frontend-plus-react 0.1.14 → 0.1.16
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 +322 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -6
- package/dist/index.d.ts +16 -6
- package/dist/index.js +572 -313
- package/dist/index.js.map +1 -1
- package/package.json +3 -8
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
|
|
|
@@ -757,12 +757,9 @@ var useApiCall = () => {
|
|
|
757
757
|
const { showSnackbar } = useSnackbar();
|
|
758
758
|
const [loading, setLoading] = useState2(false);
|
|
759
759
|
const [error, setError] = useState2(null);
|
|
760
|
-
const callApi = useCallback2(async (procedureName, params
|
|
760
|
+
const callApi = useCallback2(async (procedureName, params) => {
|
|
761
761
|
setLoading(true);
|
|
762
762
|
setError(null);
|
|
763
|
-
const defaultOpts = { ...{
|
|
764
|
-
reportOnSnackbar: true
|
|
765
|
-
}, ...opts };
|
|
766
763
|
try {
|
|
767
764
|
const result = await executeBackendProcedure(procedureName, params);
|
|
768
765
|
return result === null ? void 0 : result;
|
|
@@ -774,9 +771,7 @@ var useApiCall = () => {
|
|
|
774
771
|
} else if (err instanceof Error) {
|
|
775
772
|
snackbarMessage = err.message;
|
|
776
773
|
}
|
|
777
|
-
|
|
778
|
-
showSnackbar(snackbarMessage, "error");
|
|
779
|
-
}
|
|
774
|
+
showSnackbar(snackbarMessage, "error");
|
|
780
775
|
throw err;
|
|
781
776
|
} finally {
|
|
782
777
|
setLoading(false);
|
|
@@ -784,9 +779,28 @@ var useApiCall = () => {
|
|
|
784
779
|
}, [showSnackbar]);
|
|
785
780
|
return { callApi, loading, error };
|
|
786
781
|
};
|
|
782
|
+
var useApiCallWithoutSnackbar = () => {
|
|
783
|
+
const [loading, setLoading] = useState2(false);
|
|
784
|
+
const [error, setError] = useState2(null);
|
|
785
|
+
const callApi = useCallback2(async (procedureName, params) => {
|
|
786
|
+
setLoading(true);
|
|
787
|
+
setError(null);
|
|
788
|
+
try {
|
|
789
|
+
const result = await executeBackendProcedure(procedureName, params);
|
|
790
|
+
return result === null ? void 0 : result;
|
|
791
|
+
} catch (err) {
|
|
792
|
+
setError(err);
|
|
793
|
+
console.error(`Error en la llamada API (WithoutSnackbar) para ${procedureName}:`, err);
|
|
794
|
+
throw err;
|
|
795
|
+
} finally {
|
|
796
|
+
setLoading(false);
|
|
797
|
+
}
|
|
798
|
+
}, []);
|
|
799
|
+
return { callApi, loading, error };
|
|
800
|
+
};
|
|
787
801
|
|
|
788
802
|
// src/components/grid/GenericDataGrid.tsx
|
|
789
|
-
import { CircularProgress, Typography as Typography5, Box as
|
|
803
|
+
import { CircularProgress as CircularProgress2, Typography as Typography5, Box as Box8, Alert, useTheme as useTheme3 } from "@mui/material";
|
|
790
804
|
|
|
791
805
|
// src/utils/functions.tsx
|
|
792
806
|
var JSON4all = __toESM(require_json4all(), 1);
|
|
@@ -1027,17 +1041,131 @@ var ConfirmDialog = ({ open, onClose, title, message }) => {
|
|
|
1027
1041
|
);
|
|
1028
1042
|
};
|
|
1029
1043
|
|
|
1044
|
+
// src/components/grid/DataGridOptionsDialog.tsx
|
|
1045
|
+
import {
|
|
1046
|
+
Popover,
|
|
1047
|
+
List,
|
|
1048
|
+
ListItemButton,
|
|
1049
|
+
ListItemIcon,
|
|
1050
|
+
ListItemText,
|
|
1051
|
+
Paper,
|
|
1052
|
+
CircularProgress,
|
|
1053
|
+
Box
|
|
1054
|
+
} from "@mui/material";
|
|
1055
|
+
import { useState as useState3 } from "react";
|
|
1056
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1057
|
+
var DataGridOptionsDialog = ({
|
|
1058
|
+
open,
|
|
1059
|
+
onClose,
|
|
1060
|
+
options,
|
|
1061
|
+
anchorEl
|
|
1062
|
+
}) => {
|
|
1063
|
+
const [isExecuting, setIsExecuting] = useState3(false);
|
|
1064
|
+
const handleOptionClick = async (handler) => {
|
|
1065
|
+
try {
|
|
1066
|
+
setIsExecuting(true);
|
|
1067
|
+
await handler();
|
|
1068
|
+
} catch (error) {
|
|
1069
|
+
console.error("Error ejecutando handler:", error);
|
|
1070
|
+
} finally {
|
|
1071
|
+
setIsExecuting(false);
|
|
1072
|
+
onClose();
|
|
1073
|
+
}
|
|
1074
|
+
};
|
|
1075
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1076
|
+
open && /* @__PURE__ */ jsx3(
|
|
1077
|
+
"div",
|
|
1078
|
+
{
|
|
1079
|
+
style: {
|
|
1080
|
+
position: "fixed",
|
|
1081
|
+
top: 0,
|
|
1082
|
+
left: 0,
|
|
1083
|
+
right: 0,
|
|
1084
|
+
bottom: 0,
|
|
1085
|
+
backgroundColor: "rgba(0, 0, 0, 0.2)",
|
|
1086
|
+
zIndex: 1200,
|
|
1087
|
+
pointerEvents: "none"
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
),
|
|
1091
|
+
/* @__PURE__ */ jsx3(
|
|
1092
|
+
Popover,
|
|
1093
|
+
{
|
|
1094
|
+
open,
|
|
1095
|
+
anchorEl,
|
|
1096
|
+
onClose,
|
|
1097
|
+
anchorOrigin: {
|
|
1098
|
+
vertical: "bottom",
|
|
1099
|
+
horizontal: "left"
|
|
1100
|
+
},
|
|
1101
|
+
transformOrigin: {
|
|
1102
|
+
vertical: "top",
|
|
1103
|
+
horizontal: "left"
|
|
1104
|
+
},
|
|
1105
|
+
slotProps: {
|
|
1106
|
+
paper: {
|
|
1107
|
+
sx: {
|
|
1108
|
+
zIndex: 1300
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
},
|
|
1112
|
+
children: /* @__PURE__ */ jsxs3(Paper, { sx: { minWidth: 150, maxWidth: 350 }, children: [
|
|
1113
|
+
isExecuting && /* @__PURE__ */ jsx3(
|
|
1114
|
+
Box,
|
|
1115
|
+
{
|
|
1116
|
+
sx: {
|
|
1117
|
+
display: "flex",
|
|
1118
|
+
justifyContent: "center",
|
|
1119
|
+
alignItems: "center",
|
|
1120
|
+
p: 5
|
|
1121
|
+
},
|
|
1122
|
+
children: /* @__PURE__ */ jsx3(CircularProgress, { size: 40 })
|
|
1123
|
+
}
|
|
1124
|
+
),
|
|
1125
|
+
!isExecuting && /* @__PURE__ */ jsx3(List, { sx: {
|
|
1126
|
+
py: 0,
|
|
1127
|
+
"& .MuiListItemButton-root": {
|
|
1128
|
+
py: 0.5,
|
|
1129
|
+
px: 1.5,
|
|
1130
|
+
minHeight: 36
|
|
1131
|
+
},
|
|
1132
|
+
"& .MuiListItemIcon-root": {
|
|
1133
|
+
minWidth: 32
|
|
1134
|
+
},
|
|
1135
|
+
"& .MuiListItemText-primary": {
|
|
1136
|
+
fontSize: "0.85rem"
|
|
1137
|
+
},
|
|
1138
|
+
"& .MuiSvgIcon-root": {
|
|
1139
|
+
fontSize: 18
|
|
1140
|
+
}
|
|
1141
|
+
}, children: options.filter((option) => option.visible !== false).map((option) => /* @__PURE__ */ jsxs3(
|
|
1142
|
+
ListItemButton,
|
|
1143
|
+
{
|
|
1144
|
+
onClick: () => handleOptionClick(option.handler),
|
|
1145
|
+
children: [
|
|
1146
|
+
/* @__PURE__ */ jsx3(ListItemIcon, { children: option.icon }),
|
|
1147
|
+
/* @__PURE__ */ jsx3(ListItemText, { primary: option.label })
|
|
1148
|
+
]
|
|
1149
|
+
},
|
|
1150
|
+
option.id
|
|
1151
|
+
)) })
|
|
1152
|
+
] })
|
|
1153
|
+
}
|
|
1154
|
+
)
|
|
1155
|
+
] });
|
|
1156
|
+
};
|
|
1157
|
+
|
|
1030
1158
|
// src/components/grid/renderers/headerCellRenderers.tsx
|
|
1031
|
-
import { Box, IconButton, Tooltip, Typography } from "@mui/material";
|
|
1159
|
+
import { Box as Box2, IconButton, Tooltip, Typography } from "@mui/material";
|
|
1032
1160
|
import SearchIcon from "@mui/icons-material/Search";
|
|
1033
1161
|
import SearchOffIcon from "@mui/icons-material/SearchOff";
|
|
1034
1162
|
import MoreVertIcon from "@mui/icons-material/MoreVert";
|
|
1035
|
-
import { jsx as
|
|
1163
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1036
1164
|
var defaultColumnHeaderCellRenderer = (props, fieldDef) => {
|
|
1037
1165
|
const { column } = props;
|
|
1038
1166
|
const isPrimaryKey = fieldDef.isPk;
|
|
1039
|
-
return /* @__PURE__ */
|
|
1040
|
-
|
|
1167
|
+
return /* @__PURE__ */ jsx4(
|
|
1168
|
+
Box2,
|
|
1041
1169
|
{
|
|
1042
1170
|
sx: {
|
|
1043
1171
|
display: "flex",
|
|
@@ -1048,7 +1176,7 @@ var defaultColumnHeaderCellRenderer = (props, fieldDef) => {
|
|
|
1048
1176
|
boxSizing: "border-box",
|
|
1049
1177
|
height: "100%"
|
|
1050
1178
|
},
|
|
1051
|
-
children: /* @__PURE__ */
|
|
1179
|
+
children: /* @__PURE__ */ jsx4(
|
|
1052
1180
|
Typography,
|
|
1053
1181
|
{
|
|
1054
1182
|
variant: "body2",
|
|
@@ -1064,41 +1192,42 @@ var defaultColumnHeaderCellRenderer = (props, fieldDef) => {
|
|
|
1064
1192
|
}
|
|
1065
1193
|
);
|
|
1066
1194
|
};
|
|
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
|
-
|
|
1195
|
+
var actionsColumnHeaderCellRenderer = (props, isFilterRowVisible, toggleFilterVisibility, handleDataGridOptions) => {
|
|
1196
|
+
return /* @__PURE__ */ jsxs4(Box2, { sx: { display: "flex", flexDirection: "row", alignItems: "center", justifyContent: "center", gap: 0.2 }, children: [
|
|
1197
|
+
/* @__PURE__ */ jsx4(
|
|
1198
|
+
IconButton,
|
|
1199
|
+
{
|
|
1200
|
+
color: "inherit",
|
|
1201
|
+
onClick: toggleFilterVisibility,
|
|
1202
|
+
size: "small",
|
|
1203
|
+
title: isFilterRowVisible ? "Ocultar filtros" : "Mostrar filtros",
|
|
1204
|
+
sx: { p: 0.25 },
|
|
1205
|
+
children: isFilterRowVisible ? /* @__PURE__ */ jsx4(SearchOffIcon, { sx: { fontSize: 18 } }) : /* @__PURE__ */ jsx4(SearchIcon, { sx: { fontSize: 18 } })
|
|
1206
|
+
}
|
|
1207
|
+
),
|
|
1208
|
+
/* @__PURE__ */ jsx4(
|
|
1209
|
+
IconButton,
|
|
1210
|
+
{
|
|
1211
|
+
onClick: (event) => handleDataGridOptions(event),
|
|
1212
|
+
size: "small",
|
|
1213
|
+
title: "Opciones de esta tabla",
|
|
1214
|
+
sx: { p: 0.25 },
|
|
1215
|
+
children: /* @__PURE__ */ jsx4(MoreVertIcon, { sx: { fontSize: 20, variant: "filled", size: "small" } })
|
|
1216
|
+
}
|
|
1217
|
+
)
|
|
1218
|
+
] });
|
|
1219
|
+
};
|
|
1220
|
+
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
1221
|
|
|
1093
1222
|
// src/components/grid/FilterInputRender.tsx
|
|
1094
1223
|
import { InputBase } from "@mui/material";
|
|
1095
|
-
import { jsx as
|
|
1224
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1096
1225
|
function FilterInputRenderer({
|
|
1097
1226
|
column,
|
|
1098
1227
|
filters,
|
|
1099
1228
|
setFilters
|
|
1100
1229
|
}) {
|
|
1101
|
-
return /* @__PURE__ */
|
|
1230
|
+
return /* @__PURE__ */ jsx5(
|
|
1102
1231
|
InputBase,
|
|
1103
1232
|
{
|
|
1104
1233
|
value: filters[column.key] || "",
|
|
@@ -1123,13 +1252,13 @@ function FilterInputRenderer({
|
|
|
1123
1252
|
var FilterInputRender_default = FilterInputRenderer;
|
|
1124
1253
|
|
|
1125
1254
|
// src/components/grid/renderers/summaryCellRenderers.tsx
|
|
1126
|
-
import { Box as
|
|
1127
|
-
import { jsx as
|
|
1255
|
+
import { Box as Box3 } from "@mui/material";
|
|
1256
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1128
1257
|
var defaultColumnSummaryCellRenderer = (props, fixedFields, isFilterRowVisible, filters, setFilters) => {
|
|
1129
1258
|
const { column } = props;
|
|
1130
1259
|
const fixedFieldEntry = fixedFields?.find((f) => f.fieldName === column.key);
|
|
1131
1260
|
if (fixedFieldEntry && fixedFieldEntry.until === void 0 || !isFilterRowVisible) return null;
|
|
1132
|
-
return /* @__PURE__ */
|
|
1261
|
+
return /* @__PURE__ */ jsx6(Box3, { children: /* @__PURE__ */ jsx6(
|
|
1133
1262
|
FilterInputRender_default,
|
|
1134
1263
|
{
|
|
1135
1264
|
column,
|
|
@@ -1142,7 +1271,7 @@ var actionsColumnSummaryCellRenderer = (props) => null;
|
|
|
1142
1271
|
var detailColumnCellSummaryRenderer = (props) => null;
|
|
1143
1272
|
|
|
1144
1273
|
// src/components/grid/renderers/cellRenderers.tsx
|
|
1145
|
-
import { Box as
|
|
1274
|
+
import { Box as Box6, Button as Button2, IconButton as IconButton2, Tooltip as Tooltip3, Typography as Typography4, useTheme } from "@mui/material";
|
|
1146
1275
|
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
|
|
1147
1276
|
import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
|
|
1148
1277
|
import ViewHeadlineIcon from "@mui/icons-material/ViewHeadline";
|
|
@@ -1150,29 +1279,29 @@ import DeleteIcon from "@mui/icons-material/Delete";
|
|
|
1150
1279
|
import AddIcon from "@mui/icons-material/Add";
|
|
1151
1280
|
|
|
1152
1281
|
// src/components/grid/ExampleClientSideComponent.tsx
|
|
1153
|
-
import { Box as
|
|
1154
|
-
import { jsx as
|
|
1282
|
+
import { Box as Box4, Typography as Typography2 } from "@mui/material";
|
|
1283
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1155
1284
|
var ExampleClientSideComponent = ({ row, column, fieldDefinition }) => {
|
|
1156
1285
|
const value = row[column.key];
|
|
1157
|
-
return /* @__PURE__ */
|
|
1286
|
+
return /* @__PURE__ */ jsx7(Box4, { sx: {
|
|
1158
1287
|
padding: 0.5,
|
|
1159
1288
|
width: "100%",
|
|
1160
1289
|
height: "100%",
|
|
1161
1290
|
display: "flex",
|
|
1162
1291
|
alignItems: "center",
|
|
1163
1292
|
backgroundColor: value === "Special" ? "lightblue" : "transparent"
|
|
1164
|
-
}, children: /* @__PURE__ */
|
|
1293
|
+
}, children: /* @__PURE__ */ jsx7(Typography2, { variant: "body2", sx: { fontWeight: "bold" }, children: value ? `CS: ${value}` : "N/A" }) });
|
|
1165
1294
|
};
|
|
1166
1295
|
var ExampleClientSideComponent_default = ExampleClientSideComponent;
|
|
1167
1296
|
|
|
1168
1297
|
// src/components/grid/FallbackClientSideRenderer.tsx
|
|
1169
|
-
import { Box as
|
|
1298
|
+
import { Box as Box5, Typography as Typography3, Tooltip as Tooltip2 } from "@mui/material";
|
|
1170
1299
|
import WarningAmberIcon from "@mui/icons-material/WarningAmber";
|
|
1171
|
-
import { jsx as
|
|
1300
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1172
1301
|
var FallbackClientSideRenderer = ({ column, row, fieldDefinition }) => {
|
|
1173
1302
|
const clientSideName = fieldDefinition?.clientSide || "Desconocido";
|
|
1174
|
-
return /* @__PURE__ */
|
|
1175
|
-
|
|
1303
|
+
return /* @__PURE__ */ jsx8(Tooltip2, { title: `Componente clientSide '${clientSideName}' no implementado. Mostrando valor por defecto.`, children: /* @__PURE__ */ jsxs5(
|
|
1304
|
+
Box5,
|
|
1176
1305
|
{
|
|
1177
1306
|
sx: {
|
|
1178
1307
|
display: "flex",
|
|
@@ -1192,8 +1321,8 @@ var FallbackClientSideRenderer = ({ column, row, fieldDefinition }) => {
|
|
|
1192
1321
|
// Evita que el contenido se desborde
|
|
1193
1322
|
},
|
|
1194
1323
|
children: [
|
|
1195
|
-
/* @__PURE__ */
|
|
1196
|
-
/* @__PURE__ */
|
|
1324
|
+
/* @__PURE__ */ jsx8(Typography3, { variant: "body2", noWrap: true, sx: { flexGrow: 1 }, children: clientSideName + " not found" }),
|
|
1325
|
+
/* @__PURE__ */ jsx8(
|
|
1197
1326
|
WarningAmberIcon,
|
|
1198
1327
|
{
|
|
1199
1328
|
sx: {
|
|
@@ -1223,7 +1352,7 @@ var extendClientSides = (newRenderers) => {
|
|
|
1223
1352
|
};
|
|
1224
1353
|
|
|
1225
1354
|
// src/components/grid/renderers/cellRenderers.tsx
|
|
1226
|
-
import { jsx as
|
|
1355
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1227
1356
|
var allColumnsCellRenderer = (props) => {
|
|
1228
1357
|
const theme = useTheme();
|
|
1229
1358
|
const column = props.column;
|
|
@@ -1233,8 +1362,8 @@ var allColumnsCellRenderer = (props) => {
|
|
|
1233
1362
|
const detailColumn = column;
|
|
1234
1363
|
if (column.customType === "detail" && detailColumn.detailTable.abr === detailTableAbr) {
|
|
1235
1364
|
const { detailTable, fixedFields } = getDetailTableAndFixedFieldsForDetailTableAbr(detailColumn.tableDefinition, detailTableAbr, row);
|
|
1236
|
-
return /* @__PURE__ */
|
|
1237
|
-
|
|
1365
|
+
return /* @__PURE__ */ jsx9(
|
|
1366
|
+
Box6,
|
|
1238
1367
|
{
|
|
1239
1368
|
sx: {
|
|
1240
1369
|
// Se eliminó el padding para que la sub-grilla se extienda por completo
|
|
@@ -1249,7 +1378,7 @@ var allColumnsCellRenderer = (props) => {
|
|
|
1249
1378
|
onClick: (e) => e.stopPropagation(),
|
|
1250
1379
|
onKeyDown: (e) => e.stopPropagation(),
|
|
1251
1380
|
onDoubleClick: (e) => e.stopPropagation(),
|
|
1252
|
-
children: /* @__PURE__ */
|
|
1381
|
+
children: /* @__PURE__ */ jsx9(GenericDataGrid_default, { tableName: detailTable.table, fixedFields, gridStyles: { height: 322 } })
|
|
1253
1382
|
}
|
|
1254
1383
|
);
|
|
1255
1384
|
}
|
|
@@ -1265,9 +1394,9 @@ var allColumnsCellRenderer = (props) => {
|
|
|
1265
1394
|
if (fieldDef?.clientSide) {
|
|
1266
1395
|
const ClientSideComponent = clientSides[fieldDef.clientSide];
|
|
1267
1396
|
if (ClientSideComponent) {
|
|
1268
|
-
return /* @__PURE__ */
|
|
1397
|
+
return /* @__PURE__ */ jsx9(ClientSideComponent, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
|
|
1269
1398
|
}
|
|
1270
|
-
return /* @__PURE__ */
|
|
1399
|
+
return /* @__PURE__ */ jsx9(FallbackClientSideRenderer_default, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
|
|
1271
1400
|
}
|
|
1272
1401
|
let cellBackgroundColor = "transparent";
|
|
1273
1402
|
if (currentCellFeedback) {
|
|
@@ -1284,7 +1413,7 @@ var allColumnsCellRenderer = (props) => {
|
|
|
1284
1413
|
}
|
|
1285
1414
|
}
|
|
1286
1415
|
const value = row[props.column.key];
|
|
1287
|
-
return /* @__PURE__ */
|
|
1416
|
+
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
1417
|
}
|
|
1289
1418
|
case "detail": {
|
|
1290
1419
|
const detailColumn = column;
|
|
@@ -1292,7 +1421,7 @@ var allColumnsCellRenderer = (props) => {
|
|
|
1292
1421
|
const isExpanded = tableData.some(
|
|
1293
1422
|
(r) => r[DETAIL_ROW_INDICATOR] === detailTable.abr && getPrimaryKeyValues(r, primaryKey) === getPrimaryKeyValues({ ...row, [DETAIL_ROW_INDICATOR]: detailTable.abr }, primaryKey)
|
|
1294
1423
|
);
|
|
1295
|
-
return /* @__PURE__ */
|
|
1424
|
+
return /* @__PURE__ */ jsx9(Tooltip3, { title: detailTable.label, children: /* @__PURE__ */ jsx9(Box6, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%" }, children: /* @__PURE__ */ jsx9(
|
|
1296
1425
|
IconButton2,
|
|
1297
1426
|
{
|
|
1298
1427
|
onClick: (event) => {
|
|
@@ -1312,7 +1441,7 @@ var allColumnsCellRenderer = (props) => {
|
|
|
1312
1441
|
}
|
|
1313
1442
|
event.stopPropagation();
|
|
1314
1443
|
},
|
|
1315
|
-
children: isExpanded ? /* @__PURE__ */
|
|
1444
|
+
children: isExpanded ? /* @__PURE__ */ jsx9(KeyboardArrowUpIcon, { sx: { fontSize: 20 } }) : /* @__PURE__ */ jsx9(KeyboardArrowDownIcon, { sx: { fontSize: 20 } })
|
|
1316
1445
|
}
|
|
1317
1446
|
) }) });
|
|
1318
1447
|
}
|
|
@@ -1344,7 +1473,7 @@ var allColumnsCellRenderer = (props) => {
|
|
|
1344
1473
|
color: "primary"
|
|
1345
1474
|
}
|
|
1346
1475
|
];
|
|
1347
|
-
return /* @__PURE__ */
|
|
1476
|
+
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
1477
|
Button2,
|
|
1349
1478
|
{
|
|
1350
1479
|
variant: "outlined",
|
|
@@ -1353,7 +1482,7 @@ var allColumnsCellRenderer = (props) => {
|
|
|
1353
1482
|
onClick: () => actionDef.handler(row),
|
|
1354
1483
|
title: actionDef.title,
|
|
1355
1484
|
sx: { width: 22, minWidth: 22, height: 22, "& .MuiButton-startIcon": { m: 0 } },
|
|
1356
|
-
children: /* @__PURE__ */
|
|
1485
|
+
children: /* @__PURE__ */ jsx9(actionDef.icon, { sx: { fontSize: 18 } })
|
|
1357
1486
|
},
|
|
1358
1487
|
actionDef.action
|
|
1359
1488
|
) : null) });
|
|
@@ -1364,10 +1493,10 @@ var allColumnsCellRenderer = (props) => {
|
|
|
1364
1493
|
};
|
|
1365
1494
|
|
|
1366
1495
|
// src/components/grid/InputRenderer.tsx
|
|
1367
|
-
import { useCallback as useCallback3, useMemo, useState as
|
|
1496
|
+
import { useCallback as useCallback3, useMemo, useState as useState4 } from "react";
|
|
1368
1497
|
import InputBase2 from "@mui/material/InputBase";
|
|
1369
1498
|
import { useTheme as useTheme2 } from "@mui/material";
|
|
1370
|
-
import { jsx as
|
|
1499
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1371
1500
|
function findChangedValues(oldRowData, newRowData, isNewRow) {
|
|
1372
1501
|
let changes = [];
|
|
1373
1502
|
for (const key in newRowData) {
|
|
@@ -1395,7 +1524,7 @@ function InputRenderer({
|
|
|
1395
1524
|
primaryKey
|
|
1396
1525
|
}) {
|
|
1397
1526
|
const tableName = tableDefinition.tableName;
|
|
1398
|
-
const [editingValue, setEditingValue] =
|
|
1527
|
+
const [editingValue, setEditingValue] = useState4(row[column.key]);
|
|
1399
1528
|
const theme = useTheme2();
|
|
1400
1529
|
const { showSuccess, showError } = useSnackbar();
|
|
1401
1530
|
const cellKey = getCellKey(row, column.key, primaryKey);
|
|
@@ -1568,7 +1697,7 @@ function InputRenderer({
|
|
|
1568
1697
|
}, [handleCommit, editingValue]);
|
|
1569
1698
|
const fieldDefinition = tableDefinition.fields.find((f) => f.name === column.key);
|
|
1570
1699
|
const isFieldEditable = fieldDefinition?.editable !== false;
|
|
1571
|
-
return /* @__PURE__ */
|
|
1700
|
+
return /* @__PURE__ */ jsx10(
|
|
1572
1701
|
InputBase2,
|
|
1573
1702
|
{
|
|
1574
1703
|
value: editingValue === null ? "" : editingValue,
|
|
@@ -1595,8 +1724,8 @@ function InputRenderer({
|
|
|
1595
1724
|
var InputRenderer_default = InputRenderer;
|
|
1596
1725
|
|
|
1597
1726
|
// src/components/grid/renderers/editCellRenderers.tsx
|
|
1598
|
-
import { Box as
|
|
1599
|
-
import { jsx as
|
|
1727
|
+
import { Box as Box7, Tooltip as Tooltip4 } from "@mui/material";
|
|
1728
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1600
1729
|
var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
1601
1730
|
const column = props.column;
|
|
1602
1731
|
switch (column.customType) {
|
|
@@ -1627,7 +1756,7 @@ var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
|
1627
1756
|
const currentCellFeedback = cellFeedbackMap.get ? cellFeedbackMap.get(cellKey) : cellFeedbackMap[cellKey];
|
|
1628
1757
|
return (
|
|
1629
1758
|
// --- TOOLTIP ADAPTADO: Lee el mensaje de error desde el Mapa ---
|
|
1630
|
-
/* @__PURE__ */
|
|
1759
|
+
/* @__PURE__ */ jsx11(Tooltip4, { title: currentCellFeedback?.message || "", children: /* @__PURE__ */ jsx11(Box7, { children: /* @__PURE__ */ jsx11(
|
|
1631
1760
|
InputRenderer_default,
|
|
1632
1761
|
{
|
|
1633
1762
|
...props,
|
|
@@ -1657,9 +1786,9 @@ var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
|
1657
1786
|
};
|
|
1658
1787
|
|
|
1659
1788
|
// src/components/grid/renderers/emptyRowRenderer.tsx
|
|
1660
|
-
import { jsx as
|
|
1789
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1661
1790
|
function EmptyRowsRenderer() {
|
|
1662
|
-
return /* @__PURE__ */
|
|
1791
|
+
return /* @__PURE__ */ jsx12("div", { style: {
|
|
1663
1792
|
// Posicionamiento absoluto respecto a la pantalla
|
|
1664
1793
|
position: "fixed",
|
|
1665
1794
|
top: "50%",
|
|
@@ -1674,11 +1803,114 @@ function EmptyRowsRenderer() {
|
|
|
1674
1803
|
borderRadius: "4px",
|
|
1675
1804
|
padding: "16px 24px",
|
|
1676
1805
|
boxShadow: "0 2px 10px rgba(0,0,0,0.1)"
|
|
1677
|
-
}, children: /* @__PURE__ */
|
|
1806
|
+
}, children: /* @__PURE__ */ jsx12("div", { style: { textAlign: "center" }, children: "No hay filas para mostrar" }) });
|
|
1678
1807
|
}
|
|
1679
1808
|
|
|
1809
|
+
// src/components/grid/menu/options.tsx
|
|
1810
|
+
import RefreshIcon from "@mui/icons-material/Refresh";
|
|
1811
|
+
import ViewColumnIcon from "@mui/icons-material/ViewColumn";
|
|
1812
|
+
import VisibilityOffIcon from "@mui/icons-material/VisibilityOff";
|
|
1813
|
+
import FileDownloadIcon from "@mui/icons-material/FileDownload";
|
|
1814
|
+
import FileUploadIcon from "@mui/icons-material/FileUpload";
|
|
1815
|
+
import DeleteSweepIcon from "@mui/icons-material/DeleteSweep";
|
|
1816
|
+
import FilterAltIcon from "@mui/icons-material/FilterAlt";
|
|
1817
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1818
|
+
var buildMenuOptions = (params) => {
|
|
1819
|
+
const {
|
|
1820
|
+
tableDefinition,
|
|
1821
|
+
tableName,
|
|
1822
|
+
fixedFields,
|
|
1823
|
+
setTableData,
|
|
1824
|
+
callApi,
|
|
1825
|
+
showSuccess,
|
|
1826
|
+
showError,
|
|
1827
|
+
showWarning
|
|
1828
|
+
} = params;
|
|
1829
|
+
if (!tableDefinition) return [];
|
|
1830
|
+
const options = [];
|
|
1831
|
+
options.push({
|
|
1832
|
+
id: "refresh",
|
|
1833
|
+
label: "refrescar la grilla desde la base de datos",
|
|
1834
|
+
icon: /* @__PURE__ */ jsx13(RefreshIcon, {}),
|
|
1835
|
+
handler: async () => {
|
|
1836
|
+
try {
|
|
1837
|
+
const data = await callApi("table_data", {
|
|
1838
|
+
table: tableName,
|
|
1839
|
+
fixedFields
|
|
1840
|
+
});
|
|
1841
|
+
setTableData(data);
|
|
1842
|
+
showSuccess("Grilla refrescada correctamente");
|
|
1843
|
+
} catch (err) {
|
|
1844
|
+
showError(`Error al refrescar: ${err.message || "Error desconocido"}`);
|
|
1845
|
+
}
|
|
1846
|
+
},
|
|
1847
|
+
visible: true
|
|
1848
|
+
});
|
|
1849
|
+
options.push({
|
|
1850
|
+
id: "showColumns",
|
|
1851
|
+
label: "mostrar las columnas relacionadas",
|
|
1852
|
+
icon: /* @__PURE__ */ jsx13(ViewColumnIcon, {}),
|
|
1853
|
+
handler: async () => {
|
|
1854
|
+
console.log("Mostrar columnas relacionadas");
|
|
1855
|
+
},
|
|
1856
|
+
visible: true
|
|
1857
|
+
});
|
|
1858
|
+
options.push({
|
|
1859
|
+
id: "hideColumns",
|
|
1860
|
+
label: "ocultar o mostrar columnas",
|
|
1861
|
+
icon: /* @__PURE__ */ jsx13(VisibilityOffIcon, {}),
|
|
1862
|
+
handler: async () => {
|
|
1863
|
+
console.log("Ocultar/mostrar columnas");
|
|
1864
|
+
},
|
|
1865
|
+
visible: true
|
|
1866
|
+
});
|
|
1867
|
+
if (tableDefinition.allow?.export) {
|
|
1868
|
+
options.push({
|
|
1869
|
+
id: "export",
|
|
1870
|
+
label: "exportar",
|
|
1871
|
+
icon: /* @__PURE__ */ jsx13(FileDownloadIcon, {}),
|
|
1872
|
+
handler: async () => {
|
|
1873
|
+
console.log("Exportar datos");
|
|
1874
|
+
},
|
|
1875
|
+
visible: true
|
|
1876
|
+
});
|
|
1877
|
+
}
|
|
1878
|
+
if (tableDefinition.allow?.import) {
|
|
1879
|
+
options.push({
|
|
1880
|
+
id: "import",
|
|
1881
|
+
label: "importar",
|
|
1882
|
+
icon: /* @__PURE__ */ jsx13(FileUploadIcon, {}),
|
|
1883
|
+
handler: async () => {
|
|
1884
|
+
console.log("Importar datos");
|
|
1885
|
+
},
|
|
1886
|
+
visible: true
|
|
1887
|
+
});
|
|
1888
|
+
}
|
|
1889
|
+
if (tableDefinition.allow?.delete) {
|
|
1890
|
+
options.push({
|
|
1891
|
+
id: "deleteAll",
|
|
1892
|
+
label: "borrar todos los registros",
|
|
1893
|
+
icon: /* @__PURE__ */ jsx13(DeleteSweepIcon, {}),
|
|
1894
|
+
handler: async () => {
|
|
1895
|
+
showWarning("Esta operaci\xF3n eliminar\xE1 TODOS los registros de la tabla");
|
|
1896
|
+
},
|
|
1897
|
+
visible: true
|
|
1898
|
+
});
|
|
1899
|
+
}
|
|
1900
|
+
options.push({
|
|
1901
|
+
id: "completeTable",
|
|
1902
|
+
label: "tabla completa y filtrada",
|
|
1903
|
+
icon: /* @__PURE__ */ jsx13(FilterAltIcon, {}),
|
|
1904
|
+
handler: async () => {
|
|
1905
|
+
console.log("Toggle tabla completa/filtrada");
|
|
1906
|
+
},
|
|
1907
|
+
visible: true
|
|
1908
|
+
});
|
|
1909
|
+
return options;
|
|
1910
|
+
};
|
|
1911
|
+
|
|
1680
1912
|
// src/components/grid/GenericDataGrid.tsx
|
|
1681
|
-
import { jsx as
|
|
1913
|
+
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1682
1914
|
var NEW_ROW_INDICATOR = "$new";
|
|
1683
1915
|
var DETAIL_ROW_INDICATOR = "$detail";
|
|
1684
1916
|
var getPrimaryKeyValues = (row, primaryKey) => {
|
|
@@ -1699,18 +1931,20 @@ var GenericDataGrid = ({
|
|
|
1699
1931
|
gridStyles
|
|
1700
1932
|
}) => {
|
|
1701
1933
|
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] =
|
|
1934
|
+
const [tableDefinition, setTableDefinition] = useState5(null);
|
|
1935
|
+
const [tableData, setTableData] = useState5([]);
|
|
1936
|
+
const [isFilterRowVisible, setIsFilterRowVisible] = useState5(false);
|
|
1937
|
+
const [filters, setFilters] = useState5({});
|
|
1938
|
+
const [selectedRows, setSelectedRows] = useState5(() => /* @__PURE__ */ new Set());
|
|
1939
|
+
const [selectedCell, setSelectedCell] = useState5(void 0);
|
|
1940
|
+
const [cellFeedbackMap, setCellFeedbackMap] = useState5(/* @__PURE__ */ new Map());
|
|
1941
|
+
const [localCellChanges, setLocalCellChanges] = useState5(/* @__PURE__ */ new Map());
|
|
1710
1942
|
const theme = useTheme3();
|
|
1711
|
-
const [openConfirmDialog, setOpenConfirmDialog] =
|
|
1712
|
-
const [
|
|
1713
|
-
const [
|
|
1943
|
+
const [openConfirmDialog, setOpenConfirmDialog] = useState5(false);
|
|
1944
|
+
const [openDataGridOptions, setOpenDataGridOptions] = useState5(false);
|
|
1945
|
+
const [dataGridOptionsAnchorEl, setDataGridOptionsAnchorEl] = useState5(null);
|
|
1946
|
+
const [rowToDelete, setRowToDelete] = useState5(null);
|
|
1947
|
+
const [exitingRowIds, setExitingRowIds] = useState5(/* @__PURE__ */ new Set());
|
|
1714
1948
|
const { showSuccess, showError, showWarning, showInfo } = useSnackbar();
|
|
1715
1949
|
const feedbackTimerRef = useRef(null);
|
|
1716
1950
|
const dataGridRef = useRef(null);
|
|
@@ -2027,6 +2261,16 @@ var GenericDataGrid = ({
|
|
|
2027
2261
|
const handleSelectedCellChange = useCallback4((args) => {
|
|
2028
2262
|
setSelectedCell(args);
|
|
2029
2263
|
}, []);
|
|
2264
|
+
const menuOptions = useMemo2(() => buildMenuOptions({
|
|
2265
|
+
tableDefinition,
|
|
2266
|
+
tableName,
|
|
2267
|
+
fixedFields,
|
|
2268
|
+
setTableData,
|
|
2269
|
+
callApi,
|
|
2270
|
+
showSuccess,
|
|
2271
|
+
showError,
|
|
2272
|
+
showWarning
|
|
2273
|
+
}), [tableDefinition, tableName, fixedFields, setTableData, callApi, showSuccess, showError, showWarning]);
|
|
2030
2274
|
const columns = useMemo2(() => {
|
|
2031
2275
|
if (!tableDefinition) return [];
|
|
2032
2276
|
const fieldsToShow = tableDefinition.fields.filter((field) => {
|
|
@@ -2077,7 +2321,10 @@ var GenericDataGrid = ({
|
|
|
2077
2321
|
editable: false,
|
|
2078
2322
|
resizable: false,
|
|
2079
2323
|
sortable: false,
|
|
2080
|
-
renderHeaderCell: (props) => actionsColumnHeaderCellRenderer(props, isFilterRowVisible, toggleFilterVisibility)
|
|
2324
|
+
renderHeaderCell: (props) => actionsColumnHeaderCellRenderer(props, isFilterRowVisible, toggleFilterVisibility, (e) => {
|
|
2325
|
+
setDataGridOptionsAnchorEl(e.currentTarget);
|
|
2326
|
+
setOpenDataGridOptions(true);
|
|
2327
|
+
}),
|
|
2081
2328
|
renderSummaryCell: (props) => actionsColumnSummaryCellRenderer(props)
|
|
2082
2329
|
};
|
|
2083
2330
|
const detailColumns = [];
|
|
@@ -2181,20 +2428,20 @@ var GenericDataGrid = ({
|
|
|
2181
2428
|
console.log("Is editable:", isEditable);
|
|
2182
2429
|
}, [tableDefinition, fixedFields]);
|
|
2183
2430
|
if (loading) {
|
|
2184
|
-
return /* @__PURE__ */
|
|
2185
|
-
/* @__PURE__ */
|
|
2186
|
-
/* @__PURE__ */
|
|
2431
|
+
return /* @__PURE__ */ jsxs6(Box8, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: [
|
|
2432
|
+
/* @__PURE__ */ jsx14(CircularProgress2, {}),
|
|
2433
|
+
/* @__PURE__ */ jsx14(Typography5, { variant: "h6", sx: { ml: 2 }, children: "Cargando tabla..." })
|
|
2187
2434
|
] });
|
|
2188
2435
|
}
|
|
2189
2436
|
if (error) {
|
|
2190
|
-
return /* @__PURE__ */
|
|
2437
|
+
return /* @__PURE__ */ jsx14(Box8, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsx14(Alert, { severity: "error", children: error.message }) });
|
|
2191
2438
|
}
|
|
2192
2439
|
if (!tableDefinition) {
|
|
2193
|
-
return /* @__PURE__ */
|
|
2440
|
+
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
2441
|
}
|
|
2195
|
-
return /* @__PURE__ */
|
|
2196
|
-
/* @__PURE__ */
|
|
2197
|
-
|
|
2442
|
+
return /* @__PURE__ */ jsxs6(Box8, { sx: { pt: 2, display: "flex", flexDirection: "column", height: "100%", boxSizing: "border-box" }, children: [
|
|
2443
|
+
/* @__PURE__ */ jsx14(
|
|
2444
|
+
Box8,
|
|
2198
2445
|
{
|
|
2199
2446
|
sx: {
|
|
2200
2447
|
backgroundColor: theme.palette.primary.main,
|
|
@@ -2208,15 +2455,15 @@ var GenericDataGrid = ({
|
|
|
2208
2455
|
ml: 2,
|
|
2209
2456
|
mr: 2
|
|
2210
2457
|
},
|
|
2211
|
-
children: /* @__PURE__ */
|
|
2458
|
+
children: /* @__PURE__ */ jsxs6(Typography5, { variant: "subtitle2", component: "div", children: [
|
|
2212
2459
|
cambiarGuionesBajosPorEspacios(tableDefinition.title || tableDefinition.name),
|
|
2213
2460
|
" - ",
|
|
2214
2461
|
getFilteredRowCount() === getRowCount() ? `${getRowCount()} registros` : `${getFilteredRowCount()} (F)`
|
|
2215
2462
|
] })
|
|
2216
2463
|
}
|
|
2217
2464
|
),
|
|
2218
|
-
/* @__PURE__ */
|
|
2219
|
-
|
|
2465
|
+
/* @__PURE__ */ jsx14(
|
|
2466
|
+
Box8,
|
|
2220
2467
|
{
|
|
2221
2468
|
sx: {
|
|
2222
2469
|
flexGrow: 1,
|
|
@@ -2227,7 +2474,7 @@ var GenericDataGrid = ({
|
|
|
2227
2474
|
px: 2,
|
|
2228
2475
|
pb: 2
|
|
2229
2476
|
},
|
|
2230
|
-
children: /* @__PURE__ */
|
|
2477
|
+
children: /* @__PURE__ */ jsx14(
|
|
2231
2478
|
DataGrid,
|
|
2232
2479
|
{
|
|
2233
2480
|
className: "rdg-light",
|
|
@@ -2248,7 +2495,7 @@ var GenericDataGrid = ({
|
|
|
2248
2495
|
headerRowHeight: 30,
|
|
2249
2496
|
topSummaryRows: isFilterRowVisible ? [{ id: "filterRow" }] : void 0,
|
|
2250
2497
|
summaryRowHeight: isFilterRowVisible ? 30 : 0,
|
|
2251
|
-
renderers: { noRowsFallback: /* @__PURE__ */
|
|
2498
|
+
renderers: { noRowsFallback: /* @__PURE__ */ jsx14(EmptyRowsRenderer, {}) },
|
|
2252
2499
|
onCellMouseDown: handleCellMouseDown,
|
|
2253
2500
|
onCellDoubleClick: handlCellDoubleClick,
|
|
2254
2501
|
onCellClick: handleCellClick,
|
|
@@ -2257,7 +2504,7 @@ var GenericDataGrid = ({
|
|
|
2257
2504
|
)
|
|
2258
2505
|
}
|
|
2259
2506
|
),
|
|
2260
|
-
/* @__PURE__ */
|
|
2507
|
+
/* @__PURE__ */ jsx14(
|
|
2261
2508
|
ConfirmDialog,
|
|
2262
2509
|
{
|
|
2263
2510
|
open: openConfirmDialog,
|
|
@@ -2265,6 +2512,15 @@ var GenericDataGrid = ({
|
|
|
2265
2512
|
title: "Confirmar Eliminaci\xF3n",
|
|
2266
2513
|
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
2514
|
}
|
|
2515
|
+
),
|
|
2516
|
+
/* @__PURE__ */ jsx14(
|
|
2517
|
+
DataGridOptionsDialog,
|
|
2518
|
+
{
|
|
2519
|
+
open: openDataGridOptions,
|
|
2520
|
+
onClose: () => setOpenDataGridOptions(false),
|
|
2521
|
+
options: menuOptions,
|
|
2522
|
+
anchorEl: dataGridOptionsAnchorEl
|
|
2523
|
+
}
|
|
2268
2524
|
)
|
|
2269
2525
|
] });
|
|
2270
2526
|
};
|
|
@@ -2278,7 +2534,7 @@ import { BrowserRouter, Routes, Route, useLocation as useLocation4, Navigate as
|
|
|
2278
2534
|
import { useEffect as useEffect3 } from "react";
|
|
2279
2535
|
import { Outlet } from "react-router-dom";
|
|
2280
2536
|
import {
|
|
2281
|
-
Box as
|
|
2537
|
+
Box as Box11,
|
|
2282
2538
|
AppBar,
|
|
2283
2539
|
Toolbar,
|
|
2284
2540
|
Typography as Typography8,
|
|
@@ -2291,10 +2547,10 @@ import {
|
|
|
2291
2547
|
} from "@mui/material";
|
|
2292
2548
|
|
|
2293
2549
|
// src/contexts/AppContext.tsx
|
|
2294
|
-
import { createContext as createContext2, useContext as useContext2, useState as
|
|
2550
|
+
import { createContext as createContext2, useContext as useContext2, useState as useState6, useEffect as useEffect2, useCallback as useCallback5, useMemo as useMemo3 } from "react";
|
|
2295
2551
|
import { useNavigate } from "react-router-dom";
|
|
2296
2552
|
import { useSelector as useSelector2, useDispatch as useDispatch2 } from "react-redux";
|
|
2297
|
-
import { jsx as
|
|
2553
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
2298
2554
|
var AuthContext = createContext2(void 0);
|
|
2299
2555
|
var useApp = () => {
|
|
2300
2556
|
const context = useContext2(AuthContext);
|
|
@@ -2306,8 +2562,8 @@ var useApp = () => {
|
|
|
2306
2562
|
};
|
|
2307
2563
|
var AppProvider = ({ children }) => {
|
|
2308
2564
|
console.log("AppProvider rendered/re-rendered");
|
|
2309
|
-
const [isLoggedIn, setIsLoggedIn] =
|
|
2310
|
-
const [showSessionExpiredMessage, setShowSessionExpiredMessage] =
|
|
2565
|
+
const [isLoggedIn, setIsLoggedIn] = useState6(false);
|
|
2566
|
+
const [showSessionExpiredMessage, setShowSessionExpiredMessage] = useState6(false);
|
|
2311
2567
|
const dispatch = useDispatch2();
|
|
2312
2568
|
const clientContext = useSelector2((state) => state.clientContext);
|
|
2313
2569
|
const navigate = useNavigate();
|
|
@@ -2362,7 +2618,7 @@ var AppProvider = ({ children }) => {
|
|
|
2362
2618
|
showSessionExpiredMessage,
|
|
2363
2619
|
setShowSessionExpiredMessage
|
|
2364
2620
|
]);
|
|
2365
|
-
return /* @__PURE__ */
|
|
2621
|
+
return /* @__PURE__ */ jsx15(AuthContext.Provider, { value: authContextValue, children });
|
|
2366
2622
|
};
|
|
2367
2623
|
|
|
2368
2624
|
// src/components/MainLayout.tsx
|
|
@@ -2371,7 +2627,7 @@ import MenuIcon from "@mui/icons-material/Menu";
|
|
|
2371
2627
|
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
2372
2628
|
|
|
2373
2629
|
// src/components/SideMenu.tsx
|
|
2374
|
-
import { List, ListItem, ListItemButton, ListItemIcon, ListItemText, Divider, Box as
|
|
2630
|
+
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
2631
|
import ExpandLess from "@mui/icons-material/ExpandLess";
|
|
2376
2632
|
import ExpandMore from "@mui/icons-material/ExpandMore";
|
|
2377
2633
|
import TableChartIcon from "@mui/icons-material/TableChart";
|
|
@@ -2386,30 +2642,30 @@ import { useNavigate as useNavigate2, useLocation } from "react-router-dom";
|
|
|
2386
2642
|
import { blue, orange, teal, red, grey } from "@mui/material/colors";
|
|
2387
2643
|
|
|
2388
2644
|
// src/pages/WScreens.tsx
|
|
2389
|
-
import { Box as
|
|
2645
|
+
import { Box as Box9, Typography as Typography6, Paper as Paper2 } from "@mui/material";
|
|
2390
2646
|
import ConstructionIcon from "@mui/icons-material/Construction";
|
|
2391
2647
|
import WarningAmberIcon2 from "@mui/icons-material/WarningAmber";
|
|
2392
|
-
import { jsx as
|
|
2648
|
+
import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2393
2649
|
var MyCustomDashboard = ({ screenName }) => {
|
|
2394
|
-
return /* @__PURE__ */
|
|
2395
|
-
/* @__PURE__ */
|
|
2650
|
+
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: [
|
|
2651
|
+
/* @__PURE__ */ jsxs7(Typography6, { variant: "h5", component: "h1", gutterBottom: true, children: [
|
|
2396
2652
|
"\xA1Bienvenido a tu WScreen: ",
|
|
2397
2653
|
screenName,
|
|
2398
2654
|
"!"
|
|
2399
2655
|
] }),
|
|
2400
|
-
/* @__PURE__ */
|
|
2401
|
-
/* @__PURE__ */
|
|
2656
|
+
/* @__PURE__ */ jsx16(Typography6, { variant: "body1", color: "text.secondary", children: "Esta es una pantalla de interfaz de usuario personalizada." }),
|
|
2657
|
+
/* @__PURE__ */ jsx16(Box9, { sx: { mt: 3 }, children: /* @__PURE__ */ jsx16(ConstructionIcon, { sx: { fontSize: 80, color: "primary.main" } }) })
|
|
2402
2658
|
] }) });
|
|
2403
2659
|
};
|
|
2404
2660
|
var FallbackWScreen = ({ screenName }) => {
|
|
2405
|
-
return /* @__PURE__ */
|
|
2406
|
-
/* @__PURE__ */
|
|
2407
|
-
/* @__PURE__ */
|
|
2661
|
+
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: [
|
|
2662
|
+
/* @__PURE__ */ jsx16(Typography6, { variant: "h5", component: "h1", gutterBottom: true, color: "warning.dark", children: "WScreen No Implementada" }),
|
|
2663
|
+
/* @__PURE__ */ jsxs7(Typography6, { variant: "body1", color: "warning.dark", children: [
|
|
2408
2664
|
'No se encontr\xF3 un componente implementado para la **WScreen**: **`"$',
|
|
2409
2665
|
screenName,
|
|
2410
2666
|
'"`**. 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
2667
|
] }),
|
|
2412
|
-
/* @__PURE__ */
|
|
2668
|
+
/* @__PURE__ */ jsx16(Box9, { sx: { mt: 3 }, children: /* @__PURE__ */ jsx16(WarningAmberIcon2, { sx: { fontSize: 80, color: "warning.dark" } }) })
|
|
2413
2669
|
] }) });
|
|
2414
2670
|
};
|
|
2415
2671
|
var wScreens = {
|
|
@@ -2423,7 +2679,7 @@ var extendWScreens = (newWScreens) => {
|
|
|
2423
2679
|
};
|
|
2424
2680
|
|
|
2425
2681
|
// src/components/SideMenu.tsx
|
|
2426
|
-
import { Fragment, jsx as
|
|
2682
|
+
import { Fragment as Fragment2, jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2427
2683
|
var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
2428
2684
|
const navigate = useNavigate2();
|
|
2429
2685
|
const location = useLocation();
|
|
@@ -2464,17 +2720,17 @@ var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
|
2464
2720
|
const getIcon = (item2) => {
|
|
2465
2721
|
switch (item2.menuType) {
|
|
2466
2722
|
case "table":
|
|
2467
|
-
return /* @__PURE__ */
|
|
2723
|
+
return /* @__PURE__ */ jsx17(TableChartIcon, { sx: { color: blue[700] } });
|
|
2468
2724
|
case "proc":
|
|
2469
|
-
return /* @__PURE__ */
|
|
2725
|
+
return /* @__PURE__ */ jsx17(DnsIcon, { sx: { color: teal[700] } });
|
|
2470
2726
|
case "menu":
|
|
2471
|
-
return /* @__PURE__ */
|
|
2727
|
+
return /* @__PURE__ */ jsx17(FolderIcon, { sx: { color: orange[800] } });
|
|
2472
2728
|
default:
|
|
2473
2729
|
const WScreenComponent = wScreens[item2.menuType];
|
|
2474
2730
|
if (WScreenComponent !== void 0) {
|
|
2475
|
-
return /* @__PURE__ */
|
|
2731
|
+
return /* @__PURE__ */ jsx17(DesktopWindowsIcon, { sx: { color: grey[700] } });
|
|
2476
2732
|
}
|
|
2477
|
-
return /* @__PURE__ */
|
|
2733
|
+
return /* @__PURE__ */ jsx17(WarningAmberIcon3, { sx: { color: red[500] } });
|
|
2478
2734
|
}
|
|
2479
2735
|
};
|
|
2480
2736
|
const currentPath = location.pathname;
|
|
@@ -2486,21 +2742,21 @@ var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
|
2486
2742
|
} else {
|
|
2487
2743
|
isSelected = currentPath.startsWith(`/wScreens/${item.menuType}`) || currentPath.startsWith(`/wScreens-fallback/${item.menuType}`);
|
|
2488
2744
|
}
|
|
2489
|
-
return /* @__PURE__ */
|
|
2490
|
-
/* @__PURE__ */
|
|
2491
|
-
|
|
2745
|
+
return /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
2746
|
+
/* @__PURE__ */ jsxs8(
|
|
2747
|
+
ListItemButton2,
|
|
2492
2748
|
{
|
|
2493
2749
|
onClick: handleClick,
|
|
2494
2750
|
sx: { pl: level * 2 },
|
|
2495
2751
|
selected: isSelected,
|
|
2496
2752
|
children: [
|
|
2497
|
-
/* @__PURE__ */
|
|
2498
|
-
/* @__PURE__ */
|
|
2499
|
-
item.menuType === "menu" ? open ? /* @__PURE__ */
|
|
2753
|
+
/* @__PURE__ */ jsx17(ListItemIcon2, { sx: { minWidth: "38px" }, children: getIcon(item) }),
|
|
2754
|
+
/* @__PURE__ */ jsx17(ListItemText2, { primary: item.label || item.name }),
|
|
2755
|
+
item.menuType === "menu" ? open ? /* @__PURE__ */ jsx17(ExpandLess, {}) : /* @__PURE__ */ jsx17(ExpandMore, {}) : null
|
|
2500
2756
|
]
|
|
2501
2757
|
}
|
|
2502
2758
|
),
|
|
2503
|
-
item.menuType === "menu" && /* @__PURE__ */
|
|
2759
|
+
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
2760
|
MenuListItem,
|
|
2505
2761
|
{
|
|
2506
2762
|
item: subItem,
|
|
@@ -2530,22 +2786,22 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
2530
2786
|
dispatch(setAllSubMenusOpen(!isMostlyOpen));
|
|
2531
2787
|
};
|
|
2532
2788
|
if (!clientContext || !clientContext.menu) {
|
|
2533
|
-
return /* @__PURE__ */
|
|
2789
|
+
return /* @__PURE__ */ jsx17(Box10, { sx: { p: 2, textAlign: "center" }, children: /* @__PURE__ */ jsx17(Typography7, { variant: "body2", color: "text.secondary", children: "Cargando men\xFA..." }) });
|
|
2534
2790
|
}
|
|
2535
2791
|
const isHomeSelected = location.pathname === "/home";
|
|
2536
|
-
return /* @__PURE__ */
|
|
2537
|
-
clientContext.menu.some((item) => item.menuType === "menu") && /* @__PURE__ */
|
|
2538
|
-
/* @__PURE__ */
|
|
2539
|
-
/* @__PURE__ */
|
|
2792
|
+
return /* @__PURE__ */ jsxs8(Box10, { sx: { width: "100%", flexShrink: 0 }, children: [
|
|
2793
|
+
clientContext.menu.some((item) => item.menuType === "menu") && /* @__PURE__ */ jsx17(ListItem, { disablePadding: true, children: /* @__PURE__ */ jsxs8(ListItemButton2, { onClick: handleToggleAllSubMenus, children: [
|
|
2794
|
+
/* @__PURE__ */ jsx17(ListItemIcon2, { sx: { minWidth: "38px" }, children: isMostlyOpen ? /* @__PURE__ */ jsx17(UnfoldLessIcon, {}) : /* @__PURE__ */ jsx17(UnfoldMoreIcon, {}) }),
|
|
2795
|
+
/* @__PURE__ */ jsx17(ListItemText2, { primary: isMostlyOpen ? "colapsar " : "expandir" })
|
|
2540
2796
|
] }) }),
|
|
2541
|
-
/* @__PURE__ */
|
|
2542
|
-
/* @__PURE__ */
|
|
2543
|
-
/* @__PURE__ */
|
|
2544
|
-
/* @__PURE__ */
|
|
2545
|
-
/* @__PURE__ */
|
|
2797
|
+
/* @__PURE__ */ jsx17(Divider, {}),
|
|
2798
|
+
/* @__PURE__ */ jsxs8(List2, { children: [
|
|
2799
|
+
/* @__PURE__ */ jsx17(ListItem, { disablePadding: true, children: /* @__PURE__ */ jsxs8(ListItemButton2, { onClick: handleHomeClick, selected: isHomeSelected, children: [
|
|
2800
|
+
/* @__PURE__ */ jsx17(ListItemIcon2, { sx: { minWidth: "38px" }, children: /* @__PURE__ */ jsx17(HomeIcon, {}) }),
|
|
2801
|
+
/* @__PURE__ */ jsx17(ListItemText2, { primary: "Inicio" })
|
|
2546
2802
|
] }) }),
|
|
2547
|
-
/* @__PURE__ */
|
|
2548
|
-
clientContext.menu.map((menuItem) => /* @__PURE__ */
|
|
2803
|
+
/* @__PURE__ */ jsx17(Divider, {}),
|
|
2804
|
+
clientContext.menu.map((menuItem) => /* @__PURE__ */ jsx17(
|
|
2549
2805
|
MenuListItem,
|
|
2550
2806
|
{
|
|
2551
2807
|
item: menuItem,
|
|
@@ -2588,7 +2844,7 @@ var useLogout = () => {
|
|
|
2588
2844
|
var useLogout_default = useLogout;
|
|
2589
2845
|
|
|
2590
2846
|
// src/components/MainLayout.tsx
|
|
2591
|
-
import { jsx as
|
|
2847
|
+
import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2592
2848
|
var drawerWidth = 240;
|
|
2593
2849
|
var MainLayout = () => {
|
|
2594
2850
|
const { clientContext } = useApp();
|
|
@@ -2611,12 +2867,12 @@ var MainLayout = () => {
|
|
|
2611
2867
|
}
|
|
2612
2868
|
};
|
|
2613
2869
|
if (!clientContext) {
|
|
2614
|
-
return /* @__PURE__ */
|
|
2870
|
+
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
2871
|
}
|
|
2616
2872
|
const appBarOffset = theme.mixins.toolbar;
|
|
2617
|
-
return /* @__PURE__ */
|
|
2618
|
-
/* @__PURE__ */
|
|
2619
|
-
/* @__PURE__ */
|
|
2873
|
+
return /* @__PURE__ */ jsxs9(Box11, { sx: { display: "flex", height: "100vh" }, children: [
|
|
2874
|
+
/* @__PURE__ */ jsx18(CssBaseline, {}),
|
|
2875
|
+
/* @__PURE__ */ jsx18(
|
|
2620
2876
|
AppBar,
|
|
2621
2877
|
{
|
|
2622
2878
|
position: "fixed",
|
|
@@ -2635,8 +2891,8 @@ var MainLayout = () => {
|
|
|
2635
2891
|
})
|
|
2636
2892
|
}
|
|
2637
2893
|
},
|
|
2638
|
-
children: /* @__PURE__ */
|
|
2639
|
-
/* @__PURE__ */
|
|
2894
|
+
children: /* @__PURE__ */ jsxs9(Toolbar, { children: [
|
|
2895
|
+
/* @__PURE__ */ jsx18(
|
|
2640
2896
|
IconButton3,
|
|
2641
2897
|
{
|
|
2642
2898
|
color: "inherit",
|
|
@@ -2646,24 +2902,24 @@ var MainLayout = () => {
|
|
|
2646
2902
|
sx: {
|
|
2647
2903
|
marginRight: 2.2
|
|
2648
2904
|
},
|
|
2649
|
-
children: isDrawerOpen ? /* @__PURE__ */
|
|
2905
|
+
children: isDrawerOpen ? /* @__PURE__ */ jsx18(ChevronLeftIcon, {}) : /* @__PURE__ */ jsx18(MenuIcon, {})
|
|
2650
2906
|
}
|
|
2651
2907
|
),
|
|
2652
|
-
/* @__PURE__ */
|
|
2653
|
-
/* @__PURE__ */
|
|
2654
|
-
/* @__PURE__ */
|
|
2908
|
+
/* @__PURE__ */ jsx18(Typography8, { variant: "h6", noWrap: true, component: "div", sx: { flexGrow: 1 }, children: isDrawerOpen ? "" : clientContext.config.title }),
|
|
2909
|
+
/* @__PURE__ */ jsx18(Typography8, { variant: "subtitle1", component: "div", sx: { mr: 2 }, children: clientContext.username }),
|
|
2910
|
+
/* @__PURE__ */ jsx18(
|
|
2655
2911
|
Button4,
|
|
2656
2912
|
{
|
|
2657
2913
|
color: "inherit",
|
|
2658
2914
|
onClick: logout,
|
|
2659
|
-
startIcon: /* @__PURE__ */
|
|
2915
|
+
startIcon: /* @__PURE__ */ jsx18(LogoutIcon, {}),
|
|
2660
2916
|
children: "Salir"
|
|
2661
2917
|
}
|
|
2662
2918
|
)
|
|
2663
2919
|
] })
|
|
2664
2920
|
}
|
|
2665
2921
|
),
|
|
2666
|
-
/* @__PURE__ */
|
|
2922
|
+
/* @__PURE__ */ jsxs9(
|
|
2667
2923
|
Drawer,
|
|
2668
2924
|
{
|
|
2669
2925
|
variant: "persistent",
|
|
@@ -2680,7 +2936,7 @@ var MainLayout = () => {
|
|
|
2680
2936
|
}
|
|
2681
2937
|
},
|
|
2682
2938
|
children: [
|
|
2683
|
-
/* @__PURE__ */
|
|
2939
|
+
/* @__PURE__ */ jsx18(
|
|
2684
2940
|
Toolbar,
|
|
2685
2941
|
{
|
|
2686
2942
|
sx: {
|
|
@@ -2694,12 +2950,12 @@ var MainLayout = () => {
|
|
|
2694
2950
|
children: isDrawerOpen ? clientContext.config.title : ""
|
|
2695
2951
|
}
|
|
2696
2952
|
),
|
|
2697
|
-
/* @__PURE__ */
|
|
2953
|
+
/* @__PURE__ */ jsx18(SideMenu_default, { onMenuItemClick: handleDrawerCloseMobile })
|
|
2698
2954
|
]
|
|
2699
2955
|
}
|
|
2700
2956
|
),
|
|
2701
|
-
/* @__PURE__ */
|
|
2702
|
-
|
|
2957
|
+
/* @__PURE__ */ jsx18(
|
|
2958
|
+
Box11,
|
|
2703
2959
|
{
|
|
2704
2960
|
component: "main",
|
|
2705
2961
|
sx: {
|
|
@@ -2726,7 +2982,7 @@ var MainLayout = () => {
|
|
|
2726
2982
|
flexDirection: "column",
|
|
2727
2983
|
width: isDrawerOpen ? `calc(100% - ${drawerWidth}px)` : "100%"
|
|
2728
2984
|
},
|
|
2729
|
-
children: /* @__PURE__ */
|
|
2985
|
+
children: /* @__PURE__ */ jsx18(Outlet, {})
|
|
2730
2986
|
}
|
|
2731
2987
|
)
|
|
2732
2988
|
] });
|
|
@@ -2734,9 +2990,9 @@ var MainLayout = () => {
|
|
|
2734
2990
|
var MainLayout_default = MainLayout;
|
|
2735
2991
|
|
|
2736
2992
|
// src/components/SessionExpiredMessage.tsx
|
|
2737
|
-
import { Box as
|
|
2993
|
+
import { Box as Box12, Typography as Typography9, Button as Button5, Modal } from "@mui/material";
|
|
2738
2994
|
import { useNavigate as useNavigate4 } from "react-router-dom";
|
|
2739
|
-
import { jsx as
|
|
2995
|
+
import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2740
2996
|
var style = {
|
|
2741
2997
|
position: "absolute",
|
|
2742
2998
|
top: "50%",
|
|
@@ -2758,7 +3014,7 @@ var SessionExpiredMessage = () => {
|
|
|
2758
3014
|
setIsLoggedIn(false);
|
|
2759
3015
|
navigate("/login", { replace: true });
|
|
2760
3016
|
};
|
|
2761
|
-
return /* @__PURE__ */
|
|
3017
|
+
return /* @__PURE__ */ jsx19(
|
|
2762
3018
|
Modal,
|
|
2763
3019
|
{
|
|
2764
3020
|
open: showSessionExpiredMessage,
|
|
@@ -2778,10 +3034,10 @@ var SessionExpiredMessage = () => {
|
|
|
2778
3034
|
}
|
|
2779
3035
|
}
|
|
2780
3036
|
},
|
|
2781
|
-
children: /* @__PURE__ */
|
|
2782
|
-
/* @__PURE__ */
|
|
2783
|
-
/* @__PURE__ */
|
|
2784
|
-
/* @__PURE__ */
|
|
3037
|
+
children: /* @__PURE__ */ jsxs10(Box12, { sx: style, children: [
|
|
3038
|
+
/* @__PURE__ */ jsx19(Typography9, { id: "session-expired-modal-title", variant: "h6", component: "h2", gutterBottom: true, children: "\xA1Sesi\xF3n Expirada!" }),
|
|
3039
|
+
/* @__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." }),
|
|
3040
|
+
/* @__PURE__ */ jsx19(Button5, { variant: "contained", color: "primary", onClick: handleClose, children: "Ir al Login" })
|
|
2785
3041
|
] })
|
|
2786
3042
|
}
|
|
2787
3043
|
);
|
|
@@ -2789,27 +3045,27 @@ var SessionExpiredMessage = () => {
|
|
|
2789
3045
|
var SessionExpiredMessage_default = SessionExpiredMessage;
|
|
2790
3046
|
|
|
2791
3047
|
// src/pages/HomePage.tsx
|
|
2792
|
-
import { Box as
|
|
2793
|
-
import { jsx as
|
|
3048
|
+
import { Box as Box13, Typography as Typography10 } from "@mui/material";
|
|
3049
|
+
import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2794
3050
|
var HomePage = () => {
|
|
2795
3051
|
const { clientContext } = useApp();
|
|
2796
|
-
return /* @__PURE__ */
|
|
2797
|
-
/* @__PURE__ */
|
|
2798
|
-
/* @__PURE__ */
|
|
3052
|
+
return /* @__PURE__ */ jsxs11(Box13, { sx: { p: 3 }, children: [
|
|
3053
|
+
/* @__PURE__ */ jsx20(Typography10, { variant: "h4", component: "h1", gutterBottom: true, children: `Bienvenido/a ${clientContext?.username}` }),
|
|
3054
|
+
/* @__PURE__ */ jsx20(Typography10, { variant: "body1", children: "Usa el men\xFA lateral para navegar por las diferentes secciones." })
|
|
2799
3055
|
] });
|
|
2800
3056
|
};
|
|
2801
3057
|
var HomePage_default = HomePage;
|
|
2802
3058
|
|
|
2803
3059
|
// src/pages/LogoutPage.tsx
|
|
2804
3060
|
import { useEffect as useEffect4 } from "react";
|
|
2805
|
-
import { Box as
|
|
2806
|
-
import { jsx as
|
|
3061
|
+
import { Box as Box14, Typography as Typography11, CircularProgress as CircularProgress3 } from "@mui/material";
|
|
3062
|
+
import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2807
3063
|
var LogoutPage = () => {
|
|
2808
3064
|
const logout = useLogout_default();
|
|
2809
3065
|
useEffect4(() => {
|
|
2810
3066
|
logout();
|
|
2811
3067
|
}, [logout]);
|
|
2812
|
-
return /* @__PURE__ */
|
|
3068
|
+
return /* @__PURE__ */ jsxs12(Box14, { sx: {
|
|
2813
3069
|
display: "flex",
|
|
2814
3070
|
flexDirection: "column",
|
|
2815
3071
|
justifyContent: "center",
|
|
@@ -2817,21 +3073,21 @@ var LogoutPage = () => {
|
|
|
2817
3073
|
height: "100vh",
|
|
2818
3074
|
textAlign: "center"
|
|
2819
3075
|
}, children: [
|
|
2820
|
-
/* @__PURE__ */
|
|
2821
|
-
/* @__PURE__ */
|
|
3076
|
+
/* @__PURE__ */ jsx21(CircularProgress3, { size: 60 }),
|
|
3077
|
+
/* @__PURE__ */ jsx21(Typography11, { variant: "h6", sx: { mt: 2 }, children: "Cerrando sesi\xF3n..." })
|
|
2822
3078
|
] });
|
|
2823
3079
|
};
|
|
2824
3080
|
var LogoutPage_default = LogoutPage;
|
|
2825
3081
|
|
|
2826
3082
|
// src/pages/LoginPage.tsx
|
|
2827
|
-
import { useState as
|
|
2828
|
-
import { Button as Button6, TextField, Typography as Typography12, Alert as Alert2, AlertTitle, Box as
|
|
3083
|
+
import { useState as useState7 } from "react";
|
|
3084
|
+
import { Button as Button6, TextField, Typography as Typography12, Alert as Alert2, AlertTitle, Box as Box15, CircularProgress as CircularProgress4 } from "@mui/material";
|
|
2829
3085
|
import { useForm, Controller } from "react-hook-form";
|
|
2830
3086
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
2831
3087
|
import * as z from "zod";
|
|
2832
3088
|
import { useNavigate as useNavigate5 } from "react-router-dom";
|
|
2833
3089
|
import { useDispatch as useDispatch4 } from "react-redux";
|
|
2834
|
-
import { Fragment as
|
|
3090
|
+
import { Fragment as Fragment3, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2835
3091
|
var loginSchema = z.object({
|
|
2836
3092
|
username: z.string().min(1, "El usuario es requerido"),
|
|
2837
3093
|
// Añadir validación básica
|
|
@@ -2840,8 +3096,8 @@ var loginSchema = z.object({
|
|
|
2840
3096
|
});
|
|
2841
3097
|
var LoginPage = () => {
|
|
2842
3098
|
const navigate = useNavigate5();
|
|
2843
|
-
const [loginError, setLoginError] =
|
|
2844
|
-
const [isSubmitting, setIsSubmitting] =
|
|
3099
|
+
const [loginError, setLoginError] = useState7(null);
|
|
3100
|
+
const [isSubmitting, setIsSubmitting] = useState7(false);
|
|
2845
3101
|
const { setIsLoggedIn, checkSession } = useApp();
|
|
2846
3102
|
const dispatch = useDispatch4();
|
|
2847
3103
|
const {
|
|
@@ -2887,16 +3143,16 @@ var LoginPage = () => {
|
|
|
2887
3143
|
setIsSubmitting(false);
|
|
2888
3144
|
}
|
|
2889
3145
|
};
|
|
2890
|
-
return /* @__PURE__ */
|
|
2891
|
-
|
|
3146
|
+
return /* @__PURE__ */ jsx22(
|
|
3147
|
+
Box15,
|
|
2892
3148
|
{
|
|
2893
3149
|
display: "flex",
|
|
2894
3150
|
alignItems: "center",
|
|
2895
3151
|
justifyContent: "center",
|
|
2896
3152
|
minHeight: "100vh",
|
|
2897
3153
|
bgcolor: "#f5f5f5",
|
|
2898
|
-
children: /* @__PURE__ */
|
|
2899
|
-
|
|
3154
|
+
children: /* @__PURE__ */ jsxs13(
|
|
3155
|
+
Box15,
|
|
2900
3156
|
{
|
|
2901
3157
|
width: "100%",
|
|
2902
3158
|
maxWidth: "400px",
|
|
@@ -2905,16 +3161,16 @@ var LoginPage = () => {
|
|
|
2905
3161
|
borderRadius: 8,
|
|
2906
3162
|
boxShadow: 3,
|
|
2907
3163
|
children: [
|
|
2908
|
-
/* @__PURE__ */
|
|
2909
|
-
/* @__PURE__ */
|
|
2910
|
-
/* @__PURE__ */
|
|
2911
|
-
/* @__PURE__ */
|
|
2912
|
-
/* @__PURE__ */
|
|
3164
|
+
/* @__PURE__ */ jsx22(Typography12, { variant: "h5", align: "center", gutterBottom: true, children: "Iniciar Sesi\xF3n" }),
|
|
3165
|
+
/* @__PURE__ */ jsxs13("form", { onSubmit: handleSubmit(onSubmit), className: "space-y-4", children: [
|
|
3166
|
+
/* @__PURE__ */ jsxs13("div", { children: [
|
|
3167
|
+
/* @__PURE__ */ jsx22("label", { htmlFor: "username", children: /* @__PURE__ */ jsx22(Typography12, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Usuario" }) }),
|
|
3168
|
+
/* @__PURE__ */ jsx22(
|
|
2913
3169
|
Controller,
|
|
2914
3170
|
{
|
|
2915
3171
|
name: "username",
|
|
2916
3172
|
control,
|
|
2917
|
-
render: ({ field }) => /* @__PURE__ */
|
|
3173
|
+
render: ({ field }) => /* @__PURE__ */ jsx22(
|
|
2918
3174
|
TextField,
|
|
2919
3175
|
{
|
|
2920
3176
|
...field,
|
|
@@ -2930,14 +3186,14 @@ var LoginPage = () => {
|
|
|
2930
3186
|
}
|
|
2931
3187
|
)
|
|
2932
3188
|
] }),
|
|
2933
|
-
/* @__PURE__ */
|
|
2934
|
-
/* @__PURE__ */
|
|
2935
|
-
/* @__PURE__ */
|
|
3189
|
+
/* @__PURE__ */ jsxs13("div", { children: [
|
|
3190
|
+
/* @__PURE__ */ jsx22("label", { htmlFor: "password", children: /* @__PURE__ */ jsx22(Typography12, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Contrase\xF1a" }) }),
|
|
3191
|
+
/* @__PURE__ */ jsx22(
|
|
2936
3192
|
Controller,
|
|
2937
3193
|
{
|
|
2938
3194
|
name: "password",
|
|
2939
3195
|
control,
|
|
2940
|
-
render: ({ field }) => /* @__PURE__ */
|
|
3196
|
+
render: ({ field }) => /* @__PURE__ */ jsx22(
|
|
2941
3197
|
TextField,
|
|
2942
3198
|
{
|
|
2943
3199
|
...field,
|
|
@@ -2953,14 +3209,14 @@ var LoginPage = () => {
|
|
|
2953
3209
|
}
|
|
2954
3210
|
)
|
|
2955
3211
|
] }),
|
|
2956
|
-
/* @__PURE__ */
|
|
2957
|
-
/* @__PURE__ */
|
|
3212
|
+
/* @__PURE__ */ jsx22(Button6, { type: "submit", fullWidth: true, variant: "contained", color: "primary", disabled: isSubmitting, sx: { mt: 2 }, children: isSubmitting ? /* @__PURE__ */ jsxs13(Fragment3, { children: [
|
|
3213
|
+
/* @__PURE__ */ jsx22(CircularProgress4, { size: 20, sx: { mr: 1 } }),
|
|
2958
3214
|
"Iniciando sesi\xF3n..."
|
|
2959
3215
|
] }) : "Iniciar Sesi\xF3n" })
|
|
2960
3216
|
] }),
|
|
2961
|
-
loginError && /* @__PURE__ */
|
|
3217
|
+
loginError && /* @__PURE__ */ jsxs13(Alert2, { severity: "error", sx: { mt: 2, maxHeight: "200px" }, children: [
|
|
2962
3218
|
" ",
|
|
2963
|
-
/* @__PURE__ */
|
|
3219
|
+
/* @__PURE__ */ jsx22(AlertTitle, { children: "Error" }),
|
|
2964
3220
|
loginError
|
|
2965
3221
|
] })
|
|
2966
3222
|
]
|
|
@@ -2972,7 +3228,7 @@ var LoginPage = () => {
|
|
|
2972
3228
|
var LoginPage_default = LoginPage;
|
|
2973
3229
|
|
|
2974
3230
|
// src/components/ProcedureForm.tsx
|
|
2975
|
-
import React7, { useState as
|
|
3231
|
+
import React7, { useState as useState8, useCallback as useCallback7, useMemo as useMemo4 } from "react";
|
|
2976
3232
|
import { useParams } from "react-router-dom";
|
|
2977
3233
|
import {
|
|
2978
3234
|
TextField as TextField2,
|
|
@@ -2985,22 +3241,22 @@ import {
|
|
|
2985
3241
|
FormControlLabel,
|
|
2986
3242
|
FormHelperText,
|
|
2987
3243
|
Typography as Typography14,
|
|
2988
|
-
Box as
|
|
2989
|
-
CircularProgress as
|
|
3244
|
+
Box as Box17,
|
|
3245
|
+
CircularProgress as CircularProgress5,
|
|
2990
3246
|
Alert as Alert3,
|
|
2991
3247
|
Divider as Divider2,
|
|
2992
|
-
Paper as
|
|
3248
|
+
Paper as Paper4
|
|
2993
3249
|
} from "@mui/material";
|
|
2994
3250
|
|
|
2995
3251
|
// src/pages/procedure-results/SuccessDisplay.tsx
|
|
2996
|
-
import { Box as
|
|
2997
|
-
import { jsx as
|
|
3252
|
+
import { Box as Box16, Typography as Typography13, Paper as Paper3 } from "@mui/material";
|
|
3253
|
+
import { jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2998
3254
|
var SuccessDisplay = ({ data }) => {
|
|
2999
|
-
return /* @__PURE__ */
|
|
3000
|
-
/* @__PURE__ */
|
|
3001
|
-
/* @__PURE__ */
|
|
3002
|
-
/* @__PURE__ */
|
|
3003
|
-
/* @__PURE__ */
|
|
3255
|
+
return /* @__PURE__ */ jsxs14(Paper3, { elevation: 2, sx: { p: 2, mt: 2, bgcolor: "success.light", color: "success.contrastText" }, children: [
|
|
3256
|
+
/* @__PURE__ */ jsx23(Typography13, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: "\xA1Operaci\xF3n Exitosa!" }),
|
|
3257
|
+
/* @__PURE__ */ jsx23(Typography13, { variant: "body2", sx: { fontSize: "0.85rem" }, children: "Detalles del resultado:" }),
|
|
3258
|
+
/* @__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) }) }),
|
|
3259
|
+
/* @__PURE__ */ jsx23(Typography13, { variant: "body2", sx: { fontSize: "0.8rem", mt: 1 }, children: "Puedes revisar los detalles anteriores o cerrar este mensaje." })
|
|
3004
3260
|
] });
|
|
3005
3261
|
};
|
|
3006
3262
|
var SuccessDisplay_default = SuccessDisplay;
|
|
@@ -3014,22 +3270,22 @@ var extendResultsOk = (newComponents) => {
|
|
|
3014
3270
|
};
|
|
3015
3271
|
|
|
3016
3272
|
// src/components/ProcedureForm.tsx
|
|
3017
|
-
import { jsx as
|
|
3273
|
+
import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3018
3274
|
var ProcedureForm = () => {
|
|
3019
3275
|
const { procedureName } = useParams();
|
|
3020
3276
|
const { clientContext } = useApp();
|
|
3021
3277
|
const { callApi, loading: apiLoading, error: apiError } = useApiCall();
|
|
3022
|
-
const [validationErrors, setValidationErrors] =
|
|
3023
|
-
const [successMessage, setSuccessMessage] =
|
|
3024
|
-
const [executionLog, setExecutionLog] =
|
|
3025
|
-
const [procedureResultData, setProcedureResultData] =
|
|
3278
|
+
const [validationErrors, setValidationErrors] = useState8({});
|
|
3279
|
+
const [successMessage, setSuccessMessage] = useState8(null);
|
|
3280
|
+
const [executionLog, setExecutionLog] = useState8([]);
|
|
3281
|
+
const [procedureResultData, setProcedureResultData] = useState8(null);
|
|
3026
3282
|
const procedure = useMemo4(() => {
|
|
3027
3283
|
if (procedureName && clientContext?.procedure) {
|
|
3028
3284
|
return clientContext.procedure[procedureName];
|
|
3029
3285
|
}
|
|
3030
3286
|
return void 0;
|
|
3031
3287
|
}, [procedureName, clientContext]);
|
|
3032
|
-
const [formValues, setFormValues] =
|
|
3288
|
+
const [formValues, setFormValues] = useState8(() => {
|
|
3033
3289
|
if (!procedure) return {};
|
|
3034
3290
|
const initialValues = {};
|
|
3035
3291
|
procedure.parameters.forEach((param) => {
|
|
@@ -3229,9 +3485,9 @@ var ProcedureForm = () => {
|
|
|
3229
3485
|
sx: { fontSize: "0.8rem" }
|
|
3230
3486
|
};
|
|
3231
3487
|
if (param.options && param.options.length > 0) {
|
|
3232
|
-
return /* @__PURE__ */
|
|
3233
|
-
/* @__PURE__ */
|
|
3234
|
-
/* @__PURE__ */
|
|
3488
|
+
return /* @__PURE__ */ jsxs15(FormControl, { fullWidth: true, margin: "dense", size: "small", error: hasError, required: commonProps.required, children: [
|
|
3489
|
+
/* @__PURE__ */ jsx24(InputLabel, { id: `${param.name}-label`, sx: { fontSize: "0.8rem" }, children: param.label || param.name }),
|
|
3490
|
+
/* @__PURE__ */ jsxs15(
|
|
3235
3491
|
Select,
|
|
3236
3492
|
{
|
|
3237
3493
|
labelId: `${param.name}-label`,
|
|
@@ -3242,14 +3498,14 @@ var ProcedureForm = () => {
|
|
|
3242
3498
|
label: param.label || param.name,
|
|
3243
3499
|
disabled: apiLoading,
|
|
3244
3500
|
sx: { fontSize: "0.8rem" },
|
|
3245
|
-
renderValue: (selected) => /* @__PURE__ */
|
|
3501
|
+
renderValue: (selected) => /* @__PURE__ */ jsx24(Typography14, { sx: { fontSize: "0.8rem" }, children: selected }),
|
|
3246
3502
|
children: [
|
|
3247
|
-
(!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */
|
|
3248
|
-
param.options.map((option) => /* @__PURE__ */
|
|
3503
|
+
(!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */ jsx24(MenuItem, { value: "", sx: { fontSize: "0.8rem" }, children: /* @__PURE__ */ jsx24("em", { children: "Seleccione..." }) }),
|
|
3504
|
+
param.options.map((option) => /* @__PURE__ */ jsx24(MenuItem, { value: option, sx: { fontSize: "0.8rem" }, children: option }, option))
|
|
3249
3505
|
]
|
|
3250
3506
|
}
|
|
3251
3507
|
),
|
|
3252
|
-
(param.description || errorMessage) && /* @__PURE__ */
|
|
3508
|
+
(param.description || errorMessage) && /* @__PURE__ */ jsx24(FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
|
|
3253
3509
|
] });
|
|
3254
3510
|
}
|
|
3255
3511
|
switch (param.typeName) {
|
|
@@ -3258,18 +3514,18 @@ var ProcedureForm = () => {
|
|
|
3258
3514
|
case "tsrange":
|
|
3259
3515
|
case "time_range":
|
|
3260
3516
|
case "daterange":
|
|
3261
|
-
return /* @__PURE__ */
|
|
3517
|
+
return /* @__PURE__ */ jsx24(TextField2, { type: "text", value: formValues[param.name] || "", ...commonProps });
|
|
3262
3518
|
case "decimal":
|
|
3263
3519
|
case "double":
|
|
3264
|
-
return /* @__PURE__ */
|
|
3520
|
+
return /* @__PURE__ */ jsx24(TextField2, { type: "number", inputProps: { step: "any", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
|
|
3265
3521
|
case "integer":
|
|
3266
3522
|
case "bigint":
|
|
3267
|
-
return /* @__PURE__ */
|
|
3523
|
+
return /* @__PURE__ */ jsx24(TextField2, { type: "number", inputProps: { step: "1", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
|
|
3268
3524
|
case "boolean":
|
|
3269
|
-
return /* @__PURE__ */
|
|
3525
|
+
return /* @__PURE__ */ jsx24(
|
|
3270
3526
|
FormControlLabel,
|
|
3271
3527
|
{
|
|
3272
|
-
control: /* @__PURE__ */
|
|
3528
|
+
control: /* @__PURE__ */ jsx24(
|
|
3273
3529
|
Checkbox,
|
|
3274
3530
|
{
|
|
3275
3531
|
checked: !!formValues[param.name],
|
|
@@ -3280,21 +3536,21 @@ var ProcedureForm = () => {
|
|
|
3280
3536
|
size: "small"
|
|
3281
3537
|
}
|
|
3282
3538
|
),
|
|
3283
|
-
label: /* @__PURE__ */
|
|
3539
|
+
label: /* @__PURE__ */ jsx24(Typography14, { sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "inherit" }, children: param.label || param.name }),
|
|
3284
3540
|
sx: { mt: 1, mb: 0 }
|
|
3285
3541
|
}
|
|
3286
3542
|
);
|
|
3287
3543
|
case "date":
|
|
3288
3544
|
case "timestamp":
|
|
3289
3545
|
case "time":
|
|
3290
|
-
return /* @__PURE__ */
|
|
3546
|
+
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
3547
|
case "jsonb":
|
|
3292
3548
|
case "jsona":
|
|
3293
|
-
return /* @__PURE__ */
|
|
3549
|
+
return /* @__PURE__ */ jsx24(TextField2, { multiline: true, rows: 5, value: formValues[param.name] || "", ...commonProps, InputProps: { sx: { fontSize: "0.8rem" } } });
|
|
3294
3550
|
case "bytea":
|
|
3295
|
-
return /* @__PURE__ */
|
|
3296
|
-
/* @__PURE__ */
|
|
3297
|
-
/* @__PURE__ */
|
|
3551
|
+
return /* @__PURE__ */ jsxs15(FormControl, { fullWidth: true, margin: "dense", error: hasError, required: commonProps.required, children: [
|
|
3552
|
+
/* @__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 }),
|
|
3553
|
+
/* @__PURE__ */ jsx24(
|
|
3298
3554
|
"input",
|
|
3299
3555
|
{
|
|
3300
3556
|
type: "file",
|
|
@@ -3308,34 +3564,34 @@ var ProcedureForm = () => {
|
|
|
3308
3564
|
style: { padding: "6px 0", fontSize: "0.8rem" }
|
|
3309
3565
|
}
|
|
3310
3566
|
),
|
|
3311
|
-
(param.description || errorMessage) && /* @__PURE__ */
|
|
3567
|
+
(param.description || errorMessage) && /* @__PURE__ */ jsx24(FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
|
|
3312
3568
|
] });
|
|
3313
3569
|
default:
|
|
3314
|
-
return /* @__PURE__ */
|
|
3570
|
+
return /* @__PURE__ */ jsx24(TextField2, { type: "text", value: formValues[param.name] || "", ...commonProps });
|
|
3315
3571
|
}
|
|
3316
3572
|
}, [formValues, handleChange, apiLoading, validationErrors]);
|
|
3317
3573
|
const ResultDisplayContent = useMemo4(() => {
|
|
3318
3574
|
if (!procedureResultData || !procedure?.resultOk) return null;
|
|
3319
3575
|
const ComponentToRender = resultsOk[procedure.resultOk];
|
|
3320
3576
|
if (ComponentToRender) {
|
|
3321
|
-
return /* @__PURE__ */
|
|
3577
|
+
return /* @__PURE__ */ jsx24(ComponentToRender, { data: procedureResultData });
|
|
3322
3578
|
} else {
|
|
3323
|
-
return /* @__PURE__ */
|
|
3324
|
-
/* @__PURE__ */
|
|
3579
|
+
return /* @__PURE__ */ jsxs15(Paper4, { elevation: 2, sx: { p: 2, mt: 0, bgcolor: "warning.light" }, children: [
|
|
3580
|
+
/* @__PURE__ */ jsxs15(Typography14, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: [
|
|
3325
3581
|
"el componente para resolver el resultOk: '",
|
|
3326
3582
|
procedure.resultOk,
|
|
3327
3583
|
"' definido en el procedure no existe o no est\xE1 mapeado."
|
|
3328
3584
|
] }),
|
|
3329
|
-
/* @__PURE__ */
|
|
3585
|
+
/* @__PURE__ */ jsx24(Box17, { sx: {
|
|
3330
3586
|
bgcolor: "warning.dark",
|
|
3331
3587
|
p: 1,
|
|
3332
3588
|
borderRadius: 1
|
|
3333
|
-
}, children: /* @__PURE__ */
|
|
3589
|
+
}, children: /* @__PURE__ */ jsx24("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(procedureResultData, null, 2) }) })
|
|
3334
3590
|
] });
|
|
3335
3591
|
}
|
|
3336
3592
|
}, [procedureResultData, procedure]);
|
|
3337
3593
|
if (!procedure) {
|
|
3338
|
-
return /* @__PURE__ */
|
|
3594
|
+
return /* @__PURE__ */ jsxs15(Box17, { sx: {
|
|
3339
3595
|
p: 2,
|
|
3340
3596
|
width: "100%",
|
|
3341
3597
|
boxSizing: "border-box",
|
|
@@ -3345,13 +3601,13 @@ var ProcedureForm = () => {
|
|
|
3345
3601
|
boxShadow: 3,
|
|
3346
3602
|
textAlign: "center"
|
|
3347
3603
|
}, children: [
|
|
3348
|
-
/* @__PURE__ */
|
|
3349
|
-
/* @__PURE__ */
|
|
3604
|
+
/* @__PURE__ */ jsx24(CircularProgress5, { sx: { mb: 2 } }),
|
|
3605
|
+
/* @__PURE__ */ jsx24(Typography14, { variant: "h6", color: "text.secondary", children: "Cargando procedimiento o no encontrado..." })
|
|
3350
3606
|
] });
|
|
3351
3607
|
}
|
|
3352
3608
|
return (
|
|
3353
3609
|
// Esta es la Box más externa que ahora controlará el scroll
|
|
3354
|
-
/* @__PURE__ */
|
|
3610
|
+
/* @__PURE__ */ jsxs15(Box17, { sx: {
|
|
3355
3611
|
p: 2,
|
|
3356
3612
|
ml: 1,
|
|
3357
3613
|
mt: 2,
|
|
@@ -3368,16 +3624,16 @@ var ProcedureForm = () => {
|
|
|
3368
3624
|
overflowX: "hidden"
|
|
3369
3625
|
// Oculta el scroll horizontal si no es necesario para el contenedor principal
|
|
3370
3626
|
}, children: [
|
|
3371
|
-
/* @__PURE__ */
|
|
3372
|
-
Object.values(validationErrors).some((err) => err !== null) && /* @__PURE__ */
|
|
3627
|
+
/* @__PURE__ */ jsx24(Typography14, { variant: "h5", component: "h2", gutterBottom: true, align: "left", children: cambiarGuionesBajosPorEspacios(procedure.proceedLabel || procedure.action) }),
|
|
3628
|
+
Object.values(validationErrors).some((err) => err !== null) && /* @__PURE__ */ jsxs15(Alert3, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: [
|
|
3373
3629
|
"Por favor, corrige los errores en el formulario antes de enviar.",
|
|
3374
|
-
/* @__PURE__ */
|
|
3630
|
+
/* @__PURE__ */ jsx24("ul", { children: Object.values(validationErrors).map((err, idx) => err && /* @__PURE__ */ jsx24("li", { children: err }, idx)) })
|
|
3375
3631
|
] }),
|
|
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__ */
|
|
3632
|
+
!Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */ jsx24(Alert3, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: apiError.message }),
|
|
3633
|
+
!Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */ jsx24(Alert3, { severity: "success", sx: { mb: 2, fontSize: "0.8rem" }, children: successMessage }),
|
|
3634
|
+
/* @__PURE__ */ jsxs15("form", { onSubmit: handleSubmit, children: [
|
|
3635
|
+
procedure.parameters.map((param) => /* @__PURE__ */ jsx24("div", { children: renderInputField(param) }, param.name)),
|
|
3636
|
+
/* @__PURE__ */ jsx24(
|
|
3381
3637
|
Button7,
|
|
3382
3638
|
{
|
|
3383
3639
|
type: "submit",
|
|
@@ -3386,20 +3642,20 @@ var ProcedureForm = () => {
|
|
|
3386
3642
|
disabled: apiLoading || Object.values(validationErrors).some((err) => err !== null),
|
|
3387
3643
|
sx: { mt: 2 },
|
|
3388
3644
|
size: "medium",
|
|
3389
|
-
startIcon: apiLoading ? /* @__PURE__ */
|
|
3645
|
+
startIcon: apiLoading ? /* @__PURE__ */ jsx24(CircularProgress5, { size: 20, color: "inherit" }) : null,
|
|
3390
3646
|
children: apiLoading ? "Ejecutando..." : procedure.proceedLabel || "Ejecutar"
|
|
3391
3647
|
}
|
|
3392
3648
|
)
|
|
3393
3649
|
] }),
|
|
3394
|
-
ResultDisplayContent && /* @__PURE__ */
|
|
3650
|
+
ResultDisplayContent && /* @__PURE__ */ jsxs15(Box17, { sx: { mt: 2 }, children: [
|
|
3395
3651
|
" ",
|
|
3396
3652
|
ResultDisplayContent
|
|
3397
3653
|
] }),
|
|
3398
|
-
executionLog.length > 0 && /* @__PURE__ */
|
|
3399
|
-
/* @__PURE__ */
|
|
3400
|
-
/* @__PURE__ */
|
|
3401
|
-
/* @__PURE__ */
|
|
3402
|
-
|
|
3654
|
+
executionLog.length > 0 && /* @__PURE__ */ jsxs15(Box17, { sx: { mt: 3 }, children: [
|
|
3655
|
+
/* @__PURE__ */ jsx24(Divider2, { sx: { mb: 2 } }),
|
|
3656
|
+
/* @__PURE__ */ jsx24(Typography14, { variant: "h6", gutterBottom: true, sx: { fontSize: "0.9rem" }, children: "Registro de Ejecuci\xF3n" }),
|
|
3657
|
+
/* @__PURE__ */ jsx24(
|
|
3658
|
+
Box17,
|
|
3403
3659
|
{
|
|
3404
3660
|
sx: {
|
|
3405
3661
|
bgcolor: "grey.100",
|
|
@@ -3412,7 +3668,7 @@ var ProcedureForm = () => {
|
|
|
3412
3668
|
fontSize: "0.75rem",
|
|
3413
3669
|
whiteSpace: "pre-wrap"
|
|
3414
3670
|
},
|
|
3415
|
-
children: executionLog.map((log, index) => /* @__PURE__ */
|
|
3671
|
+
children: executionLog.map((log, index) => /* @__PURE__ */ jsx24(
|
|
3416
3672
|
Typography14,
|
|
3417
3673
|
{
|
|
3418
3674
|
component: "pre",
|
|
@@ -3440,7 +3696,7 @@ import { PersistGate } from "redux-persist/integration/react";
|
|
|
3440
3696
|
// src/components/PrivateRoute.tsx
|
|
3441
3697
|
import { useEffect as useEffect5 } from "react";
|
|
3442
3698
|
import { Navigate, useLocation as useLocation2 } from "react-router-dom";
|
|
3443
|
-
import { Fragment as
|
|
3699
|
+
import { Fragment as Fragment4, jsx as jsx25 } from "react/jsx-runtime";
|
|
3444
3700
|
var PrivateRoute = ({ children }) => {
|
|
3445
3701
|
const location = useLocation2();
|
|
3446
3702
|
const dispatch = useAppDispatch();
|
|
@@ -3464,14 +3720,14 @@ var PrivateRoute = ({ children }) => {
|
|
|
3464
3720
|
}, [isAuthenticated, isLoadingAuth, location, dispatch, clientContextStatus]);
|
|
3465
3721
|
if (isLoadingAuth) {
|
|
3466
3722
|
console.log(`[PrivateRoute] Returning loading state...`);
|
|
3467
|
-
return /* @__PURE__ */
|
|
3723
|
+
return /* @__PURE__ */ jsx25("p", { children: "Verificando autenticaci\xF3n..." });
|
|
3468
3724
|
}
|
|
3469
3725
|
if (!isAuthenticated) {
|
|
3470
3726
|
console.log(`[PrivateRoute] User not authenticated, navigating to /login`);
|
|
3471
|
-
return /* @__PURE__ */
|
|
3727
|
+
return /* @__PURE__ */ jsx25(Navigate, { to: "/login", replace: true });
|
|
3472
3728
|
}
|
|
3473
3729
|
console.log(`[PrivateRoute] User authenticated, rendering children.`);
|
|
3474
|
-
return /* @__PURE__ */
|
|
3730
|
+
return /* @__PURE__ */ jsx25(Fragment4, { children });
|
|
3475
3731
|
};
|
|
3476
3732
|
var PrivateRoute_default = PrivateRoute;
|
|
3477
3733
|
|
|
@@ -3505,25 +3761,25 @@ var InitialRedirectHandler_default = InitialRedirectHandler;
|
|
|
3505
3761
|
|
|
3506
3762
|
// src/pages/GenericDataGridPage.tsx
|
|
3507
3763
|
import { useParams as useParams2 } from "react-router-dom";
|
|
3508
|
-
import { Box as
|
|
3509
|
-
import { jsx as
|
|
3764
|
+
import { Box as Box18, Alert as Alert4, Typography as Typography15 } from "@mui/material";
|
|
3765
|
+
import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3510
3766
|
var GenericDataGridPage = () => {
|
|
3511
3767
|
const { tableName } = useParams2();
|
|
3512
3768
|
if (!tableName) {
|
|
3513
|
-
return /* @__PURE__ */
|
|
3514
|
-
/* @__PURE__ */
|
|
3515
|
-
/* @__PURE__ */
|
|
3769
|
+
return /* @__PURE__ */ jsx26(Box18, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsxs16(Alert4, { severity: "error", children: [
|
|
3770
|
+
/* @__PURE__ */ jsx26(Typography15, { variant: "h6", children: "Error: Nombre de tabla no especificado en la URL." }),
|
|
3771
|
+
/* @__PURE__ */ jsx26(Typography15, { variant: "body1", children: "Por favor, aseg\xFArate de que la URL contenga el nombre de la tabla (ej. `/data/users`)." })
|
|
3516
3772
|
] }) });
|
|
3517
3773
|
}
|
|
3518
|
-
return /* @__PURE__ */
|
|
3774
|
+
return /* @__PURE__ */ jsx26(GenericDataGrid_default, { tableName, fixedFields: [] });
|
|
3519
3775
|
};
|
|
3520
3776
|
var GenericDataGridPage_default = GenericDataGridPage;
|
|
3521
3777
|
|
|
3522
3778
|
// src/pages/MenuTablePage.tsx
|
|
3523
3779
|
import { useMemo as useMemo5 } from "react";
|
|
3524
3780
|
import { useParams as useParams3 } from "react-router-dom";
|
|
3525
|
-
import { Box as
|
|
3526
|
-
import { jsx as
|
|
3781
|
+
import { Box as Box19, Alert as Alert5, Typography as Typography16 } from "@mui/material";
|
|
3782
|
+
import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3527
3783
|
var MenuTablePage = () => {
|
|
3528
3784
|
const { menuName } = useParams3();
|
|
3529
3785
|
const { clientContext } = useApp();
|
|
@@ -3565,12 +3821,12 @@ var MenuTablePage = () => {
|
|
|
3565
3821
|
};
|
|
3566
3822
|
}, [menuName, clientContext]);
|
|
3567
3823
|
if (!currentTableName) {
|
|
3568
|
-
return /* @__PURE__ */
|
|
3569
|
-
/* @__PURE__ */
|
|
3570
|
-
/* @__PURE__ */
|
|
3824
|
+
return /* @__PURE__ */ jsx27(Box19, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsxs17(Alert5, { severity: "error", children: [
|
|
3825
|
+
/* @__PURE__ */ jsx27(Typography16, { variant: "h6", children: "Error: No se pudo cargar la informaci\xF3n de la tabla." }),
|
|
3826
|
+
/* @__PURE__ */ jsx27(Typography16, { variant: "body1", children: "Verifique la configuraci\xF3n del men\xFA o el nombre de la tabla en la URL." })
|
|
3571
3827
|
] }) });
|
|
3572
3828
|
}
|
|
3573
|
-
return /* @__PURE__ */
|
|
3829
|
+
return /* @__PURE__ */ jsx27(
|
|
3574
3830
|
GenericDataGrid_default,
|
|
3575
3831
|
{
|
|
3576
3832
|
tableName: currentTableName,
|
|
@@ -3581,8 +3837,8 @@ var MenuTablePage = () => {
|
|
|
3581
3837
|
var MenuTablePage_default = MenuTablePage;
|
|
3582
3838
|
|
|
3583
3839
|
// src/App.tsx
|
|
3584
|
-
import { Box as
|
|
3585
|
-
import { jsx as
|
|
3840
|
+
import { Box as Box20 } from "@mui/material";
|
|
3841
|
+
import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3586
3842
|
var LocationTracker = () => {
|
|
3587
3843
|
const location = useLocation4();
|
|
3588
3844
|
const dispatch = useAppDispatch();
|
|
@@ -3591,25 +3847,25 @@ var LocationTracker = () => {
|
|
|
3591
3847
|
}, [location, dispatch]);
|
|
3592
3848
|
return null;
|
|
3593
3849
|
};
|
|
3594
|
-
function FrontendPlusReactRoutes({ myRoutes }) {
|
|
3595
|
-
return /* @__PURE__ */
|
|
3596
|
-
/* @__PURE__ */
|
|
3597
|
-
/* @__PURE__ */
|
|
3598
|
-
/* @__PURE__ */
|
|
3599
|
-
/* @__PURE__ */
|
|
3600
|
-
/* @__PURE__ */
|
|
3850
|
+
function FrontendPlusReactRoutes({ myRoutes, layout: Layout = MainLayout_default }) {
|
|
3851
|
+
return /* @__PURE__ */ jsxs18(Routes, { children: [
|
|
3852
|
+
/* @__PURE__ */ jsx28(Route, { path: "/login", element: /* @__PURE__ */ jsx28(LoginPage_default, {}) }),
|
|
3853
|
+
/* @__PURE__ */ jsx28(Route, { path: "/logout", element: /* @__PURE__ */ jsx28(LogoutPage_default, {}) }),
|
|
3854
|
+
/* @__PURE__ */ jsxs18(Route, { element: /* @__PURE__ */ jsxs18(PrivateRoute_default, { children: [
|
|
3855
|
+
/* @__PURE__ */ jsx28(InitialRedirectHandler_default, {}),
|
|
3856
|
+
/* @__PURE__ */ jsx28(Layout, {})
|
|
3601
3857
|
] }), children: [
|
|
3602
|
-
/* @__PURE__ */
|
|
3603
|
-
/* @__PURE__ */
|
|
3604
|
-
/* @__PURE__ */
|
|
3605
|
-
/* @__PURE__ */
|
|
3606
|
-
/* @__PURE__ */
|
|
3607
|
-
Object.keys(wScreens).map((screenName) => /* @__PURE__ */
|
|
3858
|
+
/* @__PURE__ */ jsx28(Route, { path: "/", element: /* @__PURE__ */ jsx28(HomePage_default, {}) }),
|
|
3859
|
+
/* @__PURE__ */ jsx28(Route, { path: "/home", element: /* @__PURE__ */ jsx28(HomePage_default, {}) }),
|
|
3860
|
+
/* @__PURE__ */ jsx28(Route, { path: "/table/:tableName", element: /* @__PURE__ */ jsx28(GenericDataGridPage_default, {}) }),
|
|
3861
|
+
/* @__PURE__ */ jsx28(Route, { path: "/menu/:menuName", element: /* @__PURE__ */ jsx28(MenuTablePage_default, {}) }),
|
|
3862
|
+
/* @__PURE__ */ jsx28(Route, { path: "/procedures/:procedureName", element: /* @__PURE__ */ jsx28(ProcedureForm_default, {}) }),
|
|
3863
|
+
Object.keys(wScreens).map((screenName) => /* @__PURE__ */ jsx28(
|
|
3608
3864
|
Route,
|
|
3609
3865
|
{
|
|
3610
3866
|
path: `/wScreens/${screenName}`,
|
|
3611
3867
|
element: React11.createElement(
|
|
3612
|
-
|
|
3868
|
+
Box20,
|
|
3613
3869
|
{
|
|
3614
3870
|
sx: { pt: 3, pl: 4 }
|
|
3615
3871
|
},
|
|
@@ -3618,19 +3874,29 @@ function FrontendPlusReactRoutes({ myRoutes }) {
|
|
|
3618
3874
|
},
|
|
3619
3875
|
screenName
|
|
3620
3876
|
)),
|
|
3621
|
-
/* @__PURE__ */
|
|
3877
|
+
/* @__PURE__ */ jsx28(
|
|
3622
3878
|
Route,
|
|
3623
3879
|
{
|
|
3624
3880
|
path: "/wScreens-fallback/:screenName",
|
|
3625
|
-
element: /* @__PURE__ */
|
|
3881
|
+
element: /* @__PURE__ */ jsx28(Box20, { sx: { p: 3 }, children: /* @__PURE__ */ jsx28(FallbackWScreen, { screenName: ":screenName" }) })
|
|
3626
3882
|
}
|
|
3627
3883
|
),
|
|
3628
|
-
/* @__PURE__ */
|
|
3884
|
+
/* @__PURE__ */ jsx28(Route, { path: "*", element: /* @__PURE__ */ jsx28("div", { style: { marginTop: "20px", marginLeft: "10px" }, children: "404 - Recurso No Encontrado" }) })
|
|
3629
3885
|
] }),
|
|
3630
3886
|
myRoutes,
|
|
3631
|
-
/* @__PURE__ */
|
|
3887
|
+
/* @__PURE__ */ jsx28(Route, { path: "*", element: /* @__PURE__ */ jsx28(Navigate2, { to: "/", replace: true }) })
|
|
3632
3888
|
] });
|
|
3633
3889
|
}
|
|
3890
|
+
var FrontendPlusProviders = ({ children }) => {
|
|
3891
|
+
return /* @__PURE__ */ jsx28(Provider, { store, children: /* @__PURE__ */ jsx28(PersistGate, { loading: null, persistor, children: /* @__PURE__ */ jsxs18(BrowserRouter, { children: [
|
|
3892
|
+
/* @__PURE__ */ jsx28(LocationTracker, {}),
|
|
3893
|
+
" ",
|
|
3894
|
+
/* @__PURE__ */ jsx28(AppProvider, { children: /* @__PURE__ */ jsxs18(SnackbarProvider, { children: [
|
|
3895
|
+
children,
|
|
3896
|
+
/* @__PURE__ */ jsx28(SessionExpiredMessage_default, {})
|
|
3897
|
+
] }) })
|
|
3898
|
+
] }) }) });
|
|
3899
|
+
};
|
|
3634
3900
|
var App = ({
|
|
3635
3901
|
myRoutes,
|
|
3636
3902
|
myWScreens,
|
|
@@ -3648,24 +3914,14 @@ var App = ({
|
|
|
3648
3914
|
extendWScreens(myWScreens);
|
|
3649
3915
|
}
|
|
3650
3916
|
}, [myClientSides, myResultsOk, myWScreens]);
|
|
3651
|
-
return /* @__PURE__ */
|
|
3652
|
-
/* @__PURE__ */ jsx26(LocationTracker, {}),
|
|
3653
|
-
/* @__PURE__ */ jsx26(AppProvider, { children: /* @__PURE__ */ jsxs17(SnackbarProvider, { children: [
|
|
3654
|
-
/* @__PURE__ */ jsx26(
|
|
3655
|
-
FrontendPlusReactRoutes,
|
|
3656
|
-
{
|
|
3657
|
-
myRoutes
|
|
3658
|
-
}
|
|
3659
|
-
),
|
|
3660
|
-
/* @__PURE__ */ jsx26(SessionExpiredMessage_default, {})
|
|
3661
|
-
] }) })
|
|
3662
|
-
] }) }) });
|
|
3917
|
+
return /* @__PURE__ */ jsx28(FrontendPlusProviders, { children: /* @__PURE__ */ jsx28(FrontendPlusReactRoutes, { myRoutes }) });
|
|
3663
3918
|
};
|
|
3664
3919
|
var App_default = App;
|
|
3665
3920
|
export {
|
|
3666
3921
|
App_default as App,
|
|
3667
3922
|
AppProvider,
|
|
3668
3923
|
ConfirmDialog,
|
|
3924
|
+
FrontendPlusProviders,
|
|
3669
3925
|
FrontendPlusReactRoutes,
|
|
3670
3926
|
GenericDataGrid_default as GenericDataGrid,
|
|
3671
3927
|
MainLayout_default as MainLayout,
|
|
@@ -3673,8 +3929,11 @@ export {
|
|
|
3673
3929
|
cambiarGuionesBajosPorEspacios,
|
|
3674
3930
|
clientSides,
|
|
3675
3931
|
extendClientSides,
|
|
3932
|
+
extendResultsOk,
|
|
3933
|
+
extendWScreens,
|
|
3676
3934
|
resultsOk as resultComponents,
|
|
3677
3935
|
useApiCall,
|
|
3936
|
+
useApiCallWithoutSnackbar,
|
|
3678
3937
|
useApp,
|
|
3679
3938
|
useLogout_default as useLogout,
|
|
3680
3939
|
useSnackbar,
|