@declarion/react 0.81.0 → 0.82.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/components/actions/ObjectActionBar.js +56 -54
- package/dist-lib/components/actions/PropertyGridEditor.js +56 -53
- package/dist-lib/components/actions/RowActionsKebab.js +51 -49
- package/dist-lib/components/detail-layout/AssociatedBlock.js +385 -383
- package/dist-lib/components/list/QuickPeek.js +77 -75
- package/dist-lib/components/pages/SmartDetailPage.impl.js +484 -458
- package/dist-lib/components/pages/SmartRecordListPage.impl.js +207 -206
- package/dist-lib/components/pages/list/DataCell.js +15 -15
- package/dist-lib/components/pages/list/ListFloatbar.js +55 -53
- package/dist-lib/components/pages/list/ListHeader.js +54 -52
- package/dist-lib/components/pages/list/ListTable.js +64 -64
- package/dist-lib/components/pages/list/cardProjection.js +85 -80
- package/dist-lib/components/pages/list/column-sizing.js +11 -1
- package/dist-lib/components/pages/list/use-filter-value-labels.js +29 -78
- package/dist-lib/components/pages/list/useListRowInteraction.js +78 -76
- package/dist-lib/components/pages/list/useRowMenu.js +60 -58
- package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +341 -262
- package/dist-lib/components/params/ParamsBlock.js +59 -59
- package/dist-lib/components/params/param-editors.js +114 -99
- package/dist-lib/components/shared/ConfirmDialog.js +33 -66
- package/dist-lib/components/shared/ModalFrame.js +53 -0
- package/dist-lib/hooks/useRefRecords.js +73 -0
- package/dist-lib/hooks/useRowTenant.js +12 -0
- package/dist-lib/index.d.ts +4 -3
- package/dist-lib/lib/actions.js +105 -89
- package/dist-lib/lib/mass-edit.js +13 -13
- package/dist-lib/types/schema.js +29 -22
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { coerceDisplayString as e } from "../../lib/display-value.js";
|
|
2
|
-
import {
|
|
2
|
+
import { fieldDisplayName as t, getDisplayValue as n, rowAllowsMutation as r, singlePkValues as i } from "../../types/schema.js";
|
|
3
3
|
import { useFirstScreenSettled as a } from "../../lib/capabilityPrefetch.js";
|
|
4
4
|
import { useSchema as o } from "../../hooks/useSchema.js";
|
|
5
5
|
import { textWithNodes as s } from "../../lib/language.js";
|
|
@@ -7,110 +7,111 @@ import { Icon as c } from "../primitives/Icons.js";
|
|
|
7
7
|
import { Btn as l } from "../primitives/Btn.js";
|
|
8
8
|
import { IconBtn as u } from "../primitives/IconBtn.js";
|
|
9
9
|
import { useText as d } from "../../hooks/useText.js";
|
|
10
|
-
import { useResponsiveMode as
|
|
11
|
-
import { Spinner as
|
|
12
|
-
import { TextInput as
|
|
13
|
-
import { pageInsetX as
|
|
14
|
-
import { readableSort as
|
|
15
|
-
import { stripUnsupportedSortSegments as
|
|
16
|
-
import { useObject as
|
|
17
|
-
import { useDebounce as
|
|
18
|
-
import { FileDraftScope as
|
|
19
|
-
import { getEntityFileField as
|
|
20
|
-
import { buildFilesPayload as
|
|
21
|
-
import { useUpdateObject as
|
|
22
|
-
import { useSetStatus as
|
|
23
|
-
import { useSetProperty as
|
|
24
|
-
import { countActiveFilters as
|
|
25
|
-
import { useScreenBack as
|
|
26
|
-
import { useRegisterScreenTab as
|
|
27
|
-
import { useTabSearchMirror as
|
|
28
|
-
import { DetailSkeleton as
|
|
29
|
-
import { FilterDrawer as
|
|
30
|
-
import { FilterChips as
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
10
|
+
import { useResponsiveMode as ee } from "../../hooks/useResponsiveMode.js";
|
|
11
|
+
import { Spinner as f } from "../primitives/Spinner.js";
|
|
12
|
+
import { TextInput as p } from "../primitives/Fields.js";
|
|
13
|
+
import { pageInsetX as te } from "../../lib/page-inset.js";
|
|
14
|
+
import { readableSort as ne } from "../../lib/field-classification.js";
|
|
15
|
+
import { stripUnsupportedSortSegments as re } from "../../lib/sort.js";
|
|
16
|
+
import { useObject as ie } from "../../hooks/useObject.js";
|
|
17
|
+
import { useDebounce as ae } from "../../hooks/useDebounce.js";
|
|
18
|
+
import { FileDraftScope as m, useFileDraftScope as oe } from "../file-widgets/draft-scope.js";
|
|
19
|
+
import { getEntityFileField as h, getSchemaFieldValue as g, renderSchemaField as _, schemaFieldHasValue as v, serializeSchemaFieldValue as se } from "../file-widgets/host.js";
|
|
20
|
+
import { buildFilesPayload as y, collectCommittedFileIds as b } from "../file-widgets/payload.js";
|
|
21
|
+
import { useUpdateObject as ce } from "../../hooks/useMutations.js";
|
|
22
|
+
import { useSetStatus as x } from "../../hooks/useObjectStatus.js";
|
|
23
|
+
import { useSetProperty as S } from "../../hooks/useProperties.js";
|
|
24
|
+
import { countActiveFilters as le, parseFilterURLState as ue, removeFilterAtPath as C, setFiltersInURL as w } from "../../lib/filters.js";
|
|
25
|
+
import { useScreenBack as T } from "../../hooks/useScreenBack.js";
|
|
26
|
+
import { useRegisterScreenTab as E } from "../../hooks/useRegisterScreenTab.js";
|
|
27
|
+
import { useTabSearchMirror as D } from "../../hooks/useTabSearchMirror.js";
|
|
28
|
+
import { DetailSkeleton as O } from "../shared/LoadingSkeleton.js";
|
|
29
|
+
import { FilterDrawer as k } from "../filters/FilterDrawer.js";
|
|
30
|
+
import { FilterChips as A } from "../filters/FilterChips.js";
|
|
31
|
+
import { useRowTenant as de } from "../../hooks/useRowTenant.js";
|
|
32
|
+
import { LayoutRenderer as j } from "../detail-layout/LayoutRenderer.js";
|
|
33
|
+
import { resolveCard as M, resolveListProjection as fe } from "./list/cardProjection.js";
|
|
34
|
+
import { useListFilterPresentation as pe } from "./list/useListFilterPresentation.js";
|
|
34
35
|
import { FilterOmittedNotice as N } from "../filters/FilterOmittedNotice.js";
|
|
35
36
|
import { useListQuery as P } from "./list/useListQuery.js";
|
|
36
|
-
import { listLoadErrorDescription as
|
|
37
|
+
import { listLoadErrorDescription as F } from "./list/ListNoRows.js";
|
|
37
38
|
import { useFilterValueLabels as me } from "./list/use-filter-value-labels.js";
|
|
38
|
-
import { useCallback as
|
|
39
|
-
import { Fragment as
|
|
40
|
-
import { useSearchParams as
|
|
39
|
+
import { useCallback as I, useEffect as L, useMemo as R, useRef as z, useState as B } from "react";
|
|
40
|
+
import { Fragment as he, jsx as V, jsxs as H } from "react/jsx-runtime";
|
|
41
|
+
import { useSearchParams as ge } from "react-router";
|
|
41
42
|
//#region src/components/pages/SmartRecordListPage.impl.tsx
|
|
42
|
-
var
|
|
43
|
+
var _e = 200, ve = "items:";
|
|
43
44
|
function U({ screenCode: t }) {
|
|
44
|
-
let n = d(), r = d("errors"), [i, s] =
|
|
45
|
-
|
|
46
|
-
let
|
|
45
|
+
let n = d(), r = d("errors"), [i, s] = ge(), { data: f, refetch: ie } = o(), m = ee(), [oe, h] = B(!1), g = f?.screens[t], _ = g?.entity ? f?.entities[g.entity] : void 0, v = g?.entity;
|
|
46
|
+
E(g, _, i.toString()), D(g?.route);
|
|
47
|
+
let se = T(), y = i.get("selected") ?? null, b = i.get("search") ?? "", ce = ae(b, 300), x = i.get("sort") ?? ne(_, g?.sort_default) ?? "", S = R(() => ue(i), [i]), { visibleFilterState: O, filterFieldMeta: de, allFilterFieldMeta: j, filterFieldName: ve } = pe(g, _, f?.entities, S.filters), U = O.filters, G = I((e) => {
|
|
47
48
|
s((t) => {
|
|
48
49
|
let n = new URLSearchParams(t);
|
|
49
|
-
return
|
|
50
|
+
return w(e, n), n;
|
|
50
51
|
}, { replace: !0 });
|
|
51
|
-
}, [s]), K =
|
|
52
|
-
let e =
|
|
53
|
-
return
|
|
54
|
-
}, [
|
|
55
|
-
let e =
|
|
56
|
-
return e?.list?.presentation === "table" || e?.list?.presentation === "cards" ? e.list.presentation : e?.presentation === "table" || e?.presentation === "cards" ? e.presentation :
|
|
57
|
-
}, [
|
|
58
|
-
entity:
|
|
59
|
-
screen:
|
|
60
|
-
}), [
|
|
61
|
-
entity:
|
|
62
|
-
screen:
|
|
52
|
+
}, [s]), K = R(() => g?.columns ?? _?.fields.names().filter((e) => !_.fields.get(e)?.primary && !_.fields.get(e)?.auto && _.fields.get(e)?.display?.is_listable !== !1).slice(0, 4) ?? [], [g?.columns, _]), q = R(() => {
|
|
53
|
+
let e = g?.responsive?.[m.category]?.presentation;
|
|
54
|
+
return m.category === "phone" ? "drilldown" : e === "split" || e === "drilldown" || e === "stacked" ? e : "split";
|
|
55
|
+
}, [g?.responsive, m.category]), J = R(() => {
|
|
56
|
+
let e = g?.responsive?.[m.category];
|
|
57
|
+
return e?.list?.presentation === "table" || e?.list?.presentation === "cards" ? e.list.presentation : e?.presentation === "table" || e?.presentation === "cards" ? e.presentation : m.category === "phone" ? "cards" : "table";
|
|
58
|
+
}, [g?.responsive, m.category]), be = g?.responsive?.[m.category]?.layout?.related_records, xe = R(() => M({
|
|
59
|
+
entity: _,
|
|
60
|
+
screen: g
|
|
61
|
+
}), [_, g]), Se = R(() => fe({
|
|
62
|
+
entity: _,
|
|
63
|
+
screen: g,
|
|
63
64
|
presentation: J,
|
|
64
65
|
visibleColumns: K,
|
|
65
66
|
card: xe,
|
|
66
|
-
sort:
|
|
67
|
+
sort: x
|
|
67
68
|
}), [
|
|
68
|
-
v,
|
|
69
69
|
_,
|
|
70
|
+
g,
|
|
70
71
|
J,
|
|
71
72
|
K,
|
|
72
73
|
xe,
|
|
73
|
-
|
|
74
|
+
x
|
|
74
75
|
]), Y = P({
|
|
75
|
-
entity:
|
|
76
|
-
entityCode:
|
|
77
|
-
screen:
|
|
76
|
+
entity: _,
|
|
77
|
+
entityCode: v,
|
|
78
|
+
screen: g,
|
|
78
79
|
screenCode: t,
|
|
79
80
|
page: 1,
|
|
80
|
-
perPage:
|
|
81
|
-
sortForRequest:
|
|
82
|
-
debouncedSearch:
|
|
83
|
-
filters:
|
|
81
|
+
perPage: _e,
|
|
82
|
+
sortForRequest: re(x),
|
|
83
|
+
debouncedSearch: ce,
|
|
84
|
+
filters: U,
|
|
84
85
|
includeDeleted: !1,
|
|
85
86
|
expand: Se.expandFields,
|
|
86
87
|
select: Se.selectFields,
|
|
87
|
-
isHeld: !
|
|
88
|
+
isHeld: !_,
|
|
88
89
|
retryHeld: () => {
|
|
89
|
-
|
|
90
|
+
ie();
|
|
90
91
|
},
|
|
91
92
|
runCountQuery: !1,
|
|
92
|
-
urlKey: `${
|
|
93
|
+
urlKey: `${v ?? ""}|${i.toString()}`
|
|
93
94
|
}), Ce = Y.rows, we = Y.refs, Te = Y.isLoading;
|
|
94
95
|
a(!Te);
|
|
95
|
-
let { labelFor: Ee, refs: De } = me(
|
|
96
|
+
let { labelFor: Ee, refs: De } = me(j, U, we, f?.entities), Oe = R(() => _?.fields.names().find((e) => _.fields.get(e)?.primary) ?? "id", [_]), ke = I((e, t) => {
|
|
96
97
|
s((t) => {
|
|
97
98
|
let n = new URLSearchParams(t);
|
|
98
99
|
return e ? n.set("selected", e) : n.delete("selected"), n;
|
|
99
100
|
}, { replace: t?.replace ?? !0 });
|
|
100
|
-
}, [s]), Ae =
|
|
101
|
+
}, [s]), Ae = I((e) => {
|
|
101
102
|
s((t) => {
|
|
102
103
|
let n = new URLSearchParams(t);
|
|
103
104
|
return e ? n.set("search", e) : n.delete("search"), n;
|
|
104
105
|
}, { replace: !0 });
|
|
105
|
-
}, [s]), X = (
|
|
106
|
-
|
|
106
|
+
}, [s]), X = (g?.list_resizable ?? !1) && q === "split" && m.category !== "phone" && !m.touch, je = z(null), [Z, Q] = B(null), Me = z(!1), $ = g?.list_width;
|
|
107
|
+
L(() => {
|
|
107
108
|
X && $?.endsWith("%") && Q(null);
|
|
108
109
|
}, [
|
|
109
110
|
X,
|
|
110
111
|
$,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
]),
|
|
112
|
+
m.width,
|
|
113
|
+
m.height
|
|
114
|
+
]), L(() => {
|
|
114
115
|
if (!X || Z !== null) return;
|
|
115
116
|
let e = je.current;
|
|
116
117
|
if (e) {
|
|
@@ -123,13 +124,13 @@ function U({ screenCode: t }) {
|
|
|
123
124
|
X,
|
|
124
125
|
$,
|
|
125
126
|
Z,
|
|
126
|
-
|
|
127
|
+
_
|
|
127
128
|
]);
|
|
128
|
-
let Ne =
|
|
129
|
-
|
|
129
|
+
let Ne = z(null);
|
|
130
|
+
L(() => () => {
|
|
130
131
|
Ne.current?.();
|
|
131
132
|
}, []);
|
|
132
|
-
let Pe =
|
|
133
|
+
let Pe = I((e) => {
|
|
133
134
|
e.preventDefault(), Me.current = !0;
|
|
134
135
|
let t = e.clientX, n = Z ?? 320, r = (e) => {
|
|
135
136
|
if (!Me.current) return;
|
|
@@ -140,8 +141,8 @@ function U({ screenCode: t }) {
|
|
|
140
141
|
};
|
|
141
142
|
document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", r), document.addEventListener("mouseup", i), Ne.current = i;
|
|
142
143
|
}, [Z]);
|
|
143
|
-
if (!
|
|
144
|
-
let Fe =
|
|
144
|
+
if (!f || !g || !_) return null;
|
|
145
|
+
let Fe = le(U), Ie = q === "split" || q === "stacked" || !y, Le = q === "split" || q === "stacked" || !!y, Re = q !== "split" && y ? () => ke(null, { replace: !0 }) : void 0, ze = q === "split" ? X && Z !== null ? Z : g.list_width ?? "320px" : "100%";
|
|
145
146
|
return /* @__PURE__ */ H("div", {
|
|
146
147
|
ref: je,
|
|
147
148
|
"data-record-list-presentation": q,
|
|
@@ -170,14 +171,14 @@ function U({ screenCode: t }) {
|
|
|
170
171
|
style: {
|
|
171
172
|
paddingTop: 12,
|
|
172
173
|
paddingBottom: 12,
|
|
173
|
-
...
|
|
174
|
+
...te(12),
|
|
174
175
|
display: "flex",
|
|
175
176
|
flexDirection: "column",
|
|
176
177
|
gap: 8,
|
|
177
178
|
borderBottom: "1px solid var(--divider)"
|
|
178
179
|
},
|
|
179
180
|
children: [
|
|
180
|
-
|
|
181
|
+
se.hasOriginBack && /* @__PURE__ */ H("div", {
|
|
181
182
|
style: {
|
|
182
183
|
display: "flex",
|
|
183
184
|
alignItems: "center",
|
|
@@ -186,23 +187,23 @@ function U({ screenCode: t }) {
|
|
|
186
187
|
children: [/* @__PURE__ */ V(u, {
|
|
187
188
|
icon: /* @__PURE__ */ V(c.back, { size: 14 }),
|
|
188
189
|
title: n("list.header.back", "Back"),
|
|
189
|
-
onClick:
|
|
190
|
+
onClick: se.goBack
|
|
190
191
|
}), /* @__PURE__ */ V("span", {
|
|
191
192
|
style: {
|
|
192
193
|
fontSize: 12.5,
|
|
193
194
|
fontWeight: 600,
|
|
194
195
|
color: "var(--text)"
|
|
195
196
|
},
|
|
196
|
-
children: n(
|
|
197
|
+
children: n(g.display?.name) || n(_.display.name_plural)
|
|
197
198
|
})]
|
|
198
199
|
}),
|
|
199
|
-
/* @__PURE__ */ V(
|
|
200
|
-
value:
|
|
200
|
+
/* @__PURE__ */ V(p, {
|
|
201
|
+
value: b,
|
|
201
202
|
onChange: Ae,
|
|
202
|
-
placeholder: n("list.toolbar.search_placeholder", "Search {name}…", { name: n(
|
|
203
|
+
placeholder: n("list.toolbar.search_placeholder", "Search {name}…", { name: n(_.display.name_plural) }),
|
|
203
204
|
prefix: /* @__PURE__ */ V(c.search, { size: 13 })
|
|
204
205
|
}),
|
|
205
|
-
|
|
206
|
+
S.error && /* @__PURE__ */ H("div", {
|
|
206
207
|
role: "alert",
|
|
207
208
|
"data-testid": "record-list-filter-url-error",
|
|
208
209
|
style: {
|
|
@@ -213,7 +214,7 @@ function U({ screenCode: t }) {
|
|
|
213
214
|
fontSize: 11.5
|
|
214
215
|
},
|
|
215
216
|
children: [
|
|
216
|
-
r(
|
|
217
|
+
r(S.errorCode ?? "", S.error),
|
|
217
218
|
" ",
|
|
218
219
|
n("list.filters.invalid_suffix", "Showing this list without URL filters.")
|
|
219
220
|
]
|
|
@@ -221,17 +222,17 @@ function U({ screenCode: t }) {
|
|
|
221
222
|
/* @__PURE__ */ H(l, {
|
|
222
223
|
size: "xs",
|
|
223
224
|
icon: /* @__PURE__ */ V(c.filter, { size: 12 }),
|
|
224
|
-
onClick: () =>
|
|
225
|
+
onClick: () => h(!0),
|
|
225
226
|
children: [n("filter.drawer.title", "Filters"), Fe > 0 ? ` (${Fe})` : ""]
|
|
226
227
|
}),
|
|
227
|
-
|
|
228
|
-
/* @__PURE__ */ V(
|
|
229
|
-
filters:
|
|
228
|
+
O.omitted && /* @__PURE__ */ V(N, {}),
|
|
229
|
+
/* @__PURE__ */ V(A, {
|
|
230
|
+
filters: U,
|
|
230
231
|
resolveValue: Ee,
|
|
231
|
-
fieldLabel:
|
|
232
|
-
onRemoveAtPath: (e) => G(
|
|
232
|
+
fieldLabel: ve,
|
|
233
|
+
onRemoveAtPath: (e) => G(C(U, e)),
|
|
233
234
|
onClearAll: () => G([]),
|
|
234
|
-
onChipClick: () =>
|
|
235
|
+
onChipClick: () => h(!0)
|
|
235
236
|
}),
|
|
236
237
|
/* @__PURE__ */ V("div", {
|
|
237
238
|
style: {
|
|
@@ -243,7 +244,7 @@ function U({ screenCode: t }) {
|
|
|
243
244
|
},
|
|
244
245
|
children: /* @__PURE__ */ V("span", { children: Te ? n("list.records.loading", "Loading…") : Y.isError ? r("list.rows_unreadable", "The records could not be loaded.") : n("list.records.count", "{count} {name}", {
|
|
245
246
|
count: Ce.length,
|
|
246
|
-
name: n(
|
|
247
|
+
name: n(_.display.name_plural)
|
|
247
248
|
}) })
|
|
248
249
|
})
|
|
249
250
|
]
|
|
@@ -274,7 +275,7 @@ function U({ screenCode: t }) {
|
|
|
274
275
|
padding: 16,
|
|
275
276
|
color: "var(--text-2)"
|
|
276
277
|
},
|
|
277
|
-
children: [
|
|
278
|
+
children: [F(n, r, _, Y.error), /* @__PURE__ */ V(l, {
|
|
278
279
|
size: "xs",
|
|
279
280
|
onClick: () => {
|
|
280
281
|
Y.retry();
|
|
@@ -289,16 +290,16 @@ function U({ screenCode: t }) {
|
|
|
289
290
|
color: "var(--text-3)"
|
|
290
291
|
},
|
|
291
292
|
children: n("list.records.none", "No records found")
|
|
292
|
-
}) : /* @__PURE__ */ H(
|
|
293
|
+
}) : /* @__PURE__ */ H(he, { children: [Ce.map((t) => {
|
|
293
294
|
let n = e(t[Oe]);
|
|
294
|
-
return /* @__PURE__ */ V(
|
|
295
|
+
return /* @__PURE__ */ V(W, {
|
|
295
296
|
record: t,
|
|
296
|
-
entity:
|
|
297
|
+
entity: _,
|
|
297
298
|
columns: K,
|
|
298
299
|
card: xe,
|
|
299
300
|
presentation: J,
|
|
300
301
|
refs: we,
|
|
301
|
-
isSelected: n ===
|
|
302
|
+
isSelected: n === y,
|
|
302
303
|
onClick: () => ke(n, { replace: q === "split" })
|
|
303
304
|
}, n);
|
|
304
305
|
}), Y.isCursor && Y.hasMorePages && /* @__PURE__ */ V("button", {
|
|
@@ -343,21 +344,21 @@ function U({ screenCode: t }) {
|
|
|
343
344
|
overflow: "hidden",
|
|
344
345
|
height: q === "stacked" ? "50%" : "100%"
|
|
345
346
|
},
|
|
346
|
-
children: [!Ie &&
|
|
347
|
+
children: [!Ie && O.omitted && /* @__PURE__ */ V(N, { className: "p-4" }), /* @__PURE__ */ V("div", {
|
|
347
348
|
style: {
|
|
348
349
|
flex: 1,
|
|
349
350
|
minHeight: 0
|
|
350
351
|
},
|
|
351
|
-
children:
|
|
352
|
-
entityCode:
|
|
353
|
-
recordId:
|
|
354
|
-
items:
|
|
355
|
-
schema:
|
|
356
|
-
entity:
|
|
352
|
+
children: y ? /* @__PURE__ */ V(ye, {
|
|
353
|
+
entityCode: v,
|
|
354
|
+
recordId: y,
|
|
355
|
+
items: g.items,
|
|
356
|
+
schema: f,
|
|
357
|
+
entity: _,
|
|
357
358
|
onBackToList: Re,
|
|
358
|
-
onOpenFilters: Ie ? void 0 : () =>
|
|
359
|
+
onOpenFilters: Ie ? void 0 : () => h(!0),
|
|
359
360
|
relatedRecordsPresentation: be
|
|
360
|
-
},
|
|
361
|
+
}, y) : /* @__PURE__ */ V("div", {
|
|
361
362
|
style: {
|
|
362
363
|
display: "flex",
|
|
363
364
|
alignItems: "center",
|
|
@@ -367,30 +368,30 @@ function U({ screenCode: t }) {
|
|
|
367
368
|
},
|
|
368
369
|
children: /* @__PURE__ */ V("p", {
|
|
369
370
|
style: { fontSize: 12.5 },
|
|
370
|
-
children: n("list.detail.select_prompt", "Select a {name} to view details", { name: n(
|
|
371
|
+
children: n("list.detail.select_prompt", "Select a {name} to view details", { name: n(_.display.name) })
|
|
371
372
|
})
|
|
372
373
|
})
|
|
373
374
|
})]
|
|
374
375
|
}),
|
|
375
|
-
/* @__PURE__ */ V(
|
|
376
|
-
open:
|
|
377
|
-
onClose: () =>
|
|
378
|
-
filters:
|
|
376
|
+
/* @__PURE__ */ V(k, {
|
|
377
|
+
open: oe,
|
|
378
|
+
onClose: () => h(!1),
|
|
379
|
+
filters: U,
|
|
379
380
|
onApply: G,
|
|
380
|
-
availableFields:
|
|
381
|
-
allFields:
|
|
382
|
-
fieldLabel:
|
|
381
|
+
availableFields: de,
|
|
382
|
+
allFields: j,
|
|
383
|
+
fieldLabel: ve,
|
|
383
384
|
resolveValue: Ee,
|
|
384
|
-
defaultFilters:
|
|
385
|
+
defaultFilters: g.default_filters,
|
|
385
386
|
refs: De
|
|
386
387
|
})
|
|
387
388
|
]
|
|
388
389
|
});
|
|
389
390
|
}
|
|
390
|
-
function
|
|
391
|
+
function W({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a, isSelected: o, onClick: s }) {
|
|
391
392
|
let c = d();
|
|
392
393
|
if (i === "cards") {
|
|
393
|
-
let n = r.badgeFields.filter((n) =>
|
|
394
|
+
let n = r.badgeFields.filter((n) => v(t, e, n)), i = r.bodyFields.filter((n) => v(t, e, n)), l = r.metaFields.filter((n) => v(t, e, n));
|
|
394
395
|
return /* @__PURE__ */ H("button", {
|
|
395
396
|
type: "button",
|
|
396
397
|
"data-testid": "record-list-card",
|
|
@@ -411,7 +412,7 @@ function ve({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
411
412
|
boxShadow: o ? "inset 3px 0 0 var(--accent)" : "none"
|
|
412
413
|
},
|
|
413
414
|
children: [
|
|
414
|
-
/* @__PURE__ */ V(
|
|
415
|
+
/* @__PURE__ */ V(G, {
|
|
415
416
|
entity: t,
|
|
416
417
|
record: e,
|
|
417
418
|
field: r.titleField,
|
|
@@ -423,7 +424,7 @@ function ve({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
423
424
|
color: "var(--text-3)",
|
|
424
425
|
overflowWrap: "anywhere"
|
|
425
426
|
},
|
|
426
|
-
children:
|
|
427
|
+
children: _({
|
|
427
428
|
entity: t,
|
|
428
429
|
fieldName: r.subtitleField,
|
|
429
430
|
record: e,
|
|
@@ -448,7 +449,7 @@ function ve({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
448
449
|
maxWidth: "100%",
|
|
449
450
|
overflowWrap: "anywhere"
|
|
450
451
|
},
|
|
451
|
-
children:
|
|
452
|
+
children: _({
|
|
452
453
|
entity: t,
|
|
453
454
|
fieldName: n,
|
|
454
455
|
record: e,
|
|
@@ -465,7 +466,7 @@ function ve({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
465
466
|
gap: "5px 10px",
|
|
466
467
|
margin: 0
|
|
467
468
|
},
|
|
468
|
-
children: i.map((n) => /* @__PURE__ */ V(
|
|
469
|
+
children: i.map((n) => /* @__PURE__ */ V(K, {
|
|
469
470
|
entity: t,
|
|
470
471
|
record: e,
|
|
471
472
|
fieldName: n,
|
|
@@ -485,7 +486,7 @@ function ve({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
485
486
|
minWidth: 0,
|
|
486
487
|
overflowWrap: "anywhere"
|
|
487
488
|
},
|
|
488
|
-
children:
|
|
489
|
+
children: _({
|
|
489
490
|
entity: t,
|
|
490
491
|
fieldName: n,
|
|
491
492
|
record: e,
|
|
@@ -498,7 +499,7 @@ function ve({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
498
499
|
]
|
|
499
500
|
});
|
|
500
501
|
}
|
|
501
|
-
let l = n[0], u = n[1],
|
|
502
|
+
let l = n[0], u = n[1], ee = n.slice(2, 4);
|
|
502
503
|
return /* @__PURE__ */ H("button", {
|
|
503
504
|
onClick: s,
|
|
504
505
|
style: {
|
|
@@ -531,7 +532,7 @@ function ve({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
531
532
|
whiteSpace: "nowrap",
|
|
532
533
|
color: "var(--text)"
|
|
533
534
|
},
|
|
534
|
-
children:
|
|
535
|
+
children: _({
|
|
535
536
|
entity: t,
|
|
536
537
|
fieldName: l,
|
|
537
538
|
record: e,
|
|
@@ -554,7 +555,7 @@ function ve({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
554
555
|
textOverflow: "ellipsis",
|
|
555
556
|
whiteSpace: "nowrap"
|
|
556
557
|
},
|
|
557
|
-
children:
|
|
558
|
+
children: _({
|
|
558
559
|
entity: t,
|
|
559
560
|
fieldName: u,
|
|
560
561
|
record: e,
|
|
@@ -569,9 +570,9 @@ function ve({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
569
570
|
gap: 4,
|
|
570
571
|
flexShrink: 0
|
|
571
572
|
},
|
|
572
|
-
children:
|
|
573
|
+
children: ee.map((n) => g(t, e, n) == null ? null : /* @__PURE__ */ V("div", {
|
|
573
574
|
style: { fontSize: 11 },
|
|
574
|
-
children:
|
|
575
|
+
children: _({
|
|
575
576
|
entity: t,
|
|
576
577
|
fieldName: n,
|
|
577
578
|
record: e,
|
|
@@ -584,10 +585,10 @@ function ve({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
584
585
|
})]
|
|
585
586
|
});
|
|
586
587
|
}
|
|
587
|
-
function
|
|
588
|
-
let a = d(), o =
|
|
588
|
+
function G({ entity: e, record: t, field: r, refs: i }) {
|
|
589
|
+
let a = d(), o = n(a, t, e), s = r ? _({
|
|
589
590
|
entity: e,
|
|
590
|
-
fieldName:
|
|
591
|
+
fieldName: r,
|
|
591
592
|
record: t,
|
|
592
593
|
mode: "display",
|
|
593
594
|
refs: i,
|
|
@@ -603,18 +604,18 @@ function W({ entity: e, record: t, field: n, refs: i }) {
|
|
|
603
604
|
children: s || a(e.display.name)
|
|
604
605
|
});
|
|
605
606
|
}
|
|
606
|
-
function
|
|
607
|
-
let a = d(), o =
|
|
607
|
+
function K({ entity: e, record: n, fieldName: r, refs: i }) {
|
|
608
|
+
let a = d(), o = g(e, n, r);
|
|
608
609
|
if (o == null || o === "") return null;
|
|
609
610
|
let s = e.fields.get(r);
|
|
610
|
-
return s ? /* @__PURE__ */ H(
|
|
611
|
+
return s ? /* @__PURE__ */ H(he, { children: [/* @__PURE__ */ V("dt", {
|
|
611
612
|
style: {
|
|
612
613
|
color: "var(--text-3)",
|
|
613
614
|
fontSize: 11.5,
|
|
614
615
|
minWidth: 0,
|
|
615
616
|
overflowWrap: "anywhere"
|
|
616
617
|
},
|
|
617
|
-
children:
|
|
618
|
+
children: t(a, s, r)
|
|
618
619
|
}), /* @__PURE__ */ V("dd", {
|
|
619
620
|
style: {
|
|
620
621
|
margin: 0,
|
|
@@ -623,10 +624,10 @@ function G({ entity: e, record: t, fieldName: r, refs: i }) {
|
|
|
623
624
|
minWidth: 0,
|
|
624
625
|
overflowWrap: "anywhere"
|
|
625
626
|
},
|
|
626
|
-
children:
|
|
627
|
+
children: _({
|
|
627
628
|
entity: e,
|
|
628
629
|
fieldName: r,
|
|
629
|
-
record:
|
|
630
|
+
record: n,
|
|
630
631
|
mode: "display",
|
|
631
632
|
refs: i,
|
|
632
633
|
t: a
|
|
@@ -634,7 +635,7 @@ function G({ entity: e, record: t, fieldName: r, refs: i }) {
|
|
|
634
635
|
})] }) : null;
|
|
635
636
|
}
|
|
636
637
|
function ye({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBackToList: a, onOpenFilters: o, relatedRecordsPresentation: s }) {
|
|
637
|
-
return /* @__PURE__ */ V(
|
|
638
|
+
return /* @__PURE__ */ V(m, { children: /* @__PURE__ */ V(q, {
|
|
638
639
|
entityCode: e,
|
|
639
640
|
recordId: t,
|
|
640
641
|
items: n,
|
|
@@ -645,82 +646,82 @@ function ye({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBack
|
|
|
645
646
|
relatedRecordsPresentation: s
|
|
646
647
|
}) });
|
|
647
648
|
}
|
|
648
|
-
function
|
|
649
|
-
let
|
|
649
|
+
function q({ entityCode: t, recordId: a, items: o, schema: ee, entity: p, onBackToList: ne, onOpenFilters: re, relatedRecordsPresentation: ae }) {
|
|
650
|
+
let m = d(), _ = de(p), v = R(() => a ? i(p, a) : void 0, [a, p]), { data: le, isLoading: ue } = ie(t, v), C = ce(t), w = oe(), [T, E] = B(!1), [D, k] = B({}), A = le?.data, M = r(p, "update", A, _.tenantId), fe = A?.$statuses, pe = A?.$properties, N = x(t, a), P = S(t, a), F = R(() => {
|
|
650
651
|
let e = /* @__PURE__ */ new Set();
|
|
651
|
-
for (let [t, n] of
|
|
652
|
-
for (let [t] of
|
|
652
|
+
for (let [t, n] of p.fields) !n.auto && !n.primary && e.add(t);
|
|
653
|
+
for (let [t] of p.files ?? []) e.add(t);
|
|
653
654
|
return e;
|
|
654
|
-
}, [
|
|
655
|
-
if (
|
|
655
|
+
}, [p]), me = I(() => {
|
|
656
|
+
if (A) {
|
|
656
657
|
let e = {};
|
|
657
|
-
|
|
658
|
-
let n =
|
|
659
|
-
e[t] =
|
|
660
|
-
}),
|
|
658
|
+
F.forEach((t) => {
|
|
659
|
+
let n = g(p, A, t);
|
|
660
|
+
e[t] = h(p, t) ? n ?? null : n ?? "";
|
|
661
|
+
}), k(e);
|
|
661
662
|
}
|
|
662
|
-
|
|
663
|
+
E(!0);
|
|
663
664
|
}, [
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
]),
|
|
668
|
-
await
|
|
669
|
-
}, [
|
|
670
|
-
let e = {}, t =
|
|
671
|
-
entity:
|
|
672
|
-
formData:
|
|
673
|
-
record:
|
|
665
|
+
A,
|
|
666
|
+
F,
|
|
667
|
+
p
|
|
668
|
+
]), L = I(async () => {
|
|
669
|
+
await w.flushAllDrafts(), E(!1), k({});
|
|
670
|
+
}, [w]), z = I(() => {
|
|
671
|
+
let e = {}, t = y({
|
|
672
|
+
entity: p,
|
|
673
|
+
formData: D,
|
|
674
|
+
record: A,
|
|
674
675
|
isNew: !1
|
|
675
|
-
}), n =
|
|
676
|
-
for (let [t, n] of Object.entries(
|
|
677
|
-
Object.keys(t).length > 0 && (e.$files = t), Object.keys(e).length === 0 ? (
|
|
676
|
+
}), n = b(t);
|
|
677
|
+
for (let [t, n] of Object.entries(D)) p.files?.has(t) || (e[t] = se(p, t, n));
|
|
678
|
+
Object.keys(t).length > 0 && (e.$files = t), Object.keys(e).length === 0 ? (E(!1), k({})) : C.mutate({
|
|
678
679
|
pkValues: a,
|
|
679
680
|
data: e
|
|
680
681
|
}, { onSuccess: () => {
|
|
681
|
-
n.forEach((e) =>
|
|
682
|
+
n.forEach((e) => w.markCommitted(e)), E(!1), k({});
|
|
682
683
|
} });
|
|
683
684
|
}, [
|
|
684
|
-
T,
|
|
685
685
|
w,
|
|
686
|
+
C,
|
|
686
687
|
a,
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
]),
|
|
691
|
-
|
|
688
|
+
p,
|
|
689
|
+
D,
|
|
690
|
+
A
|
|
691
|
+
]), ge = I((e, t) => {
|
|
692
|
+
k((n) => ({
|
|
692
693
|
...n,
|
|
693
694
|
[e]: t
|
|
694
695
|
}));
|
|
695
696
|
}, []);
|
|
696
|
-
if (
|
|
697
|
-
if (!
|
|
698
|
-
let
|
|
699
|
-
schema:
|
|
700
|
-
entity:
|
|
701
|
-
entityCode:
|
|
697
|
+
if (ue) return /* @__PURE__ */ V(O, {});
|
|
698
|
+
if (!A) return null;
|
|
699
|
+
let _e = n(m, A, p), U = p.display?.display_field, W = _e ? void 0 : U ? A[U] : A[p.fields.names()[0]], G = _e || (W != null && typeof W != "object" ? e(W) : m(p.display.name)), K = A?.$refs, ye = {
|
|
700
|
+
schema: ee,
|
|
701
|
+
entity: p,
|
|
702
|
+
entityCode: t,
|
|
702
703
|
recordId: a,
|
|
703
|
-
record:
|
|
704
|
-
...
|
|
705
|
-
...
|
|
706
|
-
} :
|
|
704
|
+
record: T ? {
|
|
705
|
+
...A,
|
|
706
|
+
...D
|
|
707
|
+
} : A,
|
|
707
708
|
isNew: !1,
|
|
708
|
-
mode:
|
|
709
|
-
onFieldChange:
|
|
710
|
-
refs:
|
|
711
|
-
objectProperties:
|
|
712
|
-
onSetProperty:
|
|
709
|
+
mode: T ? "edit" : "display",
|
|
710
|
+
onFieldChange: T ? ge : void 0,
|
|
711
|
+
refs: K,
|
|
712
|
+
objectProperties: pe ?? void 0,
|
|
713
|
+
onSetProperty: M ? (e, t) => P.mutate({
|
|
713
714
|
propertyCode: e,
|
|
714
715
|
value: t
|
|
715
716
|
}) : void 0,
|
|
716
|
-
isPropertyPending:
|
|
717
|
-
objectStatuses:
|
|
718
|
-
onSetStatus:
|
|
717
|
+
isPropertyPending: P.isPending,
|
|
718
|
+
objectStatuses: fe ?? void 0,
|
|
719
|
+
onSetStatus: M ? (e, t) => N.mutate({
|
|
719
720
|
groupCode: e,
|
|
720
721
|
statusCode: t
|
|
721
722
|
}) : void 0,
|
|
722
|
-
isStatusPending:
|
|
723
|
-
relatedRecordsPresentation:
|
|
723
|
+
isStatusPending: N.isPending,
|
|
724
|
+
relatedRecordsPresentation: ae
|
|
724
725
|
};
|
|
725
726
|
return /* @__PURE__ */ H("div", {
|
|
726
727
|
style: {
|
|
@@ -735,7 +736,7 @@ function K({ entityCode: n, recordId: a, items: o, schema: f, entity: m, onBackT
|
|
|
735
736
|
justifyContent: "space-between",
|
|
736
737
|
paddingTop: 10,
|
|
737
738
|
paddingBottom: 10,
|
|
738
|
-
...
|
|
739
|
+
...te(16),
|
|
739
740
|
borderBottom: "1px solid var(--divider)",
|
|
740
741
|
position: "sticky",
|
|
741
742
|
top: 0,
|
|
@@ -752,7 +753,7 @@ function K({ entityCode: n, recordId: a, items: o, schema: f, entity: m, onBackT
|
|
|
752
753
|
whiteSpace: "nowrap",
|
|
753
754
|
color: "var(--text)"
|
|
754
755
|
},
|
|
755
|
-
children:
|
|
756
|
+
children: G
|
|
756
757
|
}), /* @__PURE__ */ H("div", {
|
|
757
758
|
style: {
|
|
758
759
|
display: "flex",
|
|
@@ -760,33 +761,33 @@ function K({ entityCode: n, recordId: a, items: o, schema: f, entity: m, onBackT
|
|
|
760
761
|
gap: 6
|
|
761
762
|
},
|
|
762
763
|
children: [
|
|
763
|
-
|
|
764
|
+
ne && /* @__PURE__ */ V(u, {
|
|
764
765
|
icon: /* @__PURE__ */ V(c.back, { size: 14 }),
|
|
765
|
-
title:
|
|
766
|
-
onClick:
|
|
766
|
+
title: m("list.detail.back_to_list", "Back to list"),
|
|
767
|
+
onClick: ne
|
|
767
768
|
}),
|
|
768
|
-
|
|
769
|
+
re && /* @__PURE__ */ V(u, {
|
|
769
770
|
icon: /* @__PURE__ */ V(c.filter, { size: 14 }),
|
|
770
|
-
title:
|
|
771
|
-
onClick:
|
|
771
|
+
title: m("filter.drawer.title", "Filters"),
|
|
772
|
+
onClick: re
|
|
772
773
|
}),
|
|
773
|
-
|
|
774
|
+
M && (T ? /* @__PURE__ */ H(he, { children: [/* @__PURE__ */ V(l, {
|
|
774
775
|
size: "xs",
|
|
775
776
|
icon: /* @__PURE__ */ V(c.x, { size: 12 }),
|
|
776
|
-
onClick:
|
|
777
|
-
children:
|
|
777
|
+
onClick: L,
|
|
778
|
+
children: m("dialog.cancel", "Cancel")
|
|
778
779
|
}), /* @__PURE__ */ V(l, {
|
|
779
780
|
kind: "primary",
|
|
780
781
|
size: "xs",
|
|
781
|
-
icon:
|
|
782
|
-
onClick:
|
|
783
|
-
disabled:
|
|
784
|
-
children:
|
|
782
|
+
icon: C.isPending ? /* @__PURE__ */ V(f, { size: 12 }) : /* @__PURE__ */ V(c.save, { size: 12 }),
|
|
783
|
+
onClick: z,
|
|
784
|
+
disabled: C.isPending,
|
|
785
|
+
children: C.isPending ? m("dialog.saving", "Saving…") : m("dialog.save", "Save")
|
|
785
786
|
})] }) : /* @__PURE__ */ V(l, {
|
|
786
787
|
size: "xs",
|
|
787
788
|
icon: /* @__PURE__ */ V(c.edit, { size: 12 }),
|
|
788
|
-
onClick:
|
|
789
|
-
children:
|
|
789
|
+
onClick: me,
|
|
790
|
+
children: m("list.record.edit", "Edit")
|
|
790
791
|
}))
|
|
791
792
|
]
|
|
792
793
|
})]
|
|
@@ -796,20 +797,20 @@ function K({ entityCode: n, recordId: a, items: o, schema: f, entity: m, onBackT
|
|
|
796
797
|
overflowY: "auto",
|
|
797
798
|
paddingTop: 16,
|
|
798
799
|
paddingBottom: 16,
|
|
799
|
-
...
|
|
800
|
+
...te(16),
|
|
800
801
|
display: "flex",
|
|
801
802
|
flexDirection: "column",
|
|
802
803
|
gap: 12
|
|
803
804
|
},
|
|
804
|
-
children: o && o.length > 0 ? /* @__PURE__ */ V(
|
|
805
|
+
children: o && o.length > 0 ? /* @__PURE__ */ V(j, {
|
|
805
806
|
nodes: o,
|
|
806
|
-
ctx:
|
|
807
|
+
ctx: ye
|
|
807
808
|
}) : /* @__PURE__ */ V("p", {
|
|
808
809
|
style: {
|
|
809
810
|
fontSize: 12.5,
|
|
810
811
|
color: "var(--text-3)"
|
|
811
812
|
},
|
|
812
|
-
children: s(
|
|
813
|
+
children: s(m("list.detail.no_layout", "No layout configured. Add {key} to the screen definition."), { key: /* @__PURE__ */ V("code", { children: ve }) })
|
|
813
814
|
})
|
|
814
815
|
})]
|
|
815
816
|
});
|