@declarion/react 0.250.0 → 0.252.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/chrome/PageShell.js +26 -20
- package/dist-lib/components/fields/JsonField.js +109 -24
- package/dist-lib/components/fields/StructureField.js +38 -33
- package/dist-lib/components/fields/cells/factories/duration.js +44 -0
- package/dist-lib/components/fields/cells/registry.js +34 -32
- package/dist-lib/components/pages/SmartListPage.impl.js +280 -279
- package/dist-lib/components/pages/SmartRecordListPage.impl.js +293 -292
- package/dist-lib/components/primitives/IconBtn.js +2 -0
- package/dist-lib/declarion-react.css +1 -1
- package/dist-lib/hooks/useResponsiveMode.js +1 -1
- package/dist-lib/hooks/useSearchDraft.js +12 -0
- package/dist-lib/index.d.ts +2 -2
- package/dist-lib/index.js +130 -130
- package/dist-lib/testing.d.ts +1 -1
- package/dist-lib/{useResponsiveMode-BGMnPC4S.d.ts → useResponsiveMode-DjoWkC2n.d.ts} +3 -1
- package/package.json +1 -1
|
@@ -1,212 +1,213 @@
|
|
|
1
1
|
import { useFirstScreenSettled as e } from "../../lib/capabilityPrefetch.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
2
|
+
import { useSearchDraft as t } from "../../hooks/useSearchDraft.js";
|
|
3
|
+
import { Btn as n } from "../primitives/Btn.js";
|
|
4
|
+
import { Icon as r } from "../primitives/Icons.js";
|
|
5
|
+
import { IconBtn as i } from "../primitives/IconBtn.js";
|
|
6
|
+
import { Spinner as a } from "../primitives/Spinner.js";
|
|
7
|
+
import { TextInput as o } from "../primitives/Fields.js";
|
|
8
|
+
import { RetryButton as s } from "../primitives/RetryButton.js";
|
|
9
|
+
import { readDisplayState as c } from "../../lib/read-display-state.js";
|
|
10
|
+
import { failureTitle as l } from "../../lib/failure.js";
|
|
11
|
+
import { useScreenBack as u } from "../../hooks/useScreenBack.js";
|
|
12
|
+
import { useTabSearchMirror as d } from "../../hooks/useTabSearchMirror.js";
|
|
13
|
+
import { useRegisterScreenTab as ee } from "../../hooks/useRegisterScreenTab.js";
|
|
14
|
+
import { useSchema as te } from "../../hooks/useSchema.js";
|
|
14
15
|
import { useObject as f } from "../../hooks/useObject.js";
|
|
15
16
|
import { useUpdateObject as p } from "../../hooks/useMutations.js";
|
|
16
|
-
import { useSetStatus as
|
|
17
|
+
import { useSetStatus as ne } from "../../hooks/useObjectStatus.js";
|
|
17
18
|
import { useSetProperty as m } from "../../hooks/useProperties.js";
|
|
18
|
-
import { useDebounce as
|
|
19
|
-
import { useResponsiveMode as
|
|
20
|
-
import { FileDraftScope as
|
|
19
|
+
import { useDebounce as re } from "../../hooks/useDebounce.js";
|
|
20
|
+
import { useResponsiveMode as h } from "../../hooks/useResponsiveMode.js";
|
|
21
|
+
import { FileDraftScope as ie, useFileDraftScope as g } from "../file-widgets/draft-scope.js";
|
|
21
22
|
import { buildFilesPayload as _, collectCommittedFileIds as v } from "../file-widgets/payload.js";
|
|
22
|
-
import { getEntityFileField as
|
|
23
|
-
import { countActiveFilters as oe, parseFilterURLState as se, removeFilterAtPath as
|
|
24
|
-
import { DetailSkeleton as
|
|
25
|
-
import { LayoutRenderer as
|
|
26
|
-
import { coerceDisplayString as
|
|
27
|
-
import { fieldDisplayName as
|
|
28
|
-
import { pageInsetX as
|
|
29
|
-
import { resolveCard as
|
|
30
|
-
import { useListQuery as
|
|
31
|
-
import { stripUnsupportedSortSegments as
|
|
32
|
-
import { readableSort as
|
|
33
|
-
import { useText as
|
|
34
|
-
import { useRowTenant as
|
|
35
|
-
import { textWithNodes as
|
|
23
|
+
import { getEntityFileField as y, getSchemaFieldValue as b, renderSchemaField as x, schemaFieldHasValue as S, serializeSchemaFieldValue as ae } from "../file-widgets/host.js";
|
|
24
|
+
import { countActiveFilters as oe, parseFilterURLState as se, removeFilterAtPath as C, setFiltersInURL as w } from "../../lib/filters.js";
|
|
25
|
+
import { DetailSkeleton as T } from "../shared/LoadingSkeleton.js";
|
|
26
|
+
import { LayoutRenderer as E } from "../detail-layout/LayoutRenderer.js";
|
|
27
|
+
import { coerceDisplayString as ce } from "../../lib/display-value.js";
|
|
28
|
+
import { fieldDisplayName as D, getDisplayValue as le, isUserEditableField as ue, rowAllowsMutation as de, singlePkValues as O } from "../../types/schema.js";
|
|
29
|
+
import { pageInsetX as fe } from "../../lib/page-inset.js";
|
|
30
|
+
import { resolveCard as k, resolveListProjection as A } from "./list/cardProjection.js";
|
|
31
|
+
import { useListQuery as j } from "./list/useListQuery.js";
|
|
32
|
+
import { stripUnsupportedSortSegments as M } from "../../lib/sort.js";
|
|
33
|
+
import { readableSort as N } from "../../lib/field-classification.js";
|
|
34
|
+
import { useText as P } from "../../hooks/useText.js";
|
|
35
|
+
import { useRowTenant as pe } from "../../hooks/useRowTenant.js";
|
|
36
|
+
import { textWithNodes as me } from "../../lib/language.js";
|
|
36
37
|
import { FilterChips as F } from "../filters/FilterChips.js";
|
|
37
|
-
import { FilterDrawer as
|
|
38
|
-
import { useFilterValueLabels as
|
|
39
|
-
import { useListFilterPresentation as
|
|
40
|
-
import { FilterOmittedNotice as
|
|
41
|
-
import { listLoadErrorDescription as
|
|
42
|
-
import { useCallback as
|
|
43
|
-
import { Fragment as
|
|
44
|
-
import { useSearchParams as
|
|
38
|
+
import { FilterDrawer as he } from "../filters/FilterDrawer.js";
|
|
39
|
+
import { useFilterValueLabels as ge } from "./list/use-filter-value-labels.js";
|
|
40
|
+
import { useListFilterPresentation as _e } from "./list/useListFilterPresentation.js";
|
|
41
|
+
import { FilterOmittedNotice as I } from "../filters/FilterOmittedNotice.js";
|
|
42
|
+
import { listLoadErrorDescription as ve } from "./list/ListNoRows.js";
|
|
43
|
+
import { useCallback as L, useEffect as R, useMemo as z, useRef as B, useState as V } from "react";
|
|
44
|
+
import { Fragment as ye, jsx as H, jsxs as U } from "react/jsx-runtime";
|
|
45
|
+
import { useSearchParams as be } from "react-router";
|
|
45
46
|
// src/components/pages/SmartRecordListPage.impl.tsx
|
|
46
|
-
var
|
|
47
|
-
function
|
|
48
|
-
let
|
|
49
|
-
|
|
50
|
-
let
|
|
47
|
+
var xe = 200, W = "items:";
|
|
48
|
+
function G({ screenCode: a }) {
|
|
49
|
+
let s = P(), c = P("errors"), [l, f] = be(), { data: p, refetch: ne } = te(), m = h(), [ie, g] = V(!1), _ = p?.screens[a], v = _?.entity ? p?.entities[_.entity] : void 0, y = _?.entity;
|
|
50
|
+
ee(_, v, l.toString()), d(_?.route);
|
|
51
|
+
let b = u(), x = l.get("selected") ?? null, S = l.get("search") ?? "", ae = re(S, 300), T = l.get("sort") ?? N(v, _?.sort_default) ?? "", E = z(() => se(l), [l]), { visibleFilterState: D, filterFieldMeta: le, allFilterFieldMeta: ue, filterFieldName: de } = _e(_, v, p?.entities, E.filters), O = D.filters, pe = L((e) => {
|
|
51
52
|
f((t) => {
|
|
52
53
|
let n = new URLSearchParams(t);
|
|
53
|
-
return
|
|
54
|
+
return w(e, n), n;
|
|
54
55
|
}, { replace: !0 });
|
|
55
|
-
}, [f]),
|
|
56
|
+
}, [f]), me = z(() => _?.columns ?? v?.fields.names().filter((e) => !v.fields.get(e)?.primary && !v.fields.get(e)?.auto && v.fields.get(e)?.display?.is_listable !== !1).slice(0, 4) ?? [], [_?.columns, v]), W = z(() => {
|
|
56
57
|
let e = _?.responsive?.[m.category]?.presentation;
|
|
57
58
|
return m.category === "phone" ? "drilldown" : e === "split" || e === "drilldown" || e === "stacked" ? e : "split";
|
|
58
|
-
}, [_?.responsive, m.category]),
|
|
59
|
+
}, [_?.responsive, m.category]), G = z(() => {
|
|
59
60
|
let e = _?.responsive?.[m.category];
|
|
60
61
|
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";
|
|
61
|
-
}, [_?.responsive, m.category]),
|
|
62
|
+
}, [_?.responsive, m.category]), K = _?.responsive?.[m.category]?.layout?.related_records, q = z(() => k({
|
|
62
63
|
entity: v,
|
|
63
64
|
screen: _
|
|
64
|
-
}), [v, _]),
|
|
65
|
+
}), [v, _]), J = z(() => A({
|
|
65
66
|
entity: v,
|
|
66
67
|
screen: _,
|
|
67
|
-
presentation:
|
|
68
|
-
visibleColumns:
|
|
68
|
+
presentation: G,
|
|
69
|
+
visibleColumns: me,
|
|
69
70
|
card: q,
|
|
70
|
-
sort:
|
|
71
|
+
sort: T
|
|
71
72
|
}), [
|
|
72
73
|
v,
|
|
73
74
|
_,
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
G,
|
|
76
|
+
me,
|
|
76
77
|
q,
|
|
77
|
-
|
|
78
|
-
]),
|
|
78
|
+
T
|
|
79
|
+
]), Y = j({
|
|
79
80
|
entity: v,
|
|
80
|
-
entityCode:
|
|
81
|
+
entityCode: y,
|
|
81
82
|
screen: _,
|
|
82
|
-
screenCode:
|
|
83
|
+
screenCode: a,
|
|
83
84
|
page: 1,
|
|
84
|
-
perPage:
|
|
85
|
-
sortForRequest:
|
|
85
|
+
perPage: xe,
|
|
86
|
+
sortForRequest: M(T),
|
|
86
87
|
debouncedSearch: ae,
|
|
87
|
-
filters:
|
|
88
|
+
filters: O,
|
|
88
89
|
includeDeleted: !1,
|
|
89
|
-
expand:
|
|
90
|
-
select:
|
|
90
|
+
expand: J.expandFields,
|
|
91
|
+
select: J.selectFields,
|
|
91
92
|
isHeld: !v,
|
|
92
93
|
retryHeld: () => {
|
|
93
|
-
|
|
94
|
+
ne();
|
|
94
95
|
},
|
|
95
96
|
runCountQuery: !1,
|
|
96
|
-
urlKey: `${
|
|
97
|
-
}), we =
|
|
98
|
-
e(!
|
|
99
|
-
let { labelFor: Ee, refs: De } =
|
|
97
|
+
urlKey: `${y ?? ""}|${l.toString()}`
|
|
98
|
+
}), we = Y.rows, Te = Y.refs, X = Y.isLoading;
|
|
99
|
+
e(!X);
|
|
100
|
+
let { labelFor: Ee, refs: De } = ge(ue, O, Te, p?.entities), Oe = z(() => v?.fields.names().find((e) => v.fields.get(e)?.primary) ?? "id", [v]), ke = L((e, t) => {
|
|
100
101
|
f((t) => {
|
|
101
102
|
let n = new URLSearchParams(t);
|
|
102
103
|
return e ? n.set("selected", e) : n.delete("selected"), n;
|
|
103
104
|
}, { replace: t?.replace ?? !0 });
|
|
104
|
-
}, [f]), Ae =
|
|
105
|
+
}, [f]), Ae = L((e) => {
|
|
105
106
|
f((t) => {
|
|
106
107
|
let n = new URLSearchParams(t);
|
|
107
108
|
return e ? n.set("search", e) : n.delete("search"), n;
|
|
108
109
|
}, { replace: !0 });
|
|
109
|
-
}, [f]),
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
}, [f]), [je, Me] = t(S, Ae), Z = (_?.list_resizable ?? !1) && W === "split" && m.category !== "phone" && !m.touch, Ne = B(null), [Q, Pe] = V(null), Fe = B(!1), $ = _?.list_width;
|
|
111
|
+
R(() => {
|
|
112
|
+
Z && $?.endsWith("%") && Pe(null);
|
|
112
113
|
}, [
|
|
113
|
-
|
|
114
|
+
Z,
|
|
114
115
|
$,
|
|
115
116
|
m.width,
|
|
116
117
|
m.height
|
|
117
|
-
]),
|
|
118
|
-
if (!
|
|
119
|
-
let e =
|
|
118
|
+
]), R(() => {
|
|
119
|
+
if (!Z || Q !== null) return;
|
|
120
|
+
let e = Ne.current;
|
|
120
121
|
if (e) {
|
|
121
122
|
if ($ && $.endsWith("%")) {
|
|
122
123
|
let t = parseFloat($) / 100;
|
|
123
|
-
|
|
124
|
-
} else
|
|
124
|
+
Pe(Math.round(e.getBoundingClientRect().width * t));
|
|
125
|
+
} else Pe($ && parseInt($, 10) || 320);
|
|
125
126
|
}
|
|
126
127
|
}, [
|
|
127
|
-
X,
|
|
128
|
-
$,
|
|
129
128
|
Z,
|
|
129
|
+
$,
|
|
130
|
+
Q,
|
|
130
131
|
v
|
|
131
132
|
]);
|
|
132
|
-
let
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
let Ie = B(null);
|
|
134
|
+
R(() => () => {
|
|
135
|
+
Ie.current?.();
|
|
135
136
|
}, []);
|
|
136
|
-
let
|
|
137
|
-
e.preventDefault(),
|
|
138
|
-
let t = e.clientX, n =
|
|
139
|
-
if (!
|
|
140
|
-
let r = (
|
|
141
|
-
|
|
137
|
+
let Le = L((e) => {
|
|
138
|
+
e.preventDefault(), Fe.current = !0;
|
|
139
|
+
let t = e.clientX, n = Q ?? 320, r = (e) => {
|
|
140
|
+
if (!Fe.current) return;
|
|
141
|
+
let r = (Ne.current?.getBoundingClientRect().width ?? window.innerWidth) - 300, i = Math.max(200, Math.min(r, n + e.clientX - t));
|
|
142
|
+
Pe(i);
|
|
142
143
|
}, i = () => {
|
|
143
|
-
|
|
144
|
+
Fe.current = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i), document.body.style.cursor = "", document.body.style.userSelect = "", Ie.current = null;
|
|
144
145
|
};
|
|
145
|
-
document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", r), document.addEventListener("mouseup", i),
|
|
146
|
-
}, [
|
|
146
|
+
document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", r), document.addEventListener("mouseup", i), Ie.current = i;
|
|
147
|
+
}, [Q]);
|
|
147
148
|
if (!p || !_ || !v) return null;
|
|
148
|
-
let
|
|
149
|
-
return /* @__PURE__ */
|
|
150
|
-
ref:
|
|
151
|
-
"data-record-list-presentation":
|
|
149
|
+
let Re = oe(O), ze = W === "split" || W === "stacked" || !x, Be = W === "split" || W === "stacked" || !!x, Ve = W !== "split" && x ? () => ke(null, { replace: !0 }) : void 0, He = W === "split" ? Z && Q !== null ? Q : _.list_width ?? "320px" : "100%";
|
|
150
|
+
return /* @__PURE__ */ U("div", {
|
|
151
|
+
ref: Ne,
|
|
152
|
+
"data-record-list-presentation": W,
|
|
152
153
|
style: {
|
|
153
154
|
display: "flex",
|
|
154
|
-
flexDirection:
|
|
155
|
+
flexDirection: W === "stacked" ? "column" : "row",
|
|
155
156
|
height: "100%",
|
|
156
157
|
minWidth: 0,
|
|
157
158
|
overflow: "hidden"
|
|
158
159
|
},
|
|
159
160
|
children: [
|
|
160
|
-
|
|
161
|
+
ze && /* @__PURE__ */ U("div", {
|
|
161
162
|
"data-testid": "record-list-panel",
|
|
162
163
|
style: {
|
|
163
|
-
flex:
|
|
164
|
+
flex: W === "split" ? "none" : "1 1 auto",
|
|
164
165
|
display: "flex",
|
|
165
166
|
flexDirection: "column",
|
|
166
167
|
overflow: "hidden",
|
|
167
|
-
borderRight:
|
|
168
|
-
borderBottom:
|
|
169
|
-
width:
|
|
168
|
+
borderRight: W === "split" && !Z ? "1px solid var(--divider)" : "none",
|
|
169
|
+
borderBottom: W === "stacked" ? "1px solid var(--divider)" : "none",
|
|
170
|
+
width: He,
|
|
170
171
|
minWidth: 0,
|
|
171
|
-
height:
|
|
172
|
+
height: W === "stacked" ? "50%" : "100%"
|
|
172
173
|
},
|
|
173
|
-
children: [/* @__PURE__ */
|
|
174
|
+
children: [/* @__PURE__ */ U("div", {
|
|
174
175
|
style: {
|
|
175
176
|
paddingTop: 12,
|
|
176
177
|
paddingBottom: 12,
|
|
177
|
-
...
|
|
178
|
+
...fe(12),
|
|
178
179
|
display: "flex",
|
|
179
180
|
flexDirection: "column",
|
|
180
181
|
gap: 8,
|
|
181
182
|
borderBottom: "1px solid var(--divider)"
|
|
182
183
|
},
|
|
183
184
|
children: [
|
|
184
|
-
|
|
185
|
+
b.hasOriginBack && /* @__PURE__ */ U("div", {
|
|
185
186
|
style: {
|
|
186
187
|
display: "flex",
|
|
187
188
|
alignItems: "center",
|
|
188
189
|
gap: 8
|
|
189
190
|
},
|
|
190
|
-
children: [/* @__PURE__ */
|
|
191
|
-
icon: /* @__PURE__ */
|
|
192
|
-
title:
|
|
193
|
-
onClick:
|
|
194
|
-
}), /* @__PURE__ */
|
|
191
|
+
children: [/* @__PURE__ */ H(i, {
|
|
192
|
+
icon: /* @__PURE__ */ H(r.back, { size: 14 }),
|
|
193
|
+
title: s("list.header.back", "Back"),
|
|
194
|
+
onClick: b.goBack
|
|
195
|
+
}), /* @__PURE__ */ H("span", {
|
|
195
196
|
style: {
|
|
196
197
|
fontSize: 12.5,
|
|
197
198
|
fontWeight: 600,
|
|
198
199
|
color: "var(--text)"
|
|
199
200
|
},
|
|
200
|
-
children:
|
|
201
|
+
children: s(_.display?.name) || s(v.display.name_plural)
|
|
201
202
|
})]
|
|
202
203
|
}),
|
|
203
|
-
/* @__PURE__ */
|
|
204
|
-
value:
|
|
205
|
-
onChange:
|
|
206
|
-
placeholder:
|
|
207
|
-
prefix: /* @__PURE__ */
|
|
204
|
+
/* @__PURE__ */ H(o, {
|
|
205
|
+
value: je,
|
|
206
|
+
onChange: Me,
|
|
207
|
+
placeholder: s("list.toolbar.search_placeholder", "Search {name}…", { name: s(v.display.name_plural) }),
|
|
208
|
+
prefix: /* @__PURE__ */ H(r.search, { size: 13 })
|
|
208
209
|
}),
|
|
209
|
-
|
|
210
|
+
E.error && /* @__PURE__ */ U("div", {
|
|
210
211
|
role: "alert",
|
|
211
212
|
"data-testid": "record-list-filter-url-error",
|
|
212
213
|
style: {
|
|
@@ -217,27 +218,27 @@ function K({ screenCode: i }) {
|
|
|
217
218
|
fontSize: 11.5
|
|
218
219
|
},
|
|
219
220
|
children: [
|
|
220
|
-
|
|
221
|
+
c(E.errorCode ?? "", E.error),
|
|
221
222
|
" ",
|
|
222
|
-
|
|
223
|
+
s("list.filters.invalid_suffix", "Showing this list without URL filters.")
|
|
223
224
|
]
|
|
224
225
|
}),
|
|
225
|
-
/* @__PURE__ */
|
|
226
|
+
/* @__PURE__ */ U(n, {
|
|
226
227
|
size: "xs",
|
|
227
|
-
icon: /* @__PURE__ */
|
|
228
|
+
icon: /* @__PURE__ */ H(r.filter, { size: 12 }),
|
|
228
229
|
onClick: () => g(!0),
|
|
229
|
-
children: [
|
|
230
|
+
children: [s("filter.drawer.title", "Filters"), Re > 0 ? ` (${Re})` : ""]
|
|
230
231
|
}),
|
|
231
|
-
|
|
232
|
-
/* @__PURE__ */
|
|
233
|
-
filters:
|
|
232
|
+
D.omitted && /* @__PURE__ */ H(I, {}),
|
|
233
|
+
/* @__PURE__ */ H(F, {
|
|
234
|
+
filters: O,
|
|
234
235
|
resolveValue: Ee,
|
|
235
|
-
fieldLabel:
|
|
236
|
-
onRemoveAtPath: (e) =>
|
|
237
|
-
onClearAll: () =>
|
|
236
|
+
fieldLabel: de,
|
|
237
|
+
onRemoveAtPath: (e) => pe(C(O, e)),
|
|
238
|
+
onClearAll: () => pe([]),
|
|
238
239
|
onChipClick: () => g(!0)
|
|
239
240
|
}),
|
|
240
|
-
/* @__PURE__ */
|
|
241
|
+
/* @__PURE__ */ H("div", {
|
|
241
242
|
style: {
|
|
242
243
|
display: "flex",
|
|
243
244
|
alignItems: "center",
|
|
@@ -245,88 +246,88 @@ function K({ screenCode: i }) {
|
|
|
245
246
|
fontSize: 11,
|
|
246
247
|
color: "var(--text-3)"
|
|
247
248
|
},
|
|
248
|
-
children: /* @__PURE__ */
|
|
249
|
+
children: /* @__PURE__ */ H("span", { children: X ? s("list.records.loading", "Loading…") : Y.isError ? c("list.rows_unreadable", "The records could not be loaded.") : s("list.records.count", "{count} {name}", {
|
|
249
250
|
count: we.length,
|
|
250
|
-
name:
|
|
251
|
+
name: s(v.display.name_plural)
|
|
251
252
|
}) })
|
|
252
253
|
})
|
|
253
254
|
]
|
|
254
|
-
}), /* @__PURE__ */
|
|
255
|
+
}), /* @__PURE__ */ H("div", {
|
|
255
256
|
style: {
|
|
256
257
|
flex: 1,
|
|
257
258
|
overflowY: "auto",
|
|
258
|
-
padding:
|
|
259
|
-
display:
|
|
259
|
+
padding: G === "cards" ? 10 : 0,
|
|
260
|
+
display: G === "cards" ? "flex" : "block",
|
|
260
261
|
flexDirection: "column",
|
|
261
|
-
gap:
|
|
262
|
+
gap: G === "cards" ? 10 : void 0
|
|
262
263
|
},
|
|
263
|
-
children:
|
|
264
|
+
children: X && Y.isLoadingStale ? /* @__PURE__ */ U("div", {
|
|
264
265
|
role: "alert",
|
|
265
266
|
style: {
|
|
266
267
|
padding: 16,
|
|
267
268
|
color: "var(--text-2)"
|
|
268
269
|
},
|
|
269
270
|
children: [
|
|
270
|
-
|
|
271
|
+
s("list.rows.loading_slow_title", "Still loading data"),
|
|
271
272
|
" ",
|
|
272
|
-
/* @__PURE__ */
|
|
273
|
+
/* @__PURE__ */ H(n, {
|
|
273
274
|
size: "xs",
|
|
274
275
|
onClick: () => {
|
|
275
|
-
|
|
276
|
+
Y.retry();
|
|
276
277
|
},
|
|
277
|
-
children:
|
|
278
|
+
children: s("list.rows.retry", "Retry")
|
|
278
279
|
})
|
|
279
280
|
]
|
|
280
|
-
}) :
|
|
281
|
+
}) : X ? /* @__PURE__ */ H("div", {
|
|
281
282
|
style: {
|
|
282
283
|
padding: 12,
|
|
283
284
|
display: "flex",
|
|
284
285
|
flexDirection: "column",
|
|
285
286
|
gap: 6
|
|
286
287
|
},
|
|
287
|
-
children: Array.from({ length: 8 }).map((e, t) => /* @__PURE__ */
|
|
288
|
+
children: Array.from({ length: 8 }).map((e, t) => /* @__PURE__ */ H("div", { style: {
|
|
288
289
|
height: 48,
|
|
289
290
|
borderRadius: "var(--radius-md)",
|
|
290
291
|
background: "var(--surface-3)"
|
|
291
292
|
} }, t))
|
|
292
|
-
}) :
|
|
293
|
+
}) : Y.isError ? /* @__PURE__ */ U("div", {
|
|
293
294
|
role: "alert",
|
|
294
295
|
style: {
|
|
295
296
|
padding: 16,
|
|
296
297
|
color: "var(--text-2)"
|
|
297
298
|
},
|
|
298
|
-
children: [
|
|
299
|
+
children: [ve(s, c, v, Y.error), /* @__PURE__ */ H(n, {
|
|
299
300
|
size: "xs",
|
|
300
301
|
onClick: () => {
|
|
301
|
-
|
|
302
|
+
Y.retry();
|
|
302
303
|
},
|
|
303
|
-
children:
|
|
304
|
+
children: s("list.rows.retry", "Retry")
|
|
304
305
|
})]
|
|
305
|
-
}) : we.length === 0 ? /* @__PURE__ */
|
|
306
|
+
}) : we.length === 0 ? /* @__PURE__ */ H("div", {
|
|
306
307
|
style: {
|
|
307
308
|
padding: 28,
|
|
308
309
|
textAlign: "center",
|
|
309
310
|
fontSize: 12.5,
|
|
310
311
|
color: "var(--text-3)"
|
|
311
312
|
},
|
|
312
|
-
children:
|
|
313
|
-
}) : /* @__PURE__ */
|
|
314
|
-
let t =
|
|
315
|
-
return /* @__PURE__ */
|
|
313
|
+
children: s("list.records.none", "No records found")
|
|
314
|
+
}) : /* @__PURE__ */ U(ye, { children: [we.map((e) => {
|
|
315
|
+
let t = ce(e[Oe]);
|
|
316
|
+
return /* @__PURE__ */ H(Se, {
|
|
316
317
|
record: e,
|
|
317
318
|
entity: v,
|
|
318
|
-
columns:
|
|
319
|
+
columns: me,
|
|
319
320
|
card: q,
|
|
320
|
-
presentation:
|
|
321
|
+
presentation: G,
|
|
321
322
|
refs: Te,
|
|
322
|
-
isSelected: t ===
|
|
323
|
-
onClick: () => ke(t, { replace:
|
|
323
|
+
isSelected: t === x,
|
|
324
|
+
onClick: () => ke(t, { replace: W === "split" })
|
|
324
325
|
}, t);
|
|
325
|
-
}),
|
|
326
|
+
}), Y.isCursor && Y.hasMorePages && /* @__PURE__ */ H("button", {
|
|
326
327
|
type: "button",
|
|
327
328
|
"data-testid": "record-list-load-more",
|
|
328
|
-
onClick:
|
|
329
|
-
disabled:
|
|
329
|
+
onClick: Y.fetchNextPage,
|
|
330
|
+
disabled: Y.isFetchingNextPage,
|
|
330
331
|
style: {
|
|
331
332
|
width: "100%",
|
|
332
333
|
padding: "8px 12px",
|
|
@@ -335,15 +336,15 @@ function K({ screenCode: i }) {
|
|
|
335
336
|
border: "none",
|
|
336
337
|
borderTop: "1px solid var(--divider)",
|
|
337
338
|
color: "var(--text-2)",
|
|
338
|
-
cursor:
|
|
339
|
+
cursor: Y.isFetchingNextPage ? "default" : "pointer"
|
|
339
340
|
},
|
|
340
|
-
children:
|
|
341
|
+
children: Y.isFetchingNextPage ? s("list.records.loading", "Loading…") : s("list.footer.load_more", "Load more")
|
|
341
342
|
})] })
|
|
342
343
|
})]
|
|
343
344
|
}),
|
|
344
|
-
|
|
345
|
+
Z && /* @__PURE__ */ H("div", {
|
|
345
346
|
"data-testid": "record-list-resize-handle",
|
|
346
|
-
onMouseDown:
|
|
347
|
+
onMouseDown: Le,
|
|
347
348
|
style: {
|
|
348
349
|
flex: "none",
|
|
349
350
|
width: 1,
|
|
@@ -354,7 +355,7 @@ function K({ screenCode: i }) {
|
|
|
354
355
|
onMouseEnter: (e) => e.currentTarget.style.background = "var(--border-strong)",
|
|
355
356
|
onMouseLeave: (e) => e.currentTarget.style.background = "var(--divider)"
|
|
356
357
|
}),
|
|
357
|
-
|
|
358
|
+
Be && /* @__PURE__ */ U("div", {
|
|
358
359
|
"data-testid": "record-detail-panel",
|
|
359
360
|
style: {
|
|
360
361
|
flex: 1,
|
|
@@ -362,23 +363,23 @@ function K({ screenCode: i }) {
|
|
|
362
363
|
flexDirection: "column",
|
|
363
364
|
minWidth: 0,
|
|
364
365
|
overflow: "hidden",
|
|
365
|
-
height:
|
|
366
|
+
height: W === "stacked" ? "50%" : "100%"
|
|
366
367
|
},
|
|
367
|
-
children: [!
|
|
368
|
+
children: [!ze && D.omitted && /* @__PURE__ */ H(I, { className: "p-4" }), /* @__PURE__ */ H("div", {
|
|
368
369
|
style: {
|
|
369
370
|
flex: 1,
|
|
370
371
|
minHeight: 0
|
|
371
372
|
},
|
|
372
|
-
children:
|
|
373
|
-
entityCode:
|
|
374
|
-
recordId:
|
|
373
|
+
children: x ? /* @__PURE__ */ H(Ce, {
|
|
374
|
+
entityCode: y,
|
|
375
|
+
recordId: x,
|
|
375
376
|
items: _.items,
|
|
376
377
|
schema: p,
|
|
377
378
|
entity: v,
|
|
378
|
-
onBackToList:
|
|
379
|
-
onOpenFilters:
|
|
380
|
-
relatedRecordsPresentation:
|
|
381
|
-
},
|
|
379
|
+
onBackToList: Ve,
|
|
380
|
+
onOpenFilters: ze ? void 0 : () => g(!0),
|
|
381
|
+
relatedRecordsPresentation: K
|
|
382
|
+
}, x) : /* @__PURE__ */ H("div", {
|
|
382
383
|
style: {
|
|
383
384
|
display: "flex",
|
|
384
385
|
alignItems: "center",
|
|
@@ -386,21 +387,21 @@ function K({ screenCode: i }) {
|
|
|
386
387
|
height: "100%",
|
|
387
388
|
color: "var(--text-3)"
|
|
388
389
|
},
|
|
389
|
-
children: /* @__PURE__ */
|
|
390
|
+
children: /* @__PURE__ */ H("p", {
|
|
390
391
|
style: { fontSize: 12.5 },
|
|
391
|
-
children:
|
|
392
|
+
children: s("list.detail.select_prompt", "Select a {name} to view details", { name: s(v.display.name) })
|
|
392
393
|
})
|
|
393
394
|
})
|
|
394
395
|
})]
|
|
395
396
|
}),
|
|
396
|
-
/* @__PURE__ */
|
|
397
|
-
open:
|
|
397
|
+
/* @__PURE__ */ H(he, {
|
|
398
|
+
open: ie,
|
|
398
399
|
onClose: () => g(!1),
|
|
399
|
-
filters:
|
|
400
|
-
onApply:
|
|
401
|
-
availableFields:
|
|
402
|
-
allFields:
|
|
403
|
-
fieldLabel:
|
|
400
|
+
filters: O,
|
|
401
|
+
onApply: pe,
|
|
402
|
+
availableFields: le,
|
|
403
|
+
allFields: ue,
|
|
404
|
+
fieldLabel: de,
|
|
404
405
|
resolveValue: Ee,
|
|
405
406
|
defaultFilters: _.default_filters,
|
|
406
407
|
refs: De
|
|
@@ -408,11 +409,11 @@ function K({ screenCode: i }) {
|
|
|
408
409
|
]
|
|
409
410
|
});
|
|
410
411
|
}
|
|
411
|
-
function
|
|
412
|
-
let c =
|
|
412
|
+
function Se({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a, isSelected: o, onClick: s }) {
|
|
413
|
+
let c = P();
|
|
413
414
|
if (i === "cards") {
|
|
414
|
-
let n = r.badgeFields.filter((n) =>
|
|
415
|
-
return /* @__PURE__ */
|
|
415
|
+
let n = r.badgeFields.filter((n) => S(t, e, n)), i = r.bodyFields.filter((n) => S(t, e, n)), l = r.metaFields.filter((n) => S(t, e, n));
|
|
416
|
+
return /* @__PURE__ */ U("button", {
|
|
416
417
|
type: "button",
|
|
417
418
|
"data-testid": "record-list-card",
|
|
418
419
|
"aria-current": o ? "true" : void 0,
|
|
@@ -432,19 +433,19 @@ function be({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
432
433
|
boxShadow: o ? "inset 3px 0 0 var(--accent)" : "none"
|
|
433
434
|
},
|
|
434
435
|
children: [
|
|
435
|
-
/* @__PURE__ */
|
|
436
|
+
/* @__PURE__ */ H(K, {
|
|
436
437
|
entity: t,
|
|
437
438
|
record: e,
|
|
438
439
|
field: r.titleField,
|
|
439
440
|
refs: a
|
|
440
441
|
}),
|
|
441
|
-
r.subtitleField && /* @__PURE__ */
|
|
442
|
+
r.subtitleField && /* @__PURE__ */ H("div", {
|
|
442
443
|
style: {
|
|
443
444
|
fontSize: 12,
|
|
444
445
|
color: "var(--text-3)",
|
|
445
446
|
overflowWrap: "anywhere"
|
|
446
447
|
},
|
|
447
|
-
children:
|
|
448
|
+
children: x({
|
|
448
449
|
entity: t,
|
|
449
450
|
fieldName: r.subtitleField,
|
|
450
451
|
record: e,
|
|
@@ -453,13 +454,13 @@ function be({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
453
454
|
t: c
|
|
454
455
|
})
|
|
455
456
|
}),
|
|
456
|
-
n.length > 0 && /* @__PURE__ */
|
|
457
|
+
n.length > 0 && /* @__PURE__ */ H("div", {
|
|
457
458
|
style: {
|
|
458
459
|
display: "flex",
|
|
459
460
|
flexWrap: "wrap",
|
|
460
461
|
gap: 6
|
|
461
462
|
},
|
|
462
|
-
children: n.map((n) => /* @__PURE__ */
|
|
463
|
+
children: n.map((n) => /* @__PURE__ */ H("span", {
|
|
463
464
|
style: {
|
|
464
465
|
border: "1px solid var(--border)",
|
|
465
466
|
borderRadius: 999,
|
|
@@ -469,7 +470,7 @@ function be({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
469
470
|
maxWidth: "100%",
|
|
470
471
|
overflowWrap: "anywhere"
|
|
471
472
|
},
|
|
472
|
-
children:
|
|
473
|
+
children: x({
|
|
473
474
|
entity: t,
|
|
474
475
|
fieldName: n,
|
|
475
476
|
record: e,
|
|
@@ -479,21 +480,21 @@ function be({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
479
480
|
})
|
|
480
481
|
}, n))
|
|
481
482
|
}),
|
|
482
|
-
i.length > 0 && /* @__PURE__ */
|
|
483
|
+
i.length > 0 && /* @__PURE__ */ H("dl", {
|
|
483
484
|
style: {
|
|
484
485
|
display: "grid",
|
|
485
486
|
gridTemplateColumns: "minmax(72px, max-content) minmax(0, 1fr)",
|
|
486
487
|
gap: "5px 10px",
|
|
487
488
|
margin: 0
|
|
488
489
|
},
|
|
489
|
-
children: i.map((n) => /* @__PURE__ */
|
|
490
|
+
children: i.map((n) => /* @__PURE__ */ H(q, {
|
|
490
491
|
entity: t,
|
|
491
492
|
record: e,
|
|
492
493
|
fieldName: n,
|
|
493
494
|
refs: a
|
|
494
495
|
}, n))
|
|
495
496
|
}),
|
|
496
|
-
l.length > 0 && /* @__PURE__ */
|
|
497
|
+
l.length > 0 && /* @__PURE__ */ H("div", {
|
|
497
498
|
style: {
|
|
498
499
|
display: "flex",
|
|
499
500
|
flexWrap: "wrap",
|
|
@@ -501,12 +502,12 @@ function be({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
501
502
|
fontSize: 11,
|
|
502
503
|
color: "var(--text-3)"
|
|
503
504
|
},
|
|
504
|
-
children: l.map((n) => /* @__PURE__ */
|
|
505
|
+
children: l.map((n) => /* @__PURE__ */ H("span", {
|
|
505
506
|
style: {
|
|
506
507
|
minWidth: 0,
|
|
507
508
|
overflowWrap: "anywhere"
|
|
508
509
|
},
|
|
509
|
-
children:
|
|
510
|
+
children: x({
|
|
510
511
|
entity: t,
|
|
511
512
|
fieldName: n,
|
|
512
513
|
record: e,
|
|
@@ -520,7 +521,7 @@ function be({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
520
521
|
});
|
|
521
522
|
}
|
|
522
523
|
let l = n[0], u = n[1], d = n.slice(2, 4);
|
|
523
|
-
return /* @__PURE__ */
|
|
524
|
+
return /* @__PURE__ */ U("button", {
|
|
524
525
|
onClick: s,
|
|
525
526
|
style: {
|
|
526
527
|
width: "100%",
|
|
@@ -543,7 +544,7 @@ function be({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
543
544
|
onMouseLeave: (e) => {
|
|
544
545
|
o || (e.currentTarget.style.background = "transparent");
|
|
545
546
|
},
|
|
546
|
-
children: [l && /* @__PURE__ */
|
|
547
|
+
children: [l && /* @__PURE__ */ H("div", {
|
|
547
548
|
style: {
|
|
548
549
|
fontSize: 12.5,
|
|
549
550
|
fontWeight: 500,
|
|
@@ -552,7 +553,7 @@ function be({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
552
553
|
whiteSpace: "nowrap",
|
|
553
554
|
color: "var(--text)"
|
|
554
555
|
},
|
|
555
|
-
children:
|
|
556
|
+
children: x({
|
|
556
557
|
entity: t,
|
|
557
558
|
fieldName: l,
|
|
558
559
|
record: e,
|
|
@@ -560,13 +561,13 @@ function be({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
560
561
|
refs: a,
|
|
561
562
|
t: c
|
|
562
563
|
})
|
|
563
|
-
}), /* @__PURE__ */
|
|
564
|
+
}), /* @__PURE__ */ U("div", {
|
|
564
565
|
style: {
|
|
565
566
|
display: "flex",
|
|
566
567
|
alignItems: "center",
|
|
567
568
|
gap: 6
|
|
568
569
|
},
|
|
569
|
-
children: [u && /* @__PURE__ */
|
|
570
|
+
children: [u && /* @__PURE__ */ H("div", {
|
|
570
571
|
style: {
|
|
571
572
|
fontSize: 11,
|
|
572
573
|
color: "var(--text-3)",
|
|
@@ -575,7 +576,7 @@ function be({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
575
576
|
textOverflow: "ellipsis",
|
|
576
577
|
whiteSpace: "nowrap"
|
|
577
578
|
},
|
|
578
|
-
children:
|
|
579
|
+
children: x({
|
|
579
580
|
entity: t,
|
|
580
581
|
fieldName: u,
|
|
581
582
|
record: e,
|
|
@@ -583,16 +584,16 @@ function be({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
583
584
|
refs: a,
|
|
584
585
|
t: c
|
|
585
586
|
})
|
|
586
|
-
}), /* @__PURE__ */
|
|
587
|
+
}), /* @__PURE__ */ H("div", {
|
|
587
588
|
style: {
|
|
588
589
|
display: "flex",
|
|
589
590
|
alignItems: "center",
|
|
590
591
|
gap: 4,
|
|
591
592
|
flexShrink: 0
|
|
592
593
|
},
|
|
593
|
-
children: d.map((n) =>
|
|
594
|
+
children: d.map((n) => b(t, e, n) == null ? null : /* @__PURE__ */ H("div", {
|
|
594
595
|
style: { fontSize: 11 },
|
|
595
|
-
children:
|
|
596
|
+
children: x({
|
|
596
597
|
entity: t,
|
|
597
598
|
fieldName: n,
|
|
598
599
|
record: e,
|
|
@@ -605,8 +606,8 @@ function be({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
605
606
|
})]
|
|
606
607
|
});
|
|
607
608
|
}
|
|
608
|
-
function
|
|
609
|
-
let i =
|
|
609
|
+
function K({ entity: e, record: t, field: n, refs: r }) {
|
|
610
|
+
let i = P(), a = le(i, t, e), o = n ? x({
|
|
610
611
|
entity: e,
|
|
611
612
|
fieldName: n,
|
|
612
613
|
record: t,
|
|
@@ -614,7 +615,7 @@ function xe({ entity: e, record: t, field: n, refs: r }) {
|
|
|
614
615
|
refs: r,
|
|
615
616
|
t: i
|
|
616
617
|
}) : a;
|
|
617
|
-
return /* @__PURE__ */
|
|
618
|
+
return /* @__PURE__ */ H("div", {
|
|
618
619
|
style: {
|
|
619
620
|
fontSize: 13.5,
|
|
620
621
|
fontWeight: 600,
|
|
@@ -625,18 +626,18 @@ function xe({ entity: e, record: t, field: n, refs: r }) {
|
|
|
625
626
|
});
|
|
626
627
|
}
|
|
627
628
|
function q({ entity: e, record: t, fieldName: n, refs: r }) {
|
|
628
|
-
let i =
|
|
629
|
+
let i = P(), a = b(e, t, n);
|
|
629
630
|
if (a == null || a === "") return null;
|
|
630
631
|
let o = e.fields.get(n);
|
|
631
|
-
return o ? /* @__PURE__ */
|
|
632
|
+
return o ? /* @__PURE__ */ U(ye, { children: [/* @__PURE__ */ H("dt", {
|
|
632
633
|
style: {
|
|
633
634
|
color: "var(--text-3)",
|
|
634
635
|
fontSize: 11.5,
|
|
635
636
|
minWidth: 0,
|
|
636
637
|
overflowWrap: "anywhere"
|
|
637
638
|
},
|
|
638
|
-
children:
|
|
639
|
-
}), /* @__PURE__ */
|
|
639
|
+
children: D(i, o, n)
|
|
640
|
+
}), /* @__PURE__ */ H("dd", {
|
|
640
641
|
style: {
|
|
641
642
|
margin: 0,
|
|
642
643
|
color: "var(--text)",
|
|
@@ -644,7 +645,7 @@ function q({ entity: e, record: t, fieldName: n, refs: r }) {
|
|
|
644
645
|
minWidth: 0,
|
|
645
646
|
overflowWrap: "anywhere"
|
|
646
647
|
},
|
|
647
|
-
children:
|
|
648
|
+
children: x({
|
|
648
649
|
entity: e,
|
|
649
650
|
fieldName: n,
|
|
650
651
|
record: t,
|
|
@@ -654,8 +655,8 @@ function q({ entity: e, record: t, fieldName: n, refs: r }) {
|
|
|
654
655
|
})
|
|
655
656
|
})] }) : null;
|
|
656
657
|
}
|
|
657
|
-
function
|
|
658
|
-
return /* @__PURE__ */
|
|
658
|
+
function Ce({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBackToList: a, onOpenFilters: o, relatedRecordsPresentation: s }) {
|
|
659
|
+
return /* @__PURE__ */ H(ie, { children: /* @__PURE__ */ H(J, {
|
|
659
660
|
entityCode: e,
|
|
660
661
|
recordId: t,
|
|
661
662
|
items: n,
|
|
@@ -666,56 +667,56 @@ function Se({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBack
|
|
|
666
667
|
relatedRecordsPresentation: s
|
|
667
668
|
}) });
|
|
668
669
|
}
|
|
669
|
-
function
|
|
670
|
-
let h =
|
|
670
|
+
function J({ entityCode: e, recordId: t, items: o, schema: u, entity: d, onBackToList: ee, onOpenFilters: te, relatedRecordsPresentation: re }) {
|
|
671
|
+
let h = P(), ie = P("errors"), x = pe(d), S = z(() => t ? O(d, t) : void 0, [t, d]), oe = f(e, S), se = oe.data, C = c(oe), w = p(e), D = g(), [k, A] = V(!1), [j, M] = V({}), N = se?.data, F = de(d, "update", N, x.tenantId), he = N?.$statuses, ge = N?.$properties, _e = ne(e, t), I = m(e, t), ve = z(() => {
|
|
671
672
|
let e = /* @__PURE__ */ new Set();
|
|
672
|
-
for (let [t, n] of d.fields)
|
|
673
|
+
for (let [t, n] of d.fields) ue(n) && e.add(t);
|
|
673
674
|
for (let [t] of d.files ?? []) e.add(t);
|
|
674
675
|
return e;
|
|
675
|
-
}, [d]),
|
|
676
|
-
if (
|
|
676
|
+
}, [d]), R = L(() => {
|
|
677
|
+
if (N) {
|
|
677
678
|
let e = {};
|
|
678
|
-
|
|
679
|
-
let n =
|
|
680
|
-
e[t] =
|
|
681
|
-
}),
|
|
679
|
+
ve.forEach((t) => {
|
|
680
|
+
let n = b(d, N, t);
|
|
681
|
+
e[t] = y(d, t) ? n ?? null : n ?? "";
|
|
682
|
+
}), M(e);
|
|
682
683
|
}
|
|
683
|
-
|
|
684
|
+
A(!0);
|
|
684
685
|
}, [
|
|
685
|
-
|
|
686
|
-
|
|
686
|
+
N,
|
|
687
|
+
ve,
|
|
687
688
|
d
|
|
688
|
-
]),
|
|
689
|
-
await D.flushAllDrafts(),
|
|
690
|
-
}, [D]),
|
|
691
|
-
let e = {},
|
|
689
|
+
]), B = L(async () => {
|
|
690
|
+
await D.flushAllDrafts(), A(!1), M({});
|
|
691
|
+
}, [D]), be = L(() => {
|
|
692
|
+
let e = {}, n = _({
|
|
692
693
|
entity: d,
|
|
693
|
-
formData:
|
|
694
|
-
record:
|
|
694
|
+
formData: j,
|
|
695
|
+
record: N,
|
|
695
696
|
isNew: !1
|
|
696
|
-
}),
|
|
697
|
-
for (let [t, n] of Object.entries(
|
|
698
|
-
Object.keys(
|
|
699
|
-
pkValues:
|
|
697
|
+
}), r = v(n);
|
|
698
|
+
for (let [t, n] of Object.entries(j)) d.files?.has(t) || (e[t] = ae(d, t, n));
|
|
699
|
+
Object.keys(n).length > 0 && (e.$files = n), Object.keys(e).length === 0 ? (A(!1), M({})) : w.mutate({
|
|
700
|
+
pkValues: t,
|
|
700
701
|
data: e
|
|
701
702
|
}, { onSuccess: () => {
|
|
702
|
-
|
|
703
|
+
r.forEach((e) => D.markCommitted(e)), A(!1), M({});
|
|
703
704
|
} });
|
|
704
705
|
}, [
|
|
705
706
|
D,
|
|
706
|
-
|
|
707
|
-
|
|
707
|
+
w,
|
|
708
|
+
t,
|
|
708
709
|
d,
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
]),
|
|
712
|
-
|
|
710
|
+
j,
|
|
711
|
+
N
|
|
712
|
+
]), xe = L((e, t) => {
|
|
713
|
+
M((n) => ({
|
|
713
714
|
...n,
|
|
714
715
|
[e]: t
|
|
715
716
|
}));
|
|
716
717
|
}, []);
|
|
717
|
-
if (
|
|
718
|
-
if (!
|
|
718
|
+
if (C.loading) return /* @__PURE__ */ H(T, {});
|
|
719
|
+
if (!N && C.error !== null) return /* @__PURE__ */ U("p", {
|
|
719
720
|
role: "alert",
|
|
720
721
|
style: {
|
|
721
722
|
padding: 16,
|
|
@@ -725,60 +726,60 @@ function Ce({ entityCode: e, recordId: a, items: l, schema: u, entity: d, onBack
|
|
|
725
726
|
gap: 8
|
|
726
727
|
},
|
|
727
728
|
children: [
|
|
728
|
-
|
|
729
|
+
l(ie, C.error),
|
|
729
730
|
" ",
|
|
730
|
-
/* @__PURE__ */
|
|
731
|
+
/* @__PURE__ */ H(s, { onRetry: C.retry })
|
|
731
732
|
]
|
|
732
733
|
});
|
|
733
|
-
if (!
|
|
734
|
-
let
|
|
734
|
+
if (!N) return null;
|
|
735
|
+
let G = le(h, N, d), Se = d.display?.display_field, K = G ? void 0 : Se ? N[Se] : N[d.fields.names()[0]], q = G || (K != null && typeof K != "object" ? ce(K) : h(d.display.name)), Ce = N?.$refs, J = {
|
|
735
736
|
schema: u,
|
|
736
737
|
entity: d,
|
|
737
738
|
entityCode: e,
|
|
738
|
-
recordId:
|
|
739
|
-
record:
|
|
740
|
-
...
|
|
741
|
-
...
|
|
742
|
-
} :
|
|
739
|
+
recordId: t,
|
|
740
|
+
record: k ? {
|
|
741
|
+
...N,
|
|
742
|
+
...j
|
|
743
|
+
} : N,
|
|
743
744
|
isNew: !1,
|
|
744
|
-
mode:
|
|
745
|
-
onFieldChange:
|
|
745
|
+
mode: k ? "edit" : "display",
|
|
746
|
+
onFieldChange: k ? xe : void 0,
|
|
746
747
|
refs: Ce,
|
|
747
|
-
objectProperties:
|
|
748
|
-
onSetProperty:
|
|
748
|
+
objectProperties: ge ?? void 0,
|
|
749
|
+
onSetProperty: F ? (e, t) => I.mutate({
|
|
749
750
|
propertyCode: e,
|
|
750
751
|
value: t
|
|
751
752
|
}) : void 0,
|
|
752
|
-
isPropertyPending:
|
|
753
|
-
objectStatuses:
|
|
754
|
-
onSetStatus:
|
|
753
|
+
isPropertyPending: I.isPending,
|
|
754
|
+
objectStatuses: he ?? void 0,
|
|
755
|
+
onSetStatus: F ? (e, t) => _e.mutate({
|
|
755
756
|
groupCode: e,
|
|
756
757
|
statusCode: t
|
|
757
758
|
}) : void 0,
|
|
758
|
-
isStatusPending:
|
|
759
|
+
isStatusPending: _e.isPending,
|
|
759
760
|
relatedRecordsPresentation: re
|
|
760
761
|
};
|
|
761
|
-
return /* @__PURE__ */
|
|
762
|
+
return /* @__PURE__ */ U("div", {
|
|
762
763
|
style: {
|
|
763
764
|
display: "flex",
|
|
764
765
|
flexDirection: "column",
|
|
765
766
|
height: "100%"
|
|
766
767
|
},
|
|
767
|
-
children: [/* @__PURE__ */
|
|
768
|
+
children: [/* @__PURE__ */ U("div", {
|
|
768
769
|
style: {
|
|
769
770
|
display: "flex",
|
|
770
771
|
alignItems: "center",
|
|
771
772
|
justifyContent: "space-between",
|
|
772
773
|
paddingTop: 10,
|
|
773
774
|
paddingBottom: 10,
|
|
774
|
-
...
|
|
775
|
+
...fe(16),
|
|
775
776
|
borderBottom: "1px solid var(--divider)",
|
|
776
777
|
position: "sticky",
|
|
777
778
|
top: 0,
|
|
778
779
|
background: "var(--surface)",
|
|
779
780
|
zIndex: 10
|
|
780
781
|
},
|
|
781
|
-
children: [/* @__PURE__ */
|
|
782
|
+
children: [/* @__PURE__ */ H("h2", {
|
|
782
783
|
style: {
|
|
783
784
|
margin: 0,
|
|
784
785
|
fontSize: 13,
|
|
@@ -788,66 +789,66 @@ function Ce({ entityCode: e, recordId: a, items: l, schema: u, entity: d, onBack
|
|
|
788
789
|
whiteSpace: "nowrap",
|
|
789
790
|
color: "var(--text)"
|
|
790
791
|
},
|
|
791
|
-
children:
|
|
792
|
-
}), /* @__PURE__ */
|
|
792
|
+
children: q
|
|
793
|
+
}), /* @__PURE__ */ U("div", {
|
|
793
794
|
style: {
|
|
794
795
|
display: "flex",
|
|
795
796
|
alignItems: "center",
|
|
796
797
|
gap: 6
|
|
797
798
|
},
|
|
798
799
|
children: [
|
|
799
|
-
ee && /* @__PURE__ */
|
|
800
|
-
icon: /* @__PURE__ */
|
|
800
|
+
ee && /* @__PURE__ */ H(i, {
|
|
801
|
+
icon: /* @__PURE__ */ H(r.back, { size: 14 }),
|
|
801
802
|
title: h("list.detail.back_to_list", "Back to list"),
|
|
802
803
|
onClick: ee
|
|
803
804
|
}),
|
|
804
|
-
|
|
805
|
-
icon: /* @__PURE__ */
|
|
805
|
+
te && /* @__PURE__ */ H(i, {
|
|
806
|
+
icon: /* @__PURE__ */ H(r.filter, { size: 14 }),
|
|
806
807
|
title: h("filter.drawer.title", "Filters"),
|
|
807
|
-
onClick:
|
|
808
|
+
onClick: te
|
|
808
809
|
}),
|
|
809
|
-
|
|
810
|
+
F && (k ? /* @__PURE__ */ U(ye, { children: [/* @__PURE__ */ H(n, {
|
|
810
811
|
size: "xs",
|
|
811
|
-
icon: /* @__PURE__ */
|
|
812
|
-
onClick:
|
|
812
|
+
icon: /* @__PURE__ */ H(r.x, { size: 12 }),
|
|
813
|
+
onClick: B,
|
|
813
814
|
children: h("dialog.cancel", "Cancel")
|
|
814
|
-
}), /* @__PURE__ */
|
|
815
|
+
}), /* @__PURE__ */ H(n, {
|
|
815
816
|
kind: "primary",
|
|
816
817
|
size: "xs",
|
|
817
|
-
icon:
|
|
818
|
-
onClick:
|
|
819
|
-
disabled:
|
|
820
|
-
children:
|
|
821
|
-
})] }) : /* @__PURE__ */
|
|
818
|
+
icon: w.isPending ? /* @__PURE__ */ H(a, { size: 12 }) : /* @__PURE__ */ H(r.save, { size: 12 }),
|
|
819
|
+
onClick: be,
|
|
820
|
+
disabled: w.isPending,
|
|
821
|
+
children: w.isPending ? h("dialog.saving", "Saving…") : h("dialog.save", "Save")
|
|
822
|
+
})] }) : /* @__PURE__ */ H(n, {
|
|
822
823
|
size: "xs",
|
|
823
|
-
icon: /* @__PURE__ */
|
|
824
|
-
onClick:
|
|
824
|
+
icon: /* @__PURE__ */ H(r.edit, { size: 12 }),
|
|
825
|
+
onClick: R,
|
|
825
826
|
children: h("list.record.edit", "Edit")
|
|
826
827
|
}))
|
|
827
828
|
]
|
|
828
829
|
})]
|
|
829
|
-
}), /* @__PURE__ */
|
|
830
|
+
}), /* @__PURE__ */ H("div", {
|
|
830
831
|
style: {
|
|
831
832
|
flex: 1,
|
|
832
833
|
overflowY: "auto",
|
|
833
834
|
paddingTop: 16,
|
|
834
835
|
paddingBottom: 16,
|
|
835
|
-
...
|
|
836
|
+
...fe(16),
|
|
836
837
|
display: "flex",
|
|
837
838
|
flexDirection: "column",
|
|
838
839
|
gap: 12
|
|
839
840
|
},
|
|
840
|
-
children:
|
|
841
|
-
nodes:
|
|
841
|
+
children: o && o.length > 0 ? /* @__PURE__ */ H(E, {
|
|
842
|
+
nodes: o,
|
|
842
843
|
ctx: J
|
|
843
|
-
}) : /* @__PURE__ */
|
|
844
|
+
}) : /* @__PURE__ */ H("p", {
|
|
844
845
|
style: {
|
|
845
846
|
fontSize: 12.5,
|
|
846
847
|
color: "var(--text-3)"
|
|
847
848
|
},
|
|
848
|
-
children:
|
|
849
|
+
children: me(h("list.detail.no_layout", "No layout configured. Add {key} to the screen definition."), { key: /* @__PURE__ */ H("code", { children: W }) })
|
|
849
850
|
})
|
|
850
851
|
})]
|
|
851
852
|
});
|
|
852
853
|
}
|
|
853
|
-
export {
|
|
854
|
+
export { G as SmartRecordListPage };
|