@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
package/dist-lib/app.js
CHANGED
|
@@ -4,22 +4,22 @@ import { SmartDetailPage as r } from "./components/pages/SmartDetailPage.js";
|
|
|
4
4
|
import { SmartListPage as i } from "./components/pages/SmartListPage.js";
|
|
5
5
|
import { SmartRecordListPage as a } from "./components/pages/SmartRecordListPage.js";
|
|
6
6
|
import { useFirstScreenSettledOnInput as o } from "./lib/capabilityPrefetch.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { usePreferencesStore as s } from "./stores/preferences.js";
|
|
8
|
+
import { useAuthStore as c } from "./stores/auth.js";
|
|
9
|
+
import { useSchema as l } from "./hooks/useSchema.js";
|
|
9
10
|
import { useLanguage as ee } from "./hooks/useLanguage.js";
|
|
10
|
-
import { ResponsiveModeProvider as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { useBranding as
|
|
15
|
-
import { usePreferencesStore as m } from "./stores/preferences.js";
|
|
11
|
+
import { ResponsiveModeProvider as u } from "./hooks/useResponsiveMode.js";
|
|
12
|
+
import { usePublicParams as d } from "./hooks/useParams.js";
|
|
13
|
+
import { setIconRegistry as f } from "./stores/icon-registry.js";
|
|
14
|
+
import { isValidLogoUrl as p } from "./lib/branding.js";
|
|
15
|
+
import { useBranding as m } from "./hooks/useBranding.js";
|
|
16
16
|
import { EmbedAuthBootstrap as h } from "./embed/EmbedAuthBootstrap.js";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
17
|
+
import { schemaDefaultRoute as g } from "./lib/schema-routing.js";
|
|
18
|
+
import { DEFAULT_PAGE_STATE_TTL_MS as _ } from "./stores/page-state.js";
|
|
19
|
+
import { applyRetainedReadGcTime as v } from "./hooks/usePageStateRuntime.js";
|
|
20
|
+
import { useBrandingBreakpoints as y, useBrandingViewport as b } from "./hooks/useBrandingChrome.js";
|
|
21
|
+
import { Layout as x } from "./components/layout/Layout.js";
|
|
22
|
+
import { BlankScreen as S } from "./components/shared/BlankScreen.js";
|
|
23
23
|
import { SignIn as C } from "./components/pages/auth/SignIn.js";
|
|
24
24
|
import { SignUp as te } from "./components/pages/auth/SignUp.js";
|
|
25
25
|
import { Forgot as w } from "./components/pages/auth/Forgot.js";
|
|
@@ -50,7 +50,7 @@ var Z = "declarion-managed-favicon", Q = new U({ defaultOptions: { queries: {
|
|
|
50
50
|
retry: P,
|
|
51
51
|
retryDelay: e
|
|
52
52
|
} } });
|
|
53
|
-
|
|
53
|
+
v(Q, _);
|
|
54
54
|
function $(e) {
|
|
55
55
|
if (typeof window > "u") return null;
|
|
56
56
|
try {
|
|
@@ -64,7 +64,7 @@ function se({ component: e, screenCode: t }) {
|
|
|
64
64
|
return o(), /* @__PURE__ */ K(e, { screenCode: t });
|
|
65
65
|
}
|
|
66
66
|
function ce() {
|
|
67
|
-
let { data: e } =
|
|
67
|
+
let { data: e } = l();
|
|
68
68
|
return {
|
|
69
69
|
routes: H(() => {
|
|
70
70
|
if (!e) return [];
|
|
@@ -108,25 +108,25 @@ function ce() {
|
|
|
108
108
|
}
|
|
109
109
|
return t;
|
|
110
110
|
}, [e]),
|
|
111
|
-
defaultRoute: H(() =>
|
|
111
|
+
defaultRoute: H(() => g(e), [e])
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
114
|
function le() {
|
|
115
|
-
let e =
|
|
115
|
+
let e = c((e) => e.initialize), t = c((e) => e.isLoading), r = c((e) => e.isAuthenticated), { data: i, isError: a } = l(), o = ee(), { data: s, isLoading: u } = d(), { branding: h, isLoading: g } = m(), { routes: _, defaultRoute: v } = ce(), y = n();
|
|
116
116
|
V(() => {
|
|
117
117
|
document.documentElement.lang = o;
|
|
118
118
|
}, [o]);
|
|
119
|
-
let
|
|
119
|
+
let b = typeof window < "u" && window.self !== window.top && !y.enabled;
|
|
120
120
|
V(() => {
|
|
121
|
-
y.enabled ||
|
|
121
|
+
y.enabled || b || e();
|
|
122
122
|
}, [
|
|
123
123
|
y.enabled,
|
|
124
|
-
|
|
124
|
+
b,
|
|
125
125
|
e
|
|
126
126
|
]);
|
|
127
127
|
let k = i?.icons;
|
|
128
128
|
V(() => {
|
|
129
|
-
|
|
129
|
+
f(k ?? {});
|
|
130
130
|
}, [k]);
|
|
131
131
|
let A = h?.identity, j = h?.theme;
|
|
132
132
|
V(() => {
|
|
@@ -135,7 +135,7 @@ function le() {
|
|
|
135
135
|
e && (document.title = e);
|
|
136
136
|
}, [A?.app_name]), V(() => {
|
|
137
137
|
if (typeof document > "u") return;
|
|
138
|
-
let e = A?.app_logo, t =
|
|
138
|
+
let e = A?.app_logo, t = p(e) ? $(e.trim()) : null, n = document.getElementById(Z);
|
|
139
139
|
if (!t) n && n.remove();
|
|
140
140
|
else if (n) n.href !== t && (n.href = t);
|
|
141
141
|
else {
|
|
@@ -165,7 +165,7 @@ function le() {
|
|
|
165
165
|
n.id = R, n.rel = "stylesheet", n.href = t, document.head.appendChild(n);
|
|
166
166
|
}, [M]);
|
|
167
167
|
let P = y.enabled && !r;
|
|
168
|
-
return
|
|
168
|
+
return b || P || t || u && !s || g || !i && (r || !a) ? /* @__PURE__ */ K(S, {}) : /* @__PURE__ */ q(ae, { children: [
|
|
169
169
|
/* @__PURE__ */ K(X, {
|
|
170
170
|
path: "/login",
|
|
171
171
|
element: /* @__PURE__ */ K(C, {})
|
|
@@ -191,7 +191,7 @@ function le() {
|
|
|
191
191
|
element: /* @__PURE__ */ K(E, {})
|
|
192
192
|
}),
|
|
193
193
|
/* @__PURE__ */ q(X, {
|
|
194
|
-
element: /* @__PURE__ */ K(
|
|
194
|
+
element: /* @__PURE__ */ K(x, {}),
|
|
195
195
|
children: [
|
|
196
196
|
i && !v && /* @__PURE__ */ K(X, {
|
|
197
197
|
index: !0,
|
|
@@ -229,7 +229,7 @@ function le() {
|
|
|
229
229
|
}
|
|
230
230
|
function ue() {
|
|
231
231
|
M();
|
|
232
|
-
let e =
|
|
232
|
+
let e = s((e) => e.toastPosition);
|
|
233
233
|
return /* @__PURE__ */ q(J, { children: [
|
|
234
234
|
/* @__PURE__ */ K(h, {}),
|
|
235
235
|
/* @__PURE__ */ K(N, {}),
|
|
@@ -250,8 +250,8 @@ function ue() {
|
|
|
250
250
|
] });
|
|
251
251
|
}
|
|
252
252
|
function de({ children: e }) {
|
|
253
|
-
let t =
|
|
254
|
-
return /* @__PURE__ */ K(
|
|
253
|
+
let t = b(), n = y();
|
|
254
|
+
return /* @__PURE__ */ K(u, {
|
|
255
255
|
viewport: t,
|
|
256
256
|
breakpoints: n,
|
|
257
257
|
children: e
|
|
@@ -1,116 +1,117 @@
|
|
|
1
1
|
import { useSchema as e } from "../../hooks/useSchema.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
2
|
+
import { buildActionBody as t, executeAction as n, resolveAssociation as r } from "../../api/data.js";
|
|
3
|
+
import { failureTitle as i } from "../../lib/failure.js";
|
|
4
|
+
import { Icon as a } from "../primitives/Icons.js";
|
|
5
|
+
import { Btn as o } from "../primitives/Btn.js";
|
|
6
|
+
import { IconBtn as s } from "../primitives/IconBtn.js";
|
|
7
|
+
import { useText as c } from "../../hooks/useText.js";
|
|
8
|
+
import { toast as l } from "../../lib/toast.js";
|
|
9
|
+
import { DynamicIcon as u } from "../shared/DynamicIcon.js";
|
|
10
|
+
import { useTabNavigate as d } from "../../hooks/useTabNavigate.js";
|
|
11
11
|
import { evaluateConditions as f, findListScreenForEntity as p, isAssociationAction as m, rowDetailId as h } from "../../lib/actions.js";
|
|
12
12
|
import { useActionRunner as g } from "./ActionRunner.js";
|
|
13
13
|
import { executeUISteps as _, isUIAction as v } from "../../lib/ui-actions.js";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { useConditionCaller as y } from "../../hooks/useRowTenant.js";
|
|
15
|
+
import { useCallback as b, useState as x } from "react";
|
|
16
|
+
import { jsx as S } from "react/jsx-runtime";
|
|
16
17
|
//#region src/components/actions/ActionButton.tsx
|
|
17
|
-
function
|
|
18
|
-
let
|
|
19
|
-
if (
|
|
20
|
-
|
|
18
|
+
function C({ actionCode: C, action: w, entityCode: T, objectIds: E = [], row: D, variant: O = "outline", size: k = "default", onSuccess: A }) {
|
|
19
|
+
let j = c(), M = c("errors"), [N, P] = x(!1), [F, I] = x(!1), { data: L } = e(), R = d(), { run: z } = g(), B = m(w), V = y(), H = !D || f(w.conditions, D, V), U = b(async () => {
|
|
20
|
+
if (w.association && E.length !== 0) {
|
|
21
|
+
P(!0);
|
|
21
22
|
try {
|
|
22
|
-
let e =
|
|
23
|
+
let e = T ? `${T}.${w.association}` : w.association, t = await r(e, E), n = p(L, t.target_entity);
|
|
23
24
|
if (!n) {
|
|
24
|
-
|
|
25
|
+
l.error(M("action.list_screen_missing", "No list screen is declared for this entity."), t.target_entity);
|
|
25
26
|
return;
|
|
26
27
|
}
|
|
27
|
-
let
|
|
28
|
+
let i = L?.entities[t.target_entity], a = j(w.display?.name) || t.target_entity;
|
|
28
29
|
if (t.ids.length === 0) {
|
|
29
|
-
|
|
30
|
+
l.info(j("action.association.none_related", "No related {name} found", { name: a }));
|
|
30
31
|
return;
|
|
31
32
|
}
|
|
32
|
-
let
|
|
33
|
-
|
|
34
|
-
title:
|
|
35
|
-
icon:
|
|
36
|
-
search:
|
|
37
|
-
}),
|
|
33
|
+
let o = i?.fields.names().find((e) => i.fields.get(e)?.primary) ?? "id", s = new URLSearchParams();
|
|
34
|
+
s.set(`filter_${o}`, t.ids.join(",")), R(n.route, {
|
|
35
|
+
title: a,
|
|
36
|
+
icon: w.display?.icon || n.icon,
|
|
37
|
+
search: s.toString()
|
|
38
|
+
}), A?.();
|
|
38
39
|
} catch (e) {
|
|
39
|
-
|
|
40
|
+
l.error(i(M, e));
|
|
40
41
|
} finally {
|
|
41
|
-
|
|
42
|
+
P(!1);
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
}, [
|
|
45
|
-
A,
|
|
46
46
|
j,
|
|
47
|
-
|
|
47
|
+
M,
|
|
48
48
|
w,
|
|
49
49
|
T,
|
|
50
|
-
|
|
50
|
+
E,
|
|
51
51
|
L,
|
|
52
|
-
k
|
|
53
|
-
]), H = C.entity ? `${C.entity}.${S}` : S, U = T.length > 0 ? T : void 0, W = y(() => {
|
|
54
|
-
F(!0), R({
|
|
55
|
-
action: C,
|
|
56
|
-
title: A(C.display?.name) || S,
|
|
57
|
-
row: E,
|
|
58
|
-
entity: w,
|
|
59
|
-
execute: (e) => s(H, o(e, U)),
|
|
60
|
-
onSuccess: () => k?.()
|
|
61
|
-
}).finally(() => F(!1));
|
|
62
|
-
}, [
|
|
63
|
-
A,
|
|
64
52
|
R,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
else if (C.href && !C.handler && !C.association) {
|
|
76
|
-
let e = w ? I?.entities[w] : void 0, t = h(E, e), n = C.href;
|
|
77
|
-
w && (n = n.replaceAll("${entity}", w)), t && (n = n.replaceAll("${id}", encodeURIComponent(t))), L(n, {
|
|
78
|
-
title: A(C.display?.name) || S,
|
|
79
|
-
icon: C.display?.icon
|
|
80
|
-
}), k?.();
|
|
81
|
-
} else W();
|
|
53
|
+
A
|
|
54
|
+
]), W = w.entity ? `${w.entity}.${C}` : C, G = E.length > 0 ? E : void 0, K = b(() => {
|
|
55
|
+
I(!0), z({
|
|
56
|
+
action: w,
|
|
57
|
+
title: j(w.display?.name) || C,
|
|
58
|
+
row: D,
|
|
59
|
+
entity: T,
|
|
60
|
+
execute: (e) => n(W, t(e, G)),
|
|
61
|
+
onSuccess: () => A?.()
|
|
62
|
+
}).finally(() => I(!1));
|
|
82
63
|
}, [
|
|
83
|
-
A,
|
|
84
64
|
j,
|
|
85
|
-
C,
|
|
86
|
-
E,
|
|
87
|
-
w,
|
|
88
|
-
I?.entities,
|
|
89
|
-
S,
|
|
90
|
-
L,
|
|
91
65
|
z,
|
|
92
|
-
|
|
66
|
+
w,
|
|
67
|
+
C,
|
|
68
|
+
D,
|
|
69
|
+
T,
|
|
93
70
|
W,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
71
|
+
G,
|
|
72
|
+
A
|
|
73
|
+
]), q = b(() => {
|
|
74
|
+
if (v(w)) _(M, w.ui_steps, { row: D }).then(() => A?.());
|
|
75
|
+
else if (B) U();
|
|
76
|
+
else if (w.href && !w.handler && !w.association) {
|
|
77
|
+
let e = T ? L?.entities[T] : void 0, t = h(D, e), n = w.href;
|
|
78
|
+
T && (n = n.replaceAll("${entity}", T)), t && (n = n.replaceAll("${id}", encodeURIComponent(t))), R(n, {
|
|
79
|
+
title: j(w.display?.name) || C,
|
|
80
|
+
icon: w.display?.icon
|
|
81
|
+
}), A?.();
|
|
82
|
+
} else K();
|
|
83
|
+
}, [
|
|
84
|
+
j,
|
|
85
|
+
M,
|
|
86
|
+
w,
|
|
87
|
+
D,
|
|
88
|
+
T,
|
|
89
|
+
L?.entities,
|
|
90
|
+
C,
|
|
91
|
+
R,
|
|
92
|
+
B,
|
|
93
|
+
U,
|
|
94
|
+
K,
|
|
95
|
+
A
|
|
96
|
+
]), J = j(w.display?.name), Y = w.display?.icon, X = Y && a[Y], Z = X ? /* @__PURE__ */ S(X, { size: 13 }) : Y ? /* @__PURE__ */ S(u, {
|
|
97
|
+
name: Y,
|
|
97
98
|
size: 13
|
|
98
|
-
}) : null,
|
|
99
|
-
return
|
|
100
|
-
icon:
|
|
101
|
-
onClick:
|
|
102
|
-
title:
|
|
103
|
-
}) : /* @__PURE__ */
|
|
104
|
-
kind:
|
|
99
|
+
}) : null, Q = !H || F || N;
|
|
100
|
+
return k === "icon" ? /* @__PURE__ */ S(s, {
|
|
101
|
+
icon: Z ?? /* @__PURE__ */ S(a.bolt, { size: 13 }),
|
|
102
|
+
onClick: q,
|
|
103
|
+
title: J
|
|
104
|
+
}) : /* @__PURE__ */ S(o, {
|
|
105
|
+
kind: O === "default" ? "primary" : O === "ghost" ? "ghost" : "default",
|
|
105
106
|
size: "sm",
|
|
106
|
-
icon:
|
|
107
|
-
danger:
|
|
108
|
-
onClick:
|
|
109
|
-
disabled:
|
|
110
|
-
title:
|
|
111
|
-
"aria-label":
|
|
112
|
-
children:
|
|
107
|
+
icon: Z,
|
|
108
|
+
danger: w.destructive,
|
|
109
|
+
onClick: q,
|
|
110
|
+
disabled: Q,
|
|
111
|
+
title: J,
|
|
112
|
+
"aria-label": J,
|
|
113
|
+
children: J
|
|
113
114
|
});
|
|
114
115
|
}
|
|
115
116
|
//#endregion
|
|
116
|
-
export {
|
|
117
|
+
export { C as ActionButton };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { isExternalHref as e, safeExternalUrl as t } from "../../lib/safe-url.js";
|
|
2
|
+
import { downloadFile as n } from "../../lib/download.js";
|
|
3
|
+
import { failureTitle as r } from "../../lib/failure.js";
|
|
4
|
+
import { Icon as i } from "../primitives/Icons.js";
|
|
5
|
+
import { Btn as a } from "../primitives/Btn.js";
|
|
6
|
+
import { IconBtn as o } from "../primitives/IconBtn.js";
|
|
7
|
+
import { useText as s } from "../../hooks/useText.js";
|
|
8
8
|
import { CopyButton as c } from "../shared/CopyButton.js";
|
|
9
9
|
import { useEffect as l, useRef as u, useState as d } from "react";
|
|
10
10
|
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
11
11
|
//#region src/components/actions/ActionResultDialog.impl.tsx
|
|
12
|
-
function h({ open:
|
|
13
|
-
let
|
|
12
|
+
function h({ open: e, onClose: t, display: n }) {
|
|
13
|
+
let r = s(), c = u(null);
|
|
14
14
|
return l(() => {
|
|
15
|
-
|
|
16
|
-
}, [
|
|
15
|
+
e && c.current?.focus();
|
|
16
|
+
}, [e]), e ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", { style: {
|
|
17
17
|
position: "fixed",
|
|
18
18
|
inset: 0,
|
|
19
19
|
background: "var(--scrim)",
|
|
@@ -23,10 +23,10 @@ function h({ open: i, onClose: a, display: o }) {
|
|
|
23
23
|
ref: c,
|
|
24
24
|
role: "dialog",
|
|
25
25
|
"aria-modal": "true",
|
|
26
|
-
"aria-label":
|
|
26
|
+
"aria-label": n.title ?? r("action.result.title", "Action Result"),
|
|
27
27
|
tabIndex: -1,
|
|
28
28
|
onKeyDown: (e) => {
|
|
29
|
-
e.key === "Escape" &&
|
|
29
|
+
e.key === "Escape" && t();
|
|
30
30
|
},
|
|
31
31
|
style: {
|
|
32
32
|
position: "fixed",
|
|
@@ -67,7 +67,7 @@ function h({ open: i, onClose: a, display: o }) {
|
|
|
67
67
|
justifyContent: "center",
|
|
68
68
|
flexShrink: 0
|
|
69
69
|
},
|
|
70
|
-
children: /* @__PURE__ */ p(
|
|
70
|
+
children: /* @__PURE__ */ p(i.check, { size: 15 })
|
|
71
71
|
}),
|
|
72
72
|
/* @__PURE__ */ m("div", {
|
|
73
73
|
style: {
|
|
@@ -80,23 +80,23 @@ function h({ open: i, onClose: a, display: o }) {
|
|
|
80
80
|
fontWeight: 600,
|
|
81
81
|
color: "var(--text)"
|
|
82
82
|
},
|
|
83
|
-
children:
|
|
84
|
-
}),
|
|
83
|
+
children: n.title ?? r("action.result.title", "Action Result")
|
|
84
|
+
}), n.message && /* @__PURE__ */ p("div", {
|
|
85
85
|
style: {
|
|
86
86
|
fontSize: 11.5,
|
|
87
87
|
color: "var(--text-3)",
|
|
88
88
|
marginTop: 2
|
|
89
89
|
},
|
|
90
|
-
children:
|
|
90
|
+
children: n.message
|
|
91
91
|
})]
|
|
92
92
|
}),
|
|
93
|
-
/* @__PURE__ */ p(
|
|
94
|
-
icon: /* @__PURE__ */ p(
|
|
95
|
-
onClick:
|
|
93
|
+
/* @__PURE__ */ p(o, {
|
|
94
|
+
icon: /* @__PURE__ */ p(i.x, { size: 14 }),
|
|
95
|
+
onClick: t
|
|
96
96
|
})
|
|
97
97
|
]
|
|
98
98
|
}),
|
|
99
|
-
|
|
99
|
+
n.fields && n.fields.length > 0 && /* @__PURE__ */ p("div", {
|
|
100
100
|
style: {
|
|
101
101
|
padding: "12px 18px 16px",
|
|
102
102
|
display: "flex",
|
|
@@ -104,10 +104,10 @@ function h({ open: i, onClose: a, display: o }) {
|
|
|
104
104
|
gap: 12,
|
|
105
105
|
overflowY: "auto"
|
|
106
106
|
},
|
|
107
|
-
children:
|
|
107
|
+
children: n.fields.map((e, n) => /* @__PURE__ */ p(g, {
|
|
108
108
|
field: e,
|
|
109
|
-
onNavigate:
|
|
110
|
-
},
|
|
109
|
+
onNavigate: t
|
|
110
|
+
}, n))
|
|
111
111
|
}),
|
|
112
112
|
/* @__PURE__ */ m("div", {
|
|
113
113
|
style: {
|
|
@@ -121,24 +121,24 @@ function h({ open: i, onClose: a, display: o }) {
|
|
|
121
121
|
background: "var(--surface-2)",
|
|
122
122
|
flexShrink: 0
|
|
123
123
|
},
|
|
124
|
-
children: [/* @__PURE__ */ p("div", { style: { flex: 1 } }), /* @__PURE__ */ p(
|
|
124
|
+
children: [/* @__PURE__ */ p("div", { style: { flex: 1 } }), /* @__PURE__ */ p(a, {
|
|
125
125
|
kind: "primary",
|
|
126
|
-
onClick:
|
|
127
|
-
children:
|
|
126
|
+
onClick: t,
|
|
127
|
+
children: r("dialog.close", "Close")
|
|
128
128
|
})]
|
|
129
129
|
})
|
|
130
130
|
]
|
|
131
131
|
})] }) : null;
|
|
132
132
|
}
|
|
133
|
-
function g({ field:
|
|
134
|
-
let l =
|
|
133
|
+
function g({ field: a, onNavigate: o }) {
|
|
134
|
+
let l = s(), u = s("errors"), f = a.href ?? a.download_url ?? a.value, h = a.type === "download", g = h || a.type === "link", _ = f ? t(f) : void 0, [v, y] = d(!1), [b, x] = d(null);
|
|
135
135
|
async function S() {
|
|
136
136
|
if (_) {
|
|
137
137
|
y(!0), x(null);
|
|
138
138
|
try {
|
|
139
|
-
await
|
|
139
|
+
await n(u, _, a.filename);
|
|
140
140
|
} catch (e) {
|
|
141
|
-
x(
|
|
141
|
+
x(r(u, e));
|
|
142
142
|
} finally {
|
|
143
143
|
y(!1);
|
|
144
144
|
}
|
|
@@ -161,7 +161,7 @@ function g({ field: t, onNavigate: n }) {
|
|
|
161
161
|
fontWeight: 500,
|
|
162
162
|
textDecoration: "none",
|
|
163
163
|
whiteSpace: "nowrap"
|
|
164
|
-
}, w = g && !h, T =
|
|
164
|
+
}, w = g && !h, T = e(_), E = {
|
|
165
165
|
flex: 1,
|
|
166
166
|
minWidth: 0,
|
|
167
167
|
display: "inline-flex",
|
|
@@ -185,7 +185,7 @@ function g({ field: t, onNavigate: n }) {
|
|
|
185
185
|
fontWeight: 500,
|
|
186
186
|
color: "var(--text-3)"
|
|
187
187
|
},
|
|
188
|
-
children:
|
|
188
|
+
children: a.label
|
|
189
189
|
}),
|
|
190
190
|
h && _ && /* @__PURE__ */ m("button", {
|
|
191
191
|
type: "button",
|
|
@@ -195,7 +195,7 @@ function g({ field: t, onNavigate: n }) {
|
|
|
195
195
|
...C,
|
|
196
196
|
cursor: v ? "default" : "pointer"
|
|
197
197
|
},
|
|
198
|
-
children: [p(v ?
|
|
198
|
+
children: [p(v ? i.loader : i.download, { size: 14 }), /* @__PURE__ */ p("span", { children: v ? l("action.result.downloading", "Downloading…") : l("action.result.download", "Download") })]
|
|
199
199
|
}),
|
|
200
200
|
b && /* @__PURE__ */ p("div", {
|
|
201
201
|
style: {
|
|
@@ -216,8 +216,8 @@ function g({ field: t, onNavigate: n }) {
|
|
|
216
216
|
target: "_blank",
|
|
217
217
|
rel: "noopener noreferrer",
|
|
218
218
|
style: E,
|
|
219
|
-
title:
|
|
220
|
-
children: [/* @__PURE__ */ p(
|
|
219
|
+
title: a.value,
|
|
220
|
+
children: [/* @__PURE__ */ p(i.link, {
|
|
221
221
|
size: 14,
|
|
222
222
|
style: { flexShrink: 0 }
|
|
223
223
|
}), /* @__PURE__ */ p("span", {
|
|
@@ -226,14 +226,14 @@ function g({ field: t, onNavigate: n }) {
|
|
|
226
226
|
textOverflow: "ellipsis",
|
|
227
227
|
whiteSpace: "nowrap"
|
|
228
228
|
},
|
|
229
|
-
children:
|
|
229
|
+
children: a.value
|
|
230
230
|
})]
|
|
231
231
|
}) : /* @__PURE__ */ m("a", {
|
|
232
232
|
href: _,
|
|
233
|
-
onClick:
|
|
233
|
+
onClick: o,
|
|
234
234
|
style: E,
|
|
235
|
-
title:
|
|
236
|
-
children: [/* @__PURE__ */ p(
|
|
235
|
+
title: a.value,
|
|
236
|
+
children: [/* @__PURE__ */ p(i.link, {
|
|
237
237
|
size: 14,
|
|
238
238
|
style: { flexShrink: 0 }
|
|
239
239
|
}), /* @__PURE__ */ p("span", {
|
|
@@ -242,33 +242,33 @@ function g({ field: t, onNavigate: n }) {
|
|
|
242
242
|
textOverflow: "ellipsis",
|
|
243
243
|
whiteSpace: "nowrap"
|
|
244
244
|
},
|
|
245
|
-
children:
|
|
245
|
+
children: a.value
|
|
246
246
|
})]
|
|
247
|
-
}),
|
|
247
|
+
}), a.copyable && /* @__PURE__ */ p(c, { value: a.value })]
|
|
248
248
|
}) : /* @__PURE__ */ m("div", {
|
|
249
249
|
style: {
|
|
250
250
|
position: "relative",
|
|
251
251
|
width: "100%"
|
|
252
252
|
},
|
|
253
253
|
children: [/* @__PURE__ */ p("div", {
|
|
254
|
-
className:
|
|
254
|
+
className: a.monospace ? "mono" : void 0,
|
|
255
255
|
style: {
|
|
256
256
|
borderRadius: "var(--radius-md)",
|
|
257
257
|
border: "1px solid var(--border)",
|
|
258
258
|
background: "var(--surface-2)",
|
|
259
|
-
padding:
|
|
259
|
+
padding: a.copyable ? "8px 40px 8px 10px" : "8px 10px",
|
|
260
260
|
fontSize: 12.5,
|
|
261
261
|
wordBreak: "break-all",
|
|
262
262
|
color: "var(--text)"
|
|
263
263
|
},
|
|
264
|
-
children:
|
|
265
|
-
}),
|
|
264
|
+
children: a.value
|
|
265
|
+
}), a.copyable && /* @__PURE__ */ p("div", {
|
|
266
266
|
style: {
|
|
267
267
|
position: "absolute",
|
|
268
268
|
top: 4,
|
|
269
269
|
right: 4
|
|
270
270
|
},
|
|
271
|
-
children: /* @__PURE__ */ p(c, { value:
|
|
271
|
+
children: /* @__PURE__ */ p(c, { value: a.value })
|
|
272
272
|
})]
|
|
273
273
|
})
|
|
274
274
|
]
|