@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.
- package/dist-lib/Check-DAfMbQIw.js +38 -0
- package/dist-lib/{DraggableChildrenTable-p2ZSdwzj.js → DraggableChildrenTable-B98Md-Yq.js} +30 -30
- package/dist-lib/{Grid-CjLFAKMZ.js → Grid-BdtEd4R9.js} +2 -2
- package/dist-lib/{LayoutRenderer-DCscqXsv.js → LayoutRenderer-oVU3nEb5.js} +600 -597
- package/dist-lib/ListCardsBody-DYMt1H8l.js +287 -0
- package/dist-lib/{MarkdownRenderer-Sb7zcvj0.js → MarkdownRenderer-E9hbyoUn.js} +1 -1
- package/dist-lib/RefreshControl-B_2eW53M.js +430 -0
- package/dist-lib/{SmartDetailPage.impl-BAW-Tx_H.js → SmartDetailPage.impl-Dg22HOxb.js} +520 -515
- package/dist-lib/SmartListPage.impl-CPhhXT5S.js +2849 -0
- package/dist-lib/{SmartRecordListPage.impl-DtSSlGrI.js → SmartRecordListPage.impl-CF0UKgUj.js} +243 -240
- package/dist-lib/SortHeaderMenu-DodGvb7A.js +106 -0
- package/dist-lib/action-dispatch-CYOw7nkP.js +1984 -0
- package/dist-lib/api/batch.d.ts +5 -2
- package/dist-lib/api/data.d.ts +35 -4
- package/dist-lib/api/entities.d.ts +3 -3
- package/dist-lib/cardProjection-D-AufCh-.js +757 -0
- package/dist-lib/components/{shared → actions}/ObjectActionBar.d.ts +1 -1
- package/dist-lib/components/{shared → actions}/ResponsiveActionBar.d.ts +1 -1
- package/dist-lib/components/fields/cells/factories/date.d.ts +2 -0
- package/dist-lib/components/file-widgets/upload.d.ts +6 -1
- package/dist-lib/components/layout/Layout.d.ts +1 -1
- package/dist-lib/components/layout/TopBar.d.ts +1 -1
- package/dist-lib/components/pages/SmartListPage.d.ts +2 -12
- package/dist-lib/components/pages/SmartListPage.impl.d.ts +4 -0
- package/dist-lib/components/pages/list/ListCardRow.d.ts +40 -0
- package/dist-lib/components/pages/list/ListCardsBody.d.ts +34 -0
- package/dist-lib/components/pages/list/ListFloatbar.d.ts +1 -1
- package/dist-lib/components/pages/list/ListFooter.d.ts +26 -0
- package/dist-lib/components/pages/list/ListHeader.d.ts +1 -1
- package/dist-lib/components/pages/list/ListNoRows.d.ts +32 -0
- package/dist-lib/components/pages/list/ListTable.d.ts +34 -0
- package/dist-lib/components/pages/list/ListTableRow.d.ts +18 -0
- package/dist-lib/components/pages/list/ListToolbar.d.ts +43 -0
- package/dist-lib/components/pages/list/SortHeaderMenu.d.ts +14 -0
- package/dist-lib/components/pages/list/page-size.d.ts +3 -0
- package/dist-lib/components/pages/list/sortable-header.d.ts +2 -0
- package/dist-lib/components/pages/list/useListColumnLayout.d.ts +37 -0
- package/dist-lib/components/pages/list/useListQuery.d.ts +66 -0
- package/dist-lib/components/pages/list/useListRowInteraction.d.ts +61 -0
- package/dist-lib/components/pages/list/useListSelection.d.ts +31 -0
- package/dist-lib/components/pages/list/useListSort.d.ts +45 -0
- package/dist-lib/components/pages/list/useListViews.d.ts +46 -0
- package/dist-lib/components/pages/list/useRowMenu.d.ts +1 -1
- package/dist-lib/components/shared/RefreshControl.d.ts +17 -4
- package/dist-lib/field-classification-DTgUnbzd.js +1134 -0
- package/dist-lib/format-count-DAHCcHZO.js +1551 -0
- package/dist-lib/hooks/useBrandingChrome.d.ts +17 -1
- package/dist-lib/hooks/useText.d.ts +3 -0
- package/dist-lib/hooks/useViews.d.ts +1 -1
- package/dist-lib/index.d.ts +17 -15
- package/dist-lib/index.js +1783 -6287
- package/dist-lib/lib/messages.d.ts +7 -1
- package/dist-lib/lib/rowClickGesture.d.ts +12 -0
- package/dist-lib/lib/timestamp.d.ts +8 -3
- package/dist-lib/peekDraftStore-CnxqkoWN.js +194 -0
- package/dist-lib/record-documents-key-DEFlLxnF.js +27 -0
- package/dist-lib/registry-WypUQQ7t.js +1768 -0
- package/dist-lib/testing.d.ts +17 -2
- package/dist-lib/testing.js +72 -58
- package/dist-lib/types/api.d.ts +54 -12
- package/dist-lib/types/schema.d.ts +22 -6
- package/dist-lib/{useCurrentScreen-BshVTPVq.js → useCurrentScreen-C5Oio-1G.js} +1125 -1068
- package/dist-lib/useListQuery-Dc2vbxqs.js +87 -0
- package/dist-lib/useProperties-C36ENFdY.js +81 -0
- package/dist-lib/{useProperties-DrHFr0A1.js → useTabSearchMirror-sIuYEFaq.js} +116 -194
- package/dist-lib/{value-B1O6QikE.js → value-igT4LsqW.js} +69 -69
- package/package.json +1 -1
- package/dist-lib/RefreshControl-Cnl9nE0x.js +0 -945
- package/dist-lib/registry-CCxnZW2b.js +0 -5281
- /package/dist-lib/components/{shared → actions}/ActionButton.d.ts +0 -0
- /package/dist-lib/components/{shared → actions}/ActionDialog.d.ts +0 -0
- /package/dist-lib/components/{shared → actions}/ActionResultDialog.d.ts +0 -0
- /package/dist-lib/components/{shared → actions}/ActionRunner.d.ts +0 -0
- /package/dist-lib/components/{mass-edit → actions}/PropertyGridEditor.d.ts +0 -0
- /package/dist-lib/components/{shared → actions}/RowActionsKebab.d.ts +0 -0
- /package/dist-lib/components/{shared → chrome}/AssociationTabs.d.ts +0 -0
- /package/dist-lib/components/{shared → chrome}/AuditMetaStrip.d.ts +0 -0
- /package/dist-lib/components/{shared → chrome}/Breadcrumbs.d.ts +0 -0
- /package/dist-lib/components/{shared → chrome}/HighlightsStrip.d.ts +0 -0
- /package/dist-lib/components/{shared → chrome}/PageHeader.d.ts +0 -0
- /package/dist-lib/components/{shared → chrome}/RecordHeader.d.ts +0 -0
- /package/dist-lib/components/{shell → layout}/CommandPalette.d.ts +0 -0
- /package/dist-lib/components/{columns → list}/ColumnPicker.d.ts +0 -0
- /package/dist-lib/components/{views → list}/ViewSwitcher.d.ts +0 -0
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { $t as e, en as t,
|
|
2
|
-
import { useCallback as
|
|
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
|
|
5
|
-
function
|
|
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
|
|
10
|
+
function u(e, t) {
|
|
11
11
|
let n = encodeURIComponent(e);
|
|
12
|
-
return typeof t == "object" ? `${
|
|
12
|
+
return typeof t == "object" ? `${c}/${n}/derived/${encodeURIComponent(t.derivation)}/url` : `${c}/${n}/url`;
|
|
13
13
|
}
|
|
14
|
-
var
|
|
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
|
|
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
|
|
29
|
+
function p(e) {
|
|
30
30
|
return `${e}${e.includes("?") ? "&" : "?"}disposition=attachment`;
|
|
31
31
|
}
|
|
32
|
-
async function
|
|
33
|
-
let
|
|
34
|
-
if (
|
|
35
|
-
t();
|
|
36
|
-
let
|
|
37
|
-
return fetch(
|
|
38
|
-
}
|
|
39
|
-
async function
|
|
40
|
-
if (!
|
|
41
|
-
let i = await
|
|
42
|
-
if (i.status === 202 && typeof t == "object") throw new
|
|
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 (!
|
|
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
|
|
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
|
|
62
|
-
function
|
|
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
|
|
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
|
|
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 =
|
|
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
|
|
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
|
|
91
|
+
function x(e) {
|
|
92
92
|
let t = e.content_type?.toLowerCase().split(";")[0]?.trim() ?? "";
|
|
93
|
-
return
|
|
93
|
+
return b.has(t);
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function S(e) {
|
|
96
96
|
return e.url ?? e.presigned_url;
|
|
97
97
|
}
|
|
98
|
-
function
|
|
99
|
-
return e.url ?
|
|
98
|
+
function C(e) {
|
|
99
|
+
return e.url ? E(e.url, "attachment") : e.presigned_url;
|
|
100
100
|
}
|
|
101
|
-
function
|
|
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
|
|
105
|
+
for (let e of g) if (n[e]) return n[e];
|
|
106
106
|
return e.url ?? e.presigned_url;
|
|
107
107
|
}
|
|
108
|
-
function
|
|
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
|
|
111
|
+
for (let e of g) if (n[e]) return { derivation: e };
|
|
112
112
|
return "preview";
|
|
113
113
|
}
|
|
114
|
-
function
|
|
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
|
|
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
|
|
131
|
+
function O(e) {
|
|
132
132
|
if (e) return `${e.x * 100}% ${e.y * 100}%`;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
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
|
|
145
|
+
function A(e) {
|
|
146
146
|
return typeof e == "object" ? `derivation:${e.derivation}` : e;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function j(e) {
|
|
149
149
|
return e.startsWith("derivation:") ? { derivation: e.slice(11) } : e === "download" ? "download" : "preview";
|
|
150
150
|
}
|
|
151
|
-
function
|
|
152
|
-
let
|
|
153
|
-
return
|
|
154
|
-
|
|
155
|
-
}, [
|
|
156
|
-
if (!
|
|
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,
|
|
162
|
-
return c(void 0),
|
|
163
|
-
if (
|
|
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 (!
|
|
170
|
-
if (e instanceof
|
|
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
|
-
|
|
177
|
+
n = !0, a.abort(), t && URL.revokeObjectURL(t);
|
|
178
178
|
};
|
|
179
|
-
}, [e,
|
|
179
|
+
}, [e, i]), o;
|
|
180
180
|
}
|
|
181
|
-
function
|
|
182
|
-
let e =
|
|
183
|
-
return
|
|
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:
|
|
187
|
-
if (!
|
|
186
|
+
}, []), { open: i((t, n, i) => {
|
|
187
|
+
if (!r()) {
|
|
188
188
|
i && window.open(i, "_blank", "noopener");
|
|
189
189
|
return;
|
|
190
190
|
}
|
|
191
|
-
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
|
|
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
|
|
201
|
+
return typeof e == "object" && !!e && typeof e.id == "string";
|
|
205
202
|
}
|
|
206
203
|
function F(e) {
|
|
207
|
-
return e ? Array.isArray(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 {
|
|
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 };
|