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