@declarion/react 0.86.0 → 0.88.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
|
@@ -3,35 +3,35 @@ import { Icon as t } from "../primitives/Icons.js";
|
|
|
3
3
|
import { Btn as n } from "../primitives/Btn.js";
|
|
4
4
|
import { IconBtn as r } from "../primitives/IconBtn.js";
|
|
5
5
|
import { Kbd as i } from "../primitives/Kbd.js";
|
|
6
|
-
import { Avatar as
|
|
7
|
-
import { useText as
|
|
8
|
-
import { applyRowState as
|
|
9
|
-
import { useActionRunner as
|
|
10
|
-
import { renderSchemaField as
|
|
11
|
-
import { ResponsiveActionBar as
|
|
12
|
-
import { useRowTenant as
|
|
13
|
-
import { effectiveScreenForRecord as
|
|
14
|
-
import { PeekFieldCell as
|
|
15
|
-
import { useUnsavedInput as
|
|
16
|
-
import { useEffect as
|
|
17
|
-
import { Fragment as
|
|
6
|
+
import { Avatar as ee } from "../primitives/Avatar.js";
|
|
7
|
+
import { useText as a } from "../../hooks/useText.js";
|
|
8
|
+
import { applyRowState as o, defaultFlatForSlot as s, filterLayoutForSlot as c } from "../../lib/actions.js";
|
|
9
|
+
import { useActionRunner as l } from "../actions/ActionRunner.js";
|
|
10
|
+
import { renderSchemaField as u } from "../file-widgets/host.js";
|
|
11
|
+
import { ResponsiveActionBar as d } from "../actions/ResponsiveActionBar.js";
|
|
12
|
+
import { useRowTenant as f } from "../../hooks/useRowTenant.js";
|
|
13
|
+
import { effectiveScreenForRecord as p, variantActionCodesForRecord as m } from "../../lib/variants.js";
|
|
14
|
+
import { PeekFieldCell as h } from "./PeekFieldCell.js";
|
|
15
|
+
import { useUnsavedInput as g } from "../../hooks/useUnsavedInput.js";
|
|
16
|
+
import { useEffect as _, useMemo as v, useRef as y, useState as b } from "react";
|
|
17
|
+
import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
18
18
|
//#region src/components/list/QuickPeek.tsx
|
|
19
|
-
var
|
|
19
|
+
var w = {
|
|
20
20
|
tab: "Tab",
|
|
21
21
|
esc: "Esc"
|
|
22
22
|
};
|
|
23
|
-
function
|
|
24
|
-
let H =
|
|
25
|
-
|
|
26
|
-
let J =
|
|
27
|
-
|
|
28
|
-
G({ ...
|
|
29
|
-
}, [
|
|
23
|
+
function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarName: j, fields: M, refs: N, screen: P, actions: F, screenActionLayout: I, entityActionLayout: L, executeAction: R, onClose: z, onOpen: B, onSave: V }) {
|
|
24
|
+
let H = a(), U = f(T), [W, G] = b({ ...O }), [K, q] = b(!1);
|
|
25
|
+
g(K);
|
|
26
|
+
let J = y(null), { run: Y } = l(), X = p(T, P, W);
|
|
27
|
+
_(() => {
|
|
28
|
+
G({ ...O }), q(!1);
|
|
29
|
+
}, [O]), _(() => {
|
|
30
30
|
J.current?.focus();
|
|
31
31
|
}, []);
|
|
32
|
-
let Z =
|
|
33
|
-
let e = X?.action_layout ?? I ?? L ??
|
|
34
|
-
return
|
|
32
|
+
let Z = v(() => {
|
|
33
|
+
let e = X?.action_layout ?? I ?? L ?? s(F, "quick_peek"), t = c(e, F, void 0, "quick_peek");
|
|
34
|
+
return o(H, t, F, void 0, W, [], U, m(T, W));
|
|
35
35
|
}, [
|
|
36
36
|
H,
|
|
37
37
|
X?.action_layout,
|
|
@@ -39,7 +39,7 @@ function E({ entity: E, entityCode: O, record: k, title: A, recordId: j, avatarN
|
|
|
39
39
|
L,
|
|
40
40
|
F,
|
|
41
41
|
W,
|
|
42
|
-
|
|
42
|
+
T,
|
|
43
43
|
U
|
|
44
44
|
]), Q = ({ code: e, action: t }) => {
|
|
45
45
|
Y({
|
|
@@ -54,8 +54,8 @@ function E({ entity: E, entityCode: O, record: k, title: A, recordId: j, avatarN
|
|
|
54
54
|
[e]: t
|
|
55
55
|
};
|
|
56
56
|
G(n), q(!0), V?.(n);
|
|
57
|
-
}, te = X?.quick_peek?.width ?? 480;
|
|
58
|
-
return /* @__PURE__ */
|
|
57
|
+
}, te = X?.quick_peek?.width ?? 480, ne = M.some((e) => !e.readOnly);
|
|
58
|
+
return /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S("div", {
|
|
59
59
|
onClick: z,
|
|
60
60
|
style: {
|
|
61
61
|
position: "fixed",
|
|
@@ -63,7 +63,7 @@ function E({ entity: E, entityCode: O, record: k, title: A, recordId: j, avatarN
|
|
|
63
63
|
background: "var(--scrim-lite)",
|
|
64
64
|
zIndex: 40
|
|
65
65
|
}
|
|
66
|
-
}), /* @__PURE__ */
|
|
66
|
+
}), /* @__PURE__ */ C("aside", {
|
|
67
67
|
ref: J,
|
|
68
68
|
role: "dialog",
|
|
69
69
|
"aria-label": H("list.peek.dialog", "Quick peek"),
|
|
@@ -85,7 +85,7 @@ function E({ entity: E, entityCode: O, record: k, title: A, recordId: j, avatarN
|
|
|
85
85
|
boxShadow: "var(--shadow-lg)"
|
|
86
86
|
},
|
|
87
87
|
children: [
|
|
88
|
-
/* @__PURE__ */
|
|
88
|
+
/* @__PURE__ */ C("div", {
|
|
89
89
|
style: {
|
|
90
90
|
display: "flex",
|
|
91
91
|
alignItems: "center",
|
|
@@ -94,16 +94,16 @@ function E({ entity: E, entityCode: O, record: k, title: A, recordId: j, avatarN
|
|
|
94
94
|
gap: 10
|
|
95
95
|
},
|
|
96
96
|
children: [
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
-
name:
|
|
97
|
+
/* @__PURE__ */ S(ee, {
|
|
98
|
+
name: j || k,
|
|
99
99
|
size: 28
|
|
100
100
|
}),
|
|
101
|
-
/* @__PURE__ */
|
|
101
|
+
/* @__PURE__ */ C("div", {
|
|
102
102
|
style: {
|
|
103
103
|
flex: 1,
|
|
104
104
|
minWidth: 0
|
|
105
105
|
},
|
|
106
|
-
children: [/* @__PURE__ */
|
|
106
|
+
children: [/* @__PURE__ */ S("div", {
|
|
107
107
|
style: {
|
|
108
108
|
fontSize: 14,
|
|
109
109
|
fontWeight: 600,
|
|
@@ -112,29 +112,29 @@ function E({ entity: E, entityCode: O, record: k, title: A, recordId: j, avatarN
|
|
|
112
112
|
textOverflow: "ellipsis",
|
|
113
113
|
whiteSpace: "nowrap"
|
|
114
114
|
},
|
|
115
|
-
children:
|
|
116
|
-
}),
|
|
115
|
+
children: k
|
|
116
|
+
}), A && /* @__PURE__ */ S("div", {
|
|
117
117
|
className: "mono",
|
|
118
118
|
style: {
|
|
119
119
|
fontSize: 11,
|
|
120
120
|
color: "var(--text-4)"
|
|
121
121
|
},
|
|
122
|
-
children:
|
|
122
|
+
children: A
|
|
123
123
|
})]
|
|
124
124
|
}),
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
-
icon: /* @__PURE__ */
|
|
125
|
+
/* @__PURE__ */ S(r, {
|
|
126
|
+
icon: /* @__PURE__ */ S(t.external, { size: 13 }),
|
|
127
127
|
title: K ? H("list.peek.open_in_tab_dirty", "Open in tab (keeps unsaved changes)") : H("list.peek.open_in_tab", "Open in tab"),
|
|
128
128
|
onClick: () => B(K ? W : null)
|
|
129
129
|
}),
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
icon: /* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ S(r, {
|
|
131
|
+
icon: /* @__PURE__ */ S(t.x, { size: 14 }),
|
|
132
132
|
title: H("list.peek.close", "Close"),
|
|
133
133
|
onClick: z
|
|
134
134
|
})
|
|
135
135
|
]
|
|
136
136
|
}),
|
|
137
|
-
/* @__PURE__ */
|
|
137
|
+
/* @__PURE__ */ C("div", {
|
|
138
138
|
style: {
|
|
139
139
|
flex: 1,
|
|
140
140
|
overflowY: "auto",
|
|
@@ -143,7 +143,7 @@ function E({ entity: E, entityCode: O, record: k, title: A, recordId: j, avatarN
|
|
|
143
143
|
flexDirection: "column",
|
|
144
144
|
gap: 10
|
|
145
145
|
},
|
|
146
|
-
children: [/* @__PURE__ */
|
|
146
|
+
children: [/* @__PURE__ */ C("div", {
|
|
147
147
|
style: {
|
|
148
148
|
padding: "8px 10px",
|
|
149
149
|
background: "var(--accent-soft)",
|
|
@@ -154,20 +154,19 @@ function E({ entity: E, entityCode: O, record: k, title: A, recordId: j, avatarN
|
|
|
154
154
|
alignItems: "center",
|
|
155
155
|
gap: 6
|
|
156
156
|
},
|
|
157
|
-
children: [
|
|
158
|
-
/* @__PURE__ */
|
|
157
|
+
children: [ne && /* @__PURE__ */ C(x, { children: [
|
|
158
|
+
/* @__PURE__ */ S(t.sparkle, { size: 12 }),
|
|
159
159
|
" ",
|
|
160
|
-
H("list.peek.hint", "Inline quick-edit — click any field to change.")
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}), M.map((e) => /* @__PURE__ */ C(D, {
|
|
160
|
+
H("list.peek.hint", "Inline quick-edit — click any field to change.")
|
|
161
|
+
] }), e(H("list.peek.keys_hint", "{tab} to move, {esc} to close."), {
|
|
162
|
+
tab: /* @__PURE__ */ S(i, { children: w.tab }),
|
|
163
|
+
esc: /* @__PURE__ */ S(i, { children: w.esc })
|
|
164
|
+
})]
|
|
165
|
+
}), M.map((e) => /* @__PURE__ */ S(E, {
|
|
167
166
|
label: e.label,
|
|
168
|
-
children: e.kind === "file" ?
|
|
169
|
-
entity:
|
|
170
|
-
entityCode:
|
|
167
|
+
children: e.kind === "file" ? u({
|
|
168
|
+
entity: T,
|
|
169
|
+
entityCode: D,
|
|
171
170
|
fieldName: e.key,
|
|
172
171
|
record: W,
|
|
173
172
|
mode: e.readOnly ? "display" : "edit",
|
|
@@ -175,7 +174,7 @@ function E({ entity: E, entityCode: O, record: k, title: A, recordId: j, avatarN
|
|
|
175
174
|
refs: N,
|
|
176
175
|
disabled: e.readOnly,
|
|
177
176
|
t: H
|
|
178
|
-
}) : /* @__PURE__ */
|
|
177
|
+
}) : /* @__PURE__ */ S(h, {
|
|
179
178
|
field: e.field,
|
|
180
179
|
fieldName: e.key,
|
|
181
180
|
label: e.label,
|
|
@@ -187,7 +186,7 @@ function E({ entity: E, entityCode: O, record: k, title: A, recordId: j, avatarN
|
|
|
187
186
|
})
|
|
188
187
|
}, e.key))]
|
|
189
188
|
}),
|
|
190
|
-
/* @__PURE__ */
|
|
189
|
+
/* @__PURE__ */ C("div", {
|
|
191
190
|
style: {
|
|
192
191
|
display: "flex",
|
|
193
192
|
padding: "10px 14px",
|
|
@@ -196,7 +195,7 @@ function E({ entity: E, entityCode: O, record: k, title: A, recordId: j, avatarN
|
|
|
196
195
|
alignItems: "center"
|
|
197
196
|
},
|
|
198
197
|
children: [
|
|
199
|
-
K && /* @__PURE__ */
|
|
198
|
+
K && /* @__PURE__ */ C("span", {
|
|
200
199
|
style: {
|
|
201
200
|
fontSize: 11,
|
|
202
201
|
color: "var(--warn)",
|
|
@@ -204,21 +203,21 @@ function E({ entity: E, entityCode: O, record: k, title: A, recordId: j, avatarN
|
|
|
204
203
|
alignItems: "center",
|
|
205
204
|
gap: 4
|
|
206
205
|
},
|
|
207
|
-
children: [/* @__PURE__ */
|
|
206
|
+
children: [/* @__PURE__ */ S("span", { style: {
|
|
208
207
|
width: 6,
|
|
209
208
|
height: 6,
|
|
210
209
|
borderRadius: 999,
|
|
211
210
|
background: "var(--warn)"
|
|
212
211
|
} }), H("list.peek.unsaved", "Unsaved")]
|
|
213
212
|
}),
|
|
214
|
-
/* @__PURE__ */
|
|
213
|
+
/* @__PURE__ */ S("div", {
|
|
215
214
|
style: {
|
|
216
215
|
flex: 1,
|
|
217
216
|
minWidth: 0,
|
|
218
217
|
display: "flex",
|
|
219
218
|
justifyContent: "flex-end"
|
|
220
219
|
},
|
|
221
|
-
children: Z.length > 0 && /* @__PURE__ */
|
|
220
|
+
children: Z.length > 0 && /* @__PURE__ */ S(d, {
|
|
222
221
|
layout: Z,
|
|
223
222
|
row: W,
|
|
224
223
|
onRun: (e, t) => Q({
|
|
@@ -231,9 +230,9 @@ function E({ entity: E, entityCode: O, record: k, title: A, recordId: j, avatarN
|
|
|
231
230
|
ariaLabel: H("list.peek.actions", "Quick peek actions")
|
|
232
231
|
})
|
|
233
232
|
}),
|
|
234
|
-
/* @__PURE__ */
|
|
233
|
+
/* @__PURE__ */ S(n, {
|
|
235
234
|
kind: "primary",
|
|
236
|
-
icon: /* @__PURE__ */
|
|
235
|
+
icon: /* @__PURE__ */ S(t.edit, { size: 13 }),
|
|
237
236
|
onClick: () => B(K ? W : null),
|
|
238
237
|
children: H("list.peek.open_full", "Open full")
|
|
239
238
|
})
|
|
@@ -242,8 +241,8 @@ function E({ entity: E, entityCode: O, record: k, title: A, recordId: j, avatarN
|
|
|
242
241
|
]
|
|
243
242
|
})] });
|
|
244
243
|
}
|
|
245
|
-
function
|
|
246
|
-
return /* @__PURE__ */
|
|
244
|
+
function E({ label: e, children: t }) {
|
|
245
|
+
return /* @__PURE__ */ C("div", {
|
|
247
246
|
style: {
|
|
248
247
|
display: "grid",
|
|
249
248
|
gridTemplateColumns: "120px 1fr",
|
|
@@ -251,15 +250,15 @@ function D({ label: e, children: t }) {
|
|
|
251
250
|
padding: "4px 0",
|
|
252
251
|
borderBottom: "1px solid var(--divider)"
|
|
253
252
|
},
|
|
254
|
-
children: [/* @__PURE__ */
|
|
253
|
+
children: [/* @__PURE__ */ S("div", {
|
|
255
254
|
style: {
|
|
256
255
|
fontSize: 11.5,
|
|
257
256
|
color: "var(--text-3)",
|
|
258
257
|
fontWeight: 500
|
|
259
258
|
},
|
|
260
259
|
children: e
|
|
261
|
-
}), /* @__PURE__ */
|
|
260
|
+
}), /* @__PURE__ */ S("div", { children: t })]
|
|
262
261
|
});
|
|
263
262
|
}
|
|
264
263
|
//#endregion
|
|
265
|
-
export {
|
|
264
|
+
export { E as QEField, T as QuickPeek };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { OrderedMap as e } from "../../types/ordmap.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
2
|
+
import { executeAction as t } from "../../api/data.js";
|
|
3
|
+
import { failureTitle as n } from "../../lib/failure.js";
|
|
4
|
+
import { Icon as r } from "../primitives/Icons.js";
|
|
5
|
+
import { Btn as i } from "../primitives/Btn.js";
|
|
6
|
+
import { Dropdown as a } from "../primitives/Dropdown.js";
|
|
7
|
+
import { useText as o } from "../../hooks/useText.js";
|
|
8
|
+
import { useResponsiveMode as s } from "../../hooks/useResponsiveMode.js";
|
|
9
|
+
import { MenuItem as c } from "../primitives/MenuItem.js";
|
|
10
10
|
import { useActionRunner as l } from "../actions/ActionRunner.js";
|
|
11
11
|
import { buildListQuery as u } from "./exportRequest.js";
|
|
12
12
|
import { useMemo as d, useRef as f, useState as p } from "react";
|
|
@@ -15,9 +15,9 @@ import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
|
15
15
|
//#region src/components/pages/DocumentsMenu.tsx
|
|
16
16
|
var v = "document-templates-available";
|
|
17
17
|
function y({ entityCode: e, scope: y, objectIds: C = [], viewState: w, selectedIds: T = [], capability: E, canManageTemplates: D = !1 }) {
|
|
18
|
-
let O =
|
|
18
|
+
let O = o(), k = o("errors"), { run: A } = l(), j = f(null), [M, N] = p(!1), P = y === "detail" ? !!E?.generate_one : !!E?.generate_many, F = D && !P, { data: I, isLoading: L, error: R } = m({
|
|
19
19
|
queryKey: [v, e],
|
|
20
|
-
queryFn: async () => (await
|
|
20
|
+
queryFn: async () => (await t("document.templates.available", { entity: e })).result?.templates ?? [],
|
|
21
21
|
enabled: M || F,
|
|
22
22
|
staleTime: 6e4
|
|
23
23
|
}), z = L, B = d(() => (I ?? []).filter((e) => y === "detail" ? e.input_mode === "one" || e.input_mode === "global" : e.input_mode === "many" || e.input_mode === "global"), [y, I]), V = F && B.length > 0, H = P || V;
|
|
@@ -42,76 +42,76 @@ function y({ entityCode: e, scope: y, objectIds: C = [], viewState: w, selectedI
|
|
|
42
42
|
}
|
|
43
43
|
return [];
|
|
44
44
|
}
|
|
45
|
-
function G(e,
|
|
46
|
-
let
|
|
45
|
+
function G(e, n, r) {
|
|
46
|
+
let i = b(e), a = O(e.name) || e.code;
|
|
47
47
|
N(!1), A({
|
|
48
|
-
action:
|
|
49
|
-
title:
|
|
50
|
-
execute: (
|
|
51
|
-
let
|
|
48
|
+
action: i,
|
|
49
|
+
title: a,
|
|
50
|
+
execute: (i) => {
|
|
51
|
+
let a = {
|
|
52
52
|
template_code: e.code,
|
|
53
53
|
template_source: e.source,
|
|
54
|
-
output_format:
|
|
54
|
+
output_format: r
|
|
55
55
|
};
|
|
56
|
-
return Object.keys(
|
|
56
|
+
return Object.keys(i).length > 0 && (a.params = i), "objectIds" in n && (a.object_ids = n.objectIds), "query" in n && (a.query = {
|
|
57
57
|
scope: "current_view",
|
|
58
|
-
query:
|
|
59
|
-
}),
|
|
58
|
+
query: n.query
|
|
59
|
+
}), t("document.generate", a);
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
let { isPhone: K } =
|
|
63
|
+
let { isPhone: K } = s();
|
|
64
64
|
if (!H) return null;
|
|
65
65
|
let q = O("document.menu.generate", "Generate");
|
|
66
|
-
return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(
|
|
66
|
+
return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(i, {
|
|
67
67
|
ref: j,
|
|
68
68
|
kind: "ghost",
|
|
69
69
|
size: "sm",
|
|
70
|
-
icon: g(z ?
|
|
70
|
+
icon: g(z ? r.loader : r.filePlus, { size: 12 }),
|
|
71
71
|
onClick: U,
|
|
72
72
|
disabled: z,
|
|
73
73
|
"aria-label": q,
|
|
74
74
|
title: q,
|
|
75
75
|
children: K ? null : q
|
|
76
|
-
}), /* @__PURE__ */ _(
|
|
76
|
+
}), /* @__PURE__ */ _(a, {
|
|
77
77
|
open: M,
|
|
78
78
|
anchor: j.current,
|
|
79
79
|
onClose: () => N(!1),
|
|
80
80
|
align: "end",
|
|
81
81
|
width: 300,
|
|
82
82
|
children: [
|
|
83
|
-
z && /* @__PURE__ */ g(
|
|
83
|
+
z && /* @__PURE__ */ g(c, {
|
|
84
84
|
disabled: !0,
|
|
85
|
-
icon: /* @__PURE__ */ g(
|
|
85
|
+
icon: /* @__PURE__ */ g(r.loader, { size: 12 }),
|
|
86
86
|
children: O("document.menu.loading", "Loading templates...")
|
|
87
87
|
}),
|
|
88
|
-
R && /* @__PURE__ */ g(
|
|
88
|
+
R && /* @__PURE__ */ g(c, {
|
|
89
89
|
disabled: !0,
|
|
90
|
-
icon: /* @__PURE__ */ g(
|
|
91
|
-
children:
|
|
90
|
+
icon: /* @__PURE__ */ g(r.warning, { size: 12 }),
|
|
91
|
+
children: n(k, R)
|
|
92
92
|
}),
|
|
93
|
-
!z && !R && B.length === 0 && /* @__PURE__ */ g(
|
|
93
|
+
!z && !R && B.length === 0 && /* @__PURE__ */ g(c, {
|
|
94
94
|
disabled: !0,
|
|
95
|
-
icon: /* @__PURE__ */ g(
|
|
95
|
+
icon: /* @__PURE__ */ g(r.file, { size: 12 }),
|
|
96
96
|
children: O("document.menu.empty", "No document templates")
|
|
97
97
|
}),
|
|
98
98
|
!z && !R && B.map((e) => {
|
|
99
|
-
let
|
|
100
|
-
return
|
|
101
|
-
icon: /* @__PURE__ */ g(
|
|
102
|
-
onClick: () => G(e,
|
|
99
|
+
let t = W(e);
|
|
100
|
+
return t.length === 0 ? null : x(e).flatMap((n) => t.map((t) => n.available ? /* @__PURE__ */ g(c, {
|
|
101
|
+
icon: /* @__PURE__ */ g(r.file, { size: 12 }),
|
|
102
|
+
onClick: () => G(e, t, n.format),
|
|
103
103
|
title: O(e.description),
|
|
104
|
-
children: S(O, e,
|
|
105
|
-
}, `${e.source}:${e.code}:${
|
|
104
|
+
children: S(O, e, t, n.format)
|
|
105
|
+
}, `${e.source}:${e.code}:${t.kind}:${n.format}`) : /* @__PURE__ */ _(c, {
|
|
106
106
|
disabled: !0,
|
|
107
|
-
icon: /* @__PURE__ */ g(
|
|
108
|
-
title:
|
|
107
|
+
icon: /* @__PURE__ */ g(r.file, { size: 12 }),
|
|
108
|
+
title: n.disabled_reason,
|
|
109
109
|
children: [
|
|
110
|
-
S(O, e,
|
|
110
|
+
S(O, e, t, n.format),
|
|
111
111
|
" - ",
|
|
112
|
-
|
|
112
|
+
n.disabled_reason || O("document.not_available", "Unavailable")
|
|
113
113
|
]
|
|
114
|
-
}, `${e.source}:${e.code}:${
|
|
114
|
+
}, `${e.source}:${e.code}:${t.kind}:${n.format}:disabled`)));
|
|
115
115
|
})
|
|
116
116
|
]
|
|
117
117
|
})] });
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ApiError as e } from "../../types/api.js";
|
|
2
2
|
import { pluralText as t } from "../../lib/language.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
3
|
+
import { exportEntities as n } from "../../api/data.js";
|
|
4
|
+
import { failureTitle as r } from "../../lib/failure.js";
|
|
5
|
+
import { Icon as i } from "../primitives/Icons.js";
|
|
6
|
+
import { Btn as a } from "../primitives/Btn.js";
|
|
7
|
+
import { Dropdown as o } from "../primitives/Dropdown.js";
|
|
8
|
+
import { useText as s } from "../../hooks/useText.js";
|
|
9
|
+
import { useResponsiveMode as c } from "../../hooks/useResponsiveMode.js";
|
|
10
|
+
import { MenuItem as l } from "../primitives/MenuItem.js";
|
|
11
11
|
import { buildExportRequest as u } from "./exportRequest.js";
|
|
12
12
|
import { useRef as d, useState as f } from "react";
|
|
13
13
|
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
@@ -22,7 +22,7 @@ function _(e, n) {
|
|
|
22
22
|
}, { total: n.toLocaleString(e.language) });
|
|
23
23
|
}
|
|
24
24
|
function v(v) {
|
|
25
|
-
let x =
|
|
25
|
+
let x = s(), S = s("errors"), { isPhone: C } = c(), { entityCode: w, entity: T, screen: E, viewState: D, visibleColumns: O, selectedRowPKs: k, totalRows: A, pageRows: j, language: M, align: N = "end", variant: P = "toolbar", onBeforeOpen: F } = v, [I, L] = f(!1), [R, z] = f(!1), [B, V] = f(null), H = d(null), U = g(T.export), W = g(E?.export);
|
|
26
26
|
if (!U || !W) return null;
|
|
27
27
|
async function G(t) {
|
|
28
28
|
V(null), z(!0);
|
|
@@ -32,12 +32,12 @@ function v(v) {
|
|
|
32
32
|
visibleColumns: O,
|
|
33
33
|
selectedRowPKs: t === "selected_rows" ? k : void 0,
|
|
34
34
|
language: M
|
|
35
|
-
}), { blob:
|
|
36
|
-
b(
|
|
35
|
+
}), { blob: r, filename: i } = await n(w, e);
|
|
36
|
+
b(r, i || `${w}-${y()}.csv`), L(!1);
|
|
37
37
|
} catch (t) {
|
|
38
38
|
V({
|
|
39
39
|
code: t instanceof e ? t.code : "",
|
|
40
|
-
message:
|
|
40
|
+
message: r(S, t)
|
|
41
41
|
});
|
|
42
42
|
} finally {
|
|
43
43
|
z(!1);
|
|
@@ -45,8 +45,8 @@ function v(v) {
|
|
|
45
45
|
}
|
|
46
46
|
if (P === "selection-menu-item") {
|
|
47
47
|
let e = R || k.length === 0;
|
|
48
|
-
return /* @__PURE__ */ m(
|
|
49
|
-
icon: /* @__PURE__ */ m(
|
|
48
|
+
return /* @__PURE__ */ m(l, {
|
|
49
|
+
icon: /* @__PURE__ */ m(i.download, { size: 12 }),
|
|
50
50
|
"data-testid": "export-selection-menu-item",
|
|
51
51
|
onClick: e ? void 0 : () => {
|
|
52
52
|
F?.(), G("selected_rows");
|
|
@@ -55,11 +55,11 @@ function v(v) {
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
let K = k.length > 0, q = T.list_pagination === "cursor";
|
|
58
|
-
return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(
|
|
58
|
+
return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(a, {
|
|
59
59
|
ref: H,
|
|
60
60
|
kind: "ghost",
|
|
61
61
|
size: "sm",
|
|
62
|
-
icon: /* @__PURE__ */ m(
|
|
62
|
+
icon: /* @__PURE__ */ m(i.download, { size: 12 }),
|
|
63
63
|
onClick: () => {
|
|
64
64
|
F?.(), L((e) => !e);
|
|
65
65
|
},
|
|
@@ -67,30 +67,30 @@ function v(v) {
|
|
|
67
67
|
"aria-label": x("export.menu.export", "Export"),
|
|
68
68
|
title: x("export.menu.export", "Export"),
|
|
69
69
|
children: C ? null : R ? x("export.menu.exporting", "Exporting…") : x("export.menu.export", "Export")
|
|
70
|
-
}), /* @__PURE__ */ h(
|
|
70
|
+
}), /* @__PURE__ */ h(o, {
|
|
71
71
|
open: I,
|
|
72
72
|
anchor: H.current,
|
|
73
73
|
onClose: () => L(!1),
|
|
74
74
|
align: N,
|
|
75
75
|
width: 260,
|
|
76
76
|
children: [
|
|
77
|
-
/* @__PURE__ */ m(
|
|
78
|
-
icon: /* @__PURE__ */ m(
|
|
77
|
+
/* @__PURE__ */ m(l, {
|
|
78
|
+
icon: /* @__PURE__ */ m(i.download, { size: 12 }),
|
|
79
79
|
onClick: R ? void 0 : () => void G("current_view"),
|
|
80
80
|
children: _(x, A)
|
|
81
81
|
}),
|
|
82
|
-
K && /* @__PURE__ */ m(
|
|
83
|
-
icon: /* @__PURE__ */ m(
|
|
82
|
+
K && /* @__PURE__ */ m(l, {
|
|
83
|
+
icon: /* @__PURE__ */ m(i.check, { size: 12 }),
|
|
84
84
|
onClick: R ? void 0 : () => void G("selected_rows"),
|
|
85
85
|
children: x("export.scope.selected_rows", "Selected rows (CSV) · {count}", { count: k.length })
|
|
86
86
|
}),
|
|
87
|
-
q ? /* @__PURE__ */ m(
|
|
88
|
-
icon: /* @__PURE__ */ m(
|
|
87
|
+
q ? /* @__PURE__ */ m(l, {
|
|
88
|
+
icon: /* @__PURE__ */ m(i.columns, { size: 12 }),
|
|
89
89
|
"data-testid": "export-current-page-disabled",
|
|
90
90
|
disabled: !0,
|
|
91
91
|
children: x("export.scope.current_page_unavailable_cursor", "Current page · n/a (infinite scroll)")
|
|
92
|
-
}) : /* @__PURE__ */ m(
|
|
93
|
-
icon: /* @__PURE__ */ m(
|
|
92
|
+
}) : /* @__PURE__ */ m(l, {
|
|
93
|
+
icon: /* @__PURE__ */ m(i.columns, { size: 12 }),
|
|
94
94
|
onClick: R ? void 0 : () => void G("current_page"),
|
|
95
95
|
children: j === void 0 ? x("export.scope.current_page_window", "Current page (CSV) · page window") : t(x, "export.scope.current_page", j, {
|
|
96
96
|
one: "Current page (CSV) · {count} row",
|