xladmin 0.3.2 → 0.3.4
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/components/layout/AdminMessageContext.d.ts +18 -0
- package/dist/i18n.d.ts +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +814 -504
- package/dist/types/index.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -302,8 +302,8 @@ function handleNavLinkClick(event, { href, onClick, router }) {
|
|
|
302
302
|
}
|
|
303
303
|
|
|
304
304
|
// src/components/FormDialog.tsx
|
|
305
|
-
import { useEffect as
|
|
306
|
-
import { Alert, Box, Button, Dialog, DialogActions, DialogContent, DialogTitle } from "@mui/material";
|
|
305
|
+
import { useEffect as useEffect4, useMemo as useMemo5, useState as useState4 } from "react";
|
|
306
|
+
import { Alert, Box as Box2, Button, Dialog, DialogActions, DialogContent, DialogTitle } from "@mui/material";
|
|
307
307
|
import { LocalizationProvider } from "@mui/x-date-pickers";
|
|
308
308
|
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
|
|
309
309
|
|
|
@@ -363,7 +363,12 @@ var messages = {
|
|
|
363
363
|
menu: "\u041C\u0435\u043D\u044E",
|
|
364
364
|
show_details: "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u043E\u043F\u0438\u0441\u0430\u043D\u0438\u0435",
|
|
365
365
|
hide_details: "\u0421\u043A\u0440\u044B\u0442\u044C \u043E\u043F\u0438\u0441\u0430\u043D\u0438\u0435",
|
|
366
|
-
staff_only: "\u0414\u043E\u0441\u0442\u0443\u043F \u043A \u0430\u0434\u043C\u0438\u043D\u043A\u0435 \u0435\u0441\u0442\u044C \u0442\u043E\u043B\u044C\u043A\u043E \u0443 staff-\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u0435\u0439."
|
|
366
|
+
staff_only: "\u0414\u043E\u0441\u0442\u0443\u043F \u043A \u0430\u0434\u043C\u0438\u043D\u043A\u0435 \u0435\u0441\u0442\u044C \u0442\u043E\u043B\u044C\u043A\u043E \u0443 staff-\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u0435\u0439.",
|
|
367
|
+
action_success: '\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 "{action}" \u0432\u044B\u043F\u043E\u043B\u043D\u0435\u043D\u043E \u0434\u043B\u044F {count} \u043E\u0431\u044A\u0435\u043A\u0442\u043E\u0432.',
|
|
368
|
+
delete_success: "\u0423\u0434\u0430\u043B\u0435\u043D\u043E \u043E\u0431\u044A\u0435\u043A\u0442\u043E\u0432: {count}.",
|
|
369
|
+
object_saved_success: "\u041E\u0431\u044A\u0435\u043A\u0442 \u0441\u043E\u0445\u0440\u0430\u043D\u0451\u043D.",
|
|
370
|
+
object_created_success: "\u041E\u0431\u044A\u0435\u043A\u0442 \u0441\u043E\u0437\u0434\u0430\u043D.",
|
|
371
|
+
object_deleted_success: "\u041E\u0431\u044A\u0435\u043A\u0442 \u0443\u0434\u0430\u043B\u0451\u043D."
|
|
367
372
|
},
|
|
368
373
|
en: {
|
|
369
374
|
admin_title: "Admin",
|
|
@@ -417,7 +422,12 @@ var messages = {
|
|
|
417
422
|
menu: "Menu",
|
|
418
423
|
show_details: "Show details",
|
|
419
424
|
hide_details: "Hide details",
|
|
420
|
-
staff_only: "Only staff users can access the admin."
|
|
425
|
+
staff_only: "Only staff users can access the admin.",
|
|
426
|
+
action_success: 'Action "{action}" completed for {count} items.',
|
|
427
|
+
delete_success: "Deleted items: {count}.",
|
|
428
|
+
object_saved_success: "Object saved.",
|
|
429
|
+
object_created_success: "Object created.",
|
|
430
|
+
object_deleted_success: "Object deleted."
|
|
421
431
|
}
|
|
422
432
|
};
|
|
423
433
|
var AdminLocaleContext = createContext2("ru");
|
|
@@ -1046,8 +1056,217 @@ function stringifyJsonValue(value) {
|
|
|
1046
1056
|
return JSON.stringify(value, null, 2);
|
|
1047
1057
|
}
|
|
1048
1058
|
|
|
1049
|
-
// src/components/
|
|
1059
|
+
// src/components/layout/AdminMessageContext.tsx
|
|
1060
|
+
import { createContext as createContext3, useCallback as useCallback2, useContext as useContext3, useEffect as useEffect3, useMemo as useMemo4, useRef as useRef3, useState as useState3 } from "react";
|
|
1061
|
+
import CheckCircleOutlineIcon from "@mui/icons-material/CheckCircleOutline";
|
|
1062
|
+
import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline";
|
|
1063
|
+
import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined";
|
|
1064
|
+
import { Box, Paper, Portal, Stack, Typography } from "@mui/material";
|
|
1065
|
+
import { alpha, useTheme } from "@mui/material/styles";
|
|
1050
1066
|
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1067
|
+
var DEFAULT_DURATION_MS = 3e3;
|
|
1068
|
+
var EXIT_DURATION_MS = 220;
|
|
1069
|
+
var defaultAdminMessageApi = {
|
|
1070
|
+
show: () => -1,
|
|
1071
|
+
success: () => -1,
|
|
1072
|
+
error: () => -1,
|
|
1073
|
+
info: () => -1,
|
|
1074
|
+
dismiss: () => {
|
|
1075
|
+
},
|
|
1076
|
+
clear: () => {
|
|
1077
|
+
}
|
|
1078
|
+
};
|
|
1079
|
+
var AdminMessageContext = createContext3(defaultAdminMessageApi);
|
|
1080
|
+
function AdminMessageProvider({ children }) {
|
|
1081
|
+
const [items, setItems] = useState3([]);
|
|
1082
|
+
const idRef = useRef3(0);
|
|
1083
|
+
const dismissTimersRef = useRef3(/* @__PURE__ */ new Map());
|
|
1084
|
+
const removeTimersRef = useRef3(/* @__PURE__ */ new Map());
|
|
1085
|
+
const dismiss = useCallback2((id) => {
|
|
1086
|
+
const dismissTimerId = dismissTimersRef.current.get(id);
|
|
1087
|
+
if (dismissTimerId !== void 0) {
|
|
1088
|
+
window.clearTimeout(dismissTimerId);
|
|
1089
|
+
dismissTimersRef.current.delete(id);
|
|
1090
|
+
}
|
|
1091
|
+
setItems((current) => current.map((item) => item.id === id ? { ...item, leaving: true } : item));
|
|
1092
|
+
const previousRemoveTimerId = removeTimersRef.current.get(id);
|
|
1093
|
+
if (previousRemoveTimerId !== void 0) {
|
|
1094
|
+
window.clearTimeout(previousRemoveTimerId);
|
|
1095
|
+
}
|
|
1096
|
+
const removeTimerId = window.setTimeout(() => {
|
|
1097
|
+
setItems((current) => current.filter((item) => item.id !== id));
|
|
1098
|
+
removeTimersRef.current.delete(id);
|
|
1099
|
+
}, EXIT_DURATION_MS);
|
|
1100
|
+
removeTimersRef.current.set(id, removeTimerId);
|
|
1101
|
+
}, []);
|
|
1102
|
+
const show = useCallback2((kind, text, options) => {
|
|
1103
|
+
var _a;
|
|
1104
|
+
if (!text.trim()) {
|
|
1105
|
+
return -1;
|
|
1106
|
+
}
|
|
1107
|
+
idRef.current += 1;
|
|
1108
|
+
const id = idRef.current;
|
|
1109
|
+
setItems((current) => [...current, { id, kind, text, leaving: false }]);
|
|
1110
|
+
const duration = (_a = options == null ? void 0 : options.duration) != null ? _a : DEFAULT_DURATION_MS;
|
|
1111
|
+
const dismissTimerId = window.setTimeout(() => dismiss(id), duration);
|
|
1112
|
+
dismissTimersRef.current.set(id, dismissTimerId);
|
|
1113
|
+
return id;
|
|
1114
|
+
}, [dismiss]);
|
|
1115
|
+
const clear = useCallback2(() => {
|
|
1116
|
+
for (const timerId of dismissTimersRef.current.values()) {
|
|
1117
|
+
window.clearTimeout(timerId);
|
|
1118
|
+
}
|
|
1119
|
+
for (const timerId of removeTimersRef.current.values()) {
|
|
1120
|
+
window.clearTimeout(timerId);
|
|
1121
|
+
}
|
|
1122
|
+
dismissTimersRef.current.clear();
|
|
1123
|
+
removeTimersRef.current.clear();
|
|
1124
|
+
setItems([]);
|
|
1125
|
+
}, []);
|
|
1126
|
+
useEffect3(() => clear, [clear]);
|
|
1127
|
+
const value = useMemo4(() => ({
|
|
1128
|
+
show,
|
|
1129
|
+
success: (text, options) => show("success", text, options),
|
|
1130
|
+
error: (text, options) => show("error", text, options),
|
|
1131
|
+
info: (text, options) => show("info", text, options),
|
|
1132
|
+
dismiss,
|
|
1133
|
+
clear
|
|
1134
|
+
}), [clear, dismiss, show]);
|
|
1135
|
+
return /* @__PURE__ */ jsxs2(AdminMessageContext.Provider, { value, children: [
|
|
1136
|
+
children,
|
|
1137
|
+
/* @__PURE__ */ jsx4(AdminMessageViewport, { items, onDismiss: dismiss })
|
|
1138
|
+
] });
|
|
1139
|
+
}
|
|
1140
|
+
function useAdminMessage() {
|
|
1141
|
+
return useContext3(AdminMessageContext);
|
|
1142
|
+
}
|
|
1143
|
+
function AdminMessageViewport({
|
|
1144
|
+
items,
|
|
1145
|
+
onDismiss
|
|
1146
|
+
}) {
|
|
1147
|
+
return /* @__PURE__ */ jsx4(Portal, { children: /* @__PURE__ */ jsx4(
|
|
1148
|
+
Box,
|
|
1149
|
+
{
|
|
1150
|
+
"aria-live": "polite",
|
|
1151
|
+
sx: {
|
|
1152
|
+
position: "fixed",
|
|
1153
|
+
top: { xs: 12, sm: 16 },
|
|
1154
|
+
right: { xs: 12, sm: 16 },
|
|
1155
|
+
zIndex: (theme) => theme.zIndex.modal + 40,
|
|
1156
|
+
width: { xs: "calc(100vw - 24px)", sm: 360 },
|
|
1157
|
+
maxWidth: "100%",
|
|
1158
|
+
pointerEvents: "none"
|
|
1159
|
+
},
|
|
1160
|
+
children: /* @__PURE__ */ jsx4(Stack, { spacing: 1, children: items.map((item) => /* @__PURE__ */ jsx4(AdminMessageBubble, { item, onDismiss }, item.id)) })
|
|
1161
|
+
}
|
|
1162
|
+
) });
|
|
1163
|
+
}
|
|
1164
|
+
function AdminMessageBubble({
|
|
1165
|
+
item,
|
|
1166
|
+
onDismiss
|
|
1167
|
+
}) {
|
|
1168
|
+
const theme = useTheme();
|
|
1169
|
+
const appearance = getBubbleAppearance(theme, item.kind);
|
|
1170
|
+
const Icon = appearance.icon;
|
|
1171
|
+
return /* @__PURE__ */ jsx4(
|
|
1172
|
+
Paper,
|
|
1173
|
+
{
|
|
1174
|
+
elevation: 0,
|
|
1175
|
+
onClick: () => onDismiss(item.id),
|
|
1176
|
+
role: "button",
|
|
1177
|
+
sx: {
|
|
1178
|
+
pointerEvents: "auto",
|
|
1179
|
+
cursor: "pointer",
|
|
1180
|
+
borderRadius: "11px",
|
|
1181
|
+
px: 1.5,
|
|
1182
|
+
py: 1.125,
|
|
1183
|
+
border: `1px solid ${appearance.borderColor}`,
|
|
1184
|
+
backgroundColor: appearance.backgroundColor,
|
|
1185
|
+
boxShadow: `0 14px 32px ${alpha("#000000", 0.22)}`,
|
|
1186
|
+
transform: item.leaving ? "translateX(24px) scale(0.98)" : "translateX(0) scale(1)",
|
|
1187
|
+
opacity: item.leaving ? 0 : 1,
|
|
1188
|
+
transition: "transform 220ms ease, opacity 220ms ease",
|
|
1189
|
+
animation: item.leaving ? "none" : "adminMessageEnter 220ms cubic-bezier(0.2, 0.8, 0.2, 1)",
|
|
1190
|
+
"@keyframes adminMessageEnter": {
|
|
1191
|
+
"0%": {
|
|
1192
|
+
opacity: 0,
|
|
1193
|
+
transform: "translateX(32px) scale(0.96)"
|
|
1194
|
+
},
|
|
1195
|
+
"100%": {
|
|
1196
|
+
opacity: 1,
|
|
1197
|
+
transform: "translateX(0) scale(1)"
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
},
|
|
1201
|
+
children: /* @__PURE__ */ jsxs2(Stack, { direction: "row", spacing: 1.125, alignItems: "center", children: [
|
|
1202
|
+
/* @__PURE__ */ jsx4(
|
|
1203
|
+
Box,
|
|
1204
|
+
{
|
|
1205
|
+
sx: {
|
|
1206
|
+
width: 26,
|
|
1207
|
+
height: 26,
|
|
1208
|
+
borderRadius: "999px",
|
|
1209
|
+
display: "flex",
|
|
1210
|
+
alignItems: "center",
|
|
1211
|
+
justifyContent: "center",
|
|
1212
|
+
flexShrink: 0,
|
|
1213
|
+
color: appearance.iconColor,
|
|
1214
|
+
backgroundColor: appearance.iconBackgroundColor
|
|
1215
|
+
},
|
|
1216
|
+
children: /* @__PURE__ */ jsx4(Icon, { sx: { fontSize: 17 } })
|
|
1217
|
+
}
|
|
1218
|
+
),
|
|
1219
|
+
/* @__PURE__ */ jsx4(
|
|
1220
|
+
Typography,
|
|
1221
|
+
{
|
|
1222
|
+
sx: {
|
|
1223
|
+
fontSize: 14,
|
|
1224
|
+
lineHeight: 1.35,
|
|
1225
|
+
fontWeight: 500,
|
|
1226
|
+
color: "text.primary",
|
|
1227
|
+
wordBreak: "break-word",
|
|
1228
|
+
flex: 1,
|
|
1229
|
+
display: "flex",
|
|
1230
|
+
alignItems: "center",
|
|
1231
|
+
minHeight: 26
|
|
1232
|
+
},
|
|
1233
|
+
children: item.text
|
|
1234
|
+
}
|
|
1235
|
+
)
|
|
1236
|
+
] })
|
|
1237
|
+
}
|
|
1238
|
+
);
|
|
1239
|
+
}
|
|
1240
|
+
function getBubbleAppearance(theme, kind) {
|
|
1241
|
+
if (kind === "success") {
|
|
1242
|
+
return {
|
|
1243
|
+
icon: CheckCircleOutlineIcon,
|
|
1244
|
+
borderColor: alpha(theme.palette.success.main, 0.5),
|
|
1245
|
+
backgroundColor: alpha(theme.palette.success.main, 0.18),
|
|
1246
|
+
iconColor: theme.palette.success.main,
|
|
1247
|
+
iconBackgroundColor: alpha(theme.palette.success.main, 0.24)
|
|
1248
|
+
};
|
|
1249
|
+
}
|
|
1250
|
+
if (kind === "error") {
|
|
1251
|
+
return {
|
|
1252
|
+
icon: ErrorOutlineIcon,
|
|
1253
|
+
borderColor: alpha(theme.palette.error.main, 0.42),
|
|
1254
|
+
backgroundColor: alpha(theme.palette.error.main, 0.14),
|
|
1255
|
+
iconColor: theme.palette.error.main,
|
|
1256
|
+
iconBackgroundColor: alpha(theme.palette.error.main, 0.18)
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
return {
|
|
1260
|
+
icon: InfoOutlinedIcon,
|
|
1261
|
+
borderColor: alpha(theme.palette.info.main, 0.42),
|
|
1262
|
+
backgroundColor: alpha(theme.palette.info.main, 0.14),
|
|
1263
|
+
iconColor: theme.palette.info.main,
|
|
1264
|
+
iconBackgroundColor: alpha(theme.palette.info.main, 0.18)
|
|
1265
|
+
};
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
// src/components/FormDialog.tsx
|
|
1269
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1051
1270
|
function FormDialog({
|
|
1052
1271
|
open,
|
|
1053
1272
|
onClose,
|
|
@@ -1061,18 +1280,19 @@ function FormDialog({
|
|
|
1061
1280
|
itemId
|
|
1062
1281
|
}) {
|
|
1063
1282
|
const t = useAdminTranslation();
|
|
1064
|
-
const
|
|
1065
|
-
const [
|
|
1066
|
-
const [
|
|
1067
|
-
const
|
|
1283
|
+
const message = useAdminMessage();
|
|
1284
|
+
const [values, setValues] = useState4({});
|
|
1285
|
+
const [error, setError] = useState4(null);
|
|
1286
|
+
const [isSaving, setIsSaving] = useState4(false);
|
|
1287
|
+
const editableFieldNames = useMemo5(
|
|
1068
1288
|
() => mode === "create" ? meta.create_fields : meta.update_fields,
|
|
1069
1289
|
[meta.create_fields, meta.update_fields, mode]
|
|
1070
1290
|
);
|
|
1071
|
-
const editableFields =
|
|
1291
|
+
const editableFields = useMemo5(
|
|
1072
1292
|
() => meta.fields.filter((field) => editableFieldNames.includes(field.name)),
|
|
1073
1293
|
[editableFieldNames, meta.fields]
|
|
1074
1294
|
);
|
|
1075
|
-
|
|
1295
|
+
useEffect4(() => {
|
|
1076
1296
|
setValues(initialValues != null ? initialValues : {});
|
|
1077
1297
|
setError(null);
|
|
1078
1298
|
setIsSaving(false);
|
|
@@ -1087,18 +1307,22 @@ function FormDialog({
|
|
|
1087
1307
|
try {
|
|
1088
1308
|
if (mode === "create") {
|
|
1089
1309
|
await client.createItem(slug, payload);
|
|
1310
|
+
message.success(t("object_created_success"));
|
|
1090
1311
|
} else if (itemId !== void 0) {
|
|
1091
1312
|
await client.patchItem(slug, itemId, payload);
|
|
1313
|
+
message.success(t("object_saved_success"));
|
|
1092
1314
|
}
|
|
1093
1315
|
onSuccess();
|
|
1094
1316
|
onClose();
|
|
1095
1317
|
} catch (reason) {
|
|
1096
|
-
|
|
1318
|
+
const nextError = reason instanceof Error ? reason.message : t("object_save_error");
|
|
1319
|
+
setError(nextError);
|
|
1320
|
+
message.error(nextError);
|
|
1097
1321
|
} finally {
|
|
1098
1322
|
setIsSaving(false);
|
|
1099
1323
|
}
|
|
1100
1324
|
};
|
|
1101
|
-
return /* @__PURE__ */
|
|
1325
|
+
return /* @__PURE__ */ jsxs3(
|
|
1102
1326
|
Dialog,
|
|
1103
1327
|
{
|
|
1104
1328
|
open,
|
|
@@ -1120,10 +1344,10 @@ function FormDialog({
|
|
|
1120
1344
|
}
|
|
1121
1345
|
},
|
|
1122
1346
|
children: [
|
|
1123
|
-
/* @__PURE__ */
|
|
1124
|
-
/* @__PURE__ */
|
|
1125
|
-
error ? /* @__PURE__ */
|
|
1126
|
-
editableFields.map((field) => /* @__PURE__ */
|
|
1347
|
+
/* @__PURE__ */ jsx5(DialogTitle, { children: title }),
|
|
1348
|
+
/* @__PURE__ */ jsx5(DialogContent, { children: /* @__PURE__ */ jsx5(LocalizationProvider, { dateAdapter: AdapterDayjs, adapterLocale: meta.locale, children: /* @__PURE__ */ jsxs3(Box2, { sx: { display: "grid", gap: 2, pt: 1 }, children: [
|
|
1349
|
+
error ? /* @__PURE__ */ jsx5(Alert, { severity: "error", children: error }) : null,
|
|
1350
|
+
editableFields.map((field) => /* @__PURE__ */ jsx5(
|
|
1127
1351
|
FieldEditor,
|
|
1128
1352
|
{
|
|
1129
1353
|
field,
|
|
@@ -1137,9 +1361,9 @@ function FormDialog({
|
|
|
1137
1361
|
field.name
|
|
1138
1362
|
))
|
|
1139
1363
|
] }) }) }),
|
|
1140
|
-
/* @__PURE__ */
|
|
1141
|
-
/* @__PURE__ */
|
|
1142
|
-
/* @__PURE__ */
|
|
1364
|
+
/* @__PURE__ */ jsxs3(DialogActions, { children: [
|
|
1365
|
+
/* @__PURE__ */ jsx5(Button, { onClick: onClose, disabled: isSaving, children: t("cancel") }),
|
|
1366
|
+
/* @__PURE__ */ jsx5(Button, { variant: "contained", onClick: () => void handleSave(), disabled: isSaving, children: isSaving ? t("saving") : t("save") })
|
|
1143
1367
|
] })
|
|
1144
1368
|
]
|
|
1145
1369
|
}
|
|
@@ -1147,13 +1371,13 @@ function FormDialog({
|
|
|
1147
1371
|
}
|
|
1148
1372
|
|
|
1149
1373
|
// src/components/OverviewPage.tsx
|
|
1150
|
-
import { useEffect as
|
|
1151
|
-
import { Alert as Alert3, Box as
|
|
1374
|
+
import { useEffect as useEffect7, useMemo as useMemo7, useState as useState7 } from "react";
|
|
1375
|
+
import { Alert as Alert3, Box as Box6, Grid, Paper as Paper4, Skeleton as Skeleton2, Stack as Stack6 } from "@mui/material";
|
|
1152
1376
|
|
|
1153
1377
|
// src/hooks/useAdminDocumentTitle.ts
|
|
1154
|
-
import { useEffect as
|
|
1378
|
+
import { useEffect as useEffect5 } from "react";
|
|
1155
1379
|
function useAdminDocumentTitle(...parts) {
|
|
1156
|
-
|
|
1380
|
+
useEffect5(() => {
|
|
1157
1381
|
const title = parts.map((part) => part == null ? void 0 : part.trim()).filter((part) => Boolean(part)).join(" | ");
|
|
1158
1382
|
if (!title) {
|
|
1159
1383
|
return;
|
|
@@ -1163,24 +1387,24 @@ function useAdminDocumentTitle(...parts) {
|
|
|
1163
1387
|
}
|
|
1164
1388
|
|
|
1165
1389
|
// src/components/layout/AdminDataContext.tsx
|
|
1166
|
-
import { createContext as
|
|
1167
|
-
import { jsx as
|
|
1390
|
+
import { createContext as createContext4, useContext as useContext4 } from "react";
|
|
1391
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1168
1392
|
var defaultAdminDataContextValue = {
|
|
1169
1393
|
locale: "ru",
|
|
1170
1394
|
models: [],
|
|
1171
1395
|
blocks: []
|
|
1172
1396
|
};
|
|
1173
|
-
var AdminDataContext =
|
|
1397
|
+
var AdminDataContext = createContext4(defaultAdminDataContextValue);
|
|
1174
1398
|
function AdminDataProvider({ value, children }) {
|
|
1175
|
-
return /* @__PURE__ */
|
|
1399
|
+
return /* @__PURE__ */ jsx6(AdminDataContext.Provider, { value, children });
|
|
1176
1400
|
}
|
|
1177
1401
|
function useAdminData() {
|
|
1178
|
-
return
|
|
1402
|
+
return useContext4(AdminDataContext);
|
|
1179
1403
|
}
|
|
1180
1404
|
|
|
1181
1405
|
// src/components/ModelsBlocks.tsx
|
|
1182
|
-
import { memo as memo2, useMemo as
|
|
1183
|
-
import { Box as
|
|
1406
|
+
import { memo as memo2, useMemo as useMemo6 } from "react";
|
|
1407
|
+
import { Box as Box4, Stack as Stack4, useMediaQuery, useTheme as useTheme2 } from "@mui/material";
|
|
1184
1408
|
|
|
1185
1409
|
// src/components/models-blocks/DashboardModelsBlock.tsx
|
|
1186
1410
|
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
|
@@ -1191,16 +1415,16 @@ import {
|
|
|
1191
1415
|
ButtonBase,
|
|
1192
1416
|
ListItemButton,
|
|
1193
1417
|
ListItemText,
|
|
1194
|
-
Stack as
|
|
1418
|
+
Stack as Stack3
|
|
1195
1419
|
} from "@mui/material";
|
|
1196
1420
|
|
|
1197
1421
|
// src/components/models-blocks/BlockTitle.tsx
|
|
1198
|
-
import { Stack, Typography } from "@mui/material";
|
|
1199
|
-
import { jsx as
|
|
1422
|
+
import { Stack as Stack2, Typography as Typography2 } from "@mui/material";
|
|
1423
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1200
1424
|
function BlockTitle({ block, compact = false }) {
|
|
1201
|
-
return /* @__PURE__ */
|
|
1202
|
-
/* @__PURE__ */
|
|
1203
|
-
|
|
1425
|
+
return /* @__PURE__ */ jsxs4(Stack2, { spacing: 0.25, children: [
|
|
1426
|
+
/* @__PURE__ */ jsx7(
|
|
1427
|
+
Typography2,
|
|
1204
1428
|
{
|
|
1205
1429
|
variant: compact ? "subtitle1" : "h6",
|
|
1206
1430
|
sx: {
|
|
@@ -1211,7 +1435,7 @@ function BlockTitle({ block, compact = false }) {
|
|
|
1211
1435
|
children: block.title
|
|
1212
1436
|
}
|
|
1213
1437
|
),
|
|
1214
|
-
block.description && !compact ? /* @__PURE__ */
|
|
1438
|
+
block.description && !compact ? /* @__PURE__ */ jsx7(Typography2, { color: "text.secondary", sx: { fontSize: compact ? 12 : 14, lineHeight: 1.3 }, children: block.description }) : null
|
|
1215
1439
|
] });
|
|
1216
1440
|
}
|
|
1217
1441
|
|
|
@@ -1242,11 +1466,11 @@ function getBlockSurfaceSx(block, variant) {
|
|
|
1242
1466
|
}
|
|
1243
1467
|
|
|
1244
1468
|
// src/components/models-blocks/useBlockExpandedState.ts
|
|
1245
|
-
import { useCallback as
|
|
1469
|
+
import { useCallback as useCallback3, useEffect as useEffect6, useState as useState5 } from "react";
|
|
1246
1470
|
var STORAGE_KEY_PREFIX = "xladmin.models-block.expanded";
|
|
1247
1471
|
function useBlockExpandedState(blockSlug, defaultExpanded) {
|
|
1248
|
-
const [isExpanded, setIsExpanded] =
|
|
1249
|
-
|
|
1472
|
+
const [isExpanded, setIsExpanded] = useState5(defaultExpanded);
|
|
1473
|
+
useEffect6(() => {
|
|
1250
1474
|
if (typeof window === "undefined") {
|
|
1251
1475
|
return;
|
|
1252
1476
|
}
|
|
@@ -1257,7 +1481,7 @@ function useBlockExpandedState(blockSlug, defaultExpanded) {
|
|
|
1257
1481
|
}
|
|
1258
1482
|
setIsExpanded(rawValue === "true");
|
|
1259
1483
|
}, [blockSlug, defaultExpanded]);
|
|
1260
|
-
const updateExpanded =
|
|
1484
|
+
const updateExpanded = useCallback3((nextExpanded) => {
|
|
1261
1485
|
setIsExpanded(nextExpanded);
|
|
1262
1486
|
if (typeof window !== "undefined") {
|
|
1263
1487
|
window.localStorage.setItem(getStorageKey(blockSlug), String(nextExpanded));
|
|
@@ -1270,10 +1494,10 @@ function getStorageKey(blockSlug) {
|
|
|
1270
1494
|
}
|
|
1271
1495
|
|
|
1272
1496
|
// src/components/NavLink.tsx
|
|
1273
|
-
import { jsx as
|
|
1497
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1274
1498
|
function NavLink({ href, children, style, title, onClick, router }) {
|
|
1275
1499
|
const resolvedRouter = useAdminRouter(router);
|
|
1276
|
-
return /* @__PURE__ */
|
|
1500
|
+
return /* @__PURE__ */ jsx8(
|
|
1277
1501
|
"a",
|
|
1278
1502
|
{
|
|
1279
1503
|
href,
|
|
@@ -1289,10 +1513,10 @@ function NavLink({ href, children, style, title, onClick, router }) {
|
|
|
1289
1513
|
}
|
|
1290
1514
|
|
|
1291
1515
|
// src/components/models-blocks/DashboardModelsBlock.tsx
|
|
1292
|
-
import { jsx as
|
|
1516
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1293
1517
|
function DashboardModelsBlock({ block, basePath }) {
|
|
1294
1518
|
const [isExpanded, setIsExpanded] = useBlockExpandedState(block.slug, block.default_expanded);
|
|
1295
|
-
return /* @__PURE__ */
|
|
1519
|
+
return /* @__PURE__ */ jsxs5(
|
|
1296
1520
|
Accordion,
|
|
1297
1521
|
{
|
|
1298
1522
|
expanded: block.collapsible ? isExpanded : true,
|
|
@@ -1308,10 +1532,10 @@ function DashboardModelsBlock({ block, basePath }) {
|
|
|
1308
1532
|
}
|
|
1309
1533
|
},
|
|
1310
1534
|
children: [
|
|
1311
|
-
/* @__PURE__ */
|
|
1535
|
+
/* @__PURE__ */ jsx9(
|
|
1312
1536
|
AccordionSummary,
|
|
1313
1537
|
{
|
|
1314
|
-
expandIcon: block.collapsible ? /* @__PURE__ */
|
|
1538
|
+
expandIcon: block.collapsible ? /* @__PURE__ */ jsx9(ExpandMoreIcon, { fontSize: "small" }) : void 0,
|
|
1315
1539
|
sx: {
|
|
1316
1540
|
minHeight: "48px",
|
|
1317
1541
|
pr: 1.75,
|
|
@@ -1333,15 +1557,15 @@ function DashboardModelsBlock({ block, basePath }) {
|
|
|
1333
1557
|
mb: 1.05
|
|
1334
1558
|
}
|
|
1335
1559
|
},
|
|
1336
|
-
children: /* @__PURE__ */
|
|
1560
|
+
children: /* @__PURE__ */ jsx9(BlockTitle, { block })
|
|
1337
1561
|
}
|
|
1338
1562
|
),
|
|
1339
|
-
/* @__PURE__ */
|
|
1563
|
+
/* @__PURE__ */ jsx9(AccordionDetails, { sx: { px: 1.35, pb: 1.35, pt: 0 }, children: /* @__PURE__ */ jsx9(Stack3, { spacing: 0.5, sx: { px: 0.4 }, children: block.models.map((model) => /* @__PURE__ */ jsx9(
|
|
1340
1564
|
NavLink,
|
|
1341
1565
|
{
|
|
1342
1566
|
href: `${basePath}/${model.slug}`,
|
|
1343
1567
|
style: { textDecoration: "none", display: "block" },
|
|
1344
|
-
children: /* @__PURE__ */
|
|
1568
|
+
children: /* @__PURE__ */ jsx9(
|
|
1345
1569
|
ButtonBase,
|
|
1346
1570
|
{
|
|
1347
1571
|
sx: {
|
|
@@ -1351,7 +1575,7 @@ function DashboardModelsBlock({ block, basePath }) {
|
|
|
1351
1575
|
borderRadius: "8px",
|
|
1352
1576
|
overflow: "hidden"
|
|
1353
1577
|
},
|
|
1354
|
-
children: /* @__PURE__ */
|
|
1578
|
+
children: /* @__PURE__ */ jsx9(
|
|
1355
1579
|
ListItemButton,
|
|
1356
1580
|
{
|
|
1357
1581
|
sx: {
|
|
@@ -1360,7 +1584,7 @@ function DashboardModelsBlock({ block, basePath }) {
|
|
|
1360
1584
|
px: 1.25,
|
|
1361
1585
|
py: 0.4
|
|
1362
1586
|
},
|
|
1363
|
-
children: /* @__PURE__ */
|
|
1587
|
+
children: /* @__PURE__ */ jsx9(ListItemText, { primary: model.title })
|
|
1364
1588
|
}
|
|
1365
1589
|
)
|
|
1366
1590
|
}
|
|
@@ -1379,17 +1603,17 @@ import {
|
|
|
1379
1603
|
Accordion as Accordion2,
|
|
1380
1604
|
AccordionDetails as AccordionDetails2,
|
|
1381
1605
|
AccordionSummary as AccordionSummary2,
|
|
1382
|
-
Box as
|
|
1606
|
+
Box as Box3,
|
|
1383
1607
|
List,
|
|
1384
1608
|
ListItemButton as ListItemButton2,
|
|
1385
1609
|
ListItemText as ListItemText2,
|
|
1386
|
-
Paper
|
|
1610
|
+
Paper as Paper2
|
|
1387
1611
|
} from "@mui/material";
|
|
1388
|
-
import { jsx as
|
|
1612
|
+
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1389
1613
|
function SidebarModelsBlock({ block, basePath, activeModelSlug, onModelNavigate }) {
|
|
1390
1614
|
const [isExpanded, setIsExpanded] = useBlockExpandedState(block.slug, block.default_expanded);
|
|
1391
1615
|
if (block.collapsible) {
|
|
1392
|
-
return /* @__PURE__ */
|
|
1616
|
+
return /* @__PURE__ */ jsxs6(
|
|
1393
1617
|
Accordion2,
|
|
1394
1618
|
{
|
|
1395
1619
|
expanded: isExpanded,
|
|
@@ -1405,10 +1629,10 @@ function SidebarModelsBlock({ block, basePath, activeModelSlug, onModelNavigate
|
|
|
1405
1629
|
}
|
|
1406
1630
|
},
|
|
1407
1631
|
children: [
|
|
1408
|
-
/* @__PURE__ */
|
|
1632
|
+
/* @__PURE__ */ jsx10(
|
|
1409
1633
|
AccordionSummary2,
|
|
1410
1634
|
{
|
|
1411
|
-
expandIcon: /* @__PURE__ */
|
|
1635
|
+
expandIcon: /* @__PURE__ */ jsx10(ExpandMoreIcon2, { fontSize: "small" }),
|
|
1412
1636
|
sx: {
|
|
1413
1637
|
minHeight: "42px",
|
|
1414
1638
|
pr: 1.25,
|
|
@@ -1424,10 +1648,10 @@ function SidebarModelsBlock({ block, basePath, activeModelSlug, onModelNavigate
|
|
|
1424
1648
|
my: 0
|
|
1425
1649
|
}
|
|
1426
1650
|
},
|
|
1427
|
-
children: /* @__PURE__ */
|
|
1651
|
+
children: /* @__PURE__ */ jsx10(BlockTitle, { block, compact: true })
|
|
1428
1652
|
}
|
|
1429
1653
|
),
|
|
1430
|
-
/* @__PURE__ */
|
|
1654
|
+
/* @__PURE__ */ jsx10(AccordionDetails2, { sx: { p: 0 }, children: /* @__PURE__ */ jsx10(
|
|
1431
1655
|
SidebarModelsList,
|
|
1432
1656
|
{
|
|
1433
1657
|
models: block.models,
|
|
@@ -1440,8 +1664,8 @@ function SidebarModelsBlock({ block, basePath, activeModelSlug, onModelNavigate
|
|
|
1440
1664
|
}
|
|
1441
1665
|
);
|
|
1442
1666
|
}
|
|
1443
|
-
return /* @__PURE__ */
|
|
1444
|
-
|
|
1667
|
+
return /* @__PURE__ */ jsxs6(
|
|
1668
|
+
Paper2,
|
|
1445
1669
|
{
|
|
1446
1670
|
sx: {
|
|
1447
1671
|
...getBlockSurfaceSx(block, "sidebar"),
|
|
@@ -1449,8 +1673,8 @@ function SidebarModelsBlock({ block, basePath, activeModelSlug, onModelNavigate
|
|
|
1449
1673
|
overflow: "hidden"
|
|
1450
1674
|
},
|
|
1451
1675
|
children: [
|
|
1452
|
-
/* @__PURE__ */
|
|
1453
|
-
/* @__PURE__ */
|
|
1676
|
+
/* @__PURE__ */ jsx10(Box3, { sx: { px: 1.25, py: 1 }, children: /* @__PURE__ */ jsx10(BlockTitle, { block, compact: true }) }),
|
|
1677
|
+
/* @__PURE__ */ jsx10(
|
|
1454
1678
|
SidebarModelsList,
|
|
1455
1679
|
{
|
|
1456
1680
|
models: block.models,
|
|
@@ -1464,16 +1688,16 @@ function SidebarModelsBlock({ block, basePath, activeModelSlug, onModelNavigate
|
|
|
1464
1688
|
);
|
|
1465
1689
|
}
|
|
1466
1690
|
function SidebarModelsList({ models, basePath, activeModelSlug, onModelNavigate }) {
|
|
1467
|
-
return /* @__PURE__ */
|
|
1691
|
+
return /* @__PURE__ */ jsx10(List, { dense: true, disablePadding: true, sx: { display: "flex", flexDirection: "column", gap: 0.5, p: 1.35 }, children: models.map((model) => {
|
|
1468
1692
|
const href = `${basePath}/${model.slug}`;
|
|
1469
1693
|
const isActive = activeModelSlug === model.slug;
|
|
1470
|
-
return /* @__PURE__ */
|
|
1694
|
+
return /* @__PURE__ */ jsx10(
|
|
1471
1695
|
NavLink,
|
|
1472
1696
|
{
|
|
1473
1697
|
href,
|
|
1474
1698
|
style: { textDecoration: "none", display: "block" },
|
|
1475
1699
|
onClick: () => onModelNavigate == null ? void 0 : onModelNavigate(href),
|
|
1476
|
-
children: /* @__PURE__ */
|
|
1700
|
+
children: /* @__PURE__ */ jsx10(
|
|
1477
1701
|
ListItemButton2,
|
|
1478
1702
|
{
|
|
1479
1703
|
selected: isActive,
|
|
@@ -1492,7 +1716,7 @@ function SidebarModelsList({ models, basePath, activeModelSlug, onModelNavigate
|
|
|
1492
1716
|
backgroundColor: "rgba(255, 255, 255, 0.2)"
|
|
1493
1717
|
}
|
|
1494
1718
|
},
|
|
1495
|
-
children: /* @__PURE__ */
|
|
1719
|
+
children: /* @__PURE__ */ jsx10(ListItemText2, { primary: model.title })
|
|
1496
1720
|
}
|
|
1497
1721
|
)
|
|
1498
1722
|
},
|
|
@@ -1502,7 +1726,7 @@ function SidebarModelsList({ models, basePath, activeModelSlug, onModelNavigate
|
|
|
1502
1726
|
}
|
|
1503
1727
|
|
|
1504
1728
|
// src/components/ModelsBlocks.tsx
|
|
1505
|
-
import { jsx as
|
|
1729
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1506
1730
|
var ModelsBlocks = memo2(function ModelsBlocks2({
|
|
1507
1731
|
basePath,
|
|
1508
1732
|
models,
|
|
@@ -1512,10 +1736,10 @@ var ModelsBlocks = memo2(function ModelsBlocks2({
|
|
|
1512
1736
|
onModelNavigate
|
|
1513
1737
|
}) {
|
|
1514
1738
|
const t = useAdminTranslation();
|
|
1515
|
-
const theme =
|
|
1739
|
+
const theme = useTheme2();
|
|
1516
1740
|
const isMdUp = useMediaQuery(theme.breakpoints.up("md"));
|
|
1517
1741
|
const isXlUp = useMediaQuery(theme.breakpoints.up("xl"));
|
|
1518
|
-
const normalizedBlocks =
|
|
1742
|
+
const normalizedBlocks = useMemo6(() => [
|
|
1519
1743
|
...blocks,
|
|
1520
1744
|
{
|
|
1521
1745
|
slug: "all-models",
|
|
@@ -1528,12 +1752,12 @@ var ModelsBlocks = memo2(function ModelsBlocks2({
|
|
|
1528
1752
|
isAllModels: true
|
|
1529
1753
|
}
|
|
1530
1754
|
], [blocks, models, t, variant]);
|
|
1531
|
-
const dashboardColumns =
|
|
1755
|
+
const dashboardColumns = useMemo6(() => {
|
|
1532
1756
|
const columnCount = isXlUp ? 3 : isMdUp ? 2 : 1;
|
|
1533
1757
|
return distributeBlocksByHeight(normalizedBlocks, columnCount);
|
|
1534
1758
|
}, [isMdUp, isXlUp, normalizedBlocks]);
|
|
1535
1759
|
if (variant === "sidebar") {
|
|
1536
|
-
return /* @__PURE__ */
|
|
1760
|
+
return /* @__PURE__ */ jsx11(Stack4, { spacing: 1, children: normalizedBlocks.map((block) => /* @__PURE__ */ jsx11(
|
|
1537
1761
|
SidebarModelsBlock,
|
|
1538
1762
|
{
|
|
1539
1763
|
block,
|
|
@@ -1544,7 +1768,7 @@ var ModelsBlocks = memo2(function ModelsBlocks2({
|
|
|
1544
1768
|
block.slug
|
|
1545
1769
|
)) });
|
|
1546
1770
|
}
|
|
1547
|
-
return /* @__PURE__ */
|
|
1771
|
+
return /* @__PURE__ */ jsx11(Box4, { sx: { display: "flex", gap: 2, alignItems: "flex-start" }, children: dashboardColumns.map((column, columnIndex) => /* @__PURE__ */ jsx11(Box4, { sx: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ jsx11(Stack4, { spacing: 2, children: column.map((block) => /* @__PURE__ */ jsx11(DashboardModelsBlock, { block, basePath }, block.slug)) }) }, columnIndex)) });
|
|
1548
1772
|
});
|
|
1549
1773
|
function distributeBlocksByHeight(blocks, columnCount) {
|
|
1550
1774
|
const columns = Array.from({ length: columnCount }, () => []);
|
|
@@ -1566,15 +1790,15 @@ function getBlockWeight(block) {
|
|
|
1566
1790
|
}
|
|
1567
1791
|
|
|
1568
1792
|
// src/components/layout/MainHeader.tsx
|
|
1569
|
-
import { useState as
|
|
1793
|
+
import { useState as useState6 } from "react";
|
|
1570
1794
|
import MenuIcon from "@mui/icons-material/Menu";
|
|
1571
|
-
import { Box as
|
|
1795
|
+
import { Box as Box5 } from "@mui/material";
|
|
1572
1796
|
import ExpandMoreIcon3 from "@mui/icons-material/ExpandMore";
|
|
1573
|
-
import { Alert as Alert2, Collapse, IconButton, Paper as
|
|
1797
|
+
import { Alert as Alert2, Collapse, IconButton, Paper as Paper3, Skeleton, Stack as Stack5, Typography as Typography3 } from "@mui/material";
|
|
1574
1798
|
|
|
1575
1799
|
// src/components/layout/ShellContext.tsx
|
|
1576
|
-
import { createContext as
|
|
1577
|
-
import { jsx as
|
|
1800
|
+
import { createContext as createContext5, useContext as useContext5 } from "react";
|
|
1801
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1578
1802
|
var defaultShellContextValue = {
|
|
1579
1803
|
isMobile: false,
|
|
1580
1804
|
openMobileSidebar: () => {
|
|
@@ -1584,19 +1808,19 @@ var defaultShellContextValue = {
|
|
|
1584
1808
|
startPendingNavigation: () => {
|
|
1585
1809
|
}
|
|
1586
1810
|
};
|
|
1587
|
-
var ShellContext =
|
|
1811
|
+
var ShellContext = createContext5(defaultShellContextValue);
|
|
1588
1812
|
function ShellContextProvider({
|
|
1589
1813
|
value,
|
|
1590
1814
|
children
|
|
1591
1815
|
}) {
|
|
1592
|
-
return /* @__PURE__ */
|
|
1816
|
+
return /* @__PURE__ */ jsx12(ShellContext.Provider, { value, children });
|
|
1593
1817
|
}
|
|
1594
1818
|
function useShellContext() {
|
|
1595
|
-
return
|
|
1819
|
+
return useContext5(ShellContext);
|
|
1596
1820
|
}
|
|
1597
1821
|
|
|
1598
1822
|
// src/components/layout/MainHeader.tsx
|
|
1599
|
-
import { jsx as
|
|
1823
|
+
import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1600
1824
|
var MAIN_HEADER_PADDING_X = 2.5;
|
|
1601
1825
|
var MAIN_HEADER_PADDING_T = 1.35;
|
|
1602
1826
|
var MAIN_HEADER_PADDING_B = 1.8;
|
|
@@ -1605,9 +1829,9 @@ var MAIN_HEADER_SUBTITLE_HEIGHT = 16;
|
|
|
1605
1829
|
function MainHeader({ title, subtitle, details, error, beforeTitle, beforeSubtitle, actions }) {
|
|
1606
1830
|
const t = useAdminTranslation();
|
|
1607
1831
|
const { isMobile, openMobileSidebar } = useShellContext();
|
|
1608
|
-
const [isDetailsOpen, setIsDetailsOpen] =
|
|
1609
|
-
return /* @__PURE__ */
|
|
1610
|
-
|
|
1832
|
+
const [isDetailsOpen, setIsDetailsOpen] = useState6(false);
|
|
1833
|
+
return /* @__PURE__ */ jsxs7(
|
|
1834
|
+
Paper3,
|
|
1611
1835
|
{
|
|
1612
1836
|
sx: {
|
|
1613
1837
|
px: { xs: 1.5, sm: MAIN_HEADER_PADDING_X },
|
|
@@ -1620,9 +1844,9 @@ function MainHeader({ title, subtitle, details, error, beforeTitle, beforeSubtit
|
|
|
1620
1844
|
zIndex: 3
|
|
1621
1845
|
},
|
|
1622
1846
|
children: [
|
|
1623
|
-
/* @__PURE__ */
|
|
1624
|
-
/* @__PURE__ */
|
|
1625
|
-
|
|
1847
|
+
/* @__PURE__ */ jsxs7(Stack5, { spacing: 0.5, children: [
|
|
1848
|
+
/* @__PURE__ */ jsxs7(
|
|
1849
|
+
Stack5,
|
|
1626
1850
|
{
|
|
1627
1851
|
direction: "row",
|
|
1628
1852
|
spacing: 1.5,
|
|
@@ -1630,20 +1854,20 @@ function MainHeader({ title, subtitle, details, error, beforeTitle, beforeSubtit
|
|
|
1630
1854
|
justifyContent: "space-between",
|
|
1631
1855
|
sx: { minWidth: 0 },
|
|
1632
1856
|
children: [
|
|
1633
|
-
/* @__PURE__ */
|
|
1634
|
-
isMobile ? /* @__PURE__ */
|
|
1857
|
+
/* @__PURE__ */ jsxs7(Stack5, { direction: "row", spacing: 1, alignItems: "center", sx: { minWidth: 0, flex: 1 }, children: [
|
|
1858
|
+
isMobile ? /* @__PURE__ */ jsx13(Box5, { sx: { display: "flex", alignItems: "center", flexShrink: 0 }, children: /* @__PURE__ */ jsx13(
|
|
1635
1859
|
IconButton,
|
|
1636
1860
|
{
|
|
1637
1861
|
"aria-label": t("menu"),
|
|
1638
1862
|
onClick: openMobileSidebar,
|
|
1639
1863
|
size: "small",
|
|
1640
1864
|
sx: { ml: -0.5 },
|
|
1641
|
-
children: /* @__PURE__ */
|
|
1865
|
+
children: /* @__PURE__ */ jsx13(MenuIcon, { fontSize: "small" })
|
|
1642
1866
|
}
|
|
1643
1867
|
) }) : null,
|
|
1644
|
-
beforeTitle ? /* @__PURE__ */
|
|
1645
|
-
/* @__PURE__ */
|
|
1646
|
-
|
|
1868
|
+
beforeTitle ? /* @__PURE__ */ jsx13(Box5, { sx: { display: "flex", alignItems: "center", flexShrink: 0 }, children: beforeTitle }) : null,
|
|
1869
|
+
/* @__PURE__ */ jsx13(
|
|
1870
|
+
Typography3,
|
|
1647
1871
|
{
|
|
1648
1872
|
variant: "h5",
|
|
1649
1873
|
sx: {
|
|
@@ -1655,17 +1879,17 @@ function MainHeader({ title, subtitle, details, error, beforeTitle, beforeSubtit
|
|
|
1655
1879
|
}
|
|
1656
1880
|
)
|
|
1657
1881
|
] }),
|
|
1658
|
-
actions ? /* @__PURE__ */
|
|
1882
|
+
actions ? /* @__PURE__ */ jsx13(Box5, { sx: { display: "flex", alignItems: "center", flexShrink: 0 }, children: actions }) : null
|
|
1659
1883
|
]
|
|
1660
1884
|
}
|
|
1661
1885
|
),
|
|
1662
|
-
subtitle && !details ? /* @__PURE__ */
|
|
1663
|
-
beforeSubtitle ? /* @__PURE__ */
|
|
1664
|
-
/* @__PURE__ */
|
|
1886
|
+
subtitle && !details ? /* @__PURE__ */ jsxs7(Stack5, { direction: "row", spacing: 0.5, alignItems: "center", sx: { minWidth: 0 }, children: [
|
|
1887
|
+
beforeSubtitle ? /* @__PURE__ */ jsx13(Box5, { sx: { display: "flex", alignItems: "center", flexShrink: 0 }, children: beforeSubtitle }) : null,
|
|
1888
|
+
/* @__PURE__ */ jsx13(Typography3, { color: "text.secondary", sx: { lineHeight: "1rem", minWidth: 0 }, children: subtitle })
|
|
1665
1889
|
] }) : null,
|
|
1666
|
-
details ? /* @__PURE__ */
|
|
1667
|
-
/* @__PURE__ */
|
|
1668
|
-
|
|
1890
|
+
details ? /* @__PURE__ */ jsxs7(Stack5, { spacing: 0.5, children: [
|
|
1891
|
+
/* @__PURE__ */ jsxs7(
|
|
1892
|
+
Stack5,
|
|
1669
1893
|
{
|
|
1670
1894
|
direction: "row",
|
|
1671
1895
|
spacing: 0.5,
|
|
@@ -1673,18 +1897,18 @@ function MainHeader({ title, subtitle, details, error, beforeTitle, beforeSubtit
|
|
|
1673
1897
|
justifyContent: "space-between",
|
|
1674
1898
|
sx: { minWidth: 0 },
|
|
1675
1899
|
children: [
|
|
1676
|
-
/* @__PURE__ */
|
|
1677
|
-
beforeSubtitle ? /* @__PURE__ */
|
|
1678
|
-
/* @__PURE__ */
|
|
1900
|
+
/* @__PURE__ */ jsxs7(Stack5, { direction: "row", spacing: 0.5, alignItems: "center", sx: { minWidth: 0, flex: 1 }, children: [
|
|
1901
|
+
beforeSubtitle ? /* @__PURE__ */ jsx13(Box5, { sx: { display: "flex", alignItems: "center", flexShrink: 0 }, children: beforeSubtitle }) : null,
|
|
1902
|
+
/* @__PURE__ */ jsx13(Typography3, { color: "text.secondary", sx: { lineHeight: "1rem", minWidth: 0 }, children: subtitle })
|
|
1679
1903
|
] }),
|
|
1680
|
-
/* @__PURE__ */
|
|
1904
|
+
/* @__PURE__ */ jsx13(
|
|
1681
1905
|
IconButton,
|
|
1682
1906
|
{
|
|
1683
1907
|
"aria-label": isDetailsOpen ? t("hide_details") : t("show_details"),
|
|
1684
1908
|
onClick: () => setIsDetailsOpen((current) => !current),
|
|
1685
1909
|
size: "small",
|
|
1686
1910
|
sx: { mr: -0.5 },
|
|
1687
|
-
children: /* @__PURE__ */
|
|
1911
|
+
children: /* @__PURE__ */ jsx13(
|
|
1688
1912
|
ExpandMoreIcon3,
|
|
1689
1913
|
{
|
|
1690
1914
|
fontSize: "small",
|
|
@@ -1699,10 +1923,10 @@ function MainHeader({ title, subtitle, details, error, beforeTitle, beforeSubtit
|
|
|
1699
1923
|
]
|
|
1700
1924
|
}
|
|
1701
1925
|
),
|
|
1702
|
-
/* @__PURE__ */
|
|
1926
|
+
/* @__PURE__ */ jsx13(Collapse, { in: isDetailsOpen, children: /* @__PURE__ */ jsx13(Box5, { sx: { pt: 0.5 }, children: details }) })
|
|
1703
1927
|
] }) : null
|
|
1704
1928
|
] }),
|
|
1705
|
-
error ? /* @__PURE__ */
|
|
1929
|
+
error ? /* @__PURE__ */ jsx13(Alert2, { severity: "error", sx: { mt: 2 }, children: error }) : null
|
|
1706
1930
|
]
|
|
1707
1931
|
}
|
|
1708
1932
|
);
|
|
@@ -1711,8 +1935,8 @@ function MainHeaderSkeleton({
|
|
|
1711
1935
|
titleWidth = 240,
|
|
1712
1936
|
subtitleWidth = "40%"
|
|
1713
1937
|
}) {
|
|
1714
|
-
return /* @__PURE__ */
|
|
1715
|
-
|
|
1938
|
+
return /* @__PURE__ */ jsx13(
|
|
1939
|
+
Paper3,
|
|
1716
1940
|
{
|
|
1717
1941
|
sx: {
|
|
1718
1942
|
px: { xs: 1.5, sm: MAIN_HEADER_PADDING_X },
|
|
@@ -1724,8 +1948,8 @@ function MainHeaderSkeleton({
|
|
|
1724
1948
|
top: 0,
|
|
1725
1949
|
zIndex: 3
|
|
1726
1950
|
},
|
|
1727
|
-
children: /* @__PURE__ */
|
|
1728
|
-
/* @__PURE__ */
|
|
1951
|
+
children: /* @__PURE__ */ jsxs7(Stack5, { spacing: 1, children: [
|
|
1952
|
+
/* @__PURE__ */ jsx13(
|
|
1729
1953
|
Skeleton,
|
|
1730
1954
|
{
|
|
1731
1955
|
variant: "rounded",
|
|
@@ -1734,7 +1958,7 @@ function MainHeaderSkeleton({
|
|
|
1734
1958
|
sx: { transform: "none" }
|
|
1735
1959
|
}
|
|
1736
1960
|
),
|
|
1737
|
-
/* @__PURE__ */
|
|
1961
|
+
/* @__PURE__ */ jsx13(
|
|
1738
1962
|
Skeleton,
|
|
1739
1963
|
{
|
|
1740
1964
|
variant: "rounded",
|
|
@@ -1749,14 +1973,14 @@ function MainHeaderSkeleton({
|
|
|
1749
1973
|
}
|
|
1750
1974
|
|
|
1751
1975
|
// src/components/OverviewPage.tsx
|
|
1752
|
-
import { jsx as
|
|
1976
|
+
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1753
1977
|
var cachedModelsResponse = null;
|
|
1754
1978
|
var inFlightModelsRequest = null;
|
|
1755
1979
|
function OverviewPage({ client, basePath }) {
|
|
1756
1980
|
const t = useAdminTranslation();
|
|
1757
1981
|
useAdminDocumentTitle(t("admin_title"), t("overview_title"));
|
|
1758
1982
|
const adminData = useAdminData();
|
|
1759
|
-
const shellModelsResponse =
|
|
1983
|
+
const shellModelsResponse = useMemo7(() => {
|
|
1760
1984
|
if (adminData.models.length === 0 && adminData.blocks.length === 0) {
|
|
1761
1985
|
return null;
|
|
1762
1986
|
}
|
|
@@ -1766,10 +1990,10 @@ function OverviewPage({ client, basePath }) {
|
|
|
1766
1990
|
blocks: adminData.blocks
|
|
1767
1991
|
};
|
|
1768
1992
|
}, [adminData.blocks, adminData.locale, adminData.models]);
|
|
1769
|
-
const [data, setData] =
|
|
1770
|
-
const [error, setError] =
|
|
1771
|
-
const [isLoading, setIsLoading] =
|
|
1772
|
-
|
|
1993
|
+
const [data, setData] = useState7(shellModelsResponse != null ? shellModelsResponse : cachedModelsResponse);
|
|
1994
|
+
const [error, setError] = useState7(null);
|
|
1995
|
+
const [isLoading, setIsLoading] = useState7(shellModelsResponse === null && cachedModelsResponse === null);
|
|
1996
|
+
useEffect7(() => {
|
|
1773
1997
|
let isMounted = true;
|
|
1774
1998
|
if (shellModelsResponse !== null) {
|
|
1775
1999
|
cachedModelsResponse = shellModelsResponse;
|
|
@@ -1809,21 +2033,21 @@ function OverviewPage({ client, basePath }) {
|
|
|
1809
2033
|
};
|
|
1810
2034
|
}, [client, shellModelsResponse, t]);
|
|
1811
2035
|
if (isLoading && !data) {
|
|
1812
|
-
return /* @__PURE__ */
|
|
2036
|
+
return /* @__PURE__ */ jsx14(OverviewPageSkeleton, {});
|
|
1813
2037
|
}
|
|
1814
2038
|
if (error || !data) {
|
|
1815
|
-
return /* @__PURE__ */
|
|
2039
|
+
return /* @__PURE__ */ jsx14(Alert3, { severity: "error", children: error || t("models_load_error") });
|
|
1816
2040
|
}
|
|
1817
|
-
return /* @__PURE__ */
|
|
1818
|
-
/* @__PURE__ */
|
|
2041
|
+
return /* @__PURE__ */ jsxs8(Stack6, { spacing: 1.5, sx: { height: "100%", minHeight: 0 }, children: [
|
|
2042
|
+
/* @__PURE__ */ jsx14(
|
|
1819
2043
|
MainHeader,
|
|
1820
2044
|
{
|
|
1821
2045
|
title: t("overview_title"),
|
|
1822
2046
|
subtitle: t("overview_subtitle")
|
|
1823
2047
|
}
|
|
1824
2048
|
),
|
|
1825
|
-
/* @__PURE__ */
|
|
1826
|
-
|
|
2049
|
+
/* @__PURE__ */ jsx14(
|
|
2050
|
+
Paper4,
|
|
1827
2051
|
{
|
|
1828
2052
|
sx: {
|
|
1829
2053
|
borderRadius: "10px",
|
|
@@ -1833,7 +2057,7 @@ function OverviewPage({ client, basePath }) {
|
|
|
1833
2057
|
display: "flex",
|
|
1834
2058
|
flexDirection: "column"
|
|
1835
2059
|
},
|
|
1836
|
-
children: /* @__PURE__ */
|
|
2060
|
+
children: /* @__PURE__ */ jsx14(Box6, { sx: { flex: 1, minHeight: 0, overflow: "auto", p: 2 }, children: /* @__PURE__ */ jsx14(
|
|
1837
2061
|
ModelsBlocks,
|
|
1838
2062
|
{
|
|
1839
2063
|
models: data.items,
|
|
@@ -1847,10 +2071,10 @@ function OverviewPage({ client, basePath }) {
|
|
|
1847
2071
|
] });
|
|
1848
2072
|
}
|
|
1849
2073
|
function OverviewPageSkeleton() {
|
|
1850
|
-
return /* @__PURE__ */
|
|
1851
|
-
/* @__PURE__ */
|
|
1852
|
-
/* @__PURE__ */
|
|
1853
|
-
|
|
2074
|
+
return /* @__PURE__ */ jsxs8(Stack6, { spacing: 1.5, sx: { height: "100%", minHeight: 0 }, children: [
|
|
2075
|
+
/* @__PURE__ */ jsx14(MainHeaderSkeleton, { titleWidth: 220, subtitleWidth: "58%" }),
|
|
2076
|
+
/* @__PURE__ */ jsx14(
|
|
2077
|
+
Paper4,
|
|
1854
2078
|
{
|
|
1855
2079
|
sx: {
|
|
1856
2080
|
borderRadius: "10px",
|
|
@@ -1860,9 +2084,9 @@ function OverviewPageSkeleton() {
|
|
|
1860
2084
|
display: "flex",
|
|
1861
2085
|
flexDirection: "column"
|
|
1862
2086
|
},
|
|
1863
|
-
children: /* @__PURE__ */
|
|
1864
|
-
/* @__PURE__ */
|
|
1865
|
-
/* @__PURE__ */
|
|
2087
|
+
children: /* @__PURE__ */ jsx14(Box6, { sx: { flex: 1, minHeight: 0, overflow: "auto", p: 2 }, children: /* @__PURE__ */ jsx14(Grid, { container: true, spacing: 2, children: Array.from({ length: 8 }).map((_, index) => /* @__PURE__ */ jsx14(Grid, { size: { xs: 12, md: 6, xl: 4 }, children: /* @__PURE__ */ jsx14(Paper4, { sx: { p: 2.5, borderRadius: "10px" }, children: /* @__PURE__ */ jsxs8(Stack6, { spacing: 1, children: [
|
|
2088
|
+
/* @__PURE__ */ jsx14(Skeleton2, { variant: "text", width: "60%", height: 36 }),
|
|
2089
|
+
/* @__PURE__ */ jsx14(Skeleton2, { variant: "text", width: "40%", height: 24 })
|
|
1866
2090
|
] }) }) }, index)) }) })
|
|
1867
2091
|
}
|
|
1868
2092
|
)
|
|
@@ -1877,7 +2101,7 @@ import ExpandMoreIcon4 from "@mui/icons-material/ExpandMore";
|
|
|
1877
2101
|
import FilterListIcon from "@mui/icons-material/FilterList";
|
|
1878
2102
|
import {
|
|
1879
2103
|
Alert as Alert5,
|
|
1880
|
-
Box as
|
|
2104
|
+
Box as Box10,
|
|
1881
2105
|
Button as Button4,
|
|
1882
2106
|
Checkbox as Checkbox2,
|
|
1883
2107
|
Dialog as Dialog3,
|
|
@@ -1887,8 +2111,8 @@ import {
|
|
|
1887
2111
|
InputBase,
|
|
1888
2112
|
Menu,
|
|
1889
2113
|
MenuItem as MenuItem2,
|
|
1890
|
-
Paper as
|
|
1891
|
-
Stack as
|
|
2114
|
+
Paper as Paper7,
|
|
2115
|
+
Stack as Stack10,
|
|
1892
2116
|
Table,
|
|
1893
2117
|
TableBody,
|
|
1894
2118
|
TableCell as TableCell2,
|
|
@@ -1896,25 +2120,25 @@ import {
|
|
|
1896
2120
|
TableRow as TableRow2,
|
|
1897
2121
|
TableSortLabel,
|
|
1898
2122
|
Tooltip,
|
|
1899
|
-
Typography as
|
|
2123
|
+
Typography as Typography6,
|
|
1900
2124
|
useMediaQuery as useMediaQuery2
|
|
1901
2125
|
} from "@mui/material";
|
|
1902
|
-
import { useTheme as
|
|
2126
|
+
import { useTheme as useTheme3 } from "@mui/material/styles";
|
|
1903
2127
|
|
|
1904
2128
|
// src/components/DeletePreviewDialog.tsx
|
|
1905
2129
|
import {
|
|
1906
2130
|
Alert as Alert4,
|
|
1907
|
-
Box as
|
|
2131
|
+
Box as Box7,
|
|
1908
2132
|
Button as Button2,
|
|
1909
2133
|
CircularProgress as CircularProgress2,
|
|
1910
2134
|
Dialog as Dialog2,
|
|
1911
2135
|
DialogActions as DialogActions2,
|
|
1912
2136
|
DialogContent as DialogContent2,
|
|
1913
2137
|
DialogTitle as DialogTitle2,
|
|
1914
|
-
Stack as
|
|
1915
|
-
Typography as
|
|
2138
|
+
Stack as Stack7,
|
|
2139
|
+
Typography as Typography4
|
|
1916
2140
|
} from "@mui/material";
|
|
1917
|
-
import { jsx as
|
|
2141
|
+
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1918
2142
|
function DeletePreviewDialog({
|
|
1919
2143
|
open,
|
|
1920
2144
|
title,
|
|
@@ -1926,7 +2150,7 @@ function DeletePreviewDialog({
|
|
|
1926
2150
|
onConfirm
|
|
1927
2151
|
}) {
|
|
1928
2152
|
const t = useAdminTranslation();
|
|
1929
|
-
return /* @__PURE__ */
|
|
2153
|
+
return /* @__PURE__ */ jsxs9(
|
|
1930
2154
|
Dialog2,
|
|
1931
2155
|
{
|
|
1932
2156
|
open,
|
|
@@ -1948,27 +2172,27 @@ function DeletePreviewDialog({
|
|
|
1948
2172
|
}
|
|
1949
2173
|
},
|
|
1950
2174
|
children: [
|
|
1951
|
-
/* @__PURE__ */
|
|
1952
|
-
/* @__PURE__ */
|
|
1953
|
-
isLoading ? /* @__PURE__ */
|
|
1954
|
-
/* @__PURE__ */
|
|
1955
|
-
/* @__PURE__ */
|
|
2175
|
+
/* @__PURE__ */ jsx15(DialogTitle2, { children: title }),
|
|
2176
|
+
/* @__PURE__ */ jsxs9(DialogContent2, { dividers: true, children: [
|
|
2177
|
+
isLoading ? /* @__PURE__ */ jsxs9(Stack7, { spacing: 1.5, alignItems: "center", justifyContent: "center", sx: { minHeight: 180 }, children: [
|
|
2178
|
+
/* @__PURE__ */ jsx15(CircularProgress2, { size: 28, thickness: 4.2, color: "inherit" }),
|
|
2179
|
+
/* @__PURE__ */ jsx15(Typography4, { color: "text.secondary", children: t("delete_preview_loading") })
|
|
1956
2180
|
] }) : null,
|
|
1957
|
-
!isLoading && error ? /* @__PURE__ */
|
|
1958
|
-
!isLoading && !error && preview ? /* @__PURE__ */
|
|
1959
|
-
/* @__PURE__ */
|
|
1960
|
-
!preview.can_delete ? /* @__PURE__ */
|
|
1961
|
-
/* @__PURE__ */
|
|
1962
|
-
/* @__PURE__ */
|
|
1963
|
-
/* @__PURE__ */
|
|
1964
|
-
/* @__PURE__ */
|
|
1965
|
-
/* @__PURE__ */
|
|
1966
|
-
/* @__PURE__ */
|
|
2181
|
+
!isLoading && error ? /* @__PURE__ */ jsx15(Alert4, { severity: "error", children: error }) : null,
|
|
2182
|
+
!isLoading && !error && preview ? /* @__PURE__ */ jsxs9(Stack7, { spacing: 1.5, children: [
|
|
2183
|
+
/* @__PURE__ */ jsx15(Typography4, { color: "text.secondary", children: preview.can_delete ? t("delete_preview_hint") : t("delete_preview_blocked_hint") }),
|
|
2184
|
+
!preview.can_delete ? /* @__PURE__ */ jsx15(Alert4, { severity: "warning", children: t("delete_preview_blocked_hint") }) : null,
|
|
2185
|
+
/* @__PURE__ */ jsxs9(Stack7, { spacing: 0.5, children: [
|
|
2186
|
+
/* @__PURE__ */ jsx15(Typography4, { variant: "body2", color: "text.secondary", children: t("delete_preview_roots", { count: preview.summary.roots }) }),
|
|
2187
|
+
/* @__PURE__ */ jsx15(Typography4, { variant: "body2", color: "text.secondary", children: t("delete_preview_delete", { count: preview.summary.delete }) }),
|
|
2188
|
+
/* @__PURE__ */ jsx15(Typography4, { variant: "body2", color: "text.secondary", children: t("delete_preview_protect", { count: preview.summary.protect }) }),
|
|
2189
|
+
/* @__PURE__ */ jsx15(Typography4, { variant: "body2", color: "text.secondary", children: t("delete_preview_set_null", { count: preview.summary.set_null }) }),
|
|
2190
|
+
/* @__PURE__ */ jsx15(Typography4, { variant: "body2", color: "text.secondary", children: t("delete_preview_total", { count: preview.summary.total }) })
|
|
1967
2191
|
] }),
|
|
1968
|
-
preview.summary.delete === 0 && preview.summary.protect === 0 && preview.summary.set_null === 0 ? /* @__PURE__ */
|
|
1969
|
-
preview.roots.length > 0 ? /* @__PURE__ */
|
|
2192
|
+
preview.summary.delete === 0 && preview.summary.protect === 0 && preview.summary.set_null === 0 ? /* @__PURE__ */ jsx15(Typography4, { variant: "body2", color: "text.secondary", children: t("delete_preview_empty") }) : null,
|
|
2193
|
+
preview.roots.length > 0 ? /* @__PURE__ */ jsx15(Stack7, { spacing: 1, children: preview.roots.map((rootNode, index) => {
|
|
1970
2194
|
var _a;
|
|
1971
|
-
return /* @__PURE__ */
|
|
2195
|
+
return /* @__PURE__ */ jsx15(
|
|
1972
2196
|
DeletePreviewNode,
|
|
1973
2197
|
{
|
|
1974
2198
|
node: rootNode,
|
|
@@ -1976,8 +2200,8 @@ function DeletePreviewDialog({
|
|
|
1976
2200
|
},
|
|
1977
2201
|
`${(_a = rootNode.model_slug) != null ? _a : "model"}:${rootNode.id}:${index}`
|
|
1978
2202
|
);
|
|
1979
|
-
}) }) : /* @__PURE__ */
|
|
1980
|
-
|
|
2203
|
+
}) }) : /* @__PURE__ */ jsx15(
|
|
2204
|
+
Typography4,
|
|
1981
2205
|
{
|
|
1982
2206
|
variant: "body2",
|
|
1983
2207
|
color: "text.secondary",
|
|
@@ -1986,9 +2210,9 @@ function DeletePreviewDialog({
|
|
|
1986
2210
|
)
|
|
1987
2211
|
] }) : null
|
|
1988
2212
|
] }),
|
|
1989
|
-
/* @__PURE__ */
|
|
1990
|
-
/* @__PURE__ */
|
|
1991
|
-
/* @__PURE__ */
|
|
2213
|
+
/* @__PURE__ */ jsxs9(DialogActions2, { children: [
|
|
2214
|
+
/* @__PURE__ */ jsx15(Button2, { onClick: onClose, disabled: isSubmitting, children: t("cancel") }),
|
|
2215
|
+
/* @__PURE__ */ jsx15(
|
|
1992
2216
|
Button2,
|
|
1993
2217
|
{
|
|
1994
2218
|
color: "error",
|
|
@@ -2005,8 +2229,8 @@ function DeletePreviewDialog({
|
|
|
2005
2229
|
}
|
|
2006
2230
|
function DeletePreviewNode({ node, depth }) {
|
|
2007
2231
|
const t = useAdminTranslation();
|
|
2008
|
-
return /* @__PURE__ */
|
|
2009
|
-
|
|
2232
|
+
return /* @__PURE__ */ jsxs9(
|
|
2233
|
+
Box7,
|
|
2010
2234
|
{
|
|
2011
2235
|
sx: {
|
|
2012
2236
|
pl: depth === 0 ? 0 : 1.5,
|
|
@@ -2014,17 +2238,17 @@ function DeletePreviewNode({ node, depth }) {
|
|
|
2014
2238
|
borderLeft: depth === 0 ? "none" : "1px solid rgba(255, 255, 255, 0.08)"
|
|
2015
2239
|
},
|
|
2016
2240
|
children: [
|
|
2017
|
-
/* @__PURE__ */
|
|
2018
|
-
/* @__PURE__ */
|
|
2019
|
-
/* @__PURE__ */
|
|
2241
|
+
/* @__PURE__ */ jsxs9(Stack7, { spacing: 0.25, children: [
|
|
2242
|
+
/* @__PURE__ */ jsx15(Typography4, { sx: { fontWeight: 600 }, children: node.label }),
|
|
2243
|
+
/* @__PURE__ */ jsxs9(Typography4, { variant: "body2", color: "text.secondary", children: [
|
|
2020
2244
|
node.model_title,
|
|
2021
2245
|
node.relation_name ? ` \u2022 ${node.relation_name}` : "",
|
|
2022
2246
|
` \u2022 ${getEffectLabel(node.effect, t)}`
|
|
2023
2247
|
] })
|
|
2024
2248
|
] }),
|
|
2025
|
-
node.children.length > 0 ? /* @__PURE__ */
|
|
2249
|
+
node.children.length > 0 ? /* @__PURE__ */ jsx15(Stack7, { spacing: 0.75, sx: { mt: 1 }, children: node.children.map((childNode, index) => {
|
|
2026
2250
|
var _a;
|
|
2027
|
-
return /* @__PURE__ */
|
|
2251
|
+
return /* @__PURE__ */ jsx15(
|
|
2028
2252
|
DeletePreviewNode,
|
|
2029
2253
|
{
|
|
2030
2254
|
node: childNode,
|
|
@@ -2048,19 +2272,19 @@ function getEffectLabel(effect, t) {
|
|
|
2048
2272
|
}
|
|
2049
2273
|
|
|
2050
2274
|
// src/components/model-page/ListFiltersBar.tsx
|
|
2051
|
-
import { memo as memo3, useCallback as
|
|
2275
|
+
import { memo as memo3, useCallback as useCallback4, useEffect as useEffect8, useMemo as useMemo8, useState as useState8 } from "react";
|
|
2052
2276
|
import {
|
|
2053
2277
|
Autocomplete as Autocomplete2,
|
|
2054
2278
|
Button as Button3,
|
|
2055
2279
|
CircularProgress as CircularProgress3,
|
|
2056
2280
|
Divider,
|
|
2057
2281
|
MenuItem,
|
|
2058
|
-
Paper as
|
|
2059
|
-
Stack as
|
|
2282
|
+
Paper as Paper5,
|
|
2283
|
+
Stack as Stack8,
|
|
2060
2284
|
TextField as TextField2,
|
|
2061
|
-
Typography as
|
|
2285
|
+
Typography as Typography5
|
|
2062
2286
|
} from "@mui/material";
|
|
2063
|
-
import { Fragment as Fragment2, jsx as
|
|
2287
|
+
import { Fragment as Fragment2, jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2064
2288
|
var ListFiltersSidebar = memo3(function ListFiltersSidebar2({
|
|
2065
2289
|
client,
|
|
2066
2290
|
slug,
|
|
@@ -2071,7 +2295,7 @@ var ListFiltersSidebar = memo3(function ListFiltersSidebar2({
|
|
|
2071
2295
|
debounceMs = 300
|
|
2072
2296
|
}) {
|
|
2073
2297
|
const t = useAdminTranslation();
|
|
2074
|
-
const filterGroups =
|
|
2298
|
+
const filterGroups = useMemo8(() => {
|
|
2075
2299
|
var _a, _b;
|
|
2076
2300
|
const groupedFilters = /* @__PURE__ */ new Map();
|
|
2077
2301
|
for (const filter of filters) {
|
|
@@ -2090,13 +2314,13 @@ var ListFiltersSidebar = memo3(function ListFiltersSidebar2({
|
|
|
2090
2314
|
}
|
|
2091
2315
|
return Array.from(groupedFilters.values());
|
|
2092
2316
|
}, [filters]);
|
|
2093
|
-
const activeFiltersCount =
|
|
2317
|
+
const activeFiltersCount = useMemo8(
|
|
2094
2318
|
() => filters.filter((filter) => Boolean(values[filter.slug])).length,
|
|
2095
2319
|
[filters, values]
|
|
2096
2320
|
);
|
|
2097
2321
|
if (filters.length === 0) return null;
|
|
2098
|
-
return /* @__PURE__ */
|
|
2099
|
-
|
|
2322
|
+
return /* @__PURE__ */ jsx16(
|
|
2323
|
+
Paper5,
|
|
2100
2324
|
{
|
|
2101
2325
|
sx: {
|
|
2102
2326
|
width: { xs: "100%", lg: 288 },
|
|
@@ -2107,13 +2331,13 @@ var ListFiltersSidebar = memo3(function ListFiltersSidebar2({
|
|
|
2107
2331
|
p: 1.5,
|
|
2108
2332
|
overflow: "auto"
|
|
2109
2333
|
},
|
|
2110
|
-
children: /* @__PURE__ */
|
|
2111
|
-
/* @__PURE__ */
|
|
2112
|
-
/* @__PURE__ */
|
|
2113
|
-
/* @__PURE__ */
|
|
2114
|
-
activeFiltersCount > 0 ? /* @__PURE__ */
|
|
2334
|
+
children: /* @__PURE__ */ jsxs10(Stack8, { spacing: 1.5, children: [
|
|
2335
|
+
/* @__PURE__ */ jsxs10(Stack8, { direction: "row", spacing: 1, alignItems: "center", justifyContent: "space-between", children: [
|
|
2336
|
+
/* @__PURE__ */ jsxs10(Stack8, { spacing: 0.25, children: [
|
|
2337
|
+
/* @__PURE__ */ jsx16(Typography5, { sx: { fontSize: 15, fontWeight: 700 }, children: t("filters") }),
|
|
2338
|
+
activeFiltersCount > 0 ? /* @__PURE__ */ jsx16(Typography5, { color: "text.secondary", sx: { fontSize: 12 }, children: t("active_filters", { count: activeFiltersCount }) }) : null
|
|
2115
2339
|
] }),
|
|
2116
|
-
/* @__PURE__ */
|
|
2340
|
+
/* @__PURE__ */ jsx16(
|
|
2117
2341
|
Button3,
|
|
2118
2342
|
{
|
|
2119
2343
|
size: "small",
|
|
@@ -2124,8 +2348,8 @@ var ListFiltersSidebar = memo3(function ListFiltersSidebar2({
|
|
|
2124
2348
|
}
|
|
2125
2349
|
)
|
|
2126
2350
|
] }),
|
|
2127
|
-
/* @__PURE__ */
|
|
2128
|
-
filterGroups.map((group) => /* @__PURE__ */
|
|
2351
|
+
/* @__PURE__ */ jsx16(Divider, {}),
|
|
2352
|
+
filterGroups.map((group) => /* @__PURE__ */ jsx16(
|
|
2129
2353
|
FilterGroupSection,
|
|
2130
2354
|
{
|
|
2131
2355
|
client,
|
|
@@ -2142,11 +2366,11 @@ var ListFiltersSidebar = memo3(function ListFiltersSidebar2({
|
|
|
2142
2366
|
);
|
|
2143
2367
|
});
|
|
2144
2368
|
function FilterGroupSection({ client, slug, group, values, onChange, debounceMs }) {
|
|
2145
|
-
return /* @__PURE__ */
|
|
2146
|
-
/* @__PURE__ */
|
|
2147
|
-
/* @__PURE__ */
|
|
2369
|
+
return /* @__PURE__ */ jsxs10(Stack8, { spacing: 1, children: [
|
|
2370
|
+
/* @__PURE__ */ jsx16(Typography5, { sx: { fontSize: 13, fontWeight: 700, color: "text.secondary" }, children: group.title }),
|
|
2371
|
+
/* @__PURE__ */ jsx16(Stack8, { spacing: 1, children: group.filters.map((filter) => {
|
|
2148
2372
|
var _a;
|
|
2149
|
-
return /* @__PURE__ */
|
|
2373
|
+
return /* @__PURE__ */ jsx16(
|
|
2150
2374
|
ListFilterField,
|
|
2151
2375
|
{
|
|
2152
2376
|
client,
|
|
@@ -2164,15 +2388,17 @@ function FilterGroupSection({ client, slug, group, values, onChange, debounceMs
|
|
|
2164
2388
|
function ListFilterField({ client, slug, filter, value, onChange, debounceMs }) {
|
|
2165
2389
|
var _a, _b;
|
|
2166
2390
|
const t = useAdminTranslation();
|
|
2167
|
-
const [draftValue, setDraftValue] =
|
|
2168
|
-
const [searchValue, setSearchValue] =
|
|
2169
|
-
const
|
|
2391
|
+
const [draftValue, setDraftValue] = useState8(value);
|
|
2392
|
+
const [searchValue, setSearchValue] = useState8("");
|
|
2393
|
+
const selectedValues = useMemo8(() => parseSelectedFilterValues(value, filter.multiple), [filter.multiple, value]);
|
|
2394
|
+
const isSelectFilter = filter.input_kind === "select" || filter.input_kind === "select-multiple";
|
|
2395
|
+
const loadChoices = useCallback4(
|
|
2170
2396
|
async (signal) => {
|
|
2171
2397
|
const response = await client.getFilterChoices(
|
|
2172
2398
|
slug,
|
|
2173
2399
|
filter.slug,
|
|
2174
2400
|
searchValue || void 0,
|
|
2175
|
-
|
|
2401
|
+
selectedValues.length > 0 ? selectedValues : void 0,
|
|
2176
2402
|
{ signal }
|
|
2177
2403
|
);
|
|
2178
2404
|
return response.items.map((item) => ({
|
|
@@ -2180,23 +2406,23 @@ function ListFilterField({ client, slug, filter, value, onChange, debounceMs })
|
|
|
2180
2406
|
label: item.label
|
|
2181
2407
|
}));
|
|
2182
2408
|
},
|
|
2183
|
-
[client, filter.slug, searchValue,
|
|
2409
|
+
[client, filter.slug, searchValue, selectedValues, slug]
|
|
2184
2410
|
);
|
|
2185
2411
|
const { items: options, isLoading: isLoadingChoices } = useRemoteChoices({
|
|
2186
|
-
enabled: filter.has_choices &&
|
|
2412
|
+
enabled: filter.has_choices && isSelectFilter,
|
|
2187
2413
|
debounceMs,
|
|
2188
2414
|
initialItems: filter.options,
|
|
2189
2415
|
resetKey: `${slug}:${filter.slug}`,
|
|
2190
2416
|
queryKey: `${slug}:${filter.slug}:${searchValue}:${value}`,
|
|
2191
2417
|
load: loadChoices
|
|
2192
2418
|
});
|
|
2193
|
-
|
|
2419
|
+
useEffect8(() => {
|
|
2194
2420
|
setDraftValue(value);
|
|
2195
2421
|
}, [value]);
|
|
2196
|
-
|
|
2422
|
+
useEffect8(() => {
|
|
2197
2423
|
setSearchValue("");
|
|
2198
2424
|
}, [filter.slug]);
|
|
2199
|
-
|
|
2425
|
+
useEffect8(() => {
|
|
2200
2426
|
if (filter.input_kind !== "text") {
|
|
2201
2427
|
return;
|
|
2202
2428
|
}
|
|
@@ -2210,7 +2436,7 @@ function ListFilterField({ client, slug, filter, value, onChange, debounceMs })
|
|
|
2210
2436
|
};
|
|
2211
2437
|
}, [debounceMs, draftValue, filter.input_kind, filter.slug, onChange, value]);
|
|
2212
2438
|
if (filter.input_kind === "boolean") {
|
|
2213
|
-
return /* @__PURE__ */
|
|
2439
|
+
return /* @__PURE__ */ jsxs10(
|
|
2214
2440
|
TextField2,
|
|
2215
2441
|
{
|
|
2216
2442
|
select: true,
|
|
@@ -2220,21 +2446,27 @@ function ListFilterField({ client, slug, filter, value, onChange, debounceMs })
|
|
|
2220
2446
|
value,
|
|
2221
2447
|
onChange: (event) => onChange(filter.slug, event.target.value),
|
|
2222
2448
|
children: [
|
|
2223
|
-
/* @__PURE__ */
|
|
2224
|
-
filter.options.map((option) => /* @__PURE__ */
|
|
2449
|
+
/* @__PURE__ */ jsx16(MenuItem, { value: "", children: t("all") }),
|
|
2450
|
+
filter.options.map((option) => /* @__PURE__ */ jsx16(MenuItem, { value: option.value, children: option.label }, `${filter.slug}-${option.value}`))
|
|
2225
2451
|
]
|
|
2226
2452
|
}
|
|
2227
2453
|
);
|
|
2228
2454
|
}
|
|
2229
|
-
if (
|
|
2230
|
-
const
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2455
|
+
if (isSelectFilter) {
|
|
2456
|
+
const selectedOptions = selectedValues.map((selectedValue) => {
|
|
2457
|
+
var _a2;
|
|
2458
|
+
return (_a2 = options.find((option) => option.value === selectedValue)) != null ? _a2 : {
|
|
2459
|
+
value: selectedValue,
|
|
2460
|
+
label: selectedValue
|
|
2461
|
+
};
|
|
2462
|
+
});
|
|
2463
|
+
const selectedOption = filter.multiple ? selectedOptions : (_a = selectedOptions[0]) != null ? _a : null;
|
|
2464
|
+
return /* @__PURE__ */ jsx16(
|
|
2235
2465
|
Autocomplete2,
|
|
2236
2466
|
{
|
|
2237
2467
|
options,
|
|
2468
|
+
multiple: filter.multiple,
|
|
2469
|
+
disableCloseOnSelect: filter.multiple,
|
|
2238
2470
|
value: selectedOption,
|
|
2239
2471
|
loading: isLoadingChoices,
|
|
2240
2472
|
filterOptions: (items) => items,
|
|
@@ -2243,14 +2475,19 @@ function ListFilterField({ client, slug, filter, value, onChange, debounceMs })
|
|
|
2243
2475
|
isOptionEqualToValue: (option, selected) => option.value === selected.value,
|
|
2244
2476
|
getOptionLabel: (option) => option.label,
|
|
2245
2477
|
onChange: (_, nextValue) => {
|
|
2246
|
-
var _a2;
|
|
2247
|
-
|
|
2478
|
+
var _a2, _b2;
|
|
2479
|
+
if (filter.multiple) {
|
|
2480
|
+
const nextItems = Array.isArray(nextValue) ? nextValue : [];
|
|
2481
|
+
onChange(filter.slug, nextItems.map((item) => item.value).join(","));
|
|
2482
|
+
return;
|
|
2483
|
+
}
|
|
2484
|
+
onChange(filter.slug, (_b2 = (_a2 = Array.isArray(nextValue) ? nextValue[0] : nextValue) == null ? void 0 : _a2.value) != null ? _b2 : "");
|
|
2248
2485
|
},
|
|
2249
2486
|
onInputChange: (_, nextInputValue) => setSearchValue(nextInputValue),
|
|
2250
2487
|
renderInput: (params) => (() => {
|
|
2251
2488
|
var _a2;
|
|
2252
2489
|
const { InputProps, inputProps, ...textFieldParams } = params;
|
|
2253
|
-
return /* @__PURE__ */
|
|
2490
|
+
return /* @__PURE__ */ jsx16(
|
|
2254
2491
|
TextField2,
|
|
2255
2492
|
{
|
|
2256
2493
|
...textFieldParams,
|
|
@@ -2259,8 +2496,8 @@ function ListFilterField({ client, slug, filter, value, onChange, debounceMs })
|
|
|
2259
2496
|
slotProps: {
|
|
2260
2497
|
input: {
|
|
2261
2498
|
...InputProps,
|
|
2262
|
-
endAdornment: /* @__PURE__ */
|
|
2263
|
-
isLoadingChoices ? /* @__PURE__ */
|
|
2499
|
+
endAdornment: /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
2500
|
+
isLoadingChoices ? /* @__PURE__ */ jsx16(CircularProgress3, { color: "inherit", size: 16 }) : null,
|
|
2264
2501
|
InputProps.endAdornment
|
|
2265
2502
|
] })
|
|
2266
2503
|
},
|
|
@@ -2272,7 +2509,7 @@ function ListFilterField({ client, slug, filter, value, onChange, debounceMs })
|
|
|
2272
2509
|
}
|
|
2273
2510
|
);
|
|
2274
2511
|
}
|
|
2275
|
-
return /* @__PURE__ */
|
|
2512
|
+
return /* @__PURE__ */ jsx16(
|
|
2276
2513
|
TextField2,
|
|
2277
2514
|
{
|
|
2278
2515
|
size: "small",
|
|
@@ -2284,12 +2521,21 @@ function ListFilterField({ client, slug, filter, value, onChange, debounceMs })
|
|
|
2284
2521
|
}
|
|
2285
2522
|
);
|
|
2286
2523
|
}
|
|
2524
|
+
function parseSelectedFilterValues(value, multiple) {
|
|
2525
|
+
if (!value) {
|
|
2526
|
+
return [];
|
|
2527
|
+
}
|
|
2528
|
+
if (!multiple) {
|
|
2529
|
+
return [value];
|
|
2530
|
+
}
|
|
2531
|
+
return value.split(",").map((item) => item.trim()).filter(Boolean);
|
|
2532
|
+
}
|
|
2287
2533
|
|
|
2288
2534
|
// src/components/model-page/ListRow.tsx
|
|
2289
2535
|
import { memo as memo4 } from "react";
|
|
2290
2536
|
import MoreVertIcon from "@mui/icons-material/MoreVert";
|
|
2291
|
-
import { Box as
|
|
2292
|
-
import { jsx as
|
|
2537
|
+
import { Box as Box8, Checkbox, IconButton as IconButton2, TableCell, TableRow } from "@mui/material";
|
|
2538
|
+
import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2293
2539
|
var ListRow = memo4(function ListRow2({
|
|
2294
2540
|
row,
|
|
2295
2541
|
pkField,
|
|
@@ -2305,7 +2551,7 @@ var ListRow = memo4(function ListRow2({
|
|
|
2305
2551
|
const checkboxColumnWidth = 56;
|
|
2306
2552
|
const actionsColumnWidth = 56;
|
|
2307
2553
|
const rowId = row[pkField];
|
|
2308
|
-
return /* @__PURE__ */
|
|
2554
|
+
return /* @__PURE__ */ jsxs11(
|
|
2309
2555
|
TableRow,
|
|
2310
2556
|
{
|
|
2311
2557
|
hover: true,
|
|
@@ -2319,7 +2565,7 @@ var ListRow = memo4(function ListRow2({
|
|
|
2319
2565
|
}
|
|
2320
2566
|
},
|
|
2321
2567
|
children: [
|
|
2322
|
-
/* @__PURE__ */
|
|
2568
|
+
/* @__PURE__ */ jsx17(
|
|
2323
2569
|
TableCell,
|
|
2324
2570
|
{
|
|
2325
2571
|
padding: "none",
|
|
@@ -2331,7 +2577,7 @@ var ListRow = memo4(function ListRow2({
|
|
|
2331
2577
|
textAlign: "center",
|
|
2332
2578
|
px: 1
|
|
2333
2579
|
},
|
|
2334
|
-
children: /* @__PURE__ */
|
|
2580
|
+
children: /* @__PURE__ */ jsx17(
|
|
2335
2581
|
Checkbox,
|
|
2336
2582
|
{
|
|
2337
2583
|
checked: isSelected,
|
|
@@ -2356,8 +2602,8 @@ var ListRow = memo4(function ListRow2({
|
|
|
2356
2602
|
textOverflow: "ellipsis"
|
|
2357
2603
|
};
|
|
2358
2604
|
if (imageUrl) {
|
|
2359
|
-
return /* @__PURE__ */
|
|
2360
|
-
|
|
2605
|
+
return /* @__PURE__ */ jsx17(TableCell, { title: fullFieldValue, sx: { ...commonCellSx, py: 0.75 }, children: /* @__PURE__ */ jsx17(
|
|
2606
|
+
Box8,
|
|
2361
2607
|
{
|
|
2362
2608
|
component: "img",
|
|
2363
2609
|
src: imageUrl,
|
|
@@ -2374,7 +2620,7 @@ var ListRow = memo4(function ListRow2({
|
|
|
2374
2620
|
) }, fieldName);
|
|
2375
2621
|
}
|
|
2376
2622
|
if (index === 0) {
|
|
2377
|
-
return /* @__PURE__ */
|
|
2623
|
+
return /* @__PURE__ */ jsx17(
|
|
2378
2624
|
TableCell,
|
|
2379
2625
|
{
|
|
2380
2626
|
title: fullFieldValue,
|
|
@@ -2392,7 +2638,7 @@ var ListRow = memo4(function ListRow2({
|
|
|
2392
2638
|
color: "primary.main"
|
|
2393
2639
|
}
|
|
2394
2640
|
},
|
|
2395
|
-
children: /* @__PURE__ */
|
|
2641
|
+
children: /* @__PURE__ */ jsx17(
|
|
2396
2642
|
NavLink,
|
|
2397
2643
|
{
|
|
2398
2644
|
href: `${basePath}/${slug}/${rowId}`,
|
|
@@ -2405,9 +2651,9 @@ var ListRow = memo4(function ListRow2({
|
|
|
2405
2651
|
fieldName
|
|
2406
2652
|
);
|
|
2407
2653
|
}
|
|
2408
|
-
return /* @__PURE__ */
|
|
2654
|
+
return /* @__PURE__ */ jsx17(TableCell, { title: fullFieldValue, sx: commonCellSx, children: fieldValue }, fieldName);
|
|
2409
2655
|
}),
|
|
2410
|
-
/* @__PURE__ */
|
|
2656
|
+
/* @__PURE__ */ jsx17(
|
|
2411
2657
|
TableCell,
|
|
2412
2658
|
{
|
|
2413
2659
|
align: "right",
|
|
@@ -2416,7 +2662,7 @@ var ListRow = memo4(function ListRow2({
|
|
|
2416
2662
|
minWidth: actionsColumnWidth,
|
|
2417
2663
|
maxWidth: actionsColumnWidth
|
|
2418
2664
|
},
|
|
2419
|
-
children: /* @__PURE__ */
|
|
2665
|
+
children: /* @__PURE__ */ jsx17(IconButton2, { size: "small", onClick: (event) => onOpenMenu(event, rowId), children: /* @__PURE__ */ jsx17(MoreVertIcon, { fontSize: "small" }) })
|
|
2420
2666
|
}
|
|
2421
2667
|
)
|
|
2422
2668
|
]
|
|
@@ -2425,20 +2671,20 @@ var ListRow = memo4(function ListRow2({
|
|
|
2425
2671
|
});
|
|
2426
2672
|
|
|
2427
2673
|
// src/components/model-page/SearchField.tsx
|
|
2428
|
-
import { memo as memo5, useEffect as
|
|
2674
|
+
import { memo as memo5, useEffect as useEffect9, useState as useState9 } from "react";
|
|
2429
2675
|
import { TextField as TextField3 } from "@mui/material";
|
|
2430
|
-
import { jsx as
|
|
2676
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
2431
2677
|
var SearchField = memo5(function SearchField2({
|
|
2432
2678
|
value,
|
|
2433
2679
|
onCommit,
|
|
2434
2680
|
debounceMs,
|
|
2435
2681
|
placeholder
|
|
2436
2682
|
}) {
|
|
2437
|
-
const [draftValue, setDraftValue] =
|
|
2438
|
-
|
|
2683
|
+
const [draftValue, setDraftValue] = useState9(value);
|
|
2684
|
+
useEffect9(() => {
|
|
2439
2685
|
setDraftValue(value);
|
|
2440
2686
|
}, [value]);
|
|
2441
|
-
|
|
2687
|
+
useEffect9(() => {
|
|
2442
2688
|
const timerId = window.setTimeout(() => {
|
|
2443
2689
|
if (draftValue !== value) {
|
|
2444
2690
|
onCommit(draftValue);
|
|
@@ -2448,7 +2694,7 @@ var SearchField = memo5(function SearchField2({
|
|
|
2448
2694
|
window.clearTimeout(timerId);
|
|
2449
2695
|
};
|
|
2450
2696
|
}, [debounceMs, draftValue, onCommit, value]);
|
|
2451
|
-
return /* @__PURE__ */
|
|
2697
|
+
return /* @__PURE__ */ jsx18(
|
|
2452
2698
|
TextField3,
|
|
2453
2699
|
{
|
|
2454
2700
|
size: "small",
|
|
@@ -2467,7 +2713,7 @@ var SearchField = memo5(function SearchField2({
|
|
|
2467
2713
|
});
|
|
2468
2714
|
|
|
2469
2715
|
// src/components/model-page/useModelPageController.ts
|
|
2470
|
-
import { useCallback as
|
|
2716
|
+
import { useCallback as useCallback5, useEffect as useEffect10, useMemo as useMemo9, useRef as useRef4, useState as useState10 } from "react";
|
|
2471
2717
|
|
|
2472
2718
|
// src/cache.ts
|
|
2473
2719
|
var MAX_CACHE_ENTRIES = 100;
|
|
@@ -2561,7 +2807,8 @@ function useModelPageController({
|
|
|
2561
2807
|
t
|
|
2562
2808
|
}) {
|
|
2563
2809
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
2564
|
-
const
|
|
2810
|
+
const message = useAdminMessage();
|
|
2811
|
+
const searchParams = useMemo9(() => new URLSearchParams(locationSearch), [locationSearch]);
|
|
2565
2812
|
const initialQuery = (_a = searchParams.get("q")) != null ? _a : "";
|
|
2566
2813
|
const initialSort = (_b = searchParams.get("sort")) != null ? _b : "";
|
|
2567
2814
|
const initialPage = parsePageParam(searchParams.get("page"));
|
|
@@ -2575,40 +2822,41 @@ function useModelPageController({
|
|
|
2575
2822
|
...initialFilters
|
|
2576
2823
|
})
|
|
2577
2824
|
)) != null ? _c : null;
|
|
2578
|
-
const [selectedIds, setSelectedIds] =
|
|
2579
|
-
const [isAllMatchingSelected, setIsAllMatchingSelected] =
|
|
2580
|
-
const [createOpen, setCreateOpen] =
|
|
2581
|
-
const [data, setData] =
|
|
2582
|
-
const [error, setError] =
|
|
2583
|
-
const [isLoading, setIsLoading] =
|
|
2584
|
-
const [rowActionMenuAnchor, setRowActionMenuAnchor] =
|
|
2585
|
-
const [rowActionMenuId, setRowActionMenuId] =
|
|
2586
|
-
const [bulkActionMenuAnchor, setBulkActionMenuAnchor] =
|
|
2587
|
-
const [appliedQuery, setAppliedQuery] =
|
|
2588
|
-
const [sortValue, setSortValue] =
|
|
2589
|
-
const [currentPage, setCurrentPage] =
|
|
2590
|
-
const [pageInput, setPageInput] =
|
|
2591
|
-
const [appliedFilters, setAppliedFilters] =
|
|
2592
|
-
const [deletePreviewOpen, setDeletePreviewOpen] =
|
|
2593
|
-
const [deletePreview, setDeletePreview] =
|
|
2594
|
-
const [deletePreviewError, setDeletePreviewError] =
|
|
2595
|
-
const [isDeletePreviewLoading, setIsDeletePreviewLoading] =
|
|
2596
|
-
const [isDeleteSubmitting, setIsDeleteSubmitting] =
|
|
2597
|
-
const [pendingDeleteIds, setPendingDeleteIds] =
|
|
2598
|
-
const [pendingDeleteSelectAll, setPendingDeleteSelectAll] =
|
|
2599
|
-
const [pendingDeleteScope, setPendingDeleteScope] =
|
|
2600
|
-
const [pendingDeleteMode, setPendingDeleteMode] =
|
|
2601
|
-
const [filtersOpen, setFiltersOpen] =
|
|
2602
|
-
const requestIdRef =
|
|
2603
|
-
const dataRef =
|
|
2604
|
-
const pageSizeRef =
|
|
2605
|
-
const
|
|
2825
|
+
const [selectedIds, setSelectedIds] = useState10([]);
|
|
2826
|
+
const [isAllMatchingSelected, setIsAllMatchingSelected] = useState10(false);
|
|
2827
|
+
const [createOpen, setCreateOpen] = useState10(false);
|
|
2828
|
+
const [data, setData] = useState10(() => initialCachedResponse);
|
|
2829
|
+
const [error, setError] = useState10(null);
|
|
2830
|
+
const [isLoading, setIsLoading] = useState10(initialCachedResponse === null);
|
|
2831
|
+
const [rowActionMenuAnchor, setRowActionMenuAnchor] = useState10(null);
|
|
2832
|
+
const [rowActionMenuId, setRowActionMenuId] = useState10(null);
|
|
2833
|
+
const [bulkActionMenuAnchor, setBulkActionMenuAnchor] = useState10(null);
|
|
2834
|
+
const [appliedQuery, setAppliedQuery] = useState10(initialQuery);
|
|
2835
|
+
const [sortValue, setSortValue] = useState10(initialSort);
|
|
2836
|
+
const [currentPage, setCurrentPage] = useState10(initialPage);
|
|
2837
|
+
const [pageInput, setPageInput] = useState10(String(initialPage));
|
|
2838
|
+
const [appliedFilters, setAppliedFilters] = useState10(initialFilters);
|
|
2839
|
+
const [deletePreviewOpen, setDeletePreviewOpen] = useState10(false);
|
|
2840
|
+
const [deletePreview, setDeletePreview] = useState10(null);
|
|
2841
|
+
const [deletePreviewError, setDeletePreviewError] = useState10(null);
|
|
2842
|
+
const [isDeletePreviewLoading, setIsDeletePreviewLoading] = useState10(false);
|
|
2843
|
+
const [isDeleteSubmitting, setIsDeleteSubmitting] = useState10(false);
|
|
2844
|
+
const [pendingDeleteIds, setPendingDeleteIds] = useState10([]);
|
|
2845
|
+
const [pendingDeleteSelectAll, setPendingDeleteSelectAll] = useState10(false);
|
|
2846
|
+
const [pendingDeleteScope, setPendingDeleteScope] = useState10(null);
|
|
2847
|
+
const [pendingDeleteMode, setPendingDeleteMode] = useState10("single");
|
|
2848
|
+
const [filtersOpen, setFiltersOpen] = useState10(false);
|
|
2849
|
+
const requestIdRef = useRef4(0);
|
|
2850
|
+
const dataRef = useRef4(initialCachedResponse);
|
|
2851
|
+
const pageSizeRef = useRef4((_d = initialCachedResponse == null ? void 0 : initialCachedResponse.meta.page_size) != null ? _d : DEFAULT_PAGE_SIZE);
|
|
2852
|
+
const previousSlugRef = useRef4(slug);
|
|
2853
|
+
const sortFields = useMemo9(() => sortValue.split(",").filter(Boolean), [sortValue]);
|
|
2606
2854
|
const meta = (_e = data == null ? void 0 : data.meta) != null ? _e : null;
|
|
2607
2855
|
const rows = (_f = data == null ? void 0 : data.items) != null ? _f : [];
|
|
2608
2856
|
const total = (_g = data == null ? void 0 : data.pagination.total) != null ? _g : 0;
|
|
2609
2857
|
const pageSize = (_h = meta == null ? void 0 : meta.page_size) != null ? _h : pageSizeRef.current;
|
|
2610
2858
|
const totalPages = Math.max(1, Math.ceil(total / pageSize));
|
|
2611
|
-
const fieldMap =
|
|
2859
|
+
const fieldMap = useMemo9(
|
|
2612
2860
|
() => {
|
|
2613
2861
|
var _a2;
|
|
2614
2862
|
return new Map(((_a2 = meta == null ? void 0 : meta.fields) != null ? _a2 : []).map((field) => [field.name, field]));
|
|
@@ -2619,14 +2867,14 @@ function useModelPageController({
|
|
|
2619
2867
|
const listFilters = (_j = meta == null ? void 0 : meta.list_filters) != null ? _j : [];
|
|
2620
2868
|
const hasListFilters = listFilters.length > 0;
|
|
2621
2869
|
const bulkActions = (_k = meta == null ? void 0 : meta.bulk_actions) != null ? _k : [];
|
|
2622
|
-
const selectionScope =
|
|
2870
|
+
const selectionScope = useMemo9(
|
|
2623
2871
|
() => ({
|
|
2624
2872
|
q: appliedQuery || void 0,
|
|
2625
2873
|
filters: { ...appliedFilters }
|
|
2626
2874
|
}),
|
|
2627
2875
|
[appliedFilters, appliedQuery]
|
|
2628
2876
|
);
|
|
2629
|
-
const selectedIdSet =
|
|
2877
|
+
const selectedIdSet = useMemo9(() => {
|
|
2630
2878
|
if (isAllMatchingSelected) {
|
|
2631
2879
|
return new Set(rows.map((row) => {
|
|
2632
2880
|
var _a2;
|
|
@@ -2645,13 +2893,53 @@ function useModelPageController({
|
|
|
2645
2893
|
});
|
|
2646
2894
|
const hasSelection = isAllMatchingSelected || selectedIds.length > 0;
|
|
2647
2895
|
const selectionCount = isAllMatchingSelected ? total : selectedIds.length;
|
|
2648
|
-
|
|
2896
|
+
useEffect10(() => {
|
|
2649
2897
|
dataRef.current = data;
|
|
2650
2898
|
}, [data]);
|
|
2651
|
-
|
|
2899
|
+
useEffect10(() => {
|
|
2652
2900
|
setPageInput(String(currentPage));
|
|
2653
2901
|
}, [currentPage]);
|
|
2654
|
-
|
|
2902
|
+
useEffect10(() => {
|
|
2903
|
+
var _a2, _b2, _c2, _d2;
|
|
2904
|
+
if (previousSlugRef.current === slug) {
|
|
2905
|
+
return;
|
|
2906
|
+
}
|
|
2907
|
+
previousSlugRef.current = slug;
|
|
2908
|
+
const nextSearchParams = new URLSearchParams(locationSearch);
|
|
2909
|
+
const nextQuery = (_a2 = nextSearchParams.get("q")) != null ? _a2 : "";
|
|
2910
|
+
const nextSort = (_b2 = nextSearchParams.get("sort")) != null ? _b2 : "";
|
|
2911
|
+
const nextPage = parsePageParam(nextSearchParams.get("page"));
|
|
2912
|
+
const nextFilters = extractFilterParams(nextSearchParams);
|
|
2913
|
+
const nextCachedResponse = (_c2 = getClientCacheBucket(client).listResponseCache.get(
|
|
2914
|
+
buildListCacheKey(slug, {
|
|
2915
|
+
q: nextQuery || void 0,
|
|
2916
|
+
sort: nextSort || void 0,
|
|
2917
|
+
limit: DEFAULT_PAGE_SIZE,
|
|
2918
|
+
offset: (nextPage - 1) * DEFAULT_PAGE_SIZE,
|
|
2919
|
+
...nextFilters
|
|
2920
|
+
})
|
|
2921
|
+
)) != null ? _c2 : null;
|
|
2922
|
+
dataRef.current = nextCachedResponse;
|
|
2923
|
+
pageSizeRef.current = (_d2 = nextCachedResponse == null ? void 0 : nextCachedResponse.meta.page_size) != null ? _d2 : DEFAULT_PAGE_SIZE;
|
|
2924
|
+
setData(nextCachedResponse);
|
|
2925
|
+
setError(null);
|
|
2926
|
+
setIsLoading(nextCachedResponse === null);
|
|
2927
|
+
setSelectedIds([]);
|
|
2928
|
+
setIsAllMatchingSelected(false);
|
|
2929
|
+
setRowActionMenuAnchor(null);
|
|
2930
|
+
setRowActionMenuId(null);
|
|
2931
|
+
setBulkActionMenuAnchor(null);
|
|
2932
|
+
setDeletePreviewOpen(false);
|
|
2933
|
+
setDeletePreview(null);
|
|
2934
|
+
setDeletePreviewError(null);
|
|
2935
|
+
setIsDeletePreviewLoading(false);
|
|
2936
|
+
setIsDeleteSubmitting(false);
|
|
2937
|
+
setPendingDeleteIds([]);
|
|
2938
|
+
setPendingDeleteSelectAll(false);
|
|
2939
|
+
setPendingDeleteScope(null);
|
|
2940
|
+
setPendingDeleteMode("single");
|
|
2941
|
+
}, [client, locationSearch, slug]);
|
|
2942
|
+
useEffect10(() => {
|
|
2655
2943
|
var _a2, _b2;
|
|
2656
2944
|
const nextSearchParams = new URLSearchParams(locationSearch);
|
|
2657
2945
|
const nextQuery = (_a2 = nextSearchParams.get("q")) != null ? _a2 : "";
|
|
@@ -2664,11 +2952,11 @@ function useModelPageController({
|
|
|
2664
2952
|
setPageInput(String(nextPage));
|
|
2665
2953
|
setAppliedFilters(nextFilters);
|
|
2666
2954
|
}, [locationSearch]);
|
|
2667
|
-
const clearSelection =
|
|
2955
|
+
const clearSelection = useCallback5(() => {
|
|
2668
2956
|
setSelectedIds([]);
|
|
2669
2957
|
setIsAllMatchingSelected(false);
|
|
2670
2958
|
}, []);
|
|
2671
|
-
const loadItems =
|
|
2959
|
+
const loadItems = useCallback5(async () => {
|
|
2672
2960
|
var _a2;
|
|
2673
2961
|
const activeRequestId = requestIdRef.current + 1;
|
|
2674
2962
|
requestIdRef.current = activeRequestId;
|
|
@@ -2712,17 +3000,17 @@ function useModelPageController({
|
|
|
2712
3000
|
}
|
|
2713
3001
|
}
|
|
2714
3002
|
}, [appliedFilters, appliedQuery, client, currentPage, isAllMatchingSelected, slug, sortValue, t]);
|
|
2715
|
-
|
|
3003
|
+
useEffect10(() => {
|
|
2716
3004
|
void loadItems();
|
|
2717
3005
|
}, [loadItems]);
|
|
2718
|
-
const refresh =
|
|
3006
|
+
const refresh = useCallback5(async () => {
|
|
2719
3007
|
invalidateModelCache(client, slug);
|
|
2720
3008
|
await loadItems();
|
|
2721
3009
|
}, [client, loadItems, slug]);
|
|
2722
|
-
const replaceLocation =
|
|
3010
|
+
const replaceLocation = useCallback5((nextQuery, nextSort, nextPage, nextFilters) => {
|
|
2723
3011
|
router.replace(buildUrlWithParams(pathname, nextQuery, nextSort, nextPage, nextFilters));
|
|
2724
3012
|
}, [pathname, router]);
|
|
2725
|
-
const handleSearchCommit =
|
|
3013
|
+
const handleSearchCommit = useCallback5((nextQuery) => {
|
|
2726
3014
|
if (nextQuery === appliedQuery) {
|
|
2727
3015
|
return;
|
|
2728
3016
|
}
|
|
@@ -2732,17 +3020,17 @@ function useModelPageController({
|
|
|
2732
3020
|
setPageInput("1");
|
|
2733
3021
|
replaceLocation(nextQuery, sortValue, 1, appliedFilters);
|
|
2734
3022
|
}, [appliedFilters, appliedQuery, clearSelection, replaceLocation, sortValue]);
|
|
2735
|
-
const handlePageChange =
|
|
3023
|
+
const handlePageChange = useCallback5((nextPage) => {
|
|
2736
3024
|
const safePage = Math.min(Math.max(nextPage, 1), totalPages);
|
|
2737
3025
|
setCurrentPage(safePage);
|
|
2738
3026
|
setPageInput(String(safePage));
|
|
2739
3027
|
replaceLocation(appliedQuery, sortValue, safePage, appliedFilters);
|
|
2740
3028
|
}, [appliedFilters, appliedQuery, replaceLocation, sortValue, totalPages]);
|
|
2741
|
-
const handlePageInputCommit =
|
|
3029
|
+
const handlePageInputCommit = useCallback5(() => {
|
|
2742
3030
|
const parsedPage = parsePageParam(pageInput);
|
|
2743
3031
|
handlePageChange(parsedPage);
|
|
2744
3032
|
}, [handlePageChange, pageInput]);
|
|
2745
|
-
const toggleSort =
|
|
3033
|
+
const toggleSort = useCallback5((fieldName) => {
|
|
2746
3034
|
const nextSortFields = sortFields.filter((item) => item !== fieldName && item !== `-${fieldName}`);
|
|
2747
3035
|
const currentSort = sortFields.find((item) => item === fieldName || item === `-${fieldName}`);
|
|
2748
3036
|
if (currentSort === void 0) {
|
|
@@ -2758,7 +3046,7 @@ function useModelPageController({
|
|
|
2758
3046
|
setPageInput("1");
|
|
2759
3047
|
replaceLocation(appliedQuery, nextSortValue, 1, appliedFilters);
|
|
2760
3048
|
}, [appliedFilters, appliedQuery, replaceLocation, sortFields]);
|
|
2761
|
-
const handleFilterChange =
|
|
3049
|
+
const handleFilterChange = useCallback5((filterSlug, value) => {
|
|
2762
3050
|
const nextFilters = {
|
|
2763
3051
|
...appliedFilters,
|
|
2764
3052
|
[filterSlug]: value
|
|
@@ -2772,7 +3060,7 @@ function useModelPageController({
|
|
|
2772
3060
|
setPageInput("1");
|
|
2773
3061
|
replaceLocation(appliedQuery, sortValue, 1, nextFilters);
|
|
2774
3062
|
}, [appliedFilters, appliedQuery, clearSelection, replaceLocation, sortValue]);
|
|
2775
|
-
const handleResetFilters =
|
|
3063
|
+
const handleResetFilters = useCallback5(() => {
|
|
2776
3064
|
if (Object.keys(appliedFilters).length === 0) {
|
|
2777
3065
|
return;
|
|
2778
3066
|
}
|
|
@@ -2782,7 +3070,7 @@ function useModelPageController({
|
|
|
2782
3070
|
setPageInput("1");
|
|
2783
3071
|
replaceLocation(appliedQuery, sortValue, 1, {});
|
|
2784
3072
|
}, [appliedFilters, appliedQuery, clearSelection, replaceLocation, sortValue]);
|
|
2785
|
-
const openSingleDeletePreview =
|
|
3073
|
+
const openSingleDeletePreview = useCallback5(async (rowId) => {
|
|
2786
3074
|
setPendingDeleteIds([rowId]);
|
|
2787
3075
|
setPendingDeleteSelectAll(false);
|
|
2788
3076
|
setPendingDeleteScope(null);
|
|
@@ -2800,7 +3088,7 @@ function useModelPageController({
|
|
|
2800
3088
|
setIsDeletePreviewLoading(false);
|
|
2801
3089
|
}
|
|
2802
3090
|
}, [client, slug, t]);
|
|
2803
|
-
const openBulkDeletePreview =
|
|
3091
|
+
const openBulkDeletePreview = useCallback5(async () => {
|
|
2804
3092
|
if (!hasSelection) {
|
|
2805
3093
|
return;
|
|
2806
3094
|
}
|
|
@@ -2826,7 +3114,7 @@ function useModelPageController({
|
|
|
2826
3114
|
setBulkActionMenuAnchor(null);
|
|
2827
3115
|
}
|
|
2828
3116
|
}, [client, hasSelection, isAllMatchingSelected, selectedIds, selectionScope, slug, t]);
|
|
2829
|
-
const handleConfirmDelete =
|
|
3117
|
+
const handleConfirmDelete = useCallback5(async () => {
|
|
2830
3118
|
if (pendingDeleteMode === "single" && pendingDeleteIds.length === 0) {
|
|
2831
3119
|
return;
|
|
2832
3120
|
}
|
|
@@ -2838,12 +3126,14 @@ function useModelPageController({
|
|
|
2838
3126
|
try {
|
|
2839
3127
|
if (pendingDeleteMode === "single") {
|
|
2840
3128
|
await client.deleteItem(slug, pendingDeleteIds[0]);
|
|
3129
|
+
message.success(t("object_deleted_success"));
|
|
2841
3130
|
} else {
|
|
2842
|
-
await client.bulkDelete(
|
|
3131
|
+
const response = await client.bulkDelete(
|
|
2843
3132
|
slug,
|
|
2844
3133
|
pendingDeleteIds,
|
|
2845
3134
|
pendingDeleteSelectAll && pendingDeleteScope ? { selectAll: true, selectionScope: pendingDeleteScope } : void 0
|
|
2846
3135
|
);
|
|
3136
|
+
message.success(t("delete_success", { count: response.deleted }));
|
|
2847
3137
|
}
|
|
2848
3138
|
setDeletePreviewOpen(false);
|
|
2849
3139
|
setDeletePreview(null);
|
|
@@ -2854,12 +3144,15 @@ function useModelPageController({
|
|
|
2854
3144
|
clearSelection();
|
|
2855
3145
|
await refresh();
|
|
2856
3146
|
} catch (reason) {
|
|
2857
|
-
|
|
3147
|
+
const nextError = reason instanceof Error ? reason.message : t("object_delete_error");
|
|
3148
|
+
setDeletePreviewError(nextError);
|
|
3149
|
+
message.error(nextError);
|
|
2858
3150
|
} finally {
|
|
2859
3151
|
setIsDeleteSubmitting(false);
|
|
2860
3152
|
}
|
|
2861
|
-
}, [clearSelection, client, pendingDeleteIds, pendingDeleteMode, pendingDeleteScope, pendingDeleteSelectAll, refresh, slug, t]);
|
|
2862
|
-
const handleRunNamedBulkAction =
|
|
3153
|
+
}, [clearSelection, client, message, pendingDeleteIds, pendingDeleteMode, pendingDeleteScope, pendingDeleteSelectAll, refresh, slug, t]);
|
|
3154
|
+
const handleRunNamedBulkAction = useCallback5(async (actionSlug) => {
|
|
3155
|
+
var _a2, _b2;
|
|
2863
3156
|
if (!actionSlug || !hasSelection) {
|
|
2864
3157
|
return;
|
|
2865
3158
|
}
|
|
@@ -2868,7 +3161,7 @@ function useModelPageController({
|
|
|
2868
3161
|
return;
|
|
2869
3162
|
}
|
|
2870
3163
|
try {
|
|
2871
|
-
await client.runBulkAction(
|
|
3164
|
+
const response = await client.runBulkAction(
|
|
2872
3165
|
slug,
|
|
2873
3166
|
actionSlug,
|
|
2874
3167
|
isAllMatchingSelected ? [] : selectedIds,
|
|
@@ -2878,16 +3171,20 @@ function useModelPageController({
|
|
|
2878
3171
|
setBulkActionMenuAnchor(null);
|
|
2879
3172
|
clearSelection();
|
|
2880
3173
|
await refresh();
|
|
3174
|
+
const actionLabel = (_b2 = (_a2 = bulkActions.find((item) => item.slug === actionSlug)) == null ? void 0 : _a2.label) != null ? _b2 : actionSlug;
|
|
3175
|
+
message.success(t("action_success", { action: actionLabel, count: response.processed }));
|
|
2881
3176
|
} catch (reason) {
|
|
2882
|
-
|
|
3177
|
+
const nextError = reason instanceof Error ? reason.message : t("object_action_error");
|
|
3178
|
+
setError(nextError);
|
|
3179
|
+
message.error(nextError);
|
|
2883
3180
|
}
|
|
2884
|
-
}, [clearSelection, client, hasSelection, isAllMatchingSelected, openBulkDeletePreview, refresh, selectedIds, selectionScope, slug, t]);
|
|
2885
|
-
const handleRowDelete =
|
|
3181
|
+
}, [bulkActions, clearSelection, client, hasSelection, isAllMatchingSelected, message, openBulkDeletePreview, refresh, selectedIds, selectionScope, slug, t]);
|
|
3182
|
+
const handleRowDelete = useCallback5(async (rowId) => {
|
|
2886
3183
|
setRowActionMenuAnchor(null);
|
|
2887
3184
|
setRowActionMenuId(null);
|
|
2888
3185
|
await openSingleDeletePreview(rowId);
|
|
2889
3186
|
}, [openSingleDeletePreview]);
|
|
2890
|
-
const handleToggleSelection =
|
|
3187
|
+
const handleToggleSelection = useCallback5((rowId, checked) => {
|
|
2891
3188
|
if (isAllMatchingSelected) {
|
|
2892
3189
|
if (checked) {
|
|
2893
3190
|
return;
|
|
@@ -2913,7 +3210,7 @@ function useModelPageController({
|
|
|
2913
3210
|
return current.filter((item) => String(item) !== rowKey);
|
|
2914
3211
|
});
|
|
2915
3212
|
}, [isAllMatchingSelected, meta, rows]);
|
|
2916
|
-
const handleToggleAllVisible =
|
|
3213
|
+
const handleToggleAllVisible = useCallback5((checked) => {
|
|
2917
3214
|
if (!meta) {
|
|
2918
3215
|
return;
|
|
2919
3216
|
}
|
|
@@ -2924,33 +3221,33 @@ function useModelPageController({
|
|
|
2924
3221
|
}
|
|
2925
3222
|
clearSelection();
|
|
2926
3223
|
}, [clearSelection, meta, rows]);
|
|
2927
|
-
const handleSelectAllMatching =
|
|
3224
|
+
const handleSelectAllMatching = useCallback5(() => {
|
|
2928
3225
|
if (!hasSelection || total === 0) {
|
|
2929
3226
|
return;
|
|
2930
3227
|
}
|
|
2931
3228
|
setSelectedIds([]);
|
|
2932
3229
|
setIsAllMatchingSelected(true);
|
|
2933
3230
|
}, [hasSelection, total]);
|
|
2934
|
-
const clearBulkDeleteState =
|
|
3231
|
+
const clearBulkDeleteState = useCallback5(() => {
|
|
2935
3232
|
setPendingDeleteIds([]);
|
|
2936
3233
|
setPendingDeleteSelectAll(false);
|
|
2937
3234
|
setPendingDeleteScope(null);
|
|
2938
3235
|
}, []);
|
|
2939
|
-
const handleClearDeletePreview =
|
|
3236
|
+
const handleClearDeletePreview = useCallback5(() => {
|
|
2940
3237
|
setDeletePreviewOpen(false);
|
|
2941
3238
|
setDeletePreview(null);
|
|
2942
3239
|
setDeletePreviewError(null);
|
|
2943
3240
|
clearBulkDeleteState();
|
|
2944
3241
|
}, [clearBulkDeleteState]);
|
|
2945
|
-
const handleOpenRowMenu =
|
|
3242
|
+
const handleOpenRowMenu = useCallback5((event, rowId) => {
|
|
2946
3243
|
setRowActionMenuAnchor(event.currentTarget);
|
|
2947
3244
|
setRowActionMenuId(rowId);
|
|
2948
3245
|
}, []);
|
|
2949
|
-
const handleCloseRowMenu =
|
|
3246
|
+
const handleCloseRowMenu = useCallback5(() => {
|
|
2950
3247
|
setRowActionMenuAnchor(null);
|
|
2951
3248
|
setRowActionMenuId(null);
|
|
2952
3249
|
}, []);
|
|
2953
|
-
const handleCloseBulkActionMenu =
|
|
3250
|
+
const handleCloseBulkActionMenu = useCallback5(() => {
|
|
2954
3251
|
setBulkActionMenuAnchor(null);
|
|
2955
3252
|
}, []);
|
|
2956
3253
|
return {
|
|
@@ -3061,29 +3358,29 @@ function extractFilterParams(params) {
|
|
|
3061
3358
|
}
|
|
3062
3359
|
|
|
3063
3360
|
// src/components/model-page/Skeletons.tsx
|
|
3064
|
-
import { Box as
|
|
3065
|
-
import { jsx as
|
|
3361
|
+
import { Box as Box9, Paper as Paper6, Skeleton as Skeleton3, Stack as Stack9 } from "@mui/material";
|
|
3362
|
+
import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3066
3363
|
function ModelPageSkeleton() {
|
|
3067
|
-
return /* @__PURE__ */
|
|
3068
|
-
/* @__PURE__ */
|
|
3069
|
-
/* @__PURE__ */
|
|
3070
|
-
/* @__PURE__ */
|
|
3071
|
-
/* @__PURE__ */
|
|
3072
|
-
/* @__PURE__ */
|
|
3073
|
-
/* @__PURE__ */
|
|
3364
|
+
return /* @__PURE__ */ jsxs12(Stack9, { spacing: 1.5, sx: { height: "100%", minHeight: 0 }, children: [
|
|
3365
|
+
/* @__PURE__ */ jsx19(MainHeaderSkeleton, { titleWidth: 240, subtitleWidth: "38%" }),
|
|
3366
|
+
/* @__PURE__ */ jsx19(Paper6, { sx: { p: 1.5, borderRadius: "10px", flexShrink: 0 }, children: /* @__PURE__ */ jsxs12(Stack9, { direction: { xs: "column", lg: "row" }, spacing: 1.5, alignItems: { lg: "center" }, children: [
|
|
3367
|
+
/* @__PURE__ */ jsx19(Skeleton3, { variant: "rounded", width: 360, height: 40 }),
|
|
3368
|
+
/* @__PURE__ */ jsx19(Skeleton3, { variant: "rounded", width: 128, height: 40 }),
|
|
3369
|
+
/* @__PURE__ */ jsx19(Box9, { sx: { flex: 1 } }),
|
|
3370
|
+
/* @__PURE__ */ jsx19(Skeleton3, { variant: "rounded", width: 110, height: 24 })
|
|
3074
3371
|
] }) }),
|
|
3075
|
-
/* @__PURE__ */
|
|
3372
|
+
/* @__PURE__ */ jsx19(Paper6, { sx: { borderRadius: "10px", flex: 1, minHeight: 0, overflow: "hidden" }, children: /* @__PURE__ */ jsx19(ModelTableSkeleton, {}) })
|
|
3076
3373
|
] });
|
|
3077
3374
|
}
|
|
3078
3375
|
function ModelTableSkeleton() {
|
|
3079
|
-
return /* @__PURE__ */
|
|
3080
|
-
/* @__PURE__ */
|
|
3081
|
-
Array.from({ length: 10 }).map((_, index) => /* @__PURE__ */
|
|
3376
|
+
return /* @__PURE__ */ jsx19(Box9, { sx: { height: "100%", overflow: "auto", p: 1.5 }, children: /* @__PURE__ */ jsxs12(Stack9, { spacing: 1, children: [
|
|
3377
|
+
/* @__PURE__ */ jsx19(Skeleton3, { variant: "rounded", width: "100%", height: 42 }),
|
|
3378
|
+
Array.from({ length: 10 }).map((_, index) => /* @__PURE__ */ jsx19(Skeleton3, { variant: "rounded", width: "100%", height: 48 }, index))
|
|
3082
3379
|
] }) });
|
|
3083
3380
|
}
|
|
3084
3381
|
|
|
3085
3382
|
// src/components/ModelPage.tsx
|
|
3086
|
-
import { jsx as
|
|
3383
|
+
import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3087
3384
|
var SEARCH_DEBOUNCE_MS = 300;
|
|
3088
3385
|
var CHECKBOX_COLUMN_WIDTH = 56;
|
|
3089
3386
|
var ACTIONS_COLUMN_WIDTH = 56;
|
|
@@ -3094,7 +3391,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3094
3391
|
const selectAllLabel = locale === "ru" ? "\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0441\u0435" : "Select All";
|
|
3095
3392
|
const resolvedRouter = useAdminRouter(router);
|
|
3096
3393
|
const location = useAdminLocation(resolvedRouter);
|
|
3097
|
-
const theme =
|
|
3394
|
+
const theme = useTheme3();
|
|
3098
3395
|
const isMobile = useMediaQuery2(theme.breakpoints.down("md"));
|
|
3099
3396
|
const controller = useModelPageController({
|
|
3100
3397
|
client,
|
|
@@ -3106,10 +3403,10 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3106
3403
|
});
|
|
3107
3404
|
useAdminDocumentTitle(t("admin_title"), (_b = (_a = controller.meta) == null ? void 0 : _a.title) != null ? _b : slug);
|
|
3108
3405
|
if (!controller.isLoading && controller.error && !controller.data) {
|
|
3109
|
-
return /* @__PURE__ */
|
|
3406
|
+
return /* @__PURE__ */ jsx20(Alert5, { severity: "error", children: controller.error });
|
|
3110
3407
|
}
|
|
3111
3408
|
if (!controller.data || !controller.meta) {
|
|
3112
|
-
return /* @__PURE__ */
|
|
3409
|
+
return /* @__PURE__ */ jsx20(ModelPageSkeleton, {});
|
|
3113
3410
|
}
|
|
3114
3411
|
const meta = controller.meta;
|
|
3115
3412
|
const beforePagination = renderBeforePagination == null ? void 0 : renderBeforePagination({
|
|
@@ -3128,12 +3425,12 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3128
3425
|
appliedFilters: controller.appliedFilters,
|
|
3129
3426
|
refresh: controller.refresh
|
|
3130
3427
|
});
|
|
3131
|
-
return /* @__PURE__ */
|
|
3132
|
-
/* @__PURE__ */
|
|
3428
|
+
return /* @__PURE__ */ jsx20(AdminRouterProvider, { router: resolvedRouter, children: /* @__PURE__ */ jsxs13(Stack10, { spacing: 1.5, sx: { height: "100%", minHeight: 0 }, children: [
|
|
3429
|
+
/* @__PURE__ */ jsx20(
|
|
3133
3430
|
MainHeader,
|
|
3134
3431
|
{
|
|
3135
3432
|
title: controller.meta.title,
|
|
3136
|
-
actions: /* @__PURE__ */
|
|
3433
|
+
actions: /* @__PURE__ */ jsx20(Tooltip, { title: t("create"), children: /* @__PURE__ */ jsx20(
|
|
3137
3434
|
IconButton3,
|
|
3138
3435
|
{
|
|
3139
3436
|
"aria-label": t("create"),
|
|
@@ -3148,31 +3445,31 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3148
3445
|
backgroundColor: "primary.dark"
|
|
3149
3446
|
}
|
|
3150
3447
|
},
|
|
3151
|
-
children: /* @__PURE__ */
|
|
3448
|
+
children: /* @__PURE__ */ jsx20(AddIcon, { fontSize: "small" })
|
|
3152
3449
|
}
|
|
3153
3450
|
) }),
|
|
3154
3451
|
subtitle: `${controller.meta.slug} | ${t("objects_count", { count: controller.total })}`,
|
|
3155
|
-
details: controller.meta.description ? /* @__PURE__ */
|
|
3452
|
+
details: controller.meta.description ? /* @__PURE__ */ jsx20(Typography6, { color: "text.secondary", sx: { fontSize: 14, lineHeight: 1.45 }, children: controller.meta.description }) : void 0
|
|
3156
3453
|
}
|
|
3157
3454
|
),
|
|
3158
|
-
/* @__PURE__ */
|
|
3159
|
-
|
|
3455
|
+
/* @__PURE__ */ jsx20(
|
|
3456
|
+
Paper7,
|
|
3160
3457
|
{
|
|
3161
3458
|
sx: {
|
|
3162
3459
|
p: 1.5,
|
|
3163
3460
|
borderRadius: "10px",
|
|
3164
3461
|
flexShrink: 0
|
|
3165
3462
|
},
|
|
3166
|
-
children: /* @__PURE__ */
|
|
3167
|
-
/* @__PURE__ */
|
|
3168
|
-
|
|
3463
|
+
children: /* @__PURE__ */ jsxs13(Stack10, { direction: { xs: "column", lg: "row" }, spacing: 1.5, alignItems: { lg: "center" }, children: [
|
|
3464
|
+
/* @__PURE__ */ jsxs13(
|
|
3465
|
+
Stack10,
|
|
3169
3466
|
{
|
|
3170
3467
|
direction: { xs: "column", xl: "row" },
|
|
3171
3468
|
spacing: 1.5,
|
|
3172
3469
|
alignItems: { xl: "center" },
|
|
3173
3470
|
sx: { flex: 1, minWidth: 0 },
|
|
3174
3471
|
children: [
|
|
3175
|
-
/* @__PURE__ */
|
|
3472
|
+
/* @__PURE__ */ jsx20(
|
|
3176
3473
|
SearchField,
|
|
3177
3474
|
{
|
|
3178
3475
|
value: controller.appliedQuery,
|
|
@@ -3181,17 +3478,17 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3181
3478
|
placeholder: t("search")
|
|
3182
3479
|
}
|
|
3183
3480
|
),
|
|
3184
|
-
controller.hasSelection ? /* @__PURE__ */
|
|
3185
|
-
/* @__PURE__ */
|
|
3481
|
+
controller.hasSelection ? /* @__PURE__ */ jsxs13(Stack10, { direction: "row", spacing: 1, alignItems: "center", sx: { minWidth: 0, flexWrap: "wrap" }, children: [
|
|
3482
|
+
/* @__PURE__ */ jsx20(
|
|
3186
3483
|
Button4,
|
|
3187
3484
|
{
|
|
3188
3485
|
variant: "outlined",
|
|
3189
|
-
endIcon: /* @__PURE__ */
|
|
3486
|
+
endIcon: /* @__PURE__ */ jsx20(ExpandMoreIcon4, {}),
|
|
3190
3487
|
onClick: (event) => controller.setBulkActionMenuAnchor(event.currentTarget),
|
|
3191
3488
|
children: t("actions")
|
|
3192
3489
|
}
|
|
3193
3490
|
),
|
|
3194
|
-
!controller.isAllMatchingSelected && controller.selectionCount < controller.total ? /* @__PURE__ */
|
|
3491
|
+
!controller.isAllMatchingSelected && controller.selectionCount < controller.total ? /* @__PURE__ */ jsx20(
|
|
3195
3492
|
Button4,
|
|
3196
3493
|
{
|
|
3197
3494
|
variant: "text",
|
|
@@ -3200,7 +3497,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3200
3497
|
children: selectAllLabel
|
|
3201
3498
|
}
|
|
3202
3499
|
) : null,
|
|
3203
|
-
/* @__PURE__ */
|
|
3500
|
+
/* @__PURE__ */ jsxs13(Typography6, { color: "text.secondary", sx: { alignSelf: "center", whiteSpace: "nowrap" }, children: [
|
|
3204
3501
|
t("selected_count", { count: controller.selectionCount }),
|
|
3205
3502
|
" / ",
|
|
3206
3503
|
controller.total
|
|
@@ -3209,28 +3506,28 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3209
3506
|
]
|
|
3210
3507
|
}
|
|
3211
3508
|
),
|
|
3212
|
-
/* @__PURE__ */
|
|
3213
|
-
beforePagination ? /* @__PURE__ */
|
|
3214
|
-
isMobile && controller.hasListFilters ? /* @__PURE__ */
|
|
3509
|
+
/* @__PURE__ */ jsxs13(Stack10, { direction: "row", spacing: 1, alignItems: "center", sx: { marginLeft: "auto" }, children: [
|
|
3510
|
+
beforePagination ? /* @__PURE__ */ jsx20(Box10, { sx: { display: "flex", alignItems: "center", flexShrink: 0 }, children: beforePagination }) : null,
|
|
3511
|
+
isMobile && controller.hasListFilters ? /* @__PURE__ */ jsx20(Tooltip, { title: t("filters"), children: /* @__PURE__ */ jsx20(
|
|
3215
3512
|
IconButton3,
|
|
3216
3513
|
{
|
|
3217
3514
|
size: "small",
|
|
3218
3515
|
"aria-label": t("filters"),
|
|
3219
3516
|
onClick: () => controller.setFiltersOpen(true),
|
|
3220
|
-
children: /* @__PURE__ */
|
|
3517
|
+
children: /* @__PURE__ */ jsx20(FilterListIcon, { fontSize: "small" })
|
|
3221
3518
|
}
|
|
3222
3519
|
) }) : null,
|
|
3223
|
-
/* @__PURE__ */
|
|
3520
|
+
/* @__PURE__ */ jsx20(
|
|
3224
3521
|
IconButton3,
|
|
3225
3522
|
{
|
|
3226
3523
|
size: "small",
|
|
3227
3524
|
onClick: () => controller.handlePageChange(controller.currentPage - 1),
|
|
3228
3525
|
disabled: controller.currentPage <= 1,
|
|
3229
3526
|
sx: { mr: "-5px" },
|
|
3230
|
-
children: /* @__PURE__ */
|
|
3527
|
+
children: /* @__PURE__ */ jsx20(ChevronLeftIcon, { fontSize: "small" })
|
|
3231
3528
|
}
|
|
3232
3529
|
),
|
|
3233
|
-
/* @__PURE__ */
|
|
3530
|
+
/* @__PURE__ */ jsx20(
|
|
3234
3531
|
InputBase,
|
|
3235
3532
|
{
|
|
3236
3533
|
value: controller.pageInput,
|
|
@@ -3260,8 +3557,8 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3260
3557
|
}
|
|
3261
3558
|
}
|
|
3262
3559
|
),
|
|
3263
|
-
/* @__PURE__ */
|
|
3264
|
-
|
|
3560
|
+
/* @__PURE__ */ jsxs13(
|
|
3561
|
+
Typography6,
|
|
3265
3562
|
{
|
|
3266
3563
|
color: "text.secondary",
|
|
3267
3564
|
sx: { minWidth: "auto", fontSize: "1rem", lineHeight: "1rem" },
|
|
@@ -3271,23 +3568,23 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3271
3568
|
]
|
|
3272
3569
|
}
|
|
3273
3570
|
),
|
|
3274
|
-
/* @__PURE__ */
|
|
3571
|
+
/* @__PURE__ */ jsx20(
|
|
3275
3572
|
IconButton3,
|
|
3276
3573
|
{
|
|
3277
3574
|
size: "small",
|
|
3278
3575
|
onClick: () => controller.handlePageChange(controller.currentPage + 1),
|
|
3279
3576
|
disabled: controller.currentPage >= controller.totalPages,
|
|
3280
3577
|
sx: { ml: "-5px" },
|
|
3281
|
-
children: /* @__PURE__ */
|
|
3578
|
+
children: /* @__PURE__ */ jsx20(ChevronRightIcon, { fontSize: "small" })
|
|
3282
3579
|
}
|
|
3283
3580
|
)
|
|
3284
3581
|
] })
|
|
3285
3582
|
] })
|
|
3286
3583
|
}
|
|
3287
3584
|
),
|
|
3288
|
-
/* @__PURE__ */
|
|
3289
|
-
/* @__PURE__ */
|
|
3290
|
-
|
|
3585
|
+
/* @__PURE__ */ jsxs13(Stack10, { direction: { xs: "column", lg: "row" }, spacing: 1.5, sx: { flex: 1, minHeight: 0 }, children: [
|
|
3586
|
+
/* @__PURE__ */ jsx20(
|
|
3587
|
+
Paper7,
|
|
3291
3588
|
{
|
|
3292
3589
|
sx: {
|
|
3293
3590
|
borderRadius: "10px",
|
|
@@ -3296,9 +3593,9 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3296
3593
|
minHeight: 0,
|
|
3297
3594
|
overflow: "hidden"
|
|
3298
3595
|
},
|
|
3299
|
-
children: controller.isLoading ? /* @__PURE__ */
|
|
3300
|
-
/* @__PURE__ */
|
|
3301
|
-
/* @__PURE__ */
|
|
3596
|
+
children: controller.isLoading ? /* @__PURE__ */ jsx20(ModelTableSkeleton, {}) : /* @__PURE__ */ jsx20(Box10, { sx: { height: "100%", overflow: "auto" }, children: /* @__PURE__ */ jsxs13(Table, { stickyHeader: true, size: "small", sx: { tableLayout: "fixed" }, children: [
|
|
3597
|
+
/* @__PURE__ */ jsx20(TableHead, { children: /* @__PURE__ */ jsxs13(TableRow2, { children: [
|
|
3598
|
+
/* @__PURE__ */ jsx20(
|
|
3302
3599
|
TableCell2,
|
|
3303
3600
|
{
|
|
3304
3601
|
padding: "none",
|
|
@@ -3311,7 +3608,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3311
3608
|
textAlign: "center",
|
|
3312
3609
|
px: 1
|
|
3313
3610
|
},
|
|
3314
|
-
children: /* @__PURE__ */
|
|
3611
|
+
children: /* @__PURE__ */ jsx20(
|
|
3315
3612
|
Checkbox2,
|
|
3316
3613
|
{
|
|
3317
3614
|
checked: controller.allVisibleSelected,
|
|
@@ -3326,7 +3623,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3326
3623
|
const field = controller.fieldMap.get(fieldName);
|
|
3327
3624
|
const sortDirection = resolveSortDirection(controller.sortFields, fieldName);
|
|
3328
3625
|
const isSortable = resolveFieldSortable(field);
|
|
3329
|
-
return /* @__PURE__ */
|
|
3626
|
+
return /* @__PURE__ */ jsx20(
|
|
3330
3627
|
TableCell2,
|
|
3331
3628
|
{
|
|
3332
3629
|
sortDirection: sortDirection != null ? sortDirection : false,
|
|
@@ -3339,7 +3636,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3339
3636
|
maxWidth: getListFieldWidthPx(field)
|
|
3340
3637
|
},
|
|
3341
3638
|
onClick: isSortable ? () => controller.toggleSort(fieldName) : void 0,
|
|
3342
|
-
children: isSortable ? /* @__PURE__ */
|
|
3639
|
+
children: isSortable ? /* @__PURE__ */ jsx20(
|
|
3343
3640
|
TableSortLabel,
|
|
3344
3641
|
{
|
|
3345
3642
|
active: Boolean(sortDirection),
|
|
@@ -3353,7 +3650,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3353
3650
|
},
|
|
3354
3651
|
children: (_a2 = field == null ? void 0 : field.label) != null ? _a2 : fieldName
|
|
3355
3652
|
}
|
|
3356
|
-
) : /* @__PURE__ */
|
|
3653
|
+
) : /* @__PURE__ */ jsx20(Typography6, { component: "span", sx: {
|
|
3357
3654
|
fontSize: 14,
|
|
3358
3655
|
fontWeight: 700,
|
|
3359
3656
|
color: "rgba(255, 255, 255, 0.96)"
|
|
@@ -3362,7 +3659,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3362
3659
|
fieldName
|
|
3363
3660
|
);
|
|
3364
3661
|
}),
|
|
3365
|
-
/* @__PURE__ */
|
|
3662
|
+
/* @__PURE__ */ jsx20(
|
|
3366
3663
|
TableCell2,
|
|
3367
3664
|
{
|
|
3368
3665
|
align: "right",
|
|
@@ -3375,9 +3672,9 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3375
3672
|
}
|
|
3376
3673
|
)
|
|
3377
3674
|
] }) }),
|
|
3378
|
-
/* @__PURE__ */
|
|
3675
|
+
/* @__PURE__ */ jsx20(TableBody, { children: controller.rows.map((row) => {
|
|
3379
3676
|
const rowId = row[meta.pk_field];
|
|
3380
|
-
return /* @__PURE__ */
|
|
3677
|
+
return /* @__PURE__ */ jsx20(
|
|
3381
3678
|
ListRow,
|
|
3382
3679
|
{
|
|
3383
3680
|
row,
|
|
@@ -3397,7 +3694,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3397
3694
|
] }) })
|
|
3398
3695
|
}
|
|
3399
3696
|
),
|
|
3400
|
-
!isMobile && controller.hasListFilters ? /* @__PURE__ */
|
|
3697
|
+
!isMobile && controller.hasListFilters ? /* @__PURE__ */ jsx20(
|
|
3401
3698
|
ListFiltersSidebar,
|
|
3402
3699
|
{
|
|
3403
3700
|
client,
|
|
@@ -3410,13 +3707,13 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3410
3707
|
}
|
|
3411
3708
|
) : null
|
|
3412
3709
|
] }),
|
|
3413
|
-
/* @__PURE__ */
|
|
3710
|
+
/* @__PURE__ */ jsx20(
|
|
3414
3711
|
Menu,
|
|
3415
3712
|
{
|
|
3416
3713
|
anchorEl: controller.bulkActionMenuAnchor,
|
|
3417
3714
|
open: Boolean(controller.bulkActionMenuAnchor),
|
|
3418
3715
|
onClose: controller.handleCloseBulkActionMenu,
|
|
3419
|
-
children: controller.bulkActions.map((action) => /* @__PURE__ */
|
|
3716
|
+
children: controller.bulkActions.map((action) => /* @__PURE__ */ jsx20(
|
|
3420
3717
|
MenuItem2,
|
|
3421
3718
|
{
|
|
3422
3719
|
onClick: () => void controller.handleRunNamedBulkAction(action.slug),
|
|
@@ -3426,13 +3723,13 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3426
3723
|
))
|
|
3427
3724
|
}
|
|
3428
3725
|
),
|
|
3429
|
-
/* @__PURE__ */
|
|
3726
|
+
/* @__PURE__ */ jsx20(
|
|
3430
3727
|
Menu,
|
|
3431
3728
|
{
|
|
3432
3729
|
anchorEl: controller.rowActionMenuAnchor,
|
|
3433
3730
|
open: Boolean(controller.rowActionMenuAnchor),
|
|
3434
3731
|
onClose: controller.handleCloseRowMenu,
|
|
3435
|
-
children: /* @__PURE__ */
|
|
3732
|
+
children: /* @__PURE__ */ jsx20(
|
|
3436
3733
|
MenuItem2,
|
|
3437
3734
|
{
|
|
3438
3735
|
onClick: () => {
|
|
@@ -3445,7 +3742,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3445
3742
|
)
|
|
3446
3743
|
}
|
|
3447
3744
|
),
|
|
3448
|
-
/* @__PURE__ */
|
|
3745
|
+
/* @__PURE__ */ jsx20(
|
|
3449
3746
|
FormDialog,
|
|
3450
3747
|
{
|
|
3451
3748
|
open: controller.createOpen,
|
|
@@ -3458,7 +3755,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3458
3755
|
client
|
|
3459
3756
|
}
|
|
3460
3757
|
),
|
|
3461
|
-
/* @__PURE__ */
|
|
3758
|
+
/* @__PURE__ */ jsxs13(
|
|
3462
3759
|
Dialog3,
|
|
3463
3760
|
{
|
|
3464
3761
|
open: controller.filtersOpen,
|
|
@@ -3479,8 +3776,8 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3479
3776
|
}
|
|
3480
3777
|
},
|
|
3481
3778
|
children: [
|
|
3482
|
-
/* @__PURE__ */
|
|
3483
|
-
/* @__PURE__ */
|
|
3779
|
+
/* @__PURE__ */ jsx20(DialogTitle3, { children: t("filters") }),
|
|
3780
|
+
/* @__PURE__ */ jsx20(DialogContent3, { sx: { px: 2, pb: 2 }, children: controller.hasListFilters ? /* @__PURE__ */ jsx20(
|
|
3484
3781
|
ListFiltersSidebar,
|
|
3485
3782
|
{
|
|
3486
3783
|
client,
|
|
@@ -3495,7 +3792,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3495
3792
|
]
|
|
3496
3793
|
}
|
|
3497
3794
|
),
|
|
3498
|
-
/* @__PURE__ */
|
|
3795
|
+
/* @__PURE__ */ jsx20(
|
|
3499
3796
|
DeletePreviewDialog,
|
|
3500
3797
|
{
|
|
3501
3798
|
open: controller.deletePreviewOpen,
|
|
@@ -3530,16 +3827,16 @@ function resolveFieldSortable(field) {
|
|
|
3530
3827
|
// src/components/ObjectPage.tsx
|
|
3531
3828
|
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
|
|
3532
3829
|
import MoreVertIcon2 from "@mui/icons-material/MoreVert";
|
|
3533
|
-
import { Alert as Alert6, Box as
|
|
3830
|
+
import { Alert as Alert6, Box as Box13, Button as Button5, IconButton as IconButton4, Menu as Menu2, MenuItem as MenuItem3, Paper as Paper9, Stack as Stack13, Typography as Typography7, useMediaQuery as useMediaQuery3 } from "@mui/material";
|
|
3534
3831
|
import { LocalizationProvider as LocalizationProvider2 } from "@mui/x-date-pickers";
|
|
3535
3832
|
import { AdapterDayjs as AdapterDayjs2 } from "@mui/x-date-pickers/AdapterDayjs";
|
|
3536
|
-
import { useTheme as
|
|
3833
|
+
import { useTheme as useTheme4 } from "@mui/material/styles";
|
|
3537
3834
|
import "dayjs/locale/en.js";
|
|
3538
3835
|
import "dayjs/locale/ru.js";
|
|
3539
3836
|
|
|
3540
3837
|
// src/components/object-page/ObjectField.tsx
|
|
3541
|
-
import { memo as memo6, useCallback as
|
|
3542
|
-
import { jsx as
|
|
3838
|
+
import { memo as memo6, useCallback as useCallback6 } from "react";
|
|
3839
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
3543
3840
|
var ObjectField = memo6(function ObjectField2({
|
|
3544
3841
|
field,
|
|
3545
3842
|
value,
|
|
@@ -3547,10 +3844,10 @@ var ObjectField = memo6(function ObjectField2({
|
|
|
3547
3844
|
client,
|
|
3548
3845
|
onFieldChange
|
|
3549
3846
|
}) {
|
|
3550
|
-
const handleChange =
|
|
3847
|
+
const handleChange = useCallback6((nextValue) => {
|
|
3551
3848
|
onFieldChange(field.name, nextValue);
|
|
3552
3849
|
}, [field.name, onFieldChange]);
|
|
3553
|
-
return /* @__PURE__ */
|
|
3850
|
+
return /* @__PURE__ */ jsx21(
|
|
3554
3851
|
FieldEditor,
|
|
3555
3852
|
{
|
|
3556
3853
|
field,
|
|
@@ -3563,21 +3860,21 @@ var ObjectField = memo6(function ObjectField2({
|
|
|
3563
3860
|
});
|
|
3564
3861
|
|
|
3565
3862
|
// src/components/object-page/ObjectPageSkeleton.tsx
|
|
3566
|
-
import { Box as
|
|
3567
|
-
import { jsx as
|
|
3863
|
+
import { Box as Box11, Paper as Paper8, Skeleton as Skeleton4, Stack as Stack11 } from "@mui/material";
|
|
3864
|
+
import { jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3568
3865
|
function ObjectPageSkeleton() {
|
|
3569
|
-
return /* @__PURE__ */
|
|
3570
|
-
/* @__PURE__ */
|
|
3571
|
-
/* @__PURE__ */
|
|
3572
|
-
|
|
3866
|
+
return /* @__PURE__ */ jsxs14(Stack11, { spacing: 1.5, sx: { height: "100%", minHeight: 0 }, children: [
|
|
3867
|
+
/* @__PURE__ */ jsx22(MainHeaderSkeleton, { titleWidth: 420, subtitleWidth: "32%" }),
|
|
3868
|
+
/* @__PURE__ */ jsxs14(
|
|
3869
|
+
Stack11,
|
|
3573
3870
|
{
|
|
3574
3871
|
direction: { xs: "column", lg: "row" },
|
|
3575
3872
|
spacing: 1.5,
|
|
3576
3873
|
sx: { flex: 1, minHeight: 0, alignItems: "stretch" },
|
|
3577
3874
|
children: [
|
|
3578
|
-
/* @__PURE__ */
|
|
3579
|
-
/* @__PURE__ */
|
|
3580
|
-
|
|
3875
|
+
/* @__PURE__ */ jsx22(Paper8, { sx: { borderRadius: "10px", flex: 1, minHeight: 0, overflow: "hidden" }, children: /* @__PURE__ */ jsx22(Box11, { sx: { height: "100%", overflow: "auto", p: 2.5 }, children: /* @__PURE__ */ jsx22(Stack11, { spacing: 1.5, children: Array.from({ length: 9 }).map((_, index) => /* @__PURE__ */ jsx22(Skeleton4, { variant: "rounded", width: "100%", height: 56 }, index)) }) }) }),
|
|
3876
|
+
/* @__PURE__ */ jsx22(
|
|
3877
|
+
Paper8,
|
|
3581
3878
|
{
|
|
3582
3879
|
sx: {
|
|
3583
3880
|
width: { xs: "100%", lg: 280 },
|
|
@@ -3586,10 +3883,10 @@ function ObjectPageSkeleton() {
|
|
|
3586
3883
|
p: 1.5,
|
|
3587
3884
|
alignSelf: "flex-start"
|
|
3588
3885
|
},
|
|
3589
|
-
children: /* @__PURE__ */
|
|
3590
|
-
/* @__PURE__ */
|
|
3591
|
-
/* @__PURE__ */
|
|
3592
|
-
/* @__PURE__ */
|
|
3886
|
+
children: /* @__PURE__ */ jsxs14(Stack11, { spacing: 1, children: [
|
|
3887
|
+
/* @__PURE__ */ jsx22(Skeleton4, { variant: "text", width: 90, height: 28 }),
|
|
3888
|
+
/* @__PURE__ */ jsx22(Skeleton4, { variant: "rounded", width: "100%", height: 40 }),
|
|
3889
|
+
/* @__PURE__ */ jsx22(Skeleton4, { variant: "rounded", width: "100%", height: 40 })
|
|
3593
3890
|
] })
|
|
3594
3891
|
}
|
|
3595
3892
|
)
|
|
@@ -3601,8 +3898,8 @@ function ObjectPageSkeleton() {
|
|
|
3601
3898
|
|
|
3602
3899
|
// src/components/object-page/ReadonlyObjectField.tsx
|
|
3603
3900
|
import { memo as memo7 } from "react";
|
|
3604
|
-
import { Box as
|
|
3605
|
-
import { jsx as
|
|
3901
|
+
import { Box as Box12, Stack as Stack12, TextField as TextField4 } from "@mui/material";
|
|
3902
|
+
import { jsx as jsx23, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3606
3903
|
var ReadonlyObjectField = memo7(function ReadonlyObjectField2({
|
|
3607
3904
|
field,
|
|
3608
3905
|
value,
|
|
@@ -3610,9 +3907,9 @@ var ReadonlyObjectField = memo7(function ReadonlyObjectField2({
|
|
|
3610
3907
|
}) {
|
|
3611
3908
|
var _a;
|
|
3612
3909
|
const isMultiline = field.input_kind === "textarea" || field.input_kind === "json" || field.type.toLowerCase().includes("text") || value.includes("\n") || value.length > 120;
|
|
3613
|
-
return /* @__PURE__ */
|
|
3614
|
-
imageUrl ? /* @__PURE__ */
|
|
3615
|
-
|
|
3910
|
+
return /* @__PURE__ */ jsxs15(Stack12, { spacing: 1, children: [
|
|
3911
|
+
imageUrl ? /* @__PURE__ */ jsx23(
|
|
3912
|
+
Box12,
|
|
3616
3913
|
{
|
|
3617
3914
|
component: "img",
|
|
3618
3915
|
src: imageUrl,
|
|
@@ -3628,7 +3925,7 @@ var ReadonlyObjectField = memo7(function ReadonlyObjectField2({
|
|
|
3628
3925
|
}
|
|
3629
3926
|
}
|
|
3630
3927
|
) : null,
|
|
3631
|
-
/* @__PURE__ */
|
|
3928
|
+
/* @__PURE__ */ jsx23(
|
|
3632
3929
|
TextField4,
|
|
3633
3930
|
{
|
|
3634
3931
|
label: field.label,
|
|
@@ -3645,7 +3942,7 @@ var ReadonlyObjectField = memo7(function ReadonlyObjectField2({
|
|
|
3645
3942
|
});
|
|
3646
3943
|
|
|
3647
3944
|
// src/components/object-page/useObjectPageController.ts
|
|
3648
|
-
import { useCallback as
|
|
3945
|
+
import { useCallback as useCallback7, useEffect as useEffect11, useMemo as useMemo10, useState as useState11 } from "react";
|
|
3649
3946
|
|
|
3650
3947
|
// src/utils/isDeepEqual.ts
|
|
3651
3948
|
function isDeepEqual(left, right) {
|
|
@@ -3685,30 +3982,31 @@ function useObjectPageController({
|
|
|
3685
3982
|
t
|
|
3686
3983
|
}) {
|
|
3687
3984
|
var _a, _b, _c;
|
|
3985
|
+
const message = useAdminMessage();
|
|
3688
3986
|
const cacheKey = buildDetailCacheKey(slug, id);
|
|
3689
|
-
const [data, setData] =
|
|
3987
|
+
const [data, setData] = useState11(() => {
|
|
3690
3988
|
var _a2;
|
|
3691
3989
|
return (_a2 = getClientCacheBucket(client).detailResponseCache.get(cacheKey)) != null ? _a2 : null;
|
|
3692
3990
|
});
|
|
3693
|
-
const [values, setValues] =
|
|
3991
|
+
const [values, setValues] = useState11(() => {
|
|
3694
3992
|
var _a2, _b2;
|
|
3695
3993
|
return (_b2 = (_a2 = getClientCacheBucket(client).detailResponseCache.get(cacheKey)) == null ? void 0 : _a2.item) != null ? _b2 : {};
|
|
3696
3994
|
});
|
|
3697
|
-
const [initialValues, setInitialValues] =
|
|
3995
|
+
const [initialValues, setInitialValues] = useState11(() => {
|
|
3698
3996
|
var _a2, _b2;
|
|
3699
3997
|
return (_b2 = (_a2 = getClientCacheBucket(client).detailResponseCache.get(cacheKey)) == null ? void 0 : _a2.item) != null ? _b2 : {};
|
|
3700
3998
|
});
|
|
3701
|
-
const [error, setError] =
|
|
3702
|
-
const [isLoading, setIsLoading] =
|
|
3703
|
-
const [isSaving, setIsSaving] =
|
|
3704
|
-
const [isDeleting, setIsDeleting] =
|
|
3705
|
-
const [activeActionSlug, setActiveActionSlug] =
|
|
3706
|
-
const [deleteConfirmOpen, setDeleteConfirmOpen] =
|
|
3707
|
-
const [deletePreview, setDeletePreview] =
|
|
3708
|
-
const [isDeletePreviewLoading, setIsDeletePreviewLoading] =
|
|
3709
|
-
const [deletePreviewError, setDeletePreviewError] =
|
|
3710
|
-
const [actionsAnchorEl, setActionsAnchorEl] =
|
|
3711
|
-
|
|
3999
|
+
const [error, setError] = useState11(null);
|
|
4000
|
+
const [isLoading, setIsLoading] = useState11(data === null);
|
|
4001
|
+
const [isSaving, setIsSaving] = useState11(false);
|
|
4002
|
+
const [isDeleting, setIsDeleting] = useState11(false);
|
|
4003
|
+
const [activeActionSlug, setActiveActionSlug] = useState11(null);
|
|
4004
|
+
const [deleteConfirmOpen, setDeleteConfirmOpen] = useState11(false);
|
|
4005
|
+
const [deletePreview, setDeletePreview] = useState11(null);
|
|
4006
|
+
const [isDeletePreviewLoading, setIsDeletePreviewLoading] = useState11(false);
|
|
4007
|
+
const [deletePreviewError, setDeletePreviewError] = useState11(null);
|
|
4008
|
+
const [actionsAnchorEl, setActionsAnchorEl] = useState11(null);
|
|
4009
|
+
useEffect11(() => {
|
|
3712
4010
|
var _a2;
|
|
3713
4011
|
let isMounted = true;
|
|
3714
4012
|
const bucket = getClientCacheBucket(client);
|
|
@@ -3752,25 +4050,25 @@ function useObjectPageController({
|
|
|
3752
4050
|
const meta = (_a = data == null ? void 0 : data.meta) != null ? _a : null;
|
|
3753
4051
|
const detailFields = (_b = meta == null ? void 0 : meta.detail_fields) != null ? _b : [];
|
|
3754
4052
|
const objectActions = (_c = meta == null ? void 0 : meta.object_actions) != null ? _c : [];
|
|
3755
|
-
const fieldMap =
|
|
4053
|
+
const fieldMap = useMemo10(
|
|
3756
4054
|
() => {
|
|
3757
4055
|
var _a2;
|
|
3758
4056
|
return new Map(((_a2 = meta == null ? void 0 : meta.fields) != null ? _a2 : []).map((field) => [field.name, field]));
|
|
3759
4057
|
},
|
|
3760
4058
|
[meta == null ? void 0 : meta.fields]
|
|
3761
4059
|
);
|
|
3762
|
-
const editableFields =
|
|
4060
|
+
const editableFields = useMemo10(
|
|
3763
4061
|
() => {
|
|
3764
4062
|
var _a2;
|
|
3765
4063
|
return ((_a2 = meta == null ? void 0 : meta.fields) != null ? _a2 : []).filter((field) => meta == null ? void 0 : meta.update_fields.includes(field.name));
|
|
3766
4064
|
},
|
|
3767
4065
|
[meta == null ? void 0 : meta.fields, meta == null ? void 0 : meta.update_fields]
|
|
3768
4066
|
);
|
|
3769
|
-
const editableFieldNames =
|
|
4067
|
+
const editableFieldNames = useMemo10(
|
|
3770
4068
|
() => new Set(editableFields.map((field) => field.name)),
|
|
3771
4069
|
[editableFields]
|
|
3772
4070
|
);
|
|
3773
|
-
const objectTitle =
|
|
4071
|
+
const objectTitle = useMemo10(
|
|
3774
4072
|
() => {
|
|
3775
4073
|
var _a2;
|
|
3776
4074
|
return String((_a2 = data == null ? void 0 : data.item._display) != null ? _a2 : meta ? `${meta.title} #${id}` : id);
|
|
@@ -3778,19 +4076,19 @@ function useObjectPageController({
|
|
|
3778
4076
|
[data, id, meta]
|
|
3779
4077
|
);
|
|
3780
4078
|
const isActionsMenuOpen = actionsAnchorEl !== null;
|
|
3781
|
-
const currentPayload =
|
|
4079
|
+
const currentPayload = useMemo10(
|
|
3782
4080
|
() => buildAdminPayload(values, editableFields),
|
|
3783
4081
|
[editableFields, values]
|
|
3784
4082
|
);
|
|
3785
|
-
const initialPayload =
|
|
4083
|
+
const initialPayload = useMemo10(
|
|
3786
4084
|
() => buildAdminPayload(initialValues, editableFields),
|
|
3787
4085
|
[editableFields, initialValues]
|
|
3788
4086
|
);
|
|
3789
|
-
const isDirty =
|
|
4087
|
+
const isDirty = useMemo10(
|
|
3790
4088
|
() => !isDeepEqual(currentPayload, initialPayload),
|
|
3791
4089
|
[currentPayload, initialPayload]
|
|
3792
4090
|
);
|
|
3793
|
-
const handleFieldChange =
|
|
4091
|
+
const handleFieldChange = useCallback7((fieldName, nextValue) => {
|
|
3794
4092
|
setValues((current) => {
|
|
3795
4093
|
if (Object.is(current[fieldName], nextValue)) {
|
|
3796
4094
|
return current;
|
|
@@ -3798,7 +4096,7 @@ function useObjectPageController({
|
|
|
3798
4096
|
return { ...current, [fieldName]: nextValue };
|
|
3799
4097
|
});
|
|
3800
4098
|
}, []);
|
|
3801
|
-
const handleSave =
|
|
4099
|
+
const handleSave = useCallback7(async () => {
|
|
3802
4100
|
if (!meta || !isDirty) {
|
|
3803
4101
|
return;
|
|
3804
4102
|
}
|
|
@@ -3812,29 +4110,36 @@ function useObjectPageController({
|
|
|
3812
4110
|
setData(nextDetail);
|
|
3813
4111
|
setValues(response.item);
|
|
3814
4112
|
setInitialValues(response.item);
|
|
4113
|
+
message.success(t("object_saved_success"));
|
|
3815
4114
|
} catch (reason) {
|
|
3816
|
-
|
|
4115
|
+
const nextError = reason instanceof Error ? reason.message : t("object_save_error");
|
|
4116
|
+
setError(nextError);
|
|
4117
|
+
message.error(nextError);
|
|
3817
4118
|
} finally {
|
|
3818
4119
|
setIsSaving(false);
|
|
3819
4120
|
}
|
|
3820
|
-
}, [cacheKey, client, currentPayload, id, isDirty, meta, slug, t]);
|
|
3821
|
-
const handleDelete =
|
|
4121
|
+
}, [cacheKey, client, currentPayload, id, isDirty, message, meta, slug, t]);
|
|
4122
|
+
const handleDelete = useCallback7(async () => {
|
|
3822
4123
|
setIsDeleting(true);
|
|
3823
4124
|
setError(null);
|
|
3824
4125
|
try {
|
|
3825
4126
|
await client.deleteItem(slug, id);
|
|
3826
4127
|
invalidateModelCache(client, slug);
|
|
4128
|
+
message.success(t("object_deleted_success"));
|
|
3827
4129
|
router.push(listPath);
|
|
3828
4130
|
} catch (reason) {
|
|
3829
|
-
|
|
4131
|
+
const nextError = reason instanceof Error ? reason.message : t("object_delete_error");
|
|
4132
|
+
setError(nextError);
|
|
4133
|
+
message.error(nextError);
|
|
3830
4134
|
setIsDeleting(false);
|
|
3831
4135
|
setDeleteConfirmOpen(false);
|
|
3832
4136
|
}
|
|
3833
|
-
}, [client, id, listPath, router, slug, t]);
|
|
3834
|
-
const handleNavigateBack =
|
|
4137
|
+
}, [client, id, listPath, message, router, slug, t]);
|
|
4138
|
+
const handleNavigateBack = useCallback7(() => {
|
|
3835
4139
|
router.push(listPath);
|
|
3836
4140
|
}, [listPath, router]);
|
|
3837
|
-
const handleRunObjectAction =
|
|
4141
|
+
const handleRunObjectAction = useCallback7(async (actionSlug) => {
|
|
4142
|
+
var _a2, _b2;
|
|
3838
4143
|
setActiveActionSlug(actionSlug);
|
|
3839
4144
|
setError(null);
|
|
3840
4145
|
try {
|
|
@@ -3847,13 +4152,17 @@ function useObjectPageController({
|
|
|
3847
4152
|
setData(nextDetail);
|
|
3848
4153
|
setValues(response.item);
|
|
3849
4154
|
setInitialValues(response.item);
|
|
4155
|
+
const actionLabel = (_b2 = (_a2 = objectActions.find((item) => item.slug === actionSlug)) == null ? void 0 : _a2.label) != null ? _b2 : actionSlug;
|
|
4156
|
+
message.success(t("action_success", { action: actionLabel, count: 1 }));
|
|
3850
4157
|
} catch (reason) {
|
|
3851
|
-
|
|
4158
|
+
const nextError = reason instanceof Error ? reason.message : t("object_action_error");
|
|
4159
|
+
setError(nextError);
|
|
4160
|
+
message.error(nextError);
|
|
3852
4161
|
} finally {
|
|
3853
4162
|
setActiveActionSlug(null);
|
|
3854
4163
|
}
|
|
3855
|
-
}, [cacheKey, client, data, id, slug, t]);
|
|
3856
|
-
const handleOpenDeletePreview =
|
|
4164
|
+
}, [cacheKey, client, data, id, message, objectActions, slug, t]);
|
|
4165
|
+
const handleOpenDeletePreview = useCallback7(async () => {
|
|
3857
4166
|
setActionsAnchorEl(null);
|
|
3858
4167
|
setDeleteConfirmOpen(true);
|
|
3859
4168
|
setDeletePreview(null);
|
|
@@ -3904,7 +4213,7 @@ function useObjectPageController({
|
|
|
3904
4213
|
}
|
|
3905
4214
|
|
|
3906
4215
|
// src/components/ObjectPage.tsx
|
|
3907
|
-
import { jsx as
|
|
4216
|
+
import { jsx as jsx24, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3908
4217
|
function ObjectPage({ client, slug, id, router }) {
|
|
3909
4218
|
var _a, _b;
|
|
3910
4219
|
const locale = useAdminLocale();
|
|
@@ -3912,7 +4221,7 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
3912
4221
|
const resolvedRouter = useAdminRouter(router);
|
|
3913
4222
|
const location = useAdminLocation(resolvedRouter);
|
|
3914
4223
|
const pathname = location.pathname;
|
|
3915
|
-
const theme =
|
|
4224
|
+
const theme = useTheme4();
|
|
3916
4225
|
const isPhone = useMediaQuery3(theme.breakpoints.down("sm"));
|
|
3917
4226
|
const listPath = pathname.split("/").slice(0, -1).join("/");
|
|
3918
4227
|
const controller = useObjectPageController({
|
|
@@ -3925,54 +4234,54 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
3925
4234
|
});
|
|
3926
4235
|
useAdminDocumentTitle(t("admin_title"), (_b = (_a = controller.meta) == null ? void 0 : _a.title) != null ? _b : slug, controller.objectTitle);
|
|
3927
4236
|
if (controller.isLoading && !controller.data) {
|
|
3928
|
-
return /* @__PURE__ */
|
|
4237
|
+
return /* @__PURE__ */ jsx24(ObjectPageSkeleton, {});
|
|
3929
4238
|
}
|
|
3930
4239
|
if (controller.error && !controller.data) {
|
|
3931
|
-
return /* @__PURE__ */
|
|
4240
|
+
return /* @__PURE__ */ jsx24(Alert6, { severity: "error", children: controller.error });
|
|
3932
4241
|
}
|
|
3933
4242
|
if (!controller.data || !controller.meta) {
|
|
3934
|
-
return /* @__PURE__ */
|
|
4243
|
+
return /* @__PURE__ */ jsx24(ObjectPageSkeleton, {});
|
|
3935
4244
|
}
|
|
3936
|
-
return /* @__PURE__ */
|
|
3937
|
-
/* @__PURE__ */
|
|
3938
|
-
/* @__PURE__ */
|
|
4245
|
+
return /* @__PURE__ */ jsx24(AdminRouterProvider, { router: resolvedRouter, children: /* @__PURE__ */ jsxs16(LocalizationProvider2, { dateAdapter: AdapterDayjs2, adapterLocale: locale, children: [
|
|
4246
|
+
/* @__PURE__ */ jsxs16(Stack13, { spacing: 1.5, sx: { height: "100%", minHeight: 0 }, children: [
|
|
4247
|
+
/* @__PURE__ */ jsx24(
|
|
3939
4248
|
MainHeader,
|
|
3940
4249
|
{
|
|
3941
4250
|
title: controller.objectTitle,
|
|
3942
4251
|
subtitle: controller.meta.slug,
|
|
3943
|
-
beforeSubtitle: /* @__PURE__ */
|
|
4252
|
+
beforeSubtitle: /* @__PURE__ */ jsx24(
|
|
3944
4253
|
IconButton4,
|
|
3945
4254
|
{
|
|
3946
4255
|
"aria-label": t("back"),
|
|
3947
4256
|
onClick: controller.handleNavigateBack,
|
|
3948
4257
|
size: "small",
|
|
3949
4258
|
sx: { ml: -0.5 },
|
|
3950
|
-
children: /* @__PURE__ */
|
|
4259
|
+
children: /* @__PURE__ */ jsx24(ArrowBackIcon, { fontSize: "small" })
|
|
3951
4260
|
}
|
|
3952
4261
|
),
|
|
3953
|
-
actions: isPhone ? /* @__PURE__ */
|
|
4262
|
+
actions: isPhone ? /* @__PURE__ */ jsx24(
|
|
3954
4263
|
IconButton4,
|
|
3955
4264
|
{
|
|
3956
4265
|
"aria-label": t("actions"),
|
|
3957
4266
|
onClick: (event) => controller.setActionsAnchorEl(event.currentTarget),
|
|
3958
4267
|
size: "small",
|
|
3959
4268
|
sx: { mr: -0.5 },
|
|
3960
|
-
children: /* @__PURE__ */
|
|
4269
|
+
children: /* @__PURE__ */ jsx24(MoreVertIcon2, { fontSize: "small" })
|
|
3961
4270
|
}
|
|
3962
4271
|
) : void 0,
|
|
3963
|
-
details: controller.meta.description ? /* @__PURE__ */
|
|
4272
|
+
details: controller.meta.description ? /* @__PURE__ */ jsx24(Typography7, { color: "text.secondary", sx: { fontSize: 14, lineHeight: 1.45 }, children: controller.meta.description }) : void 0,
|
|
3964
4273
|
error: controller.error
|
|
3965
4274
|
}
|
|
3966
4275
|
),
|
|
3967
|
-
/* @__PURE__ */
|
|
3968
|
-
|
|
4276
|
+
/* @__PURE__ */ jsxs16(
|
|
4277
|
+
Stack13,
|
|
3969
4278
|
{
|
|
3970
4279
|
direction: { xs: "column", lg: "row" },
|
|
3971
4280
|
spacing: 1.5,
|
|
3972
4281
|
sx: { flex: 1, minHeight: 0, alignItems: "stretch" },
|
|
3973
4282
|
children: [
|
|
3974
|
-
/* @__PURE__ */
|
|
3975
|
-
|
|
4283
|
+
/* @__PURE__ */ jsx24(
|
|
4284
|
+
Paper9,
|
|
3976
4285
|
{
|
|
3977
4286
|
sx: {
|
|
3978
4287
|
borderRadius: "10px",
|
|
@@ -3980,13 +4289,13 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
3980
4289
|
minHeight: 0,
|
|
3981
4290
|
overflow: "hidden"
|
|
3982
4291
|
},
|
|
3983
|
-
children: /* @__PURE__ */
|
|
4292
|
+
children: /* @__PURE__ */ jsx24(Box13, { component: "form", autoComplete: "off", sx: { height: "100%", overflow: "auto", p: 2.5 }, children: /* @__PURE__ */ jsx24(Stack13, { spacing: 1.5, children: controller.detailFields.map((fieldName) => {
|
|
3984
4293
|
const field = controller.fieldMap.get(fieldName);
|
|
3985
4294
|
if (!field) {
|
|
3986
4295
|
return null;
|
|
3987
4296
|
}
|
|
3988
4297
|
if (controller.editableFieldNames.has(fieldName)) {
|
|
3989
|
-
return /* @__PURE__ */
|
|
4298
|
+
return /* @__PURE__ */ jsx24(
|
|
3990
4299
|
ObjectField,
|
|
3991
4300
|
{
|
|
3992
4301
|
field,
|
|
@@ -3998,7 +4307,7 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
3998
4307
|
field.name
|
|
3999
4308
|
);
|
|
4000
4309
|
}
|
|
4001
|
-
return /* @__PURE__ */
|
|
4310
|
+
return /* @__PURE__ */ jsx24(
|
|
4002
4311
|
ReadonlyObjectField,
|
|
4003
4312
|
{
|
|
4004
4313
|
field,
|
|
@@ -4014,8 +4323,8 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
4014
4323
|
}) }) })
|
|
4015
4324
|
}
|
|
4016
4325
|
),
|
|
4017
|
-
/* @__PURE__ */
|
|
4018
|
-
|
|
4326
|
+
/* @__PURE__ */ jsx24(
|
|
4327
|
+
Paper9,
|
|
4019
4328
|
{
|
|
4020
4329
|
sx: {
|
|
4021
4330
|
width: { xs: "100%", lg: 280 },
|
|
@@ -4027,9 +4336,9 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
4027
4336
|
top: { lg: 0 },
|
|
4028
4337
|
display: isPhone ? "none" : void 0
|
|
4029
4338
|
},
|
|
4030
|
-
children: /* @__PURE__ */
|
|
4031
|
-
/* @__PURE__ */
|
|
4032
|
-
controller.isDirty ? /* @__PURE__ */
|
|
4339
|
+
children: /* @__PURE__ */ jsxs16(Stack13, { spacing: 1, children: [
|
|
4340
|
+
/* @__PURE__ */ jsx24(Typography7, { variant: "subtitle2", color: "text.secondary", children: t("actions") }),
|
|
4341
|
+
controller.isDirty ? /* @__PURE__ */ jsx24(
|
|
4033
4342
|
Button5,
|
|
4034
4343
|
{
|
|
4035
4344
|
variant: "contained",
|
|
@@ -4038,7 +4347,7 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
4038
4347
|
children: controller.isSaving ? t("saving") : t("save")
|
|
4039
4348
|
}
|
|
4040
4349
|
) : null,
|
|
4041
|
-
/* @__PURE__ */
|
|
4350
|
+
/* @__PURE__ */ jsx24(
|
|
4042
4351
|
Button5,
|
|
4043
4352
|
{
|
|
4044
4353
|
variant: "outlined",
|
|
@@ -4048,7 +4357,7 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
4048
4357
|
children: t("delete")
|
|
4049
4358
|
}
|
|
4050
4359
|
),
|
|
4051
|
-
controller.objectActions.map((action) => /* @__PURE__ */
|
|
4360
|
+
controller.objectActions.map((action) => /* @__PURE__ */ jsx24(
|
|
4052
4361
|
Button5,
|
|
4053
4362
|
{
|
|
4054
4363
|
variant: "outlined",
|
|
@@ -4065,7 +4374,7 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
4065
4374
|
}
|
|
4066
4375
|
)
|
|
4067
4376
|
] }),
|
|
4068
|
-
/* @__PURE__ */
|
|
4377
|
+
/* @__PURE__ */ jsxs16(
|
|
4069
4378
|
Menu2,
|
|
4070
4379
|
{
|
|
4071
4380
|
anchorEl: controller.actionsAnchorEl,
|
|
@@ -4081,7 +4390,7 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
4081
4390
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
4082
4391
|
transformOrigin: { vertical: "top", horizontal: "right" },
|
|
4083
4392
|
children: [
|
|
4084
|
-
controller.isDirty ? /* @__PURE__ */
|
|
4393
|
+
controller.isDirty ? /* @__PURE__ */ jsx24(
|
|
4085
4394
|
MenuItem3,
|
|
4086
4395
|
{
|
|
4087
4396
|
onClick: () => {
|
|
@@ -4092,7 +4401,7 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
4092
4401
|
children: controller.isSaving ? t("saving") : t("save")
|
|
4093
4402
|
}
|
|
4094
4403
|
) : null,
|
|
4095
|
-
/* @__PURE__ */
|
|
4404
|
+
/* @__PURE__ */ jsx24(
|
|
4096
4405
|
MenuItem3,
|
|
4097
4406
|
{
|
|
4098
4407
|
onClick: () => void controller.handleOpenDeletePreview(),
|
|
@@ -4101,7 +4410,7 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
4101
4410
|
children: t("delete")
|
|
4102
4411
|
}
|
|
4103
4412
|
),
|
|
4104
|
-
controller.objectActions.map((action) => /* @__PURE__ */
|
|
4413
|
+
controller.objectActions.map((action) => /* @__PURE__ */ jsx24(
|
|
4105
4414
|
MenuItem3,
|
|
4106
4415
|
{
|
|
4107
4416
|
onClick: () => {
|
|
@@ -4116,7 +4425,7 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
4116
4425
|
]
|
|
4117
4426
|
}
|
|
4118
4427
|
),
|
|
4119
|
-
/* @__PURE__ */
|
|
4428
|
+
/* @__PURE__ */ jsx24(
|
|
4120
4429
|
DeletePreviewDialog,
|
|
4121
4430
|
{
|
|
4122
4431
|
open: controller.deleteConfirmOpen,
|
|
@@ -4140,8 +4449,8 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
4140
4449
|
}
|
|
4141
4450
|
|
|
4142
4451
|
// src/components/Shell.tsx
|
|
4143
|
-
import { useEffect as
|
|
4144
|
-
import { Box as
|
|
4452
|
+
import { useEffect as useEffect12, useMemo as useMemo11, useState as useState12 } from "react";
|
|
4453
|
+
import { Box as Box16, CssBaseline, Drawer, GlobalStyles, Stack as Stack14, useMediaQuery as useMediaQuery4 } from "@mui/material";
|
|
4145
4454
|
import { ThemeProvider } from "@mui/material/styles";
|
|
4146
4455
|
|
|
4147
4456
|
// src/theme/defaultAdminTheme.ts
|
|
@@ -4272,8 +4581,8 @@ var defaultAdminTheme = createTheme({
|
|
|
4272
4581
|
});
|
|
4273
4582
|
|
|
4274
4583
|
// src/components/layout/Main.tsx
|
|
4275
|
-
import { Box as
|
|
4276
|
-
import { jsx as
|
|
4584
|
+
import { Box as Box14 } from "@mui/material";
|
|
4585
|
+
import { jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4277
4586
|
function Main({ children }) {
|
|
4278
4587
|
const { pathname } = useAdminLocation();
|
|
4279
4588
|
const { pendingPath, pendingView } = useShellContext();
|
|
@@ -4282,8 +4591,8 @@ function Main({ children }) {
|
|
|
4282
4591
|
return normalizedPath.replace(/^\/(ru|en)(?=\/|$)/, "") || "/";
|
|
4283
4592
|
};
|
|
4284
4593
|
const isPendingNavigation = pendingPath !== null && normalizeAdminPath2(pathname) !== normalizeAdminPath2(pendingPath);
|
|
4285
|
-
return /* @__PURE__ */
|
|
4286
|
-
|
|
4594
|
+
return /* @__PURE__ */ jsxs17(
|
|
4595
|
+
Box14,
|
|
4287
4596
|
{
|
|
4288
4597
|
sx: {
|
|
4289
4598
|
flex: 1,
|
|
@@ -4296,8 +4605,8 @@ function Main({ children }) {
|
|
|
4296
4605
|
},
|
|
4297
4606
|
children: [
|
|
4298
4607
|
children,
|
|
4299
|
-
isPendingNavigation ? /* @__PURE__ */
|
|
4300
|
-
|
|
4608
|
+
isPendingNavigation ? /* @__PURE__ */ jsx25(
|
|
4609
|
+
Box14,
|
|
4301
4610
|
{
|
|
4302
4611
|
sx: {
|
|
4303
4612
|
position: "absolute",
|
|
@@ -4305,7 +4614,7 @@ function Main({ children }) {
|
|
|
4305
4614
|
zIndex: 5,
|
|
4306
4615
|
backgroundColor: "background.default"
|
|
4307
4616
|
},
|
|
4308
|
-
children: pendingView === "model" || pendingView === "overview" ? /* @__PURE__ */
|
|
4617
|
+
children: pendingView === "model" || pendingView === "overview" ? /* @__PURE__ */ jsx25(ModelPageSkeleton, {}) : /* @__PURE__ */ jsx25(ModelPageSkeleton, {})
|
|
4309
4618
|
}
|
|
4310
4619
|
) : null
|
|
4311
4620
|
]
|
|
@@ -4315,8 +4624,8 @@ function Main({ children }) {
|
|
|
4315
4624
|
|
|
4316
4625
|
// src/components/layout/Sidebar.tsx
|
|
4317
4626
|
import { memo as memo8 } from "react";
|
|
4318
|
-
import { Box as
|
|
4319
|
-
import { jsx as
|
|
4627
|
+
import { Box as Box15, ListItemButton as ListItemButton3, Typography as Typography8 } from "@mui/material";
|
|
4628
|
+
import { jsx as jsx26, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4320
4629
|
var Sidebar = memo8(function Sidebar2({ models, blocks, basePath }) {
|
|
4321
4630
|
var _a;
|
|
4322
4631
|
const t = useAdminTranslation();
|
|
@@ -4329,8 +4638,8 @@ var Sidebar = memo8(function Sidebar2({ models, blocks, basePath }) {
|
|
|
4329
4638
|
const relativePath = matchedBasePath ? effectivePathname.slice(matchedBasePath.length) : "";
|
|
4330
4639
|
const activeModelSlug = (_a = relativePath.split("/").filter(Boolean)[0]) != null ? _a : null;
|
|
4331
4640
|
const isOverviewActive = matchedBasePath !== null && (effectivePathname === matchedBasePath || effectivePathname === `${matchedBasePath}/`);
|
|
4332
|
-
return /* @__PURE__ */
|
|
4333
|
-
|
|
4641
|
+
return /* @__PURE__ */ jsx26(Box15, { sx: { height: "100%", overflow: "hidden" }, children: /* @__PURE__ */ jsx26(
|
|
4642
|
+
Box15,
|
|
4334
4643
|
{
|
|
4335
4644
|
sx: {
|
|
4336
4645
|
height: "100%",
|
|
@@ -4341,14 +4650,14 @@ var Sidebar = memo8(function Sidebar2({ models, blocks, basePath }) {
|
|
|
4341
4650
|
ml: 0,
|
|
4342
4651
|
pl: 0
|
|
4343
4652
|
},
|
|
4344
|
-
children: /* @__PURE__ */
|
|
4345
|
-
/* @__PURE__ */
|
|
4653
|
+
children: /* @__PURE__ */ jsxs18(Box15, { sx: { direction: "ltr", pl: 1 }, children: [
|
|
4654
|
+
/* @__PURE__ */ jsx26(
|
|
4346
4655
|
NavLink,
|
|
4347
4656
|
{
|
|
4348
4657
|
href: basePath,
|
|
4349
4658
|
style: { textDecoration: "none", display: "block" },
|
|
4350
4659
|
onClick: () => startPendingNavigation(basePath, "overview"),
|
|
4351
|
-
children: /* @__PURE__ */
|
|
4660
|
+
children: /* @__PURE__ */ jsx26(
|
|
4352
4661
|
ListItemButton3,
|
|
4353
4662
|
{
|
|
4354
4663
|
selected: isOverviewActive,
|
|
@@ -4361,12 +4670,12 @@ var Sidebar = memo8(function Sidebar2({ models, blocks, basePath }) {
|
|
|
4361
4670
|
backgroundColor: isOverviewActive ? "rgba(255, 255, 255, 0.2)" : "rgba(255, 255, 255, 0.055)"
|
|
4362
4671
|
}
|
|
4363
4672
|
},
|
|
4364
|
-
children: /* @__PURE__ */
|
|
4673
|
+
children: /* @__PURE__ */ jsx26(Typography8, { variant: "subtitle1", sx: { fontWeight: 700 }, children: t("overview") })
|
|
4365
4674
|
}
|
|
4366
4675
|
)
|
|
4367
4676
|
}
|
|
4368
4677
|
),
|
|
4369
|
-
/* @__PURE__ */
|
|
4678
|
+
/* @__PURE__ */ jsx26(
|
|
4370
4679
|
ModelsBlocks,
|
|
4371
4680
|
{
|
|
4372
4681
|
models,
|
|
@@ -4383,7 +4692,7 @@ var Sidebar = memo8(function Sidebar2({ models, blocks, basePath }) {
|
|
|
4383
4692
|
});
|
|
4384
4693
|
|
|
4385
4694
|
// src/components/Shell.tsx
|
|
4386
|
-
import { jsx as
|
|
4695
|
+
import { jsx as jsx27, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4387
4696
|
function normalizeAdminPath(path) {
|
|
4388
4697
|
const normalizedPath = path.endsWith("/") && path !== "/" ? path.slice(0, -1) : path;
|
|
4389
4698
|
return normalizedPath.replace(/^\/(ru|en)(?=\/|$)/, "") || "/";
|
|
@@ -4395,18 +4704,18 @@ function Shell({ client, models, blocks, basePath, locale, children, theme, rout
|
|
|
4395
4704
|
const location = useAdminLocation(resolvedRouter);
|
|
4396
4705
|
const pathname = location.pathname;
|
|
4397
4706
|
const isDesktopSidebar = useMediaQuery4(activeTheme.breakpoints.up("lg"));
|
|
4398
|
-
const [isMobileSidebarOpen, setIsMobileSidebarOpen] =
|
|
4399
|
-
const [pendingPath, setPendingPath] =
|
|
4400
|
-
const [pendingView, setPendingView] =
|
|
4401
|
-
|
|
4707
|
+
const [isMobileSidebarOpen, setIsMobileSidebarOpen] = useState12(false);
|
|
4708
|
+
const [pendingPath, setPendingPath] = useState12(null);
|
|
4709
|
+
const [pendingView, setPendingView] = useState12(null);
|
|
4710
|
+
useEffect12(() => {
|
|
4402
4711
|
if (isDesktopSidebar) {
|
|
4403
4712
|
setIsMobileSidebarOpen(false);
|
|
4404
4713
|
}
|
|
4405
4714
|
}, [isDesktopSidebar]);
|
|
4406
|
-
|
|
4715
|
+
useEffect12(() => {
|
|
4407
4716
|
setIsMobileSidebarOpen(false);
|
|
4408
4717
|
}, [pathname]);
|
|
4409
|
-
|
|
4718
|
+
useEffect12(() => {
|
|
4410
4719
|
if (pendingPath === null) {
|
|
4411
4720
|
return;
|
|
4412
4721
|
}
|
|
@@ -4415,7 +4724,7 @@ function Shell({ client, models, blocks, basePath, locale, children, theme, rout
|
|
|
4415
4724
|
setPendingView(null);
|
|
4416
4725
|
}
|
|
4417
4726
|
}, [pathname, pendingPath]);
|
|
4418
|
-
const shellContextValue =
|
|
4727
|
+
const shellContextValue = useMemo11(() => ({
|
|
4419
4728
|
isMobile: !isDesktopSidebar,
|
|
4420
4729
|
openMobileSidebar: () => setIsMobileSidebarOpen(true),
|
|
4421
4730
|
pendingPath,
|
|
@@ -4428,9 +4737,9 @@ function Shell({ client, models, blocks, basePath, locale, children, theme, rout
|
|
|
4428
4737
|
setPendingView(view);
|
|
4429
4738
|
}
|
|
4430
4739
|
}), [isDesktopSidebar, pathname, pendingPath, pendingView]);
|
|
4431
|
-
return /* @__PURE__ */
|
|
4432
|
-
/* @__PURE__ */
|
|
4433
|
-
/* @__PURE__ */
|
|
4740
|
+
return /* @__PURE__ */ jsx27(AdminRouterProvider, { router: resolvedRouter, children: /* @__PURE__ */ jsx27(ThemeProvider, { theme: activeTheme, children: /* @__PURE__ */ jsx27(AdminLocaleProvider, { locale, children: /* @__PURE__ */ jsx27(AdminDataProvider, { value: { locale: locale === "en" ? "en" : "ru", models, blocks }, children: /* @__PURE__ */ jsx27(ShellContextProvider, { value: shellContextValue, children: /* @__PURE__ */ jsxs19(AdminMessageProvider, { children: [
|
|
4741
|
+
/* @__PURE__ */ jsx27(CssBaseline, {}),
|
|
4742
|
+
/* @__PURE__ */ jsx27(
|
|
4434
4743
|
GlobalStyles,
|
|
4435
4744
|
{
|
|
4436
4745
|
styles: (muiTheme) => ({
|
|
@@ -4469,8 +4778,8 @@ function Shell({ client, models, blocks, basePath, locale, children, theme, rout
|
|
|
4469
4778
|
})
|
|
4470
4779
|
}
|
|
4471
4780
|
),
|
|
4472
|
-
/* @__PURE__ */
|
|
4473
|
-
|
|
4781
|
+
/* @__PURE__ */ jsx27(
|
|
4782
|
+
Box16,
|
|
4474
4783
|
{
|
|
4475
4784
|
"data-xladmin-root": "true",
|
|
4476
4785
|
sx: {
|
|
@@ -4480,15 +4789,15 @@ function Shell({ client, models, blocks, basePath, locale, children, theme, rout
|
|
|
4480
4789
|
backgroundColor: "background.default",
|
|
4481
4790
|
backgroundImage: "none"
|
|
4482
4791
|
},
|
|
4483
|
-
children: /* @__PURE__ */
|
|
4484
|
-
|
|
4792
|
+
children: /* @__PURE__ */ jsxs19(
|
|
4793
|
+
Stack14,
|
|
4485
4794
|
{
|
|
4486
4795
|
direction: { xs: "column", lg: "row" },
|
|
4487
4796
|
spacing: 0,
|
|
4488
4797
|
sx: { height: "100%", minHeight: 0, alignItems: "stretch" },
|
|
4489
4798
|
children: [
|
|
4490
|
-
/* @__PURE__ */
|
|
4491
|
-
|
|
4799
|
+
/* @__PURE__ */ jsx27(
|
|
4800
|
+
Box16,
|
|
4492
4801
|
{
|
|
4493
4802
|
sx: {
|
|
4494
4803
|
display: { xs: "none", lg: "block" },
|
|
@@ -4499,11 +4808,11 @@ function Shell({ client, models, blocks, basePath, locale, children, theme, rout
|
|
|
4499
4808
|
pl: 0,
|
|
4500
4809
|
pr: 1
|
|
4501
4810
|
},
|
|
4502
|
-
children: /* @__PURE__ */
|
|
4811
|
+
children: /* @__PURE__ */ jsx27(Sidebar, { models, blocks, basePath })
|
|
4503
4812
|
}
|
|
4504
4813
|
),
|
|
4505
|
-
/* @__PURE__ */
|
|
4506
|
-
|
|
4814
|
+
/* @__PURE__ */ jsx27(
|
|
4815
|
+
Box16,
|
|
4507
4816
|
{
|
|
4508
4817
|
sx: {
|
|
4509
4818
|
flex: 1,
|
|
@@ -4516,7 +4825,7 @@ function Shell({ client, models, blocks, basePath, locale, children, theme, rout
|
|
|
4516
4825
|
py: { xs: 1, sm: 1.5, lg: 2 },
|
|
4517
4826
|
pl: { xs: 1, sm: 1.5, lg: 1 }
|
|
4518
4827
|
},
|
|
4519
|
-
children: /* @__PURE__ */
|
|
4828
|
+
children: /* @__PURE__ */ jsx27(Main, { children })
|
|
4520
4829
|
}
|
|
4521
4830
|
)
|
|
4522
4831
|
]
|
|
@@ -4524,7 +4833,7 @@ function Shell({ client, models, blocks, basePath, locale, children, theme, rout
|
|
|
4524
4833
|
)
|
|
4525
4834
|
}
|
|
4526
4835
|
),
|
|
4527
|
-
/* @__PURE__ */
|
|
4836
|
+
/* @__PURE__ */ jsx27(
|
|
4528
4837
|
Drawer,
|
|
4529
4838
|
{
|
|
4530
4839
|
anchor: "left",
|
|
@@ -4543,10 +4852,10 @@ function Shell({ client, models, blocks, basePath, locale, children, theme, rout
|
|
|
4543
4852
|
}
|
|
4544
4853
|
}
|
|
4545
4854
|
},
|
|
4546
|
-
children: /* @__PURE__ */
|
|
4855
|
+
children: /* @__PURE__ */ jsx27(Box16, { sx: { height: "100%", minHeight: 0, pr: 1.5 }, children: /* @__PURE__ */ jsx27(Sidebar, { models, blocks, basePath }) })
|
|
4547
4856
|
}
|
|
4548
4857
|
)
|
|
4549
|
-
] }) }) }) }) });
|
|
4858
|
+
] }) }) }) }) }) });
|
|
4550
4859
|
}
|
|
4551
4860
|
export {
|
|
4552
4861
|
AdminLocaleProvider,
|
|
@@ -4575,6 +4884,7 @@ export {
|
|
|
4575
4884
|
translateAdmin,
|
|
4576
4885
|
useAdminLocale,
|
|
4577
4886
|
useAdminLocation,
|
|
4887
|
+
useAdminMessage,
|
|
4578
4888
|
useAdminRouter,
|
|
4579
4889
|
useAdminTranslation
|
|
4580
4890
|
};
|