@declarion/react 0.250.0 → 0.251.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.
@@ -1,97 +1,98 @@
1
1
  import { useFirstScreenSettled as e } from "../../lib/capabilityPrefetch.js";
2
- import { useSchema as t } from "../../hooks/useSchema.js";
3
- import { useAuthStore as n } from "../../stores/auth.js";
4
- import { useSavedScrollOffset as r, useVirtualScrollRestoration as i } from "../../lib/scroll-restoration.js";
5
- import { useUpdateObject as a } from "../../hooks/useMutations.js";
6
- import { useDebounce as o } from "../../hooks/useDebounce.js";
7
- import { useResponsiveMode as ee } from "../../hooks/useResponsiveMode.js";
8
- import { useTabNavigate as te } from "../../hooks/useTabNavigate.js";
9
- import { useTabSearchMirror as ne } from "../../hooks/useTabSearchMirror.js";
10
- import { useRegisterScreenTab as re } from "../../hooks/useRegisterScreenTab.js";
11
- import { useEmbed as ie } from "../../embed/EmbedContext.js";
12
- import { useTabStore as ae } from "../../stores/tabs.js";
13
- import { usePreferencesStore as oe } from "../../stores/preferences.js";
14
- import { useScreenIsLive as se } from "../../stores/realtime.js";
15
- import { filterUnavailableMutationActions as ce, getScreenActions as le } from "../../lib/actions.js";
16
- import { buildDetailHrefFromId as ue, entityAllowsMutation as de, getDisplayValue as fe, pkValuesToDetailId as pe } from "../../types/schema.js";
17
- import { useFilters as me } from "../../hooks/useFilters.js";
18
- import { useActiveView as he } from "./list/useActiveView.js";
19
- import { QuickPeek as ge } from "../list/QuickPeek.js";
20
- import { clearPeekDraft as _e } from "../list/peekDraftStore.js";
21
- import { executeAction as ve } from "../../api/data.js";
22
- import { countActiveFilters as ye, parseFilterURLState as be, removeFilterAtPath as xe } from "../../lib/filters.js";
23
- import { effectiveScreenForRecord as Se } from "../../lib/variants.js";
24
- import { coerceDisplayString as Ce } from "../../lib/display-value.js";
25
- import { FilterChips as we } from "../filters/FilterChips.js";
26
- import { FilterDrawer as Te } from "../filters/FilterDrawer.js";
27
- import { listTableFeatures as Ee } from "./list/table-features.js";
2
+ import { useSearchDraft as t } from "../../hooks/useSearchDraft.js";
3
+ import { useSchema as n } from "../../hooks/useSchema.js";
4
+ import { useAuthStore as r } from "../../stores/auth.js";
5
+ import { useSavedScrollOffset as i, useVirtualScrollRestoration as a } from "../../lib/scroll-restoration.js";
6
+ import { useUpdateObject as o } from "../../hooks/useMutations.js";
7
+ import { useDebounce as ee } from "../../hooks/useDebounce.js";
8
+ import { useResponsiveMode as te } from "../../hooks/useResponsiveMode.js";
9
+ import { useTabNavigate as ne } from "../../hooks/useTabNavigate.js";
10
+ import { useTabSearchMirror as re } from "../../hooks/useTabSearchMirror.js";
11
+ import { useRegisterScreenTab as ie } from "../../hooks/useRegisterScreenTab.js";
12
+ import { useEmbed as ae } from "../../embed/EmbedContext.js";
13
+ import { useTabStore as oe } from "../../stores/tabs.js";
14
+ import { usePreferencesStore as se } from "../../stores/preferences.js";
15
+ import { useScreenIsLive as ce } from "../../stores/realtime.js";
16
+ import { filterUnavailableMutationActions as le, getScreenActions as ue } from "../../lib/actions.js";
17
+ import { buildDetailHrefFromId as de, entityAllowsMutation as fe, getDisplayValue as pe, pkValuesToDetailId as me } from "../../types/schema.js";
18
+ import { useFilters as he } from "../../hooks/useFilters.js";
19
+ import { useActiveView as ge } from "./list/useActiveView.js";
20
+ import { QuickPeek as _e } from "../list/QuickPeek.js";
21
+ import { clearPeekDraft as ve } from "../list/peekDraftStore.js";
22
+ import { executeAction as ye } from "../../api/data.js";
23
+ import { countActiveFilters as be, parseFilterURLState as xe, removeFilterAtPath as Se } from "../../lib/filters.js";
24
+ import { effectiveScreenForRecord as Ce } from "../../lib/variants.js";
25
+ import { coerceDisplayString as we } from "../../lib/display-value.js";
26
+ import { FilterChips as Te } from "../filters/FilterChips.js";
27
+ import { FilterDrawer as Ee } from "../filters/FilterDrawer.js";
28
+ import { listTableFeatures as De } from "./list/table-features.js";
28
29
  import "./list/page-size.js";
29
- import { useListFilterPresentation as De } from "./list/useListFilterPresentation.js";
30
- import { FilterOmittedNotice as Oe } from "../filters/FilterOmittedNotice.js";
31
- import { useListQuery as ke } from "./list/useListQuery.js";
32
- import { useListSort as Ae } from "./list/useListSort.js";
33
- import { rowSelectionKey as je, useListSelection as Me } from "./list/useListSelection.js";
34
- import { useListColumnLayout as Ne } from "./list/useListColumnLayout.js";
35
- import { useListRowInteraction as Pe } from "./list/useListRowInteraction.js";
36
- import { ListTable as Fe } from "./list/ListTable.js";
37
- import { ListTableRow as Ie } from "./list/ListTableRow.js";
38
- import { ListNoRows as Le } from "./list/ListNoRows.js";
39
- import { ListFooter as Re } from "./list/ListFooter.js";
40
- import { ListToolbar as ze } from "./list/ListToolbar.js";
41
- import { overwritableViewName as Be, useListViews as Ve } from "./list/useListViews.js";
42
- import { DeleteViewDialog as He } from "./list/DeleteViewDialog.js";
43
- import { ListUrlBanner as Ue } from "./list/ListUrlBanner.js";
44
- import { useFilterValueLabels as We } from "./list/use-filter-value-labels.js";
45
- import { SaveViewDialog as Ge } from "./list/SaveViewDialog.js";
46
- import { ListHeader as Ke } from "./list/ListHeader.js";
47
- import { ListFloatbar as qe } from "./list/ListFloatbar.js";
48
- import { buildListColumns as Je } from "./list/columns.js";
49
- import { RowContextMenu as Ye } from "./list/RowContextMenu.js";
50
- import { buildColumnSizeVars as Xe } from "./list/column-sizing.js";
51
- import { useHeaderReorder as Ze } from "./list/useHeaderReorder.js";
52
- import { resolveCard as Qe, resolveListProjection as $e, resolveVariantRenderFields as et } from "./list/cardProjection.js";
53
- import { resolveCellRenderer as tt } from "../fields/cells/registry.js";
54
- import { FileDraftScope as s, useFileDraftScope as nt } from "../file-widgets/draft-scope.js";
55
- import { buildFilesPayload as rt, collectCommittedFileIds as it } from "../file-widgets/payload.js";
56
- import { getSchemaFieldValue as at, serializeSchemaFieldValue as ot } from "../file-widgets/host.js";
57
- import { useText as st } from "../../hooks/useText.js";
58
- import { Suspense as ct, lazy as c, useCallback as l, useEffect as u, useMemo as d, useRef as f, useState as lt } from "react";
59
- import { Fragment as ut, jsx as p, jsxs as dt } from "react/jsx-runtime";
60
- import { useSearchParams as ft } from "react-router";
61
- import { useTable as pt } from "@tanstack/react-table";
62
- import { useVirtualizer as mt } from "@tanstack/react-virtual";
30
+ import { useListFilterPresentation as Oe } from "./list/useListFilterPresentation.js";
31
+ import { FilterOmittedNotice as ke } from "../filters/FilterOmittedNotice.js";
32
+ import { useListQuery as Ae } from "./list/useListQuery.js";
33
+ import { useListSort as je } from "./list/useListSort.js";
34
+ import { rowSelectionKey as Me, useListSelection as Ne } from "./list/useListSelection.js";
35
+ import { useListColumnLayout as Pe } from "./list/useListColumnLayout.js";
36
+ import { useListRowInteraction as Fe } from "./list/useListRowInteraction.js";
37
+ import { ListTable as Ie } from "./list/ListTable.js";
38
+ import { ListTableRow as Le } from "./list/ListTableRow.js";
39
+ import { ListNoRows as Re } from "./list/ListNoRows.js";
40
+ import { ListFooter as ze } from "./list/ListFooter.js";
41
+ import { ListToolbar as Be } from "./list/ListToolbar.js";
42
+ import { overwritableViewName as Ve, useListViews as He } from "./list/useListViews.js";
43
+ import { DeleteViewDialog as Ue } from "./list/DeleteViewDialog.js";
44
+ import { ListUrlBanner as We } from "./list/ListUrlBanner.js";
45
+ import { useFilterValueLabels as Ge } from "./list/use-filter-value-labels.js";
46
+ import { SaveViewDialog as Ke } from "./list/SaveViewDialog.js";
47
+ import { ListHeader as qe } from "./list/ListHeader.js";
48
+ import { ListFloatbar as Je } from "./list/ListFloatbar.js";
49
+ import { buildListColumns as Ye } from "./list/columns.js";
50
+ import { RowContextMenu as Xe } from "./list/RowContextMenu.js";
51
+ import { buildColumnSizeVars as Ze } from "./list/column-sizing.js";
52
+ import { useHeaderReorder as Qe } from "./list/useHeaderReorder.js";
53
+ import { resolveCard as $e, resolveListProjection as et, resolveVariantRenderFields as tt } from "./list/cardProjection.js";
54
+ import { resolveCellRenderer as nt } from "../fields/cells/registry.js";
55
+ import { FileDraftScope as s, useFileDraftScope as rt } from "../file-widgets/draft-scope.js";
56
+ import { buildFilesPayload as it, collectCommittedFileIds as at } from "../file-widgets/payload.js";
57
+ import { getSchemaFieldValue as ot, serializeSchemaFieldValue as st } from "../file-widgets/host.js";
58
+ import { useText as ct } from "../../hooks/useText.js";
59
+ import { Suspense as lt, lazy as c, useCallback as l, useEffect as u, useMemo as d, useRef as f, useState as ut } from "react";
60
+ import { Fragment as dt, jsx as p, jsxs as ft } from "react/jsx-runtime";
61
+ import { useSearchParams as pt } from "react-router";
62
+ import { useTable as mt } from "@tanstack/react-table";
63
+ import { useVirtualizer as ht } from "@tanstack/react-virtual";
63
64
  // src/components/pages/SmartListPage.impl.tsx
64
- var ht = c(() => import("./list/ListCardsBody.js").then((e) => ({ default: e.ListCardsBody })));
65
- function gt({ screenCode: e }) {
65
+ var gt = c(() => import("./list/ListCardsBody.js").then((e) => ({ default: e.ListCardsBody })));
66
+ function _t({ screenCode: e }) {
66
67
  return /* @__PURE__ */ p(s, { children: /* @__PURE__ */ p(m, { screenCode: e }) });
67
68
  }
68
- var _t = [];
69
+ var vt = [];
69
70
  function m({ screenCode: s }) {
70
- let c = st(), gt = st("errors"), m = te(), [h, g] = ft(), { data: _ } = t(), [vt, v] = lt(!1), [yt, y] = lt(!1), [bt, b] = lt(null), xt = n((e) => e.user), St = n((e) => e.activeTenant), Ct = nt(), x = _?.screens[s], S = x?.entity ? _?.entities[x.entity] : void 0, C = x?.entity, wt = de(S, "create"), Tt = de(S, "update"), Et = de(S, "delete"), w = _?.actions, T = d(() => ce(le(S?.actions, x?.actions, "list_toolbar", w), S), [
71
+ let c = ct(), _t = ct("errors"), m = ne(), [h, g] = pt(), { data: _ } = n(), [yt, v] = ut(!1), [bt, y] = ut(!1), [xt, b] = ut(null), St = r((e) => e.user), Ct = r((e) => e.activeTenant), wt = rt(), x = _?.screens[s], S = x?.entity ? _?.entities[x.entity] : void 0, C = x?.entity, Tt = fe(S, "create"), Et = fe(S, "update"), Dt = fe(S, "delete"), w = _?.actions, T = d(() => le(ue(S?.actions, x?.actions, "list_toolbar", w), S), [
71
72
  S,
72
73
  x?.actions,
73
74
  w
74
- ]), E = d(() => ce(le(S?.actions, void 0, "list_floatbar", w), S), [S, w]), D = d(() => {
75
+ ]), E = d(() => le(ue(S?.actions, void 0, "list_floatbar", w), S), [S, w]), D = d(() => {
75
76
  let e = /* @__PURE__ */ new Map(), t = (t) => {
76
- for (let n of le(S?.actions, t, "list_row", w)) e.set(n.code, n);
77
+ for (let n of ue(S?.actions, t, "list_row", w)) e.set(n.code, n);
77
78
  };
78
79
  t(x?.row_actions);
79
80
  for (let e of x?.variants?.items() ?? []) e.row_actions !== void 0 && t(e.row_actions);
80
- return ce([...e.values()], S);
81
+ return le([...e.values()], S);
81
82
  }, [
82
83
  S,
83
84
  x,
84
85
  w
85
- ]), Dt = x?.row_actions !== void 0, Ot = d(() => E.length > 0 || S?.export?.enabled !== !1 && x?.export?.enabled !== !1, [
86
+ ]), Ot = x?.row_actions !== void 0, kt = d(() => E.length > 0 || S?.export?.enabled !== !1 && x?.export?.enabled !== !1, [
86
87
  E,
87
88
  S?.export?.enabled,
88
89
  x?.export?.enabled
89
- ]), kt = !!S?.soft_delete, At = kt && (xt?.permissions ?? []).some((e) => e === "feature:view_deleted" || e === "feature:*" || e === "*"), jt = At && h.get("include_deleted") === "true", Mt = ie(), { openTab: Nt, updateTabSearch: Pt, findTabByPathname: Ft } = ae();
90
- re(x, S, h.toString()), ne(x?.route);
91
- let It = l((e) => {
92
- if (!x?.route || !S || Mt.enabled) return;
93
- let t = Ft(x.route);
94
- t ? Pt(t.id, e) : Nt({
90
+ ]), At = !!S?.soft_delete, jt = At && (St?.permissions ?? []).some((e) => e === "feature:view_deleted" || e === "feature:*" || e === "*"), Mt = jt && h.get("include_deleted") === "true", Nt = ae(), { openTab: Pt, updateTabSearch: Ft, findTabByPathname: It } = oe();
91
+ ie(x, S, h.toString()), re(x?.route);
92
+ let Lt = l((e) => {
93
+ if (!x?.route || !S || Nt.enabled) return;
94
+ let t = It(x.route);
95
+ t ? Ft(t.id, e) : Pt({
95
96
  pathname: x.route,
96
97
  search: e,
97
98
  title: c(x.display?.name) || c(S.display.name_plural),
@@ -102,55 +103,55 @@ function m({ screenCode: s }) {
102
103
  c,
103
104
  x,
104
105
  S,
105
- Mt.enabled,
106
+ Nt.enabled,
107
+ It,
106
108
  Ft,
107
- Pt,
108
- Nt
109
- ]), O = parseInt(h.get("page") ?? "1", 10), Lt = (() => {
109
+ Pt
110
+ ]), O = parseInt(h.get("page") ?? "1", 10), Rt = (() => {
110
111
  let e = parseInt(h.get("per_page") ?? "", 10);
111
112
  return !Number.isFinite(e) || e <= 0 || e > 1e3 ? 200 : e;
112
- })(), Rt = h.get("search") ?? "", zt = d(() => {
113
- let e = be(h);
114
- return e.error === null ? null : gt(e.errorCode ?? "", e.error);
115
- }, [gt, h]), k = he({
113
+ })(), zt = h.get("search") ?? "", Bt = d(() => {
114
+ let e = xe(h);
115
+ return e.error === null ? null : _t(e.errorCode ?? "", e.error);
116
+ }, [_t, h]), k = ge({
116
117
  screenCode: s,
117
118
  screen: x,
118
119
  entity: S,
119
120
  searchParams: h,
120
121
  setSearchParams: g,
121
- userId: xt?.id,
122
- tenantId: St?.id,
123
- filterError: !!zt
124
- }), { filters: Bt, columns: Vt, sort: Ht } = k.defaults, { filters: Ut, setFilters: A, clearFilters: Wt } = me({ defaults: Bt }), { visibleFilterState: Gt, filterFieldMeta: Kt, allFilterFieldMeta: qt, filterFieldName: Jt } = De(x, S, _?.entities, Ut), j = Gt.filters, Yt = ye(j), Xt = l(() => A(_t), [A]), Zt = Ae({
122
+ userId: St?.id,
123
+ tenantId: Ct?.id,
124
+ filterError: !!Bt
125
+ }), { filters: Vt, columns: Ht, sort: Ut } = k.defaults, { filters: Wt, setFilters: A, clearFilters: Gt } = he({ defaults: Vt }), { visibleFilterState: Kt, filterFieldMeta: qt, allFilterFieldMeta: Jt, filterFieldName: Yt } = Oe(x, S, _?.entities, Wt), j = Kt.filters, Xt = be(j), Zt = l(() => A(vt), [A]), Qt = je({
125
126
  searchParams: h,
126
127
  setSearchParams: g,
127
- defaultSort: Ht,
128
- commitScreenTabSearch: It
129
- }), { cols: M, nullsByField: Qt, value: $t, forRequest: en, tableSorting: tn, write: nn, applyColumn: rn, shiftClickColumn: an, appendColumn: on, clearColumn: sn, clearAll: cn } = Zt, ln = Ne({
128
+ defaultSort: Ut,
129
+ commitScreenTabSearch: Lt
130
+ }), { cols: M, nullsByField: $t, value: en, forRequest: tn, tableSorting: nn, write: rn, applyColumn: an, shiftClickColumn: on, appendColumn: sn, clearColumn: cn, clearAll: ln } = Qt, un = Pe({
130
131
  screenCode: s,
131
132
  screen: x,
132
133
  searchParams: h,
133
134
  setSearchParams: g,
134
- defaultColumns: Vt
135
- }), { visible: N, sizing: un, setSizing: dn, apply: fn, commitResize: pn } = ln, mn = Ve({
135
+ defaultColumns: Ht
136
+ }), { visible: N, sizing: dn, setSizing: fn, apply: pn, commitResize: mn } = un, hn = He({
136
137
  screenCode: s,
137
138
  screen: x,
138
139
  entity: S,
139
140
  searchParams: h,
140
141
  setSearchParams: g,
141
- userId: xt?.id,
142
- tenantId: St?.id,
142
+ userId: St?.id,
143
+ tenantId: Ct?.id,
143
144
  all: k.all,
144
145
  activeId: k.activeId,
145
146
  active: k.active,
146
147
  clearedKey: k.clearedKey,
147
- filters: Ut,
148
+ filters: Wt,
148
149
  visibleColumns: N,
149
- sort: $t
150
- }), { active: P, saveAsNew: hn, overwriteActive: gn, isSaving: _n } = mn, vn = o(Rt, 300), F = ee(), I = d(() => {
150
+ sort: en
151
+ }), { active: P, saveAsNew: gn, overwriteActive: _n, isSaving: vn } = hn, yn = ee(zt, 300), F = te(), I = d(() => {
151
152
  let e = x?.responsive?.[F.category]?.presentation;
152
153
  return e === "table" || e === "cards" ? e : F.category === "phone" ? "cards" : "table";
153
- }, [x?.responsive, F.category]), yn = d(() => Qe({
154
+ }, [x?.responsive, F.category]), bn = d(() => $e({
154
155
  entity: S,
155
156
  screen: x,
156
157
  savedViewColumns: P?.columns
@@ -158,12 +159,12 @@ function m({ screenCode: s }) {
158
159
  S,
159
160
  x,
160
161
  P?.columns
161
- ]), bn = d(() => $e({
162
+ ]), xn = d(() => et({
162
163
  entity: S,
163
164
  screen: x,
164
165
  presentation: I,
165
166
  visibleColumns: N,
166
- card: yn,
167
+ card: bn,
167
168
  rowActions: D,
168
169
  toolbarActions: T,
169
170
  bulkActions: E,
@@ -174,41 +175,41 @@ function m({ screenCode: s }) {
174
175
  x,
175
176
  I,
176
177
  N,
177
- yn,
178
+ bn,
178
179
  D,
179
180
  T,
180
181
  E,
181
182
  M,
182
183
  _?.screens
183
- ]), xn = ke({
184
+ ]), Sn = Ae({
184
185
  entity: S,
185
186
  entityCode: C,
186
187
  screen: x,
187
188
  screenCode: s,
188
189
  page: O,
189
- perPage: Lt,
190
- sortForRequest: en,
191
- debouncedSearch: vn,
190
+ perPage: Rt,
191
+ sortForRequest: tn,
192
+ debouncedSearch: yn,
192
193
  filters: j,
193
194
  isHeld: k.isHeld,
194
195
  prefetchWhileHeld: k.prefetchWhileHeld,
195
196
  retryHeld: k.retryViews,
196
- includeDeleted: jt,
197
- expand: bn.expandFields,
198
- select: bn.selectFields,
197
+ includeDeleted: Mt,
198
+ expand: xn.expandFields,
199
+ select: xn.selectFields,
199
200
  runCountQuery: !0,
200
201
  urlKey: `${C ?? ""}|${h.toString()}`
201
- }), { rows: L, meta: Sn, refs: Cn, isLoading: wn, isFetching: Tn, isShowingPreviousRows: En, isError: Dn, error: On, isLoadingStale: kn, retry: An, countTotal: jn, countStrategy: Mn, countLoading: Nn, countError: Pn, totalPages: R, hasMorePages: Fn, isCursor: In, fetchNextPage: Ln, isFetchingNextPage: Rn } = xn;
202
- e(!wn);
203
- let zn = Me(S, L, Tn), { state: Bn, setState: z, ids: B, pkValues: Vn, rows: Hn, keyOf: V } = zn, Un = se(S?.realtime, C ?? ""), Wn = a(C ?? ""), H = f(Cn);
204
- H.current = Cn;
205
- let Gn = d(() => {
202
+ }), { rows: L, meta: Cn, refs: wn, isLoading: Tn, isFetching: En, isShowingPreviousRows: Dn, isError: On, error: kn, isLoadingStale: An, retry: jn, countTotal: Mn, countStrategy: Nn, countLoading: Pn, countError: Fn, totalPages: R, hasMorePages: In, isCursor: Ln, fetchNextPage: Rn, isFetchingNextPage: zn } = Sn;
203
+ e(!Tn);
204
+ let Bn = Ne(S, L, En), { state: Vn, setState: z, ids: B, pkValues: Hn, rows: Un, keyOf: V } = Bn, Wn = ce(S?.realtime, C ?? ""), Gn = o(C ?? ""), H = f(wn);
205
+ H.current = wn;
206
+ let Kn = d(() => {
206
207
  let e = /* @__PURE__ */ new Map();
207
208
  if (!S) return e;
208
- for (let t of et(S, x, P?.columns)) {
209
+ for (let t of tt(S, x, P?.columns)) {
209
210
  if (t.startsWith("$") || S.files?.get(t)) continue;
210
211
  let n = S.fields.get(t);
211
- n && e.set(t, tt({
212
+ n && e.set(t, nt({
212
213
  field: n,
213
214
  fieldName: t,
214
215
  surface: "list",
@@ -230,96 +231,96 @@ function m({ screenCode: s }) {
230
231
  _?.screens,
231
232
  H,
232
233
  c
233
- ]), { labelFor: Kn, refs: qn } = We(qt, j, Cn, _?.entities), U = Pe({
234
+ ]), { labelFor: qn, refs: Jn } = Ge(Jt, j, wn, _?.entities), U = Fe({
234
235
  entity: S,
235
236
  screen: x,
236
237
  screens: _?.screens,
237
238
  entities: _?.entities,
238
239
  searchParams: h,
239
240
  tabNavigate: m,
240
- commitScreenTabSearch: It,
241
+ commitScreenTabSearch: Lt,
241
242
  isPhone: F.category === "phone",
242
- canUpdate: Tt
243
- }), { peekAllowed: W, peekRow: G, setPeekRow: K, peekFields: Jn, peekActions: Yn, peekExecute: Xn, contextMenu: q, setContextMenu: Zn } = U, J = d(() => !x || !S ? !1 : ue(x, "_", S, _?.screens) !== null, [
243
+ canUpdate: Et
244
+ }), { peekAllowed: W, peekRow: G, setPeekRow: K, peekFields: Yn, peekActions: Xn, peekExecute: Zn, contextMenu: q, setContextMenu: Qn } = U, J = d(() => !x || !S ? !1 : de(x, "_", S, _?.screens) !== null, [
244
245
  x,
245
246
  S,
246
247
  _?.screens
247
- ]), Qn = d(() => Je({
248
+ ]), $n = d(() => Ye({
248
249
  visibleCols: N,
249
250
  entity: S,
250
251
  screen: x,
251
252
  schema: _,
252
253
  entityCode: C,
253
254
  rowActions: D,
254
- hasBatchActions: Ot,
255
- hasExplicitRowActions: Dt,
256
- canUpdate: Tt,
257
- canDelete: Et,
255
+ hasBatchActions: kt,
256
+ hasExplicitRowActions: Ot,
257
+ canUpdate: Et,
258
+ canDelete: Dt,
258
259
  peekEnabled: W,
259
260
  hasDetailTarget: J,
260
261
  t: c,
261
262
  tabNavigate: m,
262
263
  refsRef: H,
263
- rowSelectionKey: je,
264
+ rowSelectionKey: Me,
264
265
  setPeekRow: K
265
266
  }), [
266
267
  x,
267
268
  S,
268
269
  N,
269
270
  m,
270
- Ot,
271
+ kt,
271
272
  D,
272
- Dt,
273
+ Ot,
273
274
  C,
274
275
  W,
275
276
  J,
276
277
  _,
277
278
  c,
278
- Tt,
279
279
  Et,
280
+ Dt,
280
281
  H,
281
282
  K
282
- ]), Y = pt({
283
- features: Ee,
283
+ ]), Y = mt({
284
+ features: De,
284
285
  data: L,
285
- columns: Qn,
286
+ columns: $n,
286
287
  manualSorting: !0,
287
288
  enableColumnResizing: !0,
288
289
  columnResizeMode: "onChange",
289
- onColumnSizingChange: dn,
290
+ onColumnSizingChange: fn,
290
291
  state: {
291
- sorting: tn,
292
- rowSelection: Bn,
293
- columnSizing: un
292
+ sorting: nn,
293
+ rowSelection: Vn,
294
+ columnSizing: dn
294
295
  },
295
296
  onSortingChange: (e) => {
296
- let t = (typeof e == "function" ? e(tn) : e).slice(0, 5);
297
+ let t = (typeof e == "function" ? e(nn) : e).slice(0, 5);
297
298
  if (t.length === 0) {
298
- nn([]);
299
+ rn([]);
299
300
  return;
300
301
  }
301
302
  let n = t.map((e) => {
302
- let t = Qt.get(e.id);
303
+ let t = $t.get(e.id);
303
304
  return {
304
305
  field: e.id,
305
306
  dir: e.desc ? "desc" : "asc",
306
307
  ...t ? { nulls: t } : {}
307
308
  };
308
309
  });
309
- nn(n);
310
+ rn(n);
310
311
  },
311
312
  onRowSelectionChange: z,
312
313
  getRowId: V
313
- }), X = Y.state.columnResizing.isResizingColumn, $n = f(!1);
314
+ }), X = Y.state.columnResizing.isResizingColumn, er = f(!1);
314
315
  u(() => {
315
- let e = !!$n.current && !X;
316
- $n.current = X, e && pn(Y.state.columnSizing);
316
+ let e = !!er.current && !X;
317
+ er.current = X, e && mn(Y.state.columnSizing);
317
318
  }, [
318
319
  X,
319
- pn,
320
+ mn,
320
321
  Y
321
322
  ]);
322
- let er = Xe(Y), tr = Y.getTotalSize();
323
+ let tr = Ze(Y), nr = Y.getTotalSize();
323
324
  u(() => {
324
325
  let e = (e) => {
325
326
  let t = e.target?.tagName;
@@ -327,25 +328,25 @@ function m({ screenCode: s }) {
327
328
  };
328
329
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
329
330
  }, []);
330
- let Z = f(null), { rows: Q } = Y.getRowModel(), nr = f(null), rr = Ze({
331
+ let Z = f(null), { rows: Q } = Y.getRowModel(), rr = f(null), ir = Qe({
331
332
  visibleCols: N,
332
- onReorder: fn,
333
+ onReorder: pn,
333
334
  scrollElRef: Z,
334
- theadRef: nr
335
- }), ir = oe((e) => e.density), ar = oe((e) => e.zebra), or = r(), $ = mt({
335
+ theadRef: rr
336
+ }), ar = se((e) => e.density), or = se((e) => e.zebra), sr = i(), $ = ht({
336
337
  count: Q.length,
337
338
  getScrollElement: () => Z.current,
338
339
  estimateSize: () => I === "cards" ? 142 : 48,
339
340
  overscan: 10,
340
- initialOffset: or
341
- }), sr = d(() => Q.map((e) => e.id), [Q]);
342
- i({
341
+ initialOffset: sr
342
+ }), cr = d(() => Q.map((e) => e.id), [Q]);
343
+ a({
343
344
  virtualizer: $,
344
345
  scrollElementRef: Z,
345
- rowKeys: sr
346
+ rowKeys: cr
346
347
  }), u(() => {
347
348
  $.measure();
348
- }, [ir, $]), u(() => {
349
+ }, [ar, $]), u(() => {
349
350
  $.measure();
350
351
  }, [
351
352
  F.width,
@@ -353,52 +354,52 @@ function m({ screenCode: s }) {
353
354
  I,
354
355
  $
355
356
  ]);
356
- let cr = l((e) => {
357
+ let lr = l((e) => {
357
358
  g((t) => {
358
359
  let n = new URLSearchParams(t);
359
360
  return e ? n.set("search", e) : n.delete("search"), n.set("page", "1"), n;
360
361
  });
361
- }, [g]), lr = l(() => {
362
+ }, [g]), [ur, dr] = t(zt, lr), fr = l(() => {
362
363
  g((e) => {
363
364
  let t = new URLSearchParams(e);
364
365
  return t.get("include_deleted") ? t.delete("include_deleted") : t.set("include_deleted", "true"), t.set("page", "1"), t;
365
366
  });
366
- }, [g]), ur = l((e) => {
367
+ }, [g]), pr = l((e) => {
367
368
  g((t) => {
368
369
  let n = new URLSearchParams(t);
369
370
  return n.set("page", String(e)), n;
370
371
  });
371
372
  }, [g]);
372
373
  u(() => {
373
- R !== void 0 && O > R && ur(R);
374
+ R !== void 0 && O > R && pr(R);
374
375
  }, [
375
376
  R,
376
377
  O,
377
- ur
378
+ pr
378
379
  ]);
379
- let dr = l((e) => {
380
+ let mr = l((e) => {
380
381
  g((t) => {
381
382
  let n = new URLSearchParams(t);
382
383
  return n.set("per_page", String(e)), n.set("page", "1"), n;
383
384
  });
384
385
  }, [g]);
385
386
  if (!x || !S) return null;
386
- let fr = S.display, pr = c(x.display?.name) || c(fr.name), mr = x.display?.icon || fr.icon, hr = c(x.display?.description) || c(fr.description), gr = F.category === "phone", _r = I === "cards", vr = Vn.map((e) => pe(S, e)), yr = {
387
+ let hr = S.display, gr = c(x.display?.name) || c(hr.name), _r = x.display?.icon || hr.icon, vr = c(x.display?.description) || c(hr.description), yr = F.category === "phone", br = I === "cards", xr = Hn.map((e) => me(S, e)), Sr = {
387
388
  entity: S,
388
389
  entityCode: C ?? "",
389
390
  screen: x,
390
391
  screenRoute: x.route,
391
- selectedRows: Hn,
392
- selectedIds: vr,
392
+ selectedRows: Un,
393
+ selectedIds: xr,
393
394
  t: c,
394
395
  tabNavigate: (e, t) => m(e, {
395
396
  title: t?.title,
396
397
  icon: t?.icon,
397
398
  search: t?.search
398
399
  }),
399
- runActionApi: (e, t) => ve(e, t)
400
+ runActionApi: (e, t) => ye(e, t)
400
401
  };
401
- return /* @__PURE__ */ dt("div", {
402
+ return /* @__PURE__ */ ft("div", {
402
403
  style: {
403
404
  display: "flex",
404
405
  flexDirection: "column",
@@ -406,10 +407,10 @@ function m({ screenCode: s }) {
406
407
  background: "var(--background)"
407
408
  },
408
409
  children: [
409
- /* @__PURE__ */ dt(ut, { children: [
410
- /* @__PURE__ */ p(Ke, {
411
- title: pr,
412
- description: hr,
410
+ /* @__PURE__ */ ft(dt, { children: [
411
+ /* @__PURE__ */ p(qe, {
412
+ title: gr,
413
+ description: vr,
413
414
  toolbarActions: T,
414
415
  screenActionLayout: x.action_layout,
415
416
  entityActionLayout: S.action_layout,
@@ -417,75 +418,75 @@ function m({ screenCode: s }) {
417
418
  data: L,
418
419
  rowKey: V,
419
420
  onActionSuccess: () => z({}),
420
- widgetContext: yr
421
+ widgetContext: Sr
421
422
  }),
422
- /* @__PURE__ */ p(ze, {
423
+ /* @__PURE__ */ p(Be, {
423
424
  screen: x,
424
425
  entity: S,
425
426
  entityCode: C,
426
427
  schema: _,
427
428
  screenCode: s,
428
- screenName: pr,
429
- isPhone: gr,
430
- isCardsPresentation: _r,
431
- sort: Zt,
432
- columns: ln,
433
- views: mn,
434
- query: xn,
435
- selection: zn,
429
+ screenName: gr,
430
+ isPhone: yr,
431
+ isCardsPresentation: br,
432
+ sort: Qt,
433
+ columns: un,
434
+ views: hn,
435
+ query: Sn,
436
+ selection: Bn,
436
437
  filters: {
437
438
  json: j,
438
- debouncedSearch: vn,
439
- count: Yt,
439
+ debouncedSearch: yn,
440
+ count: Xt,
440
441
  onOpen: () => v(!0)
441
442
  },
442
- searchValue: Rt,
443
- onSearchChange: cr,
443
+ searchValue: ur,
444
+ onSearchChange: dr,
444
445
  onSaveView: () => y(!0),
445
446
  onDeleteView: b,
446
447
  page: O,
447
- perPage: Lt,
448
- includeDeleted: jt,
449
- canViewDeleted: At,
450
- onToggleDeleted: lr,
448
+ perPage: Rt,
449
+ includeDeleted: Mt,
450
+ canViewDeleted: jt,
451
+ onToggleDeleted: fr,
451
452
  realtime: S?.realtime === !0,
452
- isLive: Un
453
+ isLive: Wn
453
454
  }),
454
- /* @__PURE__ */ p(Ue, {
455
- filterError: zt,
455
+ /* @__PURE__ */ p(We, {
456
+ filterError: Bt,
456
457
  unresolvedViewId: k.isUnresolved ? k.activeId : null,
457
- onClearFilters: Wt,
458
+ onClearFilters: Gt,
458
459
  onClearView: k.clearActiveView
459
460
  }),
460
- Gt.omitted && /* @__PURE__ */ p(Oe, { className: "px-5 pb-2.5" }),
461
+ Kt.omitted && /* @__PURE__ */ p(ke, { className: "px-5 pb-2.5" }),
461
462
  j.length > 0 && /* @__PURE__ */ p("div", {
462
463
  style: { padding: "0 20px 10px" },
463
- children: /* @__PURE__ */ p(we, {
464
+ children: /* @__PURE__ */ p(Te, {
464
465
  filters: j,
465
- resolveValue: Kn,
466
- onRemoveAtPath: (e) => A(xe(j, e)),
467
- onClearAll: Xt,
466
+ resolveValue: qn,
467
+ onRemoveAtPath: (e) => A(Se(j, e)),
468
+ onClearAll: Zt,
468
469
  onChipClick: () => v(!0),
469
- fieldLabel: Jt
470
+ fieldLabel: Yt
470
471
  })
471
472
  })
472
473
  ] }),
473
- /* @__PURE__ */ p(Le, {
474
- isLoading: wn,
475
- tableLoadingStale: kn,
476
- isError: Dn,
477
- error: On,
474
+ /* @__PURE__ */ p(Re, {
475
+ isLoading: Tn,
476
+ tableLoadingStale: An,
477
+ isError: On,
478
+ error: kn,
478
479
  rowCount: L.length,
479
480
  entity: S,
480
481
  screen: x,
481
- screenName: pr,
482
- screenIcon: mr,
483
- isFiltered: !!vn || Yt > 0,
484
- canCreate: wt,
482
+ screenName: gr,
483
+ screenIcon: _r,
484
+ isFiltered: !!yn || Xt > 0,
485
+ canCreate: Tt,
485
486
  toolbarActions: T,
486
- onRetry: An
487
+ onRetry: jn
487
488
  }),
488
- wn || Dn || L.length === 0 ? null : /* @__PURE__ */ p("div", {
489
+ Tn || On || L.length === 0 ? null : /* @__PURE__ */ p("div", {
489
490
  style: {
490
491
  flex: 1,
491
492
  minHeight: 0,
@@ -493,7 +494,7 @@ function m({ screenCode: s }) {
493
494
  display: "flex",
494
495
  flexDirection: "column"
495
496
  },
496
- children: /* @__PURE__ */ dt("div", {
497
+ children: /* @__PURE__ */ ft("div", {
497
498
  style: {
498
499
  background: "var(--surface)",
499
500
  border: "1px solid var(--border)",
@@ -514,9 +515,9 @@ function m({ screenCode: s }) {
514
515
  flex: 1,
515
516
  minHeight: 0
516
517
  },
517
- children: I === "cards" ? /* @__PURE__ */ p(ct, {
518
+ children: I === "cards" ? /* @__PURE__ */ p(lt, {
518
519
  fallback: null,
519
- children: /* @__PURE__ */ p(ht, {
520
+ children: /* @__PURE__ */ p(gt, {
520
521
  rows: Q,
521
522
  virtualizer: $,
522
523
  entity: S,
@@ -525,100 +526,100 @@ function m({ screenCode: s }) {
525
526
  entities: _?.entities,
526
527
  savedViewColumns: P?.columns,
527
528
  refs: H.current,
528
- renderers: Gn,
529
+ renderers: Kn,
529
530
  rowActions: D,
530
531
  tabNavigate: m,
531
532
  interaction: U,
532
- hasSoftDelete: kt,
533
- zebra: ar,
534
- hasBatchActions: Ot,
533
+ hasSoftDelete: At,
534
+ zebra: or,
535
+ hasBatchActions: kt,
535
536
  hasDetailTarget: J,
536
537
  rowKey: V
537
538
  })
538
- }) : /* @__PURE__ */ p(Fe, {
539
- showsPreviousRows: En,
539
+ }) : /* @__PURE__ */ p(Ie, {
540
+ showsPreviousRows: Dn,
540
541
  table: Y,
541
- columns: Qn,
542
+ columns: $n,
542
543
  rows: Q,
543
544
  entity: S,
544
- columnSizeVars: er,
545
- totalColumnsWidth: tr,
546
- theadRef: nr,
545
+ columnSizeVars: tr,
546
+ totalColumnsWidth: nr,
547
+ theadRef: rr,
547
548
  virtualizer: $,
548
549
  visibleCols: N,
549
- headerReorder: rr,
550
+ headerReorder: ir,
550
551
  sortCols: M,
551
- sortNullsMap: Qt,
552
- shiftClickColumn: an,
553
- applyColumnSort: rn,
554
- appendColumnSort: on,
555
- clearColumnSort: sn,
556
- clearAllSorts: cn,
557
- renderRow: (e, t) => /* @__PURE__ */ p(Ie, {
552
+ sortNullsMap: $t,
553
+ shiftClickColumn: on,
554
+ applyColumnSort: an,
555
+ appendColumnSort: sn,
556
+ clearColumnSort: cn,
557
+ clearAllSorts: ln,
558
+ renderRow: (e, t) => /* @__PURE__ */ p(Le, {
558
559
  row: e,
559
560
  rowIndex: t,
560
561
  entity: S,
561
- hasSoftDelete: kt,
562
- zebra: ar,
562
+ hasSoftDelete: At,
563
+ zebra: or,
563
564
  hasDetailTarget: J,
564
565
  interaction: U,
565
566
  measureElement: $.measureElement
566
567
  }, e.id),
567
568
  isResizingColumn: X
568
569
  })
569
- }), /* @__PURE__ */ p(Re, {
570
- meta: Sn,
571
- isCursor: In,
572
- isPhone: gr,
570
+ }), /* @__PURE__ */ p(ze, {
571
+ meta: Cn,
572
+ isCursor: Ln,
573
+ isPhone: yr,
573
574
  rowsLoaded: L.length,
574
575
  selectedCount: B.length,
575
- countTotal: jn,
576
- countStrategy: Mn,
577
- countLoading: Nn,
578
- countError: Pn,
576
+ countTotal: Mn,
577
+ countStrategy: Nn,
578
+ countLoading: Pn,
579
+ countError: Fn,
579
580
  page: O,
580
581
  totalPages: R,
581
- goToPage: ur,
582
- perPage: Lt,
583
- setPerPage: dr,
584
- hasMorePages: Fn,
585
- fetchNextPage: Ln,
586
- isFetchingNextPage: Rn
582
+ goToPage: pr,
583
+ perPage: Rt,
584
+ setPerPage: mr,
585
+ hasMorePages: In,
586
+ fetchNextPage: Rn,
587
+ isFetchingNextPage: zn
587
588
  })]
588
589
  })
589
590
  }),
590
- /* @__PURE__ */ p(Te, {
591
- open: vt,
591
+ /* @__PURE__ */ p(Ee, {
592
+ open: yt,
592
593
  onClose: () => v(!1),
593
594
  filters: j,
594
595
  onApply: A,
595
- availableFields: Kt,
596
- allFields: qt,
597
- fieldLabel: Jt,
598
- resolveValue: Kn,
596
+ availableFields: qt,
597
+ allFields: Jt,
598
+ fieldLabel: Yt,
599
+ resolveValue: qn,
599
600
  defaultFilters: x?.default_filters,
600
- refs: qn
601
+ refs: Jn
601
602
  }),
602
- /* @__PURE__ */ p(He, {
603
- view: bt,
603
+ /* @__PURE__ */ p(Ue, {
604
+ view: xt,
604
605
  onCancel: () => b(null),
605
606
  onConfirm: (e) => {
606
- mn.deleteView(e).catch(() => void 0).finally(() => b(null));
607
+ hn.deleteView(e).catch(() => void 0).finally(() => b(null));
607
608
  }
608
609
  }),
609
- /* @__PURE__ */ p(Ge, {
610
- open: yt,
611
- pending: _n,
610
+ /* @__PURE__ */ p(Ke, {
611
+ open: bt,
612
+ pending: vn,
612
613
  onClose: () => y(!1),
613
- overwriteViewName: Be(c, P),
614
+ overwriteViewName: Ve(c, P),
614
615
  onOverwrite: async () => {
615
- await gn(), y(!1);
616
+ await _n(), y(!1);
616
617
  },
617
618
  onSave: async (e) => {
618
- await hn(e), y(!1);
619
+ await gn(e), y(!1);
619
620
  }
620
621
  }),
621
- B.length > 0 && /* @__PURE__ */ p(qe, {
622
+ B.length > 0 && /* @__PURE__ */ p(Je, {
622
623
  selectedIds: B,
623
624
  floatbarActions: E,
624
625
  screenActionLayout: x.action_layout,
@@ -630,9 +631,9 @@ function m({ screenCode: s }) {
630
631
  screen: x,
631
632
  onClear: () => z({}),
632
633
  onActionSuccess: () => z({}),
633
- widgetContext: yr
634
+ widgetContext: Sr
634
635
  }),
635
- q && S && x && /* @__PURE__ */ p(Ye, {
636
+ q && S && x && /* @__PURE__ */ p(Xe, {
636
637
  x: q.x,
637
638
  y: q.y,
638
639
  row: q.row,
@@ -646,27 +647,27 @@ function m({ screenCode: s }) {
646
647
  peekAllowed: W,
647
648
  hasDetailTarget: J,
648
649
  onPeek: K,
649
- onClose: () => Zn(null)
650
+ onClose: () => Qn(null)
650
651
  }),
651
- W && G && S && /* @__PURE__ */ p(ge, {
652
+ W && G && S && /* @__PURE__ */ p(_e, {
652
653
  entity: S,
653
654
  entityCode: C,
654
655
  record: G,
655
- title: fe(c, G, S) || c(S.display.name),
656
+ title: pe(c, G, S) || c(S.display.name),
656
657
  recordId: (() => {
657
658
  let e = S.fields.names()?.find((e) => S.fields.get(e)?.primary);
658
- return e && S.fields.get(e)?.type !== "uuid" ? Ce(G[e]) : void 0;
659
+ return e && S.fields.get(e)?.type !== "uuid" ? we(G[e]) : void 0;
659
660
  })(),
660
- fields: Jn,
661
- screen: Se(S, x, G),
662
- actions: Yn,
663
- screenActionLayout: Se(S, x, G)?.action_layout,
661
+ fields: Yn,
662
+ screen: Ce(S, x, G),
663
+ actions: Xn,
664
+ screenActionLayout: Ce(S, x, G)?.action_layout,
664
665
  entityActionLayout: S.action_layout,
665
- executeAction: Xn,
666
+ executeAction: Zn,
666
667
  onClose: () => {
667
668
  if (S && G) {
668
669
  let e = S.fields.names()?.find((e) => S.fields.get(e)?.primary);
669
- e && _e(Ce(G[e]));
670
+ e && ve(we(G[e]));
670
671
  }
671
672
  K(null);
672
673
  },
@@ -678,28 +679,28 @@ function m({ screenCode: s }) {
678
679
  K(e);
679
680
  let t = S.fields.names()?.find((e) => S.fields.get(e)?.primary);
680
681
  if (!t) return;
681
- let n = Ce(e[t]), r = {};
682
+ let n = we(e[t]), r = {};
682
683
  for (let t of S.fields.names()) {
683
- let n = at(S, e, t), i = at(S, G, t), a = ot(S, t, n), o = ot(S, t, i);
684
+ let n = ot(S, e, t), i = ot(S, G, t), a = st(S, t, n), o = st(S, t, i);
684
685
  (a === "" ? null : a) !== (o === "" || o === void 0 ? null : o) && (r[t] = a);
685
686
  }
686
- let i = rt({
687
+ let i = it({
687
688
  entity: S,
688
689
  formData: e,
689
690
  record: G,
690
691
  isNew: !1
691
692
  });
692
693
  if (Object.keys(i).length > 0 && (r.$files = i), Object.keys(r).length === 0) return;
693
- let a = it(i);
694
- Wn.mutate({
694
+ let a = at(i);
695
+ Gn.mutate({
695
696
  pkValues: n,
696
697
  data: r
697
698
  }, { onSuccess: () => {
698
- a.forEach((e) => Ct.markCommitted(e));
699
+ a.forEach((e) => wt.markCommitted(e));
699
700
  } });
700
701
  }
701
702
  })
702
703
  ]
703
704
  });
704
705
  }
705
- export { gt as SmartListPage };
706
+ export { _t as SmartListPage };