@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.
Files changed (28) hide show
  1. package/dist-lib/components/actions/ObjectActionBar.js +56 -54
  2. package/dist-lib/components/actions/PropertyGridEditor.js +56 -53
  3. package/dist-lib/components/actions/RowActionsKebab.js +51 -49
  4. package/dist-lib/components/detail-layout/AssociatedBlock.js +385 -383
  5. package/dist-lib/components/list/QuickPeek.js +77 -75
  6. package/dist-lib/components/pages/SmartDetailPage.impl.js +484 -458
  7. package/dist-lib/components/pages/SmartRecordListPage.impl.js +207 -206
  8. package/dist-lib/components/pages/list/DataCell.js +15 -15
  9. package/dist-lib/components/pages/list/ListFloatbar.js +55 -53
  10. package/dist-lib/components/pages/list/ListHeader.js +54 -52
  11. package/dist-lib/components/pages/list/ListTable.js +64 -64
  12. package/dist-lib/components/pages/list/cardProjection.js +85 -80
  13. package/dist-lib/components/pages/list/column-sizing.js +11 -1
  14. package/dist-lib/components/pages/list/use-filter-value-labels.js +29 -78
  15. package/dist-lib/components/pages/list/useListRowInteraction.js +78 -76
  16. package/dist-lib/components/pages/list/useRowMenu.js +60 -58
  17. package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +341 -262
  18. package/dist-lib/components/params/ParamsBlock.js +59 -59
  19. package/dist-lib/components/params/param-editors.js +114 -99
  20. package/dist-lib/components/shared/ConfirmDialog.js +33 -66
  21. package/dist-lib/components/shared/ModalFrame.js +53 -0
  22. package/dist-lib/hooks/useRefRecords.js +73 -0
  23. package/dist-lib/hooks/useRowTenant.js +12 -0
  24. package/dist-lib/index.d.ts +4 -3
  25. package/dist-lib/lib/actions.js +105 -89
  26. package/dist-lib/lib/mass-edit.js +13 -13
  27. package/dist-lib/types/schema.js +29 -22
  28. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { coerceDisplayString as e } from "../../lib/display-value.js";
2
- import { entityAllowsMutation as t, fieldDisplayName as n, getDisplayValue as r, singlePkValues as i } from "../../types/schema.js";
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 f } from "../../hooks/useResponsiveMode.js";
11
- import { Spinner as p } from "../primitives/Spinner.js";
12
- import { TextInput as m } from "../primitives/Fields.js";
13
- import { pageInsetX as ee } from "../../lib/page-inset.js";
14
- import { readableSort as te } from "../../lib/field-classification.js";
15
- import { stripUnsupportedSortSegments as ne } from "../../lib/sort.js";
16
- import { useObject as re } from "../../hooks/useObject.js";
17
- import { useDebounce as ie } from "../../hooks/useDebounce.js";
18
- import { FileDraftScope as h, useFileDraftScope as ae } from "../file-widgets/draft-scope.js";
19
- import { getEntityFileField as g, getSchemaFieldValue as _, renderSchemaField as v, schemaFieldHasValue as y, serializeSchemaFieldValue as b } from "../file-widgets/host.js";
20
- import { buildFilesPayload as x, collectCommittedFileIds as oe } from "../file-widgets/payload.js";
21
- import { useUpdateObject as se } from "../../hooks/useMutations.js";
22
- import { useSetStatus as S } from "../../hooks/useObjectStatus.js";
23
- import { useSetProperty as C } from "../../hooks/useProperties.js";
24
- import { countActiveFilters as ce, parseFilterURLState as le, removeFilterAtPath as w, setFiltersInURL as T } from "../../lib/filters.js";
25
- import { useScreenBack as E } from "../../hooks/useScreenBack.js";
26
- import { useRegisterScreenTab as D } from "../../hooks/useRegisterScreenTab.js";
27
- import { useTabSearchMirror as O } from "../../hooks/useTabSearchMirror.js";
28
- import { DetailSkeleton as k } from "../shared/LoadingSkeleton.js";
29
- import { FilterDrawer as A } from "../filters/FilterDrawer.js";
30
- import { FilterChips as j } from "../filters/FilterChips.js";
31
- import { LayoutRenderer as ue } from "../detail-layout/LayoutRenderer.js";
32
- import { resolveCard as de, resolveListProjection as fe } from "./list/cardProjection.js";
33
- import { useListFilterPresentation as M } from "./list/useListFilterPresentation.js";
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 pe } from "./list/ListNoRows.js";
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 F, useEffect as I, useMemo as L, useRef as R, useState as z } from "react";
39
- import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
40
- import { useSearchParams as he } from "react-router";
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 ge = 200, _e = "items:";
43
+ var _e = 200, ve = "items:";
43
44
  function U({ screenCode: t }) {
44
- let n = d(), r = d("errors"), [i, s] = he(), { data: p, refetch: re } = o(), h = f(), [ae, g] = z(!1), _ = p?.screens[t], v = _?.entity ? p?.entities[_.entity] : void 0, y = _?.entity;
45
- D(_, v, i.toString()), O(_?.route);
46
- let b = E(), x = i.get("selected") ?? null, oe = i.get("search") ?? "", se = ie(oe, 300), S = i.get("sort") ?? te(v, _?.sort_default) ?? "", C = L(() => le(i), [i]), { visibleFilterState: k, filterFieldMeta: ue, allFilterFieldMeta: _e, filterFieldName: U } = M(_, v, p?.entities, C.filters), W = k.filters, G = F((e) => {
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 T(e, n), n;
50
+ return w(e, n), n;
50
51
  }, { replace: !0 });
51
- }, [s]), K = L(() => _?.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]), q = L(() => {
52
- let e = _?.responsive?.[h.category]?.presentation;
53
- return h.category === "phone" ? "drilldown" : e === "split" || e === "drilldown" || e === "stacked" ? e : "split";
54
- }, [_?.responsive, h.category]), J = L(() => {
55
- let e = _?.responsive?.[h.category];
56
- return e?.list?.presentation === "table" || e?.list?.presentation === "cards" ? e.list.presentation : e?.presentation === "table" || e?.presentation === "cards" ? e.presentation : h.category === "phone" ? "cards" : "table";
57
- }, [_?.responsive, h.category]), be = _?.responsive?.[h.category]?.layout?.related_records, xe = L(() => de({
58
- entity: v,
59
- screen: _
60
- }), [v, _]), Se = L(() => fe({
61
- entity: v,
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: S
67
+ sort: x
67
68
  }), [
68
- v,
69
69
  _,
70
+ g,
70
71
  J,
71
72
  K,
72
73
  xe,
73
- S
74
+ x
74
75
  ]), Y = P({
75
- entity: v,
76
- entityCode: y,
77
- screen: _,
76
+ entity: _,
77
+ entityCode: v,
78
+ screen: g,
78
79
  screenCode: t,
79
80
  page: 1,
80
- perPage: ge,
81
- sortForRequest: ne(S),
82
- debouncedSearch: se,
83
- filters: W,
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: !v,
88
+ isHeld: !_,
88
89
  retryHeld: () => {
89
- re();
90
+ ie();
90
91
  },
91
92
  runCountQuery: !1,
92
- urlKey: `${y ?? ""}|${i.toString()}`
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(_e, W, we, p?.entities), Oe = L(() => v?.fields.names().find((e) => v.fields.get(e)?.primary) ?? "id", [v]), ke = F((e, t) => {
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 = F((e) => {
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 = (_?.list_resizable ?? !1) && q === "split" && h.category !== "phone" && !h.touch, je = R(null), [Z, Q] = z(null), Me = R(!1), $ = _?.list_width;
106
- I(() => {
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
- h.width,
112
- h.height
113
- ]), I(() => {
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
- v
127
+ _
127
128
  ]);
128
- let Ne = R(null);
129
- I(() => () => {
129
+ let Ne = z(null);
130
+ L(() => () => {
130
131
  Ne.current?.();
131
132
  }, []);
132
- let Pe = F((e) => {
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 (!p || !_ || !v) return null;
144
- let Fe = ce(W), Ie = q === "split" || q === "stacked" || !x, Le = q === "split" || q === "stacked" || !!x, Re = q !== "split" && x ? () => ke(null, { replace: !0 }) : void 0, ze = q === "split" ? X && Z !== null ? Z : _.list_width ?? "320px" : "100%";
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
- ...ee(12),
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
- b.hasOriginBack && /* @__PURE__ */ H("div", {
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: b.goBack
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(_.display?.name) || n(v.display.name_plural)
197
+ children: n(g.display?.name) || n(_.display.name_plural)
197
198
  })]
198
199
  }),
199
- /* @__PURE__ */ V(m, {
200
- value: oe,
200
+ /* @__PURE__ */ V(p, {
201
+ value: b,
201
202
  onChange: Ae,
202
- placeholder: n("list.toolbar.search_placeholder", "Search {name}…", { name: n(v.display.name_plural) }),
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
- C.error && /* @__PURE__ */ H("div", {
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(C.errorCode ?? "", C.error),
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: () => g(!0),
225
+ onClick: () => h(!0),
225
226
  children: [n("filter.drawer.title", "Filters"), Fe > 0 ? ` (${Fe})` : ""]
226
227
  }),
227
- k.omitted && /* @__PURE__ */ V(N, {}),
228
- /* @__PURE__ */ V(j, {
229
- filters: W,
228
+ O.omitted && /* @__PURE__ */ V(N, {}),
229
+ /* @__PURE__ */ V(A, {
230
+ filters: U,
230
231
  resolveValue: Ee,
231
- fieldLabel: U,
232
- onRemoveAtPath: (e) => G(w(W, e)),
232
+ fieldLabel: ve,
233
+ onRemoveAtPath: (e) => G(C(U, e)),
233
234
  onClearAll: () => G([]),
234
- onChipClick: () => g(!0)
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(v.display.name_plural)
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: [pe(n, r, v, Y.error), /* @__PURE__ */ V(l, {
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(B, { children: [Ce.map((t) => {
293
+ }) : /* @__PURE__ */ H(he, { children: [Ce.map((t) => {
293
294
  let n = e(t[Oe]);
294
- return /* @__PURE__ */ V(ve, {
295
+ return /* @__PURE__ */ V(W, {
295
296
  record: t,
296
- entity: v,
297
+ entity: _,
297
298
  columns: K,
298
299
  card: xe,
299
300
  presentation: J,
300
301
  refs: we,
301
- isSelected: n === x,
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 && k.omitted && /* @__PURE__ */ V(N, { className: "p-4" }), /* @__PURE__ */ V("div", {
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: x ? /* @__PURE__ */ V(ye, {
352
- entityCode: y,
353
- recordId: x,
354
- items: _.items,
355
- schema: p,
356
- entity: v,
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 : () => g(!0),
359
+ onOpenFilters: Ie ? void 0 : () => h(!0),
359
360
  relatedRecordsPresentation: be
360
- }, x) : /* @__PURE__ */ V("div", {
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(v.display.name) })
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(A, {
376
- open: ae,
377
- onClose: () => g(!1),
378
- filters: W,
376
+ /* @__PURE__ */ V(k, {
377
+ open: oe,
378
+ onClose: () => h(!1),
379
+ filters: U,
379
380
  onApply: G,
380
- availableFields: ue,
381
- allFields: _e,
382
- fieldLabel: U,
381
+ availableFields: de,
382
+ allFields: j,
383
+ fieldLabel: ve,
383
384
  resolveValue: Ee,
384
- defaultFilters: _.default_filters,
385
+ defaultFilters: g.default_filters,
385
386
  refs: De
386
387
  })
387
388
  ]
388
389
  });
389
390
  }
390
- function ve({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a, isSelected: o, onClick: s }) {
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) => y(t, e, n)), i = r.bodyFields.filter((n) => y(t, e, n)), l = r.metaFields.filter((n) => y(t, e, 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(W, {
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: v({
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: v({
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(G, {
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: v({
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], f = n.slice(2, 4);
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: v({
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: v({
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: f.map((n) => _(t, e, n) == null ? null : /* @__PURE__ */ V("div", {
573
+ children: ee.map((n) => g(t, e, n) == null ? null : /* @__PURE__ */ V("div", {
573
574
  style: { fontSize: 11 },
574
- children: v({
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 W({ entity: e, record: t, field: n, refs: i }) {
588
- let a = d(), o = r(a, t, e), s = n ? v({
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: n,
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 G({ entity: e, record: t, fieldName: r, refs: i }) {
607
- let a = d(), o = _(e, t, r);
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(B, { children: [/* @__PURE__ */ V("dt", {
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: n(a, s, r)
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: v({
627
+ children: _({
627
628
  entity: e,
628
629
  fieldName: r,
629
- record: t,
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(h, { children: /* @__PURE__ */ V(K, {
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 K({ entityCode: n, recordId: a, items: o, schema: f, entity: m, onBackToList: te, onOpenFilters: ne, relatedRecordsPresentation: ie }) {
649
- let h = d(), v = t(m, "update"), y = L(() => a ? i(m, a) : void 0, [a, m]), { data: ce, isLoading: le } = re(n, y), w = se(n), T = ae(), [E, D] = z(!1), [O, A] = z({}), j = ce?.data, de = j?.$statuses, fe = j?.$properties, M = S(n, a), N = C(n, a), P = L(() => {
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 m.fields) !n.auto && !n.primary && e.add(t);
652
- for (let [t] of m.files ?? []) e.add(t);
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
- }, [m]), pe = F(() => {
655
- if (j) {
655
+ }, [p]), me = I(() => {
656
+ if (A) {
656
657
  let e = {};
657
- P.forEach((t) => {
658
- let n = _(m, j, t);
659
- e[t] = g(m, t) ? n ?? null : n ?? "";
660
- }), A(e);
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
- D(!0);
663
+ E(!0);
663
664
  }, [
664
- j,
665
- P,
666
- m
667
- ]), me = F(async () => {
668
- await T.flushAllDrafts(), D(!1), A({});
669
- }, [T]), I = F(() => {
670
- let e = {}, t = x({
671
- entity: m,
672
- formData: O,
673
- record: j,
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 = oe(t);
676
- for (let [t, n] of Object.entries(O)) m.files?.has(t) || (e[t] = b(m, t, n));
677
- Object.keys(t).length > 0 && (e.$files = t), Object.keys(e).length === 0 ? (D(!1), A({})) : w.mutate({
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) => T.markCommitted(e)), D(!1), A({});
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
- m,
688
- O,
689
- j
690
- ]), R = F((e, t) => {
691
- A((n) => ({
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 (le) return /* @__PURE__ */ V(k, {});
697
- if (!j) return null;
698
- let he = r(h, j, m), ge = m.display?.display_field, U = he ? void 0 : ge ? j[ge] : j[m.fields.names()[0]], ve = he || (U != null && typeof U != "object" ? e(U) : h(m.display.name)), W = j?.$refs, G = {
699
- schema: f,
700
- entity: m,
701
- entityCode: n,
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: E ? {
704
- ...j,
705
- ...O
706
- } : j,
704
+ record: T ? {
705
+ ...A,
706
+ ...D
707
+ } : A,
707
708
  isNew: !1,
708
- mode: E ? "edit" : "display",
709
- onFieldChange: E ? R : void 0,
710
- refs: W,
711
- objectProperties: fe ?? void 0,
712
- onSetProperty: v ? (e, t) => N.mutate({
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: N.isPending,
717
- objectStatuses: de ?? void 0,
718
- onSetStatus: v ? (e, t) => M.mutate({
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: M.isPending,
723
- relatedRecordsPresentation: ie
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
- ...ee(16),
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: ve
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
- te && /* @__PURE__ */ V(u, {
764
+ ne && /* @__PURE__ */ V(u, {
764
765
  icon: /* @__PURE__ */ V(c.back, { size: 14 }),
765
- title: h("list.detail.back_to_list", "Back to list"),
766
- onClick: te
766
+ title: m("list.detail.back_to_list", "Back to list"),
767
+ onClick: ne
767
768
  }),
768
- ne && /* @__PURE__ */ V(u, {
769
+ re && /* @__PURE__ */ V(u, {
769
770
  icon: /* @__PURE__ */ V(c.filter, { size: 14 }),
770
- title: h("filter.drawer.title", "Filters"),
771
- onClick: ne
771
+ title: m("filter.drawer.title", "Filters"),
772
+ onClick: re
772
773
  }),
773
- v && (E ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V(l, {
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: me,
777
- children: h("dialog.cancel", "Cancel")
777
+ onClick: L,
778
+ children: m("dialog.cancel", "Cancel")
778
779
  }), /* @__PURE__ */ V(l, {
779
780
  kind: "primary",
780
781
  size: "xs",
781
- icon: w.isPending ? /* @__PURE__ */ V(p, { size: 12 }) : /* @__PURE__ */ V(c.save, { size: 12 }),
782
- onClick: I,
783
- disabled: w.isPending,
784
- children: w.isPending ? h("dialog.saving", "Saving…") : h("dialog.save", "Save")
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: pe,
789
- children: h("list.record.edit", "Edit")
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
- ...ee(16),
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(ue, {
805
+ children: o && o.length > 0 ? /* @__PURE__ */ V(j, {
805
806
  nodes: o,
806
- ctx: G
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(h("list.detail.no_layout", "No layout configured. Add {key} to the screen definition."), { key: /* @__PURE__ */ V("code", { children: _e }) })
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
  });