@declarion/react 0.87.0 → 0.89.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/app.js +28 -28
- package/dist-lib/components/actions/ActionButton.js +86 -85
- package/dist-lib/components/actions/ActionResultDialog.impl.js +47 -47
- package/dist-lib/components/actions/ActionRunner.js +47 -47
- package/dist-lib/components/actions/ObjectActionBar.js +9 -9
- package/dist-lib/components/actions/RowActionsKebab.js +19 -19
- package/dist-lib/components/agents/AgentChatPanel.impl.js +53 -53
- package/dist-lib/components/chrome/AssociationTabs.js +21 -21
- package/dist-lib/components/chrome/RecordHeader.js +33 -40
- package/dist-lib/components/detail-layout/AssociatedBlock.js +387 -381
- package/dist-lib/components/detail-layout/ChildrenBlock.js +12 -13
- package/dist-lib/components/detail-layout/ChildrenTimeline.js +198 -198
- package/dist-lib/components/detail-layout/DraggableChildrenTable.js +114 -114
- package/dist-lib/components/detail-layout/EditableChildrenTable.js +160 -160
- package/dist-lib/components/detail-layout/EvidenceBlock.js +20 -21
- package/dist-lib/components/detail-layout/PropertiesBlock.js +45 -39
- package/dist-lib/components/detail-layout/QuickAddForm.js +9 -9
- package/dist-lib/components/detail-layout/TimelineComposer.js +87 -89
- package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +100 -99
- package/dist-lib/components/fields/FileReferenceField.js +9 -9
- package/dist-lib/components/fields/StructureField.js +57 -47
- package/dist-lib/components/fields/TimestampField.js +59 -54
- package/dist-lib/components/fields/cells/factories/money.js +14 -23
- package/dist-lib/components/fields/cells/factories/nextRun.js +1 -1
- package/dist-lib/components/fields/cells/factories/text.js +18 -3
- package/dist-lib/components/fields/cells/factories/timestamp.js +24 -12
- package/dist-lib/components/file-widgets/DocumentCard.js +108 -106
- package/dist-lib/components/layout/Layout.js +306 -361
- package/dist-lib/components/layout/Rail.js +42 -41
- package/dist-lib/components/layout/Sidebar.js +132 -117
- package/dist-lib/components/layout/TabStrip.js +116 -115
- package/dist-lib/components/layout/TenantChip.js +47 -54
- package/dist-lib/components/layout/TopBar.js +108 -105
- package/dist-lib/components/list/InlineEditCell.js +23 -23
- package/dist-lib/components/list/QuickPeek.js +65 -66
- package/dist-lib/components/pages/DocumentsMenu.js +42 -42
- package/dist-lib/components/pages/ExportMenu.js +25 -25
- package/dist-lib/components/pages/RecordDocumentsPanel.js +35 -35
- package/dist-lib/components/pages/RecordNotesPanel.js +94 -93
- package/dist-lib/components/pages/SmartDetailPage.impl.js +421 -417
- package/dist-lib/components/pages/SmartListPage.impl.js +293 -295
- package/dist-lib/components/pages/SmartRecordListPage.impl.js +310 -310
- package/dist-lib/components/pages/auth/AuthShell.js +73 -73
- package/dist-lib/components/pages/auth/SignIn.js +32 -32
- package/dist-lib/components/pages/auth/SignUp.impl.js +3 -3
- package/dist-lib/components/pages/auth/SignUpCode.js +9 -9
- package/dist-lib/components/pages/list/ListFloatbar.js +12 -12
- package/dist-lib/components/pages/list/ListHeader.js +19 -19
- package/dist-lib/components/pages/list/ListNoRows.js +15 -15
- package/dist-lib/components/pages/list/ListToolbar.js +145 -145
- package/dist-lib/components/pages/list/useActiveView.js +14 -5
- package/dist-lib/components/pages/list/useListQuery.js +121 -81
- package/dist-lib/components/pages/list/useListRowInteraction.js +70 -70
- package/dist-lib/components/pages/list/useRowMenu.js +7 -7
- package/dist-lib/components/pages/profile/Preferences.impl.js +81 -78
- package/dist-lib/components/pages/profile/Profile.impl.js +191 -189
- package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +166 -158
- package/dist-lib/components/shared/ChangePasswordDialog.impl.js +23 -23
- package/dist-lib/components/shared/MarkdownRenderer.js +9 -9
- package/dist-lib/hooks/useAuth.js +11 -11
- package/dist-lib/hooks/useBranding.js +4 -4
- package/dist-lib/hooks/useDisplayTimeZone.js +8 -0
- package/dist-lib/hooks/useFollowAgentOpen.js +24 -24
- package/dist-lib/hooks/useImpersonation.js +6 -6
- package/dist-lib/hooks/useMutations.js +23 -23
- package/dist-lib/hooks/useObjectStatus.js +5 -5
- package/dist-lib/hooks/useParams.js +59 -51
- package/dist-lib/hooks/useProperties.js +8 -8
- package/dist-lib/hooks/useRowTenant.js +18 -6
- package/dist-lib/hooks/useText.js +9 -7
- package/dist-lib/hooks/useUiPreferences.js +71 -0
- package/dist-lib/index.d.ts +22 -6
- package/dist-lib/index.js +127 -126
- package/dist-lib/lib/actions.js +116 -84
- package/dist-lib/lib/child-config.js +10 -1
- package/dist-lib/lib/format-count.js +16 -1
- package/dist-lib/lib/language.js +23 -21
- package/dist-lib/lib/money-text.js +29 -0
- package/dist-lib/lib/profile.js +4 -0
- package/dist-lib/lib/role-label.js +8 -0
- package/dist-lib/lib/schema-routing.js +34 -14
- package/dist-lib/lib/shortcut.js +10 -0
- package/dist-lib/lib/timestamp.js +93 -31
- package/dist-lib/stores/auth.js +9 -8
- package/dist-lib/stores/preferences.js +56 -17
- package/dist-lib/testing.d.ts +1 -1
- package/dist-lib/testing.js +25 -28
- package/dist-lib/types/schema.js +33 -27
- package/dist-lib/{useResponsiveMode-D3SKz5z4.d.ts → useResponsiveMode-9_eJT18k.d.ts} +5 -5
- package/package.json +1 -1
|
@@ -4,71 +4,133 @@ import { formatISO as n } from "date-fns";
|
|
|
4
4
|
function r(e = /* @__PURE__ */ new Date()) {
|
|
5
5
|
return n(e);
|
|
6
6
|
}
|
|
7
|
-
function i(e, t, n) {
|
|
8
|
-
let
|
|
9
|
-
if (isNaN(
|
|
10
|
-
if (
|
|
7
|
+
function i(e, t, n, r = a()) {
|
|
8
|
+
let i = e.match(/([+-]\d{2}:\d{2})$/), o = e.endsWith("Z"), s = new Date(e);
|
|
9
|
+
if (isNaN(s.getTime())) return e;
|
|
10
|
+
if (i || o) {
|
|
11
11
|
let e;
|
|
12
|
-
if (
|
|
13
|
-
else if (
|
|
14
|
-
let t =
|
|
15
|
-
parseInt(
|
|
12
|
+
if (o) e = r;
|
|
13
|
+
else if (i) {
|
|
14
|
+
let t = i[1].charAt(0), n = parseInt(i[1].substring(1, 3), 10);
|
|
15
|
+
parseInt(i[1].substring(4, 6), 10) === 0 && (e = n === 0 ? "UTC" : `Etc/GMT${t === "+" ? "-" : "+"}${n}`);
|
|
16
16
|
}
|
|
17
17
|
if (e) try {
|
|
18
18
|
return new Intl.DateTimeFormat(n, {
|
|
19
19
|
...t,
|
|
20
20
|
timeZone: e
|
|
21
|
-
}).format(
|
|
21
|
+
}).format(s);
|
|
22
22
|
} catch {}
|
|
23
|
-
if (
|
|
24
|
-
let e =
|
|
23
|
+
if (i) {
|
|
24
|
+
let e = i[1].charAt(0) === "+" ? 1 : -1, r = parseInt(i[1].substring(1, 3), 10), a = parseInt(i[1].substring(4, 6), 10), o = e * (r * 60 + a) * 60 * 1e3;
|
|
25
25
|
return new Intl.DateTimeFormat(n, {
|
|
26
26
|
...t,
|
|
27
27
|
timeZone: "UTC"
|
|
28
|
-
}).format(new Date(
|
|
28
|
+
}).format(new Date(s.getTime() + o));
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
return new Intl.DateTimeFormat(n, t).format(
|
|
31
|
+
return new Intl.DateTimeFormat(n, t).format(s);
|
|
32
32
|
}
|
|
33
|
-
function a(
|
|
34
|
-
return
|
|
33
|
+
function a() {
|
|
34
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
|
|
35
|
+
}
|
|
36
|
+
function o(e) {
|
|
37
|
+
return e && s(e) ? e : a();
|
|
38
|
+
}
|
|
39
|
+
function s(e) {
|
|
40
|
+
try {
|
|
41
|
+
return new Intl.DateTimeFormat("en-US", { timeZone: e }), !0;
|
|
42
|
+
} catch {
|
|
43
|
+
return !1;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function c(e) {
|
|
47
|
+
return e.declared ? "UTC" : o(e.zone);
|
|
48
|
+
}
|
|
49
|
+
function l(e, t = {}) {
|
|
50
|
+
let n = c(t), r = i(e, {
|
|
35
51
|
day: "2-digit",
|
|
36
52
|
month: "2-digit",
|
|
37
53
|
year: "numeric",
|
|
38
54
|
hour: "2-digit",
|
|
39
55
|
minute: "2-digit",
|
|
40
56
|
hour12: !1
|
|
41
|
-
}, "en-GB").replace(/\//g, "-").replace(",", "");
|
|
57
|
+
}, "en-GB", n).replace(/\//g, "-").replace(",", ""), a = d(e, n);
|
|
58
|
+
return a && r !== e ? `${r} ${a}` : r;
|
|
59
|
+
}
|
|
60
|
+
function u(t, n = {}) {
|
|
61
|
+
if (e.test(t)) return t;
|
|
62
|
+
let r = l(t, n), i = /^(\d{2})-(\d{2})-(\d{4}) /.exec(r);
|
|
63
|
+
return i ? `${i[3]}-${i[2]}-${i[1]}` : null;
|
|
64
|
+
}
|
|
65
|
+
function d(e, t = a()) {
|
|
66
|
+
let n = e.match(/([+-])(\d{2}):(\d{2})$/);
|
|
67
|
+
if (n) return f(n[1], Number(n[2]), Number(n[3]));
|
|
68
|
+
let r = new Date(e);
|
|
69
|
+
if (isNaN(r.getTime()) || e.endsWith("Z") && !s(t)) return "";
|
|
70
|
+
let i = new Intl.DateTimeFormat("en-US", e.endsWith("Z") ? {
|
|
71
|
+
timeZone: t,
|
|
72
|
+
timeZoneName: "longOffset"
|
|
73
|
+
} : { timeZoneName: "longOffset" }).formatToParts(r).find((e) => e.type === "timeZoneName")?.value.match(/^GMT(?:([+-])(\d{2}):(\d{2}))?$/);
|
|
74
|
+
return i ? i[1] ? f(i[1], Number(i[2]), Number(i[3])) : "UTC" : "";
|
|
75
|
+
}
|
|
76
|
+
function f(e, t, n) {
|
|
77
|
+
return t === 0 && n === 0 ? "UTC" : `UTC${e}${t}${n ? `:${String(n).padStart(2, "0")}` : ""}`;
|
|
78
|
+
}
|
|
79
|
+
var p = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}/, m = 6e4, h = 864e5;
|
|
80
|
+
function g(e, t) {
|
|
81
|
+
let n = new Intl.DateTimeFormat("en-US", {
|
|
82
|
+
timeZone: t,
|
|
83
|
+
timeZoneName: "longOffset"
|
|
84
|
+
}).formatToParts(new Date(e)).find((e) => e.type === "timeZoneName")?.value ?? "GMT", r = /^GMT([+-])(\d{2}):(\d{2})$/.exec(n);
|
|
85
|
+
return r ? (r[1] === "+" ? 1 : -1) * (Number(r[2]) * 60 + Number(r[3])) : 0;
|
|
86
|
+
}
|
|
87
|
+
function _(e) {
|
|
88
|
+
let t = e < 0 ? "-" : "+", n = Math.abs(e);
|
|
89
|
+
return `${t}${String(Math.floor(n / 60)).padStart(2, "0")}:${String(n % 60).padStart(2, "0")}`;
|
|
90
|
+
}
|
|
91
|
+
function v(e, t = {}) {
|
|
92
|
+
if (!p.test(e)) return "";
|
|
93
|
+
let n = new Date(e);
|
|
94
|
+
if (isNaN(n.getTime())) return "";
|
|
95
|
+
let r = e.match(/([+-])(\d{2}):(\d{2})$/);
|
|
96
|
+
if (!r && !e.endsWith("Z")) return e.slice(0, 16).replace(" ", "T");
|
|
97
|
+
let i = r ? (r[1] === "+" ? 1 : -1) * (Number(r[2]) * 60 + Number(r[3])) : g(n.getTime(), c(t));
|
|
98
|
+
return new Date(n.getTime() + i * m).toISOString().slice(0, 16);
|
|
99
|
+
}
|
|
100
|
+
function y(e, t = {}) {
|
|
101
|
+
if (t.declared) return e;
|
|
102
|
+
let n = c(t), r = e.slice(0, 16), [i, a] = r.split("T"), [o, s, l] = i.split("-").map(Number), [u, d] = a.split(":").map(Number), f = Date.UTC(o, s - 1, l, u, d), p = g(f - h, n), v = [p, g(f + h, n)].filter((e) => g(f - e * m, n) === e);
|
|
103
|
+
return `${r}:00${_(v.length ? v.reduce((e, t) => f - e * m <= f - t * m ? e : t) : p)}`;
|
|
42
104
|
}
|
|
43
|
-
function
|
|
105
|
+
function b(t) {
|
|
44
106
|
let n = e.exec(t);
|
|
45
107
|
if (!n) return null;
|
|
46
108
|
let [, r, i, a] = n;
|
|
47
109
|
return new Date(Number(r), Number(i) - 1, Number(a));
|
|
48
110
|
}
|
|
49
|
-
function
|
|
50
|
-
if (
|
|
111
|
+
function x(e, n, r = /* @__PURE__ */ new Date(), i = {}) {
|
|
112
|
+
if (n == null || n === "") return {
|
|
51
113
|
text: "—",
|
|
52
114
|
absolute: ""
|
|
53
115
|
};
|
|
54
|
-
let
|
|
55
|
-
if (isNaN(
|
|
56
|
-
let e = String(
|
|
116
|
+
let a = typeof n == "string" ? b(n) : null, o = n instanceof Date ? n : a ?? new Date(String(n));
|
|
117
|
+
if (isNaN(o.getTime())) {
|
|
118
|
+
let e = String(n);
|
|
57
119
|
return {
|
|
58
120
|
text: e,
|
|
59
121
|
absolute: e
|
|
60
122
|
};
|
|
61
123
|
}
|
|
62
|
-
let
|
|
124
|
+
let s = typeof n == "string" ? n : o.toISOString(), c = t(a ? s : u(s, i) ?? "") ?? "", d = a ? c : l(s, i), f = r.getTime() - o.getTime();
|
|
63
125
|
return Math.abs(f) > 2592e6 ? {
|
|
64
|
-
text:
|
|
126
|
+
text: c,
|
|
65
127
|
absolute: d
|
|
66
128
|
} : {
|
|
67
|
-
text:
|
|
129
|
+
text: w(e, o, r),
|
|
68
130
|
absolute: d
|
|
69
131
|
};
|
|
70
132
|
}
|
|
71
|
-
var
|
|
133
|
+
var S = [
|
|
72
134
|
{
|
|
73
135
|
unit: "second",
|
|
74
136
|
ms: 1e3,
|
|
@@ -84,14 +146,14 @@ var c = [
|
|
|
84
146
|
ms: 36e5,
|
|
85
147
|
limit: 24
|
|
86
148
|
}
|
|
87
|
-
],
|
|
88
|
-
function
|
|
149
|
+
], C = 864e5;
|
|
150
|
+
function w(e, t, n) {
|
|
89
151
|
let r = t.getTime() - n.getTime(), i = new Intl.RelativeTimeFormat(e, { numeric: "always" }), a = (e) => r > 0 ? e : -e;
|
|
90
|
-
for (let { unit: e, ms: t, limit: n } of
|
|
152
|
+
for (let { unit: e, ms: t, limit: n } of S) {
|
|
91
153
|
let o = Math.round(Math.abs(r) / t);
|
|
92
154
|
if (o < n) return i.format(a(o), e);
|
|
93
155
|
}
|
|
94
|
-
return i.format(a(Math.round(Math.abs(r) /
|
|
156
|
+
return i.format(a(Math.round(Math.abs(r) / C)), "day");
|
|
95
157
|
}
|
|
96
158
|
//#endregion
|
|
97
|
-
export {
|
|
159
|
+
export { a as browserTimeZone, b as civilDateAsLocal, u as displayDay, v as editorWallClock, y as editorWireValue, i as formatInOffsetZone, l as formatOffsetTimestamp, x as formatRelativeOrAbsolute, r as formatWireDateTime, o as resolveTimeZone, d as zoneMark };
|
package/dist-lib/stores/auth.js
CHANGED
|
@@ -2,9 +2,10 @@ import { startOrderNow as e } from "../api/access-expiry.js";
|
|
|
2
2
|
import { cancelProactiveRefresh as t, ensureRefresh as n, publishLanguage as r, scheduleProactiveRefresh as i } from "../api/client.js";
|
|
3
3
|
import { getMe as a, listTenants as o, logout as s, probeSession as c } from "../api/auth.js";
|
|
4
4
|
import { warmRoutePages as l } from "../lib/capabilityPrefetch.js";
|
|
5
|
-
import {
|
|
5
|
+
import { usePreferencesStore as u } from "./preferences.js";
|
|
6
|
+
import { create as d } from "zustand";
|
|
6
7
|
//#region src/stores/auth.ts
|
|
7
|
-
async function
|
|
8
|
+
async function f(e, t, n) {
|
|
8
9
|
try {
|
|
9
10
|
let r = await n();
|
|
10
11
|
i(r.access_expires_at), e({
|
|
@@ -24,7 +25,7 @@ async function d(e, t, n) {
|
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
|
-
var
|
|
28
|
+
var p = d((r, i) => ({
|
|
28
29
|
user: null,
|
|
29
30
|
isAuthenticated: !1,
|
|
30
31
|
isLoading: !0,
|
|
@@ -34,9 +35,9 @@ var f = u((r, i) => ({
|
|
|
34
35
|
identitySince: 0,
|
|
35
36
|
initialize: async () => {
|
|
36
37
|
let t = e();
|
|
37
|
-
t === "refresh-first" && (t = await n().then(() => "first-wave", () => "probe-first")), r({ sessionPresumed: t === "first-wave" }), t === "first-wave" && l(), await
|
|
38
|
+
t === "refresh-first" && (t = await n().then(() => "first-wave", () => "probe-first")), r({ sessionPresumed: t === "first-wave" }), t === "first-wave" && l(), await f(r, i, c), t === "probe-first" && i().isAuthenticated && l();
|
|
38
39
|
},
|
|
39
|
-
reloadSession: () =>
|
|
40
|
+
reloadSession: () => f(r, i, a),
|
|
40
41
|
refreshMe: async () => {
|
|
41
42
|
try {
|
|
42
43
|
let e = await a(), t = i(), n = t.user?.id !== e.id || t.activeTenant?.id !== e.tenant?.id;
|
|
@@ -77,8 +78,8 @@ var f = u((r, i) => ({
|
|
|
77
78
|
});
|
|
78
79
|
}
|
|
79
80
|
}));
|
|
80
|
-
|
|
81
|
-
e.isAuthenticated !== t.isAuthenticated && r(null);
|
|
81
|
+
p.subscribe((e, t) => {
|
|
82
|
+
e.isAuthenticated !== t.isAuthenticated && r(null), e.user?.id !== t.user?.id && u.getState().startIdentity();
|
|
82
83
|
});
|
|
83
84
|
//#endregion
|
|
84
|
-
export {
|
|
85
|
+
export { p as useAuthStore };
|
|
@@ -80,17 +80,38 @@ function m(e) {
|
|
|
80
80
|
toastPosition: e.toast_position
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
+
function h(e) {
|
|
84
|
+
return {
|
|
85
|
+
color_scheme: e.colorScheme,
|
|
86
|
+
accent: e.accent,
|
|
87
|
+
density: e.density,
|
|
88
|
+
sidebar: e.sidebar,
|
|
89
|
+
tabs_position: e.tabsPosition,
|
|
90
|
+
tabs_max_open: e.tabsMaxOpen,
|
|
91
|
+
tabs_persist: e.tabsPersist,
|
|
92
|
+
radius: e.radius,
|
|
93
|
+
zebra_rows: e.zebra,
|
|
94
|
+
ai_surface: e.aiSurface,
|
|
95
|
+
toast_position: e.toastPosition
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
var g = "ui_preferences";
|
|
83
99
|
f();
|
|
84
|
-
var
|
|
85
|
-
typeof window < "u" && p(
|
|
86
|
-
|
|
87
|
-
|
|
100
|
+
var _ = /* @__PURE__ */ new Set(), v = { ...t }, y = !1, b = null, x = { ...t };
|
|
101
|
+
typeof window < "u" && p(v);
|
|
102
|
+
function S() {
|
|
103
|
+
let e = C.getState(), n = {};
|
|
104
|
+
for (let r of Object.keys(t)) n[r] = e[r];
|
|
105
|
+
return n;
|
|
106
|
+
}
|
|
107
|
+
var C = e((e, n) => ({
|
|
108
|
+
...v,
|
|
88
109
|
set: (t, r) => {
|
|
89
110
|
let i = u({ [t]: r });
|
|
90
111
|
i[t] !== void 0 && (p({
|
|
91
112
|
...n(),
|
|
92
113
|
...i
|
|
93
|
-
}),
|
|
114
|
+
}), _.add(t), e(i));
|
|
94
115
|
},
|
|
95
116
|
setMany: (t) => {
|
|
96
117
|
let r = u(t);
|
|
@@ -99,28 +120,46 @@ var _ = e((e, n) => ({
|
|
|
99
120
|
...n(),
|
|
100
121
|
...r
|
|
101
122
|
});
|
|
102
|
-
for (let e of Object.keys(r))
|
|
123
|
+
for (let e of Object.keys(r)) _.add(e);
|
|
103
124
|
e(r);
|
|
104
125
|
}
|
|
105
126
|
},
|
|
106
|
-
|
|
107
|
-
if (!
|
|
108
|
-
let
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
127
|
+
hydrateFromParameter: (n, r) => {
|
|
128
|
+
if (!n && !y) return;
|
|
129
|
+
let i = n ? u(m(n)) : {};
|
|
130
|
+
x = {
|
|
131
|
+
...y ? t : x,
|
|
132
|
+
...i
|
|
133
|
+
}, r && (b = r);
|
|
134
|
+
let a = y ? {
|
|
135
|
+
...t,
|
|
113
136
|
...i
|
|
114
|
-
}
|
|
137
|
+
} : i;
|
|
138
|
+
y = !1;
|
|
139
|
+
for (let e of _) delete a[e];
|
|
140
|
+
Object.keys(a).length && (p({
|
|
141
|
+
...S(),
|
|
142
|
+
...a
|
|
143
|
+
}), e(a));
|
|
115
144
|
},
|
|
116
145
|
resetToDefaults: (n) => {
|
|
117
|
-
|
|
146
|
+
_.clear(), f();
|
|
118
147
|
let r = n ? u(m(n)) : {}, i = {
|
|
119
148
|
...t,
|
|
120
149
|
...r
|
|
121
150
|
};
|
|
122
|
-
p(i), e(i);
|
|
151
|
+
x = i, p(i), e(i);
|
|
152
|
+
},
|
|
153
|
+
startIdentity: () => {
|
|
154
|
+
_.clear(), y = !0, b = null, x = { ...t };
|
|
155
|
+
},
|
|
156
|
+
holdsRowOf: (e) => e !== "" && b === e,
|
|
157
|
+
markSaved: (e) => {
|
|
158
|
+
x = { ...e };
|
|
159
|
+
},
|
|
160
|
+
revertToSaved: () => {
|
|
161
|
+
_.clear(), p(x), e({ ...x });
|
|
123
162
|
}
|
|
124
163
|
}));
|
|
125
164
|
//#endregion
|
|
126
|
-
export { p as applyPreferences,
|
|
165
|
+
export { g as UI_PREFERENCES_PARAM_CODE, p as applyPreferences, S as currentPreferences, h as toParameter, C as usePreferencesStore };
|
package/dist-lib/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as Refs, M as ListMeta, P as ListResponse, d as ActionExecuteResponse, jt as TextFn, k as DataResponse, o as ResponsiveViewport, pt as Schema, st as LocalizedString, u as ActionExecuteRequest } from "./useResponsiveMode-
|
|
1
|
+
import { B as Refs, M as ListMeta, P as ListResponse, d as ActionExecuteResponse, jt as TextFn, k as DataResponse, o as ResponsiveViewport, pt as Schema, st as LocalizedString, u as ActionExecuteRequest } from "./useResponsiveMode-9_eJT18k.js";
|
|
2
2
|
import { ReactElement, ReactNode } from "react";
|
|
3
3
|
import { QueryClient } from "@tanstack/react-query";
|
|
4
4
|
import { RenderResult } from "@testing-library/react";
|
package/dist-lib/testing.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EmbedProvider as e } from "./embed/EmbedContext.js";
|
|
2
2
|
import { useAuthStore as t } from "./stores/auth.js";
|
|
3
3
|
import { makeTextFn as n } from "./lib/language.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { encodeObjectId as r, setActionExecutor as i, setGetEntityResolver as a, setListEntitiesResolver as o } from "./api/data.js";
|
|
5
|
+
import { ResponsiveModeProvider as s } from "./hooks/useResponsiveMode.js";
|
|
6
6
|
import { ActionRunnerProvider as c } from "./components/actions/ActionRunner.js";
|
|
7
7
|
import { CurrentScreenProvider as l } from "./hooks/useCurrentScreen.js";
|
|
8
8
|
import { seedSchemaCache as u } from "./test/seed-schema.js";
|
|
@@ -85,19 +85,16 @@ function k() {
|
|
|
85
85
|
let e = {
|
|
86
86
|
id: "test-tenant",
|
|
87
87
|
code: "test",
|
|
88
|
-
name: "Test"
|
|
89
|
-
role: "admin"
|
|
88
|
+
name: "Test"
|
|
90
89
|
}, n = {
|
|
91
90
|
id: "test-user",
|
|
92
91
|
email: "test@example.com",
|
|
93
92
|
display_name: "Test User",
|
|
94
93
|
is_active: !0,
|
|
95
94
|
roles: ["admin"],
|
|
96
|
-
role_names: { admin: "administrator" },
|
|
95
|
+
role_names: { admin: { en: "administrator" } },
|
|
97
96
|
permissions: ["*"],
|
|
98
|
-
tenant: e
|
|
99
|
-
created_at: "2026-01-01T00:00:00Z",
|
|
100
|
-
updated_at: "2026-01-01T00:00:00Z"
|
|
97
|
+
tenant: e
|
|
101
98
|
};
|
|
102
99
|
t.getState().setUser(n, e);
|
|
103
100
|
}
|
|
@@ -116,7 +113,7 @@ function A(e) {
|
|
|
116
113
|
}
|
|
117
114
|
function j(e) {
|
|
118
115
|
let t = e.entityData ?? {};
|
|
119
|
-
|
|
116
|
+
o((n, r) => {
|
|
120
117
|
let i = r;
|
|
121
118
|
e.onListRequest?.(n, i);
|
|
122
119
|
let a = t[n], o = typeof a == "function" ? a(i) : a;
|
|
@@ -141,24 +138,24 @@ function j(e) {
|
|
|
141
138
|
...s.refs === void 0 ? {} : { $refs: s.refs }
|
|
142
139
|
};
|
|
143
140
|
});
|
|
144
|
-
let n = e.entityItems ?? {},
|
|
145
|
-
|
|
146
|
-
let
|
|
141
|
+
let n = e.entityItems ?? {}, s = e.entityItemResponses ?? {};
|
|
142
|
+
a((e, t) => {
|
|
143
|
+
let i = typeof t == "string" ? t : r(t), a = s[e]?.[i];
|
|
144
|
+
if (a instanceof Error) throw a;
|
|
145
|
+
if (a !== void 0) return a;
|
|
146
|
+
let o = n[e]?.[i];
|
|
147
147
|
if (o instanceof Error) throw o;
|
|
148
|
-
|
|
149
|
-
let s = n[e]?.[a];
|
|
150
|
-
if (s instanceof Error) throw s;
|
|
151
|
-
return { data: s };
|
|
148
|
+
return { data: o };
|
|
152
149
|
});
|
|
153
150
|
let c = e.actionResults ?? {};
|
|
154
|
-
|
|
151
|
+
i(async (e, t) => {
|
|
155
152
|
if (!(e in c)) throw Error(`renderWithDeclarion: no action result registered for "${e}" (seed it via actionResults)`);
|
|
156
153
|
let n = c[e];
|
|
157
154
|
return D(typeof n == "function" ? await n(t) : n);
|
|
158
155
|
});
|
|
159
156
|
}
|
|
160
157
|
function M() {
|
|
161
|
-
|
|
158
|
+
o(null), a(null), i(null), t.setState({
|
|
162
159
|
user: null,
|
|
163
160
|
isAuthenticated: !1,
|
|
164
161
|
activeTenant: null,
|
|
@@ -166,30 +163,30 @@ function M() {
|
|
|
166
163
|
});
|
|
167
164
|
}
|
|
168
165
|
function N(t, n = {}) {
|
|
169
|
-
let
|
|
166
|
+
let r = new f({ defaultOptions: { queries: {
|
|
170
167
|
retry: !1,
|
|
171
168
|
gcTime: Infinity
|
|
172
169
|
} } });
|
|
173
|
-
k(), u(
|
|
174
|
-
let
|
|
170
|
+
k(), u(r, n.schema ?? S()), j(n);
|
|
171
|
+
let i = n.screenCode ? /* @__PURE__ */ m(l, {
|
|
175
172
|
code: n.screenCode,
|
|
176
173
|
children: t
|
|
177
|
-
}) : t,
|
|
178
|
-
client:
|
|
174
|
+
}) : t, a = { current: n.route ?? "/" }, o = /* @__PURE__ */ h(p, {
|
|
175
|
+
client: r,
|
|
179
176
|
children: [/* @__PURE__ */ h(g, {
|
|
180
177
|
initialEntries: [n.route ?? "/"],
|
|
181
|
-
children: [/* @__PURE__ */ m(O, { into:
|
|
178
|
+
children: [/* @__PURE__ */ m(O, { into: a }), /* @__PURE__ */ m(c, { children: i })]
|
|
182
179
|
}), /* @__PURE__ */ m(v, {})]
|
|
183
180
|
}), d = n.embedQuery ? /* @__PURE__ */ m(e, {
|
|
184
181
|
query: n.embedQuery,
|
|
185
|
-
children:
|
|
186
|
-
}) :
|
|
182
|
+
children: o
|
|
183
|
+
}) : o, _ = y(n.viewport ? /* @__PURE__ */ m(s, {
|
|
187
184
|
viewportOverride: n.viewport,
|
|
188
185
|
children: d
|
|
189
186
|
}) : d);
|
|
190
187
|
return Object.assign(_, {
|
|
191
|
-
queryClient:
|
|
192
|
-
location: () =>
|
|
188
|
+
queryClient: r,
|
|
189
|
+
location: () => a.current
|
|
193
190
|
});
|
|
194
191
|
}
|
|
195
192
|
function P({ children: e, authenticated: n = !0, ...r }) {
|
package/dist-lib/types/schema.js
CHANGED
|
@@ -12,7 +12,10 @@ function a(e, r, a) {
|
|
|
12
12
|
let c = r[s];
|
|
13
13
|
if (c == null) return;
|
|
14
14
|
let l = a?.fields?.get(s);
|
|
15
|
-
if (l?.type === "timestamp" && typeof c == "string" && c !== "") return n(c
|
|
15
|
+
if (l?.type === "timestamp" && typeof c == "string" && c !== "") return n(c, {
|
|
16
|
+
zone: e.timeZone,
|
|
17
|
+
declared: !!(l.timezone || a?.default_timezone)
|
|
18
|
+
});
|
|
16
19
|
let u = l?.values;
|
|
17
20
|
if (u && (typeof c == "string" || typeof c == "number")) {
|
|
18
21
|
let t = u.find((e) => e.code === String(c));
|
|
@@ -111,43 +114,46 @@ function h(e) {
|
|
|
111
114
|
structure: e.structure
|
|
112
115
|
};
|
|
113
116
|
}
|
|
114
|
-
function g(e
|
|
117
|
+
function g(e) {
|
|
118
|
+
return !e.primary && !e.auto && !e.readonly && !e.source;
|
|
119
|
+
}
|
|
120
|
+
function _(e, t) {
|
|
115
121
|
return !e || e.readonly ? !1 : e.mutations?.[t] ?? !0;
|
|
116
122
|
}
|
|
117
|
-
function
|
|
123
|
+
function v(e, t, n) {
|
|
118
124
|
let r = e?.tenant_key;
|
|
119
125
|
return !r || !t || !(r in t) || !!n && String(t[r]).toLowerCase() === n.toLowerCase();
|
|
120
126
|
}
|
|
121
|
-
function
|
|
122
|
-
return
|
|
127
|
+
function y(e, t, n, r) {
|
|
128
|
+
return _(e, t) && (t === "create" || v(e, n, r));
|
|
123
129
|
}
|
|
124
|
-
function
|
|
130
|
+
function b(e) {
|
|
125
131
|
return !e?.disable_defaults?.includes("__new");
|
|
126
132
|
}
|
|
127
|
-
function
|
|
133
|
+
function x(e) {
|
|
128
134
|
if (e.primary_key && e.primary_key.length > 0) return e.primary_key;
|
|
129
135
|
for (let [t, n] of e.fields) if (n.primary) return [t];
|
|
130
136
|
return ["id"];
|
|
131
137
|
}
|
|
132
|
-
function
|
|
133
|
-
let r =
|
|
138
|
+
function S(e, n) {
|
|
139
|
+
let r = x(e), i = {};
|
|
134
140
|
for (let e of r) i[e] = t(n[e]);
|
|
135
141
|
return i;
|
|
136
142
|
}
|
|
137
|
-
function S(e) {
|
|
138
|
-
return e.length === 1 ? e[0] : JSON.stringify(e);
|
|
139
|
-
}
|
|
140
143
|
function C(e) {
|
|
141
|
-
return
|
|
144
|
+
return e.length === 1 ? e[0] : JSON.stringify(e);
|
|
142
145
|
}
|
|
143
|
-
function w(e
|
|
144
|
-
return
|
|
146
|
+
function w(e) {
|
|
147
|
+
return C(Object.values(e));
|
|
145
148
|
}
|
|
146
149
|
function T(e, t) {
|
|
147
|
-
|
|
148
|
-
if (n.length === 1) return { [n[0]]: t };
|
|
150
|
+
return C(x(e).map((e) => t[e] ?? ""));
|
|
149
151
|
}
|
|
150
152
|
function E(e, t) {
|
|
153
|
+
let n = x(e);
|
|
154
|
+
if (n.length === 1) return { [n[0]]: t };
|
|
155
|
+
}
|
|
156
|
+
function D(e, t) {
|
|
151
157
|
if (t <= 1) return [e];
|
|
152
158
|
try {
|
|
153
159
|
let n = JSON.parse(e);
|
|
@@ -157,24 +163,24 @@ function E(e, t) {
|
|
|
157
163
|
}
|
|
158
164
|
return null;
|
|
159
165
|
}
|
|
160
|
-
function
|
|
166
|
+
function O(e, t, n) {
|
|
161
167
|
if (e?.detail_screen === "none") return null;
|
|
162
168
|
let r = e?.detail_screen ?? t?.detail_screen;
|
|
163
169
|
return r ? n?.[r]?.route ?? null : null;
|
|
164
170
|
}
|
|
165
|
-
function
|
|
171
|
+
function k(e, t, n, r) {
|
|
166
172
|
if (!t) return null;
|
|
167
|
-
let i =
|
|
173
|
+
let i = O(e, n, r);
|
|
168
174
|
return i ? i.replace(":id", encodeURIComponent(t)) : null;
|
|
169
175
|
}
|
|
170
|
-
function k(e, t, n, r) {
|
|
171
|
-
return !t || b(t).some((e) => !r[e]) ? null : O(e, w(t, r), t, n);
|
|
172
|
-
}
|
|
173
176
|
function A(e, t, n, r) {
|
|
174
|
-
return t ? k(e, t,
|
|
177
|
+
return !t || x(t).some((e) => !r[e]) ? null : k(e, T(t, r), t, n);
|
|
178
|
+
}
|
|
179
|
+
function j(e, t, n, r) {
|
|
180
|
+
return t ? A(e, t, n, S(t, r)) : null;
|
|
175
181
|
}
|
|
176
|
-
function
|
|
177
|
-
return
|
|
182
|
+
function M(e) {
|
|
183
|
+
return x(e).length > 1;
|
|
178
184
|
}
|
|
179
185
|
//#endregion
|
|
180
|
-
export { r as DETAIL_SCREEN_NONE, i as DISPLAY_KEY, e as OrderedMap,
|
|
186
|
+
export { r as DETAIL_SCREEN_NONE, i as DISPLAY_KEY, e as OrderedMap, k as buildDetailHrefFromId, A as buildEntityDetailHref, j as buildRowDetailHref, m as effectiveSpecialValues, b as entityAllowsCreateRoute, _ as entityAllowsMutation, S as extractPkValues, u as fieldDisplayName, a as getDisplayValue, x as getPrimaryKeyFields, M as isCompositePk, g as isUserEditableField, d as normalizeRefConfig, C as pkValuePartsToId, D as pkValuesFromId, T as pkValuesToDetailId, w as pkValuesToId, h as propertyToField, O as resolveDetailRoute, o as resolveRefRecordLabel, y as rowAllowsMutation, v as rowSetInTenant, l as screenTitleForPath, E as singlePkValues, f as specialValueMarker, p as specialValueMarkerCode };
|
|
@@ -194,8 +194,9 @@ interface TextFn {
|
|
|
194
194
|
(value: LocalizedString | null | undefined): string;
|
|
195
195
|
readonly language: string;
|
|
196
196
|
readonly deploymentLanguage: string;
|
|
197
|
+
readonly timeZone: string;
|
|
197
198
|
}
|
|
198
|
-
declare function makeTextFn(messages: Record<string, LocalizedString> | undefined, language: string, deploymentLanguage: string): TextFn;
|
|
199
|
+
declare function makeTextFn(messages: Record<string, LocalizedString> | undefined, language: string, deploymentLanguage: string, timeZone?: string): TextFn;
|
|
199
200
|
declare function pluralText(t: TextFn, code: string, count: number, english: {
|
|
200
201
|
one: string;
|
|
201
202
|
other: string;
|
|
@@ -1366,7 +1367,6 @@ interface Tenant {
|
|
|
1366
1367
|
id: string;
|
|
1367
1368
|
code: string;
|
|
1368
1369
|
name: string;
|
|
1369
|
-
role: string;
|
|
1370
1370
|
env?: TenantEnv;
|
|
1371
1371
|
/**
|
|
1372
1372
|
* Whether the caller has a `tenant_users` row for this tenant. Always
|
|
@@ -1381,15 +1381,15 @@ interface AuthUser {
|
|
|
1381
1381
|
email: string;
|
|
1382
1382
|
display_name: string;
|
|
1383
1383
|
is_active: boolean;
|
|
1384
|
+
timezone?: string;
|
|
1384
1385
|
roles: string[];
|
|
1385
|
-
role_names?: Record<string,
|
|
1386
|
+
role_names?: Record<string, LocalizedString>;
|
|
1386
1387
|
permissions?: string[];
|
|
1388
|
+
is_tenant_owner?: boolean;
|
|
1387
1389
|
tenant?: Tenant;
|
|
1388
1390
|
/** Populated only when the request is acting under an impersonation session. */
|
|
1389
1391
|
impersonation?: ImpersonationInfo;
|
|
1390
1392
|
access_expires_at?: string;
|
|
1391
|
-
created_at: string;
|
|
1392
|
-
updated_at: string;
|
|
1393
1393
|
}
|
|
1394
1394
|
/**
|
|
1395
1395
|
* ImpersonationInfo is the read-side projection of the active session
|