@declarion/react 0.36.3 → 0.36.5
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-ChUh120M.js → DraggableChildrenTable-BfErdVdt.js} +35 -35
- package/dist-lib/{Grid-DT9wV-D7.js → Grid-D0ckegd1.js} +41 -41
- package/dist-lib/{LayoutRenderer-0UKE3pp6.js → LayoutRenderer-BGeN0rwC.js} +465 -465
- package/dist-lib/{MarkdownRenderer-CvURrJCu.js → MarkdownRenderer-14LG1clY.js} +1 -1
- package/dist-lib/{RefreshControl-CX_D6PcA.js → RefreshControl-Bpd9kw0G.js} +45 -45
- package/dist-lib/{SmartDetailPage.impl-Ccz4TqfJ.js → SmartDetailPage.impl-BaXAi7OH.js} +234 -234
- package/dist-lib/{SmartRecordListPage.impl-Y0w4oIe3.js → SmartRecordListPage.impl-CgiZWbF3.js} +189 -189
- package/dist-lib/index.d.ts +1 -1
- package/dist-lib/index.js +1510 -1526
- package/dist-lib/{registry-D_zbJrLC.js → registry-KMbQkTF6.js} +1036 -1034
- package/dist-lib/testing.d.ts +8 -0
- package/dist-lib/testing.js +63 -60
- package/dist-lib/{ActionRunner-BrXXs8ga.js → useCurrentScreen-Bgp6_vne.js} +18 -2
- package/dist-lib/{useProperties-C_1KM72K.js → useProperties-DMT162ot.js} +68 -68
- package/dist-lib/{value-BBnVc95O.js → value-CUVtVjKI.js} +22 -22
- package/package.json +1 -1
package/dist-lib/testing.d.ts
CHANGED
|
@@ -33,6 +33,14 @@ export interface RenderWithDeclarionOptions {
|
|
|
33
33
|
actionResults?: Record<string, ActionResult>;
|
|
34
34
|
/** Initial path for the memory router (e.g. "/replay/abc/compare"). Default "/". */
|
|
35
35
|
route?: string;
|
|
36
|
+
/**
|
|
37
|
+
* The screen code the rendered component is standing in for, as the router would
|
|
38
|
+
* mount it. Custom screens read their own declaration through `useCurrentScreen()` -
|
|
39
|
+
* `<PageHeader />` takes its title and description from it - so a harness that does
|
|
40
|
+
* not supply it renders a screen with no name, which is not what production does.
|
|
41
|
+
* Pass the same code the schema declares.
|
|
42
|
+
*/
|
|
43
|
+
screenCode?: string;
|
|
36
44
|
/** Optional responsive viewport seam for component tests that assert phone/tablet behavior. */
|
|
37
45
|
viewport?: ResponsiveViewport;
|
|
38
46
|
}
|
package/dist-lib/testing.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useState as
|
|
3
|
-
import { MemoryRouter as
|
|
4
|
-
import { QueryClient as
|
|
5
|
-
import { Toaster as
|
|
6
|
-
import { jsx as
|
|
7
|
-
import { render as
|
|
1
|
+
import { Ln as e, _t as t, at as n, ft as r, mt as i, pt as a, r as o, t as s } from "./useCurrentScreen-Bgp6_vne.js";
|
|
2
|
+
import { useState as c } from "react";
|
|
3
|
+
import { MemoryRouter as l } from "react-router-dom";
|
|
4
|
+
import { QueryClient as u, QueryClientProvider as d } from "@tanstack/react-query";
|
|
5
|
+
import { Toaster as f } from "sonner";
|
|
6
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
7
|
+
import { render as h } from "@testing-library/react";
|
|
8
8
|
//#region src/testing.tsx
|
|
9
|
-
function
|
|
9
|
+
function g(e = {}) {
|
|
10
10
|
return {
|
|
11
11
|
languages: [],
|
|
12
12
|
structures: {},
|
|
@@ -19,7 +19,7 @@ function h(e = {}) {
|
|
|
19
19
|
...e
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function _(e, t = {}, n) {
|
|
23
23
|
return {
|
|
24
24
|
data: e,
|
|
25
25
|
meta: {
|
|
@@ -33,33 +33,33 @@ function g(e, t = {}, n) {
|
|
|
33
33
|
...n === void 0 ? {} : { $refs: n }
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function v(e) {
|
|
37
37
|
return e;
|
|
38
38
|
}
|
|
39
|
-
var
|
|
40
|
-
function
|
|
39
|
+
var y = Symbol("declarion.testing.actionEnvelope");
|
|
40
|
+
function b(e) {
|
|
41
41
|
return {
|
|
42
42
|
...e,
|
|
43
|
-
[
|
|
43
|
+
[y]: !0
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
if (e && typeof e == "object" && e[
|
|
46
|
+
function x(e) {
|
|
47
|
+
if (e && typeof e == "object" && e[y]) {
|
|
48
48
|
let t = { ...e };
|
|
49
|
-
return delete t[
|
|
49
|
+
return delete t[y], t;
|
|
50
50
|
}
|
|
51
51
|
return {
|
|
52
52
|
status: "success",
|
|
53
53
|
result: e
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function S() {
|
|
57
57
|
let e = {
|
|
58
58
|
id: "test-tenant",
|
|
59
59
|
code: "test",
|
|
60
60
|
name: "Test",
|
|
61
61
|
role: "admin"
|
|
62
|
-
},
|
|
62
|
+
}, n = {
|
|
63
63
|
id: "test-user",
|
|
64
64
|
email: "test@example.com",
|
|
65
65
|
display_name: "Test User",
|
|
@@ -70,9 +70,9 @@ function x() {
|
|
|
70
70
|
created_at: "2026-01-01T00:00:00Z",
|
|
71
71
|
updated_at: "2026-01-01T00:00:00Z"
|
|
72
72
|
};
|
|
73
|
-
|
|
73
|
+
t.getState().setUser(n, e);
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function C(e) {
|
|
76
76
|
if (e === void 0) return { rows: [] };
|
|
77
77
|
if (Array.isArray(e)) return { rows: e };
|
|
78
78
|
if (Array.isArray(e.data)) {
|
|
@@ -85,11 +85,11 @@ function S(e) {
|
|
|
85
85
|
}
|
|
86
86
|
return e;
|
|
87
87
|
}
|
|
88
|
-
function
|
|
89
|
-
let
|
|
90
|
-
|
|
91
|
-
let
|
|
92
|
-
return
|
|
88
|
+
function w(e) {
|
|
89
|
+
let t = e.entityData ?? {};
|
|
90
|
+
i((e, n) => {
|
|
91
|
+
let r = t[e], i = C(r), a = i.meta?.per_page ?? 50, o = i.meta?.total ?? i.rows.length;
|
|
92
|
+
return n.count === "only" ? {
|
|
93
93
|
data: [],
|
|
94
94
|
meta: {
|
|
95
95
|
page: 1,
|
|
@@ -108,69 +108,72 @@ function C(e) {
|
|
|
108
108
|
...i.refs === void 0 ? {} : { $refs: i.refs }
|
|
109
109
|
};
|
|
110
110
|
});
|
|
111
|
-
let
|
|
112
|
-
|
|
113
|
-
let
|
|
114
|
-
if (
|
|
115
|
-
if (
|
|
116
|
-
let
|
|
117
|
-
if (
|
|
118
|
-
return { data:
|
|
111
|
+
let o = e.entityItems ?? {}, s = e.entityItemResponses ?? {};
|
|
112
|
+
a((e, t) => {
|
|
113
|
+
let r = typeof t == "string" ? t : n(t), i = s[e]?.[r];
|
|
114
|
+
if (i instanceof Error) throw i;
|
|
115
|
+
if (i !== void 0) return i;
|
|
116
|
+
let a = o[e]?.[r];
|
|
117
|
+
if (a instanceof Error) throw a;
|
|
118
|
+
return { data: a };
|
|
119
119
|
});
|
|
120
120
|
let c = e.actionResults ?? {};
|
|
121
|
-
|
|
121
|
+
r(async (e, t) => {
|
|
122
122
|
if (!(e in c)) throw Error(`renderWithDeclarion: no action result registered for "${e}" (seed it via actionResults)`);
|
|
123
123
|
let n = c[e];
|
|
124
|
-
return
|
|
124
|
+
return x(typeof n == "function" ? await n(t) : n);
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
|
|
127
|
+
function T() {
|
|
128
|
+
i(null), a(null), r(null), t.setState({
|
|
129
129
|
user: null,
|
|
130
130
|
isAuthenticated: !1,
|
|
131
131
|
activeTenant: null,
|
|
132
132
|
tenants: []
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
|
-
function
|
|
136
|
-
let r = new
|
|
135
|
+
function E(t, n = {}) {
|
|
136
|
+
let r = new u({ defaultOptions: { queries: {
|
|
137
137
|
retry: !1,
|
|
138
138
|
gcTime: Infinity
|
|
139
139
|
} } });
|
|
140
|
-
|
|
141
|
-
let i = /* @__PURE__ */ p(
|
|
140
|
+
S(), r.setQueryData(["schema", !0], n.schema ?? g()), w(n);
|
|
141
|
+
let i = n.screenCode ? /* @__PURE__ */ p(s, {
|
|
142
|
+
code: n.screenCode,
|
|
143
|
+
children: t
|
|
144
|
+
}) : t, a = /* @__PURE__ */ m(d, {
|
|
142
145
|
client: r,
|
|
143
|
-
children: [/* @__PURE__ */
|
|
146
|
+
children: [/* @__PURE__ */ p(l, {
|
|
144
147
|
initialEntries: [n.route ?? "/"],
|
|
145
|
-
children: /* @__PURE__ */
|
|
146
|
-
}), /* @__PURE__ */ f
|
|
147
|
-
}),
|
|
148
|
+
children: /* @__PURE__ */ p(o, { children: i })
|
|
149
|
+
}), /* @__PURE__ */ p(f, {})]
|
|
150
|
+
}), c = h(n.viewport ? /* @__PURE__ */ p(e, {
|
|
148
151
|
viewportOverride: n.viewport,
|
|
149
|
-
children:
|
|
150
|
-
}) :
|
|
151
|
-
return Object.assign(
|
|
152
|
+
children: a
|
|
153
|
+
}) : a);
|
|
154
|
+
return Object.assign(c, { queryClient: r });
|
|
152
155
|
}
|
|
153
|
-
function
|
|
154
|
-
let [i] =
|
|
155
|
-
let e = new
|
|
156
|
+
function D({ children: e, authenticated: n = !0, ...r }) {
|
|
157
|
+
let [i] = c(() => {
|
|
158
|
+
let e = new u({ defaultOptions: { queries: {
|
|
156
159
|
retry: !1,
|
|
157
160
|
gcTime: Infinity
|
|
158
161
|
} } });
|
|
159
|
-
return
|
|
162
|
+
return n ? (S(), e.setQueryData(["schema", !0], r.schema ?? g())) : t.setState({
|
|
160
163
|
user: null,
|
|
161
164
|
isAuthenticated: !1,
|
|
162
165
|
activeTenant: null,
|
|
163
166
|
tenants: []
|
|
164
|
-
}),
|
|
167
|
+
}), w(r), e;
|
|
165
168
|
});
|
|
166
|
-
return /* @__PURE__ */
|
|
169
|
+
return /* @__PURE__ */ m(d, {
|
|
167
170
|
client: i,
|
|
168
|
-
children: [/* @__PURE__ */
|
|
169
|
-
initialEntries: [
|
|
170
|
-
children: /* @__PURE__ */
|
|
171
|
-
}), /* @__PURE__ */ f
|
|
171
|
+
children: [/* @__PURE__ */ p(l, {
|
|
172
|
+
initialEntries: [r.route ?? "/"],
|
|
173
|
+
children: /* @__PURE__ */ p(o, { children: e })
|
|
174
|
+
}), /* @__PURE__ */ p(f, {})]
|
|
172
175
|
});
|
|
173
176
|
}
|
|
174
|
-
typeof afterEach == "function" && afterEach(() =>
|
|
177
|
+
typeof afterEach == "function" && afterEach(() => T());
|
|
175
178
|
//#endregion
|
|
176
|
-
export {
|
|
179
|
+
export { D as PreviewHarness, b as actionEnvelope, v as actionResults, T as cleanupDeclarion, _ as entityDataFixture, E as renderWithDeclarion, g as schemaFixture };
|
|
@@ -2755,7 +2755,7 @@ var Z = {
|
|
|
2755
2755
|
update: Ur,
|
|
2756
2756
|
dismiss: (e) => g.dismiss(e),
|
|
2757
2757
|
dismissAll: () => g.dismiss()
|
|
2758
|
-
}, Wr = a(() => import("./MarkdownRenderer-
|
|
2758
|
+
}, Wr = a(() => import("./MarkdownRenderer-14LG1clY.js").then((e) => ({ default: e.MarkdownRenderer })));
|
|
2759
2759
|
function Gr() {
|
|
2760
2760
|
return /* @__PURE__ */ v("div", { className: "h-4 w-2/3 rounded bg-muted animate-pulse" });
|
|
2761
2761
|
}
|
|
@@ -6606,4 +6606,20 @@ function cc({ state: t, onClose: n, onExecute: r }) {
|
|
|
6606
6606
|
})] });
|
|
6607
6607
|
}
|
|
6608
6608
|
//#endregion
|
|
6609
|
-
|
|
6609
|
+
//#region src/hooks/useCurrentScreen.tsx
|
|
6610
|
+
var lc = r(void 0);
|
|
6611
|
+
function uc({ code: e, children: t }) {
|
|
6612
|
+
let { data: n } = Y(), r = u(() => ({
|
|
6613
|
+
code: e,
|
|
6614
|
+
screen: n?.screens[e]
|
|
6615
|
+
}), [e, n]);
|
|
6616
|
+
return /* @__PURE__ */ v(lc.Provider, {
|
|
6617
|
+
value: r,
|
|
6618
|
+
children: t
|
|
6619
|
+
});
|
|
6620
|
+
}
|
|
6621
|
+
function dc() {
|
|
6622
|
+
return s(lc);
|
|
6623
|
+
}
|
|
6624
|
+
//#endregion
|
|
6625
|
+
export { xr as $, st as $t, ji as A, Ce as An, G as At, Zr as B, N as Bn, Et as Bt, ba as C, xe as Cn, Rn as Ct, aa as D, Pe as Dn, An as Dt, ea as E, Ie as En, kn as Et, Ei as F, ve as Fn, mn as Ft, Mr as G, E as Gn, ht as Gt, Kr as H, k as Hn, bt as Ht, di as I, ce as In, Nt as It, Dr as J, pt as Jt, jr as K, T as Kn, gt as Kt, li as L, ge as Ln, It as Lt, Oi as M, Fe as Mn, J as Mt, Ti as N, be as Nn, pn as Nt, ia as O, F as On, In as Ot, Di as P, ye as Pn, hn as Pt, br as Q, at as Qt, ti as R, de as Rn, Lt as Rt, _a as S, De as Sn, Ln as St, va as T, je as Tn, Mn as Tt, Z as U, O as Un, xt as Ut, Yr as V, ae as Vn, St as Vt, Ar as W, D as Wn, Tt as Wt, Sr as X, B as Xt, wr as Y, ft as Yt, Cr as Z, ot as Zt, ss as _, R as _n, Vn as _t, Ys as a, qe as an, Jn as at, Ca as b, I as bn, jn as bt, Ps as c, ze as cn, Wn as ct, Os as d, Ye as dn, Yn as dt, Re as en, fr as et, Ss as f, $e as fn, tr as ft, ls as g, et as gn, Y as gt, fs as h, Ke as hn, Kn as ht, rc as i, Ge as in, qn as it, ki as j, P as jn, q as jt, $i as k, Me as kn, Nn as kt, zs as l, z as ln, Un as lt, ms as m, Xe as mn, ir as mt, dc as n, nt as nn, $n as nt, Js as o, Je as on, or as ot, Ds as p, Ze as pn, ar as pt, kr as q, _t as qt, ac as r, rt as rn, Gn as rt, Ns as s, Ue as sn, Xn as st, uc as t, tt as tn, Zn as tt, ks as u, L as un, sr as ut, Sa as v, He as vn, Bn as vt, ca as w, Ne as wn, Fn as wt, Q as x, Le as xn, zn as xt, wa as y, Qe as yn, On as yt, Qr as z, _e as zn, Dt as zt };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { vt as c } from "./registry-
|
|
1
|
+
import { $ as e, $t as t, Mt as n, U as r, bn as i, jt as a, ot as o, un as s } from "./useCurrentScreen-Bgp6_vne.js";
|
|
2
|
+
import { vt as c } from "./registry-KMbQkTF6.js";
|
|
3
3
|
import { useEffect as l, useMemo as u } from "react";
|
|
4
4
|
import { useSearchParams as d } from "react-router-dom";
|
|
5
5
|
import { useInfiniteQuery as f, useMutation as p, useQueryClient as m } from "@tanstack/react-query";
|
|
@@ -48,32 +48,32 @@ var b = class {
|
|
|
48
48
|
}
|
|
49
49
|
async get(e) {
|
|
50
50
|
let t = new URLSearchParams(typeof e == "string" ? { id: e } : e);
|
|
51
|
-
return _((await
|
|
51
|
+
return _((await a(`/api/data/${this.entity}?${t.toString()}`)).data);
|
|
52
52
|
}
|
|
53
53
|
async list(e = {}) {
|
|
54
|
-
let
|
|
54
|
+
let n, r = !1;
|
|
55
55
|
try {
|
|
56
|
-
|
|
56
|
+
n = await a(y(this.entity, e));
|
|
57
57
|
} catch (i) {
|
|
58
|
-
if (e.after &&
|
|
59
|
-
let { after:
|
|
60
|
-
|
|
58
|
+
if (e.after && t(i)) {
|
|
59
|
+
let { after: t, ...i } = e;
|
|
60
|
+
n = await a(y(this.entity, i)), r = !0;
|
|
61
61
|
} else throw i;
|
|
62
62
|
}
|
|
63
|
-
return this.refs.merge(
|
|
64
|
-
data:
|
|
65
|
-
meta:
|
|
63
|
+
return this.refs.merge(n.$refs), {
|
|
64
|
+
data: n.data.map((e) => _(e)),
|
|
65
|
+
meta: n.meta,
|
|
66
66
|
$refs: this.refs.all(),
|
|
67
|
-
reset:
|
|
67
|
+
reset: r
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
async create(e) {
|
|
71
71
|
return (await this.createMany([e]))[0];
|
|
72
72
|
}
|
|
73
|
-
async createMany(
|
|
74
|
-
if (
|
|
75
|
-
let
|
|
76
|
-
actions:
|
|
73
|
+
async createMany(e) {
|
|
74
|
+
if (e.length === 0) return [];
|
|
75
|
+
let t = await n("system.batch", {
|
|
76
|
+
actions: e.map((e) => ({
|
|
77
77
|
action: `${this.entity}.__create`,
|
|
78
78
|
params: {
|
|
79
79
|
entity: this.entity,
|
|
@@ -82,7 +82,7 @@ var b = class {
|
|
|
82
82
|
})),
|
|
83
83
|
atomic: !0
|
|
84
84
|
});
|
|
85
|
-
return x(
|
|
85
|
+
return x(t, `${this.entity}.__create`), t.results.map((e) => _(S(e)));
|
|
86
86
|
}
|
|
87
87
|
async update(e, t) {
|
|
88
88
|
return (await this.updateMany([{
|
|
@@ -90,10 +90,10 @@ var b = class {
|
|
|
90
90
|
...t
|
|
91
91
|
}]))[0];
|
|
92
92
|
}
|
|
93
|
-
async updateMany(
|
|
94
|
-
if (
|
|
95
|
-
let
|
|
96
|
-
actions:
|
|
93
|
+
async updateMany(e) {
|
|
94
|
+
if (e.length === 0) return [];
|
|
95
|
+
let t = await n("system.batch", {
|
|
96
|
+
actions: e.map(({ id: e, ...t }) => ({
|
|
97
97
|
action: `${this.entity}.__update`,
|
|
98
98
|
params: {
|
|
99
99
|
object_ids: [e],
|
|
@@ -103,13 +103,13 @@ var b = class {
|
|
|
103
103
|
})),
|
|
104
104
|
atomic: !0
|
|
105
105
|
});
|
|
106
|
-
return x(
|
|
106
|
+
return x(t, `${this.entity}.__update`), t.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
|
|
112
|
+
return e.length === 0 ? { count: 0 } : { count: (await o(`${this.entity}.__delete`, {
|
|
113
113
|
object_ids: e,
|
|
114
114
|
entity: this.entity
|
|
115
115
|
})).object_count ?? e.length };
|
|
@@ -118,7 +118,7 @@ var b = class {
|
|
|
118
118
|
await this.restoreMany([e]);
|
|
119
119
|
}
|
|
120
120
|
async restoreMany(e) {
|
|
121
|
-
return e.length === 0 ? { count: 0 } : { count: (await
|
|
121
|
+
return e.length === 0 ? { count: 0 } : { count: (await o(`${this.entity}.__restore`, {
|
|
122
122
|
object_ids: e,
|
|
123
123
|
entity: this.entity
|
|
124
124
|
})).object_count ?? e.length };
|
|
@@ -126,15 +126,15 @@ var b = class {
|
|
|
126
126
|
async upsert(e, t) {
|
|
127
127
|
return (await this.upsertMany([e], t))[0];
|
|
128
128
|
}
|
|
129
|
-
async upsertMany(
|
|
130
|
-
if (
|
|
131
|
-
let r = await
|
|
132
|
-
actions:
|
|
129
|
+
async upsertMany(e, t) {
|
|
130
|
+
if (e.length === 0) return [];
|
|
131
|
+
let r = await n("system.batch", {
|
|
132
|
+
actions: e.map((e) => ({
|
|
133
133
|
action: `${this.entity}.__upsert`,
|
|
134
134
|
params: {
|
|
135
135
|
entity: this.entity,
|
|
136
136
|
fields: e,
|
|
137
|
-
unique_by:
|
|
137
|
+
unique_by: t
|
|
138
138
|
}
|
|
139
139
|
})),
|
|
140
140
|
atomic: !0
|
|
@@ -232,40 +232,40 @@ function O(e, t, n) {
|
|
|
232
232
|
}
|
|
233
233
|
//#endregion
|
|
234
234
|
//#region src/hooks/useTabSearchMirror.ts
|
|
235
|
-
function k(
|
|
236
|
-
let
|
|
235
|
+
function k(t) {
|
|
236
|
+
let n = e(), [r] = d();
|
|
237
237
|
l(() => {
|
|
238
|
-
if (!
|
|
239
|
-
let
|
|
240
|
-
i &&
|
|
238
|
+
if (!t || n.enabled) return;
|
|
239
|
+
let e = c.getState(), i = e.findTabByPathname(t);
|
|
240
|
+
i && e.updateTabSearch(i.id, r.toString());
|
|
241
241
|
}, [
|
|
242
242
|
r,
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
t,
|
|
244
|
+
n.enabled
|
|
245
245
|
]);
|
|
246
246
|
}
|
|
247
247
|
//#endregion
|
|
248
248
|
//#region src/hooks/useRegisterScreenTab.ts
|
|
249
|
-
function A(
|
|
250
|
-
let a =
|
|
249
|
+
function A(t, n, r, i) {
|
|
250
|
+
let a = e();
|
|
251
251
|
l(() => {
|
|
252
|
-
!
|
|
253
|
-
pathname:
|
|
252
|
+
!t || a.enabled || c.getState().openTab({
|
|
253
|
+
pathname: t,
|
|
254
254
|
search: i,
|
|
255
|
-
title:
|
|
255
|
+
title: n,
|
|
256
256
|
icon: r,
|
|
257
257
|
closable: !0
|
|
258
258
|
});
|
|
259
259
|
}, [
|
|
260
|
-
e,
|
|
261
260
|
t,
|
|
261
|
+
n,
|
|
262
262
|
r,
|
|
263
263
|
a.enabled
|
|
264
264
|
]);
|
|
265
265
|
}
|
|
266
266
|
function j(e, t, n) {
|
|
267
|
-
let r = e?.route,
|
|
268
|
-
A(t ? r : void 0,
|
|
267
|
+
let r = e?.route, i = t ? s(e?.display?.name) || s(t.display.name_plural) : "", a = e?.display?.icon || t?.display.icon;
|
|
268
|
+
A(t ? r : void 0, i, a, n);
|
|
269
269
|
}
|
|
270
270
|
//#endregion
|
|
271
271
|
//#region src/lib/filters.ts
|
|
@@ -332,14 +332,14 @@ function z(e, t) {
|
|
|
332
332
|
if (!e.field || !e.op) return "";
|
|
333
333
|
let n = N[e.op] || e.op;
|
|
334
334
|
if (M.has(e.op)) return `${n}`;
|
|
335
|
-
let r = e.field,
|
|
335
|
+
let r = e.field, a = (e) => {
|
|
336
336
|
if (t) {
|
|
337
337
|
let n = t(r, e);
|
|
338
338
|
return n.label != null && (n.status === "special" || n.status === "resolved") ? n.label : n.raw;
|
|
339
339
|
}
|
|
340
|
-
return
|
|
340
|
+
return i(e);
|
|
341
341
|
};
|
|
342
|
-
return `${n} ${Array.isArray(e.value) ? e.value.map(
|
|
342
|
+
return `${n} ${Array.isArray(e.value) ? e.value.map(a).join(", ") : a(e.value)}`;
|
|
343
343
|
}
|
|
344
344
|
function B(e, t) {
|
|
345
345
|
return {
|
|
@@ -374,36 +374,36 @@ function V(e, t) {
|
|
|
374
374
|
//#endregion
|
|
375
375
|
//#region src/api/status.ts
|
|
376
376
|
async function H(e, t, n, r, i) {
|
|
377
|
-
let
|
|
377
|
+
let a = {
|
|
378
378
|
status_group_code: n,
|
|
379
379
|
status_code: r
|
|
380
380
|
};
|
|
381
|
-
i != null && (
|
|
382
|
-
let s = (await
|
|
381
|
+
i != null && (a.note = i);
|
|
382
|
+
let s = (await o(`${e}.__update`, {
|
|
383
383
|
object_ids: [t],
|
|
384
384
|
entity: e,
|
|
385
|
-
fields: { $statuses: [
|
|
385
|
+
fields: { $statuses: [a] }
|
|
386
386
|
})).result?.rows?.[0]?.$statuses ?? [];
|
|
387
387
|
return s.find((e) => e.group_code === n) ?? s[0];
|
|
388
388
|
}
|
|
389
389
|
//#endregion
|
|
390
390
|
//#region src/hooks/useObjectStatus.ts
|
|
391
|
-
function U(e,
|
|
392
|
-
let
|
|
391
|
+
function U(e, t) {
|
|
392
|
+
let n = m();
|
|
393
393
|
return p({
|
|
394
|
-
mutationFn: ({ groupCode:
|
|
394
|
+
mutationFn: ({ groupCode: n, statusCode: r, note: i }) => H(e, t, n, r, i),
|
|
395
395
|
onSuccess: () => {
|
|
396
|
-
|
|
396
|
+
n.invalidateQueries({ queryKey: ["entity-item", e] });
|
|
397
397
|
},
|
|
398
398
|
onError: (e) => {
|
|
399
|
-
|
|
399
|
+
r.error(e.message);
|
|
400
400
|
}
|
|
401
401
|
});
|
|
402
402
|
}
|
|
403
403
|
//#endregion
|
|
404
404
|
//#region src/api/properties.ts
|
|
405
405
|
async function W(e, t, n, r) {
|
|
406
|
-
let i = (await
|
|
406
|
+
let i = (await o(`${e}.__update`, {
|
|
407
407
|
object_ids: [t],
|
|
408
408
|
entity: e,
|
|
409
409
|
fields: { $properties: [{
|
|
@@ -414,7 +414,7 @@ async function W(e, t, n, r) {
|
|
|
414
414
|
return i.find((e) => e.property_code === n) ?? i[0];
|
|
415
415
|
}
|
|
416
416
|
async function G(e, t, n) {
|
|
417
|
-
await
|
|
417
|
+
await o(`${e}.__update`, {
|
|
418
418
|
object_ids: [t],
|
|
419
419
|
entity: e,
|
|
420
420
|
fields: { $properties: [{
|
|
@@ -425,27 +425,27 @@ async function G(e, t, n) {
|
|
|
425
425
|
}
|
|
426
426
|
//#endregion
|
|
427
427
|
//#region src/hooks/useProperties.ts
|
|
428
|
-
function K(e,
|
|
429
|
-
let
|
|
428
|
+
function K(e, t) {
|
|
429
|
+
let n = m();
|
|
430
430
|
return p({
|
|
431
|
-
mutationFn: ({ propertyCode:
|
|
431
|
+
mutationFn: ({ propertyCode: n, value: r }) => W(e, t, n, r),
|
|
432
432
|
onSuccess: () => {
|
|
433
|
-
|
|
433
|
+
n.invalidateQueries({ queryKey: ["entity-item", e] });
|
|
434
434
|
},
|
|
435
435
|
onError: (e) => {
|
|
436
|
-
|
|
436
|
+
r.error(e.message);
|
|
437
437
|
}
|
|
438
438
|
});
|
|
439
439
|
}
|
|
440
|
-
function q(e,
|
|
441
|
-
let
|
|
440
|
+
function q(e, t) {
|
|
441
|
+
let n = m();
|
|
442
442
|
return p({
|
|
443
|
-
mutationFn: (
|
|
443
|
+
mutationFn: (n) => G(e, t, n),
|
|
444
444
|
onSuccess: () => {
|
|
445
|
-
|
|
445
|
+
n.invalidateQueries({ queryKey: ["entity-item", e] });
|
|
446
446
|
},
|
|
447
447
|
onError: (e) => {
|
|
448
|
-
|
|
448
|
+
r.error(e.message);
|
|
449
449
|
}
|
|
450
450
|
});
|
|
451
451
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bt as e, Ut as t, zt as n } from "./useCurrentScreen-Bgp6_vne.js";
|
|
2
2
|
import { useCallback as r, useEffect as i, useRef as a, useState as o } from "react";
|
|
3
3
|
//#region src/embed/file-src.ts
|
|
4
4
|
var s = "/api/files";
|
|
@@ -29,17 +29,17 @@ function d(e, t) {
|
|
|
29
29
|
function f(e) {
|
|
30
30
|
return `${e}${e.includes("?") ? "&" : "?"}disposition=attachment`;
|
|
31
31
|
}
|
|
32
|
-
async function p(
|
|
33
|
-
let i = await
|
|
32
|
+
async function p(t, r) {
|
|
33
|
+
let i = await n(), a = await fetch(t, d(i, r));
|
|
34
34
|
if (a.status !== 401) return a;
|
|
35
|
-
|
|
36
|
-
let o = await
|
|
37
|
-
return fetch(
|
|
38
|
-
}
|
|
39
|
-
async function m(e,
|
|
40
|
-
if (!
|
|
41
|
-
let i = await p(l(e,
|
|
42
|
-
if (i.status === 202 && typeof
|
|
35
|
+
e();
|
|
36
|
+
let o = await n();
|
|
37
|
+
return fetch(t, d(o, r));
|
|
38
|
+
}
|
|
39
|
+
async function m(e, n, r) {
|
|
40
|
+
if (!t()) throw Error("resolveEmbedFileSrc called outside embed token mode");
|
|
41
|
+
let i = await p(l(e, n), r);
|
|
42
|
+
if (i.status === 202 && typeof n == "object") throw new u(e, n.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
45
|
if (!c(a)) throw Error("embed file url response is malformed");
|
|
@@ -48,7 +48,7 @@ async function m(e, t, r) {
|
|
|
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(
|
|
51
|
+
let o = await p(n === "download" ? f(a.url) : a.url, r);
|
|
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 {
|
|
@@ -148,23 +148,23 @@ function k(e) {
|
|
|
148
148
|
function A(e) {
|
|
149
149
|
return e.startsWith("derivation:") ? { derivation: e.slice(11) } : e === "download" ? "download" : "preview";
|
|
150
150
|
}
|
|
151
|
-
function j(e,
|
|
152
|
-
let a = k(
|
|
151
|
+
function j(e, n, r) {
|
|
152
|
+
let a = k(n), [s, c] = o(() => t() ? void 0 : r);
|
|
153
153
|
return i(() => {
|
|
154
|
-
|
|
154
|
+
t() || c(r);
|
|
155
155
|
}, [r]), i(() => {
|
|
156
|
-
if (!
|
|
156
|
+
if (!t()) return;
|
|
157
157
|
if (!e) {
|
|
158
158
|
c(void 0);
|
|
159
159
|
return;
|
|
160
160
|
}
|
|
161
|
-
let
|
|
161
|
+
let n = null, r = !1, i = new AbortController();
|
|
162
162
|
return c(void 0), m(e, A(a), i.signal).then((e) => {
|
|
163
163
|
if (r) {
|
|
164
164
|
e.kind === "blob" && URL.revokeObjectURL(e.url);
|
|
165
165
|
return;
|
|
166
166
|
}
|
|
167
|
-
e.kind === "blob" && (
|
|
167
|
+
e.kind === "blob" && (n = e.url), c(e.url);
|
|
168
168
|
}).catch((e) => {
|
|
169
169
|
if (!r) {
|
|
170
170
|
if (e instanceof u) {
|
|
@@ -174,7 +174,7 @@ function j(e, t, r) {
|
|
|
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(),
|
|
177
|
+
r = !0, i.abort(), n && URL.revokeObjectURL(n);
|
|
178
178
|
};
|
|
179
179
|
}, [e, a]), s;
|
|
180
180
|
}
|
|
@@ -183,12 +183,12 @@ function M() {
|
|
|
183
183
|
return i(() => () => {
|
|
184
184
|
for (let t of e.current) URL.revokeObjectURL(t);
|
|
185
185
|
e.current = [];
|
|
186
|
-
}, []), { open: r((
|
|
187
|
-
if (!
|
|
186
|
+
}, []), { open: r((n, r, i) => {
|
|
187
|
+
if (!t()) {
|
|
188
188
|
i && window.open(i, "_blank", "noopener");
|
|
189
189
|
return;
|
|
190
190
|
}
|
|
191
|
-
|
|
191
|
+
n && m(n, r).then((t) => {
|
|
192
192
|
t.kind === "blob" && e.current.push(t.url), window.open(t.url, "_blank", "noopener");
|
|
193
193
|
}).catch((e) => {
|
|
194
194
|
e instanceof u || console.error("[declarion-embed] file open failed:", e);
|