@declarion/react 0.39.0 → 0.40.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/{DraggableChildrenTable-DziCVhq6.js → DraggableChildrenTable-Ctmn0liO.js} +27 -27
- package/dist-lib/{Grid-BTX2tkCT.js → Grid-BsIkTp3u.js} +42 -42
- package/dist-lib/{LayoutRenderer-CwMERoPJ.js → LayoutRenderer-D4oTfZhV.js} +562 -562
- package/dist-lib/{MarkdownRenderer-dHOTEhUa.js → MarkdownRenderer-B-2CrtjU.js} +1 -1
- package/dist-lib/{RefreshControl--UAgflh7.js → RefreshControl-VQf34HKZ.js} +201 -201
- package/dist-lib/SmartDetailPage.impl-HMaLVDlV.js +1802 -0
- package/dist-lib/{SmartRecordListPage.impl-CZXzVhPC.js → SmartRecordListPage.impl-Cxm7qvlZ.js} +239 -239
- package/dist-lib/components/shared/ActionButton.d.ts +1 -7
- package/dist-lib/declarion-react.css +1 -1
- package/dist-lib/index.js +1788 -1666
- package/dist-lib/lib/actions.d.ts +27 -0
- package/dist-lib/{registry-DXNFRlbB.js → registry-DFtAh6zc.js} +1798 -2427
- package/dist-lib/testing.js +27 -27
- package/dist-lib/{useCurrentScreen-BA2lb-d7.js → useCurrentScreen-mw8TfE8q.js} +563 -361
- package/dist-lib/{useProperties-Br2DeOQh.js → useProperties-gMdnhdhO.js} +50 -50
- package/dist-lib/{value-C91loRXp.js → value-t9ETvWIJ.js} +4 -4
- package/package.json +1 -1
- package/dist-lib/SmartDetailPage.impl-Bj7MtHxi.js +0 -1827
- package/dist-lib/components/shared/ActionConfirmDialog.d.ts +0 -10
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { s as e } from "./DynamicIcon-DeRpAaXm.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Ct as t, In as n, Jn as r, Kt as i, Mt as a, Tn as o, Yn as s, ar as c, ht as l, i as u, mt as d, or as f, rr as p, sr as m, xt as h } from "./useCurrentScreen-mw8TfE8q.js";
|
|
3
3
|
import { useCallback as g, useEffect as _, useId as v, useMemo as y, useRef as b, useState as x } from "react";
|
|
4
4
|
import { useLocation as S } from "react-router-dom";
|
|
5
5
|
import { useQuery as C, useQueryClient as w } from "@tanstack/react-query";
|
|
6
6
|
import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
7
|
-
import { createPortal as
|
|
8
|
-
import { create as
|
|
7
|
+
import { createPortal as O } from "react-dom";
|
|
8
|
+
import { create as k } from "zustand";
|
|
9
9
|
//#region src/components/primitives/Avatar.tsx
|
|
10
|
-
function
|
|
10
|
+
function A({ name: e, size: t = 22, color: n }) {
|
|
11
11
|
let r = e.split(/\s+/).map((e) => e[0]).slice(0, 2).join("").toUpperCase(), i = e.split("").reduce((e, t) => e + t.charCodeAt(0), 0), a = [
|
|
12
12
|
"#DCE4F6",
|
|
13
13
|
"#E4DCF6",
|
|
@@ -37,24 +37,24 @@ function k({ name: e, size: t = 22, color: n }) {
|
|
|
37
37
|
}
|
|
38
38
|
//#endregion
|
|
39
39
|
//#region src/components/primitives/Tooltip.tsx
|
|
40
|
-
var
|
|
41
|
-
function
|
|
40
|
+
var j = 350, M = 80, N = 260, P = 6, F = 4;
|
|
41
|
+
function I(e, t) {
|
|
42
42
|
let [n, r] = x(!1), [i, a] = x(null), o = b(null), s = b(null), c = b(null), l = v(), u = g(() => {
|
|
43
43
|
s.current && clearTimeout(s.current), c.current && clearTimeout(c.current), s.current = null, c.current = null;
|
|
44
44
|
}, []), d = g(() => {
|
|
45
45
|
let t = e.current;
|
|
46
46
|
if (!t) return;
|
|
47
|
-
let n = t.getBoundingClientRect(), r = o.current, i = r?.offsetWidth ??
|
|
48
|
-
c = Math.max(
|
|
49
|
-
let l = n.top -
|
|
47
|
+
let n = t.getBoundingClientRect(), r = o.current, i = r?.offsetWidth ?? N, s = r?.offsetHeight ?? 0, c = n.left + n.width / 2 - i / 2;
|
|
48
|
+
c = Math.max(F, Math.min(c, window.innerWidth - i - F));
|
|
49
|
+
let l = n.top - P - s < F ? n.bottom + P : n.top - P - s;
|
|
50
50
|
a({
|
|
51
51
|
left: c,
|
|
52
52
|
top: l
|
|
53
53
|
});
|
|
54
54
|
}, [e]), f = g((e) => {
|
|
55
|
-
t && (u(), e ? r(!0) : s.current = setTimeout(() => r(!0),
|
|
55
|
+
t && (u(), e ? r(!0) : s.current = setTimeout(() => r(!0), j));
|
|
56
56
|
}, [u, t]), p = g(() => {
|
|
57
|
-
u(), c.current = setTimeout(() => r(!1),
|
|
57
|
+
u(), c.current = setTimeout(() => r(!1), M);
|
|
58
58
|
}, [u]);
|
|
59
59
|
_(() => {
|
|
60
60
|
if (!n) {
|
|
@@ -72,7 +72,7 @@ function F(e, t) {
|
|
|
72
72
|
left: i?.left ?? 0,
|
|
73
73
|
top: i?.top ?? 0,
|
|
74
74
|
zIndex: 1e3,
|
|
75
|
-
maxWidth:
|
|
75
|
+
maxWidth: N,
|
|
76
76
|
padding: "5px 8px",
|
|
77
77
|
borderRadius: 6,
|
|
78
78
|
background: "var(--surface-inverse, #1f2430)",
|
|
@@ -83,7 +83,7 @@ function F(e, t) {
|
|
|
83
83
|
pointerEvents: "none",
|
|
84
84
|
visibility: i ? "visible" : "hidden",
|
|
85
85
|
whiteSpace: "normal"
|
|
86
|
-
}, h = n && t ?
|
|
86
|
+
}, h = n && t ? O(/* @__PURE__ */ E("div", {
|
|
87
87
|
ref: o,
|
|
88
88
|
id: l,
|
|
89
89
|
role: "tooltip",
|
|
@@ -102,8 +102,8 @@ function F(e, t) {
|
|
|
102
102
|
portal: h
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
let r = b(null), { triggerHandlers: i, describedBy: a, portal: o } =
|
|
105
|
+
function ee({ content: e, children: t, triggerProps: n }) {
|
|
106
|
+
let r = b(null), { triggerHandlers: i, describedBy: a, portal: o } = I(r, e);
|
|
107
107
|
return e ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E("span", {
|
|
108
108
|
...n,
|
|
109
109
|
ref: r,
|
|
@@ -117,8 +117,8 @@ function te({ content: e, children: t, triggerProps: n }) {
|
|
|
117
117
|
children: t
|
|
118
118
|
}), o] }) : /* @__PURE__ */ E(T, { children: t });
|
|
119
119
|
}
|
|
120
|
-
function
|
|
121
|
-
return /* @__PURE__ */ E(
|
|
120
|
+
function te({ label: t, size: n = 14, ...r }) {
|
|
121
|
+
return /* @__PURE__ */ E(ee, {
|
|
122
122
|
content: t,
|
|
123
123
|
children: /* @__PURE__ */ E("span", {
|
|
124
124
|
tabIndex: 0,
|
|
@@ -137,14 +137,14 @@ function ne({ label: t, size: n = 14, ...r }) {
|
|
|
137
137
|
}
|
|
138
138
|
//#endregion
|
|
139
139
|
//#region src/components/primitives/RecordIdBadge.tsx
|
|
140
|
-
var
|
|
141
|
-
function
|
|
142
|
-
let [n, r] = x(!1), i =
|
|
140
|
+
var ne = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, re = 1200;
|
|
141
|
+
function ie({ value: t }) {
|
|
142
|
+
let [n, r] = x(!1), i = ne.test(t) ? `${t.slice(0, 8)}…` : t;
|
|
143
143
|
return /* @__PURE__ */ D("button", {
|
|
144
144
|
type: "button",
|
|
145
145
|
onClick: g(async () => {
|
|
146
146
|
try {
|
|
147
|
-
await navigator.clipboard.writeText(t), r(!0), window.setTimeout(() => r(!1),
|
|
147
|
+
await navigator.clipboard.writeText(t), r(!0), window.setTimeout(() => r(!1), re);
|
|
148
148
|
} catch {}
|
|
149
149
|
}, [t]),
|
|
150
150
|
title: n ? "Copied" : `Copy ${t}`,
|
|
@@ -157,32 +157,32 @@ function ae({ value: t }) {
|
|
|
157
157
|
}
|
|
158
158
|
//#endregion
|
|
159
159
|
//#region src/lib/branding.ts
|
|
160
|
-
var
|
|
161
|
-
function
|
|
160
|
+
var L = "branding";
|
|
161
|
+
function ae(e, t) {
|
|
162
162
|
return e?.parameters.find((e) => e.code === t)?.value;
|
|
163
163
|
}
|
|
164
|
-
function
|
|
165
|
-
return
|
|
164
|
+
function oe(e) {
|
|
165
|
+
return R(ae(e, L));
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
if (
|
|
167
|
+
function R(e) {
|
|
168
|
+
if (z(e)) return e;
|
|
169
169
|
}
|
|
170
|
-
function
|
|
171
|
-
let t =
|
|
172
|
-
return
|
|
170
|
+
function se(e) {
|
|
171
|
+
let t = oe(e)?.identity;
|
|
172
|
+
return z(t) ? t : void 0;
|
|
173
173
|
}
|
|
174
|
-
function
|
|
174
|
+
function z(e) {
|
|
175
175
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
176
176
|
}
|
|
177
|
-
function
|
|
177
|
+
function ce(e) {
|
|
178
178
|
if (!e) return !1;
|
|
179
179
|
let t = e.trim();
|
|
180
180
|
return t ? t.startsWith("/") || t.startsWith("http://") || t.startsWith("https://") || t.startsWith("data:image/") : !1;
|
|
181
181
|
}
|
|
182
182
|
//#endregion
|
|
183
183
|
//#region src/api/params.ts
|
|
184
|
-
async function
|
|
185
|
-
let e = (await
|
|
184
|
+
async function le() {
|
|
185
|
+
let e = (await i("/api/params/public")).data;
|
|
186
186
|
if (Array.isArray(e)) return { parameters: e };
|
|
187
187
|
let t = e ?? {};
|
|
188
188
|
return {
|
|
@@ -192,74 +192,74 @@ async function ue() {
|
|
|
192
192
|
meta: t.meta
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
|
-
async function
|
|
196
|
-
return (await
|
|
195
|
+
async function B(e) {
|
|
196
|
+
return (await i(`/api/params/${encodeURIComponent(e)}`)).data;
|
|
197
197
|
}
|
|
198
|
-
async function
|
|
199
|
-
return (await
|
|
198
|
+
async function ue(e) {
|
|
199
|
+
return (await i(`/api/params${e === "tenant" ? "?resolution=tenant" : ""}`)).data ?? [];
|
|
200
200
|
}
|
|
201
201
|
//#endregion
|
|
202
202
|
//#region src/hooks/useParams.ts
|
|
203
|
-
var
|
|
204
|
-
function
|
|
205
|
-
let
|
|
203
|
+
var V = "$params";
|
|
204
|
+
function de({ carrierEntityCode: e, rowId: n, enabled: r = !0, onWritten: i }) {
|
|
205
|
+
let a = w(), [o, s] = x(null), c = C({
|
|
206
206
|
queryKey: [
|
|
207
207
|
"params-carrier-detail",
|
|
208
208
|
e,
|
|
209
|
-
|
|
209
|
+
n
|
|
210
210
|
],
|
|
211
|
-
queryFn: () =>
|
|
212
|
-
enabled:
|
|
211
|
+
queryFn: () => t(e, n),
|
|
212
|
+
enabled: r && !!n,
|
|
213
213
|
staleTime: 30 * 1e3
|
|
214
|
-
}),
|
|
215
|
-
|
|
214
|
+
}), l = c.data?.data, u = !!l && !("$params" in l), d = y(() => Array.isArray(l?.$params) ? l[V] : [], [l]), f = y(() => new Map(d.map((e) => [e.param_code, e])), [d]), p = g(async (t) => {
|
|
215
|
+
s(null);
|
|
216
216
|
try {
|
|
217
|
-
await
|
|
218
|
-
object_ids: [
|
|
217
|
+
await h(`${e}.__update`, {
|
|
218
|
+
object_ids: [n],
|
|
219
219
|
entity: e,
|
|
220
|
-
fields: { [
|
|
221
|
-
}), await
|
|
220
|
+
fields: { [V]: t }
|
|
221
|
+
}), await a.invalidateQueries({ queryKey: ["params-all"] }), await a.invalidateQueries({ queryKey: [
|
|
222
222
|
"params-carrier-detail",
|
|
223
223
|
e,
|
|
224
|
-
|
|
225
|
-
] }),
|
|
224
|
+
n
|
|
225
|
+
] }), i?.();
|
|
226
226
|
} catch (e) {
|
|
227
|
-
|
|
227
|
+
s(e instanceof Error ? e.message : "Failed to save parameter.");
|
|
228
228
|
}
|
|
229
229
|
}, [
|
|
230
230
|
e,
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
]),
|
|
231
|
+
n,
|
|
232
|
+
a,
|
|
233
|
+
i
|
|
234
|
+
]), m = g((e, t) => {
|
|
235
235
|
let n = d.filter((t) => t.param_code !== e.code);
|
|
236
236
|
return n.push({
|
|
237
237
|
param_code: e.code,
|
|
238
238
|
value: t
|
|
239
|
-
}),
|
|
240
|
-
}, [d,
|
|
239
|
+
}), p(n);
|
|
240
|
+
}, [d, p]), _ = g((e) => p(d.filter((t) => t.param_code !== e.code)), [d, p]), v = g(() => s(null), []);
|
|
241
241
|
return {
|
|
242
242
|
overrides: d,
|
|
243
243
|
overrideByCode: f,
|
|
244
244
|
missingParams: u,
|
|
245
|
-
isLoading:
|
|
246
|
-
error:
|
|
245
|
+
isLoading: c.isLoading,
|
|
246
|
+
error: o,
|
|
247
247
|
clearError: v,
|
|
248
|
-
save:
|
|
248
|
+
save: m,
|
|
249
249
|
reset: _
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function fe(e) {
|
|
253
253
|
return C({
|
|
254
254
|
queryKey: ["params-all", e ?? "full"],
|
|
255
|
-
queryFn: () =>
|
|
255
|
+
queryFn: () => ue(e),
|
|
256
256
|
staleTime: 30 * 1e3
|
|
257
257
|
});
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function pe() {
|
|
260
260
|
return C({
|
|
261
261
|
queryKey: ["params-public"],
|
|
262
|
-
queryFn:
|
|
262
|
+
queryFn: le,
|
|
263
263
|
staleTime: 300 * 1e3
|
|
264
264
|
});
|
|
265
265
|
}
|
|
@@ -267,13 +267,13 @@ function me(e, t = {}) {
|
|
|
267
267
|
let n = t.enabled ?? !0;
|
|
268
268
|
return C({
|
|
269
269
|
queryKey: ["params", e],
|
|
270
|
-
queryFn: () =>
|
|
270
|
+
queryFn: () => B(e),
|
|
271
271
|
enabled: !!e && n,
|
|
272
272
|
staleTime: 60 * 1e3
|
|
273
273
|
});
|
|
274
274
|
}
|
|
275
|
-
function
|
|
276
|
-
let t =
|
|
275
|
+
function he(e) {
|
|
276
|
+
let t = a((e) => e.isAuthenticated), n = pe(), r = me(e, { enabled: t }), i = ge(n.data?.parameters, e);
|
|
277
277
|
if (t && r.data?.found) return {
|
|
278
278
|
value: r.data.value,
|
|
279
279
|
found: !0,
|
|
@@ -281,22 +281,22 @@ function H(e) {
|
|
|
281
281
|
loading: !1,
|
|
282
282
|
error: null
|
|
283
283
|
};
|
|
284
|
-
let
|
|
284
|
+
let o = i !== void 0;
|
|
285
285
|
return {
|
|
286
286
|
value: i?.value,
|
|
287
|
-
found:
|
|
288
|
-
source:
|
|
287
|
+
found: o,
|
|
288
|
+
source: o ? "public" : void 0,
|
|
289
289
|
loading: n.isLoading || t && r.isLoading && !r.data && !r.error,
|
|
290
290
|
error: r.error ?? n.error ?? null
|
|
291
291
|
};
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function ge(e, t) {
|
|
294
294
|
return e?.find((e) => e.code === t);
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function _e(e, t) {
|
|
297
297
|
let n = C({
|
|
298
298
|
queryKey: ["params", e],
|
|
299
|
-
queryFn: () =>
|
|
299
|
+
queryFn: () => B(e),
|
|
300
300
|
enabled: !!e,
|
|
301
301
|
staleTime: 60 * 1e3
|
|
302
302
|
}), r = n.data, i = !!r?.found;
|
|
@@ -310,55 +310,55 @@ function U(e, t) {
|
|
|
310
310
|
}
|
|
311
311
|
//#endregion
|
|
312
312
|
//#region src/hooks/useBranding.ts
|
|
313
|
-
function
|
|
314
|
-
let e =
|
|
313
|
+
function H() {
|
|
314
|
+
let e = he(L);
|
|
315
315
|
return {
|
|
316
|
-
branding:
|
|
316
|
+
branding: R(e.value),
|
|
317
317
|
isLoading: e.loading
|
|
318
318
|
};
|
|
319
319
|
}
|
|
320
|
-
function
|
|
321
|
-
return
|
|
320
|
+
function ve() {
|
|
321
|
+
return H().branding?.identity;
|
|
322
322
|
}
|
|
323
|
-
function
|
|
324
|
-
return
|
|
323
|
+
function U() {
|
|
324
|
+
return H().branding?.chrome;
|
|
325
325
|
}
|
|
326
326
|
//#endregion
|
|
327
327
|
//#region src/stores/page-state.ts
|
|
328
|
-
var
|
|
329
|
-
function
|
|
330
|
-
|
|
328
|
+
var W = 1800 * 1e3, G = null;
|
|
329
|
+
function K(e) {
|
|
330
|
+
G = e;
|
|
331
331
|
}
|
|
332
|
-
function
|
|
333
|
-
if (!(!e || !
|
|
332
|
+
function q(e) {
|
|
333
|
+
if (!(!e || !G)) for (let t of e.queryKeys) G.removeQueries({
|
|
334
334
|
queryKey: t,
|
|
335
335
|
exact: !0
|
|
336
336
|
});
|
|
337
337
|
}
|
|
338
|
-
function
|
|
338
|
+
function J(e, t) {
|
|
339
339
|
let n = e[t];
|
|
340
340
|
if (!n) return e;
|
|
341
|
-
|
|
341
|
+
q(n);
|
|
342
342
|
let r = { ...e };
|
|
343
343
|
return delete r[t], r;
|
|
344
344
|
}
|
|
345
|
-
function
|
|
345
|
+
function Y(e, t) {
|
|
346
346
|
let n = e;
|
|
347
347
|
for (; Object.keys(n).length > 64;) {
|
|
348
348
|
let e = null, r = Infinity;
|
|
349
349
|
for (let [i, a] of Object.entries(n)) i !== t && a.lastActiveAt < r && (r = a.lastActiveAt, e = i);
|
|
350
350
|
if (e === null) break;
|
|
351
|
-
n =
|
|
351
|
+
n = J(n, e);
|
|
352
352
|
}
|
|
353
353
|
return n;
|
|
354
354
|
}
|
|
355
|
-
var
|
|
355
|
+
var X = k((e, t) => ({
|
|
356
356
|
entries: {},
|
|
357
|
-
ttlMs:
|
|
357
|
+
ttlMs: W,
|
|
358
358
|
setTtl: (n) => {
|
|
359
359
|
if (n <= 0) {
|
|
360
360
|
let { entries: r } = t();
|
|
361
|
-
for (let e of Object.keys(r))
|
|
361
|
+
for (let e of Object.keys(r)) q(r[e]);
|
|
362
362
|
e({
|
|
363
363
|
ttlMs: n,
|
|
364
364
|
entries: {}
|
|
@@ -382,7 +382,7 @@ var Z = O((e, t) => ({
|
|
|
382
382
|
lastActiveAt: o,
|
|
383
383
|
queryKeys: []
|
|
384
384
|
};
|
|
385
|
-
e({ entries:
|
|
385
|
+
e({ entries: Y({
|
|
386
386
|
...a.entries,
|
|
387
387
|
[n]: c
|
|
388
388
|
}, n) });
|
|
@@ -406,7 +406,7 @@ var Z = O((e, t) => ({
|
|
|
406
406
|
registerQueryKey: (n, r) => {
|
|
407
407
|
let i = t();
|
|
408
408
|
if (i.ttlMs <= 0) return;
|
|
409
|
-
let a = Date.now(), o = i.entries[n], s = o?.queryKeys.some((e) =>
|
|
409
|
+
let a = Date.now(), o = i.entries[n], s = o?.queryKeys.some((e) => ye(e, r));
|
|
410
410
|
if (o && s) return;
|
|
411
411
|
let c = o ? {
|
|
412
412
|
...o,
|
|
@@ -417,29 +417,29 @@ var Z = O((e, t) => ({
|
|
|
417
417
|
lastActiveAt: a,
|
|
418
418
|
queryKeys: [r]
|
|
419
419
|
};
|
|
420
|
-
e({ entries:
|
|
420
|
+
e({ entries: Y({
|
|
421
421
|
...i.entries,
|
|
422
422
|
[n]: c
|
|
423
423
|
}, n) });
|
|
424
424
|
},
|
|
425
425
|
kill: (n) => {
|
|
426
|
-
let r = t(), i =
|
|
426
|
+
let r = t(), i = J(r.entries, n);
|
|
427
427
|
i !== r.entries && e({ entries: i });
|
|
428
428
|
},
|
|
429
429
|
sweep: (n) => {
|
|
430
430
|
let { ttlMs: r, entries: i } = t(), a = i;
|
|
431
|
-
for (let [e, t] of Object.entries(i)) (r <= 0 || n - t.lastActiveAt > r) && (a =
|
|
431
|
+
for (let [e, t] of Object.entries(i)) (r <= 0 || n - t.lastActiveAt > r) && (a = J(a, e));
|
|
432
432
|
a !== i && e({ entries: a });
|
|
433
433
|
},
|
|
434
434
|
clear: () => {
|
|
435
435
|
let { entries: n } = t();
|
|
436
436
|
if (Object.keys(n).length !== 0) {
|
|
437
|
-
for (let e of Object.keys(n))
|
|
437
|
+
for (let e of Object.keys(n)) q(n[e]);
|
|
438
438
|
e({ entries: {} });
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
}));
|
|
442
|
-
function
|
|
442
|
+
function ye(e, t) {
|
|
443
443
|
if (e === t) return !0;
|
|
444
444
|
try {
|
|
445
445
|
return JSON.stringify(e) === JSON.stringify(t);
|
|
@@ -449,29 +449,29 @@ function ve(e, t) {
|
|
|
449
449
|
}
|
|
450
450
|
//#endregion
|
|
451
451
|
//#region src/lib/canonical-url.ts
|
|
452
|
-
function
|
|
452
|
+
function be(e) {
|
|
453
453
|
return e.length > 1 && e.endsWith("/") ? e.replace(/\/+$/, "") || "/" : e;
|
|
454
454
|
}
|
|
455
|
-
function
|
|
456
|
-
let t =
|
|
457
|
-
for (let e of
|
|
455
|
+
function Z(e) {
|
|
456
|
+
let t = be(e.pathname), n = e.search ?? "", r = n.startsWith("?") ? n.slice(1) : n, i = new URLSearchParams(r);
|
|
457
|
+
for (let e of l) i.delete(e);
|
|
458
458
|
i.sort();
|
|
459
459
|
let a = i.toString();
|
|
460
460
|
return a ? `${t}?${a}` : t;
|
|
461
461
|
}
|
|
462
|
-
function
|
|
463
|
-
return
|
|
462
|
+
function xe(e) {
|
|
463
|
+
return be(e.pathname);
|
|
464
464
|
}
|
|
465
465
|
//#endregion
|
|
466
466
|
//#region src/hooks/usePageStateTtl.ts
|
|
467
|
-
var
|
|
468
|
-
function
|
|
469
|
-
let { value: e } =
|
|
470
|
-
return typeof e != "number" || !Number.isFinite(e) || e < 0 ?
|
|
467
|
+
var Se = "ui_page_state_ttl_ms";
|
|
468
|
+
function Ce() {
|
|
469
|
+
let { value: e } = _e(Se, W);
|
|
470
|
+
return typeof e != "number" || !Number.isFinite(e) || e < 0 ? W : e;
|
|
471
471
|
}
|
|
472
472
|
//#endregion
|
|
473
473
|
//#region src/hooks/usePageStateRuntime.ts
|
|
474
|
-
var
|
|
474
|
+
var we = [
|
|
475
475
|
["entity-data"],
|
|
476
476
|
["entity-count"],
|
|
477
477
|
["entity-item"],
|
|
@@ -479,27 +479,27 @@ var Ce = [
|
|
|
479
479
|
["entity-data-all"],
|
|
480
480
|
["action-data"],
|
|
481
481
|
["action-data-cursor"]
|
|
482
|
-
],
|
|
483
|
-
function
|
|
484
|
-
for (let n of
|
|
485
|
-
}
|
|
486
|
-
function
|
|
487
|
-
let e = w(), t =
|
|
488
|
-
r.current = n, _(() => (
|
|
489
|
-
if (
|
|
482
|
+
], Te = 6e4;
|
|
483
|
+
function Ee(e, t) {
|
|
484
|
+
for (let n of we) e.setQueryDefaults(n, { gcTime: t });
|
|
485
|
+
}
|
|
486
|
+
function De() {
|
|
487
|
+
let e = w(), t = Ce(), n = S(), r = b(n);
|
|
488
|
+
r.current = n, _(() => (K(e), () => K(null)), [e]), _(() => {
|
|
489
|
+
if (X.getState().setTtl(t), Ee(e, t), t <= 0) for (let t of we) e.removeQueries({ queryKey: t });
|
|
490
490
|
}, [e, t]), _(() => {
|
|
491
491
|
if (t <= 0) return;
|
|
492
492
|
let e = setInterval(() => {
|
|
493
|
-
let e =
|
|
494
|
-
e.touch(
|
|
495
|
-
},
|
|
493
|
+
let e = X.getState(), t = r.current;
|
|
494
|
+
e.touch(Z(t)), e.touch(xe(t)), e.sweep(Date.now());
|
|
495
|
+
}, Te);
|
|
496
496
|
return () => clearInterval(e);
|
|
497
497
|
}, [t]);
|
|
498
498
|
}
|
|
499
|
-
function
|
|
500
|
-
let n =
|
|
499
|
+
function Oe(e, t = !0) {
|
|
500
|
+
let n = Z(S());
|
|
501
501
|
_(() => {
|
|
502
|
-
!t || !e ||
|
|
502
|
+
!t || !e || X.getState().registerQueryKey(n, e);
|
|
503
503
|
}, [
|
|
504
504
|
n,
|
|
505
505
|
e ? JSON.stringify(e) : "",
|
|
@@ -508,29 +508,29 @@ function De(e, t = !0) {
|
|
|
508
508
|
}
|
|
509
509
|
//#endregion
|
|
510
510
|
//#region src/lib/record-documents-key.ts
|
|
511
|
-
var
|
|
511
|
+
var ke = "record-documents";
|
|
512
512
|
//#endregion
|
|
513
513
|
//#region src/hooks/useBrandingChrome.ts
|
|
514
|
-
function
|
|
515
|
-
let e =
|
|
516
|
-
return (e.enabled ?
|
|
514
|
+
function Ae() {
|
|
515
|
+
let e = d(), t = U();
|
|
516
|
+
return (e.enabled ? t?.embed?.viewport : t?.full?.viewport) ?? "auto";
|
|
517
517
|
}
|
|
518
|
-
function
|
|
519
|
-
let
|
|
518
|
+
function je(e) {
|
|
519
|
+
let t = d(), n = U();
|
|
520
520
|
return y(() => {
|
|
521
|
-
let
|
|
521
|
+
let r = { ...t.enabled ? n?.embed?.surfaces?.[e] : n?.full?.surfaces?.[e] };
|
|
522
522
|
return {
|
|
523
|
-
...
|
|
524
|
-
isVisible: (e) =>
|
|
523
|
+
...r,
|
|
524
|
+
isVisible: (e) => r[e] !== !1
|
|
525
525
|
};
|
|
526
526
|
}, [
|
|
527
|
-
|
|
528
|
-
|
|
527
|
+
n,
|
|
528
|
+
t.enabled,
|
|
529
529
|
e
|
|
530
530
|
]);
|
|
531
531
|
}
|
|
532
|
-
function
|
|
533
|
-
let e =
|
|
532
|
+
function Me() {
|
|
533
|
+
let e = U();
|
|
534
534
|
return y(() => {
|
|
535
535
|
let t = { ...e?.full?.shell };
|
|
536
536
|
return {
|
|
@@ -541,54 +541,54 @@ function je() {
|
|
|
541
541
|
}
|
|
542
542
|
//#endregion
|
|
543
543
|
//#region src/components/pages/exportRequest.ts
|
|
544
|
-
var
|
|
545
|
-
function
|
|
544
|
+
var Ne = /* @__PURE__ */ new Set(["_select", "_actions"]);
|
|
545
|
+
function Pe(e) {
|
|
546
546
|
let t = {};
|
|
547
547
|
return e.screenCode && (t.screen = e.screenCode), e.jsonFilters && e.jsonFilters.length > 0 && (t.filters = e.jsonFilters), e.search && (t.search = e.search), e.sort && (t.sort = e.sort), e.includeDeleted && (t.include_deleted = !0), e.page && (t.page = e.page), e.perPage && (t.per_page = e.perPage), t;
|
|
548
548
|
}
|
|
549
|
-
function
|
|
550
|
-
let n = t.visibleColumns.filter((e) => !
|
|
549
|
+
function Fe(e, t) {
|
|
550
|
+
let n = t.visibleColumns.filter((e) => !Ne.has(e)), r = {
|
|
551
551
|
format: "csv",
|
|
552
552
|
scope: t.scope,
|
|
553
|
-
query:
|
|
553
|
+
query: Pe(e),
|
|
554
554
|
columns: n
|
|
555
555
|
};
|
|
556
556
|
return t.scope === "selected_rows" && t.selectedRowPKs && t.selectedRowPKs.length > 0 && (r.selection = t.selectedRowPKs), t.locale && (r.locale = t.locale), t.filename && (r.filename = t.filename), r;
|
|
557
557
|
}
|
|
558
558
|
//#endregion
|
|
559
559
|
//#region src/components/pages/DocumentsMenu.tsx
|
|
560
|
-
var
|
|
561
|
-
function
|
|
562
|
-
let { run:
|
|
563
|
-
queryKey: [
|
|
564
|
-
queryFn: async () => (await
|
|
560
|
+
var Ie = "document-templates-available";
|
|
561
|
+
function Le({ entityCode: t, scope: n, objectIds: r = [], viewState: i, selectedIds: a = [], capability: c, canManageTemplates: l = !1 }) {
|
|
562
|
+
let { run: d } = u(), f = b(null), [g, _] = x(!1), v = n === "detail" ? !!c?.generate_one : !!c?.generate_many, S = l && !v, { data: w, isLoading: O, error: k } = C({
|
|
563
|
+
queryKey: [Ie, t],
|
|
564
|
+
queryFn: async () => (await h("document.templates.available", { entity: t })).result?.templates ?? [],
|
|
565
565
|
enabled: g || S,
|
|
566
566
|
staleTime: 6e4
|
|
567
|
-
}),
|
|
568
|
-
function
|
|
567
|
+
}), A = O, j = y(() => (w ?? []).filter((e) => n === "detail" ? e.input_mode === "one" || e.input_mode === "global" : e.input_mode === "many" || e.input_mode === "global"), [n, w]), M = S && j.length > 0, N = v || M;
|
|
568
|
+
function P() {
|
|
569
569
|
_((e) => !e);
|
|
570
570
|
}
|
|
571
|
-
function
|
|
571
|
+
function F(e) {
|
|
572
572
|
if (e.input_mode === "global") return [{ kind: "global" }];
|
|
573
|
-
if (n === "detail") return e.input_mode === "one" &&
|
|
573
|
+
if (n === "detail") return e.input_mode === "one" && r.length === 1 ? [{
|
|
574
574
|
kind: "one",
|
|
575
|
-
objectIds:
|
|
575
|
+
objectIds: r
|
|
576
576
|
}] : [];
|
|
577
577
|
if (e.input_mode === "many") {
|
|
578
578
|
let e = [];
|
|
579
|
-
return
|
|
579
|
+
return i && e.push({
|
|
580
580
|
kind: "current_view",
|
|
581
|
-
query:
|
|
582
|
-
}),
|
|
581
|
+
query: Pe(i)
|
|
582
|
+
}), a.length > 0 && e.push({
|
|
583
583
|
kind: "selected",
|
|
584
|
-
objectIds:
|
|
584
|
+
objectIds: a
|
|
585
585
|
}), e;
|
|
586
586
|
}
|
|
587
587
|
return [];
|
|
588
588
|
}
|
|
589
|
-
function
|
|
590
|
-
let r =
|
|
591
|
-
_(!1),
|
|
589
|
+
function I(e, t, n) {
|
|
590
|
+
let r = Re(e), i = o(e.name) || e.code;
|
|
591
|
+
_(!1), d({
|
|
592
592
|
action: r,
|
|
593
593
|
title: i,
|
|
594
594
|
execute: (r) => {
|
|
@@ -600,53 +600,53 @@ function Ie({ entityCode: t, scope: n, objectIds: a = [], viewState: s, selected
|
|
|
600
600
|
return Object.keys(r).length > 0 && (i.params = r), "objectIds" in t && (i.object_ids = t.objectIds), "query" in t && (i.query = {
|
|
601
601
|
scope: "current_view",
|
|
602
602
|
query: t.query
|
|
603
|
-
}),
|
|
603
|
+
}), h("document.generate", i);
|
|
604
604
|
}
|
|
605
605
|
});
|
|
606
606
|
}
|
|
607
|
-
return
|
|
608
|
-
ref:
|
|
607
|
+
return N ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(m, {
|
|
608
|
+
ref: f,
|
|
609
609
|
kind: "ghost",
|
|
610
610
|
size: "sm",
|
|
611
|
-
icon: E(
|
|
612
|
-
onClick:
|
|
613
|
-
disabled:
|
|
611
|
+
icon: E(A ? e.loader : e.filePlus, { size: 12 }),
|
|
612
|
+
onClick: P,
|
|
613
|
+
disabled: A,
|
|
614
614
|
children: "Generate"
|
|
615
|
-
}), /* @__PURE__ */ D(
|
|
615
|
+
}), /* @__PURE__ */ D(p, {
|
|
616
616
|
open: g,
|
|
617
|
-
anchor:
|
|
617
|
+
anchor: f.current,
|
|
618
618
|
onClose: () => _(!1),
|
|
619
619
|
align: "end",
|
|
620
620
|
width: 300,
|
|
621
621
|
children: [
|
|
622
|
-
|
|
622
|
+
A && /* @__PURE__ */ E(s, {
|
|
623
623
|
disabled: !0,
|
|
624
624
|
icon: /* @__PURE__ */ E(e.loader, { size: 12 }),
|
|
625
625
|
children: "Loading templates..."
|
|
626
626
|
}),
|
|
627
|
-
|
|
627
|
+
k && /* @__PURE__ */ E(s, {
|
|
628
628
|
disabled: !0,
|
|
629
629
|
icon: /* @__PURE__ */ E(e.warning, { size: 12 }),
|
|
630
|
-
children:
|
|
630
|
+
children: k instanceof Error ? k.message : String(k)
|
|
631
631
|
}),
|
|
632
|
-
!
|
|
632
|
+
!A && !k && j.length === 0 && /* @__PURE__ */ E(s, {
|
|
633
633
|
disabled: !0,
|
|
634
634
|
icon: /* @__PURE__ */ E(e.file, { size: 12 }),
|
|
635
635
|
children: "No document templates"
|
|
636
636
|
}),
|
|
637
|
-
!
|
|
638
|
-
let n =
|
|
639
|
-
return n.length === 0 ? null :
|
|
637
|
+
!A && !k && j.map((t) => {
|
|
638
|
+
let n = F(t);
|
|
639
|
+
return n.length === 0 ? null : ze(t).flatMap((r) => n.map((n) => r.available ? /* @__PURE__ */ E(s, {
|
|
640
640
|
icon: /* @__PURE__ */ E(e.file, { size: 12 }),
|
|
641
|
-
onClick: () =>
|
|
642
|
-
title:
|
|
643
|
-
children:
|
|
644
|
-
}, `${t.source}:${t.code}:${n.kind}:${r.format}`) : /* @__PURE__ */ D(
|
|
641
|
+
onClick: () => I(t, n, r.format),
|
|
642
|
+
title: o(t.description),
|
|
643
|
+
children: Be(t, n, r.format)
|
|
644
|
+
}, `${t.source}:${t.code}:${n.kind}:${r.format}`) : /* @__PURE__ */ D(s, {
|
|
645
645
|
disabled: !0,
|
|
646
646
|
icon: /* @__PURE__ */ E(e.file, { size: 12 }),
|
|
647
647
|
title: r.disabled_reason,
|
|
648
648
|
children: [
|
|
649
|
-
|
|
649
|
+
Be(t, n, r.format),
|
|
650
650
|
" - ",
|
|
651
651
|
r.disabled_reason || "Unavailable"
|
|
652
652
|
]
|
|
@@ -655,8 +655,8 @@ function Ie({ entityCode: t, scope: n, objectIds: a = [], viewState: s, selected
|
|
|
655
655
|
]
|
|
656
656
|
})] }) : null;
|
|
657
657
|
}
|
|
658
|
-
function
|
|
659
|
-
let t = new
|
|
658
|
+
function Re(e) {
|
|
659
|
+
let t = new n((e.params ?? []).map((e) => ({
|
|
660
660
|
...e,
|
|
661
661
|
name: e.name ?? ""
|
|
662
662
|
})));
|
|
@@ -670,14 +670,14 @@ function Le(e) {
|
|
|
670
670
|
resolved_params: t
|
|
671
671
|
};
|
|
672
672
|
}
|
|
673
|
-
function
|
|
673
|
+
function ze(e) {
|
|
674
674
|
return e.outputs && e.outputs.length > 0 ? e.outputs : (e.allowed_outputs && e.allowed_outputs.length > 0 ? e.allowed_outputs : [e.output_format || "xlsx"]).map((e) => ({
|
|
675
675
|
format: e,
|
|
676
676
|
available: !0
|
|
677
677
|
}));
|
|
678
678
|
}
|
|
679
|
-
function
|
|
680
|
-
let r =
|
|
679
|
+
function Be(e, t, n) {
|
|
680
|
+
let r = o(e.name) || e.code, i = n ? ` (${n.toUpperCase()})` : "";
|
|
681
681
|
switch (t.kind) {
|
|
682
682
|
case "one": return `${r}${i}`;
|
|
683
683
|
case "selected": return `${r}${i} - selected rows`;
|
|
@@ -687,12 +687,12 @@ function ze(e, t, n) {
|
|
|
687
687
|
}
|
|
688
688
|
//#endregion
|
|
689
689
|
//#region src/lib/document-templates.ts
|
|
690
|
-
function
|
|
690
|
+
function Ve(e) {
|
|
691
691
|
return !!e?.entities?.document_template;
|
|
692
692
|
}
|
|
693
693
|
//#endregion
|
|
694
694
|
//#region src/lib/scroll-restoration.ts
|
|
695
|
-
var
|
|
695
|
+
var Q = "scroll", He = 120, Ue = 24, We = 600;
|
|
696
696
|
function Ge(e, t) {
|
|
697
697
|
return Number.isFinite(e) ? Math.max(0, Math.min(e, Number.isFinite(t) && t > 0 ? t : 0)) : 0;
|
|
698
698
|
}
|
|
@@ -723,10 +723,10 @@ function qe(e, t, n, r) {
|
|
|
723
723
|
}
|
|
724
724
|
return Ge(e.offset, r);
|
|
725
725
|
}
|
|
726
|
-
function Je(e =
|
|
726
|
+
function Je(e = Q) {
|
|
727
727
|
let t = S(), n = b(null);
|
|
728
728
|
if (n.current === null) {
|
|
729
|
-
let r =
|
|
729
|
+
let r = Z(t), i = X.getState().read(r, e);
|
|
730
730
|
n.current = i && Number.isFinite(i.offset) ? Math.max(0, i.offset) : 0;
|
|
731
731
|
}
|
|
732
732
|
return n.current;
|
|
@@ -749,7 +749,7 @@ function Ye(e) {
|
|
|
749
749
|
};
|
|
750
750
|
}
|
|
751
751
|
function Xe(e) {
|
|
752
|
-
let { virtualizer: t, scrollElementRef: n, rowKeys: r } = e, i = e.stateKey ?? "scroll", a = e.enabled ?? !0, o =
|
|
752
|
+
let { virtualizer: t, scrollElementRef: n, rowKeys: r } = e, i = e.stateKey ?? "scroll", a = e.enabled ?? !0, o = Z(S()), s = b(t);
|
|
753
753
|
s.current = t;
|
|
754
754
|
let c = b(r);
|
|
755
755
|
c.current = r;
|
|
@@ -760,7 +760,7 @@ function Xe(e) {
|
|
|
760
760
|
if (!a) return;
|
|
761
761
|
let e = s.current;
|
|
762
762
|
if (!e || r.length === 0) return;
|
|
763
|
-
let t =
|
|
763
|
+
let t = X.getState().read(o, i), n = l.current !== o;
|
|
764
764
|
if (l.current = o, !t) {
|
|
765
765
|
n && e.scrollToOffset(0, {
|
|
766
766
|
align: "start",
|
|
@@ -798,7 +798,7 @@ function Ze(e, t, n, r, i) {
|
|
|
798
798
|
if (!t) return;
|
|
799
799
|
let i = 0, o = We, s = null, c = null, l = (e) => {
|
|
800
800
|
let t = a.current(e);
|
|
801
|
-
t &&
|
|
801
|
+
t && X.getState().set(n, r, t);
|
|
802
802
|
}, u = () => c?.trigger(), d = () => {
|
|
803
803
|
let t = e.current;
|
|
804
804
|
if (!t) {
|
|
@@ -818,7 +818,7 @@ function Ze(e, t, n, r, i) {
|
|
|
818
818
|
]);
|
|
819
819
|
}
|
|
820
820
|
function Qe(e) {
|
|
821
|
-
let { scrollElementRef: t } = e, n = e.stateKey ?? "scroll", r = e.enabled ?? !0, i =
|
|
821
|
+
let { scrollElementRef: t } = e, n = e.stateKey ?? "scroll", r = e.enabled ?? !0, i = Z(S()), a = b(null);
|
|
822
822
|
_(() => {
|
|
823
823
|
if (!r || a.current === i) return;
|
|
824
824
|
let e = 0, o = We, s = () => {
|
|
@@ -828,7 +828,7 @@ function Qe(e) {
|
|
|
828
828
|
return;
|
|
829
829
|
}
|
|
830
830
|
a.current = i;
|
|
831
|
-
let c =
|
|
831
|
+
let c = X.getState().read(i, n);
|
|
832
832
|
c && (r.scrollTop = Number.isFinite(c.offset) ? Math.max(0, c.offset) : 0);
|
|
833
833
|
};
|
|
834
834
|
return s(), () => {
|
|
@@ -883,28 +883,28 @@ function at(e) {
|
|
|
883
883
|
}
|
|
884
884
|
//#endregion
|
|
885
885
|
//#region src/components/shared/RefreshControl.tsx
|
|
886
|
-
function ot({ liveObject: t, realtime:
|
|
886
|
+
function ot({ liveObject: t, realtime: n = !0 }) {
|
|
887
887
|
return /* @__PURE__ */ D("span", {
|
|
888
888
|
style: {
|
|
889
889
|
display: "inline-flex",
|
|
890
890
|
alignItems: "center",
|
|
891
891
|
gap: 8
|
|
892
892
|
},
|
|
893
|
-
children: [/* @__PURE__ */ E(
|
|
893
|
+
children: [/* @__PURE__ */ E(f, {
|
|
894
894
|
icon: t.isFetching ? /* @__PURE__ */ E("span", {
|
|
895
895
|
"data-testid": "refresh-spinner",
|
|
896
896
|
style: { display: "inline-flex" },
|
|
897
|
-
children: /* @__PURE__ */ E(
|
|
897
|
+
children: /* @__PURE__ */ E(r, { size: 14 })
|
|
898
898
|
}) : /* @__PURE__ */ E(e.refresh, { size: 14 }),
|
|
899
899
|
title: "Refresh",
|
|
900
900
|
disabled: t.isLoading || t.isFetching,
|
|
901
901
|
onClick: () => {
|
|
902
902
|
t.refetch();
|
|
903
903
|
}
|
|
904
|
-
}),
|
|
904
|
+
}), n && /* @__PURE__ */ E("span", {
|
|
905
905
|
"data-testid": "live-indicator",
|
|
906
906
|
title: t.isLive ? "This view updates automatically in realtime." : "Realtime updates are paused. Refresh manually to load the latest data.",
|
|
907
|
-
children: /* @__PURE__ */ E(
|
|
907
|
+
children: /* @__PURE__ */ E(c, {
|
|
908
908
|
tone: t.isLive ? "emerald" : "amber",
|
|
909
909
|
size: "xs",
|
|
910
910
|
dot: !0,
|
|
@@ -914,4 +914,4 @@ function ot({ liveObject: t, realtime: r = !0 }) {
|
|
|
914
914
|
});
|
|
915
915
|
}
|
|
916
916
|
//#endregion
|
|
917
|
-
export {
|
|
917
|
+
export { de as A, I as B, xe as C, H as D, X as E, se as F, ce as I, ie as L, _e as M, pe as N, ve as O, me as P, te as R, Ce as S, W as T, A as V, ke as _, $e as a, Oe as b, Qe as c, Ve as d, Le as f, Ae as g, Me as h, tt as i, he as j, fe as k, Je as l, je as m, it as n, et as o, Fe as p, at as r, Q as s, ot as t, Xe as u, Ee as v, Z as w, Se as x, De as y, ee as z };
|