@declarion/react 0.48.1 → 0.49.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 (84) hide show
  1. package/dist-lib/Check-DAfMbQIw.js +38 -0
  2. package/dist-lib/{DraggableChildrenTable-p2ZSdwzj.js → DraggableChildrenTable-B98Md-Yq.js} +30 -30
  3. package/dist-lib/{Grid-CjLFAKMZ.js → Grid-BdtEd4R9.js} +2 -2
  4. package/dist-lib/{LayoutRenderer-DCscqXsv.js → LayoutRenderer-oVU3nEb5.js} +600 -597
  5. package/dist-lib/ListCardsBody-DYMt1H8l.js +287 -0
  6. package/dist-lib/{MarkdownRenderer-Sb7zcvj0.js → MarkdownRenderer-E9hbyoUn.js} +1 -1
  7. package/dist-lib/RefreshControl-B_2eW53M.js +430 -0
  8. package/dist-lib/{SmartDetailPage.impl-BAW-Tx_H.js → SmartDetailPage.impl-Dg22HOxb.js} +520 -515
  9. package/dist-lib/SmartListPage.impl-CPhhXT5S.js +2849 -0
  10. package/dist-lib/{SmartRecordListPage.impl-DtSSlGrI.js → SmartRecordListPage.impl-CF0UKgUj.js} +243 -240
  11. package/dist-lib/SortHeaderMenu-DodGvb7A.js +106 -0
  12. package/dist-lib/action-dispatch-CYOw7nkP.js +1984 -0
  13. package/dist-lib/api/batch.d.ts +5 -2
  14. package/dist-lib/api/data.d.ts +35 -4
  15. package/dist-lib/api/entities.d.ts +3 -3
  16. package/dist-lib/cardProjection-D-AufCh-.js +757 -0
  17. package/dist-lib/components/{shared → actions}/ObjectActionBar.d.ts +1 -1
  18. package/dist-lib/components/{shared → actions}/ResponsiveActionBar.d.ts +1 -1
  19. package/dist-lib/components/fields/cells/factories/date.d.ts +2 -0
  20. package/dist-lib/components/file-widgets/upload.d.ts +6 -1
  21. package/dist-lib/components/layout/Layout.d.ts +1 -1
  22. package/dist-lib/components/layout/TopBar.d.ts +1 -1
  23. package/dist-lib/components/pages/SmartListPage.d.ts +2 -12
  24. package/dist-lib/components/pages/SmartListPage.impl.d.ts +4 -0
  25. package/dist-lib/components/pages/list/ListCardRow.d.ts +40 -0
  26. package/dist-lib/components/pages/list/ListCardsBody.d.ts +34 -0
  27. package/dist-lib/components/pages/list/ListFloatbar.d.ts +1 -1
  28. package/dist-lib/components/pages/list/ListFooter.d.ts +26 -0
  29. package/dist-lib/components/pages/list/ListHeader.d.ts +1 -1
  30. package/dist-lib/components/pages/list/ListNoRows.d.ts +32 -0
  31. package/dist-lib/components/pages/list/ListTable.d.ts +34 -0
  32. package/dist-lib/components/pages/list/ListTableRow.d.ts +18 -0
  33. package/dist-lib/components/pages/list/ListToolbar.d.ts +43 -0
  34. package/dist-lib/components/pages/list/SortHeaderMenu.d.ts +14 -0
  35. package/dist-lib/components/pages/list/page-size.d.ts +3 -0
  36. package/dist-lib/components/pages/list/sortable-header.d.ts +2 -0
  37. package/dist-lib/components/pages/list/useListColumnLayout.d.ts +37 -0
  38. package/dist-lib/components/pages/list/useListQuery.d.ts +66 -0
  39. package/dist-lib/components/pages/list/useListRowInteraction.d.ts +61 -0
  40. package/dist-lib/components/pages/list/useListSelection.d.ts +31 -0
  41. package/dist-lib/components/pages/list/useListSort.d.ts +45 -0
  42. package/dist-lib/components/pages/list/useListViews.d.ts +46 -0
  43. package/dist-lib/components/pages/list/useRowMenu.d.ts +1 -1
  44. package/dist-lib/components/shared/RefreshControl.d.ts +17 -4
  45. package/dist-lib/field-classification-DTgUnbzd.js +1134 -0
  46. package/dist-lib/format-count-DAHCcHZO.js +1551 -0
  47. package/dist-lib/hooks/useBrandingChrome.d.ts +17 -1
  48. package/dist-lib/hooks/useText.d.ts +3 -0
  49. package/dist-lib/hooks/useViews.d.ts +1 -1
  50. package/dist-lib/index.d.ts +17 -15
  51. package/dist-lib/index.js +1783 -6287
  52. package/dist-lib/lib/messages.d.ts +7 -1
  53. package/dist-lib/lib/rowClickGesture.d.ts +12 -0
  54. package/dist-lib/lib/timestamp.d.ts +8 -3
  55. package/dist-lib/peekDraftStore-CnxqkoWN.js +194 -0
  56. package/dist-lib/record-documents-key-DEFlLxnF.js +27 -0
  57. package/dist-lib/registry-WypUQQ7t.js +1768 -0
  58. package/dist-lib/testing.d.ts +17 -2
  59. package/dist-lib/testing.js +72 -58
  60. package/dist-lib/types/api.d.ts +54 -12
  61. package/dist-lib/types/schema.d.ts +22 -6
  62. package/dist-lib/{useCurrentScreen-BshVTPVq.js → useCurrentScreen-C5Oio-1G.js} +1125 -1068
  63. package/dist-lib/useListQuery-Dc2vbxqs.js +87 -0
  64. package/dist-lib/useProperties-C36ENFdY.js +81 -0
  65. package/dist-lib/{useProperties-DrHFr0A1.js → useTabSearchMirror-sIuYEFaq.js} +116 -194
  66. package/dist-lib/{value-B1O6QikE.js → value-igT4LsqW.js} +69 -69
  67. package/package.json +1 -1
  68. package/dist-lib/RefreshControl-Cnl9nE0x.js +0 -945
  69. package/dist-lib/registry-CCxnZW2b.js +0 -5281
  70. /package/dist-lib/components/{shared → actions}/ActionButton.d.ts +0 -0
  71. /package/dist-lib/components/{shared → actions}/ActionDialog.d.ts +0 -0
  72. /package/dist-lib/components/{shared → actions}/ActionResultDialog.d.ts +0 -0
  73. /package/dist-lib/components/{shared → actions}/ActionRunner.d.ts +0 -0
  74. /package/dist-lib/components/{mass-edit → actions}/PropertyGridEditor.d.ts +0 -0
  75. /package/dist-lib/components/{shared → actions}/RowActionsKebab.d.ts +0 -0
  76. /package/dist-lib/components/{shared → chrome}/AssociationTabs.d.ts +0 -0
  77. /package/dist-lib/components/{shared → chrome}/AuditMetaStrip.d.ts +0 -0
  78. /package/dist-lib/components/{shared → chrome}/Breadcrumbs.d.ts +0 -0
  79. /package/dist-lib/components/{shared → chrome}/HighlightsStrip.d.ts +0 -0
  80. /package/dist-lib/components/{shared → chrome}/PageHeader.d.ts +0 -0
  81. /package/dist-lib/components/{shared → chrome}/RecordHeader.d.ts +0 -0
  82. /package/dist-lib/components/{shell → layout}/CommandPalette.d.ts +0 -0
  83. /package/dist-lib/components/{columns → list}/ColumnPicker.d.ts +0 -0
  84. /package/dist-lib/components/{views → list}/ViewSwitcher.d.ts +0 -0
@@ -1,24 +1,24 @@
1
- import { $t as e, en as t, rn as n } from "./useCurrentScreen-BshVTPVq.js";
2
- import { useCallback as r, useEffect as i, useRef as a, useState as o } from "react";
1
+ import { $t as e, en as t, hn as n, rn as r } from "./useCurrentScreen-C5Oio-1G.js";
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
- var s = "/api/files";
5
- function c(e) {
4
+ var c = "/api/files";
5
+ function l(e) {
6
6
  if (typeof e != "object" || !e) return !1;
7
7
  let t = e;
8
8
  return typeof t.url == "string" && typeof t.proxy == "boolean";
9
9
  }
10
- function l(e, t) {
10
+ function u(e, t) {
11
11
  let n = encodeURIComponent(e);
12
- return typeof t == "object" ? `${s}/${n}/derived/${encodeURIComponent(t.derivation)}/url` : `${s}/${n}/url`;
12
+ return typeof t == "object" ? `${c}/${n}/derived/${encodeURIComponent(t.derivation)}/url` : `${c}/${n}/url`;
13
13
  }
14
- var u = class extends Error {
14
+ var d = class extends Error {
15
15
  fileId;
16
16
  key;
17
17
  constructor(e, t) {
18
18
  super(`derivation "${t}" of file ${e} is still generating`), this.fileId = e, this.key = t, this.name = "DerivationPendingError";
19
19
  }
20
20
  };
21
- function d(e, t) {
21
+ function f(e, t) {
22
22
  return {
23
23
  method: "GET",
24
24
  credentials: "omit",
@@ -26,29 +26,29 @@ function d(e, t) {
26
26
  signal: t
27
27
  };
28
28
  }
29
- function f(e) {
29
+ function p(e) {
30
30
  return `${e}${e.includes("?") ? "&" : "?"}disposition=attachment`;
31
31
  }
32
- async function p(n, r) {
33
- let i = await e(), a = await fetch(n, d(i, r));
34
- if (a.status !== 401) return a;
35
- t();
36
- let o = await e();
37
- return fetch(n, d(o, r));
38
- }
39
- async function m(e, t, r) {
40
- if (!n()) throw Error("resolveEmbedFileSrc called outside embed token mode");
41
- let i = await p(l(e, t), r);
42
- if (i.status === 202 && typeof t == "object") throw new u(e, t.derivation);
32
+ async function m(r, i) {
33
+ let a = await e(), o = await fetch(r, f(a, i));
34
+ if (o.status !== 401) return o;
35
+ await n(o), t();
36
+ let s = await e();
37
+ return fetch(r, f(s, i));
38
+ }
39
+ async function h(e, t, n) {
40
+ if (!r()) throw Error("resolveEmbedFileSrc called outside embed token mode");
41
+ let i = await m(u(e, t), n);
42
+ if (i.status === 202 && typeof t == "object") throw new d(e, t.derivation);
43
43
  if (!i.ok) throw Error(`embed file url request failed: ${i.status} ${i.statusText}`);
44
44
  let a = await i.json();
45
- if (!c(a)) throw Error("embed file url response is malformed");
45
+ if (!l(a)) throw Error("embed file url response is malformed");
46
46
  if (!a.proxy) return {
47
47
  url: a.url,
48
48
  kind: "direct"
49
49
  };
50
50
  if (!a.url.startsWith("/api/files/")) throw Error(`embed file proxy: refusing non-files-route URL ${JSON.stringify(a.url)}`);
51
- let o = await p(t === "download" ? f(a.url) : a.url, r);
51
+ let o = await m(t === "download" ? p(a.url) : a.url, n);
52
52
  if (!o.ok) throw Error(`embed file proxy fetch failed: ${o.status} ${o.statusText}`);
53
53
  let s = await o.blob();
54
54
  return {
@@ -58,11 +58,11 @@ async function m(e, t, r) {
58
58
  }
59
59
  //#endregion
60
60
  //#region src/components/file-widgets/helpers.ts
61
- var h = ["thumb_200", "thumb_300"];
62
- function g() {
61
+ var g = ["thumb_200", "thumb_300"];
62
+ function _() {
63
63
  return typeof navigator > "u" ? ["en"] : (navigator.languages?.length ? navigator.languages : [navigator.language]).filter((e) => typeof e == "string" && e.length > 0);
64
64
  }
65
- function _(e, t) {
65
+ function v(e, t) {
66
66
  for (let n of t) {
67
67
  if (e[n]) return e[n];
68
68
  let t = n.split("-")[0];
@@ -70,17 +70,17 @@ function _(e, t) {
70
70
  }
71
71
  for (let t of Object.values(e)) if (typeof t == "string" && t.length > 0) return t;
72
72
  }
73
- function v(e, t, n) {
73
+ function y(e, t, n) {
74
74
  if (t) return t;
75
75
  let r = e?.metadata?.alt_text;
76
76
  if (typeof r == "string" && r.length > 0) return r;
77
77
  if (r && typeof r == "object" && !Array.isArray(r)) {
78
- let e = _(Object.fromEntries(Object.entries(r).filter((e) => e[0].length > 0 && typeof e[1] == "string")), g());
78
+ let e = v(Object.fromEntries(Object.entries(r).filter((e) => e[0].length > 0 && typeof e[1] == "string")), _());
79
79
  if (e) return e;
80
80
  }
81
81
  return n;
82
82
  }
83
- var y = /* @__PURE__ */ new Set([
83
+ var b = /* @__PURE__ */ new Set([
84
84
  "image/png",
85
85
  "image/jpeg",
86
86
  "image/webp",
@@ -88,30 +88,30 @@ var y = /* @__PURE__ */ new Set([
88
88
  "image/avif",
89
89
  "application/pdf"
90
90
  ]);
91
- function b(e) {
91
+ function x(e) {
92
92
  let t = e.content_type?.toLowerCase().split(";")[0]?.trim() ?? "";
93
- return y.has(t);
93
+ return b.has(t);
94
94
  }
95
- function x(e) {
95
+ function S(e) {
96
96
  return e.url ?? e.presigned_url;
97
97
  }
98
- function S(e) {
99
- return e.url ? T(e.url, "attachment") : e.presigned_url;
98
+ function C(e) {
99
+ return e.url ? E(e.url, "attachment") : e.presigned_url;
100
100
  }
101
- function C(e, t) {
101
+ function w(e, t) {
102
102
  if (!e) return;
103
103
  let n = e.derivations ?? {};
104
104
  if (t && n[t]) return n[t];
105
- for (let e of h) if (n[e]) return n[e];
105
+ for (let e of g) if (n[e]) return n[e];
106
106
  return e.url ?? e.presigned_url;
107
107
  }
108
- function w(e, t) {
108
+ function T(e, t) {
109
109
  let n = e?.derivations ?? {};
110
110
  if (t && n[t]) return { derivation: t };
111
- for (let e of h) if (n[e]) return { derivation: e };
111
+ for (let e of g) if (n[e]) return { derivation: e };
112
112
  return "preview";
113
113
  }
114
- function T(e, t) {
114
+ function E(e, t) {
115
115
  try {
116
116
  let n = new URL(e, typeof window < "u" ? window.location.origin : "http://localhost");
117
117
  return n.searchParams.set("disposition", t), /^https?:\/\//i.test(e) ? n.toString() : `${n.pathname}${n.search}${n.hash}`;
@@ -119,7 +119,7 @@ function T(e, t) {
119
119
  return `${e}${e.includes("?") ? "&" : "?"}disposition=${t}`;
120
120
  }
121
121
  }
122
- function E(e) {
122
+ function D(e) {
123
123
  let t = e?.metadata?.focal_point;
124
124
  if (!t || typeof t != "object" || Array.isArray(t)) return null;
125
125
  let n = t, r = typeof n.x == "number" ? n.x : NaN, i = typeof n.y == "number" ? n.y : NaN;
@@ -128,10 +128,10 @@ function E(e) {
128
128
  y: i
129
129
  };
130
130
  }
131
- function D(e) {
131
+ function O(e) {
132
132
  if (e) return `${e.x * 100}% ${e.y * 100}%`;
133
133
  }
134
- function O(e, t) {
134
+ function k(e, t) {
135
135
  return {
136
136
  ...e,
137
137
  metadata: {
@@ -142,69 +142,69 @@ function O(e, t) {
142
142
  }
143
143
  //#endregion
144
144
  //#region src/components/file-widgets/useEmbedFileSrc.ts
145
- function k(e) {
145
+ function A(e) {
146
146
  return typeof e == "object" ? `derivation:${e.derivation}` : e;
147
147
  }
148
- function A(e) {
148
+ function j(e) {
149
149
  return e.startsWith("derivation:") ? { derivation: e.slice(11) } : e === "download" ? "download" : "preview";
150
150
  }
151
- function j(e, t, r) {
152
- let a = k(t), [s, c] = o(() => n() ? void 0 : r);
153
- return i(() => {
154
- n() || c(r);
155
- }, [r]), i(() => {
156
- if (!n()) return;
151
+ function M(e, t, n) {
152
+ let i = A(t), [o, c] = s(() => r() ? void 0 : n);
153
+ return a(() => {
154
+ r() || c(n);
155
+ }, [n]), a(() => {
156
+ if (!r()) return;
157
157
  if (!e) {
158
158
  c(void 0);
159
159
  return;
160
160
  }
161
- let t = null, r = !1, i = new AbortController();
162
- return c(void 0), m(e, A(a), i.signal).then((e) => {
163
- if (r) {
161
+ let t = null, n = !1, a = new AbortController();
162
+ return c(void 0), h(e, j(i), a.signal).then((e) => {
163
+ if (n) {
164
164
  e.kind === "blob" && URL.revokeObjectURL(e.url);
165
165
  return;
166
166
  }
167
167
  e.kind === "blob" && (t = e.url), c(e.url);
168
168
  }).catch((e) => {
169
- if (!r) {
170
- if (e instanceof u) {
169
+ if (!n) {
170
+ if (e instanceof d) {
171
171
  c(void 0);
172
172
  return;
173
173
  }
174
174
  e instanceof DOMException && e.name === "AbortError" || (console.error("[declarion-embed] file src resolution failed:", e), c(void 0));
175
175
  }
176
176
  }), () => {
177
- r = !0, i.abort(), t && URL.revokeObjectURL(t);
177
+ n = !0, a.abort(), t && URL.revokeObjectURL(t);
178
178
  };
179
- }, [e, a]), s;
179
+ }, [e, i]), o;
180
180
  }
181
- function M() {
182
- let e = a([]);
183
- return i(() => () => {
181
+ function N() {
182
+ let e = o([]);
183
+ return a(() => () => {
184
184
  for (let t of e.current) URL.revokeObjectURL(t);
185
185
  e.current = [];
186
- }, []), { open: r((t, r, i) => {
187
- if (!n()) {
186
+ }, []), { open: i((t, n, i) => {
187
+ if (!r()) {
188
188
  i && window.open(i, "_blank", "noopener");
189
189
  return;
190
190
  }
191
- t && m(t, r).then((t) => {
191
+ t && h(t, n).then((t) => {
192
192
  t.kind === "blob" && e.current.push(t.url), window.open(t.url, "_blank", "noopener");
193
193
  }).catch((e) => {
194
- e instanceof u || console.error("[declarion-embed] file open failed:", e);
194
+ e instanceof d || console.error("[declarion-embed] file open failed:", e);
195
195
  });
196
196
  }, []) };
197
197
  }
198
198
  //#endregion
199
199
  //#region src/components/file-widgets/value.ts
200
- function N(e) {
201
- return typeof e == "object" && !!e && typeof e.id == "string";
202
- }
203
200
  function P(e) {
204
- return e ? Array.isArray(e) ? e.find(N) ?? null : N(e) ? e : null : null;
201
+ return typeof e == "object" && !!e && typeof e.id == "string";
205
202
  }
206
203
  function F(e) {
207
- return e ? Array.isArray(e) ? e.filter(N) : N(e) ? [e] : [] : [];
204
+ return e ? Array.isArray(e) ? e.find(P) ?? null : P(e) ? e : null : null;
205
+ }
206
+ function I(e) {
207
+ return e ? Array.isArray(e) ? e.filter(P) : P(e) ? [e] : [] : [];
208
208
  }
209
209
  //#endregion
210
- export { b as a, C as c, E as d, v as f, j as i, w as l, P as n, S as o, O as p, M as r, D as s, F as t, x as u };
210
+ export { x as a, w as c, D as d, y as f, M as i, T as l, F as n, C as o, k as p, N as r, O as s, I as t, S as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@declarion/react",
3
- "version": "0.48.1",
3
+ "version": "0.49.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "React SDK for Declarion, the schema-driven business apps platform.",