@declarion/react 0.38.5 → 0.39.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 (45) hide show
  1. package/dist-lib/{DraggableChildrenTable-DvJO6-m0.js → DraggableChildrenTable-DziCVhq6.js} +1 -1
  2. package/dist-lib/{Grid-D2ArPFCz.js → Grid-BTX2tkCT.js} +2 -2
  3. package/dist-lib/{LayoutRenderer-C8DQ61Vo.js → LayoutRenderer-CwMERoPJ.js} +387 -285
  4. package/dist-lib/{MarkdownRenderer-CSuODN70.js → MarkdownRenderer-dHOTEhUa.js} +1 -1
  5. package/dist-lib/{RefreshControl-CHvOUn0o.js → RefreshControl--UAgflh7.js} +291 -209
  6. package/dist-lib/{SmartDetailPage.impl-Cl306lX3.js → SmartDetailPage.impl-Bj7MtHxi.js} +473 -414
  7. package/dist-lib/{SmartRecordListPage.impl-j8bhyL4e.js → SmartRecordListPage.impl-CZXzVhPC.js} +164 -164
  8. package/dist-lib/api/params.d.ts +12 -11
  9. package/dist-lib/components/columns/ColumnPicker.d.ts +11 -1
  10. package/dist-lib/components/detail-layout/EvidenceBlock.d.ts +6 -0
  11. package/dist-lib/components/detail-layout/useManualColumnResize.d.ts +25 -0
  12. package/dist-lib/components/list/QuickPeek.d.ts +11 -2
  13. package/dist-lib/components/pages/list/{ListBulkBar.d.ts → ListFloatbar.d.ts} +3 -3
  14. package/dist-lib/components/pages/list/RowActionsCell.d.ts +8 -10
  15. package/dist-lib/components/pages/list/RowContextMenu.d.ts +29 -0
  16. package/dist-lib/components/pages/list/SaveViewDialog.d.ts +5 -1
  17. package/dist-lib/components/pages/list/cardProjection.d.ts +1 -1
  18. package/dist-lib/components/pages/list/column-sizing.d.ts +15 -0
  19. package/dist-lib/components/pages/list/columns.d.ts +3 -0
  20. package/dist-lib/components/pages/list/useHeaderReorder.d.ts +26 -0
  21. package/dist-lib/components/pages/list/useRowMenu.d.ts +47 -0
  22. package/dist-lib/components/pages/profile/Profile.d.ts +3 -0
  23. package/dist-lib/components/pages/tenant-params/TenantParamsPage.d.ts +2 -0
  24. package/dist-lib/components/params/ParamsBlock.d.ts +25 -0
  25. package/dist-lib/components/params/param-editors.d.ts +28 -0
  26. package/dist-lib/components/primitives/Dropdown.d.ts +10 -1
  27. package/dist-lib/components/shared/ActionDialog.d.ts +2 -2
  28. package/dist-lib/components/shared/ResponsiveActionBar.d.ts +45 -23
  29. package/dist-lib/declarion-react.css +1 -1
  30. package/dist-lib/hooks/useParams.d.ts +45 -1
  31. package/dist-lib/index.d.ts +0 -2
  32. package/dist-lib/index.js +3036 -2167
  33. package/dist-lib/lib/actions.d.ts +17 -3
  34. package/dist-lib/lib/evidence-verdict.d.ts +11 -0
  35. package/dist-lib/lib/rowClickGesture.d.ts +14 -0
  36. package/dist-lib/{registry-C3hbFTDQ.js → registry-DXNFRlbB.js} +780 -560
  37. package/dist-lib/stores/list-layout.d.ts +86 -0
  38. package/dist-lib/testing.js +1 -1
  39. package/dist-lib/types/api.d.ts +29 -1
  40. package/dist-lib/types/schema.d.ts +12 -0
  41. package/dist-lib/{useCurrentScreen-DD3KdlMj.js → useCurrentScreen-BA2lb-d7.js} +35 -23
  42. package/dist-lib/{useProperties-CliP5qvg.js → useProperties-Br2DeOQh.js} +81 -81
  43. package/dist-lib/{value-CNy3_xCA.js → value-C91loRXp.js} +1 -1
  44. package/package.json +1 -1
  45. package/dist-lib/components/list/RowMenu.d.ts +0 -23
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Per-device list-table WIDTH store (plan 2026-07-18 "Adjustable table
3
+ * columns", rev 2). Holds ONE thing: column pixel widths, device-local in
4
+ * localStorage, per (tenant, user, SCREEN) by column id. Screen-keyed, so
5
+ * widening a column once holds across EVERY view of that screen on this device.
6
+ * Absent entry = the YAML default (`field.display.width ?? 150`), resolved by
7
+ * TanStack when `header.getSize()` reads `columnSizing[id] ?? columnDef.size`.
8
+ *
9
+ * Why widths are the ONLY thing here: order/visibility/sort/filters already
10
+ * live in the URL and are persisted per device per tab by the `tabs` store -
11
+ * that is the single source of truth for the logical layout (a second store
12
+ * mirroring them caused a cold-open seed to clobber `?sort`; removed in rev 2).
13
+ * Width is the one column setting that must NOT ride a shareable URL: it is
14
+ * physical fit (a width tuned for a 27"/4K monitor would corrupt the same view
15
+ * for a teammate on a laptop), so it is device-local and never in a saved view.
16
+ *
17
+ * This does NOT violate the "browser stores nothing" appearance-preferences
18
+ * rule (Decision 33, `preferences.ts`): that governs deployment BRANDING
19
+ * (theme/accent/density). Widths are device state of the same class as the
20
+ * `tabs` store, which already uses localStorage. Keying + persistence mirror
21
+ * `stores/tabs.ts`: a module-level (tenant,user) scope set via `setScope`, the
22
+ * whole snapshot under one key `declarion::${tenantId}::${userId}::listlayout`,
23
+ * hydrated on tenant switch. `childKey` callers pass a composite screenKey
24
+ * `${screenCode}::child::${childKey}`; the store is agnostic to it.
25
+ */
26
+ /** Minimum resizable column width in px. Exported so the resize handler and
27
+ * the store's defensive clamp share ONE floor (no magic number). */
28
+ export declare const MIN_COL_WIDTH = 60;
29
+ /** Maximum resizable column width in px (a sane cap so a column can never
30
+ * become absurdly wide). Shared by the TanStack per-column `maxSize` and the
31
+ * store's defensive clamp. */
32
+ export declare const MAX_COL_WIDTH = 1200;
33
+ /** Snapshot schema version. A snapshot with a different `v` is discarded on
34
+ * read (future migrations plug in here). */
35
+ export declare const LIST_LAYOUT_VERSION = 2;
36
+ /** A screen's width overrides: colId -> pixel width. */
37
+ export type WidthMap = Record<string, number>;
38
+ interface LayoutSnapshot {
39
+ v: number;
40
+ /** screenKey -> (colId -> width). */
41
+ widths: Record<string, WidthMap>;
42
+ /** True once this user has resized any column on this device - gates the
43
+ * one-time "widths are personal per device" education toast. */
44
+ resizeEduShown?: boolean;
45
+ }
46
+ interface LayoutState extends LayoutSnapshot {
47
+ setScope: (tenantId: string | null, userId: string | null) => void;
48
+ hydrate: () => void;
49
+ /** Set one column's width (clamped). */
50
+ setWidth: (screenKey: string, colId: string, width: number) => void;
51
+ /** Merge a batch of column widths (clamped). */
52
+ setWidths: (screenKey: string, widths: WidthMap) => void;
53
+ /** Drop all width overrides for a screen (back to YAML defaults). Stored as
54
+ * an empty map, not a deleted key, so the reset propagates across tabs. */
55
+ resetWidths: (screenKey: string) => void;
56
+ /** Drop width entries for colIds no longer in the screen schema. */
57
+ prune: (screenKey: string, validColIds: string[]) => void;
58
+ /** Record that the one-time resize-education toast has been shown. */
59
+ markResizeEduShown: () => void;
60
+ }
61
+ /** Narrow an untrusted persisted snapshot (localStorage is hostile) to
62
+ * LayoutSnapshot, discarding anything malformed or of a foreign version. */
63
+ export declare function parseLayoutSnapshot(raw: string): LayoutSnapshot | null;
64
+ /**
65
+ * Merge an incoming cross-tab snapshot into the local one, last-writer-wins per
66
+ * screenKey (a screenKey present in `incoming` replaces the local value
67
+ * wholesale, so a prune / reset-to-`{}` / edit all propagate; screenKeys only
68
+ * the local tab touched survive).
69
+ */
70
+ export declare function mergeSnapshot(local: LayoutSnapshot, incoming: LayoutSnapshot): LayoutSnapshot;
71
+ export declare const useListLayoutStore: import("zustand").UseBoundStore<import("zustand").StoreApi<LayoutState>>;
72
+ /** Subscribe to the window `storage` event for the layout key and merge an
73
+ * incoming snapshot (last-writer-wins per screenKey). Idempotent. */
74
+ export declare function startListLayoutCrossTabSync(): void;
75
+ export interface ScopedListLayout {
76
+ widths: WidthMap;
77
+ /** Whether the one-time resize-education toast has already been shown. */
78
+ resizeEduShown: boolean;
79
+ setWidth: (colId: string, width: number) => void;
80
+ setWidths: (widths: WidthMap) => void;
81
+ resetWidths: () => void;
82
+ prune: (validColIds: string[]) => void;
83
+ markResizeEduShown: () => void;
84
+ }
85
+ export declare function useListLayout(screenKey: string | null | undefined): ScopedListLayout;
86
+ export {};
@@ -1,4 +1,4 @@
1
- import { Ln as e, _t as t, at as n, ft as r, mt as i, pt as a, r as o, t as s } from "./useCurrentScreen-DD3KdlMj.js";
1
+ import { Ln as e, _t as t, at as n, ft as r, mt as i, pt as a, r as o, t as s } from "./useCurrentScreen-BA2lb-d7.js";
2
2
  import { useState as c } from "react";
3
3
  import { MemoryRouter as l } from "react-router-dom";
4
4
  import { QueryClient as u, QueryClientProvider as d } from "@tanstack/react-query";
@@ -355,7 +355,12 @@ export interface ParamLookup {
355
355
  source?: "object" | "user" | "role" | "tenant" | "env" | "yaml";
356
356
  type?: string;
357
357
  }
358
- /** @deprecated Prefer `ParamLookup`. Retained for callers still inspecting `source`. */
358
+ /**
359
+ * One entry of the bulk `GET /api/params` response (and per-code resolution).
360
+ * Carries the declaration facets the admin UIs need to compute attachment,
361
+ * render structure editors, and render choice selects, so the bulk endpoint is
362
+ * self-sufficient without a second schema fetch.
363
+ */
359
364
  export interface ResolvedParam {
360
365
  code: string;
361
366
  name: LocalizedString;
@@ -364,6 +369,12 @@ export interface ResolvedParam {
364
369
  description?: LocalizedString;
365
370
  value: unknown;
366
371
  source: "object" | "user" | "role" | "tenant" | "env" | "yaml" | "none";
372
+ /** Override levels the param accepts (reserved words or entity codes). */
373
+ scopes?: string[];
374
+ /** Structure code when `type === "structure"`. */
375
+ structure?: string;
376
+ /** Closed value set for a choices-constrained string param. */
377
+ choices?: string[];
367
378
  }
368
379
  export interface ParamOverride {
369
380
  param_code: string;
@@ -449,6 +460,22 @@ export interface V2PropertyInstance {
449
460
  updated_by?: string;
450
461
  }
451
462
  /** Per-row parameter override. */
463
+ /**
464
+ * The last verification verdict of an evidence-covered row, shipped under the
465
+ * row's `$evidence` key (the evidence satellite, mirroring `$statuses`). Read
466
+ * cheaply from the stored verification result - never a live re-verify. Mirrors
467
+ * the Go `evidence.RowVerdict`. `verdict` is one of: `verified`, `unverified`,
468
+ * `tampered`, `erased`, `indeterminate`, `outside_coverage`.
469
+ */
470
+ export interface EvidenceVerdict {
471
+ verdict: string;
472
+ verified_at?: string;
473
+ reason?: string;
474
+ seq?: number;
475
+ generation?: number;
476
+ checkpoint_number?: number;
477
+ covered: boolean;
478
+ }
452
479
  export interface V2ParamInstance {
453
480
  param_code: string;
454
481
  value: unknown;
@@ -498,4 +525,5 @@ export interface EnrichedRow extends RowData {
498
525
  $params?: V2ParamInstance[];
499
526
  $children?: Record<string, Record<string, unknown>[]>;
500
527
  $units?: Units;
528
+ $evidence?: EvidenceVerdict;
501
529
  }
@@ -360,6 +360,11 @@ export interface Entity {
360
360
  tenant_key?: string;
361
361
  children?: ChildRelation[];
362
362
  status_groups?: Record<string, StatusGroupDef>;
363
+ /** Computed by the server: this entity's rows are evidence-covered (an
364
+ * `evidence:` block, or an audit table the core audit source covers). Drives
365
+ * the evidence panel / `?expand=evidence` the same way `status_groups` drives
366
+ * the statuses surface. Absent for uncovered entities. */
367
+ evidence_covered?: boolean;
363
368
  properties?: Record<string, PropertyDef>;
364
369
  search_fields?: string[];
365
370
  actions?: Record<string, Action>;
@@ -377,6 +382,10 @@ export interface Entity {
377
382
  * routes a singleton entity's detail screen at the screen's declared
378
383
  * `route:` without a `:id` segment, and skips list-route registration. */
379
384
  singleton?: boolean;
385
+ /** Carrier scope its `$params` writes land under (e.g. my_tenant -> "tenant",
386
+ * profile -> "user"). Absent = writes land under the entity's own code. Used
387
+ * by ParamsBlock to compute the attachable parameter set. */
388
+ params_scope?: string;
380
389
  /** Server-enforced WHERE applied unconditionally on every read/write
381
390
  * via server/handlers/data_prefilter.go. Values may be literal scalars
382
391
  * OR `$caller.*` expressions (`$caller.user_id`, `$caller.tenant_id`)
@@ -759,6 +768,9 @@ export interface HandlerParam {
759
768
  description?: LocalizedString;
760
769
  color?: string;
761
770
  }>;
771
+ /** `type: structure` (or structure-shaped json) param target: the top-level
772
+ * structure code whose fields the dialog renders as a nested form. */
773
+ structure?: string;
762
774
  /** `type: ref` param target. Scalar entity-code string (shorthand) OR a
763
775
  * structured RefConfig (non-id lookup / display). Normalize via
764
776
  * normalizeRefConfig before use. */
@@ -161,54 +161,65 @@ function A({ children: e }) {
161
161
  }
162
162
  //#endregion
163
163
  //#region src/components/primitives/Dropdown.tsx
164
- function j({ open: e, onClose: t, anchor: n, children: r, align: i = "start", width: a, style: o }) {
165
- let s = f(null), [c, d] = p(null);
164
+ function j({ open: e, onClose: t, anchor: n, anchorPoint: r, children: i, align: a = "start", width: o, style: s }) {
165
+ let c = f(null), [d, m] = p(null), h = r?.x, g = r?.y;
166
166
  if (u(() => {
167
- if (!e || !n) return;
168
- let t = n.getBoundingClientRect(), r = M(), o = s.current?.offsetHeight || 260, c = r - t.bottom < o + 12 && t.top > o + 12 ? "above" : "below", l = c === "below" ? t.bottom + 4 : t.top - 4 - o, u = typeof window < "u" ? window.innerWidth : 0, f = i === "end" ? t.right - (a || 200) : t.left;
169
- u && (f = Math.max(8, Math.min(f, u - (a || 200) - 8))), d((e) => e && e.top === l && e.left === f && e.placement === c ? e : {
167
+ if (!e || !n && h === void 0) return;
168
+ let t = n ? n.getBoundingClientRect() : {
169
+ top: g,
170
+ bottom: g,
171
+ left: h,
172
+ right: h
173
+ }, r = M(), i = c.current?.offsetHeight || 260, s = r - t.bottom < i + 12 && t.top > i + 12 ? "above" : "below", l = s === "below" ? t.bottom + 4 : t.top - 4 - i, u = typeof window < "u" ? window.innerWidth : 0, d = a === "end" ? t.right - (o || 200) : t.left;
174
+ u && (d = Math.max(8, Math.min(d, u - (o || 200) - 8))), m((e) => e && e.top === l && e.left === d && e.placement === s ? e : {
170
175
  top: l,
171
- left: f,
172
- placement: c
176
+ left: d,
177
+ placement: s
173
178
  });
174
179
  }, [
175
180
  e,
176
181
  n,
177
- i,
178
- a
182
+ h,
183
+ g,
184
+ a,
185
+ o
179
186
  ]), l(() => {
180
187
  if (!e) return;
181
188
  let r = (e) => {
182
189
  let r = e.target;
183
- s.current && r && !s.current.contains(r) && n && !n.contains(r) && t?.();
190
+ c.current && r && !c.current.contains(r) && (!n || !n.contains(r)) && t?.();
191
+ }, i = (e) => {
192
+ e.key === "Escape" && t?.();
193
+ };
194
+ return document.addEventListener("mousedown", r), document.addEventListener("keydown", i), () => {
195
+ document.removeEventListener("mousedown", r), document.removeEventListener("keydown", i);
184
196
  };
185
- return document.addEventListener("mousedown", r), () => document.removeEventListener("mousedown", r);
186
197
  }, [
187
198
  e,
188
199
  n,
189
200
  t
190
- ]), !e || !c) return null;
191
- let m = c.placement === "below" ? `calc(var(--app-height) - ${c.top}px - 8px)` : `${Math.max(120, c.top - 8)}px`, h = ee(o?.maxHeight), g = h ? `min(${m}, ${h})` : m;
201
+ ]), !e || !d) return null;
202
+ let _ = d.placement === "below" ? `calc(var(--app-height) - ${d.top}px - 8px)` : `${Math.max(120, d.top - 8)}px`, v = ee(s?.maxHeight), y = v ? `min(${_}, ${v})` : _;
192
203
  return S(/* @__PURE__ */ b("div", {
193
- ref: s,
204
+ ref: c,
194
205
  style: {
195
206
  position: "fixed",
196
- top: c.top,
197
- left: c.left,
207
+ top: d.top,
208
+ left: d.left,
198
209
  zIndex: 200,
199
- minWidth: a || 200,
200
- maxWidth: `calc(100vw - ${c.left}px - 8px)`,
210
+ minWidth: o || 200,
211
+ maxWidth: `calc(100vw - ${d.left}px - 8px)`,
201
212
  background: "var(--surface)",
202
213
  border: "1px solid var(--border)",
203
214
  borderRadius: 8,
204
215
  boxShadow: "var(--shadow-lg)",
205
216
  padding: 4,
206
- ...o,
207
- maxHeight: g,
208
- overflowY: o?.overflowY ?? "auto",
217
+ ...s,
218
+ maxHeight: y,
219
+ overflowY: s?.overflowY ?? "auto",
209
220
  overscrollBehavior: "contain"
210
221
  },
211
- children: r
222
+ children: i
212
223
  }), document.body);
213
224
  }
214
225
  function M() {
@@ -2764,7 +2775,7 @@ var Z = {
2764
2775
  update: Gr,
2765
2776
  dismiss: (e) => v.dismiss(e),
2766
2777
  dismissAll: () => v.dismiss()
2767
- }, Kr = o(() => import("./MarkdownRenderer-CSuODN70.js").then((e) => ({ default: e.MarkdownRenderer })));
2778
+ }, Kr = o(() => import("./MarkdownRenderer-dHOTEhUa.js").then((e) => ({ default: e.MarkdownRenderer })));
2768
2779
  function qr() {
2769
2780
  return /* @__PURE__ */ b("div", { className: "h-4 w-2/3 rounded bg-muted animate-pulse" });
2770
2781
  }
@@ -5786,6 +5797,7 @@ function Ws(e) {
5786
5797
  } : void 0,
5787
5798
  enum: e.enum,
5788
5799
  values: e.values,
5800
+ structure: e.structure,
5789
5801
  ref: Ke(e.ref)
5790
5802
  };
5791
5803
  }
@@ -1,20 +1,20 @@
1
- import { $ as e, $t as t, Mt as n, U as r, bn as i, jt as a, ot as o, un as s } from "./useCurrentScreen-DD3KdlMj.js";
2
- import { vt as c } from "./registry-C3hbFTDQ.js";
3
- import { useEffect as l, useMemo as u } from "react";
4
- import { useSearchParams as d } from "react-router-dom";
5
- import { useInfiniteQuery as f, useMutation as p, useQueryClient as m } from "@tanstack/react-query";
1
+ import { $ as e, $t as t, Mt as n, U as r, bn as i, jt as a, ot as o, un as s } from "./useCurrentScreen-BA2lb-d7.js";
2
+ import { wt as c } from "./registry-DXNFRlbB.js";
3
+ import { useEffect as l, useLayoutEffect as u, useMemo as d } from "react";
4
+ import { useSearchParams as f } from "react-router-dom";
5
+ import { useInfiniteQuery as p, useMutation as m, useQueryClient as h } from "@tanstack/react-query";
6
6
  //#region src/api/entities.ts
7
- function h(e, t) {
7
+ function g(e, t) {
8
8
  return e.$statuses?.find((e) => e.group_code === t);
9
9
  }
10
- function g(e, t) {
10
+ function _(e, t) {
11
11
  return e.$properties?.find((e) => e.property_code === t);
12
12
  }
13
- function _(e) {
13
+ function v(e) {
14
14
  let t = { ...e };
15
- return t.$status = (e) => h(t, e), t.$property = (e) => g(t, e), t;
15
+ return t.$status = (e) => g(t, e), t.$property = (e) => _(t, e), t;
16
16
  }
17
- var v = class {
17
+ var y = class {
18
18
  cache = {};
19
19
  merge(e) {
20
20
  if (e) for (let t of Object.keys(e)) {
@@ -36,32 +36,32 @@ var v = class {
36
36
  this.cache = {};
37
37
  }
38
38
  };
39
- function y(e, t) {
39
+ function b(e, t) {
40
40
  let n = new URL(`/api/data/${e}`, window.location.origin);
41
41
  return t.select && t.select.length > 0 && n.searchParams.set("select", t.select.join(",")), t.expand && t.expand.length > 0 && n.searchParams.set("expand", t.expand.join(",")), t.sort && n.searchParams.set("sort", t.sort), t.search && n.searchParams.set("search", t.search), t.limit && n.searchParams.set("limit", String(t.limit)), t.after && n.searchParams.set("after", t.after), t.count && n.searchParams.set("count", "with"), t.screen && n.searchParams.set("screen", t.screen), t.preview && n.searchParams.set("preview", "true"), t.include_deleted && n.searchParams.set("include_deleted", "true"), t.filters && t.filters.length > 0 && n.searchParams.set("filters", JSON.stringify(t.filters)), n.pathname + n.search;
42
42
  }
43
- var b = class {
43
+ var x = class {
44
44
  entity;
45
45
  refs;
46
46
  constructor(e, t) {
47
- this.entity = e, this.refs = t ?? new v();
47
+ this.entity = e, this.refs = t ?? new y();
48
48
  }
49
49
  async get(e) {
50
50
  let t = new URLSearchParams(typeof e == "string" ? { id: e } : e);
51
- return _((await a(`/api/data/${this.entity}?${t.toString()}`)).data);
51
+ return v((await a(`/api/data/${this.entity}?${t.toString()}`)).data);
52
52
  }
53
53
  async list(e = {}) {
54
54
  let n, r = !1;
55
55
  try {
56
- n = await a(y(this.entity, e));
56
+ n = await a(b(this.entity, e));
57
57
  } catch (i) {
58
58
  if (e.after && t(i)) {
59
59
  let { after: t, ...i } = e;
60
- n = await a(y(this.entity, i)), r = !0;
60
+ n = await a(b(this.entity, i)), r = !0;
61
61
  } else throw i;
62
62
  }
63
63
  return this.refs.merge(n.$refs), {
64
- data: n.data.map((e) => _(e)),
64
+ data: n.data.map((e) => v(e)),
65
65
  meta: n.meta,
66
66
  $refs: this.refs.all(),
67
67
  reset: r
@@ -82,7 +82,7 @@ var b = class {
82
82
  })),
83
83
  atomic: !0
84
84
  });
85
- return x(t, `${this.entity}.__create`), t.results.map((e) => _(S(e)));
85
+ return S(t, `${this.entity}.__create`), t.results.map((e) => v(C(e)));
86
86
  }
87
87
  async update(e, t) {
88
88
  return (await this.updateMany([{
@@ -103,7 +103,7 @@ var b = class {
103
103
  })),
104
104
  atomic: !0
105
105
  });
106
- return x(t, `${this.entity}.__update`), t.results.map((e) => _(S(e)));
106
+ return S(t, `${this.entity}.__update`), t.results.map((e) => v(C(e)));
107
107
  }
108
108
  async delete(e) {
109
109
  await this.deleteMany([e]);
@@ -139,29 +139,29 @@ var b = class {
139
139
  })),
140
140
  atomic: !0
141
141
  });
142
- return x(r, `${this.entity}.__upsert`), r.results.map((e) => _(C(e)));
142
+ return S(r, `${this.entity}.__upsert`), r.results.map((e) => v(w(e)));
143
143
  }
144
144
  };
145
- function x(e, t) {
145
+ function S(e, t) {
146
146
  if (e.committed) return;
147
147
  let n = e.results.find((e) => !e.ok), r = n ? `${n.error_code ?? "ERROR"}: ${n.error ?? "unknown"}` : "batch did not commit";
148
148
  throw Error(`${t} batch failed: ${r}`);
149
149
  }
150
- function S(e) {
150
+ function C(e) {
151
151
  let t = e.result ?? {};
152
152
  return (Array.isArray(t.rows) ? t.rows[0] : void 0) ?? {};
153
153
  }
154
- function C(e) {
154
+ function w(e) {
155
155
  let t = e.result ?? {};
156
156
  return (Array.isArray(t.rows) ? t.rows[0] : void 0)?.row ?? {};
157
157
  }
158
- function w(e, t) {
159
- return new b(e, t);
158
+ function T(e, t) {
159
+ return new x(e, t);
160
160
  }
161
161
  //#endregion
162
162
  //#region src/hooks/useCursorEntityData.ts
163
- var T = "entity-data-cursor";
164
- function E(e) {
163
+ var E = "entity-data-cursor";
164
+ function D(e) {
165
165
  return JSON.stringify({
166
166
  sort: e.sort,
167
167
  filters: e.filters,
@@ -174,19 +174,19 @@ function E(e) {
174
174
  limit: e.limit
175
175
  });
176
176
  }
177
- function D(e, t) {
177
+ function O(e, t) {
178
178
  return [
179
- T,
179
+ E,
180
180
  e,
181
- E(t)
181
+ D(t)
182
182
  ];
183
183
  }
184
- function O(e, t, n) {
185
- let r = m(), i = u(() => new b(e ?? ""), [e]), a = u(() => E(t), [t]), o = u(() => [
186
- T,
184
+ function k(e, t, n) {
185
+ let r = h(), i = d(() => new x(e ?? ""), [e]), a = d(() => D(t), [t]), o = d(() => [
186
+ E,
187
187
  e,
188
188
  a
189
- ], [e, a]), s = f({
189
+ ], [e, a]), s = p({
190
190
  queryKey: o,
191
191
  queryFn: ({ pageParam: e }) => i.list({
192
192
  sort: t.sort,
@@ -205,21 +205,21 @@ function O(e, t, n) {
205
205
  initialPageParam: void 0,
206
206
  enabled: !!e && n,
207
207
  placeholderData: (t, n) => n?.queryKey?.[1] === e ? t : void 0
208
- }), c = s.data?.pages, d = c && c.length > 1 ? c[c.length - 1]?.reset : !1;
208
+ }), c = s.data?.pages, u = c && c.length > 1 ? c[c.length - 1]?.reset : !1;
209
209
  l(() => {
210
- d && r.resetQueries({ queryKey: o });
210
+ u && r.resetQueries({ queryKey: o });
211
211
  }, [
212
- d,
212
+ u,
213
213
  r,
214
214
  o
215
215
  ]);
216
- let p = u(() => (s.data?.pages ?? []).flatMap((e) => e.data), [s.data?.pages]), h = s.data?.pages?.[0]?.meta;
216
+ let f = d(() => (s.data?.pages ?? []).flatMap((e) => e.data), [s.data?.pages]), m = s.data?.pages?.[0]?.meta;
217
217
  return {
218
- rows: p,
218
+ rows: f,
219
219
  refs: s.data?.pages?.[s.data.pages.length - 1]?.$refs,
220
- total: h && !h.count_unknown ? h.total : void 0,
221
- countMode: h?.count_mode,
222
- countUnknown: h?.count_unknown ?? !1,
220
+ total: m && !m.count_unknown ? m.total : void 0,
221
+ countMode: m?.count_mode,
222
+ countUnknown: m?.count_unknown ?? !1,
223
223
  hasMore: s.hasNextPage,
224
224
  fetchNextPage: s.fetchNextPage,
225
225
  isFetchingNextPage: s.isFetchingNextPage,
@@ -232,9 +232,9 @@ function O(e, t, n) {
232
232
  }
233
233
  //#endregion
234
234
  //#region src/hooks/useTabSearchMirror.ts
235
- function k(t) {
236
- let n = e(), [r] = d();
237
- l(() => {
235
+ function A(t) {
236
+ let n = e(), [r] = f();
237
+ u(() => {
238
238
  if (!t || n.enabled) return;
239
239
  let e = c.getState(), i = e.findTabByPathname(t);
240
240
  i && e.updateTabSearch(i.id, r.toString());
@@ -246,7 +246,7 @@ function k(t) {
246
246
  }
247
247
  //#endregion
248
248
  //#region src/hooks/useRegisterScreenTab.ts
249
- function A(t, n, r, i) {
249
+ function j(t, n, r, i) {
250
250
  let a = e();
251
251
  l(() => {
252
252
  !t || a.enabled || c.getState().openTab({
@@ -263,13 +263,13 @@ function A(t, n, r, i) {
263
263
  a.enabled
264
264
  ]);
265
265
  }
266
- function j(e, t, n) {
266
+ function M(e, t, n) {
267
267
  let r = e?.route, i = t ? s(e?.display?.name) || s(t.display.name_plural) : "", a = e?.display?.icon || t?.display.icon;
268
- A(t ? r : void 0, i, a, n);
268
+ j(t ? r : void 0, i, a, n);
269
269
  }
270
270
  //#endregion
271
271
  //#region src/lib/filters.ts
272
- var M = /* @__PURE__ */ new Set([
272
+ var N = /* @__PURE__ */ new Set([
273
273
  "is_empty",
274
274
  "is_not_empty",
275
275
  "today",
@@ -279,7 +279,7 @@ var M = /* @__PURE__ */ new Set([
279
279
  "last_30_days",
280
280
  "last_hour",
281
281
  "last_24_hours"
282
- ]), N = {
282
+ ]), P = {
283
283
  eq: "is",
284
284
  not_eq: "is not",
285
285
  gt: ">",
@@ -301,7 +301,7 @@ var M = /* @__PURE__ */ new Set([
301
301
  last_hour: "last hour",
302
302
  last_24_hours: "last 24 hours"
303
303
  };
304
- function P(e) {
304
+ function F(e) {
305
305
  let t = e.get("filters");
306
306
  if (!t) return [];
307
307
  try {
@@ -311,27 +311,27 @@ function P(e) {
311
311
  return [];
312
312
  }
313
313
  }
314
- function F(e, t) {
314
+ function I(e, t) {
315
315
  e.length === 0 ? t.delete("filters") : t.set("filters", JSON.stringify(e));
316
316
  }
317
- function I(e) {
317
+ function L(e) {
318
318
  return e.some((e) => e.or != null);
319
319
  }
320
- function L(e) {
320
+ function R(e) {
321
321
  let t = [];
322
322
  for (let n of e) if (!(!n || typeof n != "object")) {
323
- if (n.field && n.op && t.push(n), n.or) for (let e of n.or) t.push(...L(e));
324
- n.and && t.push(...L(n.and));
323
+ if (n.field && n.op && t.push(n), n.or) for (let e of n.or) t.push(...R(e));
324
+ n.and && t.push(...R(n.and));
325
325
  }
326
326
  return t;
327
327
  }
328
- function R(e) {
329
- return L(e).length;
328
+ function z(e) {
329
+ return R(e).length;
330
330
  }
331
- function z(e, t) {
331
+ function B(e, t) {
332
332
  if (!e.field || !e.op) return "";
333
- let n = N[e.op] || e.op;
334
- if (M.has(e.op)) return `${n}`;
333
+ let n = P[e.op] || e.op;
334
+ if (N.has(e.op)) return `${n}`;
335
335
  let r = e.field, a = (e) => {
336
336
  if (t) {
337
337
  let n = t(r, e);
@@ -341,18 +341,18 @@ function z(e, t) {
341
341
  };
342
342
  return `${n} ${Array.isArray(e.value) ? e.value.map(a).join(", ") : a(e.value)}`;
343
343
  }
344
- function B(e, t) {
344
+ function V(e, t) {
345
345
  return {
346
346
  field: e,
347
347
  op: "eq",
348
348
  value: t
349
349
  };
350
350
  }
351
- function V(e, t) {
351
+ function H(e, t) {
352
352
  let n = [];
353
353
  for (let r of e) if (r.field !== t) {
354
354
  if (r.or) {
355
- let e = r.or.map((e) => V(e, t)).filter((e) => e.length > 0);
355
+ let e = r.or.map((e) => H(e, t)).filter((e) => e.length > 0);
356
356
  e.length > 0 && n.push({
357
357
  ...r,
358
358
  or: e
@@ -360,7 +360,7 @@ function V(e, t) {
360
360
  continue;
361
361
  }
362
362
  if (r.and) {
363
- let e = V(r.and, t);
363
+ let e = H(r.and, t);
364
364
  e.length > 0 && n.push({
365
365
  ...r,
366
366
  and: e
@@ -373,7 +373,7 @@ function V(e, t) {
373
373
  }
374
374
  //#endregion
375
375
  //#region src/api/status.ts
376
- async function H(e, t, n, r, i) {
376
+ async function U(e, t, n, r, i) {
377
377
  let a = {
378
378
  status_group_code: n,
379
379
  status_code: r
@@ -388,10 +388,10 @@ async function H(e, t, n, r, i) {
388
388
  }
389
389
  //#endregion
390
390
  //#region src/hooks/useObjectStatus.ts
391
- function U(e, t) {
392
- let n = m();
393
- return p({
394
- mutationFn: ({ groupCode: n, statusCode: r, note: i }) => H(e, t, n, r, i),
391
+ function W(e, t) {
392
+ let n = h();
393
+ return m({
394
+ mutationFn: ({ groupCode: n, statusCode: r, note: i }) => U(e, t, n, r, i),
395
395
  onSuccess: () => {
396
396
  n.invalidateQueries({ queryKey: ["entity-item", e] });
397
397
  },
@@ -402,7 +402,7 @@ function U(e, t) {
402
402
  }
403
403
  //#endregion
404
404
  //#region src/api/properties.ts
405
- async function W(e, t, n, r) {
405
+ async function G(e, t, n, r) {
406
406
  let i = (await o(`${e}.__update`, {
407
407
  object_ids: [t],
408
408
  entity: e,
@@ -413,7 +413,7 @@ async function W(e, t, n, r) {
413
413
  })).result?.rows?.[0]?.$properties ?? [];
414
414
  return i.find((e) => e.property_code === n) ?? i[0];
415
415
  }
416
- async function G(e, t, n) {
416
+ async function K(e, t, n) {
417
417
  await o(`${e}.__update`, {
418
418
  object_ids: [t],
419
419
  entity: e,
@@ -425,10 +425,10 @@ async function G(e, t, n) {
425
425
  }
426
426
  //#endregion
427
427
  //#region src/hooks/useProperties.ts
428
- function K(e, t) {
429
- let n = m();
430
- return p({
431
- mutationFn: ({ propertyCode: n, value: r }) => W(e, t, n, r),
428
+ function q(e, t) {
429
+ let n = h();
430
+ return m({
431
+ mutationFn: ({ propertyCode: n, value: r }) => G(e, t, n, r),
432
432
  onSuccess: () => {
433
433
  n.invalidateQueries({ queryKey: ["entity-item", e] });
434
434
  },
@@ -437,10 +437,10 @@ function K(e, t) {
437
437
  }
438
438
  });
439
439
  }
440
- function q(e, t) {
441
- let n = m();
442
- return p({
443
- mutationFn: (n) => G(e, t, n),
440
+ function J(e, t) {
441
+ let n = h();
442
+ return m({
443
+ mutationFn: (n) => K(e, t, n),
444
444
  onSuccess: () => {
445
445
  n.invalidateQueries({ queryKey: ["entity-item", e] });
446
446
  },
@@ -450,4 +450,4 @@ function q(e, t) {
450
450
  });
451
451
  }
452
452
  //#endregion
453
- export { w as C, v as S, T as _, N as a, O as b, L as c, P as d, V as f, k as g, A as h, M as i, z as l, j as m, K as n, R as o, F as p, U as r, B as s, q as t, I as u, D as v, b as x, E as y };
453
+ export { T as C, y as S, E as _, P as a, k as b, R as c, F as d, H as f, A as g, j as h, N as i, B as l, M as m, q as n, z as o, I as p, W as r, V as s, J as t, L as u, O as v, x, D as y };
@@ -1,4 +1,4 @@
1
- import { Bt as e, Ut as t, zt as n } from "./useCurrentScreen-DD3KdlMj.js";
1
+ import { Bt as e, Ut as t, zt as n } from "./useCurrentScreen-BA2lb-d7.js";
2
2
  import { useCallback as r, useEffect as i, useRef as a, useState as o } from "react";
3
3
  //#region src/embed/file-src.ts
4
4
  var s = "/api/files";