@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
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { J as e, X as t, Y as n } from "./useCurrentScreen-C5Oio-1G.js";
|
|
2
|
+
import { y as r } from "./field-classification-DTgUnbzd.js";
|
|
3
|
+
import { _ as i, y as a } from "./useTabSearchMirror-sIuYEFaq.js";
|
|
4
|
+
import { useCallback as o, useEffect as s, useMemo as c, useState as l } from "react";
|
|
5
|
+
import { useQueryClient as u } from "@tanstack/react-query";
|
|
6
|
+
//#region src/components/pages/list/useListQuery.ts
|
|
7
|
+
var d = 1e4;
|
|
8
|
+
function f(s) {
|
|
9
|
+
let l = u(), { entity: d, entityCode: f, screen: m, screenCode: h, page: g, perPage: _, sortForRequest: v, debouncedSearch: y, filters: b, filterError: x, includeDeleted: S, expand: C, select: w, runCountQuery: T, urlKey: E } = s, D = x ? void 0 : b.length > 0 ? b : void 0, O = {
|
|
10
|
+
page: g,
|
|
11
|
+
per_page: _,
|
|
12
|
+
sort: v,
|
|
13
|
+
search: y || void 0,
|
|
14
|
+
filters: D,
|
|
15
|
+
include_deleted: S || void 0,
|
|
16
|
+
expand: C,
|
|
17
|
+
select: w,
|
|
18
|
+
preview: !0,
|
|
19
|
+
screen: m?.fixed_filters ? h : void 0
|
|
20
|
+
}, k = {
|
|
21
|
+
sort: v,
|
|
22
|
+
filters: D,
|
|
23
|
+
search: y || void 0,
|
|
24
|
+
select: w,
|
|
25
|
+
expand: C,
|
|
26
|
+
includeDeleted: S || void 0,
|
|
27
|
+
screen: m?.fixed_filters ? h : void 0,
|
|
28
|
+
preview: !0,
|
|
29
|
+
limit: _
|
|
30
|
+
}, A = d?.list_pagination === "cursor", j = t(f, O, !A), M = n(f, O, T && !A), N = a(f, k, A);
|
|
31
|
+
r(e(f, O), !A), r(i(f, k), A);
|
|
32
|
+
let P = A ? N.isLoading : j.isLoading, F = c(() => A ? N.rows : j.data?.data ?? [], [
|
|
33
|
+
A,
|
|
34
|
+
N.rows,
|
|
35
|
+
j.data?.data
|
|
36
|
+
]), I = A ? N.total : M.data?.meta?.total, L = c(() => {
|
|
37
|
+
if (!(A || I === void 0 || _ <= 0)) return Math.max(1, Math.ceil(I / _));
|
|
38
|
+
}, [
|
|
39
|
+
A,
|
|
40
|
+
I,
|
|
41
|
+
_
|
|
42
|
+
]), R = p(P, E), z = o(() => {
|
|
43
|
+
f && l.cancelQueries({ queryKey: ["entity-data", f] }), A ? N.refetch() : j.refetch();
|
|
44
|
+
}, [
|
|
45
|
+
f,
|
|
46
|
+
l,
|
|
47
|
+
A,
|
|
48
|
+
N,
|
|
49
|
+
j
|
|
50
|
+
]), B = o(() => {
|
|
51
|
+
N.fetchNextPage();
|
|
52
|
+
}, [N]);
|
|
53
|
+
return {
|
|
54
|
+
rows: F,
|
|
55
|
+
meta: j.data?.meta,
|
|
56
|
+
refs: A ? N.refs : j.data?.$refs,
|
|
57
|
+
isLoading: P,
|
|
58
|
+
isFetching: A ? N.isFetching : j.isFetching,
|
|
59
|
+
isError: A ? N.isError : j.isError,
|
|
60
|
+
error: A ? N.error : j.error,
|
|
61
|
+
isLoadingStale: R,
|
|
62
|
+
retry: z,
|
|
63
|
+
countTotal: I,
|
|
64
|
+
countStrategy: A ? N.countMode : M.data?.meta?.count_mode,
|
|
65
|
+
countLoading: A ? N.isLoading : M.isLoading,
|
|
66
|
+
countError: !A && M.isError,
|
|
67
|
+
totalPages: L,
|
|
68
|
+
hasMorePages: A ? N.hasMore : j.data?.meta?.has_more ?? (L !== void 0 && g < L),
|
|
69
|
+
isCursor: A,
|
|
70
|
+
fetchNextPage: B,
|
|
71
|
+
isFetchingNextPage: N.isFetchingNextPage
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function p(e, t) {
|
|
75
|
+
let [n, r] = l(!1);
|
|
76
|
+
return s(() => {
|
|
77
|
+
if (!e) {
|
|
78
|
+
r(!1);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
r(!1);
|
|
82
|
+
let t = window.setTimeout(() => r(!0), d);
|
|
83
|
+
return () => window.clearTimeout(t);
|
|
84
|
+
}, [e, t]), n;
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
export { f as t };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { bt as e, rt as t } from "./useCurrentScreen-C5Oio-1G.js";
|
|
2
|
+
import { useMutation as n, useQueryClient as r } from "@tanstack/react-query";
|
|
3
|
+
//#region src/api/status.ts
|
|
4
|
+
async function i(t, n, r, i, a) {
|
|
5
|
+
let o = {
|
|
6
|
+
status_group_code: r,
|
|
7
|
+
status_code: i
|
|
8
|
+
};
|
|
9
|
+
a != null && (o.note = a);
|
|
10
|
+
let s = (await e(`${t}.__update`, {
|
|
11
|
+
object_ids: [n],
|
|
12
|
+
entity: t,
|
|
13
|
+
fields: { $statuses: [o] }
|
|
14
|
+
})).result?.rows?.[0]?.$statuses ?? [];
|
|
15
|
+
return s.find((e) => e.group_code === r) ?? s[0];
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/hooks/useObjectStatus.ts
|
|
19
|
+
function a(e, a) {
|
|
20
|
+
let o = r();
|
|
21
|
+
return n({
|
|
22
|
+
mutationFn: ({ groupCode: t, statusCode: n, note: r }) => i(e, a, t, n, r),
|
|
23
|
+
onSuccess: () => {
|
|
24
|
+
o.invalidateQueries({ queryKey: ["entity-item", e] });
|
|
25
|
+
},
|
|
26
|
+
onError: (e) => {
|
|
27
|
+
t.error(e.message);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/api/properties.ts
|
|
33
|
+
async function o(t, n, r, i) {
|
|
34
|
+
let a = (await e(`${t}.__update`, {
|
|
35
|
+
object_ids: [n],
|
|
36
|
+
entity: t,
|
|
37
|
+
fields: { $properties: [{
|
|
38
|
+
property_code: r,
|
|
39
|
+
value: i
|
|
40
|
+
}] }
|
|
41
|
+
})).result?.rows?.[0]?.$properties ?? [];
|
|
42
|
+
return a.find((e) => e.property_code === r) ?? a[0];
|
|
43
|
+
}
|
|
44
|
+
async function s(t, n, r) {
|
|
45
|
+
await e(`${t}.__update`, {
|
|
46
|
+
object_ids: [n],
|
|
47
|
+
entity: t,
|
|
48
|
+
fields: { $properties: [{
|
|
49
|
+
property_code: r,
|
|
50
|
+
value: null
|
|
51
|
+
}] }
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/hooks/useProperties.ts
|
|
56
|
+
function c(e, i) {
|
|
57
|
+
let a = r();
|
|
58
|
+
return n({
|
|
59
|
+
mutationFn: ({ propertyCode: t, value: n }) => o(e, i, t, n),
|
|
60
|
+
onSuccess: () => {
|
|
61
|
+
a.invalidateQueries({ queryKey: ["entity-item", e] });
|
|
62
|
+
},
|
|
63
|
+
onError: (e) => {
|
|
64
|
+
t.error(e.message);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function l(e, i) {
|
|
69
|
+
let a = r();
|
|
70
|
+
return n({
|
|
71
|
+
mutationFn: (t) => s(e, i, t),
|
|
72
|
+
onSuccess: () => {
|
|
73
|
+
a.invalidateQueries({ queryKey: ["entity-item", e] });
|
|
74
|
+
},
|
|
75
|
+
onError: (e) => {
|
|
76
|
+
t.error(e.message);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
export { c as n, a as r, l as t };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Dn as e, Gt as t, Kt as n, bt as r, mn as i, pn as a, pt as o, zn as s } from "./useCurrentScreen-C5Oio-1G.js";
|
|
2
|
+
import { F as c } from "./field-classification-DTgUnbzd.js";
|
|
3
3
|
import { useEffect as l, useLayoutEffect as u, useMemo as d } from "react";
|
|
4
4
|
import { useSearchParams as f } from "react-router";
|
|
5
|
-
import { useInfiniteQuery as p,
|
|
5
|
+
import { useInfiniteQuery as p, useQueryClient as m } from "@tanstack/react-query";
|
|
6
6
|
//#region src/api/entities.ts
|
|
7
|
-
function
|
|
7
|
+
function h(e, t) {
|
|
8
8
|
return e.$statuses?.find((e) => e.group_code === t);
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function g(e, t) {
|
|
11
11
|
return e.$properties?.find((e) => e.property_code === t);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function _(e) {
|
|
14
14
|
let t = { ...e };
|
|
15
|
-
return t.$status = (e) =>
|
|
15
|
+
return t.$status = (e) => h(t, e), t.$property = (e) => g(t, e), t;
|
|
16
16
|
}
|
|
17
|
-
var
|
|
17
|
+
var v = class {
|
|
18
18
|
cache = {};
|
|
19
19
|
merge(e) {
|
|
20
20
|
if (e) for (let t of Object.keys(e)) {
|
|
@@ -36,32 +36,32 @@ var y = class {
|
|
|
36
36
|
this.cache = {};
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
function
|
|
39
|
+
function y(e, t) {
|
|
40
40
|
let n = new URL(`/api/data/${e}`, window.location.origin);
|
|
41
41
|
return t.select && t.select.length > 0 && n.searchParams.set("select", t.select.join(",")), t.expand && t.expand.length > 0 && n.searchParams.set("expand", t.expand.join(",")), t.sort && n.searchParams.set("sort", t.sort), t.search && n.searchParams.set("search", t.search), t.limit && n.searchParams.set("limit", String(t.limit)), t.after && n.searchParams.set("after", t.after), t.count && n.searchParams.set("count", "with"), t.screen && n.searchParams.set("screen", t.screen), t.preview && n.searchParams.set("preview", "true"), t.include_deleted && n.searchParams.set("include_deleted", "true"), t.filters && t.filters.length > 0 && n.searchParams.set("filters", JSON.stringify(t.filters)), n.pathname + n.search;
|
|
42
42
|
}
|
|
43
|
-
var
|
|
43
|
+
var b = class {
|
|
44
44
|
entity;
|
|
45
45
|
refs;
|
|
46
46
|
constructor(e, t) {
|
|
47
|
-
this.entity = e, this.refs = t ?? new
|
|
47
|
+
this.entity = e, this.refs = t ?? new v();
|
|
48
48
|
}
|
|
49
|
-
async get(
|
|
50
|
-
let n = new URLSearchParams(typeof
|
|
51
|
-
return
|
|
49
|
+
async get(e) {
|
|
50
|
+
let n = new URLSearchParams(typeof e == "string" ? { id: e } : e);
|
|
51
|
+
return _((await t(`/api/data/${this.entity}?${n.toString()}`)).data);
|
|
52
52
|
}
|
|
53
|
-
async list(
|
|
53
|
+
async list(e = {}) {
|
|
54
54
|
let n, r = !1;
|
|
55
55
|
try {
|
|
56
|
-
n = await
|
|
57
|
-
} catch (
|
|
58
|
-
if (
|
|
59
|
-
let { after: i, ...a } =
|
|
60
|
-
n = await
|
|
61
|
-
} else throw
|
|
56
|
+
n = await t(y(this.entity, e));
|
|
57
|
+
} catch (a) {
|
|
58
|
+
if (e.after && i(a)) {
|
|
59
|
+
let { after: i, ...a } = e;
|
|
60
|
+
n = await t(y(this.entity, a)), r = !0;
|
|
61
|
+
} else throw a;
|
|
62
62
|
}
|
|
63
63
|
return this.refs.merge(n.$refs), {
|
|
64
|
-
data: n.data.map((e) =>
|
|
64
|
+
data: n.data.map((e) => _(e)),
|
|
65
65
|
meta: n.meta,
|
|
66
66
|
$refs: this.refs.all(),
|
|
67
67
|
reset: r
|
|
@@ -72,17 +72,17 @@ var x = class {
|
|
|
72
72
|
}
|
|
73
73
|
async createMany(e) {
|
|
74
74
|
if (e.length === 0) return [];
|
|
75
|
-
let
|
|
75
|
+
let t = e.map((e) => ({
|
|
76
76
|
action: `${this.entity}.__create`,
|
|
77
77
|
params: {
|
|
78
78
|
entity: this.entity,
|
|
79
79
|
fields: e
|
|
80
80
|
}
|
|
81
|
-
})), r = await
|
|
82
|
-
actions:
|
|
81
|
+
})), r = await n("system.batch", {
|
|
82
|
+
actions: t,
|
|
83
83
|
atomic: !0
|
|
84
84
|
});
|
|
85
|
-
return
|
|
85
|
+
return x(r, `${this.entity}.__create`), r.results.map((e) => _(S(e)));
|
|
86
86
|
}
|
|
87
87
|
async update(e, t) {
|
|
88
88
|
return (await this.updateMany([{
|
|
@@ -92,24 +92,24 @@ var x = class {
|
|
|
92
92
|
}
|
|
93
93
|
async updateMany(e) {
|
|
94
94
|
if (e.length === 0) return [];
|
|
95
|
-
let
|
|
95
|
+
let t = e.map(({ id: e, ...t }) => ({
|
|
96
96
|
action: `${this.entity}.__update`,
|
|
97
97
|
params: {
|
|
98
98
|
object_ids: [e],
|
|
99
99
|
entity: this.entity,
|
|
100
100
|
fields: t
|
|
101
101
|
}
|
|
102
|
-
})), r = await
|
|
103
|
-
actions:
|
|
102
|
+
})), r = await n("system.batch", {
|
|
103
|
+
actions: t,
|
|
104
104
|
atomic: !0
|
|
105
105
|
});
|
|
106
|
-
return
|
|
106
|
+
return x(r, `${this.entity}.__update`), r.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 r(`${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 r(`${this.entity}.__restore`, {
|
|
122
122
|
object_ids: e,
|
|
123
123
|
entity: this.entity
|
|
124
124
|
})).object_count ?? e.length };
|
|
@@ -126,42 +126,42 @@ var x = class {
|
|
|
126
126
|
async upsert(e, t) {
|
|
127
127
|
return (await this.upsertMany([e], t))[0];
|
|
128
128
|
}
|
|
129
|
-
async upsertMany(e,
|
|
129
|
+
async upsertMany(e, t) {
|
|
130
130
|
if (e.length === 0) return [];
|
|
131
131
|
let r = e.map((e) => ({
|
|
132
132
|
action: `${this.entity}.__upsert`,
|
|
133
133
|
params: {
|
|
134
134
|
entity: this.entity,
|
|
135
135
|
fields: e,
|
|
136
|
-
unique_by:
|
|
136
|
+
unique_by: t
|
|
137
137
|
}
|
|
138
|
-
})), i = await
|
|
138
|
+
})), i = await n("system.batch", {
|
|
139
139
|
actions: r,
|
|
140
140
|
atomic: !0
|
|
141
141
|
});
|
|
142
|
-
return
|
|
142
|
+
return x(i, `${this.entity}.__upsert`), i.results.map((e) => _(C(e)));
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
|
-
function
|
|
145
|
+
function x(e, t) {
|
|
146
146
|
if (e.committed) return;
|
|
147
|
-
let n = e.results.find((e) => !e.ok), r = n ? `${n.
|
|
147
|
+
let n = e.results.find((e) => !e.ok), r = n?.error ? `${a(n.error.type)}: ${n.error.title}` : "batch did not commit";
|
|
148
148
|
throw Error(`${t} batch failed: ${r}`);
|
|
149
149
|
}
|
|
150
|
-
function
|
|
150
|
+
function S(e) {
|
|
151
151
|
let t = e.result ?? {};
|
|
152
152
|
return (Array.isArray(t.rows) ? t.rows[0] : void 0) ?? {};
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function C(e) {
|
|
155
155
|
let t = e.result ?? {};
|
|
156
156
|
return (Array.isArray(t.rows) ? t.rows[0] : void 0)?.row ?? {};
|
|
157
157
|
}
|
|
158
|
-
function
|
|
159
|
-
return new
|
|
158
|
+
function w(e, t) {
|
|
159
|
+
return new b(e, t);
|
|
160
160
|
}
|
|
161
161
|
//#endregion
|
|
162
162
|
//#region src/hooks/useCursorEntityData.ts
|
|
163
|
-
var
|
|
164
|
-
function
|
|
163
|
+
var T = "entity-data-cursor";
|
|
164
|
+
function E(e) {
|
|
165
165
|
return JSON.stringify({
|
|
166
166
|
sort: e.sort,
|
|
167
167
|
filters: e.filters,
|
|
@@ -174,16 +174,16 @@ function D(e) {
|
|
|
174
174
|
limit: e.limit
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
|
-
function
|
|
177
|
+
function D(e, t) {
|
|
178
178
|
return [
|
|
179
|
-
|
|
179
|
+
T,
|
|
180
180
|
e,
|
|
181
|
-
|
|
181
|
+
E(t)
|
|
182
182
|
];
|
|
183
183
|
}
|
|
184
|
-
function
|
|
185
|
-
let r =
|
|
186
|
-
|
|
184
|
+
function O(e, t, n) {
|
|
185
|
+
let r = m(), i = d(() => new b(e ?? ""), [e]), a = d(() => E(t), [t]), o = d(() => [
|
|
186
|
+
T,
|
|
187
187
|
e,
|
|
188
188
|
a
|
|
189
189
|
], [e, a]), s = p({
|
|
@@ -213,13 +213,13 @@ function k(e, t, n) {
|
|
|
213
213
|
r,
|
|
214
214
|
o
|
|
215
215
|
]);
|
|
216
|
-
let f = d(() => (s.data?.pages ?? []).flatMap((e) => e.data), [s.data?.pages]),
|
|
216
|
+
let f = d(() => (s.data?.pages ?? []).flatMap((e) => e.data), [s.data?.pages]), h = s.data?.pages?.[0]?.meta;
|
|
217
217
|
return {
|
|
218
218
|
rows: f,
|
|
219
219
|
refs: s.data?.pages?.[s.data.pages.length - 1]?.$refs,
|
|
220
|
-
total:
|
|
221
|
-
countMode:
|
|
222
|
-
countUnknown:
|
|
220
|
+
total: h && !h.count_unknown ? h.total : void 0,
|
|
221
|
+
countMode: h?.count_mode,
|
|
222
|
+
countUnknown: h?.count_unknown ?? !1,
|
|
223
223
|
hasMore: s.hasNextPage,
|
|
224
224
|
fetchNextPage: s.fetchNextPage,
|
|
225
225
|
isFetchingNextPage: s.isFetchingNextPage,
|
|
@@ -231,45 +231,8 @@ function k(e, t, n) {
|
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
233
|
//#endregion
|
|
234
|
-
//#region src/hooks/useTabSearchMirror.ts
|
|
235
|
-
function A(e) {
|
|
236
|
-
let t = o(), [n] = f();
|
|
237
|
-
u(() => {
|
|
238
|
-
if (!e || t.enabled) return;
|
|
239
|
-
let r = c.getState(), i = r.findTabByPathname(e);
|
|
240
|
-
i && r.updateTabSearch(i.id, n.toString());
|
|
241
|
-
}, [
|
|
242
|
-
n,
|
|
243
|
-
e,
|
|
244
|
-
t.enabled
|
|
245
|
-
]);
|
|
246
|
-
}
|
|
247
|
-
//#endregion
|
|
248
|
-
//#region src/hooks/useRegisterScreenTab.ts
|
|
249
|
-
function j(e, t, n, r) {
|
|
250
|
-
let i = o();
|
|
251
|
-
l(() => {
|
|
252
|
-
!e || i.enabled || c.getState().openTab({
|
|
253
|
-
pathname: e,
|
|
254
|
-
search: r,
|
|
255
|
-
title: t,
|
|
256
|
-
icon: n,
|
|
257
|
-
closable: !0
|
|
258
|
-
});
|
|
259
|
-
}, [
|
|
260
|
-
e,
|
|
261
|
-
t,
|
|
262
|
-
n,
|
|
263
|
-
i.enabled
|
|
264
|
-
]);
|
|
265
|
-
}
|
|
266
|
-
function M(e, t, n) {
|
|
267
|
-
let i = e?.route, a = t ? r(e?.display?.name) || r(t.display.name_plural) : "", o = e?.display?.icon || t?.display.icon;
|
|
268
|
-
j(t ? i : void 0, a, o, n);
|
|
269
|
-
}
|
|
270
|
-
//#endregion
|
|
271
234
|
//#region src/lib/filters.ts
|
|
272
|
-
var
|
|
235
|
+
var k = /* @__PURE__ */ new Set([
|
|
273
236
|
"is_empty",
|
|
274
237
|
"is_not_empty",
|
|
275
238
|
"today",
|
|
@@ -279,7 +242,7 @@ var N = /* @__PURE__ */ new Set([
|
|
|
279
242
|
"last_30_days",
|
|
280
243
|
"last_hour",
|
|
281
244
|
"last_24_hours"
|
|
282
|
-
]),
|
|
245
|
+
]), A = /* @__PURE__ */ new Set(["in", "not_in"]), j = {
|
|
283
246
|
eq: "is",
|
|
284
247
|
not_eq: "is not",
|
|
285
248
|
gt: ">",
|
|
@@ -301,7 +264,7 @@ var N = /* @__PURE__ */ new Set([
|
|
|
301
264
|
last_hour: "last hour",
|
|
302
265
|
last_24_hours: "last 24 hours"
|
|
303
266
|
};
|
|
304
|
-
function
|
|
267
|
+
function M(e) {
|
|
305
268
|
let t = e.get("filters");
|
|
306
269
|
if (t == null || t === "") return {
|
|
307
270
|
filters: [],
|
|
@@ -309,7 +272,7 @@ function I(e) {
|
|
|
309
272
|
};
|
|
310
273
|
try {
|
|
311
274
|
return {
|
|
312
|
-
filters:
|
|
275
|
+
filters: N(e),
|
|
313
276
|
error: null
|
|
314
277
|
};
|
|
315
278
|
} catch (e) {
|
|
@@ -319,7 +282,7 @@ function I(e) {
|
|
|
319
282
|
};
|
|
320
283
|
}
|
|
321
284
|
}
|
|
322
|
-
function
|
|
285
|
+
function N(e) {
|
|
323
286
|
let t = e.get("filters");
|
|
324
287
|
if (t == null || t === "") return [];
|
|
325
288
|
let n;
|
|
@@ -328,48 +291,48 @@ function L(e) {
|
|
|
328
291
|
} catch {
|
|
329
292
|
throw Error("The filters URL value is not valid JSON.");
|
|
330
293
|
}
|
|
331
|
-
if (!Array.isArray(n) || !n.every(
|
|
294
|
+
if (!Array.isArray(n) || !n.every(V)) throw Error("The filters URL value is not a valid filter tree.");
|
|
332
295
|
return n;
|
|
333
296
|
}
|
|
334
|
-
function
|
|
297
|
+
function P(e, t) {
|
|
335
298
|
e.length === 0 ? t.delete("filters") : t.set("filters", JSON.stringify(e));
|
|
336
299
|
}
|
|
337
|
-
function
|
|
338
|
-
return e.some((e) => !e || typeof e != "object" ? !1 : e.or != null || e.and != null &&
|
|
300
|
+
function F(e) {
|
|
301
|
+
return e.some((e) => !e || typeof e != "object" ? !1 : e.or != null || e.and != null && F(e.and));
|
|
339
302
|
}
|
|
340
|
-
function
|
|
303
|
+
function I(e) {
|
|
341
304
|
let t = [];
|
|
342
|
-
for (let n of e) !n || typeof n != "object" || (n.field && n.op && t.push(n), n.or && t.push(...
|
|
305
|
+
for (let n of e) !n || typeof n != "object" || (n.field && n.op && t.push(n), n.or && t.push(...I(n.or)), n.and && t.push(...I(n.and)));
|
|
343
306
|
return t;
|
|
344
307
|
}
|
|
345
|
-
function
|
|
346
|
-
return
|
|
308
|
+
function L(e) {
|
|
309
|
+
return I(e).length;
|
|
347
310
|
}
|
|
348
|
-
function
|
|
311
|
+
function R(e, t) {
|
|
349
312
|
if (!e.field || !e.op) return "";
|
|
350
|
-
let
|
|
351
|
-
if (
|
|
352
|
-
let
|
|
313
|
+
let n = j[e.op] || e.op;
|
|
314
|
+
if (k.has(e.op)) return `${n}`;
|
|
315
|
+
let r = e.field, i = (e) => {
|
|
353
316
|
if (t) {
|
|
354
|
-
let n = t(
|
|
317
|
+
let n = t(r, e);
|
|
355
318
|
return n.label != null && (n.status === "special" || n.status === "resolved") ? n.label : n.raw;
|
|
356
319
|
}
|
|
357
|
-
return
|
|
320
|
+
return s(e);
|
|
358
321
|
};
|
|
359
|
-
return `${
|
|
322
|
+
return `${n} ${Array.isArray(e.value) ? e.value.map(i).join(", ") : i(e.value)}`;
|
|
360
323
|
}
|
|
361
|
-
function
|
|
324
|
+
function z(e, t) {
|
|
362
325
|
return {
|
|
363
326
|
field: e,
|
|
364
327
|
op: "eq",
|
|
365
328
|
value: t
|
|
366
329
|
};
|
|
367
330
|
}
|
|
368
|
-
function
|
|
331
|
+
function B(e, t) {
|
|
369
332
|
let n = [];
|
|
370
333
|
for (let r of e) if (!(!r || typeof r != "object") && r.field !== t) {
|
|
371
334
|
if (r.or) {
|
|
372
|
-
let e =
|
|
335
|
+
let e = B(r.or, t);
|
|
373
336
|
e.length > 0 && n.push({
|
|
374
337
|
...r,
|
|
375
338
|
or: e
|
|
@@ -377,7 +340,7 @@ function W(e, t) {
|
|
|
377
340
|
continue;
|
|
378
341
|
}
|
|
379
342
|
if (r.and) {
|
|
380
|
-
let e =
|
|
343
|
+
let e = B(r.and, t);
|
|
381
344
|
e.length > 0 && n.push({
|
|
382
345
|
...r,
|
|
383
346
|
and: e
|
|
@@ -388,97 +351,56 @@ function W(e, t) {
|
|
|
388
351
|
}
|
|
389
352
|
return n;
|
|
390
353
|
}
|
|
391
|
-
function
|
|
354
|
+
function V(e) {
|
|
392
355
|
if (typeof e != "object" || !e || Array.isArray(e)) return !1;
|
|
393
356
|
let t = e, n = Object.prototype.hasOwnProperty.call(t, "field"), r = Object.prototype.hasOwnProperty.call(t, "op"), i = Object.prototype.hasOwnProperty.call(t, "value"), a = Object.prototype.hasOwnProperty.call(t, "or"), o = Object.prototype.hasOwnProperty.call(t, "and");
|
|
394
357
|
if (a && o) return !1;
|
|
395
358
|
if (a || o) {
|
|
396
359
|
if (n || r || i) return !1;
|
|
397
360
|
let e = a ? t.or : t.and;
|
|
398
|
-
return Array.isArray(e) && e.length > 0 && e.every(
|
|
361
|
+
return Array.isArray(e) && e.length > 0 && e.every(V);
|
|
399
362
|
}
|
|
400
|
-
if (!(n && r && typeof t.field == "string" && t.field.length > 0 && typeof t.op == "string" &&
|
|
363
|
+
if (!(n && r && typeof t.field == "string" && t.field.length > 0 && typeof t.op == "string" && H.has(t.op))) return !1;
|
|
401
364
|
let s = t.op;
|
|
402
|
-
return
|
|
403
|
-
}
|
|
404
|
-
var K = new Set(Object.keys(F));
|
|
405
|
-
//#endregion
|
|
406
|
-
//#region src/api/status.ts
|
|
407
|
-
async function q(e, t, n, r, a) {
|
|
408
|
-
let o = {
|
|
409
|
-
status_group_code: n,
|
|
410
|
-
status_code: r
|
|
411
|
-
};
|
|
412
|
-
a != null && (o.note = a);
|
|
413
|
-
let s = (await i(`${e}.__update`, {
|
|
414
|
-
object_ids: [t],
|
|
415
|
-
entity: e,
|
|
416
|
-
fields: { $statuses: [o] }
|
|
417
|
-
})).result?.rows?.[0]?.$statuses ?? [];
|
|
418
|
-
return s.find((e) => e.group_code === n) ?? s[0];
|
|
365
|
+
return k.has(s) ? !i || t.value === null : i && t.value !== null;
|
|
419
366
|
}
|
|
367
|
+
var H = new Set(Object.keys(j));
|
|
420
368
|
//#endregion
|
|
421
|
-
//#region src/hooks/
|
|
422
|
-
function
|
|
423
|
-
let
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
object_ids: [t],
|
|
439
|
-
entity: e,
|
|
440
|
-
fields: { $properties: [{
|
|
441
|
-
property_code: n,
|
|
442
|
-
value: r
|
|
443
|
-
}] }
|
|
444
|
-
})).result?.rows?.[0]?.$properties ?? [];
|
|
445
|
-
return a.find((e) => e.property_code === n) ?? a[0];
|
|
369
|
+
//#region src/hooks/useRegisterScreenTab.ts
|
|
370
|
+
function U(e, t, n, r) {
|
|
371
|
+
let i = o();
|
|
372
|
+
l(() => {
|
|
373
|
+
!e || i.enabled || c.getState().openTab({
|
|
374
|
+
pathname: e,
|
|
375
|
+
search: r,
|
|
376
|
+
title: t,
|
|
377
|
+
icon: n,
|
|
378
|
+
closable: !0
|
|
379
|
+
});
|
|
380
|
+
}, [
|
|
381
|
+
e,
|
|
382
|
+
t,
|
|
383
|
+
n,
|
|
384
|
+
i.enabled
|
|
385
|
+
]);
|
|
446
386
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
entity: e,
|
|
451
|
-
fields: { $properties: [{
|
|
452
|
-
property_code: n,
|
|
453
|
-
value: null
|
|
454
|
-
}] }
|
|
455
|
-
});
|
|
387
|
+
function W(t, n, r) {
|
|
388
|
+
let i = t?.route, a = n ? e(t?.display?.name) || e(n.display.name_plural) : "", o = t?.display?.icon || n?.display.icon;
|
|
389
|
+
U(n ? i : void 0, a, o, r);
|
|
456
390
|
}
|
|
457
391
|
//#endregion
|
|
458
|
-
//#region src/hooks/
|
|
459
|
-
function
|
|
460
|
-
let n =
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
}
|
|
471
|
-
function Q(e, t) {
|
|
472
|
-
let n = h();
|
|
473
|
-
return m({
|
|
474
|
-
mutationFn: (n) => X(e, t, n),
|
|
475
|
-
onSuccess: () => {
|
|
476
|
-
n.invalidateQueries({ queryKey: ["entity-item", e] });
|
|
477
|
-
},
|
|
478
|
-
onError: (e) => {
|
|
479
|
-
s.error(e.message);
|
|
480
|
-
}
|
|
481
|
-
});
|
|
392
|
+
//#region src/hooks/useTabSearchMirror.ts
|
|
393
|
+
function G(e) {
|
|
394
|
+
let t = o(), [n] = f();
|
|
395
|
+
u(() => {
|
|
396
|
+
if (!e || t.enabled) return;
|
|
397
|
+
let r = c.getState(), i = r.findTabByPathname(e);
|
|
398
|
+
i && r.updateTabSearch(i.id, n.toString());
|
|
399
|
+
}, [
|
|
400
|
+
n,
|
|
401
|
+
e,
|
|
402
|
+
t.enabled
|
|
403
|
+
]);
|
|
482
404
|
}
|
|
483
405
|
//#endregion
|
|
484
|
-
export {
|
|
406
|
+
export { w as S, D as _, k as a, b, z as c, F as d, M as f, T as g, P as h, A as i, I as l, B as m, W as n, j as o, N as p, U as r, L as s, G as t, R as u, E as v, v as x, O as y };
|