frontend-plus-react 0.1.13 → 0.1.15
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/index.cjs +283 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +540 -298
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -605,7 +605,7 @@ var require_json4all = __commonJS({
|
|
|
605
605
|
});
|
|
606
606
|
|
|
607
607
|
// src/components/grid/GenericDataGrid.tsx
|
|
608
|
-
import { useState as
|
|
608
|
+
import { useState as useState5, useEffect, useCallback as useCallback4, useMemo as useMemo2, useRef } from "react";
|
|
609
609
|
import { DataGrid } from "react-data-grid";
|
|
610
610
|
import "react-data-grid/lib/styles.css";
|
|
611
611
|
|
|
@@ -786,7 +786,7 @@ var useApiCall = () => {
|
|
|
786
786
|
};
|
|
787
787
|
|
|
788
788
|
// src/components/grid/GenericDataGrid.tsx
|
|
789
|
-
import { CircularProgress, Typography as Typography5, Box as
|
|
789
|
+
import { CircularProgress as CircularProgress2, Typography as Typography5, Box as Box8, Alert, useTheme as useTheme3 } from "@mui/material";
|
|
790
790
|
|
|
791
791
|
// src/utils/functions.tsx
|
|
792
792
|
var JSON4all = __toESM(require_json4all(), 1);
|
|
@@ -1027,17 +1027,131 @@ var ConfirmDialog = ({ open, onClose, title, message }) => {
|
|
|
1027
1027
|
);
|
|
1028
1028
|
};
|
|
1029
1029
|
|
|
1030
|
+
// src/components/grid/DataGridOptionsDialog.tsx
|
|
1031
|
+
import {
|
|
1032
|
+
Popover,
|
|
1033
|
+
List,
|
|
1034
|
+
ListItemButton,
|
|
1035
|
+
ListItemIcon,
|
|
1036
|
+
ListItemText,
|
|
1037
|
+
Paper,
|
|
1038
|
+
CircularProgress,
|
|
1039
|
+
Box
|
|
1040
|
+
} from "@mui/material";
|
|
1041
|
+
import { useState as useState3 } from "react";
|
|
1042
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1043
|
+
var DataGridOptionsDialog = ({
|
|
1044
|
+
open,
|
|
1045
|
+
onClose,
|
|
1046
|
+
options,
|
|
1047
|
+
anchorEl
|
|
1048
|
+
}) => {
|
|
1049
|
+
const [isExecuting, setIsExecuting] = useState3(false);
|
|
1050
|
+
const handleOptionClick = async (handler) => {
|
|
1051
|
+
try {
|
|
1052
|
+
setIsExecuting(true);
|
|
1053
|
+
await handler();
|
|
1054
|
+
} catch (error) {
|
|
1055
|
+
console.error("Error ejecutando handler:", error);
|
|
1056
|
+
} finally {
|
|
1057
|
+
setIsExecuting(false);
|
|
1058
|
+
onClose();
|
|
1059
|
+
}
|
|
1060
|
+
};
|
|
1061
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1062
|
+
open && /* @__PURE__ */ jsx3(
|
|
1063
|
+
"div",
|
|
1064
|
+
{
|
|
1065
|
+
style: {
|
|
1066
|
+
position: "fixed",
|
|
1067
|
+
top: 0,
|
|
1068
|
+
left: 0,
|
|
1069
|
+
right: 0,
|
|
1070
|
+
bottom: 0,
|
|
1071
|
+
backgroundColor: "rgba(0, 0, 0, 0.2)",
|
|
1072
|
+
zIndex: 1200,
|
|
1073
|
+
pointerEvents: "none"
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
),
|
|
1077
|
+
/* @__PURE__ */ jsx3(
|
|
1078
|
+
Popover,
|
|
1079
|
+
{
|
|
1080
|
+
open,
|
|
1081
|
+
anchorEl,
|
|
1082
|
+
onClose,
|
|
1083
|
+
anchorOrigin: {
|
|
1084
|
+
vertical: "bottom",
|
|
1085
|
+
horizontal: "left"
|
|
1086
|
+
},
|
|
1087
|
+
transformOrigin: {
|
|
1088
|
+
vertical: "top",
|
|
1089
|
+
horizontal: "left"
|
|
1090
|
+
},
|
|
1091
|
+
slotProps: {
|
|
1092
|
+
paper: {
|
|
1093
|
+
sx: {
|
|
1094
|
+
zIndex: 1300
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
},
|
|
1098
|
+
children: /* @__PURE__ */ jsxs3(Paper, { sx: { minWidth: 150, maxWidth: 350 }, children: [
|
|
1099
|
+
isExecuting && /* @__PURE__ */ jsx3(
|
|
1100
|
+
Box,
|
|
1101
|
+
{
|
|
1102
|
+
sx: {
|
|
1103
|
+
display: "flex",
|
|
1104
|
+
justifyContent: "center",
|
|
1105
|
+
alignItems: "center",
|
|
1106
|
+
p: 5
|
|
1107
|
+
},
|
|
1108
|
+
children: /* @__PURE__ */ jsx3(CircularProgress, { size: 40 })
|
|
1109
|
+
}
|
|
1110
|
+
),
|
|
1111
|
+
!isExecuting && /* @__PURE__ */ jsx3(List, { sx: {
|
|
1112
|
+
py: 0,
|
|
1113
|
+
"& .MuiListItemButton-root": {
|
|
1114
|
+
py: 0.5,
|
|
1115
|
+
px: 1.5,
|
|
1116
|
+
minHeight: 36
|
|
1117
|
+
},
|
|
1118
|
+
"& .MuiListItemIcon-root": {
|
|
1119
|
+
minWidth: 32
|
|
1120
|
+
},
|
|
1121
|
+
"& .MuiListItemText-primary": {
|
|
1122
|
+
fontSize: "0.85rem"
|
|
1123
|
+
},
|
|
1124
|
+
"& .MuiSvgIcon-root": {
|
|
1125
|
+
fontSize: 18
|
|
1126
|
+
}
|
|
1127
|
+
}, children: options.filter((option) => option.visible !== false).map((option) => /* @__PURE__ */ jsxs3(
|
|
1128
|
+
ListItemButton,
|
|
1129
|
+
{
|
|
1130
|
+
onClick: () => handleOptionClick(option.handler),
|
|
1131
|
+
children: [
|
|
1132
|
+
/* @__PURE__ */ jsx3(ListItemIcon, { children: option.icon }),
|
|
1133
|
+
/* @__PURE__ */ jsx3(ListItemText, { primary: option.label })
|
|
1134
|
+
]
|
|
1135
|
+
},
|
|
1136
|
+
option.id
|
|
1137
|
+
)) })
|
|
1138
|
+
] })
|
|
1139
|
+
}
|
|
1140
|
+
)
|
|
1141
|
+
] });
|
|
1142
|
+
};
|
|
1143
|
+
|
|
1030
1144
|
// src/components/grid/renderers/headerCellRenderers.tsx
|
|
1031
|
-
import { Box, IconButton, Tooltip, Typography } from "@mui/material";
|
|
1145
|
+
import { Box as Box2, IconButton, Tooltip, Typography } from "@mui/material";
|
|
1032
1146
|
import SearchIcon from "@mui/icons-material/Search";
|
|
1033
1147
|
import SearchOffIcon from "@mui/icons-material/SearchOff";
|
|
1034
1148
|
import MoreVertIcon from "@mui/icons-material/MoreVert";
|
|
1035
|
-
import { jsx as
|
|
1149
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1036
1150
|
var defaultColumnHeaderCellRenderer = (props, fieldDef) => {
|
|
1037
1151
|
const { column } = props;
|
|
1038
1152
|
const isPrimaryKey = fieldDef.isPk;
|
|
1039
|
-
return /* @__PURE__ */
|
|
1040
|
-
|
|
1153
|
+
return /* @__PURE__ */ jsx4(
|
|
1154
|
+
Box2,
|
|
1041
1155
|
{
|
|
1042
1156
|
sx: {
|
|
1043
1157
|
display: "flex",
|
|
@@ -1048,7 +1162,7 @@ var defaultColumnHeaderCellRenderer = (props, fieldDef) => {
|
|
|
1048
1162
|
boxSizing: "border-box",
|
|
1049
1163
|
height: "100%"
|
|
1050
1164
|
},
|
|
1051
|
-
children: /* @__PURE__ */
|
|
1165
|
+
children: /* @__PURE__ */ jsx4(
|
|
1052
1166
|
Typography,
|
|
1053
1167
|
{
|
|
1054
1168
|
variant: "body2",
|
|
@@ -1064,41 +1178,42 @@ var defaultColumnHeaderCellRenderer = (props, fieldDef) => {
|
|
|
1064
1178
|
}
|
|
1065
1179
|
);
|
|
1066
1180
|
};
|
|
1067
|
-
var actionsColumnHeaderCellRenderer = (props, isFilterRowVisible, toggleFilterVisibility) =>
|
|
1068
|
-
/* @__PURE__ */
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
] });
|
|
1091
|
-
|
|
1181
|
+
var actionsColumnHeaderCellRenderer = (props, isFilterRowVisible, toggleFilterVisibility, handleDataGridOptions) => {
|
|
1182
|
+
return /* @__PURE__ */ jsxs4(Box2, { sx: { display: "flex", flexDirection: "row", alignItems: "center", justifyContent: "center", gap: 0.2 }, children: [
|
|
1183
|
+
/* @__PURE__ */ jsx4(
|
|
1184
|
+
IconButton,
|
|
1185
|
+
{
|
|
1186
|
+
color: "inherit",
|
|
1187
|
+
onClick: toggleFilterVisibility,
|
|
1188
|
+
size: "small",
|
|
1189
|
+
title: isFilterRowVisible ? "Ocultar filtros" : "Mostrar filtros",
|
|
1190
|
+
sx: { p: 0.25 },
|
|
1191
|
+
children: isFilterRowVisible ? /* @__PURE__ */ jsx4(SearchOffIcon, { sx: { fontSize: 18 } }) : /* @__PURE__ */ jsx4(SearchIcon, { sx: { fontSize: 18 } })
|
|
1192
|
+
}
|
|
1193
|
+
),
|
|
1194
|
+
/* @__PURE__ */ jsx4(
|
|
1195
|
+
IconButton,
|
|
1196
|
+
{
|
|
1197
|
+
onClick: (event) => handleDataGridOptions(event),
|
|
1198
|
+
size: "small",
|
|
1199
|
+
title: "Opciones de esta tabla",
|
|
1200
|
+
sx: { p: 0.25 },
|
|
1201
|
+
children: /* @__PURE__ */ jsx4(MoreVertIcon, { sx: { fontSize: 20, variant: "filled", size: "small" } })
|
|
1202
|
+
}
|
|
1203
|
+
)
|
|
1204
|
+
] });
|
|
1205
|
+
};
|
|
1206
|
+
var detailColumnCellHeaderRenderer = (props, detailTable) => /* @__PURE__ */ jsx4(Tooltip, { title: detailTable.label, children: /* @__PURE__ */ jsx4(Typography, { variant: "caption", sx: { fontSize: "0.75rem", fontWeight: "bold" }, children: detailTable.abr.toUpperCase() }) });
|
|
1092
1207
|
|
|
1093
1208
|
// src/components/grid/FilterInputRender.tsx
|
|
1094
1209
|
import { InputBase } from "@mui/material";
|
|
1095
|
-
import { jsx as
|
|
1210
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1096
1211
|
function FilterInputRenderer({
|
|
1097
1212
|
column,
|
|
1098
1213
|
filters,
|
|
1099
1214
|
setFilters
|
|
1100
1215
|
}) {
|
|
1101
|
-
return /* @__PURE__ */
|
|
1216
|
+
return /* @__PURE__ */ jsx5(
|
|
1102
1217
|
InputBase,
|
|
1103
1218
|
{
|
|
1104
1219
|
value: filters[column.key] || "",
|
|
@@ -1123,13 +1238,13 @@ function FilterInputRenderer({
|
|
|
1123
1238
|
var FilterInputRender_default = FilterInputRenderer;
|
|
1124
1239
|
|
|
1125
1240
|
// src/components/grid/renderers/summaryCellRenderers.tsx
|
|
1126
|
-
import { Box as
|
|
1127
|
-
import { jsx as
|
|
1241
|
+
import { Box as Box3 } from "@mui/material";
|
|
1242
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1128
1243
|
var defaultColumnSummaryCellRenderer = (props, fixedFields, isFilterRowVisible, filters, setFilters) => {
|
|
1129
1244
|
const { column } = props;
|
|
1130
1245
|
const fixedFieldEntry = fixedFields?.find((f) => f.fieldName === column.key);
|
|
1131
1246
|
if (fixedFieldEntry && fixedFieldEntry.until === void 0 || !isFilterRowVisible) return null;
|
|
1132
|
-
return /* @__PURE__ */
|
|
1247
|
+
return /* @__PURE__ */ jsx6(Box3, { children: /* @__PURE__ */ jsx6(
|
|
1133
1248
|
FilterInputRender_default,
|
|
1134
1249
|
{
|
|
1135
1250
|
column,
|
|
@@ -1142,7 +1257,7 @@ var actionsColumnSummaryCellRenderer = (props) => null;
|
|
|
1142
1257
|
var detailColumnCellSummaryRenderer = (props) => null;
|
|
1143
1258
|
|
|
1144
1259
|
// src/components/grid/renderers/cellRenderers.tsx
|
|
1145
|
-
import { Box as
|
|
1260
|
+
import { Box as Box6, Button as Button2, IconButton as IconButton2, Tooltip as Tooltip3, Typography as Typography4, useTheme } from "@mui/material";
|
|
1146
1261
|
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
|
|
1147
1262
|
import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
|
|
1148
1263
|
import ViewHeadlineIcon from "@mui/icons-material/ViewHeadline";
|
|
@@ -1150,29 +1265,29 @@ import DeleteIcon from "@mui/icons-material/Delete";
|
|
|
1150
1265
|
import AddIcon from "@mui/icons-material/Add";
|
|
1151
1266
|
|
|
1152
1267
|
// src/components/grid/ExampleClientSideComponent.tsx
|
|
1153
|
-
import { Box as
|
|
1154
|
-
import { jsx as
|
|
1268
|
+
import { Box as Box4, Typography as Typography2 } from "@mui/material";
|
|
1269
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1155
1270
|
var ExampleClientSideComponent = ({ row, column, fieldDefinition }) => {
|
|
1156
1271
|
const value = row[column.key];
|
|
1157
|
-
return /* @__PURE__ */
|
|
1272
|
+
return /* @__PURE__ */ jsx7(Box4, { sx: {
|
|
1158
1273
|
padding: 0.5,
|
|
1159
1274
|
width: "100%",
|
|
1160
1275
|
height: "100%",
|
|
1161
1276
|
display: "flex",
|
|
1162
1277
|
alignItems: "center",
|
|
1163
1278
|
backgroundColor: value === "Special" ? "lightblue" : "transparent"
|
|
1164
|
-
}, children: /* @__PURE__ */
|
|
1279
|
+
}, children: /* @__PURE__ */ jsx7(Typography2, { variant: "body2", sx: { fontWeight: "bold" }, children: value ? `CS: ${value}` : "N/A" }) });
|
|
1165
1280
|
};
|
|
1166
1281
|
var ExampleClientSideComponent_default = ExampleClientSideComponent;
|
|
1167
1282
|
|
|
1168
1283
|
// src/components/grid/FallbackClientSideRenderer.tsx
|
|
1169
|
-
import { Box as
|
|
1284
|
+
import { Box as Box5, Typography as Typography3, Tooltip as Tooltip2 } from "@mui/material";
|
|
1170
1285
|
import WarningAmberIcon from "@mui/icons-material/WarningAmber";
|
|
1171
|
-
import { jsx as
|
|
1286
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1172
1287
|
var FallbackClientSideRenderer = ({ column, row, fieldDefinition }) => {
|
|
1173
1288
|
const clientSideName = fieldDefinition?.clientSide || "Desconocido";
|
|
1174
|
-
return /* @__PURE__ */
|
|
1175
|
-
|
|
1289
|
+
return /* @__PURE__ */ jsx8(Tooltip2, { title: `Componente clientSide '${clientSideName}' no implementado. Mostrando valor por defecto.`, children: /* @__PURE__ */ jsxs5(
|
|
1290
|
+
Box5,
|
|
1176
1291
|
{
|
|
1177
1292
|
sx: {
|
|
1178
1293
|
display: "flex",
|
|
@@ -1192,8 +1307,8 @@ var FallbackClientSideRenderer = ({ column, row, fieldDefinition }) => {
|
|
|
1192
1307
|
// Evita que el contenido se desborde
|
|
1193
1308
|
},
|
|
1194
1309
|
children: [
|
|
1195
|
-
/* @__PURE__ */
|
|
1196
|
-
/* @__PURE__ */
|
|
1310
|
+
/* @__PURE__ */ jsx8(Typography3, { variant: "body2", noWrap: true, sx: { flexGrow: 1 }, children: clientSideName + " not found" }),
|
|
1311
|
+
/* @__PURE__ */ jsx8(
|
|
1197
1312
|
WarningAmberIcon,
|
|
1198
1313
|
{
|
|
1199
1314
|
sx: {
|
|
@@ -1223,7 +1338,7 @@ var extendClientSides = (newRenderers) => {
|
|
|
1223
1338
|
};
|
|
1224
1339
|
|
|
1225
1340
|
// src/components/grid/renderers/cellRenderers.tsx
|
|
1226
|
-
import { jsx as
|
|
1341
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1227
1342
|
var allColumnsCellRenderer = (props) => {
|
|
1228
1343
|
const theme = useTheme();
|
|
1229
1344
|
const column = props.column;
|
|
@@ -1233,8 +1348,8 @@ var allColumnsCellRenderer = (props) => {
|
|
|
1233
1348
|
const detailColumn = column;
|
|
1234
1349
|
if (column.customType === "detail" && detailColumn.detailTable.abr === detailTableAbr) {
|
|
1235
1350
|
const { detailTable, fixedFields } = getDetailTableAndFixedFieldsForDetailTableAbr(detailColumn.tableDefinition, detailTableAbr, row);
|
|
1236
|
-
return /* @__PURE__ */
|
|
1237
|
-
|
|
1351
|
+
return /* @__PURE__ */ jsx9(
|
|
1352
|
+
Box6,
|
|
1238
1353
|
{
|
|
1239
1354
|
sx: {
|
|
1240
1355
|
// Se eliminó el padding para que la sub-grilla se extienda por completo
|
|
@@ -1249,7 +1364,7 @@ var allColumnsCellRenderer = (props) => {
|
|
|
1249
1364
|
onClick: (e) => e.stopPropagation(),
|
|
1250
1365
|
onKeyDown: (e) => e.stopPropagation(),
|
|
1251
1366
|
onDoubleClick: (e) => e.stopPropagation(),
|
|
1252
|
-
children: /* @__PURE__ */
|
|
1367
|
+
children: /* @__PURE__ */ jsx9(GenericDataGrid_default, { tableName: detailTable.table, fixedFields, gridStyles: { height: 322 } })
|
|
1253
1368
|
}
|
|
1254
1369
|
);
|
|
1255
1370
|
}
|
|
@@ -1265,9 +1380,9 @@ var allColumnsCellRenderer = (props) => {
|
|
|
1265
1380
|
if (fieldDef?.clientSide) {
|
|
1266
1381
|
const ClientSideComponent = clientSides[fieldDef.clientSide];
|
|
1267
1382
|
if (ClientSideComponent) {
|
|
1268
|
-
return /* @__PURE__ */
|
|
1383
|
+
return /* @__PURE__ */ jsx9(ClientSideComponent, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
|
|
1269
1384
|
}
|
|
1270
|
-
return /* @__PURE__ */
|
|
1385
|
+
return /* @__PURE__ */ jsx9(FallbackClientSideRenderer_default, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
|
|
1271
1386
|
}
|
|
1272
1387
|
let cellBackgroundColor = "transparent";
|
|
1273
1388
|
if (currentCellFeedback) {
|
|
@@ -1284,7 +1399,7 @@ var allColumnsCellRenderer = (props) => {
|
|
|
1284
1399
|
}
|
|
1285
1400
|
}
|
|
1286
1401
|
const value = row[props.column.key];
|
|
1287
|
-
return /* @__PURE__ */
|
|
1402
|
+
return /* @__PURE__ */ jsx9(Tooltip3, { title: currentCellFeedback?.message || "", children: /* @__PURE__ */ jsx9(Box6, { sx: { position: "absolute", top: 0, left: 0, width: "100%", height: "100%", backgroundColor: cellBackgroundColor, transition: "background-color 0.3s ease-in-out", display: "flex", alignItems: "center", paddingLeft: "8px", boxSizing: "border-box" }, children: /* @__PURE__ */ jsx9(Typography4, { variant: "body2", sx: { fontSize: "0.875rem", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", width: "100%" }, children: value === null || value === void 0 ? "" : String(value) }) }) });
|
|
1288
1403
|
}
|
|
1289
1404
|
case "detail": {
|
|
1290
1405
|
const detailColumn = column;
|
|
@@ -1292,7 +1407,7 @@ var allColumnsCellRenderer = (props) => {
|
|
|
1292
1407
|
const isExpanded = tableData.some(
|
|
1293
1408
|
(r) => r[DETAIL_ROW_INDICATOR] === detailTable.abr && getPrimaryKeyValues(r, primaryKey) === getPrimaryKeyValues({ ...row, [DETAIL_ROW_INDICATOR]: detailTable.abr }, primaryKey)
|
|
1294
1409
|
);
|
|
1295
|
-
return /* @__PURE__ */
|
|
1410
|
+
return /* @__PURE__ */ jsx9(Tooltip3, { title: detailTable.label, children: /* @__PURE__ */ jsx9(Box6, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%" }, children: /* @__PURE__ */ jsx9(
|
|
1296
1411
|
IconButton2,
|
|
1297
1412
|
{
|
|
1298
1413
|
onClick: (event) => {
|
|
@@ -1312,7 +1427,7 @@ var allColumnsCellRenderer = (props) => {
|
|
|
1312
1427
|
}
|
|
1313
1428
|
event.stopPropagation();
|
|
1314
1429
|
},
|
|
1315
|
-
children: isExpanded ? /* @__PURE__ */
|
|
1430
|
+
children: isExpanded ? /* @__PURE__ */ jsx9(KeyboardArrowUpIcon, { sx: { fontSize: 20 } }) : /* @__PURE__ */ jsx9(KeyboardArrowDownIcon, { sx: { fontSize: 20 } })
|
|
1316
1431
|
}
|
|
1317
1432
|
) }) });
|
|
1318
1433
|
}
|
|
@@ -1344,7 +1459,7 @@ var allColumnsCellRenderer = (props) => {
|
|
|
1344
1459
|
color: "primary"
|
|
1345
1460
|
}
|
|
1346
1461
|
];
|
|
1347
|
-
return /* @__PURE__ */
|
|
1462
|
+
return /* @__PURE__ */ jsx9(Box6, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%", gap: 0.5 }, children: gridActionButtons.map((actionDef) => tableDefinition.allow[actionDef.action] ? /* @__PURE__ */ jsx9(
|
|
1348
1463
|
Button2,
|
|
1349
1464
|
{
|
|
1350
1465
|
variant: "outlined",
|
|
@@ -1353,7 +1468,7 @@ var allColumnsCellRenderer = (props) => {
|
|
|
1353
1468
|
onClick: () => actionDef.handler(row),
|
|
1354
1469
|
title: actionDef.title,
|
|
1355
1470
|
sx: { width: 22, minWidth: 22, height: 22, "& .MuiButton-startIcon": { m: 0 } },
|
|
1356
|
-
children: /* @__PURE__ */
|
|
1471
|
+
children: /* @__PURE__ */ jsx9(actionDef.icon, { sx: { fontSize: 18 } })
|
|
1357
1472
|
},
|
|
1358
1473
|
actionDef.action
|
|
1359
1474
|
) : null) });
|
|
@@ -1364,10 +1479,10 @@ var allColumnsCellRenderer = (props) => {
|
|
|
1364
1479
|
};
|
|
1365
1480
|
|
|
1366
1481
|
// src/components/grid/InputRenderer.tsx
|
|
1367
|
-
import { useCallback as useCallback3, useMemo, useState as
|
|
1482
|
+
import { useCallback as useCallback3, useMemo, useState as useState4 } from "react";
|
|
1368
1483
|
import InputBase2 from "@mui/material/InputBase";
|
|
1369
1484
|
import { useTheme as useTheme2 } from "@mui/material";
|
|
1370
|
-
import { jsx as
|
|
1485
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1371
1486
|
function findChangedValues(oldRowData, newRowData, isNewRow) {
|
|
1372
1487
|
let changes = [];
|
|
1373
1488
|
for (const key in newRowData) {
|
|
@@ -1395,7 +1510,7 @@ function InputRenderer({
|
|
|
1395
1510
|
primaryKey
|
|
1396
1511
|
}) {
|
|
1397
1512
|
const tableName = tableDefinition.tableName;
|
|
1398
|
-
const [editingValue, setEditingValue] =
|
|
1513
|
+
const [editingValue, setEditingValue] = useState4(row[column.key]);
|
|
1399
1514
|
const theme = useTheme2();
|
|
1400
1515
|
const { showSuccess, showError } = useSnackbar();
|
|
1401
1516
|
const cellKey = getCellKey(row, column.key, primaryKey);
|
|
@@ -1568,7 +1683,7 @@ function InputRenderer({
|
|
|
1568
1683
|
}, [handleCommit, editingValue]);
|
|
1569
1684
|
const fieldDefinition = tableDefinition.fields.find((f) => f.name === column.key);
|
|
1570
1685
|
const isFieldEditable = fieldDefinition?.editable !== false;
|
|
1571
|
-
return /* @__PURE__ */
|
|
1686
|
+
return /* @__PURE__ */ jsx10(
|
|
1572
1687
|
InputBase2,
|
|
1573
1688
|
{
|
|
1574
1689
|
value: editingValue === null ? "" : editingValue,
|
|
@@ -1595,8 +1710,8 @@ function InputRenderer({
|
|
|
1595
1710
|
var InputRenderer_default = InputRenderer;
|
|
1596
1711
|
|
|
1597
1712
|
// src/components/grid/renderers/editCellRenderers.tsx
|
|
1598
|
-
import { Box as
|
|
1599
|
-
import { jsx as
|
|
1713
|
+
import { Box as Box7, Tooltip as Tooltip4 } from "@mui/material";
|
|
1714
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1600
1715
|
var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
1601
1716
|
const column = props.column;
|
|
1602
1717
|
switch (column.customType) {
|
|
@@ -1627,7 +1742,7 @@ var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
|
1627
1742
|
const currentCellFeedback = cellFeedbackMap.get ? cellFeedbackMap.get(cellKey) : cellFeedbackMap[cellKey];
|
|
1628
1743
|
return (
|
|
1629
1744
|
// --- TOOLTIP ADAPTADO: Lee el mensaje de error desde el Mapa ---
|
|
1630
|
-
/* @__PURE__ */
|
|
1745
|
+
/* @__PURE__ */ jsx11(Tooltip4, { title: currentCellFeedback?.message || "", children: /* @__PURE__ */ jsx11(Box7, { children: /* @__PURE__ */ jsx11(
|
|
1631
1746
|
InputRenderer_default,
|
|
1632
1747
|
{
|
|
1633
1748
|
...props,
|
|
@@ -1657,9 +1772,9 @@ var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
|
1657
1772
|
};
|
|
1658
1773
|
|
|
1659
1774
|
// src/components/grid/renderers/emptyRowRenderer.tsx
|
|
1660
|
-
import { jsx as
|
|
1775
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1661
1776
|
function EmptyRowsRenderer() {
|
|
1662
|
-
return /* @__PURE__ */
|
|
1777
|
+
return /* @__PURE__ */ jsx12("div", { style: {
|
|
1663
1778
|
// Posicionamiento absoluto respecto a la pantalla
|
|
1664
1779
|
position: "fixed",
|
|
1665
1780
|
top: "50%",
|
|
@@ -1674,11 +1789,114 @@ function EmptyRowsRenderer() {
|
|
|
1674
1789
|
borderRadius: "4px",
|
|
1675
1790
|
padding: "16px 24px",
|
|
1676
1791
|
boxShadow: "0 2px 10px rgba(0,0,0,0.1)"
|
|
1677
|
-
}, children: /* @__PURE__ */
|
|
1792
|
+
}, children: /* @__PURE__ */ jsx12("div", { style: { textAlign: "center" }, children: "No hay filas para mostrar" }) });
|
|
1678
1793
|
}
|
|
1679
1794
|
|
|
1795
|
+
// src/components/grid/menu/options.tsx
|
|
1796
|
+
import RefreshIcon from "@mui/icons-material/Refresh";
|
|
1797
|
+
import ViewColumnIcon from "@mui/icons-material/ViewColumn";
|
|
1798
|
+
import VisibilityOffIcon from "@mui/icons-material/VisibilityOff";
|
|
1799
|
+
import FileDownloadIcon from "@mui/icons-material/FileDownload";
|
|
1800
|
+
import FileUploadIcon from "@mui/icons-material/FileUpload";
|
|
1801
|
+
import DeleteSweepIcon from "@mui/icons-material/DeleteSweep";
|
|
1802
|
+
import FilterAltIcon from "@mui/icons-material/FilterAlt";
|
|
1803
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1804
|
+
var buildMenuOptions = (params) => {
|
|
1805
|
+
const {
|
|
1806
|
+
tableDefinition,
|
|
1807
|
+
tableName,
|
|
1808
|
+
fixedFields,
|
|
1809
|
+
setTableData,
|
|
1810
|
+
callApi,
|
|
1811
|
+
showSuccess,
|
|
1812
|
+
showError,
|
|
1813
|
+
showWarning
|
|
1814
|
+
} = params;
|
|
1815
|
+
if (!tableDefinition) return [];
|
|
1816
|
+
const options = [];
|
|
1817
|
+
options.push({
|
|
1818
|
+
id: "refresh",
|
|
1819
|
+
label: "refrescar la grilla desde la base de datos",
|
|
1820
|
+
icon: /* @__PURE__ */ jsx13(RefreshIcon, {}),
|
|
1821
|
+
handler: async () => {
|
|
1822
|
+
try {
|
|
1823
|
+
const data = await callApi("table_data", {
|
|
1824
|
+
table: tableName,
|
|
1825
|
+
fixedFields
|
|
1826
|
+
});
|
|
1827
|
+
setTableData(data);
|
|
1828
|
+
showSuccess("Grilla refrescada correctamente");
|
|
1829
|
+
} catch (err) {
|
|
1830
|
+
showError(`Error al refrescar: ${err.message || "Error desconocido"}`);
|
|
1831
|
+
}
|
|
1832
|
+
},
|
|
1833
|
+
visible: true
|
|
1834
|
+
});
|
|
1835
|
+
options.push({
|
|
1836
|
+
id: "showColumns",
|
|
1837
|
+
label: "mostrar las columnas relacionadas",
|
|
1838
|
+
icon: /* @__PURE__ */ jsx13(ViewColumnIcon, {}),
|
|
1839
|
+
handler: async () => {
|
|
1840
|
+
console.log("Mostrar columnas relacionadas");
|
|
1841
|
+
},
|
|
1842
|
+
visible: true
|
|
1843
|
+
});
|
|
1844
|
+
options.push({
|
|
1845
|
+
id: "hideColumns",
|
|
1846
|
+
label: "ocultar o mostrar columnas",
|
|
1847
|
+
icon: /* @__PURE__ */ jsx13(VisibilityOffIcon, {}),
|
|
1848
|
+
handler: async () => {
|
|
1849
|
+
console.log("Ocultar/mostrar columnas");
|
|
1850
|
+
},
|
|
1851
|
+
visible: true
|
|
1852
|
+
});
|
|
1853
|
+
if (tableDefinition.allow?.export) {
|
|
1854
|
+
options.push({
|
|
1855
|
+
id: "export",
|
|
1856
|
+
label: "exportar",
|
|
1857
|
+
icon: /* @__PURE__ */ jsx13(FileDownloadIcon, {}),
|
|
1858
|
+
handler: async () => {
|
|
1859
|
+
console.log("Exportar datos");
|
|
1860
|
+
},
|
|
1861
|
+
visible: true
|
|
1862
|
+
});
|
|
1863
|
+
}
|
|
1864
|
+
if (tableDefinition.allow?.import) {
|
|
1865
|
+
options.push({
|
|
1866
|
+
id: "import",
|
|
1867
|
+
label: "importar",
|
|
1868
|
+
icon: /* @__PURE__ */ jsx13(FileUploadIcon, {}),
|
|
1869
|
+
handler: async () => {
|
|
1870
|
+
console.log("Importar datos");
|
|
1871
|
+
},
|
|
1872
|
+
visible: true
|
|
1873
|
+
});
|
|
1874
|
+
}
|
|
1875
|
+
if (tableDefinition.allow?.delete) {
|
|
1876
|
+
options.push({
|
|
1877
|
+
id: "deleteAll",
|
|
1878
|
+
label: "borrar todos los registros",
|
|
1879
|
+
icon: /* @__PURE__ */ jsx13(DeleteSweepIcon, {}),
|
|
1880
|
+
handler: async () => {
|
|
1881
|
+
showWarning("Esta operaci\xF3n eliminar\xE1 TODOS los registros de la tabla");
|
|
1882
|
+
},
|
|
1883
|
+
visible: true
|
|
1884
|
+
});
|
|
1885
|
+
}
|
|
1886
|
+
options.push({
|
|
1887
|
+
id: "completeTable",
|
|
1888
|
+
label: "tabla completa y filtrada",
|
|
1889
|
+
icon: /* @__PURE__ */ jsx13(FilterAltIcon, {}),
|
|
1890
|
+
handler: async () => {
|
|
1891
|
+
console.log("Toggle tabla completa/filtrada");
|
|
1892
|
+
},
|
|
1893
|
+
visible: true
|
|
1894
|
+
});
|
|
1895
|
+
return options;
|
|
1896
|
+
};
|
|
1897
|
+
|
|
1680
1898
|
// src/components/grid/GenericDataGrid.tsx
|
|
1681
|
-
import { jsx as
|
|
1899
|
+
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1682
1900
|
var NEW_ROW_INDICATOR = "$new";
|
|
1683
1901
|
var DETAIL_ROW_INDICATOR = "$detail";
|
|
1684
1902
|
var getPrimaryKeyValues = (row, primaryKey) => {
|
|
@@ -1699,18 +1917,20 @@ var GenericDataGrid = ({
|
|
|
1699
1917
|
gridStyles
|
|
1700
1918
|
}) => {
|
|
1701
1919
|
const isOpenMenu = useIsDrawerOpen();
|
|
1702
|
-
const [tableDefinition, setTableDefinition] =
|
|
1703
|
-
const [tableData, setTableData] =
|
|
1704
|
-
const [isFilterRowVisible, setIsFilterRowVisible] =
|
|
1705
|
-
const [filters, setFilters] =
|
|
1706
|
-
const [selectedRows, setSelectedRows] =
|
|
1707
|
-
const [selectedCell, setSelectedCell] =
|
|
1708
|
-
const [cellFeedbackMap, setCellFeedbackMap] =
|
|
1709
|
-
const [localCellChanges, setLocalCellChanges] =
|
|
1920
|
+
const [tableDefinition, setTableDefinition] = useState5(null);
|
|
1921
|
+
const [tableData, setTableData] = useState5([]);
|
|
1922
|
+
const [isFilterRowVisible, setIsFilterRowVisible] = useState5(false);
|
|
1923
|
+
const [filters, setFilters] = useState5({});
|
|
1924
|
+
const [selectedRows, setSelectedRows] = useState5(() => /* @__PURE__ */ new Set());
|
|
1925
|
+
const [selectedCell, setSelectedCell] = useState5(void 0);
|
|
1926
|
+
const [cellFeedbackMap, setCellFeedbackMap] = useState5(/* @__PURE__ */ new Map());
|
|
1927
|
+
const [localCellChanges, setLocalCellChanges] = useState5(/* @__PURE__ */ new Map());
|
|
1710
1928
|
const theme = useTheme3();
|
|
1711
|
-
const [openConfirmDialog, setOpenConfirmDialog] =
|
|
1712
|
-
const [
|
|
1713
|
-
const [
|
|
1929
|
+
const [openConfirmDialog, setOpenConfirmDialog] = useState5(false);
|
|
1930
|
+
const [openDataGridOptions, setOpenDataGridOptions] = useState5(false);
|
|
1931
|
+
const [dataGridOptionsAnchorEl, setDataGridOptionsAnchorEl] = useState5(null);
|
|
1932
|
+
const [rowToDelete, setRowToDelete] = useState5(null);
|
|
1933
|
+
const [exitingRowIds, setExitingRowIds] = useState5(/* @__PURE__ */ new Set());
|
|
1714
1934
|
const { showSuccess, showError, showWarning, showInfo } = useSnackbar();
|
|
1715
1935
|
const feedbackTimerRef = useRef(null);
|
|
1716
1936
|
const dataGridRef = useRef(null);
|
|
@@ -2027,6 +2247,16 @@ var GenericDataGrid = ({
|
|
|
2027
2247
|
const handleSelectedCellChange = useCallback4((args) => {
|
|
2028
2248
|
setSelectedCell(args);
|
|
2029
2249
|
}, []);
|
|
2250
|
+
const menuOptions = useMemo2(() => buildMenuOptions({
|
|
2251
|
+
tableDefinition,
|
|
2252
|
+
tableName,
|
|
2253
|
+
fixedFields,
|
|
2254
|
+
setTableData,
|
|
2255
|
+
callApi,
|
|
2256
|
+
showSuccess,
|
|
2257
|
+
showError,
|
|
2258
|
+
showWarning
|
|
2259
|
+
}), [tableDefinition, tableName, fixedFields, setTableData, callApi, showSuccess, showError, showWarning]);
|
|
2030
2260
|
const columns = useMemo2(() => {
|
|
2031
2261
|
if (!tableDefinition) return [];
|
|
2032
2262
|
const fieldsToShow = tableDefinition.fields.filter((field) => {
|
|
@@ -2077,7 +2307,10 @@ var GenericDataGrid = ({
|
|
|
2077
2307
|
editable: false,
|
|
2078
2308
|
resizable: false,
|
|
2079
2309
|
sortable: false,
|
|
2080
|
-
renderHeaderCell: (props) => actionsColumnHeaderCellRenderer(props, isFilterRowVisible, toggleFilterVisibility)
|
|
2310
|
+
renderHeaderCell: (props) => actionsColumnHeaderCellRenderer(props, isFilterRowVisible, toggleFilterVisibility, (e) => {
|
|
2311
|
+
setDataGridOptionsAnchorEl(e.currentTarget);
|
|
2312
|
+
setOpenDataGridOptions(true);
|
|
2313
|
+
}),
|
|
2081
2314
|
renderSummaryCell: (props) => actionsColumnSummaryCellRenderer(props)
|
|
2082
2315
|
};
|
|
2083
2316
|
const detailColumns = [];
|
|
@@ -2181,20 +2414,20 @@ var GenericDataGrid = ({
|
|
|
2181
2414
|
console.log("Is editable:", isEditable);
|
|
2182
2415
|
}, [tableDefinition, fixedFields]);
|
|
2183
2416
|
if (loading) {
|
|
2184
|
-
return /* @__PURE__ */
|
|
2185
|
-
/* @__PURE__ */
|
|
2186
|
-
/* @__PURE__ */
|
|
2417
|
+
return /* @__PURE__ */ jsxs6(Box8, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: [
|
|
2418
|
+
/* @__PURE__ */ jsx14(CircularProgress2, {}),
|
|
2419
|
+
/* @__PURE__ */ jsx14(Typography5, { variant: "h6", sx: { ml: 2 }, children: "Cargando tabla..." })
|
|
2187
2420
|
] });
|
|
2188
2421
|
}
|
|
2189
2422
|
if (error) {
|
|
2190
|
-
return /* @__PURE__ */
|
|
2423
|
+
return /* @__PURE__ */ jsx14(Box8, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsx14(Alert, { severity: "error", children: error.message }) });
|
|
2191
2424
|
}
|
|
2192
2425
|
if (!tableDefinition) {
|
|
2193
|
-
return /* @__PURE__ */
|
|
2426
|
+
return /* @__PURE__ */ jsx14(Box8, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsx14(Alert, { severity: "warning", children: "No se pudo cargar la definici\xF3n de la tabla." }) });
|
|
2194
2427
|
}
|
|
2195
|
-
return /* @__PURE__ */
|
|
2196
|
-
/* @__PURE__ */
|
|
2197
|
-
|
|
2428
|
+
return /* @__PURE__ */ jsxs6(Box8, { sx: { pt: 2, display: "flex", flexDirection: "column", height: "100%", boxSizing: "border-box" }, children: [
|
|
2429
|
+
/* @__PURE__ */ jsx14(
|
|
2430
|
+
Box8,
|
|
2198
2431
|
{
|
|
2199
2432
|
sx: {
|
|
2200
2433
|
backgroundColor: theme.palette.primary.main,
|
|
@@ -2208,15 +2441,15 @@ var GenericDataGrid = ({
|
|
|
2208
2441
|
ml: 2,
|
|
2209
2442
|
mr: 2
|
|
2210
2443
|
},
|
|
2211
|
-
children: /* @__PURE__ */
|
|
2444
|
+
children: /* @__PURE__ */ jsxs6(Typography5, { variant: "subtitle2", component: "div", children: [
|
|
2212
2445
|
cambiarGuionesBajosPorEspacios(tableDefinition.title || tableDefinition.name),
|
|
2213
2446
|
" - ",
|
|
2214
2447
|
getFilteredRowCount() === getRowCount() ? `${getRowCount()} registros` : `${getFilteredRowCount()} (F)`
|
|
2215
2448
|
] })
|
|
2216
2449
|
}
|
|
2217
2450
|
),
|
|
2218
|
-
/* @__PURE__ */
|
|
2219
|
-
|
|
2451
|
+
/* @__PURE__ */ jsx14(
|
|
2452
|
+
Box8,
|
|
2220
2453
|
{
|
|
2221
2454
|
sx: {
|
|
2222
2455
|
flexGrow: 1,
|
|
@@ -2227,7 +2460,7 @@ var GenericDataGrid = ({
|
|
|
2227
2460
|
px: 2,
|
|
2228
2461
|
pb: 2
|
|
2229
2462
|
},
|
|
2230
|
-
children: /* @__PURE__ */
|
|
2463
|
+
children: /* @__PURE__ */ jsx14(
|
|
2231
2464
|
DataGrid,
|
|
2232
2465
|
{
|
|
2233
2466
|
className: "rdg-light",
|
|
@@ -2248,7 +2481,7 @@ var GenericDataGrid = ({
|
|
|
2248
2481
|
headerRowHeight: 30,
|
|
2249
2482
|
topSummaryRows: isFilterRowVisible ? [{ id: "filterRow" }] : void 0,
|
|
2250
2483
|
summaryRowHeight: isFilterRowVisible ? 30 : 0,
|
|
2251
|
-
renderers: { noRowsFallback: /* @__PURE__ */
|
|
2484
|
+
renderers: { noRowsFallback: /* @__PURE__ */ jsx14(EmptyRowsRenderer, {}) },
|
|
2252
2485
|
onCellMouseDown: handleCellMouseDown,
|
|
2253
2486
|
onCellDoubleClick: handlCellDoubleClick,
|
|
2254
2487
|
onCellClick: handleCellClick,
|
|
@@ -2257,7 +2490,7 @@ var GenericDataGrid = ({
|
|
|
2257
2490
|
)
|
|
2258
2491
|
}
|
|
2259
2492
|
),
|
|
2260
|
-
/* @__PURE__ */
|
|
2493
|
+
/* @__PURE__ */ jsx14(
|
|
2261
2494
|
ConfirmDialog,
|
|
2262
2495
|
{
|
|
2263
2496
|
open: openConfirmDialog,
|
|
@@ -2265,6 +2498,15 @@ var GenericDataGrid = ({
|
|
|
2265
2498
|
title: "Confirmar Eliminaci\xF3n",
|
|
2266
2499
|
message: rowToDelete && rowToDelete[NEW_ROW_INDICATOR] ? `\xBFEst\xE1s seguro de que quieres eliminar esta nueva fila (ID: ${getPrimaryKeyValues(rowToDelete, primaryKey)}) localmente?` : rowToDelete ? `\xBFEst\xE1s seguro de que quieres eliminar la fila con ID: ${getPrimaryKeyValues(rowToDelete, primaryKey)} de la base de datos? Esta acci\xF3n es irreversible.` : "\xBFEst\xE1s seguro de que quieres eliminar este registro? Esta acci\xF3n es irreversible."
|
|
2267
2500
|
}
|
|
2501
|
+
),
|
|
2502
|
+
/* @__PURE__ */ jsx14(
|
|
2503
|
+
DataGridOptionsDialog,
|
|
2504
|
+
{
|
|
2505
|
+
open: openDataGridOptions,
|
|
2506
|
+
onClose: () => setOpenDataGridOptions(false),
|
|
2507
|
+
options: menuOptions,
|
|
2508
|
+
anchorEl: dataGridOptionsAnchorEl
|
|
2509
|
+
}
|
|
2268
2510
|
)
|
|
2269
2511
|
] });
|
|
2270
2512
|
};
|
|
@@ -2278,7 +2520,7 @@ import { BrowserRouter, Routes, Route, useLocation as useLocation4, Navigate as
|
|
|
2278
2520
|
import { useEffect as useEffect3 } from "react";
|
|
2279
2521
|
import { Outlet } from "react-router-dom";
|
|
2280
2522
|
import {
|
|
2281
|
-
Box as
|
|
2523
|
+
Box as Box11,
|
|
2282
2524
|
AppBar,
|
|
2283
2525
|
Toolbar,
|
|
2284
2526
|
Typography as Typography8,
|
|
@@ -2291,10 +2533,10 @@ import {
|
|
|
2291
2533
|
} from "@mui/material";
|
|
2292
2534
|
|
|
2293
2535
|
// src/contexts/AppContext.tsx
|
|
2294
|
-
import { createContext as createContext2, useContext as useContext2, useState as
|
|
2536
|
+
import { createContext as createContext2, useContext as useContext2, useState as useState6, useEffect as useEffect2, useCallback as useCallback5, useMemo as useMemo3 } from "react";
|
|
2295
2537
|
import { useNavigate } from "react-router-dom";
|
|
2296
2538
|
import { useSelector as useSelector2, useDispatch as useDispatch2 } from "react-redux";
|
|
2297
|
-
import { jsx as
|
|
2539
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
2298
2540
|
var AuthContext = createContext2(void 0);
|
|
2299
2541
|
var useApp = () => {
|
|
2300
2542
|
const context = useContext2(AuthContext);
|
|
@@ -2306,8 +2548,8 @@ var useApp = () => {
|
|
|
2306
2548
|
};
|
|
2307
2549
|
var AppProvider = ({ children }) => {
|
|
2308
2550
|
console.log("AppProvider rendered/re-rendered");
|
|
2309
|
-
const [isLoggedIn, setIsLoggedIn] =
|
|
2310
|
-
const [showSessionExpiredMessage, setShowSessionExpiredMessage] =
|
|
2551
|
+
const [isLoggedIn, setIsLoggedIn] = useState6(false);
|
|
2552
|
+
const [showSessionExpiredMessage, setShowSessionExpiredMessage] = useState6(false);
|
|
2311
2553
|
const dispatch = useDispatch2();
|
|
2312
2554
|
const clientContext = useSelector2((state) => state.clientContext);
|
|
2313
2555
|
const navigate = useNavigate();
|
|
@@ -2362,7 +2604,7 @@ var AppProvider = ({ children }) => {
|
|
|
2362
2604
|
showSessionExpiredMessage,
|
|
2363
2605
|
setShowSessionExpiredMessage
|
|
2364
2606
|
]);
|
|
2365
|
-
return /* @__PURE__ */
|
|
2607
|
+
return /* @__PURE__ */ jsx15(AuthContext.Provider, { value: authContextValue, children });
|
|
2366
2608
|
};
|
|
2367
2609
|
|
|
2368
2610
|
// src/components/MainLayout.tsx
|
|
@@ -2371,7 +2613,7 @@ import MenuIcon from "@mui/icons-material/Menu";
|
|
|
2371
2613
|
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
2372
2614
|
|
|
2373
2615
|
// src/components/SideMenu.tsx
|
|
2374
|
-
import { List, ListItem, ListItemButton, ListItemIcon, ListItemText, Divider, Box as
|
|
2616
|
+
import { List as List2, ListItem, ListItemButton as ListItemButton2, ListItemIcon as ListItemIcon2, ListItemText as ListItemText2, Divider, Box as Box10, Typography as Typography7, Collapse } from "@mui/material";
|
|
2375
2617
|
import ExpandLess from "@mui/icons-material/ExpandLess";
|
|
2376
2618
|
import ExpandMore from "@mui/icons-material/ExpandMore";
|
|
2377
2619
|
import TableChartIcon from "@mui/icons-material/TableChart";
|
|
@@ -2386,30 +2628,30 @@ import { useNavigate as useNavigate2, useLocation } from "react-router-dom";
|
|
|
2386
2628
|
import { blue, orange, teal, red, grey } from "@mui/material/colors";
|
|
2387
2629
|
|
|
2388
2630
|
// src/pages/WScreens.tsx
|
|
2389
|
-
import { Box as
|
|
2631
|
+
import { Box as Box9, Typography as Typography6, Paper as Paper2 } from "@mui/material";
|
|
2390
2632
|
import ConstructionIcon from "@mui/icons-material/Construction";
|
|
2391
2633
|
import WarningAmberIcon2 from "@mui/icons-material/WarningAmber";
|
|
2392
|
-
import { jsx as
|
|
2634
|
+
import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2393
2635
|
var MyCustomDashboard = ({ screenName }) => {
|
|
2394
|
-
return /* @__PURE__ */
|
|
2395
|
-
/* @__PURE__ */
|
|
2636
|
+
return /* @__PURE__ */ jsx16(Box9, { sx: { p: 4, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", height: "100%" }, children: /* @__PURE__ */ jsxs7(Paper2, { elevation: 3, sx: { p: 4, textAlign: "center", maxWidth: 600 }, children: [
|
|
2637
|
+
/* @__PURE__ */ jsxs7(Typography6, { variant: "h5", component: "h1", gutterBottom: true, children: [
|
|
2396
2638
|
"\xA1Bienvenido a tu WScreen: ",
|
|
2397
2639
|
screenName,
|
|
2398
2640
|
"!"
|
|
2399
2641
|
] }),
|
|
2400
|
-
/* @__PURE__ */
|
|
2401
|
-
/* @__PURE__ */
|
|
2642
|
+
/* @__PURE__ */ jsx16(Typography6, { variant: "body1", color: "text.secondary", children: "Esta es una pantalla de interfaz de usuario personalizada." }),
|
|
2643
|
+
/* @__PURE__ */ jsx16(Box9, { sx: { mt: 3 }, children: /* @__PURE__ */ jsx16(ConstructionIcon, { sx: { fontSize: 80, color: "primary.main" } }) })
|
|
2402
2644
|
] }) });
|
|
2403
2645
|
};
|
|
2404
2646
|
var FallbackWScreen = ({ screenName }) => {
|
|
2405
|
-
return /* @__PURE__ */
|
|
2406
|
-
/* @__PURE__ */
|
|
2407
|
-
/* @__PURE__ */
|
|
2647
|
+
return /* @__PURE__ */ jsx16(Box9, { sx: { p: 4, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", height: "100%" }, children: /* @__PURE__ */ jsxs7(Paper2, { elevation: 3, sx: { p: 4, textAlign: "center", maxWidth: 600, backgroundColor: "warning.light", border: "1px solid orange" }, children: [
|
|
2648
|
+
/* @__PURE__ */ jsx16(Typography6, { variant: "h5", component: "h1", gutterBottom: true, color: "warning.dark", children: "WScreen No Implementada" }),
|
|
2649
|
+
/* @__PURE__ */ jsxs7(Typography6, { variant: "body1", color: "warning.dark", children: [
|
|
2408
2650
|
'No se encontr\xF3 un componente implementado para la **WScreen**: **`"$',
|
|
2409
2651
|
screenName,
|
|
2410
2652
|
'"`**. Por favor, verifica el `menuType` en la definici\xF3n del men\xFA o aseg\xFArate de que el componente est\xE9 correctamente importado y mapeado en el frontend.'
|
|
2411
2653
|
] }),
|
|
2412
|
-
/* @__PURE__ */
|
|
2654
|
+
/* @__PURE__ */ jsx16(Box9, { sx: { mt: 3 }, children: /* @__PURE__ */ jsx16(WarningAmberIcon2, { sx: { fontSize: 80, color: "warning.dark" } }) })
|
|
2413
2655
|
] }) });
|
|
2414
2656
|
};
|
|
2415
2657
|
var wScreens = {
|
|
@@ -2423,7 +2665,7 @@ var extendWScreens = (newWScreens) => {
|
|
|
2423
2665
|
};
|
|
2424
2666
|
|
|
2425
2667
|
// src/components/SideMenu.tsx
|
|
2426
|
-
import { Fragment, jsx as
|
|
2668
|
+
import { Fragment as Fragment2, jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2427
2669
|
var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
2428
2670
|
const navigate = useNavigate2();
|
|
2429
2671
|
const location = useLocation();
|
|
@@ -2464,17 +2706,17 @@ var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
|
2464
2706
|
const getIcon = (item2) => {
|
|
2465
2707
|
switch (item2.menuType) {
|
|
2466
2708
|
case "table":
|
|
2467
|
-
return /* @__PURE__ */
|
|
2709
|
+
return /* @__PURE__ */ jsx17(TableChartIcon, { sx: { color: blue[700] } });
|
|
2468
2710
|
case "proc":
|
|
2469
|
-
return /* @__PURE__ */
|
|
2711
|
+
return /* @__PURE__ */ jsx17(DnsIcon, { sx: { color: teal[700] } });
|
|
2470
2712
|
case "menu":
|
|
2471
|
-
return /* @__PURE__ */
|
|
2713
|
+
return /* @__PURE__ */ jsx17(FolderIcon, { sx: { color: orange[800] } });
|
|
2472
2714
|
default:
|
|
2473
2715
|
const WScreenComponent = wScreens[item2.menuType];
|
|
2474
2716
|
if (WScreenComponent !== void 0) {
|
|
2475
|
-
return /* @__PURE__ */
|
|
2717
|
+
return /* @__PURE__ */ jsx17(DesktopWindowsIcon, { sx: { color: grey[700] } });
|
|
2476
2718
|
}
|
|
2477
|
-
return /* @__PURE__ */
|
|
2719
|
+
return /* @__PURE__ */ jsx17(WarningAmberIcon3, { sx: { color: red[500] } });
|
|
2478
2720
|
}
|
|
2479
2721
|
};
|
|
2480
2722
|
const currentPath = location.pathname;
|
|
@@ -2486,21 +2728,21 @@ var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
|
2486
2728
|
} else {
|
|
2487
2729
|
isSelected = currentPath.startsWith(`/wScreens/${item.menuType}`) || currentPath.startsWith(`/wScreens-fallback/${item.menuType}`);
|
|
2488
2730
|
}
|
|
2489
|
-
return /* @__PURE__ */
|
|
2490
|
-
/* @__PURE__ */
|
|
2491
|
-
|
|
2731
|
+
return /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
2732
|
+
/* @__PURE__ */ jsxs8(
|
|
2733
|
+
ListItemButton2,
|
|
2492
2734
|
{
|
|
2493
2735
|
onClick: handleClick,
|
|
2494
2736
|
sx: { pl: level * 2 },
|
|
2495
2737
|
selected: isSelected,
|
|
2496
2738
|
children: [
|
|
2497
|
-
/* @__PURE__ */
|
|
2498
|
-
/* @__PURE__ */
|
|
2499
|
-
item.menuType === "menu" ? open ? /* @__PURE__ */
|
|
2739
|
+
/* @__PURE__ */ jsx17(ListItemIcon2, { sx: { minWidth: "38px" }, children: getIcon(item) }),
|
|
2740
|
+
/* @__PURE__ */ jsx17(ListItemText2, { primary: item.label || item.name }),
|
|
2741
|
+
item.menuType === "menu" ? open ? /* @__PURE__ */ jsx17(ExpandLess, {}) : /* @__PURE__ */ jsx17(ExpandMore, {}) : null
|
|
2500
2742
|
]
|
|
2501
2743
|
}
|
|
2502
2744
|
),
|
|
2503
|
-
item.menuType === "menu" && /* @__PURE__ */
|
|
2745
|
+
item.menuType === "menu" && /* @__PURE__ */ jsx17(Collapse, { in: open, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ jsx17(List2, { component: "div", disablePadding: true, children: item.menuContent.map((subItem) => /* @__PURE__ */ jsx17(
|
|
2504
2746
|
MenuListItem,
|
|
2505
2747
|
{
|
|
2506
2748
|
item: subItem,
|
|
@@ -2530,22 +2772,22 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
2530
2772
|
dispatch(setAllSubMenusOpen(!isMostlyOpen));
|
|
2531
2773
|
};
|
|
2532
2774
|
if (!clientContext || !clientContext.menu) {
|
|
2533
|
-
return /* @__PURE__ */
|
|
2775
|
+
return /* @__PURE__ */ jsx17(Box10, { sx: { p: 2, textAlign: "center" }, children: /* @__PURE__ */ jsx17(Typography7, { variant: "body2", color: "text.secondary", children: "Cargando men\xFA..." }) });
|
|
2534
2776
|
}
|
|
2535
2777
|
const isHomeSelected = location.pathname === "/home";
|
|
2536
|
-
return /* @__PURE__ */
|
|
2537
|
-
clientContext.menu.some((item) => item.menuType === "menu") && /* @__PURE__ */
|
|
2538
|
-
/* @__PURE__ */
|
|
2539
|
-
/* @__PURE__ */
|
|
2778
|
+
return /* @__PURE__ */ jsxs8(Box10, { sx: { width: "100%", flexShrink: 0 }, children: [
|
|
2779
|
+
clientContext.menu.some((item) => item.menuType === "menu") && /* @__PURE__ */ jsx17(ListItem, { disablePadding: true, children: /* @__PURE__ */ jsxs8(ListItemButton2, { onClick: handleToggleAllSubMenus, children: [
|
|
2780
|
+
/* @__PURE__ */ jsx17(ListItemIcon2, { sx: { minWidth: "38px" }, children: isMostlyOpen ? /* @__PURE__ */ jsx17(UnfoldLessIcon, {}) : /* @__PURE__ */ jsx17(UnfoldMoreIcon, {}) }),
|
|
2781
|
+
/* @__PURE__ */ jsx17(ListItemText2, { primary: isMostlyOpen ? "colapsar " : "expandir" })
|
|
2540
2782
|
] }) }),
|
|
2541
|
-
/* @__PURE__ */
|
|
2542
|
-
/* @__PURE__ */
|
|
2543
|
-
/* @__PURE__ */
|
|
2544
|
-
/* @__PURE__ */
|
|
2545
|
-
/* @__PURE__ */
|
|
2783
|
+
/* @__PURE__ */ jsx17(Divider, {}),
|
|
2784
|
+
/* @__PURE__ */ jsxs8(List2, { children: [
|
|
2785
|
+
/* @__PURE__ */ jsx17(ListItem, { disablePadding: true, children: /* @__PURE__ */ jsxs8(ListItemButton2, { onClick: handleHomeClick, selected: isHomeSelected, children: [
|
|
2786
|
+
/* @__PURE__ */ jsx17(ListItemIcon2, { sx: { minWidth: "38px" }, children: /* @__PURE__ */ jsx17(HomeIcon, {}) }),
|
|
2787
|
+
/* @__PURE__ */ jsx17(ListItemText2, { primary: "Inicio" })
|
|
2546
2788
|
] }) }),
|
|
2547
|
-
/* @__PURE__ */
|
|
2548
|
-
clientContext.menu.map((menuItem) => /* @__PURE__ */
|
|
2789
|
+
/* @__PURE__ */ jsx17(Divider, {}),
|
|
2790
|
+
clientContext.menu.map((menuItem) => /* @__PURE__ */ jsx17(
|
|
2549
2791
|
MenuListItem,
|
|
2550
2792
|
{
|
|
2551
2793
|
item: menuItem,
|
|
@@ -2588,7 +2830,7 @@ var useLogout = () => {
|
|
|
2588
2830
|
var useLogout_default = useLogout;
|
|
2589
2831
|
|
|
2590
2832
|
// src/components/MainLayout.tsx
|
|
2591
|
-
import { jsx as
|
|
2833
|
+
import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2592
2834
|
var drawerWidth = 240;
|
|
2593
2835
|
var MainLayout = () => {
|
|
2594
2836
|
const { clientContext } = useApp();
|
|
@@ -2611,12 +2853,12 @@ var MainLayout = () => {
|
|
|
2611
2853
|
}
|
|
2612
2854
|
};
|
|
2613
2855
|
if (!clientContext) {
|
|
2614
|
-
return /* @__PURE__ */
|
|
2856
|
+
return /* @__PURE__ */ jsx18(Box11, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ jsx18(Typography8, { children: "Cargando dise\xF1o de la aplicaci\xF3n..." }) });
|
|
2615
2857
|
}
|
|
2616
2858
|
const appBarOffset = theme.mixins.toolbar;
|
|
2617
|
-
return /* @__PURE__ */
|
|
2618
|
-
/* @__PURE__ */
|
|
2619
|
-
/* @__PURE__ */
|
|
2859
|
+
return /* @__PURE__ */ jsxs9(Box11, { sx: { display: "flex", height: "100vh" }, children: [
|
|
2860
|
+
/* @__PURE__ */ jsx18(CssBaseline, {}),
|
|
2861
|
+
/* @__PURE__ */ jsx18(
|
|
2620
2862
|
AppBar,
|
|
2621
2863
|
{
|
|
2622
2864
|
position: "fixed",
|
|
@@ -2635,8 +2877,8 @@ var MainLayout = () => {
|
|
|
2635
2877
|
})
|
|
2636
2878
|
}
|
|
2637
2879
|
},
|
|
2638
|
-
children: /* @__PURE__ */
|
|
2639
|
-
/* @__PURE__ */
|
|
2880
|
+
children: /* @__PURE__ */ jsxs9(Toolbar, { children: [
|
|
2881
|
+
/* @__PURE__ */ jsx18(
|
|
2640
2882
|
IconButton3,
|
|
2641
2883
|
{
|
|
2642
2884
|
color: "inherit",
|
|
@@ -2646,24 +2888,24 @@ var MainLayout = () => {
|
|
|
2646
2888
|
sx: {
|
|
2647
2889
|
marginRight: 2.2
|
|
2648
2890
|
},
|
|
2649
|
-
children: isDrawerOpen ? /* @__PURE__ */
|
|
2891
|
+
children: isDrawerOpen ? /* @__PURE__ */ jsx18(ChevronLeftIcon, {}) : /* @__PURE__ */ jsx18(MenuIcon, {})
|
|
2650
2892
|
}
|
|
2651
2893
|
),
|
|
2652
|
-
/* @__PURE__ */
|
|
2653
|
-
/* @__PURE__ */
|
|
2654
|
-
/* @__PURE__ */
|
|
2894
|
+
/* @__PURE__ */ jsx18(Typography8, { variant: "h6", noWrap: true, component: "div", sx: { flexGrow: 1 }, children: isDrawerOpen ? "" : clientContext.config.title }),
|
|
2895
|
+
/* @__PURE__ */ jsx18(Typography8, { variant: "subtitle1", component: "div", sx: { mr: 2 }, children: clientContext.username }),
|
|
2896
|
+
/* @__PURE__ */ jsx18(
|
|
2655
2897
|
Button4,
|
|
2656
2898
|
{
|
|
2657
2899
|
color: "inherit",
|
|
2658
2900
|
onClick: logout,
|
|
2659
|
-
startIcon: /* @__PURE__ */
|
|
2901
|
+
startIcon: /* @__PURE__ */ jsx18(LogoutIcon, {}),
|
|
2660
2902
|
children: "Salir"
|
|
2661
2903
|
}
|
|
2662
2904
|
)
|
|
2663
2905
|
] })
|
|
2664
2906
|
}
|
|
2665
2907
|
),
|
|
2666
|
-
/* @__PURE__ */
|
|
2908
|
+
/* @__PURE__ */ jsxs9(
|
|
2667
2909
|
Drawer,
|
|
2668
2910
|
{
|
|
2669
2911
|
variant: "persistent",
|
|
@@ -2680,7 +2922,7 @@ var MainLayout = () => {
|
|
|
2680
2922
|
}
|
|
2681
2923
|
},
|
|
2682
2924
|
children: [
|
|
2683
|
-
/* @__PURE__ */
|
|
2925
|
+
/* @__PURE__ */ jsx18(
|
|
2684
2926
|
Toolbar,
|
|
2685
2927
|
{
|
|
2686
2928
|
sx: {
|
|
@@ -2694,12 +2936,12 @@ var MainLayout = () => {
|
|
|
2694
2936
|
children: isDrawerOpen ? clientContext.config.title : ""
|
|
2695
2937
|
}
|
|
2696
2938
|
),
|
|
2697
|
-
/* @__PURE__ */
|
|
2939
|
+
/* @__PURE__ */ jsx18(SideMenu_default, { onMenuItemClick: handleDrawerCloseMobile })
|
|
2698
2940
|
]
|
|
2699
2941
|
}
|
|
2700
2942
|
),
|
|
2701
|
-
/* @__PURE__ */
|
|
2702
|
-
|
|
2943
|
+
/* @__PURE__ */ jsx18(
|
|
2944
|
+
Box11,
|
|
2703
2945
|
{
|
|
2704
2946
|
component: "main",
|
|
2705
2947
|
sx: {
|
|
@@ -2726,7 +2968,7 @@ var MainLayout = () => {
|
|
|
2726
2968
|
flexDirection: "column",
|
|
2727
2969
|
width: isDrawerOpen ? `calc(100% - ${drawerWidth}px)` : "100%"
|
|
2728
2970
|
},
|
|
2729
|
-
children: /* @__PURE__ */
|
|
2971
|
+
children: /* @__PURE__ */ jsx18(Outlet, {})
|
|
2730
2972
|
}
|
|
2731
2973
|
)
|
|
2732
2974
|
] });
|
|
@@ -2734,9 +2976,9 @@ var MainLayout = () => {
|
|
|
2734
2976
|
var MainLayout_default = MainLayout;
|
|
2735
2977
|
|
|
2736
2978
|
// src/components/SessionExpiredMessage.tsx
|
|
2737
|
-
import { Box as
|
|
2979
|
+
import { Box as Box12, Typography as Typography9, Button as Button5, Modal } from "@mui/material";
|
|
2738
2980
|
import { useNavigate as useNavigate4 } from "react-router-dom";
|
|
2739
|
-
import { jsx as
|
|
2981
|
+
import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2740
2982
|
var style = {
|
|
2741
2983
|
position: "absolute",
|
|
2742
2984
|
top: "50%",
|
|
@@ -2758,7 +3000,7 @@ var SessionExpiredMessage = () => {
|
|
|
2758
3000
|
setIsLoggedIn(false);
|
|
2759
3001
|
navigate("/login", { replace: true });
|
|
2760
3002
|
};
|
|
2761
|
-
return /* @__PURE__ */
|
|
3003
|
+
return /* @__PURE__ */ jsx19(
|
|
2762
3004
|
Modal,
|
|
2763
3005
|
{
|
|
2764
3006
|
open: showSessionExpiredMessage,
|
|
@@ -2778,10 +3020,10 @@ var SessionExpiredMessage = () => {
|
|
|
2778
3020
|
}
|
|
2779
3021
|
}
|
|
2780
3022
|
},
|
|
2781
|
-
children: /* @__PURE__ */
|
|
2782
|
-
/* @__PURE__ */
|
|
2783
|
-
/* @__PURE__ */
|
|
2784
|
-
/* @__PURE__ */
|
|
3023
|
+
children: /* @__PURE__ */ jsxs10(Box12, { sx: style, children: [
|
|
3024
|
+
/* @__PURE__ */ jsx19(Typography9, { id: "session-expired-modal-title", variant: "h6", component: "h2", gutterBottom: true, children: "\xA1Sesi\xF3n Expirada!" }),
|
|
3025
|
+
/* @__PURE__ */ jsx19(Typography9, { id: "session-expired-modal-description", sx: { mt: 2, mb: 3 }, children: "Tu sesi\xF3n ha expirado por inactividad o por seguridad. Por favor, inicia sesi\xF3n de nuevo." }),
|
|
3026
|
+
/* @__PURE__ */ jsx19(Button5, { variant: "contained", color: "primary", onClick: handleClose, children: "Ir al Login" })
|
|
2785
3027
|
] })
|
|
2786
3028
|
}
|
|
2787
3029
|
);
|
|
@@ -2789,27 +3031,27 @@ var SessionExpiredMessage = () => {
|
|
|
2789
3031
|
var SessionExpiredMessage_default = SessionExpiredMessage;
|
|
2790
3032
|
|
|
2791
3033
|
// src/pages/HomePage.tsx
|
|
2792
|
-
import { Box as
|
|
2793
|
-
import { jsx as
|
|
3034
|
+
import { Box as Box13, Typography as Typography10 } from "@mui/material";
|
|
3035
|
+
import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2794
3036
|
var HomePage = () => {
|
|
2795
3037
|
const { clientContext } = useApp();
|
|
2796
|
-
return /* @__PURE__ */
|
|
2797
|
-
/* @__PURE__ */
|
|
2798
|
-
/* @__PURE__ */
|
|
3038
|
+
return /* @__PURE__ */ jsxs11(Box13, { sx: { p: 3 }, children: [
|
|
3039
|
+
/* @__PURE__ */ jsx20(Typography10, { variant: "h4", component: "h1", gutterBottom: true, children: `Bienvenido/a ${clientContext?.username}` }),
|
|
3040
|
+
/* @__PURE__ */ jsx20(Typography10, { variant: "body1", children: "Usa el men\xFA lateral para navegar por las diferentes secciones." })
|
|
2799
3041
|
] });
|
|
2800
3042
|
};
|
|
2801
3043
|
var HomePage_default = HomePage;
|
|
2802
3044
|
|
|
2803
3045
|
// src/pages/LogoutPage.tsx
|
|
2804
3046
|
import { useEffect as useEffect4 } from "react";
|
|
2805
|
-
import { Box as
|
|
2806
|
-
import { jsx as
|
|
3047
|
+
import { Box as Box14, Typography as Typography11, CircularProgress as CircularProgress3 } from "@mui/material";
|
|
3048
|
+
import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2807
3049
|
var LogoutPage = () => {
|
|
2808
3050
|
const logout = useLogout_default();
|
|
2809
3051
|
useEffect4(() => {
|
|
2810
3052
|
logout();
|
|
2811
3053
|
}, [logout]);
|
|
2812
|
-
return /* @__PURE__ */
|
|
3054
|
+
return /* @__PURE__ */ jsxs12(Box14, { sx: {
|
|
2813
3055
|
display: "flex",
|
|
2814
3056
|
flexDirection: "column",
|
|
2815
3057
|
justifyContent: "center",
|
|
@@ -2817,21 +3059,21 @@ var LogoutPage = () => {
|
|
|
2817
3059
|
height: "100vh",
|
|
2818
3060
|
textAlign: "center"
|
|
2819
3061
|
}, children: [
|
|
2820
|
-
/* @__PURE__ */
|
|
2821
|
-
/* @__PURE__ */
|
|
3062
|
+
/* @__PURE__ */ jsx21(CircularProgress3, { size: 60 }),
|
|
3063
|
+
/* @__PURE__ */ jsx21(Typography11, { variant: "h6", sx: { mt: 2 }, children: "Cerrando sesi\xF3n..." })
|
|
2822
3064
|
] });
|
|
2823
3065
|
};
|
|
2824
3066
|
var LogoutPage_default = LogoutPage;
|
|
2825
3067
|
|
|
2826
3068
|
// src/pages/LoginPage.tsx
|
|
2827
|
-
import { useState as
|
|
2828
|
-
import { Button as Button6, TextField, Typography as Typography12, Alert as Alert2, AlertTitle, Box as
|
|
3069
|
+
import { useState as useState7 } from "react";
|
|
3070
|
+
import { Button as Button6, TextField, Typography as Typography12, Alert as Alert2, AlertTitle, Box as Box15, CircularProgress as CircularProgress4 } from "@mui/material";
|
|
2829
3071
|
import { useForm, Controller } from "react-hook-form";
|
|
2830
3072
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
2831
3073
|
import * as z from "zod";
|
|
2832
3074
|
import { useNavigate as useNavigate5 } from "react-router-dom";
|
|
2833
3075
|
import { useDispatch as useDispatch4 } from "react-redux";
|
|
2834
|
-
import { Fragment as
|
|
3076
|
+
import { Fragment as Fragment3, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2835
3077
|
var loginSchema = z.object({
|
|
2836
3078
|
username: z.string().min(1, "El usuario es requerido"),
|
|
2837
3079
|
// Añadir validación básica
|
|
@@ -2840,8 +3082,8 @@ var loginSchema = z.object({
|
|
|
2840
3082
|
});
|
|
2841
3083
|
var LoginPage = () => {
|
|
2842
3084
|
const navigate = useNavigate5();
|
|
2843
|
-
const [loginError, setLoginError] =
|
|
2844
|
-
const [isSubmitting, setIsSubmitting] =
|
|
3085
|
+
const [loginError, setLoginError] = useState7(null);
|
|
3086
|
+
const [isSubmitting, setIsSubmitting] = useState7(false);
|
|
2845
3087
|
const { setIsLoggedIn, checkSession } = useApp();
|
|
2846
3088
|
const dispatch = useDispatch4();
|
|
2847
3089
|
const {
|
|
@@ -2887,16 +3129,16 @@ var LoginPage = () => {
|
|
|
2887
3129
|
setIsSubmitting(false);
|
|
2888
3130
|
}
|
|
2889
3131
|
};
|
|
2890
|
-
return /* @__PURE__ */
|
|
2891
|
-
|
|
3132
|
+
return /* @__PURE__ */ jsx22(
|
|
3133
|
+
Box15,
|
|
2892
3134
|
{
|
|
2893
3135
|
display: "flex",
|
|
2894
3136
|
alignItems: "center",
|
|
2895
3137
|
justifyContent: "center",
|
|
2896
3138
|
minHeight: "100vh",
|
|
2897
3139
|
bgcolor: "#f5f5f5",
|
|
2898
|
-
children: /* @__PURE__ */
|
|
2899
|
-
|
|
3140
|
+
children: /* @__PURE__ */ jsxs13(
|
|
3141
|
+
Box15,
|
|
2900
3142
|
{
|
|
2901
3143
|
width: "100%",
|
|
2902
3144
|
maxWidth: "400px",
|
|
@@ -2905,16 +3147,16 @@ var LoginPage = () => {
|
|
|
2905
3147
|
borderRadius: 8,
|
|
2906
3148
|
boxShadow: 3,
|
|
2907
3149
|
children: [
|
|
2908
|
-
/* @__PURE__ */
|
|
2909
|
-
/* @__PURE__ */
|
|
2910
|
-
/* @__PURE__ */
|
|
2911
|
-
/* @__PURE__ */
|
|
2912
|
-
/* @__PURE__ */
|
|
3150
|
+
/* @__PURE__ */ jsx22(Typography12, { variant: "h5", align: "center", gutterBottom: true, children: "Iniciar Sesi\xF3n" }),
|
|
3151
|
+
/* @__PURE__ */ jsxs13("form", { onSubmit: handleSubmit(onSubmit), className: "space-y-4", children: [
|
|
3152
|
+
/* @__PURE__ */ jsxs13("div", { children: [
|
|
3153
|
+
/* @__PURE__ */ jsx22("label", { htmlFor: "username", children: /* @__PURE__ */ jsx22(Typography12, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Usuario" }) }),
|
|
3154
|
+
/* @__PURE__ */ jsx22(
|
|
2913
3155
|
Controller,
|
|
2914
3156
|
{
|
|
2915
3157
|
name: "username",
|
|
2916
3158
|
control,
|
|
2917
|
-
render: ({ field }) => /* @__PURE__ */
|
|
3159
|
+
render: ({ field }) => /* @__PURE__ */ jsx22(
|
|
2918
3160
|
TextField,
|
|
2919
3161
|
{
|
|
2920
3162
|
...field,
|
|
@@ -2930,14 +3172,14 @@ var LoginPage = () => {
|
|
|
2930
3172
|
}
|
|
2931
3173
|
)
|
|
2932
3174
|
] }),
|
|
2933
|
-
/* @__PURE__ */
|
|
2934
|
-
/* @__PURE__ */
|
|
2935
|
-
/* @__PURE__ */
|
|
3175
|
+
/* @__PURE__ */ jsxs13("div", { children: [
|
|
3176
|
+
/* @__PURE__ */ jsx22("label", { htmlFor: "password", children: /* @__PURE__ */ jsx22(Typography12, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Contrase\xF1a" }) }),
|
|
3177
|
+
/* @__PURE__ */ jsx22(
|
|
2936
3178
|
Controller,
|
|
2937
3179
|
{
|
|
2938
3180
|
name: "password",
|
|
2939
3181
|
control,
|
|
2940
|
-
render: ({ field }) => /* @__PURE__ */
|
|
3182
|
+
render: ({ field }) => /* @__PURE__ */ jsx22(
|
|
2941
3183
|
TextField,
|
|
2942
3184
|
{
|
|
2943
3185
|
...field,
|
|
@@ -2953,14 +3195,14 @@ var LoginPage = () => {
|
|
|
2953
3195
|
}
|
|
2954
3196
|
)
|
|
2955
3197
|
] }),
|
|
2956
|
-
/* @__PURE__ */
|
|
2957
|
-
/* @__PURE__ */
|
|
3198
|
+
/* @__PURE__ */ jsx22(Button6, { type: "submit", fullWidth: true, variant: "contained", color: "primary", disabled: isSubmitting, sx: { mt: 2 }, children: isSubmitting ? /* @__PURE__ */ jsxs13(Fragment3, { children: [
|
|
3199
|
+
/* @__PURE__ */ jsx22(CircularProgress4, { size: 20, sx: { mr: 1 } }),
|
|
2958
3200
|
"Iniciando sesi\xF3n..."
|
|
2959
3201
|
] }) : "Iniciar Sesi\xF3n" })
|
|
2960
3202
|
] }),
|
|
2961
|
-
loginError && /* @__PURE__ */
|
|
3203
|
+
loginError && /* @__PURE__ */ jsxs13(Alert2, { severity: "error", sx: { mt: 2, maxHeight: "200px" }, children: [
|
|
2962
3204
|
" ",
|
|
2963
|
-
/* @__PURE__ */
|
|
3205
|
+
/* @__PURE__ */ jsx22(AlertTitle, { children: "Error" }),
|
|
2964
3206
|
loginError
|
|
2965
3207
|
] })
|
|
2966
3208
|
]
|
|
@@ -2972,7 +3214,7 @@ var LoginPage = () => {
|
|
|
2972
3214
|
var LoginPage_default = LoginPage;
|
|
2973
3215
|
|
|
2974
3216
|
// src/components/ProcedureForm.tsx
|
|
2975
|
-
import React7, { useState as
|
|
3217
|
+
import React7, { useState as useState8, useCallback as useCallback7, useMemo as useMemo4 } from "react";
|
|
2976
3218
|
import { useParams } from "react-router-dom";
|
|
2977
3219
|
import {
|
|
2978
3220
|
TextField as TextField2,
|
|
@@ -2985,22 +3227,22 @@ import {
|
|
|
2985
3227
|
FormControlLabel,
|
|
2986
3228
|
FormHelperText,
|
|
2987
3229
|
Typography as Typography14,
|
|
2988
|
-
Box as
|
|
2989
|
-
CircularProgress as
|
|
3230
|
+
Box as Box17,
|
|
3231
|
+
CircularProgress as CircularProgress5,
|
|
2990
3232
|
Alert as Alert3,
|
|
2991
3233
|
Divider as Divider2,
|
|
2992
|
-
Paper as
|
|
3234
|
+
Paper as Paper4
|
|
2993
3235
|
} from "@mui/material";
|
|
2994
3236
|
|
|
2995
3237
|
// src/pages/procedure-results/SuccessDisplay.tsx
|
|
2996
|
-
import { Box as
|
|
2997
|
-
import { jsx as
|
|
3238
|
+
import { Box as Box16, Typography as Typography13, Paper as Paper3 } from "@mui/material";
|
|
3239
|
+
import { jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2998
3240
|
var SuccessDisplay = ({ data }) => {
|
|
2999
|
-
return /* @__PURE__ */
|
|
3000
|
-
/* @__PURE__ */
|
|
3001
|
-
/* @__PURE__ */
|
|
3002
|
-
/* @__PURE__ */
|
|
3003
|
-
/* @__PURE__ */
|
|
3241
|
+
return /* @__PURE__ */ jsxs14(Paper3, { elevation: 2, sx: { p: 2, mt: 2, bgcolor: "success.light", color: "success.contrastText" }, children: [
|
|
3242
|
+
/* @__PURE__ */ jsx23(Typography13, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: "\xA1Operaci\xF3n Exitosa!" }),
|
|
3243
|
+
/* @__PURE__ */ jsx23(Typography13, { variant: "body2", sx: { fontSize: "0.85rem" }, children: "Detalles del resultado:" }),
|
|
3244
|
+
/* @__PURE__ */ jsx23(Box16, { sx: { bgcolor: "success.dark", p: 1, borderRadius: 1, mt: 1, overflowX: "auto" }, children: /* @__PURE__ */ jsx23("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(data, null, 2) }) }),
|
|
3245
|
+
/* @__PURE__ */ jsx23(Typography13, { variant: "body2", sx: { fontSize: "0.8rem", mt: 1 }, children: "Puedes revisar los detalles anteriores o cerrar este mensaje." })
|
|
3004
3246
|
] });
|
|
3005
3247
|
};
|
|
3006
3248
|
var SuccessDisplay_default = SuccessDisplay;
|
|
@@ -3014,22 +3256,22 @@ var extendResultsOk = (newComponents) => {
|
|
|
3014
3256
|
};
|
|
3015
3257
|
|
|
3016
3258
|
// src/components/ProcedureForm.tsx
|
|
3017
|
-
import { jsx as
|
|
3259
|
+
import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3018
3260
|
var ProcedureForm = () => {
|
|
3019
3261
|
const { procedureName } = useParams();
|
|
3020
3262
|
const { clientContext } = useApp();
|
|
3021
3263
|
const { callApi, loading: apiLoading, error: apiError } = useApiCall();
|
|
3022
|
-
const [validationErrors, setValidationErrors] =
|
|
3023
|
-
const [successMessage, setSuccessMessage] =
|
|
3024
|
-
const [executionLog, setExecutionLog] =
|
|
3025
|
-
const [procedureResultData, setProcedureResultData] =
|
|
3264
|
+
const [validationErrors, setValidationErrors] = useState8({});
|
|
3265
|
+
const [successMessage, setSuccessMessage] = useState8(null);
|
|
3266
|
+
const [executionLog, setExecutionLog] = useState8([]);
|
|
3267
|
+
const [procedureResultData, setProcedureResultData] = useState8(null);
|
|
3026
3268
|
const procedure = useMemo4(() => {
|
|
3027
3269
|
if (procedureName && clientContext?.procedure) {
|
|
3028
3270
|
return clientContext.procedure[procedureName];
|
|
3029
3271
|
}
|
|
3030
3272
|
return void 0;
|
|
3031
3273
|
}, [procedureName, clientContext]);
|
|
3032
|
-
const [formValues, setFormValues] =
|
|
3274
|
+
const [formValues, setFormValues] = useState8(() => {
|
|
3033
3275
|
if (!procedure) return {};
|
|
3034
3276
|
const initialValues = {};
|
|
3035
3277
|
procedure.parameters.forEach((param) => {
|
|
@@ -3229,9 +3471,9 @@ var ProcedureForm = () => {
|
|
|
3229
3471
|
sx: { fontSize: "0.8rem" }
|
|
3230
3472
|
};
|
|
3231
3473
|
if (param.options && param.options.length > 0) {
|
|
3232
|
-
return /* @__PURE__ */
|
|
3233
|
-
/* @__PURE__ */
|
|
3234
|
-
/* @__PURE__ */
|
|
3474
|
+
return /* @__PURE__ */ jsxs15(FormControl, { fullWidth: true, margin: "dense", size: "small", error: hasError, required: commonProps.required, children: [
|
|
3475
|
+
/* @__PURE__ */ jsx24(InputLabel, { id: `${param.name}-label`, sx: { fontSize: "0.8rem" }, children: param.label || param.name }),
|
|
3476
|
+
/* @__PURE__ */ jsxs15(
|
|
3235
3477
|
Select,
|
|
3236
3478
|
{
|
|
3237
3479
|
labelId: `${param.name}-label`,
|
|
@@ -3242,14 +3484,14 @@ var ProcedureForm = () => {
|
|
|
3242
3484
|
label: param.label || param.name,
|
|
3243
3485
|
disabled: apiLoading,
|
|
3244
3486
|
sx: { fontSize: "0.8rem" },
|
|
3245
|
-
renderValue: (selected) => /* @__PURE__ */
|
|
3487
|
+
renderValue: (selected) => /* @__PURE__ */ jsx24(Typography14, { sx: { fontSize: "0.8rem" }, children: selected }),
|
|
3246
3488
|
children: [
|
|
3247
|
-
(!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */
|
|
3248
|
-
param.options.map((option) => /* @__PURE__ */
|
|
3489
|
+
(!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */ jsx24(MenuItem, { value: "", sx: { fontSize: "0.8rem" }, children: /* @__PURE__ */ jsx24("em", { children: "Seleccione..." }) }),
|
|
3490
|
+
param.options.map((option) => /* @__PURE__ */ jsx24(MenuItem, { value: option, sx: { fontSize: "0.8rem" }, children: option }, option))
|
|
3249
3491
|
]
|
|
3250
3492
|
}
|
|
3251
3493
|
),
|
|
3252
|
-
(param.description || errorMessage) && /* @__PURE__ */
|
|
3494
|
+
(param.description || errorMessage) && /* @__PURE__ */ jsx24(FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
|
|
3253
3495
|
] });
|
|
3254
3496
|
}
|
|
3255
3497
|
switch (param.typeName) {
|
|
@@ -3258,18 +3500,18 @@ var ProcedureForm = () => {
|
|
|
3258
3500
|
case "tsrange":
|
|
3259
3501
|
case "time_range":
|
|
3260
3502
|
case "daterange":
|
|
3261
|
-
return /* @__PURE__ */
|
|
3503
|
+
return /* @__PURE__ */ jsx24(TextField2, { type: "text", value: formValues[param.name] || "", ...commonProps });
|
|
3262
3504
|
case "decimal":
|
|
3263
3505
|
case "double":
|
|
3264
|
-
return /* @__PURE__ */
|
|
3506
|
+
return /* @__PURE__ */ jsx24(TextField2, { type: "number", inputProps: { step: "any", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
|
|
3265
3507
|
case "integer":
|
|
3266
3508
|
case "bigint":
|
|
3267
|
-
return /* @__PURE__ */
|
|
3509
|
+
return /* @__PURE__ */ jsx24(TextField2, { type: "number", inputProps: { step: "1", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
|
|
3268
3510
|
case "boolean":
|
|
3269
|
-
return /* @__PURE__ */
|
|
3511
|
+
return /* @__PURE__ */ jsx24(
|
|
3270
3512
|
FormControlLabel,
|
|
3271
3513
|
{
|
|
3272
|
-
control: /* @__PURE__ */
|
|
3514
|
+
control: /* @__PURE__ */ jsx24(
|
|
3273
3515
|
Checkbox,
|
|
3274
3516
|
{
|
|
3275
3517
|
checked: !!formValues[param.name],
|
|
@@ -3280,21 +3522,21 @@ var ProcedureForm = () => {
|
|
|
3280
3522
|
size: "small"
|
|
3281
3523
|
}
|
|
3282
3524
|
),
|
|
3283
|
-
label: /* @__PURE__ */
|
|
3525
|
+
label: /* @__PURE__ */ jsx24(Typography14, { sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "inherit" }, children: param.label || param.name }),
|
|
3284
3526
|
sx: { mt: 1, mb: 0 }
|
|
3285
3527
|
}
|
|
3286
3528
|
);
|
|
3287
3529
|
case "date":
|
|
3288
3530
|
case "timestamp":
|
|
3289
3531
|
case "time":
|
|
3290
|
-
return /* @__PURE__ */
|
|
3532
|
+
return /* @__PURE__ */ jsx24(TextField2, { type: param.typeName === "date" ? "date" : param.typeName === "timestamp" ? "datetime-local" : "time", value: formValues[param.name] || "", ...commonProps, InputLabelProps: { shrink: true, sx: { fontSize: "0.8rem" } } });
|
|
3291
3533
|
case "jsonb":
|
|
3292
3534
|
case "jsona":
|
|
3293
|
-
return /* @__PURE__ */
|
|
3535
|
+
return /* @__PURE__ */ jsx24(TextField2, { multiline: true, rows: 5, value: formValues[param.name] || "", ...commonProps, InputProps: { sx: { fontSize: "0.8rem" } } });
|
|
3294
3536
|
case "bytea":
|
|
3295
|
-
return /* @__PURE__ */
|
|
3296
|
-
/* @__PURE__ */
|
|
3297
|
-
/* @__PURE__ */
|
|
3537
|
+
return /* @__PURE__ */ jsxs15(FormControl, { fullWidth: true, margin: "dense", error: hasError, required: commonProps.required, children: [
|
|
3538
|
+
/* @__PURE__ */ jsx24(Typography14, { variant: "body2", color: "textSecondary", component: "label", htmlFor: param.name, sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "text.secondary" }, children: param.label || param.name }),
|
|
3539
|
+
/* @__PURE__ */ jsx24(
|
|
3298
3540
|
"input",
|
|
3299
3541
|
{
|
|
3300
3542
|
type: "file",
|
|
@@ -3308,34 +3550,34 @@ var ProcedureForm = () => {
|
|
|
3308
3550
|
style: { padding: "6px 0", fontSize: "0.8rem" }
|
|
3309
3551
|
}
|
|
3310
3552
|
),
|
|
3311
|
-
(param.description || errorMessage) && /* @__PURE__ */
|
|
3553
|
+
(param.description || errorMessage) && /* @__PURE__ */ jsx24(FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
|
|
3312
3554
|
] });
|
|
3313
3555
|
default:
|
|
3314
|
-
return /* @__PURE__ */
|
|
3556
|
+
return /* @__PURE__ */ jsx24(TextField2, { type: "text", value: formValues[param.name] || "", ...commonProps });
|
|
3315
3557
|
}
|
|
3316
3558
|
}, [formValues, handleChange, apiLoading, validationErrors]);
|
|
3317
3559
|
const ResultDisplayContent = useMemo4(() => {
|
|
3318
3560
|
if (!procedureResultData || !procedure?.resultOk) return null;
|
|
3319
3561
|
const ComponentToRender = resultsOk[procedure.resultOk];
|
|
3320
3562
|
if (ComponentToRender) {
|
|
3321
|
-
return /* @__PURE__ */
|
|
3563
|
+
return /* @__PURE__ */ jsx24(ComponentToRender, { data: procedureResultData });
|
|
3322
3564
|
} else {
|
|
3323
|
-
return /* @__PURE__ */
|
|
3324
|
-
/* @__PURE__ */
|
|
3565
|
+
return /* @__PURE__ */ jsxs15(Paper4, { elevation: 2, sx: { p: 2, mt: 0, bgcolor: "warning.light" }, children: [
|
|
3566
|
+
/* @__PURE__ */ jsxs15(Typography14, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: [
|
|
3325
3567
|
"el componente para resolver el resultOk: '",
|
|
3326
3568
|
procedure.resultOk,
|
|
3327
3569
|
"' definido en el procedure no existe o no est\xE1 mapeado."
|
|
3328
3570
|
] }),
|
|
3329
|
-
/* @__PURE__ */
|
|
3571
|
+
/* @__PURE__ */ jsx24(Box17, { sx: {
|
|
3330
3572
|
bgcolor: "warning.dark",
|
|
3331
3573
|
p: 1,
|
|
3332
3574
|
borderRadius: 1
|
|
3333
|
-
}, children: /* @__PURE__ */
|
|
3575
|
+
}, children: /* @__PURE__ */ jsx24("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(procedureResultData, null, 2) }) })
|
|
3334
3576
|
] });
|
|
3335
3577
|
}
|
|
3336
3578
|
}, [procedureResultData, procedure]);
|
|
3337
3579
|
if (!procedure) {
|
|
3338
|
-
return /* @__PURE__ */
|
|
3580
|
+
return /* @__PURE__ */ jsxs15(Box17, { sx: {
|
|
3339
3581
|
p: 2,
|
|
3340
3582
|
width: "100%",
|
|
3341
3583
|
boxSizing: "border-box",
|
|
@@ -3345,13 +3587,13 @@ var ProcedureForm = () => {
|
|
|
3345
3587
|
boxShadow: 3,
|
|
3346
3588
|
textAlign: "center"
|
|
3347
3589
|
}, children: [
|
|
3348
|
-
/* @__PURE__ */
|
|
3349
|
-
/* @__PURE__ */
|
|
3590
|
+
/* @__PURE__ */ jsx24(CircularProgress5, { sx: { mb: 2 } }),
|
|
3591
|
+
/* @__PURE__ */ jsx24(Typography14, { variant: "h6", color: "text.secondary", children: "Cargando procedimiento o no encontrado..." })
|
|
3350
3592
|
] });
|
|
3351
3593
|
}
|
|
3352
3594
|
return (
|
|
3353
3595
|
// Esta es la Box más externa que ahora controlará el scroll
|
|
3354
|
-
/* @__PURE__ */
|
|
3596
|
+
/* @__PURE__ */ jsxs15(Box17, { sx: {
|
|
3355
3597
|
p: 2,
|
|
3356
3598
|
ml: 1,
|
|
3357
3599
|
mt: 2,
|
|
@@ -3368,16 +3610,16 @@ var ProcedureForm = () => {
|
|
|
3368
3610
|
overflowX: "hidden"
|
|
3369
3611
|
// Oculta el scroll horizontal si no es necesario para el contenedor principal
|
|
3370
3612
|
}, children: [
|
|
3371
|
-
/* @__PURE__ */
|
|
3372
|
-
Object.values(validationErrors).some((err) => err !== null) && /* @__PURE__ */
|
|
3613
|
+
/* @__PURE__ */ jsx24(Typography14, { variant: "h5", component: "h2", gutterBottom: true, align: "left", children: cambiarGuionesBajosPorEspacios(procedure.proceedLabel || procedure.action) }),
|
|
3614
|
+
Object.values(validationErrors).some((err) => err !== null) && /* @__PURE__ */ jsxs15(Alert3, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: [
|
|
3373
3615
|
"Por favor, corrige los errores en el formulario antes de enviar.",
|
|
3374
|
-
/* @__PURE__ */
|
|
3616
|
+
/* @__PURE__ */ jsx24("ul", { children: Object.values(validationErrors).map((err, idx) => err && /* @__PURE__ */ jsx24("li", { children: err }, idx)) })
|
|
3375
3617
|
] }),
|
|
3376
|
-
!Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */
|
|
3377
|
-
!Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */
|
|
3378
|
-
/* @__PURE__ */
|
|
3379
|
-
procedure.parameters.map((param) => /* @__PURE__ */
|
|
3380
|
-
/* @__PURE__ */
|
|
3618
|
+
!Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */ jsx24(Alert3, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: apiError.message }),
|
|
3619
|
+
!Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */ jsx24(Alert3, { severity: "success", sx: { mb: 2, fontSize: "0.8rem" }, children: successMessage }),
|
|
3620
|
+
/* @__PURE__ */ jsxs15("form", { onSubmit: handleSubmit, children: [
|
|
3621
|
+
procedure.parameters.map((param) => /* @__PURE__ */ jsx24("div", { children: renderInputField(param) }, param.name)),
|
|
3622
|
+
/* @__PURE__ */ jsx24(
|
|
3381
3623
|
Button7,
|
|
3382
3624
|
{
|
|
3383
3625
|
type: "submit",
|
|
@@ -3386,20 +3628,20 @@ var ProcedureForm = () => {
|
|
|
3386
3628
|
disabled: apiLoading || Object.values(validationErrors).some((err) => err !== null),
|
|
3387
3629
|
sx: { mt: 2 },
|
|
3388
3630
|
size: "medium",
|
|
3389
|
-
startIcon: apiLoading ? /* @__PURE__ */
|
|
3631
|
+
startIcon: apiLoading ? /* @__PURE__ */ jsx24(CircularProgress5, { size: 20, color: "inherit" }) : null,
|
|
3390
3632
|
children: apiLoading ? "Ejecutando..." : procedure.proceedLabel || "Ejecutar"
|
|
3391
3633
|
}
|
|
3392
3634
|
)
|
|
3393
3635
|
] }),
|
|
3394
|
-
ResultDisplayContent && /* @__PURE__ */
|
|
3636
|
+
ResultDisplayContent && /* @__PURE__ */ jsxs15(Box17, { sx: { mt: 2 }, children: [
|
|
3395
3637
|
" ",
|
|
3396
3638
|
ResultDisplayContent
|
|
3397
3639
|
] }),
|
|
3398
|
-
executionLog.length > 0 && /* @__PURE__ */
|
|
3399
|
-
/* @__PURE__ */
|
|
3400
|
-
/* @__PURE__ */
|
|
3401
|
-
/* @__PURE__ */
|
|
3402
|
-
|
|
3640
|
+
executionLog.length > 0 && /* @__PURE__ */ jsxs15(Box17, { sx: { mt: 3 }, children: [
|
|
3641
|
+
/* @__PURE__ */ jsx24(Divider2, { sx: { mb: 2 } }),
|
|
3642
|
+
/* @__PURE__ */ jsx24(Typography14, { variant: "h6", gutterBottom: true, sx: { fontSize: "0.9rem" }, children: "Registro de Ejecuci\xF3n" }),
|
|
3643
|
+
/* @__PURE__ */ jsx24(
|
|
3644
|
+
Box17,
|
|
3403
3645
|
{
|
|
3404
3646
|
sx: {
|
|
3405
3647
|
bgcolor: "grey.100",
|
|
@@ -3412,7 +3654,7 @@ var ProcedureForm = () => {
|
|
|
3412
3654
|
fontSize: "0.75rem",
|
|
3413
3655
|
whiteSpace: "pre-wrap"
|
|
3414
3656
|
},
|
|
3415
|
-
children: executionLog.map((log, index) => /* @__PURE__ */
|
|
3657
|
+
children: executionLog.map((log, index) => /* @__PURE__ */ jsx24(
|
|
3416
3658
|
Typography14,
|
|
3417
3659
|
{
|
|
3418
3660
|
component: "pre",
|
|
@@ -3440,7 +3682,7 @@ import { PersistGate } from "redux-persist/integration/react";
|
|
|
3440
3682
|
// src/components/PrivateRoute.tsx
|
|
3441
3683
|
import { useEffect as useEffect5 } from "react";
|
|
3442
3684
|
import { Navigate, useLocation as useLocation2 } from "react-router-dom";
|
|
3443
|
-
import { Fragment as
|
|
3685
|
+
import { Fragment as Fragment4, jsx as jsx25 } from "react/jsx-runtime";
|
|
3444
3686
|
var PrivateRoute = ({ children }) => {
|
|
3445
3687
|
const location = useLocation2();
|
|
3446
3688
|
const dispatch = useAppDispatch();
|
|
@@ -3464,14 +3706,14 @@ var PrivateRoute = ({ children }) => {
|
|
|
3464
3706
|
}, [isAuthenticated, isLoadingAuth, location, dispatch, clientContextStatus]);
|
|
3465
3707
|
if (isLoadingAuth) {
|
|
3466
3708
|
console.log(`[PrivateRoute] Returning loading state...`);
|
|
3467
|
-
return /* @__PURE__ */
|
|
3709
|
+
return /* @__PURE__ */ jsx25("p", { children: "Verificando autenticaci\xF3n..." });
|
|
3468
3710
|
}
|
|
3469
3711
|
if (!isAuthenticated) {
|
|
3470
3712
|
console.log(`[PrivateRoute] User not authenticated, navigating to /login`);
|
|
3471
|
-
return /* @__PURE__ */
|
|
3713
|
+
return /* @__PURE__ */ jsx25(Navigate, { to: "/login", replace: true });
|
|
3472
3714
|
}
|
|
3473
3715
|
console.log(`[PrivateRoute] User authenticated, rendering children.`);
|
|
3474
|
-
return /* @__PURE__ */
|
|
3716
|
+
return /* @__PURE__ */ jsx25(Fragment4, { children });
|
|
3475
3717
|
};
|
|
3476
3718
|
var PrivateRoute_default = PrivateRoute;
|
|
3477
3719
|
|
|
@@ -3505,25 +3747,25 @@ var InitialRedirectHandler_default = InitialRedirectHandler;
|
|
|
3505
3747
|
|
|
3506
3748
|
// src/pages/GenericDataGridPage.tsx
|
|
3507
3749
|
import { useParams as useParams2 } from "react-router-dom";
|
|
3508
|
-
import { Box as
|
|
3509
|
-
import { jsx as
|
|
3750
|
+
import { Box as Box18, Alert as Alert4, Typography as Typography15 } from "@mui/material";
|
|
3751
|
+
import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3510
3752
|
var GenericDataGridPage = () => {
|
|
3511
3753
|
const { tableName } = useParams2();
|
|
3512
3754
|
if (!tableName) {
|
|
3513
|
-
return /* @__PURE__ */
|
|
3514
|
-
/* @__PURE__ */
|
|
3515
|
-
/* @__PURE__ */
|
|
3755
|
+
return /* @__PURE__ */ jsx26(Box18, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsxs16(Alert4, { severity: "error", children: [
|
|
3756
|
+
/* @__PURE__ */ jsx26(Typography15, { variant: "h6", children: "Error: Nombre de tabla no especificado en la URL." }),
|
|
3757
|
+
/* @__PURE__ */ jsx26(Typography15, { variant: "body1", children: "Por favor, aseg\xFArate de que la URL contenga el nombre de la tabla (ej. `/data/users`)." })
|
|
3516
3758
|
] }) });
|
|
3517
3759
|
}
|
|
3518
|
-
return /* @__PURE__ */
|
|
3760
|
+
return /* @__PURE__ */ jsx26(GenericDataGrid_default, { tableName, fixedFields: [] });
|
|
3519
3761
|
};
|
|
3520
3762
|
var GenericDataGridPage_default = GenericDataGridPage;
|
|
3521
3763
|
|
|
3522
3764
|
// src/pages/MenuTablePage.tsx
|
|
3523
3765
|
import { useMemo as useMemo5 } from "react";
|
|
3524
3766
|
import { useParams as useParams3 } from "react-router-dom";
|
|
3525
|
-
import { Box as
|
|
3526
|
-
import { jsx as
|
|
3767
|
+
import { Box as Box19, Alert as Alert5, Typography as Typography16 } from "@mui/material";
|
|
3768
|
+
import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3527
3769
|
var MenuTablePage = () => {
|
|
3528
3770
|
const { menuName } = useParams3();
|
|
3529
3771
|
const { clientContext } = useApp();
|
|
@@ -3565,12 +3807,12 @@ var MenuTablePage = () => {
|
|
|
3565
3807
|
};
|
|
3566
3808
|
}, [menuName, clientContext]);
|
|
3567
3809
|
if (!currentTableName) {
|
|
3568
|
-
return /* @__PURE__ */
|
|
3569
|
-
/* @__PURE__ */
|
|
3570
|
-
/* @__PURE__ */
|
|
3810
|
+
return /* @__PURE__ */ jsx27(Box19, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsxs17(Alert5, { severity: "error", children: [
|
|
3811
|
+
/* @__PURE__ */ jsx27(Typography16, { variant: "h6", children: "Error: No se pudo cargar la informaci\xF3n de la tabla." }),
|
|
3812
|
+
/* @__PURE__ */ jsx27(Typography16, { variant: "body1", children: "Verifique la configuraci\xF3n del men\xFA o el nombre de la tabla en la URL." })
|
|
3571
3813
|
] }) });
|
|
3572
3814
|
}
|
|
3573
|
-
return /* @__PURE__ */
|
|
3815
|
+
return /* @__PURE__ */ jsx27(
|
|
3574
3816
|
GenericDataGrid_default,
|
|
3575
3817
|
{
|
|
3576
3818
|
tableName: currentTableName,
|
|
@@ -3581,8 +3823,8 @@ var MenuTablePage = () => {
|
|
|
3581
3823
|
var MenuTablePage_default = MenuTablePage;
|
|
3582
3824
|
|
|
3583
3825
|
// src/App.tsx
|
|
3584
|
-
import { Box as
|
|
3585
|
-
import { jsx as
|
|
3826
|
+
import { Box as Box20 } from "@mui/material";
|
|
3827
|
+
import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3586
3828
|
var LocationTracker = () => {
|
|
3587
3829
|
const location = useLocation4();
|
|
3588
3830
|
const dispatch = useAppDispatch();
|
|
@@ -3592,24 +3834,24 @@ var LocationTracker = () => {
|
|
|
3592
3834
|
return null;
|
|
3593
3835
|
};
|
|
3594
3836
|
function FrontendPlusReactRoutes({ myRoutes }) {
|
|
3595
|
-
return /* @__PURE__ */
|
|
3596
|
-
/* @__PURE__ */
|
|
3597
|
-
/* @__PURE__ */
|
|
3598
|
-
/* @__PURE__ */
|
|
3599
|
-
/* @__PURE__ */
|
|
3600
|
-
/* @__PURE__ */
|
|
3837
|
+
return /* @__PURE__ */ jsxs18(Routes, { children: [
|
|
3838
|
+
/* @__PURE__ */ jsx28(Route, { path: "/login", element: /* @__PURE__ */ jsx28(LoginPage_default, {}) }),
|
|
3839
|
+
/* @__PURE__ */ jsx28(Route, { path: "/logout", element: /* @__PURE__ */ jsx28(LogoutPage_default, {}) }),
|
|
3840
|
+
/* @__PURE__ */ jsxs18(Route, { element: /* @__PURE__ */ jsxs18(PrivateRoute_default, { children: [
|
|
3841
|
+
/* @__PURE__ */ jsx28(InitialRedirectHandler_default, {}),
|
|
3842
|
+
/* @__PURE__ */ jsx28(MainLayout_default, {})
|
|
3601
3843
|
] }), children: [
|
|
3602
|
-
/* @__PURE__ */
|
|
3603
|
-
/* @__PURE__ */
|
|
3604
|
-
/* @__PURE__ */
|
|
3605
|
-
/* @__PURE__ */
|
|
3606
|
-
/* @__PURE__ */
|
|
3607
|
-
Object.keys(wScreens).map((screenName) => /* @__PURE__ */
|
|
3844
|
+
/* @__PURE__ */ jsx28(Route, { path: "/", element: /* @__PURE__ */ jsx28(HomePage_default, {}) }),
|
|
3845
|
+
/* @__PURE__ */ jsx28(Route, { path: "/home", element: /* @__PURE__ */ jsx28(HomePage_default, {}) }),
|
|
3846
|
+
/* @__PURE__ */ jsx28(Route, { path: "/table/:tableName", element: /* @__PURE__ */ jsx28(GenericDataGridPage_default, {}) }),
|
|
3847
|
+
/* @__PURE__ */ jsx28(Route, { path: "/menu/:menuName", element: /* @__PURE__ */ jsx28(MenuTablePage_default, {}) }),
|
|
3848
|
+
/* @__PURE__ */ jsx28(Route, { path: "/procedures/:procedureName", element: /* @__PURE__ */ jsx28(ProcedureForm_default, {}) }),
|
|
3849
|
+
Object.keys(wScreens).map((screenName) => /* @__PURE__ */ jsx28(
|
|
3608
3850
|
Route,
|
|
3609
3851
|
{
|
|
3610
3852
|
path: `/wScreens/${screenName}`,
|
|
3611
3853
|
element: React11.createElement(
|
|
3612
|
-
|
|
3854
|
+
Box20,
|
|
3613
3855
|
{
|
|
3614
3856
|
sx: { pt: 3, pl: 4 }
|
|
3615
3857
|
},
|
|
@@ -3618,17 +3860,17 @@ function FrontendPlusReactRoutes({ myRoutes }) {
|
|
|
3618
3860
|
},
|
|
3619
3861
|
screenName
|
|
3620
3862
|
)),
|
|
3621
|
-
/* @__PURE__ */
|
|
3863
|
+
/* @__PURE__ */ jsx28(
|
|
3622
3864
|
Route,
|
|
3623
3865
|
{
|
|
3624
3866
|
path: "/wScreens-fallback/:screenName",
|
|
3625
|
-
element: /* @__PURE__ */
|
|
3867
|
+
element: /* @__PURE__ */ jsx28(Box20, { sx: { p: 3 }, children: /* @__PURE__ */ jsx28(FallbackWScreen, { screenName: ":screenName" }) })
|
|
3626
3868
|
}
|
|
3627
3869
|
),
|
|
3628
|
-
/* @__PURE__ */
|
|
3870
|
+
/* @__PURE__ */ jsx28(Route, { path: "*", element: /* @__PURE__ */ jsx28("div", { style: { marginTop: "20px", marginLeft: "10px" }, children: "404 - Recurso No Encontrado" }) })
|
|
3629
3871
|
] }),
|
|
3630
3872
|
myRoutes,
|
|
3631
|
-
/* @__PURE__ */
|
|
3873
|
+
/* @__PURE__ */ jsx28(Route, { path: "*", element: /* @__PURE__ */ jsx28(Navigate2, { to: "/", replace: true }) })
|
|
3632
3874
|
] });
|
|
3633
3875
|
}
|
|
3634
3876
|
var App = ({
|
|
@@ -3648,16 +3890,16 @@ var App = ({
|
|
|
3648
3890
|
extendWScreens(myWScreens);
|
|
3649
3891
|
}
|
|
3650
3892
|
}, [myClientSides, myResultsOk, myWScreens]);
|
|
3651
|
-
return /* @__PURE__ */
|
|
3652
|
-
/* @__PURE__ */
|
|
3653
|
-
/* @__PURE__ */
|
|
3654
|
-
/* @__PURE__ */
|
|
3893
|
+
return /* @__PURE__ */ jsx28(Provider, { store, children: /* @__PURE__ */ jsx28(PersistGate, { loading: null, persistor, children: /* @__PURE__ */ jsxs18(BrowserRouter, { children: [
|
|
3894
|
+
/* @__PURE__ */ jsx28(LocationTracker, {}),
|
|
3895
|
+
/* @__PURE__ */ jsx28(AppProvider, { children: /* @__PURE__ */ jsxs18(SnackbarProvider, { children: [
|
|
3896
|
+
/* @__PURE__ */ jsx28(
|
|
3655
3897
|
FrontendPlusReactRoutes,
|
|
3656
3898
|
{
|
|
3657
3899
|
myRoutes
|
|
3658
3900
|
}
|
|
3659
3901
|
),
|
|
3660
|
-
/* @__PURE__ */
|
|
3902
|
+
/* @__PURE__ */ jsx28(SessionExpiredMessage_default, {})
|
|
3661
3903
|
] }) })
|
|
3662
3904
|
] }) }) });
|
|
3663
3905
|
};
|