xladmin 0.3.1 → 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 +815 -505
- 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,14 +1491,17 @@ 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,
|
|
1280
|
-
style
|
|
1501
|
+
style: {
|
|
1502
|
+
color: "inherit",
|
|
1503
|
+
...style
|
|
1504
|
+
},
|
|
1281
1505
|
title,
|
|
1282
1506
|
onClick: (event) => handleNavLinkClick(event, { href, onClick, router: resolvedRouter }),
|
|
1283
1507
|
children
|
|
@@ -1286,10 +1510,10 @@ function NavLink({ href, children, style, title, onClick, router }) {
|
|
|
1286
1510
|
}
|
|
1287
1511
|
|
|
1288
1512
|
// src/components/models-blocks/DashboardModelsBlock.tsx
|
|
1289
|
-
import { jsx as
|
|
1513
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1290
1514
|
function DashboardModelsBlock({ block, basePath }) {
|
|
1291
1515
|
const [isExpanded, setIsExpanded] = useBlockExpandedState(block.slug, block.default_expanded);
|
|
1292
|
-
return /* @__PURE__ */
|
|
1516
|
+
return /* @__PURE__ */ jsxs5(
|
|
1293
1517
|
Accordion,
|
|
1294
1518
|
{
|
|
1295
1519
|
expanded: block.collapsible ? isExpanded : true,
|
|
@@ -1305,10 +1529,10 @@ function DashboardModelsBlock({ block, basePath }) {
|
|
|
1305
1529
|
}
|
|
1306
1530
|
},
|
|
1307
1531
|
children: [
|
|
1308
|
-
/* @__PURE__ */
|
|
1532
|
+
/* @__PURE__ */ jsx9(
|
|
1309
1533
|
AccordionSummary,
|
|
1310
1534
|
{
|
|
1311
|
-
expandIcon: block.collapsible ? /* @__PURE__ */
|
|
1535
|
+
expandIcon: block.collapsible ? /* @__PURE__ */ jsx9(ExpandMoreIcon, { fontSize: "small" }) : void 0,
|
|
1312
1536
|
sx: {
|
|
1313
1537
|
minHeight: "48px",
|
|
1314
1538
|
pr: 1.75,
|
|
@@ -1330,15 +1554,15 @@ function DashboardModelsBlock({ block, basePath }) {
|
|
|
1330
1554
|
mb: 1.05
|
|
1331
1555
|
}
|
|
1332
1556
|
},
|
|
1333
|
-
children: /* @__PURE__ */
|
|
1557
|
+
children: /* @__PURE__ */ jsx9(BlockTitle, { block })
|
|
1334
1558
|
}
|
|
1335
1559
|
),
|
|
1336
|
-
/* @__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(
|
|
1337
1561
|
NavLink,
|
|
1338
1562
|
{
|
|
1339
1563
|
href: `${basePath}/${model.slug}`,
|
|
1340
1564
|
style: { textDecoration: "none", display: "block" },
|
|
1341
|
-
children: /* @__PURE__ */
|
|
1565
|
+
children: /* @__PURE__ */ jsx9(
|
|
1342
1566
|
ButtonBase,
|
|
1343
1567
|
{
|
|
1344
1568
|
sx: {
|
|
@@ -1348,7 +1572,7 @@ function DashboardModelsBlock({ block, basePath }) {
|
|
|
1348
1572
|
borderRadius: "8px",
|
|
1349
1573
|
overflow: "hidden"
|
|
1350
1574
|
},
|
|
1351
|
-
children: /* @__PURE__ */
|
|
1575
|
+
children: /* @__PURE__ */ jsx9(
|
|
1352
1576
|
ListItemButton,
|
|
1353
1577
|
{
|
|
1354
1578
|
sx: {
|
|
@@ -1357,7 +1581,7 @@ function DashboardModelsBlock({ block, basePath }) {
|
|
|
1357
1581
|
px: 1.25,
|
|
1358
1582
|
py: 0.4
|
|
1359
1583
|
},
|
|
1360
|
-
children: /* @__PURE__ */
|
|
1584
|
+
children: /* @__PURE__ */ jsx9(ListItemText, { primary: model.title })
|
|
1361
1585
|
}
|
|
1362
1586
|
)
|
|
1363
1587
|
}
|
|
@@ -1376,17 +1600,17 @@ import {
|
|
|
1376
1600
|
Accordion as Accordion2,
|
|
1377
1601
|
AccordionDetails as AccordionDetails2,
|
|
1378
1602
|
AccordionSummary as AccordionSummary2,
|
|
1379
|
-
Box as
|
|
1603
|
+
Box as Box3,
|
|
1380
1604
|
List,
|
|
1381
1605
|
ListItemButton as ListItemButton2,
|
|
1382
1606
|
ListItemText as ListItemText2,
|
|
1383
|
-
Paper
|
|
1607
|
+
Paper as Paper2
|
|
1384
1608
|
} from "@mui/material";
|
|
1385
|
-
import { jsx as
|
|
1609
|
+
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1386
1610
|
function SidebarModelsBlock({ block, basePath, activeModelSlug, onModelNavigate }) {
|
|
1387
1611
|
const [isExpanded, setIsExpanded] = useBlockExpandedState(block.slug, block.default_expanded);
|
|
1388
1612
|
if (block.collapsible) {
|
|
1389
|
-
return /* @__PURE__ */
|
|
1613
|
+
return /* @__PURE__ */ jsxs6(
|
|
1390
1614
|
Accordion2,
|
|
1391
1615
|
{
|
|
1392
1616
|
expanded: isExpanded,
|
|
@@ -1402,10 +1626,10 @@ function SidebarModelsBlock({ block, basePath, activeModelSlug, onModelNavigate
|
|
|
1402
1626
|
}
|
|
1403
1627
|
},
|
|
1404
1628
|
children: [
|
|
1405
|
-
/* @__PURE__ */
|
|
1629
|
+
/* @__PURE__ */ jsx10(
|
|
1406
1630
|
AccordionSummary2,
|
|
1407
1631
|
{
|
|
1408
|
-
expandIcon: /* @__PURE__ */
|
|
1632
|
+
expandIcon: /* @__PURE__ */ jsx10(ExpandMoreIcon2, { fontSize: "small" }),
|
|
1409
1633
|
sx: {
|
|
1410
1634
|
minHeight: "42px",
|
|
1411
1635
|
pr: 1.25,
|
|
@@ -1421,10 +1645,10 @@ function SidebarModelsBlock({ block, basePath, activeModelSlug, onModelNavigate
|
|
|
1421
1645
|
my: 0
|
|
1422
1646
|
}
|
|
1423
1647
|
},
|
|
1424
|
-
children: /* @__PURE__ */
|
|
1648
|
+
children: /* @__PURE__ */ jsx10(BlockTitle, { block, compact: true })
|
|
1425
1649
|
}
|
|
1426
1650
|
),
|
|
1427
|
-
/* @__PURE__ */
|
|
1651
|
+
/* @__PURE__ */ jsx10(AccordionDetails2, { sx: { p: 0 }, children: /* @__PURE__ */ jsx10(
|
|
1428
1652
|
SidebarModelsList,
|
|
1429
1653
|
{
|
|
1430
1654
|
models: block.models,
|
|
@@ -1437,8 +1661,8 @@ function SidebarModelsBlock({ block, basePath, activeModelSlug, onModelNavigate
|
|
|
1437
1661
|
}
|
|
1438
1662
|
);
|
|
1439
1663
|
}
|
|
1440
|
-
return /* @__PURE__ */
|
|
1441
|
-
|
|
1664
|
+
return /* @__PURE__ */ jsxs6(
|
|
1665
|
+
Paper2,
|
|
1442
1666
|
{
|
|
1443
1667
|
sx: {
|
|
1444
1668
|
...getBlockSurfaceSx(block, "sidebar"),
|
|
@@ -1446,8 +1670,8 @@ function SidebarModelsBlock({ block, basePath, activeModelSlug, onModelNavigate
|
|
|
1446
1670
|
overflow: "hidden"
|
|
1447
1671
|
},
|
|
1448
1672
|
children: [
|
|
1449
|
-
/* @__PURE__ */
|
|
1450
|
-
/* @__PURE__ */
|
|
1673
|
+
/* @__PURE__ */ jsx10(Box3, { sx: { px: 1.25, py: 1 }, children: /* @__PURE__ */ jsx10(BlockTitle, { block, compact: true }) }),
|
|
1674
|
+
/* @__PURE__ */ jsx10(
|
|
1451
1675
|
SidebarModelsList,
|
|
1452
1676
|
{
|
|
1453
1677
|
models: block.models,
|
|
@@ -1461,16 +1685,16 @@ function SidebarModelsBlock({ block, basePath, activeModelSlug, onModelNavigate
|
|
|
1461
1685
|
);
|
|
1462
1686
|
}
|
|
1463
1687
|
function SidebarModelsList({ models, basePath, activeModelSlug, onModelNavigate }) {
|
|
1464
|
-
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) => {
|
|
1465
1689
|
const href = `${basePath}/${model.slug}`;
|
|
1466
1690
|
const isActive = activeModelSlug === model.slug;
|
|
1467
|
-
return /* @__PURE__ */
|
|
1691
|
+
return /* @__PURE__ */ jsx10(
|
|
1468
1692
|
NavLink,
|
|
1469
1693
|
{
|
|
1470
1694
|
href,
|
|
1471
1695
|
style: { textDecoration: "none", display: "block" },
|
|
1472
1696
|
onClick: () => onModelNavigate == null ? void 0 : onModelNavigate(href),
|
|
1473
|
-
children: /* @__PURE__ */
|
|
1697
|
+
children: /* @__PURE__ */ jsx10(
|
|
1474
1698
|
ListItemButton2,
|
|
1475
1699
|
{
|
|
1476
1700
|
selected: isActive,
|
|
@@ -1489,7 +1713,7 @@ function SidebarModelsList({ models, basePath, activeModelSlug, onModelNavigate
|
|
|
1489
1713
|
backgroundColor: "rgba(255, 255, 255, 0.2)"
|
|
1490
1714
|
}
|
|
1491
1715
|
},
|
|
1492
|
-
children: /* @__PURE__ */
|
|
1716
|
+
children: /* @__PURE__ */ jsx10(ListItemText2, { primary: model.title })
|
|
1493
1717
|
}
|
|
1494
1718
|
)
|
|
1495
1719
|
},
|
|
@@ -1499,7 +1723,7 @@ function SidebarModelsList({ models, basePath, activeModelSlug, onModelNavigate
|
|
|
1499
1723
|
}
|
|
1500
1724
|
|
|
1501
1725
|
// src/components/ModelsBlocks.tsx
|
|
1502
|
-
import { jsx as
|
|
1726
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1503
1727
|
var ModelsBlocks = memo2(function ModelsBlocks2({
|
|
1504
1728
|
basePath,
|
|
1505
1729
|
models,
|
|
@@ -1509,10 +1733,10 @@ var ModelsBlocks = memo2(function ModelsBlocks2({
|
|
|
1509
1733
|
onModelNavigate
|
|
1510
1734
|
}) {
|
|
1511
1735
|
const t = useAdminTranslation();
|
|
1512
|
-
const theme =
|
|
1736
|
+
const theme = useTheme2();
|
|
1513
1737
|
const isMdUp = useMediaQuery(theme.breakpoints.up("md"));
|
|
1514
1738
|
const isXlUp = useMediaQuery(theme.breakpoints.up("xl"));
|
|
1515
|
-
const normalizedBlocks =
|
|
1739
|
+
const normalizedBlocks = useMemo6(() => [
|
|
1516
1740
|
...blocks,
|
|
1517
1741
|
{
|
|
1518
1742
|
slug: "all-models",
|
|
@@ -1525,12 +1749,12 @@ var ModelsBlocks = memo2(function ModelsBlocks2({
|
|
|
1525
1749
|
isAllModels: true
|
|
1526
1750
|
}
|
|
1527
1751
|
], [blocks, models, t, variant]);
|
|
1528
|
-
const dashboardColumns =
|
|
1752
|
+
const dashboardColumns = useMemo6(() => {
|
|
1529
1753
|
const columnCount = isXlUp ? 3 : isMdUp ? 2 : 1;
|
|
1530
1754
|
return distributeBlocksByHeight(normalizedBlocks, columnCount);
|
|
1531
1755
|
}, [isMdUp, isXlUp, normalizedBlocks]);
|
|
1532
1756
|
if (variant === "sidebar") {
|
|
1533
|
-
return /* @__PURE__ */
|
|
1757
|
+
return /* @__PURE__ */ jsx11(Stack4, { spacing: 1, children: normalizedBlocks.map((block) => /* @__PURE__ */ jsx11(
|
|
1534
1758
|
SidebarModelsBlock,
|
|
1535
1759
|
{
|
|
1536
1760
|
block,
|
|
@@ -1541,7 +1765,7 @@ var ModelsBlocks = memo2(function ModelsBlocks2({
|
|
|
1541
1765
|
block.slug
|
|
1542
1766
|
)) });
|
|
1543
1767
|
}
|
|
1544
|
-
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)) });
|
|
1545
1769
|
});
|
|
1546
1770
|
function distributeBlocksByHeight(blocks, columnCount) {
|
|
1547
1771
|
const columns = Array.from({ length: columnCount }, () => []);
|
|
@@ -1563,15 +1787,15 @@ function getBlockWeight(block) {
|
|
|
1563
1787
|
}
|
|
1564
1788
|
|
|
1565
1789
|
// src/components/layout/MainHeader.tsx
|
|
1566
|
-
import { useState as
|
|
1790
|
+
import { useState as useState6 } from "react";
|
|
1567
1791
|
import MenuIcon from "@mui/icons-material/Menu";
|
|
1568
|
-
import { Box as
|
|
1792
|
+
import { Box as Box5 } from "@mui/material";
|
|
1569
1793
|
import ExpandMoreIcon3 from "@mui/icons-material/ExpandMore";
|
|
1570
|
-
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";
|
|
1571
1795
|
|
|
1572
1796
|
// src/components/layout/ShellContext.tsx
|
|
1573
|
-
import { createContext as
|
|
1574
|
-
import { jsx as
|
|
1797
|
+
import { createContext as createContext5, useContext as useContext5 } from "react";
|
|
1798
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1575
1799
|
var defaultShellContextValue = {
|
|
1576
1800
|
isMobile: false,
|
|
1577
1801
|
openMobileSidebar: () => {
|
|
@@ -1581,19 +1805,19 @@ var defaultShellContextValue = {
|
|
|
1581
1805
|
startPendingNavigation: () => {
|
|
1582
1806
|
}
|
|
1583
1807
|
};
|
|
1584
|
-
var ShellContext =
|
|
1808
|
+
var ShellContext = createContext5(defaultShellContextValue);
|
|
1585
1809
|
function ShellContextProvider({
|
|
1586
1810
|
value,
|
|
1587
1811
|
children
|
|
1588
1812
|
}) {
|
|
1589
|
-
return /* @__PURE__ */
|
|
1813
|
+
return /* @__PURE__ */ jsx12(ShellContext.Provider, { value, children });
|
|
1590
1814
|
}
|
|
1591
1815
|
function useShellContext() {
|
|
1592
|
-
return
|
|
1816
|
+
return useContext5(ShellContext);
|
|
1593
1817
|
}
|
|
1594
1818
|
|
|
1595
1819
|
// src/components/layout/MainHeader.tsx
|
|
1596
|
-
import { jsx as
|
|
1820
|
+
import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1597
1821
|
var MAIN_HEADER_PADDING_X = 2.5;
|
|
1598
1822
|
var MAIN_HEADER_PADDING_T = 1.35;
|
|
1599
1823
|
var MAIN_HEADER_PADDING_B = 1.8;
|
|
@@ -1602,9 +1826,9 @@ var MAIN_HEADER_SUBTITLE_HEIGHT = 16;
|
|
|
1602
1826
|
function MainHeader({ title, subtitle, details, error, beforeTitle, beforeSubtitle, actions }) {
|
|
1603
1827
|
const t = useAdminTranslation();
|
|
1604
1828
|
const { isMobile, openMobileSidebar } = useShellContext();
|
|
1605
|
-
const [isDetailsOpen, setIsDetailsOpen] =
|
|
1606
|
-
return /* @__PURE__ */
|
|
1607
|
-
|
|
1829
|
+
const [isDetailsOpen, setIsDetailsOpen] = useState6(false);
|
|
1830
|
+
return /* @__PURE__ */ jsxs7(
|
|
1831
|
+
Paper3,
|
|
1608
1832
|
{
|
|
1609
1833
|
sx: {
|
|
1610
1834
|
px: { xs: 1.5, sm: MAIN_HEADER_PADDING_X },
|
|
@@ -1617,9 +1841,9 @@ function MainHeader({ title, subtitle, details, error, beforeTitle, beforeSubtit
|
|
|
1617
1841
|
zIndex: 3
|
|
1618
1842
|
},
|
|
1619
1843
|
children: [
|
|
1620
|
-
/* @__PURE__ */
|
|
1621
|
-
/* @__PURE__ */
|
|
1622
|
-
|
|
1844
|
+
/* @__PURE__ */ jsxs7(Stack5, { spacing: 0.5, children: [
|
|
1845
|
+
/* @__PURE__ */ jsxs7(
|
|
1846
|
+
Stack5,
|
|
1623
1847
|
{
|
|
1624
1848
|
direction: "row",
|
|
1625
1849
|
spacing: 1.5,
|
|
@@ -1627,20 +1851,20 @@ function MainHeader({ title, subtitle, details, error, beforeTitle, beforeSubtit
|
|
|
1627
1851
|
justifyContent: "space-between",
|
|
1628
1852
|
sx: { minWidth: 0 },
|
|
1629
1853
|
children: [
|
|
1630
|
-
/* @__PURE__ */
|
|
1631
|
-
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(
|
|
1632
1856
|
IconButton,
|
|
1633
1857
|
{
|
|
1634
1858
|
"aria-label": t("menu"),
|
|
1635
1859
|
onClick: openMobileSidebar,
|
|
1636
1860
|
size: "small",
|
|
1637
1861
|
sx: { ml: -0.5 },
|
|
1638
|
-
children: /* @__PURE__ */
|
|
1862
|
+
children: /* @__PURE__ */ jsx13(MenuIcon, { fontSize: "small" })
|
|
1639
1863
|
}
|
|
1640
1864
|
) }) : null,
|
|
1641
|
-
beforeTitle ? /* @__PURE__ */
|
|
1642
|
-
/* @__PURE__ */
|
|
1643
|
-
|
|
1865
|
+
beforeTitle ? /* @__PURE__ */ jsx13(Box5, { sx: { display: "flex", alignItems: "center", flexShrink: 0 }, children: beforeTitle }) : null,
|
|
1866
|
+
/* @__PURE__ */ jsx13(
|
|
1867
|
+
Typography3,
|
|
1644
1868
|
{
|
|
1645
1869
|
variant: "h5",
|
|
1646
1870
|
sx: {
|
|
@@ -1652,17 +1876,17 @@ function MainHeader({ title, subtitle, details, error, beforeTitle, beforeSubtit
|
|
|
1652
1876
|
}
|
|
1653
1877
|
)
|
|
1654
1878
|
] }),
|
|
1655
|
-
actions ? /* @__PURE__ */
|
|
1879
|
+
actions ? /* @__PURE__ */ jsx13(Box5, { sx: { display: "flex", alignItems: "center", flexShrink: 0 }, children: actions }) : null
|
|
1656
1880
|
]
|
|
1657
1881
|
}
|
|
1658
1882
|
),
|
|
1659
|
-
subtitle && !details ? /* @__PURE__ */
|
|
1660
|
-
beforeSubtitle ? /* @__PURE__ */
|
|
1661
|
-
/* @__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 })
|
|
1662
1886
|
] }) : null,
|
|
1663
|
-
details ? /* @__PURE__ */
|
|
1664
|
-
/* @__PURE__ */
|
|
1665
|
-
|
|
1887
|
+
details ? /* @__PURE__ */ jsxs7(Stack5, { spacing: 0.5, children: [
|
|
1888
|
+
/* @__PURE__ */ jsxs7(
|
|
1889
|
+
Stack5,
|
|
1666
1890
|
{
|
|
1667
1891
|
direction: "row",
|
|
1668
1892
|
spacing: 0.5,
|
|
@@ -1670,18 +1894,18 @@ function MainHeader({ title, subtitle, details, error, beforeTitle, beforeSubtit
|
|
|
1670
1894
|
justifyContent: "space-between",
|
|
1671
1895
|
sx: { minWidth: 0 },
|
|
1672
1896
|
children: [
|
|
1673
|
-
/* @__PURE__ */
|
|
1674
|
-
beforeSubtitle ? /* @__PURE__ */
|
|
1675
|
-
/* @__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 })
|
|
1676
1900
|
] }),
|
|
1677
|
-
/* @__PURE__ */
|
|
1901
|
+
/* @__PURE__ */ jsx13(
|
|
1678
1902
|
IconButton,
|
|
1679
1903
|
{
|
|
1680
1904
|
"aria-label": isDetailsOpen ? t("hide_details") : t("show_details"),
|
|
1681
1905
|
onClick: () => setIsDetailsOpen((current) => !current),
|
|
1682
1906
|
size: "small",
|
|
1683
1907
|
sx: { mr: -0.5 },
|
|
1684
|
-
children: /* @__PURE__ */
|
|
1908
|
+
children: /* @__PURE__ */ jsx13(
|
|
1685
1909
|
ExpandMoreIcon3,
|
|
1686
1910
|
{
|
|
1687
1911
|
fontSize: "small",
|
|
@@ -1696,10 +1920,10 @@ function MainHeader({ title, subtitle, details, error, beforeTitle, beforeSubtit
|
|
|
1696
1920
|
]
|
|
1697
1921
|
}
|
|
1698
1922
|
),
|
|
1699
|
-
/* @__PURE__ */
|
|
1923
|
+
/* @__PURE__ */ jsx13(Collapse, { in: isDetailsOpen, children: /* @__PURE__ */ jsx13(Box5, { sx: { pt: 0.5 }, children: details }) })
|
|
1700
1924
|
] }) : null
|
|
1701
1925
|
] }),
|
|
1702
|
-
error ? /* @__PURE__ */
|
|
1926
|
+
error ? /* @__PURE__ */ jsx13(Alert2, { severity: "error", sx: { mt: 2 }, children: error }) : null
|
|
1703
1927
|
]
|
|
1704
1928
|
}
|
|
1705
1929
|
);
|
|
@@ -1708,8 +1932,8 @@ function MainHeaderSkeleton({
|
|
|
1708
1932
|
titleWidth = 240,
|
|
1709
1933
|
subtitleWidth = "40%"
|
|
1710
1934
|
}) {
|
|
1711
|
-
return /* @__PURE__ */
|
|
1712
|
-
|
|
1935
|
+
return /* @__PURE__ */ jsx13(
|
|
1936
|
+
Paper3,
|
|
1713
1937
|
{
|
|
1714
1938
|
sx: {
|
|
1715
1939
|
px: { xs: 1.5, sm: MAIN_HEADER_PADDING_X },
|
|
@@ -1721,8 +1945,8 @@ function MainHeaderSkeleton({
|
|
|
1721
1945
|
top: 0,
|
|
1722
1946
|
zIndex: 3
|
|
1723
1947
|
},
|
|
1724
|
-
children: /* @__PURE__ */
|
|
1725
|
-
/* @__PURE__ */
|
|
1948
|
+
children: /* @__PURE__ */ jsxs7(Stack5, { spacing: 1, children: [
|
|
1949
|
+
/* @__PURE__ */ jsx13(
|
|
1726
1950
|
Skeleton,
|
|
1727
1951
|
{
|
|
1728
1952
|
variant: "rounded",
|
|
@@ -1731,7 +1955,7 @@ function MainHeaderSkeleton({
|
|
|
1731
1955
|
sx: { transform: "none" }
|
|
1732
1956
|
}
|
|
1733
1957
|
),
|
|
1734
|
-
/* @__PURE__ */
|
|
1958
|
+
/* @__PURE__ */ jsx13(
|
|
1735
1959
|
Skeleton,
|
|
1736
1960
|
{
|
|
1737
1961
|
variant: "rounded",
|
|
@@ -1746,14 +1970,14 @@ function MainHeaderSkeleton({
|
|
|
1746
1970
|
}
|
|
1747
1971
|
|
|
1748
1972
|
// src/components/OverviewPage.tsx
|
|
1749
|
-
import { jsx as
|
|
1973
|
+
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1750
1974
|
var cachedModelsResponse = null;
|
|
1751
1975
|
var inFlightModelsRequest = null;
|
|
1752
1976
|
function OverviewPage({ client, basePath }) {
|
|
1753
1977
|
const t = useAdminTranslation();
|
|
1754
1978
|
useAdminDocumentTitle(t("admin_title"), t("overview_title"));
|
|
1755
1979
|
const adminData = useAdminData();
|
|
1756
|
-
const shellModelsResponse =
|
|
1980
|
+
const shellModelsResponse = useMemo7(() => {
|
|
1757
1981
|
if (adminData.models.length === 0 && adminData.blocks.length === 0) {
|
|
1758
1982
|
return null;
|
|
1759
1983
|
}
|
|
@@ -1763,10 +1987,10 @@ function OverviewPage({ client, basePath }) {
|
|
|
1763
1987
|
blocks: adminData.blocks
|
|
1764
1988
|
};
|
|
1765
1989
|
}, [adminData.blocks, adminData.locale, adminData.models]);
|
|
1766
|
-
const [data, setData] =
|
|
1767
|
-
const [error, setError] =
|
|
1768
|
-
const [isLoading, setIsLoading] =
|
|
1769
|
-
|
|
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(() => {
|
|
1770
1994
|
let isMounted = true;
|
|
1771
1995
|
if (shellModelsResponse !== null) {
|
|
1772
1996
|
cachedModelsResponse = shellModelsResponse;
|
|
@@ -1806,21 +2030,21 @@ function OverviewPage({ client, basePath }) {
|
|
|
1806
2030
|
};
|
|
1807
2031
|
}, [client, shellModelsResponse, t]);
|
|
1808
2032
|
if (isLoading && !data) {
|
|
1809
|
-
return /* @__PURE__ */
|
|
2033
|
+
return /* @__PURE__ */ jsx14(OverviewPageSkeleton, {});
|
|
1810
2034
|
}
|
|
1811
2035
|
if (error || !data) {
|
|
1812
|
-
return /* @__PURE__ */
|
|
2036
|
+
return /* @__PURE__ */ jsx14(Alert3, { severity: "error", children: error || t("models_load_error") });
|
|
1813
2037
|
}
|
|
1814
|
-
return /* @__PURE__ */
|
|
1815
|
-
/* @__PURE__ */
|
|
2038
|
+
return /* @__PURE__ */ jsxs8(Stack6, { spacing: 1.5, sx: { height: "100%", minHeight: 0 }, children: [
|
|
2039
|
+
/* @__PURE__ */ jsx14(
|
|
1816
2040
|
MainHeader,
|
|
1817
2041
|
{
|
|
1818
2042
|
title: t("overview_title"),
|
|
1819
2043
|
subtitle: t("overview_subtitle")
|
|
1820
2044
|
}
|
|
1821
2045
|
),
|
|
1822
|
-
/* @__PURE__ */
|
|
1823
|
-
|
|
2046
|
+
/* @__PURE__ */ jsx14(
|
|
2047
|
+
Paper4,
|
|
1824
2048
|
{
|
|
1825
2049
|
sx: {
|
|
1826
2050
|
borderRadius: "10px",
|
|
@@ -1830,7 +2054,7 @@ function OverviewPage({ client, basePath }) {
|
|
|
1830
2054
|
display: "flex",
|
|
1831
2055
|
flexDirection: "column"
|
|
1832
2056
|
},
|
|
1833
|
-
children: /* @__PURE__ */
|
|
2057
|
+
children: /* @__PURE__ */ jsx14(Box6, { sx: { flex: 1, minHeight: 0, overflow: "auto", p: 2 }, children: /* @__PURE__ */ jsx14(
|
|
1834
2058
|
ModelsBlocks,
|
|
1835
2059
|
{
|
|
1836
2060
|
models: data.items,
|
|
@@ -1844,10 +2068,10 @@ function OverviewPage({ client, basePath }) {
|
|
|
1844
2068
|
] });
|
|
1845
2069
|
}
|
|
1846
2070
|
function OverviewPageSkeleton() {
|
|
1847
|
-
return /* @__PURE__ */
|
|
1848
|
-
/* @__PURE__ */
|
|
1849
|
-
/* @__PURE__ */
|
|
1850
|
-
|
|
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,
|
|
1851
2075
|
{
|
|
1852
2076
|
sx: {
|
|
1853
2077
|
borderRadius: "10px",
|
|
@@ -1857,9 +2081,9 @@ function OverviewPageSkeleton() {
|
|
|
1857
2081
|
display: "flex",
|
|
1858
2082
|
flexDirection: "column"
|
|
1859
2083
|
},
|
|
1860
|
-
children: /* @__PURE__ */
|
|
1861
|
-
/* @__PURE__ */
|
|
1862
|
-
/* @__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 })
|
|
1863
2087
|
] }) }) }, index)) }) })
|
|
1864
2088
|
}
|
|
1865
2089
|
)
|
|
@@ -1874,7 +2098,7 @@ import ExpandMoreIcon4 from "@mui/icons-material/ExpandMore";
|
|
|
1874
2098
|
import FilterListIcon from "@mui/icons-material/FilterList";
|
|
1875
2099
|
import {
|
|
1876
2100
|
Alert as Alert5,
|
|
1877
|
-
Box as
|
|
2101
|
+
Box as Box10,
|
|
1878
2102
|
Button as Button4,
|
|
1879
2103
|
Checkbox as Checkbox2,
|
|
1880
2104
|
Dialog as Dialog3,
|
|
@@ -1884,8 +2108,8 @@ import {
|
|
|
1884
2108
|
InputBase,
|
|
1885
2109
|
Menu,
|
|
1886
2110
|
MenuItem as MenuItem2,
|
|
1887
|
-
Paper as
|
|
1888
|
-
Stack as
|
|
2111
|
+
Paper as Paper7,
|
|
2112
|
+
Stack as Stack10,
|
|
1889
2113
|
Table,
|
|
1890
2114
|
TableBody,
|
|
1891
2115
|
TableCell as TableCell2,
|
|
@@ -1893,25 +2117,25 @@ import {
|
|
|
1893
2117
|
TableRow as TableRow2,
|
|
1894
2118
|
TableSortLabel,
|
|
1895
2119
|
Tooltip,
|
|
1896
|
-
Typography as
|
|
2120
|
+
Typography as Typography6,
|
|
1897
2121
|
useMediaQuery as useMediaQuery2
|
|
1898
2122
|
} from "@mui/material";
|
|
1899
|
-
import { useTheme as
|
|
2123
|
+
import { useTheme as useTheme3 } from "@mui/material/styles";
|
|
1900
2124
|
|
|
1901
2125
|
// src/components/DeletePreviewDialog.tsx
|
|
1902
2126
|
import {
|
|
1903
2127
|
Alert as Alert4,
|
|
1904
|
-
Box as
|
|
2128
|
+
Box as Box7,
|
|
1905
2129
|
Button as Button2,
|
|
1906
2130
|
CircularProgress as CircularProgress2,
|
|
1907
2131
|
Dialog as Dialog2,
|
|
1908
2132
|
DialogActions as DialogActions2,
|
|
1909
2133
|
DialogContent as DialogContent2,
|
|
1910
2134
|
DialogTitle as DialogTitle2,
|
|
1911
|
-
Stack as
|
|
1912
|
-
Typography as
|
|
2135
|
+
Stack as Stack7,
|
|
2136
|
+
Typography as Typography4
|
|
1913
2137
|
} from "@mui/material";
|
|
1914
|
-
import { jsx as
|
|
2138
|
+
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1915
2139
|
function DeletePreviewDialog({
|
|
1916
2140
|
open,
|
|
1917
2141
|
title,
|
|
@@ -1923,7 +2147,7 @@ function DeletePreviewDialog({
|
|
|
1923
2147
|
onConfirm
|
|
1924
2148
|
}) {
|
|
1925
2149
|
const t = useAdminTranslation();
|
|
1926
|
-
return /* @__PURE__ */
|
|
2150
|
+
return /* @__PURE__ */ jsxs9(
|
|
1927
2151
|
Dialog2,
|
|
1928
2152
|
{
|
|
1929
2153
|
open,
|
|
@@ -1945,27 +2169,27 @@ function DeletePreviewDialog({
|
|
|
1945
2169
|
}
|
|
1946
2170
|
},
|
|
1947
2171
|
children: [
|
|
1948
|
-
/* @__PURE__ */
|
|
1949
|
-
/* @__PURE__ */
|
|
1950
|
-
isLoading ? /* @__PURE__ */
|
|
1951
|
-
/* @__PURE__ */
|
|
1952
|
-
/* @__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") })
|
|
1953
2177
|
] }) : null,
|
|
1954
|
-
!isLoading && error ? /* @__PURE__ */
|
|
1955
|
-
!isLoading && !error && preview ? /* @__PURE__ */
|
|
1956
|
-
/* @__PURE__ */
|
|
1957
|
-
!preview.can_delete ? /* @__PURE__ */
|
|
1958
|
-
/* @__PURE__ */
|
|
1959
|
-
/* @__PURE__ */
|
|
1960
|
-
/* @__PURE__ */
|
|
1961
|
-
/* @__PURE__ */
|
|
1962
|
-
/* @__PURE__ */
|
|
1963
|
-
/* @__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 }) })
|
|
1964
2188
|
] }),
|
|
1965
|
-
preview.summary.delete === 0 && preview.summary.protect === 0 && preview.summary.set_null === 0 ? /* @__PURE__ */
|
|
1966
|
-
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) => {
|
|
1967
2191
|
var _a;
|
|
1968
|
-
return /* @__PURE__ */
|
|
2192
|
+
return /* @__PURE__ */ jsx15(
|
|
1969
2193
|
DeletePreviewNode,
|
|
1970
2194
|
{
|
|
1971
2195
|
node: rootNode,
|
|
@@ -1973,8 +2197,8 @@ function DeletePreviewDialog({
|
|
|
1973
2197
|
},
|
|
1974
2198
|
`${(_a = rootNode.model_slug) != null ? _a : "model"}:${rootNode.id}:${index}`
|
|
1975
2199
|
);
|
|
1976
|
-
}) }) : /* @__PURE__ */
|
|
1977
|
-
|
|
2200
|
+
}) }) : /* @__PURE__ */ jsx15(
|
|
2201
|
+
Typography4,
|
|
1978
2202
|
{
|
|
1979
2203
|
variant: "body2",
|
|
1980
2204
|
color: "text.secondary",
|
|
@@ -1983,9 +2207,9 @@ function DeletePreviewDialog({
|
|
|
1983
2207
|
)
|
|
1984
2208
|
] }) : null
|
|
1985
2209
|
] }),
|
|
1986
|
-
/* @__PURE__ */
|
|
1987
|
-
/* @__PURE__ */
|
|
1988
|
-
/* @__PURE__ */
|
|
2210
|
+
/* @__PURE__ */ jsxs9(DialogActions2, { children: [
|
|
2211
|
+
/* @__PURE__ */ jsx15(Button2, { onClick: onClose, disabled: isSubmitting, children: t("cancel") }),
|
|
2212
|
+
/* @__PURE__ */ jsx15(
|
|
1989
2213
|
Button2,
|
|
1990
2214
|
{
|
|
1991
2215
|
color: "error",
|
|
@@ -2002,8 +2226,8 @@ function DeletePreviewDialog({
|
|
|
2002
2226
|
}
|
|
2003
2227
|
function DeletePreviewNode({ node, depth }) {
|
|
2004
2228
|
const t = useAdminTranslation();
|
|
2005
|
-
return /* @__PURE__ */
|
|
2006
|
-
|
|
2229
|
+
return /* @__PURE__ */ jsxs9(
|
|
2230
|
+
Box7,
|
|
2007
2231
|
{
|
|
2008
2232
|
sx: {
|
|
2009
2233
|
pl: depth === 0 ? 0 : 1.5,
|
|
@@ -2011,17 +2235,17 @@ function DeletePreviewNode({ node, depth }) {
|
|
|
2011
2235
|
borderLeft: depth === 0 ? "none" : "1px solid rgba(255, 255, 255, 0.08)"
|
|
2012
2236
|
},
|
|
2013
2237
|
children: [
|
|
2014
|
-
/* @__PURE__ */
|
|
2015
|
-
/* @__PURE__ */
|
|
2016
|
-
/* @__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: [
|
|
2017
2241
|
node.model_title,
|
|
2018
2242
|
node.relation_name ? ` \u2022 ${node.relation_name}` : "",
|
|
2019
2243
|
` \u2022 ${getEffectLabel(node.effect, t)}`
|
|
2020
2244
|
] })
|
|
2021
2245
|
] }),
|
|
2022
|
-
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) => {
|
|
2023
2247
|
var _a;
|
|
2024
|
-
return /* @__PURE__ */
|
|
2248
|
+
return /* @__PURE__ */ jsx15(
|
|
2025
2249
|
DeletePreviewNode,
|
|
2026
2250
|
{
|
|
2027
2251
|
node: childNode,
|
|
@@ -2045,19 +2269,19 @@ function getEffectLabel(effect, t) {
|
|
|
2045
2269
|
}
|
|
2046
2270
|
|
|
2047
2271
|
// src/components/model-page/ListFiltersBar.tsx
|
|
2048
|
-
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";
|
|
2049
2273
|
import {
|
|
2050
2274
|
Autocomplete as Autocomplete2,
|
|
2051
2275
|
Button as Button3,
|
|
2052
2276
|
CircularProgress as CircularProgress3,
|
|
2053
2277
|
Divider,
|
|
2054
2278
|
MenuItem,
|
|
2055
|
-
Paper as
|
|
2056
|
-
Stack as
|
|
2279
|
+
Paper as Paper5,
|
|
2280
|
+
Stack as Stack8,
|
|
2057
2281
|
TextField as TextField2,
|
|
2058
|
-
Typography as
|
|
2282
|
+
Typography as Typography5
|
|
2059
2283
|
} from "@mui/material";
|
|
2060
|
-
import { Fragment as Fragment2, jsx as
|
|
2284
|
+
import { Fragment as Fragment2, jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2061
2285
|
var ListFiltersSidebar = memo3(function ListFiltersSidebar2({
|
|
2062
2286
|
client,
|
|
2063
2287
|
slug,
|
|
@@ -2068,7 +2292,7 @@ var ListFiltersSidebar = memo3(function ListFiltersSidebar2({
|
|
|
2068
2292
|
debounceMs = 300
|
|
2069
2293
|
}) {
|
|
2070
2294
|
const t = useAdminTranslation();
|
|
2071
|
-
const filterGroups =
|
|
2295
|
+
const filterGroups = useMemo8(() => {
|
|
2072
2296
|
var _a, _b;
|
|
2073
2297
|
const groupedFilters = /* @__PURE__ */ new Map();
|
|
2074
2298
|
for (const filter of filters) {
|
|
@@ -2087,13 +2311,13 @@ var ListFiltersSidebar = memo3(function ListFiltersSidebar2({
|
|
|
2087
2311
|
}
|
|
2088
2312
|
return Array.from(groupedFilters.values());
|
|
2089
2313
|
}, [filters]);
|
|
2090
|
-
const activeFiltersCount =
|
|
2314
|
+
const activeFiltersCount = useMemo8(
|
|
2091
2315
|
() => filters.filter((filter) => Boolean(values[filter.slug])).length,
|
|
2092
2316
|
[filters, values]
|
|
2093
2317
|
);
|
|
2094
2318
|
if (filters.length === 0) return null;
|
|
2095
|
-
return /* @__PURE__ */
|
|
2096
|
-
|
|
2319
|
+
return /* @__PURE__ */ jsx16(
|
|
2320
|
+
Paper5,
|
|
2097
2321
|
{
|
|
2098
2322
|
sx: {
|
|
2099
2323
|
width: { xs: "100%", lg: 288 },
|
|
@@ -2104,13 +2328,13 @@ var ListFiltersSidebar = memo3(function ListFiltersSidebar2({
|
|
|
2104
2328
|
p: 1.5,
|
|
2105
2329
|
overflow: "auto"
|
|
2106
2330
|
},
|
|
2107
|
-
children: /* @__PURE__ */
|
|
2108
|
-
/* @__PURE__ */
|
|
2109
|
-
/* @__PURE__ */
|
|
2110
|
-
/* @__PURE__ */
|
|
2111
|
-
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
|
|
2112
2336
|
] }),
|
|
2113
|
-
/* @__PURE__ */
|
|
2337
|
+
/* @__PURE__ */ jsx16(
|
|
2114
2338
|
Button3,
|
|
2115
2339
|
{
|
|
2116
2340
|
size: "small",
|
|
@@ -2121,8 +2345,8 @@ var ListFiltersSidebar = memo3(function ListFiltersSidebar2({
|
|
|
2121
2345
|
}
|
|
2122
2346
|
)
|
|
2123
2347
|
] }),
|
|
2124
|
-
/* @__PURE__ */
|
|
2125
|
-
filterGroups.map((group) => /* @__PURE__ */
|
|
2348
|
+
/* @__PURE__ */ jsx16(Divider, {}),
|
|
2349
|
+
filterGroups.map((group) => /* @__PURE__ */ jsx16(
|
|
2126
2350
|
FilterGroupSection,
|
|
2127
2351
|
{
|
|
2128
2352
|
client,
|
|
@@ -2139,11 +2363,11 @@ var ListFiltersSidebar = memo3(function ListFiltersSidebar2({
|
|
|
2139
2363
|
);
|
|
2140
2364
|
});
|
|
2141
2365
|
function FilterGroupSection({ client, slug, group, values, onChange, debounceMs }) {
|
|
2142
|
-
return /* @__PURE__ */
|
|
2143
|
-
/* @__PURE__ */
|
|
2144
|
-
/* @__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) => {
|
|
2145
2369
|
var _a;
|
|
2146
|
-
return /* @__PURE__ */
|
|
2370
|
+
return /* @__PURE__ */ jsx16(
|
|
2147
2371
|
ListFilterField,
|
|
2148
2372
|
{
|
|
2149
2373
|
client,
|
|
@@ -2161,15 +2385,17 @@ function FilterGroupSection({ client, slug, group, values, onChange, debounceMs
|
|
|
2161
2385
|
function ListFilterField({ client, slug, filter, value, onChange, debounceMs }) {
|
|
2162
2386
|
var _a, _b;
|
|
2163
2387
|
const t = useAdminTranslation();
|
|
2164
|
-
const [draftValue, setDraftValue] =
|
|
2165
|
-
const [searchValue, setSearchValue] =
|
|
2166
|
-
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(
|
|
2167
2393
|
async (signal) => {
|
|
2168
2394
|
const response = await client.getFilterChoices(
|
|
2169
2395
|
slug,
|
|
2170
2396
|
filter.slug,
|
|
2171
2397
|
searchValue || void 0,
|
|
2172
|
-
|
|
2398
|
+
selectedValues.length > 0 ? selectedValues : void 0,
|
|
2173
2399
|
{ signal }
|
|
2174
2400
|
);
|
|
2175
2401
|
return response.items.map((item) => ({
|
|
@@ -2177,23 +2403,23 @@ function ListFilterField({ client, slug, filter, value, onChange, debounceMs })
|
|
|
2177
2403
|
label: item.label
|
|
2178
2404
|
}));
|
|
2179
2405
|
},
|
|
2180
|
-
[client, filter.slug, searchValue,
|
|
2406
|
+
[client, filter.slug, searchValue, selectedValues, slug]
|
|
2181
2407
|
);
|
|
2182
2408
|
const { items: options, isLoading: isLoadingChoices } = useRemoteChoices({
|
|
2183
|
-
enabled: filter.has_choices &&
|
|
2409
|
+
enabled: filter.has_choices && isSelectFilter,
|
|
2184
2410
|
debounceMs,
|
|
2185
2411
|
initialItems: filter.options,
|
|
2186
2412
|
resetKey: `${slug}:${filter.slug}`,
|
|
2187
2413
|
queryKey: `${slug}:${filter.slug}:${searchValue}:${value}`,
|
|
2188
2414
|
load: loadChoices
|
|
2189
2415
|
});
|
|
2190
|
-
|
|
2416
|
+
useEffect8(() => {
|
|
2191
2417
|
setDraftValue(value);
|
|
2192
2418
|
}, [value]);
|
|
2193
|
-
|
|
2419
|
+
useEffect8(() => {
|
|
2194
2420
|
setSearchValue("");
|
|
2195
2421
|
}, [filter.slug]);
|
|
2196
|
-
|
|
2422
|
+
useEffect8(() => {
|
|
2197
2423
|
if (filter.input_kind !== "text") {
|
|
2198
2424
|
return;
|
|
2199
2425
|
}
|
|
@@ -2207,7 +2433,7 @@ function ListFilterField({ client, slug, filter, value, onChange, debounceMs })
|
|
|
2207
2433
|
};
|
|
2208
2434
|
}, [debounceMs, draftValue, filter.input_kind, filter.slug, onChange, value]);
|
|
2209
2435
|
if (filter.input_kind === "boolean") {
|
|
2210
|
-
return /* @__PURE__ */
|
|
2436
|
+
return /* @__PURE__ */ jsxs10(
|
|
2211
2437
|
TextField2,
|
|
2212
2438
|
{
|
|
2213
2439
|
select: true,
|
|
@@ -2217,21 +2443,27 @@ function ListFilterField({ client, slug, filter, value, onChange, debounceMs })
|
|
|
2217
2443
|
value,
|
|
2218
2444
|
onChange: (event) => onChange(filter.slug, event.target.value),
|
|
2219
2445
|
children: [
|
|
2220
|
-
/* @__PURE__ */
|
|
2221
|
-
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}`))
|
|
2222
2448
|
]
|
|
2223
2449
|
}
|
|
2224
2450
|
);
|
|
2225
2451
|
}
|
|
2226
|
-
if (
|
|
2227
|
-
const
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
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(
|
|
2232
2462
|
Autocomplete2,
|
|
2233
2463
|
{
|
|
2234
2464
|
options,
|
|
2465
|
+
multiple: filter.multiple,
|
|
2466
|
+
disableCloseOnSelect: filter.multiple,
|
|
2235
2467
|
value: selectedOption,
|
|
2236
2468
|
loading: isLoadingChoices,
|
|
2237
2469
|
filterOptions: (items) => items,
|
|
@@ -2240,14 +2472,19 @@ function ListFilterField({ client, slug, filter, value, onChange, debounceMs })
|
|
|
2240
2472
|
isOptionEqualToValue: (option, selected) => option.value === selected.value,
|
|
2241
2473
|
getOptionLabel: (option) => option.label,
|
|
2242
2474
|
onChange: (_, nextValue) => {
|
|
2243
|
-
var _a2;
|
|
2244
|
-
|
|
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 : "");
|
|
2245
2482
|
},
|
|
2246
2483
|
onInputChange: (_, nextInputValue) => setSearchValue(nextInputValue),
|
|
2247
2484
|
renderInput: (params) => (() => {
|
|
2248
2485
|
var _a2;
|
|
2249
2486
|
const { InputProps, inputProps, ...textFieldParams } = params;
|
|
2250
|
-
return /* @__PURE__ */
|
|
2487
|
+
return /* @__PURE__ */ jsx16(
|
|
2251
2488
|
TextField2,
|
|
2252
2489
|
{
|
|
2253
2490
|
...textFieldParams,
|
|
@@ -2256,8 +2493,8 @@ function ListFilterField({ client, slug, filter, value, onChange, debounceMs })
|
|
|
2256
2493
|
slotProps: {
|
|
2257
2494
|
input: {
|
|
2258
2495
|
...InputProps,
|
|
2259
|
-
endAdornment: /* @__PURE__ */
|
|
2260
|
-
isLoadingChoices ? /* @__PURE__ */
|
|
2496
|
+
endAdornment: /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
2497
|
+
isLoadingChoices ? /* @__PURE__ */ jsx16(CircularProgress3, { color: "inherit", size: 16 }) : null,
|
|
2261
2498
|
InputProps.endAdornment
|
|
2262
2499
|
] })
|
|
2263
2500
|
},
|
|
@@ -2269,7 +2506,7 @@ function ListFilterField({ client, slug, filter, value, onChange, debounceMs })
|
|
|
2269
2506
|
}
|
|
2270
2507
|
);
|
|
2271
2508
|
}
|
|
2272
|
-
return /* @__PURE__ */
|
|
2509
|
+
return /* @__PURE__ */ jsx16(
|
|
2273
2510
|
TextField2,
|
|
2274
2511
|
{
|
|
2275
2512
|
size: "small",
|
|
@@ -2281,12 +2518,21 @@ function ListFilterField({ client, slug, filter, value, onChange, debounceMs })
|
|
|
2281
2518
|
}
|
|
2282
2519
|
);
|
|
2283
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
|
+
}
|
|
2284
2530
|
|
|
2285
2531
|
// src/components/model-page/ListRow.tsx
|
|
2286
2532
|
import { memo as memo4 } from "react";
|
|
2287
2533
|
import MoreVertIcon from "@mui/icons-material/MoreVert";
|
|
2288
|
-
import { Box as
|
|
2289
|
-
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";
|
|
2290
2536
|
var ListRow = memo4(function ListRow2({
|
|
2291
2537
|
row,
|
|
2292
2538
|
pkField,
|
|
@@ -2302,7 +2548,7 @@ var ListRow = memo4(function ListRow2({
|
|
|
2302
2548
|
const checkboxColumnWidth = 56;
|
|
2303
2549
|
const actionsColumnWidth = 56;
|
|
2304
2550
|
const rowId = row[pkField];
|
|
2305
|
-
return /* @__PURE__ */
|
|
2551
|
+
return /* @__PURE__ */ jsxs11(
|
|
2306
2552
|
TableRow,
|
|
2307
2553
|
{
|
|
2308
2554
|
hover: true,
|
|
@@ -2316,7 +2562,7 @@ var ListRow = memo4(function ListRow2({
|
|
|
2316
2562
|
}
|
|
2317
2563
|
},
|
|
2318
2564
|
children: [
|
|
2319
|
-
/* @__PURE__ */
|
|
2565
|
+
/* @__PURE__ */ jsx17(
|
|
2320
2566
|
TableCell,
|
|
2321
2567
|
{
|
|
2322
2568
|
padding: "none",
|
|
@@ -2328,7 +2574,7 @@ var ListRow = memo4(function ListRow2({
|
|
|
2328
2574
|
textAlign: "center",
|
|
2329
2575
|
px: 1
|
|
2330
2576
|
},
|
|
2331
|
-
children: /* @__PURE__ */
|
|
2577
|
+
children: /* @__PURE__ */ jsx17(
|
|
2332
2578
|
Checkbox,
|
|
2333
2579
|
{
|
|
2334
2580
|
checked: isSelected,
|
|
@@ -2353,8 +2599,8 @@ var ListRow = memo4(function ListRow2({
|
|
|
2353
2599
|
textOverflow: "ellipsis"
|
|
2354
2600
|
};
|
|
2355
2601
|
if (imageUrl) {
|
|
2356
|
-
return /* @__PURE__ */
|
|
2357
|
-
|
|
2602
|
+
return /* @__PURE__ */ jsx17(TableCell, { title: fullFieldValue, sx: { ...commonCellSx, py: 0.75 }, children: /* @__PURE__ */ jsx17(
|
|
2603
|
+
Box8,
|
|
2358
2604
|
{
|
|
2359
2605
|
component: "img",
|
|
2360
2606
|
src: imageUrl,
|
|
@@ -2371,7 +2617,7 @@ var ListRow = memo4(function ListRow2({
|
|
|
2371
2617
|
) }, fieldName);
|
|
2372
2618
|
}
|
|
2373
2619
|
if (index === 0) {
|
|
2374
|
-
return /* @__PURE__ */
|
|
2620
|
+
return /* @__PURE__ */ jsx17(
|
|
2375
2621
|
TableCell,
|
|
2376
2622
|
{
|
|
2377
2623
|
title: fullFieldValue,
|
|
@@ -2389,7 +2635,7 @@ var ListRow = memo4(function ListRow2({
|
|
|
2389
2635
|
color: "primary.main"
|
|
2390
2636
|
}
|
|
2391
2637
|
},
|
|
2392
|
-
children: /* @__PURE__ */
|
|
2638
|
+
children: /* @__PURE__ */ jsx17(
|
|
2393
2639
|
NavLink,
|
|
2394
2640
|
{
|
|
2395
2641
|
href: `${basePath}/${slug}/${rowId}`,
|
|
@@ -2402,9 +2648,9 @@ var ListRow = memo4(function ListRow2({
|
|
|
2402
2648
|
fieldName
|
|
2403
2649
|
);
|
|
2404
2650
|
}
|
|
2405
|
-
return /* @__PURE__ */
|
|
2651
|
+
return /* @__PURE__ */ jsx17(TableCell, { title: fullFieldValue, sx: commonCellSx, children: fieldValue }, fieldName);
|
|
2406
2652
|
}),
|
|
2407
|
-
/* @__PURE__ */
|
|
2653
|
+
/* @__PURE__ */ jsx17(
|
|
2408
2654
|
TableCell,
|
|
2409
2655
|
{
|
|
2410
2656
|
align: "right",
|
|
@@ -2413,7 +2659,7 @@ var ListRow = memo4(function ListRow2({
|
|
|
2413
2659
|
minWidth: actionsColumnWidth,
|
|
2414
2660
|
maxWidth: actionsColumnWidth
|
|
2415
2661
|
},
|
|
2416
|
-
children: /* @__PURE__ */
|
|
2662
|
+
children: /* @__PURE__ */ jsx17(IconButton2, { size: "small", onClick: (event) => onOpenMenu(event, rowId), children: /* @__PURE__ */ jsx17(MoreVertIcon, { fontSize: "small" }) })
|
|
2417
2663
|
}
|
|
2418
2664
|
)
|
|
2419
2665
|
]
|
|
@@ -2422,20 +2668,20 @@ var ListRow = memo4(function ListRow2({
|
|
|
2422
2668
|
});
|
|
2423
2669
|
|
|
2424
2670
|
// src/components/model-page/SearchField.tsx
|
|
2425
|
-
import { memo as memo5, useEffect as
|
|
2671
|
+
import { memo as memo5, useEffect as useEffect9, useState as useState9 } from "react";
|
|
2426
2672
|
import { TextField as TextField3 } from "@mui/material";
|
|
2427
|
-
import { jsx as
|
|
2673
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
2428
2674
|
var SearchField = memo5(function SearchField2({
|
|
2429
2675
|
value,
|
|
2430
2676
|
onCommit,
|
|
2431
2677
|
debounceMs,
|
|
2432
2678
|
placeholder
|
|
2433
2679
|
}) {
|
|
2434
|
-
const [draftValue, setDraftValue] =
|
|
2435
|
-
|
|
2680
|
+
const [draftValue, setDraftValue] = useState9(value);
|
|
2681
|
+
useEffect9(() => {
|
|
2436
2682
|
setDraftValue(value);
|
|
2437
2683
|
}, [value]);
|
|
2438
|
-
|
|
2684
|
+
useEffect9(() => {
|
|
2439
2685
|
const timerId = window.setTimeout(() => {
|
|
2440
2686
|
if (draftValue !== value) {
|
|
2441
2687
|
onCommit(draftValue);
|
|
@@ -2445,7 +2691,7 @@ var SearchField = memo5(function SearchField2({
|
|
|
2445
2691
|
window.clearTimeout(timerId);
|
|
2446
2692
|
};
|
|
2447
2693
|
}, [debounceMs, draftValue, onCommit, value]);
|
|
2448
|
-
return /* @__PURE__ */
|
|
2694
|
+
return /* @__PURE__ */ jsx18(
|
|
2449
2695
|
TextField3,
|
|
2450
2696
|
{
|
|
2451
2697
|
size: "small",
|
|
@@ -2464,7 +2710,7 @@ var SearchField = memo5(function SearchField2({
|
|
|
2464
2710
|
});
|
|
2465
2711
|
|
|
2466
2712
|
// src/components/model-page/useModelPageController.ts
|
|
2467
|
-
import { useCallback as
|
|
2713
|
+
import { useCallback as useCallback5, useEffect as useEffect10, useMemo as useMemo9, useRef as useRef4, useState as useState10 } from "react";
|
|
2468
2714
|
|
|
2469
2715
|
// src/cache.ts
|
|
2470
2716
|
var MAX_CACHE_ENTRIES = 100;
|
|
@@ -2558,7 +2804,8 @@ function useModelPageController({
|
|
|
2558
2804
|
t
|
|
2559
2805
|
}) {
|
|
2560
2806
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
2561
|
-
const
|
|
2807
|
+
const message = useAdminMessage();
|
|
2808
|
+
const searchParams = useMemo9(() => new URLSearchParams(locationSearch), [locationSearch]);
|
|
2562
2809
|
const initialQuery = (_a = searchParams.get("q")) != null ? _a : "";
|
|
2563
2810
|
const initialSort = (_b = searchParams.get("sort")) != null ? _b : "";
|
|
2564
2811
|
const initialPage = parsePageParam(searchParams.get("page"));
|
|
@@ -2572,40 +2819,41 @@ function useModelPageController({
|
|
|
2572
2819
|
...initialFilters
|
|
2573
2820
|
})
|
|
2574
2821
|
)) != null ? _c : null;
|
|
2575
|
-
const [selectedIds, setSelectedIds] =
|
|
2576
|
-
const [isAllMatchingSelected, setIsAllMatchingSelected] =
|
|
2577
|
-
const [createOpen, setCreateOpen] =
|
|
2578
|
-
const [data, setData] =
|
|
2579
|
-
const [error, setError] =
|
|
2580
|
-
const [isLoading, setIsLoading] =
|
|
2581
|
-
const [rowActionMenuAnchor, setRowActionMenuAnchor] =
|
|
2582
|
-
const [rowActionMenuId, setRowActionMenuId] =
|
|
2583
|
-
const [bulkActionMenuAnchor, setBulkActionMenuAnchor] =
|
|
2584
|
-
const [appliedQuery, setAppliedQuery] =
|
|
2585
|
-
const [sortValue, setSortValue] =
|
|
2586
|
-
const [currentPage, setCurrentPage] =
|
|
2587
|
-
const [pageInput, setPageInput] =
|
|
2588
|
-
const [appliedFilters, setAppliedFilters] =
|
|
2589
|
-
const [deletePreviewOpen, setDeletePreviewOpen] =
|
|
2590
|
-
const [deletePreview, setDeletePreview] =
|
|
2591
|
-
const [deletePreviewError, setDeletePreviewError] =
|
|
2592
|
-
const [isDeletePreviewLoading, setIsDeletePreviewLoading] =
|
|
2593
|
-
const [isDeleteSubmitting, setIsDeleteSubmitting] =
|
|
2594
|
-
const [pendingDeleteIds, setPendingDeleteIds] =
|
|
2595
|
-
const [pendingDeleteSelectAll, setPendingDeleteSelectAll] =
|
|
2596
|
-
const [pendingDeleteScope, setPendingDeleteScope] =
|
|
2597
|
-
const [pendingDeleteMode, setPendingDeleteMode] =
|
|
2598
|
-
const [filtersOpen, setFiltersOpen] =
|
|
2599
|
-
const requestIdRef =
|
|
2600
|
-
const dataRef =
|
|
2601
|
-
const pageSizeRef =
|
|
2602
|
-
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]);
|
|
2603
2851
|
const meta = (_e = data == null ? void 0 : data.meta) != null ? _e : null;
|
|
2604
2852
|
const rows = (_f = data == null ? void 0 : data.items) != null ? _f : [];
|
|
2605
2853
|
const total = (_g = data == null ? void 0 : data.pagination.total) != null ? _g : 0;
|
|
2606
2854
|
const pageSize = (_h = meta == null ? void 0 : meta.page_size) != null ? _h : pageSizeRef.current;
|
|
2607
2855
|
const totalPages = Math.max(1, Math.ceil(total / pageSize));
|
|
2608
|
-
const fieldMap =
|
|
2856
|
+
const fieldMap = useMemo9(
|
|
2609
2857
|
() => {
|
|
2610
2858
|
var _a2;
|
|
2611
2859
|
return new Map(((_a2 = meta == null ? void 0 : meta.fields) != null ? _a2 : []).map((field) => [field.name, field]));
|
|
@@ -2616,14 +2864,14 @@ function useModelPageController({
|
|
|
2616
2864
|
const listFilters = (_j = meta == null ? void 0 : meta.list_filters) != null ? _j : [];
|
|
2617
2865
|
const hasListFilters = listFilters.length > 0;
|
|
2618
2866
|
const bulkActions = (_k = meta == null ? void 0 : meta.bulk_actions) != null ? _k : [];
|
|
2619
|
-
const selectionScope =
|
|
2867
|
+
const selectionScope = useMemo9(
|
|
2620
2868
|
() => ({
|
|
2621
2869
|
q: appliedQuery || void 0,
|
|
2622
2870
|
filters: { ...appliedFilters }
|
|
2623
2871
|
}),
|
|
2624
2872
|
[appliedFilters, appliedQuery]
|
|
2625
2873
|
);
|
|
2626
|
-
const selectedIdSet =
|
|
2874
|
+
const selectedIdSet = useMemo9(() => {
|
|
2627
2875
|
if (isAllMatchingSelected) {
|
|
2628
2876
|
return new Set(rows.map((row) => {
|
|
2629
2877
|
var _a2;
|
|
@@ -2642,13 +2890,53 @@ function useModelPageController({
|
|
|
2642
2890
|
});
|
|
2643
2891
|
const hasSelection = isAllMatchingSelected || selectedIds.length > 0;
|
|
2644
2892
|
const selectionCount = isAllMatchingSelected ? total : selectedIds.length;
|
|
2645
|
-
|
|
2893
|
+
useEffect10(() => {
|
|
2646
2894
|
dataRef.current = data;
|
|
2647
2895
|
}, [data]);
|
|
2648
|
-
|
|
2896
|
+
useEffect10(() => {
|
|
2649
2897
|
setPageInput(String(currentPage));
|
|
2650
2898
|
}, [currentPage]);
|
|
2651
|
-
|
|
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(() => {
|
|
2652
2940
|
var _a2, _b2;
|
|
2653
2941
|
const nextSearchParams = new URLSearchParams(locationSearch);
|
|
2654
2942
|
const nextQuery = (_a2 = nextSearchParams.get("q")) != null ? _a2 : "";
|
|
@@ -2661,11 +2949,11 @@ function useModelPageController({
|
|
|
2661
2949
|
setPageInput(String(nextPage));
|
|
2662
2950
|
setAppliedFilters(nextFilters);
|
|
2663
2951
|
}, [locationSearch]);
|
|
2664
|
-
const clearSelection =
|
|
2952
|
+
const clearSelection = useCallback5(() => {
|
|
2665
2953
|
setSelectedIds([]);
|
|
2666
2954
|
setIsAllMatchingSelected(false);
|
|
2667
2955
|
}, []);
|
|
2668
|
-
const loadItems =
|
|
2956
|
+
const loadItems = useCallback5(async () => {
|
|
2669
2957
|
var _a2;
|
|
2670
2958
|
const activeRequestId = requestIdRef.current + 1;
|
|
2671
2959
|
requestIdRef.current = activeRequestId;
|
|
@@ -2709,17 +2997,17 @@ function useModelPageController({
|
|
|
2709
2997
|
}
|
|
2710
2998
|
}
|
|
2711
2999
|
}, [appliedFilters, appliedQuery, client, currentPage, isAllMatchingSelected, slug, sortValue, t]);
|
|
2712
|
-
|
|
3000
|
+
useEffect10(() => {
|
|
2713
3001
|
void loadItems();
|
|
2714
3002
|
}, [loadItems]);
|
|
2715
|
-
const refresh =
|
|
3003
|
+
const refresh = useCallback5(async () => {
|
|
2716
3004
|
invalidateModelCache(client, slug);
|
|
2717
3005
|
await loadItems();
|
|
2718
3006
|
}, [client, loadItems, slug]);
|
|
2719
|
-
const replaceLocation =
|
|
3007
|
+
const replaceLocation = useCallback5((nextQuery, nextSort, nextPage, nextFilters) => {
|
|
2720
3008
|
router.replace(buildUrlWithParams(pathname, nextQuery, nextSort, nextPage, nextFilters));
|
|
2721
3009
|
}, [pathname, router]);
|
|
2722
|
-
const handleSearchCommit =
|
|
3010
|
+
const handleSearchCommit = useCallback5((nextQuery) => {
|
|
2723
3011
|
if (nextQuery === appliedQuery) {
|
|
2724
3012
|
return;
|
|
2725
3013
|
}
|
|
@@ -2729,17 +3017,17 @@ function useModelPageController({
|
|
|
2729
3017
|
setPageInput("1");
|
|
2730
3018
|
replaceLocation(nextQuery, sortValue, 1, appliedFilters);
|
|
2731
3019
|
}, [appliedFilters, appliedQuery, clearSelection, replaceLocation, sortValue]);
|
|
2732
|
-
const handlePageChange =
|
|
3020
|
+
const handlePageChange = useCallback5((nextPage) => {
|
|
2733
3021
|
const safePage = Math.min(Math.max(nextPage, 1), totalPages);
|
|
2734
3022
|
setCurrentPage(safePage);
|
|
2735
3023
|
setPageInput(String(safePage));
|
|
2736
3024
|
replaceLocation(appliedQuery, sortValue, safePage, appliedFilters);
|
|
2737
3025
|
}, [appliedFilters, appliedQuery, replaceLocation, sortValue, totalPages]);
|
|
2738
|
-
const handlePageInputCommit =
|
|
3026
|
+
const handlePageInputCommit = useCallback5(() => {
|
|
2739
3027
|
const parsedPage = parsePageParam(pageInput);
|
|
2740
3028
|
handlePageChange(parsedPage);
|
|
2741
3029
|
}, [handlePageChange, pageInput]);
|
|
2742
|
-
const toggleSort =
|
|
3030
|
+
const toggleSort = useCallback5((fieldName) => {
|
|
2743
3031
|
const nextSortFields = sortFields.filter((item) => item !== fieldName && item !== `-${fieldName}`);
|
|
2744
3032
|
const currentSort = sortFields.find((item) => item === fieldName || item === `-${fieldName}`);
|
|
2745
3033
|
if (currentSort === void 0) {
|
|
@@ -2755,7 +3043,7 @@ function useModelPageController({
|
|
|
2755
3043
|
setPageInput("1");
|
|
2756
3044
|
replaceLocation(appliedQuery, nextSortValue, 1, appliedFilters);
|
|
2757
3045
|
}, [appliedFilters, appliedQuery, replaceLocation, sortFields]);
|
|
2758
|
-
const handleFilterChange =
|
|
3046
|
+
const handleFilterChange = useCallback5((filterSlug, value) => {
|
|
2759
3047
|
const nextFilters = {
|
|
2760
3048
|
...appliedFilters,
|
|
2761
3049
|
[filterSlug]: value
|
|
@@ -2769,7 +3057,7 @@ function useModelPageController({
|
|
|
2769
3057
|
setPageInput("1");
|
|
2770
3058
|
replaceLocation(appliedQuery, sortValue, 1, nextFilters);
|
|
2771
3059
|
}, [appliedFilters, appliedQuery, clearSelection, replaceLocation, sortValue]);
|
|
2772
|
-
const handleResetFilters =
|
|
3060
|
+
const handleResetFilters = useCallback5(() => {
|
|
2773
3061
|
if (Object.keys(appliedFilters).length === 0) {
|
|
2774
3062
|
return;
|
|
2775
3063
|
}
|
|
@@ -2779,7 +3067,7 @@ function useModelPageController({
|
|
|
2779
3067
|
setPageInput("1");
|
|
2780
3068
|
replaceLocation(appliedQuery, sortValue, 1, {});
|
|
2781
3069
|
}, [appliedFilters, appliedQuery, clearSelection, replaceLocation, sortValue]);
|
|
2782
|
-
const openSingleDeletePreview =
|
|
3070
|
+
const openSingleDeletePreview = useCallback5(async (rowId) => {
|
|
2783
3071
|
setPendingDeleteIds([rowId]);
|
|
2784
3072
|
setPendingDeleteSelectAll(false);
|
|
2785
3073
|
setPendingDeleteScope(null);
|
|
@@ -2797,7 +3085,7 @@ function useModelPageController({
|
|
|
2797
3085
|
setIsDeletePreviewLoading(false);
|
|
2798
3086
|
}
|
|
2799
3087
|
}, [client, slug, t]);
|
|
2800
|
-
const openBulkDeletePreview =
|
|
3088
|
+
const openBulkDeletePreview = useCallback5(async () => {
|
|
2801
3089
|
if (!hasSelection) {
|
|
2802
3090
|
return;
|
|
2803
3091
|
}
|
|
@@ -2823,7 +3111,7 @@ function useModelPageController({
|
|
|
2823
3111
|
setBulkActionMenuAnchor(null);
|
|
2824
3112
|
}
|
|
2825
3113
|
}, [client, hasSelection, isAllMatchingSelected, selectedIds, selectionScope, slug, t]);
|
|
2826
|
-
const handleConfirmDelete =
|
|
3114
|
+
const handleConfirmDelete = useCallback5(async () => {
|
|
2827
3115
|
if (pendingDeleteMode === "single" && pendingDeleteIds.length === 0) {
|
|
2828
3116
|
return;
|
|
2829
3117
|
}
|
|
@@ -2835,12 +3123,14 @@ function useModelPageController({
|
|
|
2835
3123
|
try {
|
|
2836
3124
|
if (pendingDeleteMode === "single") {
|
|
2837
3125
|
await client.deleteItem(slug, pendingDeleteIds[0]);
|
|
3126
|
+
message.success(t("object_deleted_success"));
|
|
2838
3127
|
} else {
|
|
2839
|
-
await client.bulkDelete(
|
|
3128
|
+
const response = await client.bulkDelete(
|
|
2840
3129
|
slug,
|
|
2841
3130
|
pendingDeleteIds,
|
|
2842
3131
|
pendingDeleteSelectAll && pendingDeleteScope ? { selectAll: true, selectionScope: pendingDeleteScope } : void 0
|
|
2843
3132
|
);
|
|
3133
|
+
message.success(t("delete_success", { count: response.deleted }));
|
|
2844
3134
|
}
|
|
2845
3135
|
setDeletePreviewOpen(false);
|
|
2846
3136
|
setDeletePreview(null);
|
|
@@ -2851,12 +3141,15 @@ function useModelPageController({
|
|
|
2851
3141
|
clearSelection();
|
|
2852
3142
|
await refresh();
|
|
2853
3143
|
} catch (reason) {
|
|
2854
|
-
|
|
3144
|
+
const nextError = reason instanceof Error ? reason.message : t("object_delete_error");
|
|
3145
|
+
setDeletePreviewError(nextError);
|
|
3146
|
+
message.error(nextError);
|
|
2855
3147
|
} finally {
|
|
2856
3148
|
setIsDeleteSubmitting(false);
|
|
2857
3149
|
}
|
|
2858
|
-
}, [clearSelection, client, pendingDeleteIds, pendingDeleteMode, pendingDeleteScope, pendingDeleteSelectAll, refresh, slug, t]);
|
|
2859
|
-
const handleRunNamedBulkAction =
|
|
3150
|
+
}, [clearSelection, client, message, pendingDeleteIds, pendingDeleteMode, pendingDeleteScope, pendingDeleteSelectAll, refresh, slug, t]);
|
|
3151
|
+
const handleRunNamedBulkAction = useCallback5(async (actionSlug) => {
|
|
3152
|
+
var _a2, _b2;
|
|
2860
3153
|
if (!actionSlug || !hasSelection) {
|
|
2861
3154
|
return;
|
|
2862
3155
|
}
|
|
@@ -2865,7 +3158,7 @@ function useModelPageController({
|
|
|
2865
3158
|
return;
|
|
2866
3159
|
}
|
|
2867
3160
|
try {
|
|
2868
|
-
await client.runBulkAction(
|
|
3161
|
+
const response = await client.runBulkAction(
|
|
2869
3162
|
slug,
|
|
2870
3163
|
actionSlug,
|
|
2871
3164
|
isAllMatchingSelected ? [] : selectedIds,
|
|
@@ -2875,16 +3168,20 @@ function useModelPageController({
|
|
|
2875
3168
|
setBulkActionMenuAnchor(null);
|
|
2876
3169
|
clearSelection();
|
|
2877
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 }));
|
|
2878
3173
|
} catch (reason) {
|
|
2879
|
-
|
|
3174
|
+
const nextError = reason instanceof Error ? reason.message : t("object_action_error");
|
|
3175
|
+
setError(nextError);
|
|
3176
|
+
message.error(nextError);
|
|
2880
3177
|
}
|
|
2881
|
-
}, [clearSelection, client, hasSelection, isAllMatchingSelected, openBulkDeletePreview, refresh, selectedIds, selectionScope, slug, t]);
|
|
2882
|
-
const handleRowDelete =
|
|
3178
|
+
}, [bulkActions, clearSelection, client, hasSelection, isAllMatchingSelected, message, openBulkDeletePreview, refresh, selectedIds, selectionScope, slug, t]);
|
|
3179
|
+
const handleRowDelete = useCallback5(async (rowId) => {
|
|
2883
3180
|
setRowActionMenuAnchor(null);
|
|
2884
3181
|
setRowActionMenuId(null);
|
|
2885
3182
|
await openSingleDeletePreview(rowId);
|
|
2886
3183
|
}, [openSingleDeletePreview]);
|
|
2887
|
-
const handleToggleSelection =
|
|
3184
|
+
const handleToggleSelection = useCallback5((rowId, checked) => {
|
|
2888
3185
|
if (isAllMatchingSelected) {
|
|
2889
3186
|
if (checked) {
|
|
2890
3187
|
return;
|
|
@@ -2910,7 +3207,7 @@ function useModelPageController({
|
|
|
2910
3207
|
return current.filter((item) => String(item) !== rowKey);
|
|
2911
3208
|
});
|
|
2912
3209
|
}, [isAllMatchingSelected, meta, rows]);
|
|
2913
|
-
const handleToggleAllVisible =
|
|
3210
|
+
const handleToggleAllVisible = useCallback5((checked) => {
|
|
2914
3211
|
if (!meta) {
|
|
2915
3212
|
return;
|
|
2916
3213
|
}
|
|
@@ -2921,33 +3218,33 @@ function useModelPageController({
|
|
|
2921
3218
|
}
|
|
2922
3219
|
clearSelection();
|
|
2923
3220
|
}, [clearSelection, meta, rows]);
|
|
2924
|
-
const handleSelectAllMatching =
|
|
3221
|
+
const handleSelectAllMatching = useCallback5(() => {
|
|
2925
3222
|
if (!hasSelection || total === 0) {
|
|
2926
3223
|
return;
|
|
2927
3224
|
}
|
|
2928
3225
|
setSelectedIds([]);
|
|
2929
3226
|
setIsAllMatchingSelected(true);
|
|
2930
3227
|
}, [hasSelection, total]);
|
|
2931
|
-
const clearBulkDeleteState =
|
|
3228
|
+
const clearBulkDeleteState = useCallback5(() => {
|
|
2932
3229
|
setPendingDeleteIds([]);
|
|
2933
3230
|
setPendingDeleteSelectAll(false);
|
|
2934
3231
|
setPendingDeleteScope(null);
|
|
2935
3232
|
}, []);
|
|
2936
|
-
const handleClearDeletePreview =
|
|
3233
|
+
const handleClearDeletePreview = useCallback5(() => {
|
|
2937
3234
|
setDeletePreviewOpen(false);
|
|
2938
3235
|
setDeletePreview(null);
|
|
2939
3236
|
setDeletePreviewError(null);
|
|
2940
3237
|
clearBulkDeleteState();
|
|
2941
3238
|
}, [clearBulkDeleteState]);
|
|
2942
|
-
const handleOpenRowMenu =
|
|
3239
|
+
const handleOpenRowMenu = useCallback5((event, rowId) => {
|
|
2943
3240
|
setRowActionMenuAnchor(event.currentTarget);
|
|
2944
3241
|
setRowActionMenuId(rowId);
|
|
2945
3242
|
}, []);
|
|
2946
|
-
const handleCloseRowMenu =
|
|
3243
|
+
const handleCloseRowMenu = useCallback5(() => {
|
|
2947
3244
|
setRowActionMenuAnchor(null);
|
|
2948
3245
|
setRowActionMenuId(null);
|
|
2949
3246
|
}, []);
|
|
2950
|
-
const handleCloseBulkActionMenu =
|
|
3247
|
+
const handleCloseBulkActionMenu = useCallback5(() => {
|
|
2951
3248
|
setBulkActionMenuAnchor(null);
|
|
2952
3249
|
}, []);
|
|
2953
3250
|
return {
|
|
@@ -3058,29 +3355,29 @@ function extractFilterParams(params) {
|
|
|
3058
3355
|
}
|
|
3059
3356
|
|
|
3060
3357
|
// src/components/model-page/Skeletons.tsx
|
|
3061
|
-
import { Box as
|
|
3062
|
-
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";
|
|
3063
3360
|
function ModelPageSkeleton() {
|
|
3064
|
-
return /* @__PURE__ */
|
|
3065
|
-
/* @__PURE__ */
|
|
3066
|
-
/* @__PURE__ */
|
|
3067
|
-
/* @__PURE__ */
|
|
3068
|
-
/* @__PURE__ */
|
|
3069
|
-
/* @__PURE__ */
|
|
3070
|
-
/* @__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 })
|
|
3071
3368
|
] }) }),
|
|
3072
|
-
/* @__PURE__ */
|
|
3369
|
+
/* @__PURE__ */ jsx19(Paper6, { sx: { borderRadius: "10px", flex: 1, minHeight: 0, overflow: "hidden" }, children: /* @__PURE__ */ jsx19(ModelTableSkeleton, {}) })
|
|
3073
3370
|
] });
|
|
3074
3371
|
}
|
|
3075
3372
|
function ModelTableSkeleton() {
|
|
3076
|
-
return /* @__PURE__ */
|
|
3077
|
-
/* @__PURE__ */
|
|
3078
|
-
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))
|
|
3079
3376
|
] }) });
|
|
3080
3377
|
}
|
|
3081
3378
|
|
|
3082
3379
|
// src/components/ModelPage.tsx
|
|
3083
|
-
import { jsx as
|
|
3380
|
+
import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3084
3381
|
var SEARCH_DEBOUNCE_MS = 300;
|
|
3085
3382
|
var CHECKBOX_COLUMN_WIDTH = 56;
|
|
3086
3383
|
var ACTIONS_COLUMN_WIDTH = 56;
|
|
@@ -3091,7 +3388,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3091
3388
|
const selectAllLabel = locale === "ru" ? "\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0441\u0435" : "Select All";
|
|
3092
3389
|
const resolvedRouter = useAdminRouter(router);
|
|
3093
3390
|
const location = useAdminLocation(resolvedRouter);
|
|
3094
|
-
const theme =
|
|
3391
|
+
const theme = useTheme3();
|
|
3095
3392
|
const isMobile = useMediaQuery2(theme.breakpoints.down("md"));
|
|
3096
3393
|
const controller = useModelPageController({
|
|
3097
3394
|
client,
|
|
@@ -3103,10 +3400,10 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3103
3400
|
});
|
|
3104
3401
|
useAdminDocumentTitle(t("admin_title"), (_b = (_a = controller.meta) == null ? void 0 : _a.title) != null ? _b : slug);
|
|
3105
3402
|
if (!controller.isLoading && controller.error && !controller.data) {
|
|
3106
|
-
return /* @__PURE__ */
|
|
3403
|
+
return /* @__PURE__ */ jsx20(Alert5, { severity: "error", children: controller.error });
|
|
3107
3404
|
}
|
|
3108
3405
|
if (!controller.data || !controller.meta) {
|
|
3109
|
-
return /* @__PURE__ */
|
|
3406
|
+
return /* @__PURE__ */ jsx20(ModelPageSkeleton, {});
|
|
3110
3407
|
}
|
|
3111
3408
|
const meta = controller.meta;
|
|
3112
3409
|
const beforePagination = renderBeforePagination == null ? void 0 : renderBeforePagination({
|
|
@@ -3125,12 +3422,12 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3125
3422
|
appliedFilters: controller.appliedFilters,
|
|
3126
3423
|
refresh: controller.refresh
|
|
3127
3424
|
});
|
|
3128
|
-
return /* @__PURE__ */
|
|
3129
|
-
/* @__PURE__ */
|
|
3425
|
+
return /* @__PURE__ */ jsx20(AdminRouterProvider, { router: resolvedRouter, children: /* @__PURE__ */ jsxs13(Stack10, { spacing: 1.5, sx: { height: "100%", minHeight: 0 }, children: [
|
|
3426
|
+
/* @__PURE__ */ jsx20(
|
|
3130
3427
|
MainHeader,
|
|
3131
3428
|
{
|
|
3132
3429
|
title: controller.meta.title,
|
|
3133
|
-
actions: /* @__PURE__ */
|
|
3430
|
+
actions: /* @__PURE__ */ jsx20(Tooltip, { title: t("create"), children: /* @__PURE__ */ jsx20(
|
|
3134
3431
|
IconButton3,
|
|
3135
3432
|
{
|
|
3136
3433
|
"aria-label": t("create"),
|
|
@@ -3145,31 +3442,31 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3145
3442
|
backgroundColor: "primary.dark"
|
|
3146
3443
|
}
|
|
3147
3444
|
},
|
|
3148
|
-
children: /* @__PURE__ */
|
|
3445
|
+
children: /* @__PURE__ */ jsx20(AddIcon, { fontSize: "small" })
|
|
3149
3446
|
}
|
|
3150
3447
|
) }),
|
|
3151
3448
|
subtitle: `${controller.meta.slug} | ${t("objects_count", { count: controller.total })}`,
|
|
3152
|
-
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
|
|
3153
3450
|
}
|
|
3154
3451
|
),
|
|
3155
|
-
/* @__PURE__ */
|
|
3156
|
-
|
|
3452
|
+
/* @__PURE__ */ jsx20(
|
|
3453
|
+
Paper7,
|
|
3157
3454
|
{
|
|
3158
3455
|
sx: {
|
|
3159
3456
|
p: 1.5,
|
|
3160
3457
|
borderRadius: "10px",
|
|
3161
3458
|
flexShrink: 0
|
|
3162
3459
|
},
|
|
3163
|
-
children: /* @__PURE__ */
|
|
3164
|
-
/* @__PURE__ */
|
|
3165
|
-
|
|
3460
|
+
children: /* @__PURE__ */ jsxs13(Stack10, { direction: { xs: "column", lg: "row" }, spacing: 1.5, alignItems: { lg: "center" }, children: [
|
|
3461
|
+
/* @__PURE__ */ jsxs13(
|
|
3462
|
+
Stack10,
|
|
3166
3463
|
{
|
|
3167
3464
|
direction: { xs: "column", xl: "row" },
|
|
3168
3465
|
spacing: 1.5,
|
|
3169
3466
|
alignItems: { xl: "center" },
|
|
3170
3467
|
sx: { flex: 1, minWidth: 0 },
|
|
3171
3468
|
children: [
|
|
3172
|
-
/* @__PURE__ */
|
|
3469
|
+
/* @__PURE__ */ jsx20(
|
|
3173
3470
|
SearchField,
|
|
3174
3471
|
{
|
|
3175
3472
|
value: controller.appliedQuery,
|
|
@@ -3178,17 +3475,17 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3178
3475
|
placeholder: t("search")
|
|
3179
3476
|
}
|
|
3180
3477
|
),
|
|
3181
|
-
controller.hasSelection ? /* @__PURE__ */
|
|
3182
|
-
/* @__PURE__ */
|
|
3478
|
+
controller.hasSelection ? /* @__PURE__ */ jsxs13(Stack10, { direction: "row", spacing: 1, alignItems: "center", sx: { minWidth: 0, flexWrap: "wrap" }, children: [
|
|
3479
|
+
/* @__PURE__ */ jsx20(
|
|
3183
3480
|
Button4,
|
|
3184
3481
|
{
|
|
3185
3482
|
variant: "outlined",
|
|
3186
|
-
endIcon: /* @__PURE__ */
|
|
3483
|
+
endIcon: /* @__PURE__ */ jsx20(ExpandMoreIcon4, {}),
|
|
3187
3484
|
onClick: (event) => controller.setBulkActionMenuAnchor(event.currentTarget),
|
|
3188
3485
|
children: t("actions")
|
|
3189
3486
|
}
|
|
3190
3487
|
),
|
|
3191
|
-
!controller.isAllMatchingSelected && controller.selectionCount < controller.total ? /* @__PURE__ */
|
|
3488
|
+
!controller.isAllMatchingSelected && controller.selectionCount < controller.total ? /* @__PURE__ */ jsx20(
|
|
3192
3489
|
Button4,
|
|
3193
3490
|
{
|
|
3194
3491
|
variant: "text",
|
|
@@ -3197,7 +3494,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3197
3494
|
children: selectAllLabel
|
|
3198
3495
|
}
|
|
3199
3496
|
) : null,
|
|
3200
|
-
/* @__PURE__ */
|
|
3497
|
+
/* @__PURE__ */ jsxs13(Typography6, { color: "text.secondary", sx: { alignSelf: "center", whiteSpace: "nowrap" }, children: [
|
|
3201
3498
|
t("selected_count", { count: controller.selectionCount }),
|
|
3202
3499
|
" / ",
|
|
3203
3500
|
controller.total
|
|
@@ -3206,28 +3503,28 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3206
3503
|
]
|
|
3207
3504
|
}
|
|
3208
3505
|
),
|
|
3209
|
-
/* @__PURE__ */
|
|
3210
|
-
beforePagination ? /* @__PURE__ */
|
|
3211
|
-
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(
|
|
3212
3509
|
IconButton3,
|
|
3213
3510
|
{
|
|
3214
3511
|
size: "small",
|
|
3215
3512
|
"aria-label": t("filters"),
|
|
3216
3513
|
onClick: () => controller.setFiltersOpen(true),
|
|
3217
|
-
children: /* @__PURE__ */
|
|
3514
|
+
children: /* @__PURE__ */ jsx20(FilterListIcon, { fontSize: "small" })
|
|
3218
3515
|
}
|
|
3219
3516
|
) }) : null,
|
|
3220
|
-
/* @__PURE__ */
|
|
3517
|
+
/* @__PURE__ */ jsx20(
|
|
3221
3518
|
IconButton3,
|
|
3222
3519
|
{
|
|
3223
3520
|
size: "small",
|
|
3224
3521
|
onClick: () => controller.handlePageChange(controller.currentPage - 1),
|
|
3225
3522
|
disabled: controller.currentPage <= 1,
|
|
3226
3523
|
sx: { mr: "-5px" },
|
|
3227
|
-
children: /* @__PURE__ */
|
|
3524
|
+
children: /* @__PURE__ */ jsx20(ChevronLeftIcon, { fontSize: "small" })
|
|
3228
3525
|
}
|
|
3229
3526
|
),
|
|
3230
|
-
/* @__PURE__ */
|
|
3527
|
+
/* @__PURE__ */ jsx20(
|
|
3231
3528
|
InputBase,
|
|
3232
3529
|
{
|
|
3233
3530
|
value: controller.pageInput,
|
|
@@ -3257,8 +3554,8 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3257
3554
|
}
|
|
3258
3555
|
}
|
|
3259
3556
|
),
|
|
3260
|
-
/* @__PURE__ */
|
|
3261
|
-
|
|
3557
|
+
/* @__PURE__ */ jsxs13(
|
|
3558
|
+
Typography6,
|
|
3262
3559
|
{
|
|
3263
3560
|
color: "text.secondary",
|
|
3264
3561
|
sx: { minWidth: "auto", fontSize: "1rem", lineHeight: "1rem" },
|
|
@@ -3268,23 +3565,23 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3268
3565
|
]
|
|
3269
3566
|
}
|
|
3270
3567
|
),
|
|
3271
|
-
/* @__PURE__ */
|
|
3568
|
+
/* @__PURE__ */ jsx20(
|
|
3272
3569
|
IconButton3,
|
|
3273
3570
|
{
|
|
3274
3571
|
size: "small",
|
|
3275
3572
|
onClick: () => controller.handlePageChange(controller.currentPage + 1),
|
|
3276
3573
|
disabled: controller.currentPage >= controller.totalPages,
|
|
3277
3574
|
sx: { ml: "-5px" },
|
|
3278
|
-
children: /* @__PURE__ */
|
|
3575
|
+
children: /* @__PURE__ */ jsx20(ChevronRightIcon, { fontSize: "small" })
|
|
3279
3576
|
}
|
|
3280
3577
|
)
|
|
3281
3578
|
] })
|
|
3282
3579
|
] })
|
|
3283
3580
|
}
|
|
3284
3581
|
),
|
|
3285
|
-
/* @__PURE__ */
|
|
3286
|
-
/* @__PURE__ */
|
|
3287
|
-
|
|
3582
|
+
/* @__PURE__ */ jsxs13(Stack10, { direction: { xs: "column", lg: "row" }, spacing: 1.5, sx: { flex: 1, minHeight: 0 }, children: [
|
|
3583
|
+
/* @__PURE__ */ jsx20(
|
|
3584
|
+
Paper7,
|
|
3288
3585
|
{
|
|
3289
3586
|
sx: {
|
|
3290
3587
|
borderRadius: "10px",
|
|
@@ -3293,9 +3590,9 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3293
3590
|
minHeight: 0,
|
|
3294
3591
|
overflow: "hidden"
|
|
3295
3592
|
},
|
|
3296
|
-
children: controller.isLoading ? /* @__PURE__ */
|
|
3297
|
-
/* @__PURE__ */
|
|
3298
|
-
/* @__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(
|
|
3299
3596
|
TableCell2,
|
|
3300
3597
|
{
|
|
3301
3598
|
padding: "none",
|
|
@@ -3308,7 +3605,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3308
3605
|
textAlign: "center",
|
|
3309
3606
|
px: 1
|
|
3310
3607
|
},
|
|
3311
|
-
children: /* @__PURE__ */
|
|
3608
|
+
children: /* @__PURE__ */ jsx20(
|
|
3312
3609
|
Checkbox2,
|
|
3313
3610
|
{
|
|
3314
3611
|
checked: controller.allVisibleSelected,
|
|
@@ -3323,7 +3620,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3323
3620
|
const field = controller.fieldMap.get(fieldName);
|
|
3324
3621
|
const sortDirection = resolveSortDirection(controller.sortFields, fieldName);
|
|
3325
3622
|
const isSortable = resolveFieldSortable(field);
|
|
3326
|
-
return /* @__PURE__ */
|
|
3623
|
+
return /* @__PURE__ */ jsx20(
|
|
3327
3624
|
TableCell2,
|
|
3328
3625
|
{
|
|
3329
3626
|
sortDirection: sortDirection != null ? sortDirection : false,
|
|
@@ -3336,7 +3633,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3336
3633
|
maxWidth: getListFieldWidthPx(field)
|
|
3337
3634
|
},
|
|
3338
3635
|
onClick: isSortable ? () => controller.toggleSort(fieldName) : void 0,
|
|
3339
|
-
children: isSortable ? /* @__PURE__ */
|
|
3636
|
+
children: isSortable ? /* @__PURE__ */ jsx20(
|
|
3340
3637
|
TableSortLabel,
|
|
3341
3638
|
{
|
|
3342
3639
|
active: Boolean(sortDirection),
|
|
@@ -3350,7 +3647,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3350
3647
|
},
|
|
3351
3648
|
children: (_a2 = field == null ? void 0 : field.label) != null ? _a2 : fieldName
|
|
3352
3649
|
}
|
|
3353
|
-
) : /* @__PURE__ */
|
|
3650
|
+
) : /* @__PURE__ */ jsx20(Typography6, { component: "span", sx: {
|
|
3354
3651
|
fontSize: 14,
|
|
3355
3652
|
fontWeight: 700,
|
|
3356
3653
|
color: "rgba(255, 255, 255, 0.96)"
|
|
@@ -3359,7 +3656,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3359
3656
|
fieldName
|
|
3360
3657
|
);
|
|
3361
3658
|
}),
|
|
3362
|
-
/* @__PURE__ */
|
|
3659
|
+
/* @__PURE__ */ jsx20(
|
|
3363
3660
|
TableCell2,
|
|
3364
3661
|
{
|
|
3365
3662
|
align: "right",
|
|
@@ -3372,9 +3669,9 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3372
3669
|
}
|
|
3373
3670
|
)
|
|
3374
3671
|
] }) }),
|
|
3375
|
-
/* @__PURE__ */
|
|
3672
|
+
/* @__PURE__ */ jsx20(TableBody, { children: controller.rows.map((row) => {
|
|
3376
3673
|
const rowId = row[meta.pk_field];
|
|
3377
|
-
return /* @__PURE__ */
|
|
3674
|
+
return /* @__PURE__ */ jsx20(
|
|
3378
3675
|
ListRow,
|
|
3379
3676
|
{
|
|
3380
3677
|
row,
|
|
@@ -3394,7 +3691,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3394
3691
|
] }) })
|
|
3395
3692
|
}
|
|
3396
3693
|
),
|
|
3397
|
-
!isMobile && controller.hasListFilters ? /* @__PURE__ */
|
|
3694
|
+
!isMobile && controller.hasListFilters ? /* @__PURE__ */ jsx20(
|
|
3398
3695
|
ListFiltersSidebar,
|
|
3399
3696
|
{
|
|
3400
3697
|
client,
|
|
@@ -3407,13 +3704,13 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3407
3704
|
}
|
|
3408
3705
|
) : null
|
|
3409
3706
|
] }),
|
|
3410
|
-
/* @__PURE__ */
|
|
3707
|
+
/* @__PURE__ */ jsx20(
|
|
3411
3708
|
Menu,
|
|
3412
3709
|
{
|
|
3413
3710
|
anchorEl: controller.bulkActionMenuAnchor,
|
|
3414
3711
|
open: Boolean(controller.bulkActionMenuAnchor),
|
|
3415
3712
|
onClose: controller.handleCloseBulkActionMenu,
|
|
3416
|
-
children: controller.bulkActions.map((action) => /* @__PURE__ */
|
|
3713
|
+
children: controller.bulkActions.map((action) => /* @__PURE__ */ jsx20(
|
|
3417
3714
|
MenuItem2,
|
|
3418
3715
|
{
|
|
3419
3716
|
onClick: () => void controller.handleRunNamedBulkAction(action.slug),
|
|
@@ -3423,13 +3720,13 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3423
3720
|
))
|
|
3424
3721
|
}
|
|
3425
3722
|
),
|
|
3426
|
-
/* @__PURE__ */
|
|
3723
|
+
/* @__PURE__ */ jsx20(
|
|
3427
3724
|
Menu,
|
|
3428
3725
|
{
|
|
3429
3726
|
anchorEl: controller.rowActionMenuAnchor,
|
|
3430
3727
|
open: Boolean(controller.rowActionMenuAnchor),
|
|
3431
3728
|
onClose: controller.handleCloseRowMenu,
|
|
3432
|
-
children: /* @__PURE__ */
|
|
3729
|
+
children: /* @__PURE__ */ jsx20(
|
|
3433
3730
|
MenuItem2,
|
|
3434
3731
|
{
|
|
3435
3732
|
onClick: () => {
|
|
@@ -3442,7 +3739,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3442
3739
|
)
|
|
3443
3740
|
}
|
|
3444
3741
|
),
|
|
3445
|
-
/* @__PURE__ */
|
|
3742
|
+
/* @__PURE__ */ jsx20(
|
|
3446
3743
|
FormDialog,
|
|
3447
3744
|
{
|
|
3448
3745
|
open: controller.createOpen,
|
|
@@ -3455,7 +3752,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3455
3752
|
client
|
|
3456
3753
|
}
|
|
3457
3754
|
),
|
|
3458
|
-
/* @__PURE__ */
|
|
3755
|
+
/* @__PURE__ */ jsxs13(
|
|
3459
3756
|
Dialog3,
|
|
3460
3757
|
{
|
|
3461
3758
|
open: controller.filtersOpen,
|
|
@@ -3476,8 +3773,8 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3476
3773
|
}
|
|
3477
3774
|
},
|
|
3478
3775
|
children: [
|
|
3479
|
-
/* @__PURE__ */
|
|
3480
|
-
/* @__PURE__ */
|
|
3776
|
+
/* @__PURE__ */ jsx20(DialogTitle3, { children: t("filters") }),
|
|
3777
|
+
/* @__PURE__ */ jsx20(DialogContent3, { sx: { px: 2, pb: 2 }, children: controller.hasListFilters ? /* @__PURE__ */ jsx20(
|
|
3481
3778
|
ListFiltersSidebar,
|
|
3482
3779
|
{
|
|
3483
3780
|
client,
|
|
@@ -3492,7 +3789,7 @@ function ModelPage({ client, basePath, slug, router, renderBeforePagination }) {
|
|
|
3492
3789
|
]
|
|
3493
3790
|
}
|
|
3494
3791
|
),
|
|
3495
|
-
/* @__PURE__ */
|
|
3792
|
+
/* @__PURE__ */ jsx20(
|
|
3496
3793
|
DeletePreviewDialog,
|
|
3497
3794
|
{
|
|
3498
3795
|
open: controller.deletePreviewOpen,
|
|
@@ -3527,16 +3824,16 @@ function resolveFieldSortable(field) {
|
|
|
3527
3824
|
// src/components/ObjectPage.tsx
|
|
3528
3825
|
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
|
|
3529
3826
|
import MoreVertIcon2 from "@mui/icons-material/MoreVert";
|
|
3530
|
-
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";
|
|
3531
3828
|
import { LocalizationProvider as LocalizationProvider2 } from "@mui/x-date-pickers";
|
|
3532
3829
|
import { AdapterDayjs as AdapterDayjs2 } from "@mui/x-date-pickers/AdapterDayjs";
|
|
3533
|
-
import { useTheme as
|
|
3830
|
+
import { useTheme as useTheme4 } from "@mui/material/styles";
|
|
3534
3831
|
import "dayjs/locale/en.js";
|
|
3535
3832
|
import "dayjs/locale/ru.js";
|
|
3536
3833
|
|
|
3537
3834
|
// src/components/object-page/ObjectField.tsx
|
|
3538
|
-
import { memo as memo6, useCallback as
|
|
3539
|
-
import { jsx as
|
|
3835
|
+
import { memo as memo6, useCallback as useCallback6 } from "react";
|
|
3836
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
3540
3837
|
var ObjectField = memo6(function ObjectField2({
|
|
3541
3838
|
field,
|
|
3542
3839
|
value,
|
|
@@ -3544,10 +3841,10 @@ var ObjectField = memo6(function ObjectField2({
|
|
|
3544
3841
|
client,
|
|
3545
3842
|
onFieldChange
|
|
3546
3843
|
}) {
|
|
3547
|
-
const handleChange =
|
|
3844
|
+
const handleChange = useCallback6((nextValue) => {
|
|
3548
3845
|
onFieldChange(field.name, nextValue);
|
|
3549
3846
|
}, [field.name, onFieldChange]);
|
|
3550
|
-
return /* @__PURE__ */
|
|
3847
|
+
return /* @__PURE__ */ jsx21(
|
|
3551
3848
|
FieldEditor,
|
|
3552
3849
|
{
|
|
3553
3850
|
field,
|
|
@@ -3560,21 +3857,21 @@ var ObjectField = memo6(function ObjectField2({
|
|
|
3560
3857
|
});
|
|
3561
3858
|
|
|
3562
3859
|
// src/components/object-page/ObjectPageSkeleton.tsx
|
|
3563
|
-
import { Box as
|
|
3564
|
-
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";
|
|
3565
3862
|
function ObjectPageSkeleton() {
|
|
3566
|
-
return /* @__PURE__ */
|
|
3567
|
-
/* @__PURE__ */
|
|
3568
|
-
/* @__PURE__ */
|
|
3569
|
-
|
|
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,
|
|
3570
3867
|
{
|
|
3571
3868
|
direction: { xs: "column", lg: "row" },
|
|
3572
3869
|
spacing: 1.5,
|
|
3573
3870
|
sx: { flex: 1, minHeight: 0, alignItems: "stretch" },
|
|
3574
3871
|
children: [
|
|
3575
|
-
/* @__PURE__ */
|
|
3576
|
-
/* @__PURE__ */
|
|
3577
|
-
|
|
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,
|
|
3578
3875
|
{
|
|
3579
3876
|
sx: {
|
|
3580
3877
|
width: { xs: "100%", lg: 280 },
|
|
@@ -3583,10 +3880,10 @@ function ObjectPageSkeleton() {
|
|
|
3583
3880
|
p: 1.5,
|
|
3584
3881
|
alignSelf: "flex-start"
|
|
3585
3882
|
},
|
|
3586
|
-
children: /* @__PURE__ */
|
|
3587
|
-
/* @__PURE__ */
|
|
3588
|
-
/* @__PURE__ */
|
|
3589
|
-
/* @__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 })
|
|
3590
3887
|
] })
|
|
3591
3888
|
}
|
|
3592
3889
|
)
|
|
@@ -3598,8 +3895,8 @@ function ObjectPageSkeleton() {
|
|
|
3598
3895
|
|
|
3599
3896
|
// src/components/object-page/ReadonlyObjectField.tsx
|
|
3600
3897
|
import { memo as memo7 } from "react";
|
|
3601
|
-
import { Box as
|
|
3602
|
-
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";
|
|
3603
3900
|
var ReadonlyObjectField = memo7(function ReadonlyObjectField2({
|
|
3604
3901
|
field,
|
|
3605
3902
|
value,
|
|
@@ -3607,9 +3904,9 @@ var ReadonlyObjectField = memo7(function ReadonlyObjectField2({
|
|
|
3607
3904
|
}) {
|
|
3608
3905
|
var _a;
|
|
3609
3906
|
const isMultiline = field.input_kind === "textarea" || field.input_kind === "json" || field.type.toLowerCase().includes("text") || value.includes("\n") || value.length > 120;
|
|
3610
|
-
return /* @__PURE__ */
|
|
3611
|
-
imageUrl ? /* @__PURE__ */
|
|
3612
|
-
|
|
3907
|
+
return /* @__PURE__ */ jsxs15(Stack12, { spacing: 1, children: [
|
|
3908
|
+
imageUrl ? /* @__PURE__ */ jsx23(
|
|
3909
|
+
Box12,
|
|
3613
3910
|
{
|
|
3614
3911
|
component: "img",
|
|
3615
3912
|
src: imageUrl,
|
|
@@ -3625,7 +3922,7 @@ var ReadonlyObjectField = memo7(function ReadonlyObjectField2({
|
|
|
3625
3922
|
}
|
|
3626
3923
|
}
|
|
3627
3924
|
) : null,
|
|
3628
|
-
/* @__PURE__ */
|
|
3925
|
+
/* @__PURE__ */ jsx23(
|
|
3629
3926
|
TextField4,
|
|
3630
3927
|
{
|
|
3631
3928
|
label: field.label,
|
|
@@ -3642,7 +3939,7 @@ var ReadonlyObjectField = memo7(function ReadonlyObjectField2({
|
|
|
3642
3939
|
});
|
|
3643
3940
|
|
|
3644
3941
|
// src/components/object-page/useObjectPageController.ts
|
|
3645
|
-
import { useCallback as
|
|
3942
|
+
import { useCallback as useCallback7, useEffect as useEffect11, useMemo as useMemo10, useState as useState11 } from "react";
|
|
3646
3943
|
|
|
3647
3944
|
// src/utils/isDeepEqual.ts
|
|
3648
3945
|
function isDeepEqual(left, right) {
|
|
@@ -3682,30 +3979,31 @@ function useObjectPageController({
|
|
|
3682
3979
|
t
|
|
3683
3980
|
}) {
|
|
3684
3981
|
var _a, _b, _c;
|
|
3982
|
+
const message = useAdminMessage();
|
|
3685
3983
|
const cacheKey = buildDetailCacheKey(slug, id);
|
|
3686
|
-
const [data, setData] =
|
|
3984
|
+
const [data, setData] = useState11(() => {
|
|
3687
3985
|
var _a2;
|
|
3688
3986
|
return (_a2 = getClientCacheBucket(client).detailResponseCache.get(cacheKey)) != null ? _a2 : null;
|
|
3689
3987
|
});
|
|
3690
|
-
const [values, setValues] =
|
|
3988
|
+
const [values, setValues] = useState11(() => {
|
|
3691
3989
|
var _a2, _b2;
|
|
3692
3990
|
return (_b2 = (_a2 = getClientCacheBucket(client).detailResponseCache.get(cacheKey)) == null ? void 0 : _a2.item) != null ? _b2 : {};
|
|
3693
3991
|
});
|
|
3694
|
-
const [initialValues, setInitialValues] =
|
|
3992
|
+
const [initialValues, setInitialValues] = useState11(() => {
|
|
3695
3993
|
var _a2, _b2;
|
|
3696
3994
|
return (_b2 = (_a2 = getClientCacheBucket(client).detailResponseCache.get(cacheKey)) == null ? void 0 : _a2.item) != null ? _b2 : {};
|
|
3697
3995
|
});
|
|
3698
|
-
const [error, setError] =
|
|
3699
|
-
const [isLoading, setIsLoading] =
|
|
3700
|
-
const [isSaving, setIsSaving] =
|
|
3701
|
-
const [isDeleting, setIsDeleting] =
|
|
3702
|
-
const [activeActionSlug, setActiveActionSlug] =
|
|
3703
|
-
const [deleteConfirmOpen, setDeleteConfirmOpen] =
|
|
3704
|
-
const [deletePreview, setDeletePreview] =
|
|
3705
|
-
const [isDeletePreviewLoading, setIsDeletePreviewLoading] =
|
|
3706
|
-
const [deletePreviewError, setDeletePreviewError] =
|
|
3707
|
-
const [actionsAnchorEl, setActionsAnchorEl] =
|
|
3708
|
-
|
|
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(() => {
|
|
3709
4007
|
var _a2;
|
|
3710
4008
|
let isMounted = true;
|
|
3711
4009
|
const bucket = getClientCacheBucket(client);
|
|
@@ -3749,25 +4047,25 @@ function useObjectPageController({
|
|
|
3749
4047
|
const meta = (_a = data == null ? void 0 : data.meta) != null ? _a : null;
|
|
3750
4048
|
const detailFields = (_b = meta == null ? void 0 : meta.detail_fields) != null ? _b : [];
|
|
3751
4049
|
const objectActions = (_c = meta == null ? void 0 : meta.object_actions) != null ? _c : [];
|
|
3752
|
-
const fieldMap =
|
|
4050
|
+
const fieldMap = useMemo10(
|
|
3753
4051
|
() => {
|
|
3754
4052
|
var _a2;
|
|
3755
4053
|
return new Map(((_a2 = meta == null ? void 0 : meta.fields) != null ? _a2 : []).map((field) => [field.name, field]));
|
|
3756
4054
|
},
|
|
3757
4055
|
[meta == null ? void 0 : meta.fields]
|
|
3758
4056
|
);
|
|
3759
|
-
const editableFields =
|
|
4057
|
+
const editableFields = useMemo10(
|
|
3760
4058
|
() => {
|
|
3761
4059
|
var _a2;
|
|
3762
4060
|
return ((_a2 = meta == null ? void 0 : meta.fields) != null ? _a2 : []).filter((field) => meta == null ? void 0 : meta.update_fields.includes(field.name));
|
|
3763
4061
|
},
|
|
3764
4062
|
[meta == null ? void 0 : meta.fields, meta == null ? void 0 : meta.update_fields]
|
|
3765
4063
|
);
|
|
3766
|
-
const editableFieldNames =
|
|
4064
|
+
const editableFieldNames = useMemo10(
|
|
3767
4065
|
() => new Set(editableFields.map((field) => field.name)),
|
|
3768
4066
|
[editableFields]
|
|
3769
4067
|
);
|
|
3770
|
-
const objectTitle =
|
|
4068
|
+
const objectTitle = useMemo10(
|
|
3771
4069
|
() => {
|
|
3772
4070
|
var _a2;
|
|
3773
4071
|
return String((_a2 = data == null ? void 0 : data.item._display) != null ? _a2 : meta ? `${meta.title} #${id}` : id);
|
|
@@ -3775,19 +4073,19 @@ function useObjectPageController({
|
|
|
3775
4073
|
[data, id, meta]
|
|
3776
4074
|
);
|
|
3777
4075
|
const isActionsMenuOpen = actionsAnchorEl !== null;
|
|
3778
|
-
const currentPayload =
|
|
4076
|
+
const currentPayload = useMemo10(
|
|
3779
4077
|
() => buildAdminPayload(values, editableFields),
|
|
3780
4078
|
[editableFields, values]
|
|
3781
4079
|
);
|
|
3782
|
-
const initialPayload =
|
|
4080
|
+
const initialPayload = useMemo10(
|
|
3783
4081
|
() => buildAdminPayload(initialValues, editableFields),
|
|
3784
4082
|
[editableFields, initialValues]
|
|
3785
4083
|
);
|
|
3786
|
-
const isDirty =
|
|
4084
|
+
const isDirty = useMemo10(
|
|
3787
4085
|
() => !isDeepEqual(currentPayload, initialPayload),
|
|
3788
4086
|
[currentPayload, initialPayload]
|
|
3789
4087
|
);
|
|
3790
|
-
const handleFieldChange =
|
|
4088
|
+
const handleFieldChange = useCallback7((fieldName, nextValue) => {
|
|
3791
4089
|
setValues((current) => {
|
|
3792
4090
|
if (Object.is(current[fieldName], nextValue)) {
|
|
3793
4091
|
return current;
|
|
@@ -3795,7 +4093,7 @@ function useObjectPageController({
|
|
|
3795
4093
|
return { ...current, [fieldName]: nextValue };
|
|
3796
4094
|
});
|
|
3797
4095
|
}, []);
|
|
3798
|
-
const handleSave =
|
|
4096
|
+
const handleSave = useCallback7(async () => {
|
|
3799
4097
|
if (!meta || !isDirty) {
|
|
3800
4098
|
return;
|
|
3801
4099
|
}
|
|
@@ -3809,29 +4107,36 @@ function useObjectPageController({
|
|
|
3809
4107
|
setData(nextDetail);
|
|
3810
4108
|
setValues(response.item);
|
|
3811
4109
|
setInitialValues(response.item);
|
|
4110
|
+
message.success(t("object_saved_success"));
|
|
3812
4111
|
} catch (reason) {
|
|
3813
|
-
|
|
4112
|
+
const nextError = reason instanceof Error ? reason.message : t("object_save_error");
|
|
4113
|
+
setError(nextError);
|
|
4114
|
+
message.error(nextError);
|
|
3814
4115
|
} finally {
|
|
3815
4116
|
setIsSaving(false);
|
|
3816
4117
|
}
|
|
3817
|
-
}, [cacheKey, client, currentPayload, id, isDirty, meta, slug, t]);
|
|
3818
|
-
const handleDelete =
|
|
4118
|
+
}, [cacheKey, client, currentPayload, id, isDirty, message, meta, slug, t]);
|
|
4119
|
+
const handleDelete = useCallback7(async () => {
|
|
3819
4120
|
setIsDeleting(true);
|
|
3820
4121
|
setError(null);
|
|
3821
4122
|
try {
|
|
3822
4123
|
await client.deleteItem(slug, id);
|
|
3823
4124
|
invalidateModelCache(client, slug);
|
|
4125
|
+
message.success(t("object_deleted_success"));
|
|
3824
4126
|
router.push(listPath);
|
|
3825
4127
|
} catch (reason) {
|
|
3826
|
-
|
|
4128
|
+
const nextError = reason instanceof Error ? reason.message : t("object_delete_error");
|
|
4129
|
+
setError(nextError);
|
|
4130
|
+
message.error(nextError);
|
|
3827
4131
|
setIsDeleting(false);
|
|
3828
4132
|
setDeleteConfirmOpen(false);
|
|
3829
4133
|
}
|
|
3830
|
-
}, [client, id, listPath, router, slug, t]);
|
|
3831
|
-
const handleNavigateBack =
|
|
4134
|
+
}, [client, id, listPath, message, router, slug, t]);
|
|
4135
|
+
const handleNavigateBack = useCallback7(() => {
|
|
3832
4136
|
router.push(listPath);
|
|
3833
4137
|
}, [listPath, router]);
|
|
3834
|
-
const handleRunObjectAction =
|
|
4138
|
+
const handleRunObjectAction = useCallback7(async (actionSlug) => {
|
|
4139
|
+
var _a2, _b2;
|
|
3835
4140
|
setActiveActionSlug(actionSlug);
|
|
3836
4141
|
setError(null);
|
|
3837
4142
|
try {
|
|
@@ -3844,13 +4149,17 @@ function useObjectPageController({
|
|
|
3844
4149
|
setData(nextDetail);
|
|
3845
4150
|
setValues(response.item);
|
|
3846
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 }));
|
|
3847
4154
|
} catch (reason) {
|
|
3848
|
-
|
|
4155
|
+
const nextError = reason instanceof Error ? reason.message : t("object_action_error");
|
|
4156
|
+
setError(nextError);
|
|
4157
|
+
message.error(nextError);
|
|
3849
4158
|
} finally {
|
|
3850
4159
|
setActiveActionSlug(null);
|
|
3851
4160
|
}
|
|
3852
|
-
}, [cacheKey, client, data, id, slug, t]);
|
|
3853
|
-
const handleOpenDeletePreview =
|
|
4161
|
+
}, [cacheKey, client, data, id, message, objectActions, slug, t]);
|
|
4162
|
+
const handleOpenDeletePreview = useCallback7(async () => {
|
|
3854
4163
|
setActionsAnchorEl(null);
|
|
3855
4164
|
setDeleteConfirmOpen(true);
|
|
3856
4165
|
setDeletePreview(null);
|
|
@@ -3901,7 +4210,7 @@ function useObjectPageController({
|
|
|
3901
4210
|
}
|
|
3902
4211
|
|
|
3903
4212
|
// src/components/ObjectPage.tsx
|
|
3904
|
-
import { jsx as
|
|
4213
|
+
import { jsx as jsx24, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3905
4214
|
function ObjectPage({ client, slug, id, router }) {
|
|
3906
4215
|
var _a, _b;
|
|
3907
4216
|
const locale = useAdminLocale();
|
|
@@ -3909,7 +4218,7 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
3909
4218
|
const resolvedRouter = useAdminRouter(router);
|
|
3910
4219
|
const location = useAdminLocation(resolvedRouter);
|
|
3911
4220
|
const pathname = location.pathname;
|
|
3912
|
-
const theme =
|
|
4221
|
+
const theme = useTheme4();
|
|
3913
4222
|
const isPhone = useMediaQuery3(theme.breakpoints.down("sm"));
|
|
3914
4223
|
const listPath = pathname.split("/").slice(0, -1).join("/");
|
|
3915
4224
|
const controller = useObjectPageController({
|
|
@@ -3922,54 +4231,54 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
3922
4231
|
});
|
|
3923
4232
|
useAdminDocumentTitle(t("admin_title"), (_b = (_a = controller.meta) == null ? void 0 : _a.title) != null ? _b : slug, controller.objectTitle);
|
|
3924
4233
|
if (controller.isLoading && !controller.data) {
|
|
3925
|
-
return /* @__PURE__ */
|
|
4234
|
+
return /* @__PURE__ */ jsx24(ObjectPageSkeleton, {});
|
|
3926
4235
|
}
|
|
3927
4236
|
if (controller.error && !controller.data) {
|
|
3928
|
-
return /* @__PURE__ */
|
|
4237
|
+
return /* @__PURE__ */ jsx24(Alert6, { severity: "error", children: controller.error });
|
|
3929
4238
|
}
|
|
3930
4239
|
if (!controller.data || !controller.meta) {
|
|
3931
|
-
return /* @__PURE__ */
|
|
4240
|
+
return /* @__PURE__ */ jsx24(ObjectPageSkeleton, {});
|
|
3932
4241
|
}
|
|
3933
|
-
return /* @__PURE__ */
|
|
3934
|
-
/* @__PURE__ */
|
|
3935
|
-
/* @__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(
|
|
3936
4245
|
MainHeader,
|
|
3937
4246
|
{
|
|
3938
4247
|
title: controller.objectTitle,
|
|
3939
4248
|
subtitle: controller.meta.slug,
|
|
3940
|
-
beforeSubtitle: /* @__PURE__ */
|
|
4249
|
+
beforeSubtitle: /* @__PURE__ */ jsx24(
|
|
3941
4250
|
IconButton4,
|
|
3942
4251
|
{
|
|
3943
4252
|
"aria-label": t("back"),
|
|
3944
4253
|
onClick: controller.handleNavigateBack,
|
|
3945
4254
|
size: "small",
|
|
3946
4255
|
sx: { ml: -0.5 },
|
|
3947
|
-
children: /* @__PURE__ */
|
|
4256
|
+
children: /* @__PURE__ */ jsx24(ArrowBackIcon, { fontSize: "small" })
|
|
3948
4257
|
}
|
|
3949
4258
|
),
|
|
3950
|
-
actions: isPhone ? /* @__PURE__ */
|
|
4259
|
+
actions: isPhone ? /* @__PURE__ */ jsx24(
|
|
3951
4260
|
IconButton4,
|
|
3952
4261
|
{
|
|
3953
4262
|
"aria-label": t("actions"),
|
|
3954
4263
|
onClick: (event) => controller.setActionsAnchorEl(event.currentTarget),
|
|
3955
4264
|
size: "small",
|
|
3956
4265
|
sx: { mr: -0.5 },
|
|
3957
|
-
children: /* @__PURE__ */
|
|
4266
|
+
children: /* @__PURE__ */ jsx24(MoreVertIcon2, { fontSize: "small" })
|
|
3958
4267
|
}
|
|
3959
4268
|
) : void 0,
|
|
3960
|
-
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,
|
|
3961
4270
|
error: controller.error
|
|
3962
4271
|
}
|
|
3963
4272
|
),
|
|
3964
|
-
/* @__PURE__ */
|
|
3965
|
-
|
|
4273
|
+
/* @__PURE__ */ jsxs16(
|
|
4274
|
+
Stack13,
|
|
3966
4275
|
{
|
|
3967
4276
|
direction: { xs: "column", lg: "row" },
|
|
3968
4277
|
spacing: 1.5,
|
|
3969
4278
|
sx: { flex: 1, minHeight: 0, alignItems: "stretch" },
|
|
3970
4279
|
children: [
|
|
3971
|
-
/* @__PURE__ */
|
|
3972
|
-
|
|
4280
|
+
/* @__PURE__ */ jsx24(
|
|
4281
|
+
Paper9,
|
|
3973
4282
|
{
|
|
3974
4283
|
sx: {
|
|
3975
4284
|
borderRadius: "10px",
|
|
@@ -3977,13 +4286,13 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
3977
4286
|
minHeight: 0,
|
|
3978
4287
|
overflow: "hidden"
|
|
3979
4288
|
},
|
|
3980
|
-
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) => {
|
|
3981
4290
|
const field = controller.fieldMap.get(fieldName);
|
|
3982
4291
|
if (!field) {
|
|
3983
4292
|
return null;
|
|
3984
4293
|
}
|
|
3985
4294
|
if (controller.editableFieldNames.has(fieldName)) {
|
|
3986
|
-
return /* @__PURE__ */
|
|
4295
|
+
return /* @__PURE__ */ jsx24(
|
|
3987
4296
|
ObjectField,
|
|
3988
4297
|
{
|
|
3989
4298
|
field,
|
|
@@ -3995,7 +4304,7 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
3995
4304
|
field.name
|
|
3996
4305
|
);
|
|
3997
4306
|
}
|
|
3998
|
-
return /* @__PURE__ */
|
|
4307
|
+
return /* @__PURE__ */ jsx24(
|
|
3999
4308
|
ReadonlyObjectField,
|
|
4000
4309
|
{
|
|
4001
4310
|
field,
|
|
@@ -4011,8 +4320,8 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
4011
4320
|
}) }) })
|
|
4012
4321
|
}
|
|
4013
4322
|
),
|
|
4014
|
-
/* @__PURE__ */
|
|
4015
|
-
|
|
4323
|
+
/* @__PURE__ */ jsx24(
|
|
4324
|
+
Paper9,
|
|
4016
4325
|
{
|
|
4017
4326
|
sx: {
|
|
4018
4327
|
width: { xs: "100%", lg: 280 },
|
|
@@ -4024,9 +4333,9 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
4024
4333
|
top: { lg: 0 },
|
|
4025
4334
|
display: isPhone ? "none" : void 0
|
|
4026
4335
|
},
|
|
4027
|
-
children: /* @__PURE__ */
|
|
4028
|
-
/* @__PURE__ */
|
|
4029
|
-
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(
|
|
4030
4339
|
Button5,
|
|
4031
4340
|
{
|
|
4032
4341
|
variant: "contained",
|
|
@@ -4035,7 +4344,7 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
4035
4344
|
children: controller.isSaving ? t("saving") : t("save")
|
|
4036
4345
|
}
|
|
4037
4346
|
) : null,
|
|
4038
|
-
/* @__PURE__ */
|
|
4347
|
+
/* @__PURE__ */ jsx24(
|
|
4039
4348
|
Button5,
|
|
4040
4349
|
{
|
|
4041
4350
|
variant: "outlined",
|
|
@@ -4045,7 +4354,7 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
4045
4354
|
children: t("delete")
|
|
4046
4355
|
}
|
|
4047
4356
|
),
|
|
4048
|
-
controller.objectActions.map((action) => /* @__PURE__ */
|
|
4357
|
+
controller.objectActions.map((action) => /* @__PURE__ */ jsx24(
|
|
4049
4358
|
Button5,
|
|
4050
4359
|
{
|
|
4051
4360
|
variant: "outlined",
|
|
@@ -4062,7 +4371,7 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
4062
4371
|
}
|
|
4063
4372
|
)
|
|
4064
4373
|
] }),
|
|
4065
|
-
/* @__PURE__ */
|
|
4374
|
+
/* @__PURE__ */ jsxs16(
|
|
4066
4375
|
Menu2,
|
|
4067
4376
|
{
|
|
4068
4377
|
anchorEl: controller.actionsAnchorEl,
|
|
@@ -4078,7 +4387,7 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
4078
4387
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
4079
4388
|
transformOrigin: { vertical: "top", horizontal: "right" },
|
|
4080
4389
|
children: [
|
|
4081
|
-
controller.isDirty ? /* @__PURE__ */
|
|
4390
|
+
controller.isDirty ? /* @__PURE__ */ jsx24(
|
|
4082
4391
|
MenuItem3,
|
|
4083
4392
|
{
|
|
4084
4393
|
onClick: () => {
|
|
@@ -4089,7 +4398,7 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
4089
4398
|
children: controller.isSaving ? t("saving") : t("save")
|
|
4090
4399
|
}
|
|
4091
4400
|
) : null,
|
|
4092
|
-
/* @__PURE__ */
|
|
4401
|
+
/* @__PURE__ */ jsx24(
|
|
4093
4402
|
MenuItem3,
|
|
4094
4403
|
{
|
|
4095
4404
|
onClick: () => void controller.handleOpenDeletePreview(),
|
|
@@ -4098,7 +4407,7 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
4098
4407
|
children: t("delete")
|
|
4099
4408
|
}
|
|
4100
4409
|
),
|
|
4101
|
-
controller.objectActions.map((action) => /* @__PURE__ */
|
|
4410
|
+
controller.objectActions.map((action) => /* @__PURE__ */ jsx24(
|
|
4102
4411
|
MenuItem3,
|
|
4103
4412
|
{
|
|
4104
4413
|
onClick: () => {
|
|
@@ -4113,7 +4422,7 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
4113
4422
|
]
|
|
4114
4423
|
}
|
|
4115
4424
|
),
|
|
4116
|
-
/* @__PURE__ */
|
|
4425
|
+
/* @__PURE__ */ jsx24(
|
|
4117
4426
|
DeletePreviewDialog,
|
|
4118
4427
|
{
|
|
4119
4428
|
open: controller.deleteConfirmOpen,
|
|
@@ -4137,8 +4446,8 @@ function ObjectPage({ client, slug, id, router }) {
|
|
|
4137
4446
|
}
|
|
4138
4447
|
|
|
4139
4448
|
// src/components/Shell.tsx
|
|
4140
|
-
import { useEffect as
|
|
4141
|
-
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";
|
|
4142
4451
|
import { ThemeProvider } from "@mui/material/styles";
|
|
4143
4452
|
|
|
4144
4453
|
// src/theme/defaultAdminTheme.ts
|
|
@@ -4269,8 +4578,8 @@ var defaultAdminTheme = createTheme({
|
|
|
4269
4578
|
});
|
|
4270
4579
|
|
|
4271
4580
|
// src/components/layout/Main.tsx
|
|
4272
|
-
import { Box as
|
|
4273
|
-
import { jsx as
|
|
4581
|
+
import { Box as Box14 } from "@mui/material";
|
|
4582
|
+
import { jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4274
4583
|
function Main({ children }) {
|
|
4275
4584
|
const { pathname } = useAdminLocation();
|
|
4276
4585
|
const { pendingPath, pendingView } = useShellContext();
|
|
@@ -4279,8 +4588,8 @@ function Main({ children }) {
|
|
|
4279
4588
|
return normalizedPath.replace(/^\/(ru|en)(?=\/|$)/, "") || "/";
|
|
4280
4589
|
};
|
|
4281
4590
|
const isPendingNavigation = pendingPath !== null && normalizeAdminPath2(pathname) !== normalizeAdminPath2(pendingPath);
|
|
4282
|
-
return /* @__PURE__ */
|
|
4283
|
-
|
|
4591
|
+
return /* @__PURE__ */ jsxs17(
|
|
4592
|
+
Box14,
|
|
4284
4593
|
{
|
|
4285
4594
|
sx: {
|
|
4286
4595
|
flex: 1,
|
|
@@ -4293,8 +4602,8 @@ function Main({ children }) {
|
|
|
4293
4602
|
},
|
|
4294
4603
|
children: [
|
|
4295
4604
|
children,
|
|
4296
|
-
isPendingNavigation ? /* @__PURE__ */
|
|
4297
|
-
|
|
4605
|
+
isPendingNavigation ? /* @__PURE__ */ jsx25(
|
|
4606
|
+
Box14,
|
|
4298
4607
|
{
|
|
4299
4608
|
sx: {
|
|
4300
4609
|
position: "absolute",
|
|
@@ -4302,7 +4611,7 @@ function Main({ children }) {
|
|
|
4302
4611
|
zIndex: 5,
|
|
4303
4612
|
backgroundColor: "background.default"
|
|
4304
4613
|
},
|
|
4305
|
-
children: pendingView === "model" || pendingView === "overview" ? /* @__PURE__ */
|
|
4614
|
+
children: pendingView === "model" || pendingView === "overview" ? /* @__PURE__ */ jsx25(ModelPageSkeleton, {}) : /* @__PURE__ */ jsx25(ModelPageSkeleton, {})
|
|
4306
4615
|
}
|
|
4307
4616
|
) : null
|
|
4308
4617
|
]
|
|
@@ -4312,8 +4621,8 @@ function Main({ children }) {
|
|
|
4312
4621
|
|
|
4313
4622
|
// src/components/layout/Sidebar.tsx
|
|
4314
4623
|
import { memo as memo8 } from "react";
|
|
4315
|
-
import { Box as
|
|
4316
|
-
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";
|
|
4317
4626
|
var Sidebar = memo8(function Sidebar2({ models, blocks, basePath }) {
|
|
4318
4627
|
var _a;
|
|
4319
4628
|
const t = useAdminTranslation();
|
|
@@ -4326,8 +4635,8 @@ var Sidebar = memo8(function Sidebar2({ models, blocks, basePath }) {
|
|
|
4326
4635
|
const relativePath = matchedBasePath ? effectivePathname.slice(matchedBasePath.length) : "";
|
|
4327
4636
|
const activeModelSlug = (_a = relativePath.split("/").filter(Boolean)[0]) != null ? _a : null;
|
|
4328
4637
|
const isOverviewActive = matchedBasePath !== null && (effectivePathname === matchedBasePath || effectivePathname === `${matchedBasePath}/`);
|
|
4329
|
-
return /* @__PURE__ */
|
|
4330
|
-
|
|
4638
|
+
return /* @__PURE__ */ jsx26(Box15, { sx: { height: "100%", overflow: "hidden" }, children: /* @__PURE__ */ jsx26(
|
|
4639
|
+
Box15,
|
|
4331
4640
|
{
|
|
4332
4641
|
sx: {
|
|
4333
4642
|
height: "100%",
|
|
@@ -4338,14 +4647,14 @@ var Sidebar = memo8(function Sidebar2({ models, blocks, basePath }) {
|
|
|
4338
4647
|
ml: 0,
|
|
4339
4648
|
pl: 0
|
|
4340
4649
|
},
|
|
4341
|
-
children: /* @__PURE__ */
|
|
4342
|
-
/* @__PURE__ */
|
|
4650
|
+
children: /* @__PURE__ */ jsxs18(Box15, { sx: { direction: "ltr", pl: 1 }, children: [
|
|
4651
|
+
/* @__PURE__ */ jsx26(
|
|
4343
4652
|
NavLink,
|
|
4344
4653
|
{
|
|
4345
4654
|
href: basePath,
|
|
4346
4655
|
style: { textDecoration: "none", display: "block" },
|
|
4347
4656
|
onClick: () => startPendingNavigation(basePath, "overview"),
|
|
4348
|
-
children: /* @__PURE__ */
|
|
4657
|
+
children: /* @__PURE__ */ jsx26(
|
|
4349
4658
|
ListItemButton3,
|
|
4350
4659
|
{
|
|
4351
4660
|
selected: isOverviewActive,
|
|
@@ -4358,12 +4667,12 @@ var Sidebar = memo8(function Sidebar2({ models, blocks, basePath }) {
|
|
|
4358
4667
|
backgroundColor: isOverviewActive ? "rgba(255, 255, 255, 0.2)" : "rgba(255, 255, 255, 0.055)"
|
|
4359
4668
|
}
|
|
4360
4669
|
},
|
|
4361
|
-
children: /* @__PURE__ */
|
|
4670
|
+
children: /* @__PURE__ */ jsx26(Typography8, { variant: "subtitle1", sx: { fontWeight: 700 }, children: t("overview") })
|
|
4362
4671
|
}
|
|
4363
4672
|
)
|
|
4364
4673
|
}
|
|
4365
4674
|
),
|
|
4366
|
-
/* @__PURE__ */
|
|
4675
|
+
/* @__PURE__ */ jsx26(
|
|
4367
4676
|
ModelsBlocks,
|
|
4368
4677
|
{
|
|
4369
4678
|
models,
|
|
@@ -4380,7 +4689,7 @@ var Sidebar = memo8(function Sidebar2({ models, blocks, basePath }) {
|
|
|
4380
4689
|
});
|
|
4381
4690
|
|
|
4382
4691
|
// src/components/Shell.tsx
|
|
4383
|
-
import { jsx as
|
|
4692
|
+
import { jsx as jsx27, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4384
4693
|
function normalizeAdminPath(path) {
|
|
4385
4694
|
const normalizedPath = path.endsWith("/") && path !== "/" ? path.slice(0, -1) : path;
|
|
4386
4695
|
return normalizedPath.replace(/^\/(ru|en)(?=\/|$)/, "") || "/";
|
|
@@ -4392,18 +4701,18 @@ function Shell({ client, models, blocks, basePath, locale, children, theme, rout
|
|
|
4392
4701
|
const location = useAdminLocation(resolvedRouter);
|
|
4393
4702
|
const pathname = location.pathname;
|
|
4394
4703
|
const isDesktopSidebar = useMediaQuery4(activeTheme.breakpoints.up("lg"));
|
|
4395
|
-
const [isMobileSidebarOpen, setIsMobileSidebarOpen] =
|
|
4396
|
-
const [pendingPath, setPendingPath] =
|
|
4397
|
-
const [pendingView, setPendingView] =
|
|
4398
|
-
|
|
4704
|
+
const [isMobileSidebarOpen, setIsMobileSidebarOpen] = useState12(false);
|
|
4705
|
+
const [pendingPath, setPendingPath] = useState12(null);
|
|
4706
|
+
const [pendingView, setPendingView] = useState12(null);
|
|
4707
|
+
useEffect12(() => {
|
|
4399
4708
|
if (isDesktopSidebar) {
|
|
4400
4709
|
setIsMobileSidebarOpen(false);
|
|
4401
4710
|
}
|
|
4402
4711
|
}, [isDesktopSidebar]);
|
|
4403
|
-
|
|
4712
|
+
useEffect12(() => {
|
|
4404
4713
|
setIsMobileSidebarOpen(false);
|
|
4405
4714
|
}, [pathname]);
|
|
4406
|
-
|
|
4715
|
+
useEffect12(() => {
|
|
4407
4716
|
if (pendingPath === null) {
|
|
4408
4717
|
return;
|
|
4409
4718
|
}
|
|
@@ -4412,7 +4721,7 @@ function Shell({ client, models, blocks, basePath, locale, children, theme, rout
|
|
|
4412
4721
|
setPendingView(null);
|
|
4413
4722
|
}
|
|
4414
4723
|
}, [pathname, pendingPath]);
|
|
4415
|
-
const shellContextValue =
|
|
4724
|
+
const shellContextValue = useMemo11(() => ({
|
|
4416
4725
|
isMobile: !isDesktopSidebar,
|
|
4417
4726
|
openMobileSidebar: () => setIsMobileSidebarOpen(true),
|
|
4418
4727
|
pendingPath,
|
|
@@ -4425,9 +4734,9 @@ function Shell({ client, models, blocks, basePath, locale, children, theme, rout
|
|
|
4425
4734
|
setPendingView(view);
|
|
4426
4735
|
}
|
|
4427
4736
|
}), [isDesktopSidebar, pathname, pendingPath, pendingView]);
|
|
4428
|
-
return /* @__PURE__ */
|
|
4429
|
-
/* @__PURE__ */
|
|
4430
|
-
/* @__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(
|
|
4431
4740
|
GlobalStyles,
|
|
4432
4741
|
{
|
|
4433
4742
|
styles: (muiTheme) => ({
|
|
@@ -4466,8 +4775,8 @@ function Shell({ client, models, blocks, basePath, locale, children, theme, rout
|
|
|
4466
4775
|
})
|
|
4467
4776
|
}
|
|
4468
4777
|
),
|
|
4469
|
-
/* @__PURE__ */
|
|
4470
|
-
|
|
4778
|
+
/* @__PURE__ */ jsx27(
|
|
4779
|
+
Box16,
|
|
4471
4780
|
{
|
|
4472
4781
|
"data-xladmin-root": "true",
|
|
4473
4782
|
sx: {
|
|
@@ -4477,15 +4786,15 @@ function Shell({ client, models, blocks, basePath, locale, children, theme, rout
|
|
|
4477
4786
|
backgroundColor: "background.default",
|
|
4478
4787
|
backgroundImage: "none"
|
|
4479
4788
|
},
|
|
4480
|
-
children: /* @__PURE__ */
|
|
4481
|
-
|
|
4789
|
+
children: /* @__PURE__ */ jsxs19(
|
|
4790
|
+
Stack14,
|
|
4482
4791
|
{
|
|
4483
4792
|
direction: { xs: "column", lg: "row" },
|
|
4484
4793
|
spacing: 0,
|
|
4485
4794
|
sx: { height: "100%", minHeight: 0, alignItems: "stretch" },
|
|
4486
4795
|
children: [
|
|
4487
|
-
/* @__PURE__ */
|
|
4488
|
-
|
|
4796
|
+
/* @__PURE__ */ jsx27(
|
|
4797
|
+
Box16,
|
|
4489
4798
|
{
|
|
4490
4799
|
sx: {
|
|
4491
4800
|
display: { xs: "none", lg: "block" },
|
|
@@ -4496,11 +4805,11 @@ function Shell({ client, models, blocks, basePath, locale, children, theme, rout
|
|
|
4496
4805
|
pl: 0,
|
|
4497
4806
|
pr: 1
|
|
4498
4807
|
},
|
|
4499
|
-
children: /* @__PURE__ */
|
|
4808
|
+
children: /* @__PURE__ */ jsx27(Sidebar, { models, blocks, basePath })
|
|
4500
4809
|
}
|
|
4501
4810
|
),
|
|
4502
|
-
/* @__PURE__ */
|
|
4503
|
-
|
|
4811
|
+
/* @__PURE__ */ jsx27(
|
|
4812
|
+
Box16,
|
|
4504
4813
|
{
|
|
4505
4814
|
sx: {
|
|
4506
4815
|
flex: 1,
|
|
@@ -4513,7 +4822,7 @@ function Shell({ client, models, blocks, basePath, locale, children, theme, rout
|
|
|
4513
4822
|
py: { xs: 1, sm: 1.5, lg: 2 },
|
|
4514
4823
|
pl: { xs: 1, sm: 1.5, lg: 1 }
|
|
4515
4824
|
},
|
|
4516
|
-
children: /* @__PURE__ */
|
|
4825
|
+
children: /* @__PURE__ */ jsx27(Main, { children })
|
|
4517
4826
|
}
|
|
4518
4827
|
)
|
|
4519
4828
|
]
|
|
@@ -4521,7 +4830,7 @@ function Shell({ client, models, blocks, basePath, locale, children, theme, rout
|
|
|
4521
4830
|
)
|
|
4522
4831
|
}
|
|
4523
4832
|
),
|
|
4524
|
-
/* @__PURE__ */
|
|
4833
|
+
/* @__PURE__ */ jsx27(
|
|
4525
4834
|
Drawer,
|
|
4526
4835
|
{
|
|
4527
4836
|
anchor: "left",
|
|
@@ -4540,10 +4849,10 @@ function Shell({ client, models, blocks, basePath, locale, children, theme, rout
|
|
|
4540
4849
|
}
|
|
4541
4850
|
}
|
|
4542
4851
|
},
|
|
4543
|
-
children: /* @__PURE__ */
|
|
4852
|
+
children: /* @__PURE__ */ jsx27(Box16, { sx: { height: "100%", minHeight: 0, pr: 1.5 }, children: /* @__PURE__ */ jsx27(Sidebar, { models, blocks, basePath }) })
|
|
4544
4853
|
}
|
|
4545
4854
|
)
|
|
4546
|
-
] }) }) }) }) });
|
|
4855
|
+
] }) }) }) }) }) });
|
|
4547
4856
|
}
|
|
4548
4857
|
export {
|
|
4549
4858
|
AdminLocaleProvider,
|
|
@@ -4572,6 +4881,7 @@ export {
|
|
|
4572
4881
|
translateAdmin,
|
|
4573
4882
|
useAdminLocale,
|
|
4574
4883
|
useAdminLocation,
|
|
4884
|
+
useAdminMessage,
|
|
4575
4885
|
useAdminRouter,
|
|
4576
4886
|
useAdminTranslation
|
|
4577
4887
|
};
|