@declarion/react 0.53.0 → 0.54.1

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 (63) hide show
  1. package/dist-lib/{DraggableChildrenTable-BQZTvZaU.js → DraggableChildrenTable-Djc7QDzR.js} +32 -32
  2. package/dist-lib/{Grid-B9Tiytbd.js → Grid-Bd2r0_4J.js} +45 -45
  3. package/dist-lib/{LayoutRenderer-D_v9OD_A.js → LayoutRenderer-V6nf9aa_.js} +716 -714
  4. package/dist-lib/{ListCardsBody-dRnXsQ7A.js → ListCardsBody-Cdsvu0Vs.js} +29 -29
  5. package/dist-lib/{MarkdownRenderer-BCyrsLrd.js → MarkdownRenderer-CZo5ZgM7.js} +1 -1
  6. package/dist-lib/{RefreshControl-CV8nGACW.js → RefreshControl-CJm3vz9p.js} +40 -40
  7. package/dist-lib/{SmartDetailPage.impl-DWprVNMb.js → SmartDetailPage.impl-DoIjCzjQ.js} +492 -492
  8. package/dist-lib/{SmartListPage.impl-BwWURGwa.js → SmartListPage.impl-DnM8e14t.js} +743 -742
  9. package/dist-lib/{SmartRecordListPage.impl-BKKBShAg.js → SmartRecordListPage.impl-BmHGYbD9.js} +128 -128
  10. package/dist-lib/{SortHeaderMenu-pgi4sxMs.js → SortHeaderMenu-CA53NerB.js} +1 -1
  11. package/dist-lib/{action-dispatch-DlHTYag7.js → action-dispatch-JcUrLFaW.js} +177 -177
  12. package/dist-lib/api/agents.d.ts +0 -1
  13. package/dist-lib/api/events.d.ts +13 -4
  14. package/dist-lib/{cardProjection-C7Orz841.js → cardProjection-Q2kwqv8V.js} +19 -19
  15. package/dist-lib/components/actions/ObjectActionBar.d.ts +1 -1
  16. package/dist-lib/components/chrome/Breadcrumbs.d.ts +1 -1
  17. package/dist-lib/components/detail-layout/DetailAuditStrip.d.ts +1 -1
  18. package/dist-lib/components/detail-layout/DetailHighlights.d.ts +1 -1
  19. package/dist-lib/components/detail-layout/DraggableChildrenTable.d.ts +1 -1
  20. package/dist-lib/components/detail-layout/EditableChildrenTable.d.ts +1 -1
  21. package/dist-lib/components/detail-layout/LayoutRenderer.d.ts +1 -1
  22. package/dist-lib/components/file-widgets/host.d.ts +1 -1
  23. package/dist-lib/components/layout/Layout.d.ts +1 -1
  24. package/dist-lib/components/layout/TopBar.d.ts +1 -1
  25. package/dist-lib/components/list/InlineEditCell.d.ts +1 -1
  26. package/dist-lib/components/list/PeekFieldCell.d.ts +1 -1
  27. package/dist-lib/components/list/QuickPeek.d.ts +1 -1
  28. package/dist-lib/components/pages/auth/AuthShell.d.ts +1 -1
  29. package/dist-lib/components/pages/list/ListCardRow.d.ts +1 -1
  30. package/dist-lib/components/pages/list/ListCardsBody.d.ts +1 -1
  31. package/dist-lib/components/pages/list/ListFloatbar.d.ts +1 -1
  32. package/dist-lib/components/pages/list/ListHeader.d.ts +1 -1
  33. package/dist-lib/components/pages/list/ListToolbar.d.ts +5 -3
  34. package/dist-lib/components/pages/list/columns.d.ts +1 -1
  35. package/dist-lib/components/pages/list/filter-meta.d.ts +1 -1
  36. package/dist-lib/components/pages/list/use-filter-value-labels.d.ts +1 -1
  37. package/dist-lib/components/pages/list/useListQuery.d.ts +1 -5
  38. package/dist-lib/components/pages/list/useListRowInteraction.d.ts +1 -1
  39. package/dist-lib/components/pages/list/useListViews.d.ts +1 -1
  40. package/dist-lib/components/pages/list/useRowMenu.d.ts +1 -1
  41. package/dist-lib/{field-classification-EY8CFF3P.js → field-classification-ssZvtr8J.js} +268 -397
  42. package/dist-lib/{format-count-BHkaDr9V.js → format-count-DHuivNT7.js} +236 -236
  43. package/dist-lib/hooks/useEntityData.d.ts +7 -0
  44. package/dist-lib/hooks/useRealtimeThresholds.d.ts +1 -0
  45. package/dist-lib/hooks/useSSE.d.ts +0 -1
  46. package/dist-lib/index.js +1039 -1020
  47. package/dist-lib/lib/action-dispatch.d.ts +1 -1
  48. package/dist-lib/lib/realtime-query-keys.d.ts +22 -0
  49. package/dist-lib/lib/realtime-reconcile.d.ts +0 -9
  50. package/dist-lib/lib/realtime-resync.d.ts +23 -0
  51. package/dist-lib/{peekDraftStore-1pIajluX.js → peekDraftStore-lm9ViVLA.js} +17 -17
  52. package/dist-lib/{registry-C5ug25M8.js → registry-DsQFhEAD.js} +511 -511
  53. package/dist-lib/stores/realtime.d.ts +86 -19
  54. package/dist-lib/testing.js +40 -40
  55. package/dist-lib/types/api.d.ts +8 -4
  56. package/dist-lib/types/schema.d.ts +6 -0
  57. package/dist-lib/{useCurrentScreen-BdnZq8vZ.js → useCurrentScreen-aHx9HH1m.js} +2473 -1960
  58. package/dist-lib/useListQuery-DZn2BAxY.js +96 -0
  59. package/dist-lib/{useProperties-Bhi9Wn5O.js → useProperties-CAqKmUKg.js} +25 -25
  60. package/dist-lib/{useTabSearchMirror-Dl5x0xKu.js → useTabSearchMirror-DYW9WoK7.js} +10 -10
  61. package/dist-lib/{value-Rp-5W3o8.js → value-CzKQPJOp.js} +4 -4
  62. package/package.json +10 -10
  63. package/dist-lib/useListQuery-BxgrPZIB.js +0 -90
@@ -0,0 +1,96 @@
1
+ import { bt as e, l as t, s as n, vt as r, xt as i, yt as a } from "./useCurrentScreen-aHx9HH1m.js";
2
+ import { g as o } from "./field-classification-ssZvtr8J.js";
3
+ import { useCallback as s, useEffect as c, useMemo as l, useState as u } from "react";
4
+ import { useQueryClient as d } from "@tanstack/react-query";
5
+ //#region src/components/pages/list/useListQuery.ts
6
+ var f = 1e4;
7
+ function p(c) {
8
+ let u = d(), { entity: f, entityCode: p, screen: h, screenCode: g, page: _, perPage: v, sortForRequest: y, debouncedSearch: b, filters: x, filterError: S, includeDeleted: C, expand: w, select: T, runCountQuery: E, urlKey: D } = c, O = S ? void 0 : x.length > 0 ? x : void 0, k = {
9
+ page: _,
10
+ per_page: v,
11
+ sort: y,
12
+ search: b || void 0,
13
+ filters: O,
14
+ include_deleted: C || void 0,
15
+ expand: w,
16
+ select: T,
17
+ preview: !0,
18
+ screen: h?.fixed_filters ? g : void 0
19
+ }, A = {
20
+ sort: y,
21
+ filters: O,
22
+ search: b || void 0,
23
+ select: T,
24
+ expand: w,
25
+ includeDeleted: C || void 0,
26
+ screen: h?.fixed_filters ? g : void 0,
27
+ preview: !0,
28
+ limit: v
29
+ }, j = f?.list_pagination === "cursor", M = i(p, k, !j), N = e(p, k, E && !j), P = t(p, A, j);
30
+ o(a(p, k), !j), o(n(p, A), j);
31
+ let F = j ? P.isLoading : M.isLoading, I = l(() => j ? P.rows : M.data?.data ?? [], [
32
+ j,
33
+ P.rows,
34
+ M.data?.data
35
+ ]), L = j ? P.total : N.data?.meta?.total, R = l(() => {
36
+ if (!(j || L === void 0 || v <= 0)) return Math.max(1, Math.ceil(L / v));
37
+ }, [
38
+ j,
39
+ L,
40
+ v
41
+ ]), z = m(F, D), B = j ? n(p, A) : a(p, k), V = r(p, k), H = E && !j, U = s(async () => {
42
+ p && (await Promise.all([u.cancelQueries({
43
+ queryKey: B,
44
+ exact: !0
45
+ }), H ? u.cancelQueries({
46
+ queryKey: V,
47
+ exact: !0
48
+ }) : void 0]), await Promise.all([j ? P.refetch() : M.refetch(), H ? N.refetch() : void 0]));
49
+ }, [
50
+ p,
51
+ u,
52
+ B,
53
+ V,
54
+ H,
55
+ j,
56
+ P,
57
+ M,
58
+ N
59
+ ]), W = s(() => {
60
+ P.fetchNextPage();
61
+ }, [P]);
62
+ return {
63
+ rows: I,
64
+ meta: M.data?.meta,
65
+ refs: j ? P.refs : M.data?.$refs,
66
+ isLoading: F,
67
+ isFetching: j ? P.isFetching : M.isFetching,
68
+ isError: j ? P.isError : M.isError,
69
+ error: j ? P.error : M.error,
70
+ isLoadingStale: z,
71
+ retry: U,
72
+ countTotal: L,
73
+ countStrategy: j ? P.countMode : N.data?.meta?.count_mode,
74
+ countLoading: j ? P.isLoading : N.isLoading,
75
+ countError: !j && N.isError,
76
+ totalPages: R,
77
+ hasMorePages: j ? P.hasMore : M.data?.meta?.has_more ?? (R !== void 0 && _ < R),
78
+ isCursor: j,
79
+ fetchNextPage: W,
80
+ isFetchingNextPage: P.isFetchingNextPage
81
+ };
82
+ }
83
+ function m(e, t) {
84
+ let [n, r] = u(!1);
85
+ return c(() => {
86
+ if (!e) {
87
+ r(!1);
88
+ return;
89
+ }
90
+ r(!1);
91
+ let t = window.setTimeout(() => r(!0), f);
92
+ return () => window.clearTimeout(t);
93
+ }, [e, t]), n;
94
+ }
95
+ //#endregion
96
+ export { p as t };
@@ -1,39 +1,39 @@
1
- import { Mt as e, Yt as t } from "./useCurrentScreen-BdnZq8vZ.js";
1
+ import { en as e, jt as t } from "./useCurrentScreen-aHx9HH1m.js";
2
2
  import { useMutation as n, useQueryClient as r } from "@tanstack/react-query";
3
3
  //#region src/api/status.ts
4
- async function i(e, n, r, i, a) {
4
+ async function i(t, n, r, i, a) {
5
5
  let o = {
6
6
  status_group_code: r,
7
7
  status_code: i
8
8
  };
9
9
  a != null && (o.note = a);
10
- let s = (await t(`${e}.__update`, {
10
+ let s = (await e(`${t}.__update`, {
11
11
  object_ids: [n],
12
- entity: e,
12
+ entity: t,
13
13
  fields: { $statuses: [o] }
14
14
  })).result?.rows?.[0]?.$statuses ?? [];
15
15
  return s.find((e) => e.group_code === r) ?? s[0];
16
16
  }
17
17
  //#endregion
18
18
  //#region src/hooks/useObjectStatus.ts
19
- function a(t, a) {
19
+ function a(e, a) {
20
20
  let o = r();
21
21
  return n({
22
- mutationFn: ({ groupCode: e, statusCode: n, note: r }) => i(t, a, e, n, r),
22
+ mutationFn: ({ groupCode: t, statusCode: n, note: r }) => i(e, a, t, n, r),
23
23
  onSuccess: () => {
24
- o.invalidateQueries({ queryKey: ["entity-item", t] });
24
+ o.invalidateQueries({ queryKey: ["entity-item", e] });
25
25
  },
26
- onError: (t) => {
27
- e.error(t.message);
26
+ onError: (e) => {
27
+ t.error(e.message);
28
28
  }
29
29
  });
30
30
  }
31
31
  //#endregion
32
32
  //#region src/api/properties.ts
33
- async function o(e, n, r, i) {
34
- let a = (await t(`${e}.__update`, {
33
+ async function o(t, n, r, i) {
34
+ let a = (await e(`${t}.__update`, {
35
35
  object_ids: [n],
36
- entity: e,
36
+ entity: t,
37
37
  fields: { $properties: [{
38
38
  property_code: r,
39
39
  value: i
@@ -41,10 +41,10 @@ async function o(e, n, r, i) {
41
41
  })).result?.rows?.[0]?.$properties ?? [];
42
42
  return a.find((e) => e.property_code === r) ?? a[0];
43
43
  }
44
- async function s(e, n, r) {
45
- await t(`${e}.__update`, {
44
+ async function s(t, n, r) {
45
+ await e(`${t}.__update`, {
46
46
  object_ids: [n],
47
- entity: e,
47
+ entity: t,
48
48
  fields: { $properties: [{
49
49
  property_code: r,
50
50
  value: null
@@ -53,27 +53,27 @@ async function s(e, n, r) {
53
53
  }
54
54
  //#endregion
55
55
  //#region src/hooks/useProperties.ts
56
- function c(t, i) {
56
+ function c(e, i) {
57
57
  let a = r();
58
58
  return n({
59
- mutationFn: ({ propertyCode: e, value: n }) => o(t, i, e, n),
59
+ mutationFn: ({ propertyCode: t, value: n }) => o(e, i, t, n),
60
60
  onSuccess: () => {
61
- a.invalidateQueries({ queryKey: ["entity-item", t] });
61
+ a.invalidateQueries({ queryKey: ["entity-item", e] });
62
62
  },
63
- onError: (t) => {
64
- e.error(t.message);
63
+ onError: (e) => {
64
+ t.error(e.message);
65
65
  }
66
66
  });
67
67
  }
68
- function l(t, i) {
68
+ function l(e, i) {
69
69
  let a = r();
70
70
  return n({
71
- mutationFn: (e) => s(t, i, e),
71
+ mutationFn: (t) => s(e, i, t),
72
72
  onSuccess: () => {
73
- a.invalidateQueries({ queryKey: ["entity-item", t] });
73
+ a.invalidateQueries({ queryKey: ["entity-item", e] });
74
74
  },
75
- onError: (t) => {
76
- e.error(t.message);
75
+ onError: (e) => {
76
+ t.error(e.message);
77
77
  }
78
78
  });
79
79
  }
@@ -1,5 +1,5 @@
1
- import { Ht as e, Zn as t, lr as n } from "./useCurrentScreen-BdnZq8vZ.js";
2
- import { M as r } from "./field-classification-EY8CFF3P.js";
1
+ import { Vt as e, mr as t, nr as n } from "./useCurrentScreen-aHx9HH1m.js";
2
+ import { M as r } from "./field-classification-ssZvtr8J.js";
3
3
  import { useEffect as i, useLayoutEffect as a } from "react";
4
4
  import { useSearchParams as o } from "react-router";
5
5
  //#region src/lib/filters.ts
@@ -79,16 +79,16 @@ function m(e) {
79
79
  function h(e) {
80
80
  return m(e).length;
81
81
  }
82
- function g(e, t) {
82
+ function g(e, n) {
83
83
  if (!e.field || !e.op) return "";
84
84
  let r = l[e.op] || e.op;
85
85
  if (s.has(e.op)) return `${r}`;
86
86
  let i = e.field, a = (e) => {
87
- if (t) {
88
- let n = t(i, e);
89
- return n.label != null && (n.status === "special" || n.status === "resolved") ? n.label : n.raw;
87
+ if (n) {
88
+ let t = n(i, e);
89
+ return t.label != null && (t.status === "special" || t.status === "resolved") ? t.label : t.raw;
90
90
  }
91
- return n(e);
91
+ return t(e);
92
92
  };
93
93
  return `${r} ${Array.isArray(e.value) ? e.value.map(a).join(", ") : a(e.value)}`;
94
94
  }
@@ -155,9 +155,9 @@ function x(t, n, a, o) {
155
155
  s.enabled
156
156
  ]);
157
157
  }
158
- function S(e, n, r) {
159
- let i = e?.route, a = n ? t(e?.display?.name) || t(n.display.name_plural) : "", o = e?.display?.icon || n?.display.icon;
160
- x(n ? i : void 0, a, o, r);
158
+ function S(e, t, r) {
159
+ let i = e?.route, a = t ? n(e?.display?.name) || n(t.display.name_plural) : "", o = e?.display?.icon || t?.display.icon;
160
+ x(t ? i : void 0, a, o, r);
161
161
  }
162
162
  //#endregion
163
163
  //#region src/hooks/useTabSearchMirror.ts
@@ -1,4 +1,4 @@
1
- import { En as e, On as t, Tn as n, zn as r } from "./useCurrentScreen-BdnZq8vZ.js";
1
+ import { An as e, Nn as t, Wn as n, jn as r } from "./useCurrentScreen-aHx9HH1m.js";
2
2
  import { useCallback as i, useEffect as a, useRef as o, useState as s } from "react";
3
3
  //#region src/embed/file-src.ts
4
4
  var c = "/api/files";
@@ -30,10 +30,10 @@ function p(e) {
30
30
  return `${e}${e.includes("?") ? "&" : "?"}disposition=attachment`;
31
31
  }
32
32
  async function m(t, i) {
33
- let a = await n(), o = await fetch(t, f(a, i));
33
+ let a = await e(), o = await fetch(t, f(a, i));
34
34
  if (o.status !== 401) return o;
35
- await r(o), e();
36
- let s = await n();
35
+ await n(o), r();
36
+ let s = await e();
37
37
  return fetch(t, f(s, i));
38
38
  }
39
39
  async function h(e, n, r) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@declarion/react",
3
- "version": "0.53.0",
3
+ "version": "0.54.1",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "React SDK for Declarion, the schema-driven business apps platform.",
@@ -67,11 +67,11 @@
67
67
  "@radix-ui/react-slot": "^1.3.3",
68
68
  "@tanstack/react-query": "^5.102.8",
69
69
  "@tanstack/react-table": "^9.2.4",
70
- "@tanstack/react-virtual": "^3.14.10",
70
+ "@tanstack/react-virtual": "^3.14.11",
71
71
  "class-variance-authority": "^0.7.1",
72
72
  "clsx": "^2.1.1",
73
73
  "date-fns": "^4.4.0",
74
- "lucide-react": "^1.35.0",
74
+ "lucide-react": "^1.43.0",
75
75
  "mdast-util-to-string": "^4.0.0",
76
76
  "monaco-editor": "^0.56.0",
77
77
  "react-markdown": "^10.1.0",
@@ -94,13 +94,13 @@
94
94
  "@testing-library/dom": "^10.4.1",
95
95
  "@testing-library/jest-dom": "^7.0.1",
96
96
  "@testing-library/react": "^16.3.3",
97
- "@testing-library/user-event": "^14.6.6",
97
+ "@testing-library/user-event": "^14.6.7",
98
98
  "@types/react": "^19.2.18",
99
- "@types/react-dom": "^19.2.5",
99
+ "@types/react-dom": "^19.2.7",
100
100
  "@vitejs/plugin-react": "^6.1.1",
101
- "@vitest/coverage-v8": "^4.1.11",
101
+ "@vitest/coverage-v8": "^5.0.0",
102
102
  "axe-core": "^4.13.0",
103
- "eslint": "^10.9.1",
103
+ "eslint": "^10.10.0",
104
104
  "eslint-plugin-react-hooks": "^7.1.1",
105
105
  "jsdom": "^30.0.1",
106
106
  "msw": "^2.15.0",
@@ -108,11 +108,11 @@
108
108
  "react": "^19.2.8",
109
109
  "react-dom": "^19.2.8",
110
110
  "tailwindcss": "^4.3.3",
111
- "tsc-alias": "^1.9.2",
111
+ "tsc-alias": "^1.9.4",
112
112
  "typescript": "^6.0.3",
113
- "typescript-eslint": "^8.68.0",
113
+ "typescript-eslint": "^8.70.0",
114
114
  "vite": "^8.2.2",
115
- "vitest": "^4.1.11"
115
+ "vitest": "^5.0.0"
116
116
  },
117
117
  "scripts": {
118
118
  "dev": "vite",
@@ -1,90 +0,0 @@
1
- import { C as e, St as t, T as n, bt as r, xt as i } from "./useCurrentScreen-BdnZq8vZ.js";
2
- import { g as a } from "./field-classification-EY8CFF3P.js";
3
- import { useCallback as o, useEffect as s, useMemo as c, useState as l } from "react";
4
- import { useQueryClient as u } from "@tanstack/react-query";
5
- //#region src/components/pages/list/useListQuery.ts
6
- var d = 1e4;
7
- function f(s) {
8
- 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 = {
9
- page: g,
10
- per_page: _,
11
- sort: v,
12
- search: y || void 0,
13
- filters: D,
14
- include_deleted: S || void 0,
15
- expand: C,
16
- select: w,
17
- preview: !0,
18
- screen: m?.fixed_filters ? h : void 0
19
- }, k = {
20
- sort: v,
21
- filters: D,
22
- search: y || void 0,
23
- select: w,
24
- expand: C,
25
- includeDeleted: S || void 0,
26
- screen: m?.fixed_filters ? h : void 0,
27
- preview: !0,
28
- limit: _
29
- }, A = d?.list_pagination === "cursor", j = t(f, O, !A), M = i(f, O, T && !A), N = n(f, k, A);
30
- a(r(f, O), !A), a(e(f, k), A);
31
- let P = A ? N.isLoading : j.isLoading, F = c(() => A ? N.rows : j.data?.data ?? [], [
32
- A,
33
- N.rows,
34
- j.data?.data
35
- ]), I = A ? N.total : M.data?.meta?.total, L = c(() => {
36
- if (!(A || I === void 0 || _ <= 0)) return Math.max(1, Math.ceil(I / _));
37
- }, [
38
- A,
39
- I,
40
- _
41
- ]), R = p(P, E), z = A ? e(f, k) : r(f, O), B = o(async () => {
42
- f && (await l.cancelQueries({
43
- queryKey: z,
44
- exact: !0
45
- }), await (A ? N.refetch() : j.refetch()));
46
- }, [
47
- f,
48
- l,
49
- z,
50
- A,
51
- N,
52
- j
53
- ]), V = o(() => {
54
- N.fetchNextPage();
55
- }, [N]);
56
- return {
57
- rows: F,
58
- meta: j.data?.meta,
59
- refs: A ? N.refs : j.data?.$refs,
60
- isLoading: P,
61
- isFetching: A ? N.isFetching : j.isFetching,
62
- isError: A ? N.isError : j.isError,
63
- error: A ? N.error : j.error,
64
- isLoadingStale: R,
65
- retry: B,
66
- countTotal: I,
67
- countStrategy: A ? N.countMode : M.data?.meta?.count_mode,
68
- countLoading: A ? N.isLoading : M.isLoading,
69
- countError: !A && M.isError,
70
- totalPages: L,
71
- hasMorePages: A ? N.hasMore : j.data?.meta?.has_more ?? (L !== void 0 && g < L),
72
- isCursor: A,
73
- fetchNextPage: V,
74
- isFetchingNextPage: N.isFetchingNextPage
75
- };
76
- }
77
- function p(e, t) {
78
- let [n, r] = l(!1);
79
- return s(() => {
80
- if (!e) {
81
- r(!1);
82
- return;
83
- }
84
- r(!1);
85
- let t = window.setTimeout(() => r(!0), d);
86
- return () => window.clearTimeout(t);
87
- }, [e, t]), n;
88
- }
89
- //#endregion
90
- export { f as t };