@declarion/react 0.48.2 → 0.50.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 (88) hide show
  1. package/dist-lib/Check-DAfMbQIw.js +38 -0
  2. package/dist-lib/{DraggableChildrenTable-p2ZSdwzj.js → DraggableChildrenTable-Dar8C-Z9.js} +31 -31
  3. package/dist-lib/DynamicIcon-DW5krHuX.js +280 -0
  4. package/dist-lib/{Grid-CjLFAKMZ.js → Grid-BkHtfsty.js} +2 -2
  5. package/dist-lib/{LayoutRenderer-DCscqXsv.js → LayoutRenderer-Cic7IAop.js} +601 -598
  6. package/dist-lib/ListCardsBody-Dko91bLv.js +287 -0
  7. package/dist-lib/{MarkdownRenderer-Sb7zcvj0.js → MarkdownRenderer-CJrVG5HZ.js} +1 -1
  8. package/dist-lib/RefreshControl-BS8WWL8i.js +430 -0
  9. package/dist-lib/{SmartDetailPage.impl-BAW-Tx_H.js → SmartDetailPage.impl-DxRDo0p2.js} +521 -516
  10. package/dist-lib/SmartListPage.impl-CNdq5Vts.js +2849 -0
  11. package/dist-lib/{SmartRecordListPage.impl-DtSSlGrI.js → SmartRecordListPage.impl-3ct7f4rT.js} +244 -241
  12. package/dist-lib/SortHeaderMenu-NgjkW8QZ.js +106 -0
  13. package/dist-lib/action-dispatch-hVrm3Hrg.js +1984 -0
  14. package/dist-lib/api/batch.d.ts +5 -2
  15. package/dist-lib/api/data.d.ts +35 -4
  16. package/dist-lib/api/entities.d.ts +3 -3
  17. package/dist-lib/cardProjection-BR-fXPvJ.js +757 -0
  18. package/dist-lib/components/{shared → actions}/ObjectActionBar.d.ts +1 -1
  19. package/dist-lib/components/{shared → actions}/ResponsiveActionBar.d.ts +1 -1
  20. package/dist-lib/components/fields/cells/factories/date.d.ts +2 -0
  21. package/dist-lib/components/file-widgets/upload.d.ts +6 -1
  22. package/dist-lib/components/layout/Layout.d.ts +1 -1
  23. package/dist-lib/components/layout/TopBar.d.ts +1 -1
  24. package/dist-lib/components/pages/SmartListPage.d.ts +2 -12
  25. package/dist-lib/components/pages/SmartListPage.impl.d.ts +4 -0
  26. package/dist-lib/components/pages/list/ListCardRow.d.ts +40 -0
  27. package/dist-lib/components/pages/list/ListCardsBody.d.ts +34 -0
  28. package/dist-lib/components/pages/list/ListFloatbar.d.ts +1 -1
  29. package/dist-lib/components/pages/list/ListFooter.d.ts +26 -0
  30. package/dist-lib/components/pages/list/ListHeader.d.ts +1 -1
  31. package/dist-lib/components/pages/list/ListNoRows.d.ts +32 -0
  32. package/dist-lib/components/pages/list/ListTable.d.ts +34 -0
  33. package/dist-lib/components/pages/list/ListTableRow.d.ts +18 -0
  34. package/dist-lib/components/pages/list/ListToolbar.d.ts +43 -0
  35. package/dist-lib/components/pages/list/SortHeaderMenu.d.ts +14 -0
  36. package/dist-lib/components/pages/list/page-size.d.ts +3 -0
  37. package/dist-lib/components/pages/list/sortable-header.d.ts +2 -0
  38. package/dist-lib/components/pages/list/useListColumnLayout.d.ts +37 -0
  39. package/dist-lib/components/pages/list/useListQuery.d.ts +66 -0
  40. package/dist-lib/components/pages/list/useListRowInteraction.d.ts +61 -0
  41. package/dist-lib/components/pages/list/useListSelection.d.ts +31 -0
  42. package/dist-lib/components/pages/list/useListSort.d.ts +45 -0
  43. package/dist-lib/components/pages/list/useListViews.d.ts +46 -0
  44. package/dist-lib/components/pages/list/useRowMenu.d.ts +1 -1
  45. package/dist-lib/components/primitives/Icons.d.ts +5 -0
  46. package/dist-lib/components/shared/RefreshControl.d.ts +17 -4
  47. package/dist-lib/field-classification-Bm0mgbwA.js +1134 -0
  48. package/dist-lib/format-count-BfRGwx2v.js +1551 -0
  49. package/dist-lib/hooks/useBrandingChrome.d.ts +17 -1
  50. package/dist-lib/hooks/useText.d.ts +3 -0
  51. package/dist-lib/hooks/useViews.d.ts +1 -1
  52. package/dist-lib/icons.js +1 -1
  53. package/dist-lib/index.d.ts +17 -15
  54. package/dist-lib/index.js +1784 -6288
  55. package/dist-lib/lib/messages.d.ts +7 -1
  56. package/dist-lib/lib/rowClickGesture.d.ts +12 -0
  57. package/dist-lib/lib/timestamp.d.ts +8 -3
  58. package/dist-lib/peekDraftStore-bb4WroTA.js +194 -0
  59. package/dist-lib/record-documents-key-8fdm7C10.js +27 -0
  60. package/dist-lib/registry-CgeGoWpW.js +1768 -0
  61. package/dist-lib/testing.d.ts +17 -2
  62. package/dist-lib/testing.js +72 -58
  63. package/dist-lib/types/api.d.ts +54 -12
  64. package/dist-lib/types/schema.d.ts +22 -6
  65. package/dist-lib/{useCurrentScreen-BshVTPVq.js → useCurrentScreen-D3XH5ptA.js} +1127 -1070
  66. package/dist-lib/useListQuery-CfuINl-0.js +87 -0
  67. package/dist-lib/useProperties-DNocaxBX.js +81 -0
  68. package/dist-lib/{useProperties-DrHFr0A1.js → useTabSearchMirror-d0BAUIcQ.js} +116 -194
  69. package/dist-lib/{value-B1O6QikE.js → value-D71J0sJq.js} +69 -69
  70. package/package.json +1 -1
  71. package/dist-lib/DynamicIcon-Dc2j-rg_.js +0 -275
  72. package/dist-lib/RefreshControl-Cnl9nE0x.js +0 -945
  73. package/dist-lib/registry-CCxnZW2b.js +0 -5281
  74. /package/dist-lib/components/{shared → actions}/ActionButton.d.ts +0 -0
  75. /package/dist-lib/components/{shared → actions}/ActionDialog.d.ts +0 -0
  76. /package/dist-lib/components/{shared → actions}/ActionResultDialog.d.ts +0 -0
  77. /package/dist-lib/components/{shared → actions}/ActionRunner.d.ts +0 -0
  78. /package/dist-lib/components/{mass-edit → actions}/PropertyGridEditor.d.ts +0 -0
  79. /package/dist-lib/components/{shared → actions}/RowActionsKebab.d.ts +0 -0
  80. /package/dist-lib/components/{shared → chrome}/AssociationTabs.d.ts +0 -0
  81. /package/dist-lib/components/{shared → chrome}/AuditMetaStrip.d.ts +0 -0
  82. /package/dist-lib/components/{shared → chrome}/Breadcrumbs.d.ts +0 -0
  83. /package/dist-lib/components/{shared → chrome}/HighlightsStrip.d.ts +0 -0
  84. /package/dist-lib/components/{shared → chrome}/PageHeader.d.ts +0 -0
  85. /package/dist-lib/components/{shared → chrome}/RecordHeader.d.ts +0 -0
  86. /package/dist-lib/components/{shell → layout}/CommandPalette.d.ts +0 -0
  87. /package/dist-lib/components/{columns → list}/ColumnPicker.d.ts +0 -0
  88. /package/dist-lib/components/{views → list}/ViewSwitcher.d.ts +0 -0
@@ -0,0 +1,87 @@
1
+ import { J as e, X as t, Y as n } from "./useCurrentScreen-D3XH5ptA.js";
2
+ import { y as r } from "./field-classification-Bm0mgbwA.js";
3
+ import { _ as i, y as a } from "./useTabSearchMirror-d0BAUIcQ.js";
4
+ import { useCallback as o, useEffect as s, useMemo as c, useState as l } from "react";
5
+ import { useQueryClient as u } from "@tanstack/react-query";
6
+ //#region src/components/pages/list/useListQuery.ts
7
+ var d = 1e4;
8
+ function f(s) {
9
+ let l = u(), { entity: d, entityCode: f, screen: m, screenCode: h, page: g, perPage: _, sortForRequest: v, debouncedSearch: y, filters: b, filterError: x, includeDeleted: S, expand: C, select: w, runCountQuery: T, urlKey: E } = s, D = x ? void 0 : b.length > 0 ? b : void 0, O = {
10
+ page: g,
11
+ per_page: _,
12
+ sort: v,
13
+ search: y || void 0,
14
+ filters: D,
15
+ include_deleted: S || void 0,
16
+ expand: C,
17
+ select: w,
18
+ preview: !0,
19
+ screen: m?.fixed_filters ? h : void 0
20
+ }, k = {
21
+ sort: v,
22
+ filters: D,
23
+ search: y || void 0,
24
+ select: w,
25
+ expand: C,
26
+ includeDeleted: S || void 0,
27
+ screen: m?.fixed_filters ? h : void 0,
28
+ preview: !0,
29
+ limit: _
30
+ }, A = d?.list_pagination === "cursor", j = t(f, O, !A), M = n(f, O, T && !A), N = a(f, k, A);
31
+ r(e(f, O), !A), r(i(f, k), A);
32
+ let P = A ? N.isLoading : j.isLoading, F = c(() => A ? N.rows : j.data?.data ?? [], [
33
+ A,
34
+ N.rows,
35
+ j.data?.data
36
+ ]), I = A ? N.total : M.data?.meta?.total, L = c(() => {
37
+ if (!(A || I === void 0 || _ <= 0)) return Math.max(1, Math.ceil(I / _));
38
+ }, [
39
+ A,
40
+ I,
41
+ _
42
+ ]), R = p(P, E), z = o(() => {
43
+ f && l.cancelQueries({ queryKey: ["entity-data", f] }), A ? N.refetch() : j.refetch();
44
+ }, [
45
+ f,
46
+ l,
47
+ A,
48
+ N,
49
+ j
50
+ ]), B = o(() => {
51
+ N.fetchNextPage();
52
+ }, [N]);
53
+ return {
54
+ rows: F,
55
+ meta: j.data?.meta,
56
+ refs: A ? N.refs : j.data?.$refs,
57
+ isLoading: P,
58
+ isFetching: A ? N.isFetching : j.isFetching,
59
+ isError: A ? N.isError : j.isError,
60
+ error: A ? N.error : j.error,
61
+ isLoadingStale: R,
62
+ retry: z,
63
+ countTotal: I,
64
+ countStrategy: A ? N.countMode : M.data?.meta?.count_mode,
65
+ countLoading: A ? N.isLoading : M.isLoading,
66
+ countError: !A && M.isError,
67
+ totalPages: L,
68
+ hasMorePages: A ? N.hasMore : j.data?.meta?.has_more ?? (L !== void 0 && g < L),
69
+ isCursor: A,
70
+ fetchNextPage: B,
71
+ isFetchingNextPage: N.isFetchingNextPage
72
+ };
73
+ }
74
+ function p(e, t) {
75
+ let [n, r] = l(!1);
76
+ return s(() => {
77
+ if (!e) {
78
+ r(!1);
79
+ return;
80
+ }
81
+ r(!1);
82
+ let t = window.setTimeout(() => r(!0), d);
83
+ return () => window.clearTimeout(t);
84
+ }, [e, t]), n;
85
+ }
86
+ //#endregion
87
+ export { f as t };
@@ -0,0 +1,81 @@
1
+ import { bt as e, rt as t } from "./useCurrentScreen-D3XH5ptA.js";
2
+ import { useMutation as n, useQueryClient as r } from "@tanstack/react-query";
3
+ //#region src/api/status.ts
4
+ async function i(t, n, r, i, a) {
5
+ let o = {
6
+ status_group_code: r,
7
+ status_code: i
8
+ };
9
+ a != null && (o.note = a);
10
+ let s = (await e(`${t}.__update`, {
11
+ object_ids: [n],
12
+ entity: t,
13
+ fields: { $statuses: [o] }
14
+ })).result?.rows?.[0]?.$statuses ?? [];
15
+ return s.find((e) => e.group_code === r) ?? s[0];
16
+ }
17
+ //#endregion
18
+ //#region src/hooks/useObjectStatus.ts
19
+ function a(e, a) {
20
+ let o = r();
21
+ return n({
22
+ mutationFn: ({ groupCode: t, statusCode: n, note: r }) => i(e, a, t, n, r),
23
+ onSuccess: () => {
24
+ o.invalidateQueries({ queryKey: ["entity-item", e] });
25
+ },
26
+ onError: (e) => {
27
+ t.error(e.message);
28
+ }
29
+ });
30
+ }
31
+ //#endregion
32
+ //#region src/api/properties.ts
33
+ async function o(t, n, r, i) {
34
+ let a = (await e(`${t}.__update`, {
35
+ object_ids: [n],
36
+ entity: t,
37
+ fields: { $properties: [{
38
+ property_code: r,
39
+ value: i
40
+ }] }
41
+ })).result?.rows?.[0]?.$properties ?? [];
42
+ return a.find((e) => e.property_code === r) ?? a[0];
43
+ }
44
+ async function s(t, n, r) {
45
+ await e(`${t}.__update`, {
46
+ object_ids: [n],
47
+ entity: t,
48
+ fields: { $properties: [{
49
+ property_code: r,
50
+ value: null
51
+ }] }
52
+ });
53
+ }
54
+ //#endregion
55
+ //#region src/hooks/useProperties.ts
56
+ function c(e, i) {
57
+ let a = r();
58
+ return n({
59
+ mutationFn: ({ propertyCode: t, value: n }) => o(e, i, t, n),
60
+ onSuccess: () => {
61
+ a.invalidateQueries({ queryKey: ["entity-item", e] });
62
+ },
63
+ onError: (e) => {
64
+ t.error(e.message);
65
+ }
66
+ });
67
+ }
68
+ function l(e, i) {
69
+ let a = r();
70
+ return n({
71
+ mutationFn: (t) => s(e, i, t),
72
+ onSuccess: () => {
73
+ a.invalidateQueries({ queryKey: ["entity-item", e] });
74
+ },
75
+ onError: (e) => {
76
+ t.error(e.message);
77
+ }
78
+ });
79
+ }
80
+ //#endregion
81
+ export { c as n, a as r, l as t };
@@ -1,20 +1,20 @@
1
- import { Gt as e, Kt as t, Ln as n, Tn as r, bt as i, pn as a, pt as o, rt as s } from "./useCurrentScreen-BshVTPVq.js";
2
- import { vt as c } from "./registry-CCxnZW2b.js";
1
+ import { Dn as e, Gt as t, Kt as n, bt as r, mn as i, pn as a, pt as o, zn as s } from "./useCurrentScreen-D3XH5ptA.js";
2
+ import { F as c } from "./field-classification-Bm0mgbwA.js";
3
3
  import { useEffect as l, useLayoutEffect as u, useMemo as d } from "react";
4
4
  import { useSearchParams as f } from "react-router";
5
- import { useInfiniteQuery as p, useMutation as m, useQueryClient as h } from "@tanstack/react-query";
5
+ import { useInfiniteQuery as p, useQueryClient as m } from "@tanstack/react-query";
6
6
  //#region src/api/entities.ts
7
- function g(e, t) {
7
+ function h(e, t) {
8
8
  return e.$statuses?.find((e) => e.group_code === t);
9
9
  }
10
- function _(e, t) {
10
+ function g(e, t) {
11
11
  return e.$properties?.find((e) => e.property_code === t);
12
12
  }
13
- function v(e) {
13
+ function _(e) {
14
14
  let t = { ...e };
15
- return t.$status = (e) => g(t, e), t.$property = (e) => _(t, e), t;
15
+ return t.$status = (e) => h(t, e), t.$property = (e) => g(t, e), t;
16
16
  }
17
- var y = class {
17
+ var v = class {
18
18
  cache = {};
19
19
  merge(e) {
20
20
  if (e) for (let t of Object.keys(e)) {
@@ -36,32 +36,32 @@ var y = class {
36
36
  this.cache = {};
37
37
  }
38
38
  };
39
- function b(e, t) {
39
+ function y(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 x = class {
43
+ var b = class {
44
44
  entity;
45
45
  refs;
46
46
  constructor(e, t) {
47
- this.entity = e, this.refs = t ?? new y();
47
+ this.entity = e, this.refs = t ?? new v();
48
48
  }
49
- async get(t) {
50
- let n = new URLSearchParams(typeof t == "string" ? { id: t } : t);
51
- return v((await e(`/api/data/${this.entity}?${n.toString()}`)).data);
49
+ async get(e) {
50
+ let n = new URLSearchParams(typeof e == "string" ? { id: e } : e);
51
+ return _((await t(`/api/data/${this.entity}?${n.toString()}`)).data);
52
52
  }
53
- async list(t = {}) {
53
+ async list(e = {}) {
54
54
  let n, r = !1;
55
55
  try {
56
- n = await e(b(this.entity, t));
57
- } catch (i) {
58
- if (t.after && a(i)) {
59
- let { after: i, ...a } = t;
60
- n = await e(b(this.entity, a)), r = !0;
61
- } else throw i;
56
+ n = await t(y(this.entity, e));
57
+ } catch (a) {
58
+ if (e.after && i(a)) {
59
+ let { after: i, ...a } = e;
60
+ n = await t(y(this.entity, a)), r = !0;
61
+ } else throw a;
62
62
  }
63
63
  return this.refs.merge(n.$refs), {
64
- data: n.data.map((e) => v(e)),
64
+ data: n.data.map((e) => _(e)),
65
65
  meta: n.meta,
66
66
  $refs: this.refs.all(),
67
67
  reset: r
@@ -72,17 +72,17 @@ var x = class {
72
72
  }
73
73
  async createMany(e) {
74
74
  if (e.length === 0) return [];
75
- let n = e.map((e) => ({
75
+ let t = e.map((e) => ({
76
76
  action: `${this.entity}.__create`,
77
77
  params: {
78
78
  entity: this.entity,
79
79
  fields: e
80
80
  }
81
- })), r = await t("system.batch", {
82
- actions: n,
81
+ })), r = await n("system.batch", {
82
+ actions: t,
83
83
  atomic: !0
84
84
  });
85
- return S(r, `${this.entity}.__create`), r.results.map((e) => v(C(e)));
85
+ return x(r, `${this.entity}.__create`), r.results.map((e) => _(S(e)));
86
86
  }
87
87
  async update(e, t) {
88
88
  return (await this.updateMany([{
@@ -92,24 +92,24 @@ var x = class {
92
92
  }
93
93
  async updateMany(e) {
94
94
  if (e.length === 0) return [];
95
- let n = e.map(({ id: e, ...t }) => ({
95
+ let t = e.map(({ id: e, ...t }) => ({
96
96
  action: `${this.entity}.__update`,
97
97
  params: {
98
98
  object_ids: [e],
99
99
  entity: this.entity,
100
100
  fields: t
101
101
  }
102
- })), r = await t("system.batch", {
103
- actions: n,
102
+ })), r = await n("system.batch", {
103
+ actions: t,
104
104
  atomic: !0
105
105
  });
106
- return S(r, `${this.entity}.__update`), r.results.map((e) => v(C(e)));
106
+ return x(r, `${this.entity}.__update`), r.results.map((e) => _(S(e)));
107
107
  }
108
108
  async delete(e) {
109
109
  await this.deleteMany([e]);
110
110
  }
111
111
  async deleteMany(e) {
112
- return e.length === 0 ? { count: 0 } : { count: (await i(`${this.entity}.__delete`, {
112
+ return e.length === 0 ? { count: 0 } : { count: (await r(`${this.entity}.__delete`, {
113
113
  object_ids: e,
114
114
  entity: this.entity
115
115
  })).object_count ?? e.length };
@@ -118,7 +118,7 @@ var x = class {
118
118
  await this.restoreMany([e]);
119
119
  }
120
120
  async restoreMany(e) {
121
- return e.length === 0 ? { count: 0 } : { count: (await i(`${this.entity}.__restore`, {
121
+ return e.length === 0 ? { count: 0 } : { count: (await r(`${this.entity}.__restore`, {
122
122
  object_ids: e,
123
123
  entity: this.entity
124
124
  })).object_count ?? e.length };
@@ -126,42 +126,42 @@ var x = class {
126
126
  async upsert(e, t) {
127
127
  return (await this.upsertMany([e], t))[0];
128
128
  }
129
- async upsertMany(e, n) {
129
+ async upsertMany(e, t) {
130
130
  if (e.length === 0) return [];
131
131
  let r = e.map((e) => ({
132
132
  action: `${this.entity}.__upsert`,
133
133
  params: {
134
134
  entity: this.entity,
135
135
  fields: e,
136
- unique_by: n
136
+ unique_by: t
137
137
  }
138
- })), i = await t("system.batch", {
138
+ })), i = await n("system.batch", {
139
139
  actions: r,
140
140
  atomic: !0
141
141
  });
142
- return S(i, `${this.entity}.__upsert`), i.results.map((e) => v(w(e)));
142
+ return x(i, `${this.entity}.__upsert`), i.results.map((e) => _(C(e)));
143
143
  }
144
144
  };
145
- function S(e, t) {
145
+ function x(e, t) {
146
146
  if (e.committed) return;
147
- let n = e.results.find((e) => !e.ok), r = n ? `${n.error_code ?? "ERROR"}: ${n.error ?? "unknown"}` : "batch did not commit";
147
+ let n = e.results.find((e) => !e.ok), r = n?.error ? `${a(n.error.type)}: ${n.error.title}` : "batch did not commit";
148
148
  throw Error(`${t} batch failed: ${r}`);
149
149
  }
150
- function C(e) {
150
+ function S(e) {
151
151
  let t = e.result ?? {};
152
152
  return (Array.isArray(t.rows) ? t.rows[0] : void 0) ?? {};
153
153
  }
154
- function w(e) {
154
+ function C(e) {
155
155
  let t = e.result ?? {};
156
156
  return (Array.isArray(t.rows) ? t.rows[0] : void 0)?.row ?? {};
157
157
  }
158
- function T(e, t) {
159
- return new x(e, t);
158
+ function w(e, t) {
159
+ return new b(e, t);
160
160
  }
161
161
  //#endregion
162
162
  //#region src/hooks/useCursorEntityData.ts
163
- var E = "entity-data-cursor";
164
- function D(e) {
163
+ var T = "entity-data-cursor";
164
+ function E(e) {
165
165
  return JSON.stringify({
166
166
  sort: e.sort,
167
167
  filters: e.filters,
@@ -174,16 +174,16 @@ function D(e) {
174
174
  limit: e.limit
175
175
  });
176
176
  }
177
- function O(e, t) {
177
+ function D(e, t) {
178
178
  return [
179
- E,
179
+ T,
180
180
  e,
181
- D(t)
181
+ E(t)
182
182
  ];
183
183
  }
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,
184
+ function O(e, t, n) {
185
+ let r = m(), i = d(() => new b(e ?? ""), [e]), a = d(() => E(t), [t]), o = d(() => [
186
+ T,
187
187
  e,
188
188
  a
189
189
  ], [e, a]), s = p({
@@ -213,13 +213,13 @@ function k(e, t, n) {
213
213
  r,
214
214
  o
215
215
  ]);
216
- let f = d(() => (s.data?.pages ?? []).flatMap((e) => e.data), [s.data?.pages]), m = s.data?.pages?.[0]?.meta;
216
+ let f = d(() => (s.data?.pages ?? []).flatMap((e) => e.data), [s.data?.pages]), h = s.data?.pages?.[0]?.meta;
217
217
  return {
218
218
  rows: f,
219
219
  refs: s.data?.pages?.[s.data.pages.length - 1]?.$refs,
220
- total: m && !m.count_unknown ? m.total : void 0,
221
- countMode: m?.count_mode,
222
- countUnknown: m?.count_unknown ?? !1,
220
+ total: h && !h.count_unknown ? h.total : void 0,
221
+ countMode: h?.count_mode,
222
+ countUnknown: h?.count_unknown ?? !1,
223
223
  hasMore: s.hasNextPage,
224
224
  fetchNextPage: s.fetchNextPage,
225
225
  isFetchingNextPage: s.isFetchingNextPage,
@@ -231,45 +231,8 @@ function k(e, t, n) {
231
231
  };
232
232
  }
233
233
  //#endregion
234
- //#region src/hooks/useTabSearchMirror.ts
235
- function A(e) {
236
- let t = o(), [n] = f();
237
- u(() => {
238
- if (!e || t.enabled) return;
239
- let r = c.getState(), i = r.findTabByPathname(e);
240
- i && r.updateTabSearch(i.id, n.toString());
241
- }, [
242
- n,
243
- e,
244
- t.enabled
245
- ]);
246
- }
247
- //#endregion
248
- //#region src/hooks/useRegisterScreenTab.ts
249
- function j(e, t, n, r) {
250
- let i = o();
251
- l(() => {
252
- !e || i.enabled || c.getState().openTab({
253
- pathname: e,
254
- search: r,
255
- title: t,
256
- icon: n,
257
- closable: !0
258
- });
259
- }, [
260
- e,
261
- t,
262
- n,
263
- i.enabled
264
- ]);
265
- }
266
- function M(e, t, n) {
267
- let i = e?.route, a = t ? r(e?.display?.name) || r(t.display.name_plural) : "", o = e?.display?.icon || t?.display.icon;
268
- j(t ? i : void 0, a, o, n);
269
- }
270
- //#endregion
271
234
  //#region src/lib/filters.ts
272
- var N = /* @__PURE__ */ new Set([
235
+ var k = /* @__PURE__ */ new Set([
273
236
  "is_empty",
274
237
  "is_not_empty",
275
238
  "today",
@@ -279,7 +242,7 @@ var N = /* @__PURE__ */ new Set([
279
242
  "last_30_days",
280
243
  "last_hour",
281
244
  "last_24_hours"
282
- ]), P = /* @__PURE__ */ new Set(["in", "not_in"]), F = {
245
+ ]), A = /* @__PURE__ */ new Set(["in", "not_in"]), j = {
283
246
  eq: "is",
284
247
  not_eq: "is not",
285
248
  gt: ">",
@@ -301,7 +264,7 @@ var N = /* @__PURE__ */ new Set([
301
264
  last_hour: "last hour",
302
265
  last_24_hours: "last 24 hours"
303
266
  };
304
- function I(e) {
267
+ function M(e) {
305
268
  let t = e.get("filters");
306
269
  if (t == null || t === "") return {
307
270
  filters: [],
@@ -309,7 +272,7 @@ function I(e) {
309
272
  };
310
273
  try {
311
274
  return {
312
- filters: L(e),
275
+ filters: N(e),
313
276
  error: null
314
277
  };
315
278
  } catch (e) {
@@ -319,7 +282,7 @@ function I(e) {
319
282
  };
320
283
  }
321
284
  }
322
- function L(e) {
285
+ function N(e) {
323
286
  let t = e.get("filters");
324
287
  if (t == null || t === "") return [];
325
288
  let n;
@@ -328,48 +291,48 @@ function L(e) {
328
291
  } catch {
329
292
  throw Error("The filters URL value is not valid JSON.");
330
293
  }
331
- if (!Array.isArray(n) || !n.every(G)) throw Error("The filters URL value is not a valid filter tree.");
294
+ if (!Array.isArray(n) || !n.every(V)) throw Error("The filters URL value is not a valid filter tree.");
332
295
  return n;
333
296
  }
334
- function R(e, t) {
297
+ function P(e, t) {
335
298
  e.length === 0 ? t.delete("filters") : t.set("filters", JSON.stringify(e));
336
299
  }
337
- function z(e) {
338
- return e.some((e) => !e || typeof e != "object" ? !1 : e.or != null || e.and != null && z(e.and));
300
+ function F(e) {
301
+ return e.some((e) => !e || typeof e != "object" ? !1 : e.or != null || e.and != null && F(e.and));
339
302
  }
340
- function B(e) {
303
+ function I(e) {
341
304
  let t = [];
342
- for (let n of e) !n || typeof n != "object" || (n.field && n.op && t.push(n), n.or && t.push(...B(n.or)), n.and && t.push(...B(n.and)));
305
+ for (let n of e) !n || typeof n != "object" || (n.field && n.op && t.push(n), n.or && t.push(...I(n.or)), n.and && t.push(...I(n.and)));
343
306
  return t;
344
307
  }
345
- function V(e) {
346
- return B(e).length;
308
+ function L(e) {
309
+ return I(e).length;
347
310
  }
348
- function H(e, t) {
311
+ function R(e, t) {
349
312
  if (!e.field || !e.op) return "";
350
- let r = F[e.op] || e.op;
351
- if (N.has(e.op)) return `${r}`;
352
- let i = e.field, a = (e) => {
313
+ let n = j[e.op] || e.op;
314
+ if (k.has(e.op)) return `${n}`;
315
+ let r = e.field, i = (e) => {
353
316
  if (t) {
354
- let n = t(i, e);
317
+ let n = t(r, e);
355
318
  return n.label != null && (n.status === "special" || n.status === "resolved") ? n.label : n.raw;
356
319
  }
357
- return n(e);
320
+ return s(e);
358
321
  };
359
- return `${r} ${Array.isArray(e.value) ? e.value.map(a).join(", ") : a(e.value)}`;
322
+ return `${n} ${Array.isArray(e.value) ? e.value.map(i).join(", ") : i(e.value)}`;
360
323
  }
361
- function U(e, t) {
324
+ function z(e, t) {
362
325
  return {
363
326
  field: e,
364
327
  op: "eq",
365
328
  value: t
366
329
  };
367
330
  }
368
- function W(e, t) {
331
+ function B(e, t) {
369
332
  let n = [];
370
333
  for (let r of e) if (!(!r || typeof r != "object") && r.field !== t) {
371
334
  if (r.or) {
372
- let e = W(r.or, t);
335
+ let e = B(r.or, t);
373
336
  e.length > 0 && n.push({
374
337
  ...r,
375
338
  or: e
@@ -377,7 +340,7 @@ function W(e, t) {
377
340
  continue;
378
341
  }
379
342
  if (r.and) {
380
- let e = W(r.and, t);
343
+ let e = B(r.and, t);
381
344
  e.length > 0 && n.push({
382
345
  ...r,
383
346
  and: e
@@ -388,97 +351,56 @@ function W(e, t) {
388
351
  }
389
352
  return n;
390
353
  }
391
- function G(e) {
354
+ function V(e) {
392
355
  if (typeof e != "object" || !e || Array.isArray(e)) return !1;
393
356
  let t = e, n = Object.prototype.hasOwnProperty.call(t, "field"), r = Object.prototype.hasOwnProperty.call(t, "op"), i = Object.prototype.hasOwnProperty.call(t, "value"), a = Object.prototype.hasOwnProperty.call(t, "or"), o = Object.prototype.hasOwnProperty.call(t, "and");
394
357
  if (a && o) return !1;
395
358
  if (a || o) {
396
359
  if (n || r || i) return !1;
397
360
  let e = a ? t.or : t.and;
398
- return Array.isArray(e) && e.length > 0 && e.every(G);
361
+ return Array.isArray(e) && e.length > 0 && e.every(V);
399
362
  }
400
- if (!(n && r && typeof t.field == "string" && t.field.length > 0 && typeof t.op == "string" && K.has(t.op))) return !1;
363
+ if (!(n && r && typeof t.field == "string" && t.field.length > 0 && typeof t.op == "string" && H.has(t.op))) return !1;
401
364
  let s = t.op;
402
- return N.has(s) ? !i || t.value === null : i && t.value !== null;
403
- }
404
- var K = new Set(Object.keys(F));
405
- //#endregion
406
- //#region src/api/status.ts
407
- async function q(e, t, n, r, a) {
408
- let o = {
409
- status_group_code: n,
410
- status_code: r
411
- };
412
- a != null && (o.note = a);
413
- let s = (await i(`${e}.__update`, {
414
- object_ids: [t],
415
- entity: e,
416
- fields: { $statuses: [o] }
417
- })).result?.rows?.[0]?.$statuses ?? [];
418
- return s.find((e) => e.group_code === n) ?? s[0];
365
+ return k.has(s) ? !i || t.value === null : i && t.value !== null;
419
366
  }
367
+ var H = new Set(Object.keys(j));
420
368
  //#endregion
421
- //#region src/hooks/useObjectStatus.ts
422
- function J(e, t) {
423
- let n = h();
424
- return m({
425
- mutationFn: ({ groupCode: n, statusCode: r, note: i }) => q(e, t, n, r, i),
426
- onSuccess: () => {
427
- n.invalidateQueries({ queryKey: ["entity-item", e] });
428
- },
429
- onError: (e) => {
430
- s.error(e.message);
431
- }
432
- });
433
- }
434
- //#endregion
435
- //#region src/api/properties.ts
436
- async function Y(e, t, n, r) {
437
- let a = (await i(`${e}.__update`, {
438
- object_ids: [t],
439
- entity: e,
440
- fields: { $properties: [{
441
- property_code: n,
442
- value: r
443
- }] }
444
- })).result?.rows?.[0]?.$properties ?? [];
445
- return a.find((e) => e.property_code === n) ?? a[0];
369
+ //#region src/hooks/useRegisterScreenTab.ts
370
+ function U(e, t, n, r) {
371
+ let i = o();
372
+ l(() => {
373
+ !e || i.enabled || c.getState().openTab({
374
+ pathname: e,
375
+ search: r,
376
+ title: t,
377
+ icon: n,
378
+ closable: !0
379
+ });
380
+ }, [
381
+ e,
382
+ t,
383
+ n,
384
+ i.enabled
385
+ ]);
446
386
  }
447
- async function X(e, t, n) {
448
- await i(`${e}.__update`, {
449
- object_ids: [t],
450
- entity: e,
451
- fields: { $properties: [{
452
- property_code: n,
453
- value: null
454
- }] }
455
- });
387
+ function W(t, n, r) {
388
+ let i = t?.route, a = n ? e(t?.display?.name) || e(n.display.name_plural) : "", o = t?.display?.icon || n?.display.icon;
389
+ U(n ? i : void 0, a, o, r);
456
390
  }
457
391
  //#endregion
458
- //#region src/hooks/useProperties.ts
459
- function Z(e, t) {
460
- let n = h();
461
- return m({
462
- mutationFn: ({ propertyCode: n, value: r }) => Y(e, t, n, r),
463
- onSuccess: () => {
464
- n.invalidateQueries({ queryKey: ["entity-item", e] });
465
- },
466
- onError: (e) => {
467
- s.error(e.message);
468
- }
469
- });
470
- }
471
- function Q(e, t) {
472
- let n = h();
473
- return m({
474
- mutationFn: (n) => X(e, t, n),
475
- onSuccess: () => {
476
- n.invalidateQueries({ queryKey: ["entity-item", e] });
477
- },
478
- onError: (e) => {
479
- s.error(e.message);
480
- }
481
- });
392
+ //#region src/hooks/useTabSearchMirror.ts
393
+ function G(e) {
394
+ let t = o(), [n] = f();
395
+ u(() => {
396
+ if (!e || t.enabled) return;
397
+ let r = c.getState(), i = r.findTabByPathname(e);
398
+ i && r.updateTabSearch(i.id, n.toString());
399
+ }, [
400
+ n,
401
+ e,
402
+ t.enabled
403
+ ]);
482
404
  }
483
405
  //#endregion
484
- export { x as C, k as S, T, j as _, N as a, O as b, U as c, z as d, I as f, M as g, R as h, P as i, B as l, W as m, Z as n, F as o, L as p, J as r, V as s, Q as t, H as u, A as v, y as w, D as x, E as y };
406
+ export { w as S, D as _, k as a, b, z as c, F as d, M as f, T as g, P as h, A as i, I as l, B as m, W as n, j as o, N as p, U as r, L as s, G as t, R as u, E as v, v as x, O as y };