@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,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Fn as e, Kt as t, Tn as n, it as r, mn as i, mt as a, qt as o, xt as s } from "./useCurrentScreen-mw8TfE8q.js";
|
|
2
|
+
import { ut as c } from "./registry-DFtAh6zc.js";
|
|
3
3
|
import { useEffect as l, useLayoutEffect as u, useMemo as d } from "react";
|
|
4
4
|
import { useSearchParams as f } from "react-router-dom";
|
|
5
5
|
import { useInfiniteQuery as p, useMutation as m, useQueryClient as h } from "@tanstack/react-query";
|
|
@@ -47,18 +47,18 @@ var x = class {
|
|
|
47
47
|
this.entity = e, this.refs = t ?? new y();
|
|
48
48
|
}
|
|
49
49
|
async get(e) {
|
|
50
|
-
let
|
|
51
|
-
return v((await
|
|
50
|
+
let n = new URLSearchParams(typeof e == "string" ? { id: e } : e);
|
|
51
|
+
return v((await t(`/api/data/${this.entity}?${n.toString()}`)).data);
|
|
52
52
|
}
|
|
53
53
|
async list(e = {}) {
|
|
54
54
|
let n, r = !1;
|
|
55
55
|
try {
|
|
56
|
-
n = await
|
|
57
|
-
} catch (
|
|
58
|
-
if (e.after &&
|
|
59
|
-
let { after:
|
|
60
|
-
n = await
|
|
61
|
-
} else throw
|
|
56
|
+
n = await t(b(this.entity, e));
|
|
57
|
+
} catch (a) {
|
|
58
|
+
if (e.after && i(a)) {
|
|
59
|
+
let { after: i, ...a } = e;
|
|
60
|
+
n = await t(b(this.entity, a)), r = !0;
|
|
61
|
+
} else throw a;
|
|
62
62
|
}
|
|
63
63
|
return this.refs.merge(n.$refs), {
|
|
64
64
|
data: n.data.map((e) => v(e)),
|
|
@@ -72,7 +72,7 @@ var x = class {
|
|
|
72
72
|
}
|
|
73
73
|
async createMany(e) {
|
|
74
74
|
if (e.length === 0) return [];
|
|
75
|
-
let t = await
|
|
75
|
+
let t = await o("system.batch", {
|
|
76
76
|
actions: e.map((e) => ({
|
|
77
77
|
action: `${this.entity}.__create`,
|
|
78
78
|
params: {
|
|
@@ -92,7 +92,7 @@ var x = class {
|
|
|
92
92
|
}
|
|
93
93
|
async updateMany(e) {
|
|
94
94
|
if (e.length === 0) return [];
|
|
95
|
-
let t = await
|
|
95
|
+
let t = await o("system.batch", {
|
|
96
96
|
actions: e.map(({ id: e, ...t }) => ({
|
|
97
97
|
action: `${this.entity}.__update`,
|
|
98
98
|
params: {
|
|
@@ -109,7 +109,7 @@ var x = class {
|
|
|
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 s(`${this.entity}.__delete`, {
|
|
113
113
|
object_ids: e,
|
|
114
114
|
entity: this.entity
|
|
115
115
|
})).object_count ?? e.length };
|
|
@@ -118,7 +118,7 @@ var x = 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 s(`${this.entity}.__restore`, {
|
|
122
122
|
object_ids: e,
|
|
123
123
|
entity: this.entity
|
|
124
124
|
})).object_count ?? e.length };
|
|
@@ -128,7 +128,7 @@ var x = class {
|
|
|
128
128
|
}
|
|
129
129
|
async upsertMany(e, t) {
|
|
130
130
|
if (e.length === 0) return [];
|
|
131
|
-
let
|
|
131
|
+
let n = await o("system.batch", {
|
|
132
132
|
actions: e.map((e) => ({
|
|
133
133
|
action: `${this.entity}.__upsert`,
|
|
134
134
|
params: {
|
|
@@ -139,7 +139,7 @@ var x = class {
|
|
|
139
139
|
})),
|
|
140
140
|
atomic: !0
|
|
141
141
|
});
|
|
142
|
-
return S(
|
|
142
|
+
return S(n, `${this.entity}.__upsert`), n.results.map((e) => v(w(e)));
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
145
|
function S(e, t) {
|
|
@@ -232,40 +232,40 @@ function k(e, t, n) {
|
|
|
232
232
|
}
|
|
233
233
|
//#endregion
|
|
234
234
|
//#region src/hooks/useTabSearchMirror.ts
|
|
235
|
-
function A(
|
|
236
|
-
let
|
|
235
|
+
function A(e) {
|
|
236
|
+
let t = a(), [n] = f();
|
|
237
237
|
u(() => {
|
|
238
|
-
if (!
|
|
239
|
-
let
|
|
240
|
-
i &&
|
|
238
|
+
if (!e || t.enabled) return;
|
|
239
|
+
let r = c.getState(), i = r.findTabByPathname(e);
|
|
240
|
+
i && r.updateTabSearch(i.id, n.toString());
|
|
241
241
|
}, [
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
242
|
+
n,
|
|
243
|
+
e,
|
|
244
|
+
t.enabled
|
|
245
245
|
]);
|
|
246
246
|
}
|
|
247
247
|
//#endregion
|
|
248
248
|
//#region src/hooks/useRegisterScreenTab.ts
|
|
249
|
-
function j(t, n, r
|
|
250
|
-
let
|
|
249
|
+
function j(e, t, n, r) {
|
|
250
|
+
let i = a();
|
|
251
251
|
l(() => {
|
|
252
|
-
!
|
|
253
|
-
pathname:
|
|
254
|
-
search:
|
|
255
|
-
title:
|
|
256
|
-
icon:
|
|
252
|
+
!e || i.enabled || c.getState().openTab({
|
|
253
|
+
pathname: e,
|
|
254
|
+
search: r,
|
|
255
|
+
title: t,
|
|
256
|
+
icon: n,
|
|
257
257
|
closable: !0
|
|
258
258
|
});
|
|
259
259
|
}, [
|
|
260
|
+
e,
|
|
260
261
|
t,
|
|
261
262
|
n,
|
|
262
|
-
|
|
263
|
-
a.enabled
|
|
263
|
+
i.enabled
|
|
264
264
|
]);
|
|
265
265
|
}
|
|
266
|
-
function M(e, t,
|
|
267
|
-
let
|
|
268
|
-
j(t ?
|
|
266
|
+
function M(e, t, r) {
|
|
267
|
+
let i = e?.route, a = t ? n(e?.display?.name) || n(t.display.name_plural) : "", o = e?.display?.icon || t?.display.icon;
|
|
268
|
+
j(t ? i : void 0, a, o, r);
|
|
269
269
|
}
|
|
270
270
|
//#endregion
|
|
271
271
|
//#region src/lib/filters.ts
|
|
@@ -328,18 +328,18 @@ function R(e) {
|
|
|
328
328
|
function z(e) {
|
|
329
329
|
return R(e).length;
|
|
330
330
|
}
|
|
331
|
-
function B(
|
|
332
|
-
if (!
|
|
333
|
-
let
|
|
334
|
-
if (N.has(
|
|
335
|
-
let
|
|
336
|
-
if (
|
|
337
|
-
let
|
|
338
|
-
return
|
|
331
|
+
function B(t, n) {
|
|
332
|
+
if (!t.field || !t.op) return "";
|
|
333
|
+
let r = P[t.op] || t.op;
|
|
334
|
+
if (N.has(t.op)) return `${r}`;
|
|
335
|
+
let i = t.field, a = (t) => {
|
|
336
|
+
if (n) {
|
|
337
|
+
let e = n(i, t);
|
|
338
|
+
return e.label != null && (e.status === "special" || e.status === "resolved") ? e.label : e.raw;
|
|
339
339
|
}
|
|
340
|
-
return
|
|
340
|
+
return e(t);
|
|
341
341
|
};
|
|
342
|
-
return `${
|
|
342
|
+
return `${r} ${Array.isArray(t.value) ? t.value.map(a).join(", ") : a(t.value)}`;
|
|
343
343
|
}
|
|
344
344
|
function V(e, t) {
|
|
345
345
|
return {
|
|
@@ -379,12 +379,12 @@ async function U(e, t, n, r, i) {
|
|
|
379
379
|
status_code: r
|
|
380
380
|
};
|
|
381
381
|
i != null && (a.note = i);
|
|
382
|
-
let
|
|
382
|
+
let o = (await s(`${e}.__update`, {
|
|
383
383
|
object_ids: [t],
|
|
384
384
|
entity: e,
|
|
385
385
|
fields: { $statuses: [a] }
|
|
386
386
|
})).result?.rows?.[0]?.$statuses ?? [];
|
|
387
|
-
return
|
|
387
|
+
return o.find((e) => e.group_code === n) ?? o[0];
|
|
388
388
|
}
|
|
389
389
|
//#endregion
|
|
390
390
|
//#region src/hooks/useObjectStatus.ts
|
|
@@ -403,7 +403,7 @@ function W(e, t) {
|
|
|
403
403
|
//#endregion
|
|
404
404
|
//#region src/api/properties.ts
|
|
405
405
|
async function G(e, t, n, r) {
|
|
406
|
-
let i = (await
|
|
406
|
+
let i = (await s(`${e}.__update`, {
|
|
407
407
|
object_ids: [t],
|
|
408
408
|
entity: e,
|
|
409
409
|
fields: { $properties: [{
|
|
@@ -414,7 +414,7 @@ async function G(e, t, n, r) {
|
|
|
414
414
|
return i.find((e) => e.property_code === n) ?? i[0];
|
|
415
415
|
}
|
|
416
416
|
async function K(e, t, n) {
|
|
417
|
-
await
|
|
417
|
+
await s(`${e}.__update`, {
|
|
418
418
|
object_ids: [t],
|
|
419
419
|
entity: e,
|
|
420
420
|
fields: { $properties: [{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { en as e, in as t, tn as n } from "./useCurrentScreen-mw8TfE8q.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";
|
|
@@ -30,10 +30,10 @@ function f(e) {
|
|
|
30
30
|
return `${e}${e.includes("?") ? "&" : "?"}disposition=attachment`;
|
|
31
31
|
}
|
|
32
32
|
async function p(t, r) {
|
|
33
|
-
let i = await
|
|
33
|
+
let i = await e(), a = await fetch(t, d(i, r));
|
|
34
34
|
if (a.status !== 401) return a;
|
|
35
|
-
|
|
36
|
-
let o = await
|
|
35
|
+
n();
|
|
36
|
+
let o = await e();
|
|
37
37
|
return fetch(t, d(o, r));
|
|
38
38
|
}
|
|
39
39
|
async function m(e, n, r) {
|