frontend-plus-react 0.1.3 → 0.1.5
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 +539 -448
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -12
- package/dist/index.d.ts +16 -12
- package/dist/index.js +718 -627
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -622,7 +622,7 @@ var SnackbarAlert = React.forwardRef(function SnackbarAlert2(props, ref) {
|
|
|
622
622
|
});
|
|
623
623
|
var SnackbarContext = createContext(void 0);
|
|
624
624
|
var DEFAULT_SUCCESS_DURATION = 3e3;
|
|
625
|
-
var DEFAULT_ERROR_DURATION =
|
|
625
|
+
var DEFAULT_ERROR_DURATION = 1e4;
|
|
626
626
|
var SnackbarProvider = ({ children }) => {
|
|
627
627
|
const [snackbar, setSnackbar] = useState({
|
|
628
628
|
open: false,
|
|
@@ -757,9 +757,12 @@ 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, opts) => {
|
|
761
761
|
setLoading(true);
|
|
762
762
|
setError(null);
|
|
763
|
+
const defaultOpts = { ...{
|
|
764
|
+
reportOnSnackbar: true
|
|
765
|
+
}, ...opts };
|
|
763
766
|
try {
|
|
764
767
|
const result = await executeBackendProcedure(procedureName, params);
|
|
765
768
|
return result === null ? void 0 : result;
|
|
@@ -771,7 +774,9 @@ var useApiCall = () => {
|
|
|
771
774
|
} else if (err instanceof Error) {
|
|
772
775
|
snackbarMessage = err.message;
|
|
773
776
|
}
|
|
774
|
-
|
|
777
|
+
if (defaultOpts.reportOnSnackbar) {
|
|
778
|
+
showSnackbar(snackbarMessage, "error");
|
|
779
|
+
}
|
|
775
780
|
throw err;
|
|
776
781
|
} finally {
|
|
777
782
|
setLoading(false);
|
|
@@ -781,15 +786,7 @@ var useApiCall = () => {
|
|
|
781
786
|
};
|
|
782
787
|
|
|
783
788
|
// src/components/grid/GenericDataGrid.tsx
|
|
784
|
-
import {
|
|
785
|
-
CircularProgress,
|
|
786
|
-
Typography as Typography5,
|
|
787
|
-
Box as Box4,
|
|
788
|
-
Alert,
|
|
789
|
-
useTheme,
|
|
790
|
-
Button as Button2,
|
|
791
|
-
IconButton
|
|
792
|
-
} from "@mui/material";
|
|
789
|
+
import { CircularProgress, Typography as Typography5, Box as Box5, Alert, useTheme as useTheme3, Button as Button3 } from "@mui/material";
|
|
793
790
|
|
|
794
791
|
// src/utils/functions.tsx
|
|
795
792
|
var JSON4all = __toESM(require_json4all(), 1);
|
|
@@ -991,18 +988,45 @@ var useRedirectPath = () => {
|
|
|
991
988
|
var cambiarGuionesBajosPorEspacios = (texto) => texto.replace(/_/g, " ");
|
|
992
989
|
|
|
993
990
|
// src/components/grid/GenericDataGrid.tsx
|
|
994
|
-
import SearchIcon from "@mui/icons-material/Search";
|
|
995
|
-
import SearchOffIcon from "@mui/icons-material/SearchOff";
|
|
996
991
|
import AddIcon from "@mui/icons-material/Add";
|
|
997
|
-
import DeleteIcon from "@mui/icons-material/Delete";
|
|
998
992
|
|
|
999
|
-
// src/components/
|
|
1000
|
-
import
|
|
1001
|
-
import
|
|
1002
|
-
|
|
993
|
+
// src/components/ConfirmDialog.tsx
|
|
994
|
+
import Dialog from "@mui/material/Dialog";
|
|
995
|
+
import DialogTitle from "@mui/material/DialogTitle";
|
|
996
|
+
import DialogContent from "@mui/material/DialogContent";
|
|
997
|
+
import DialogContentText from "@mui/material/DialogContentText";
|
|
998
|
+
import DialogActions from "@mui/material/DialogActions";
|
|
999
|
+
import Button from "@mui/material/Button";
|
|
1000
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1001
|
+
var ConfirmDialog = ({ open, onClose, title, message }) => {
|
|
1002
|
+
return /* @__PURE__ */ jsxs2(
|
|
1003
|
+
Dialog,
|
|
1004
|
+
{
|
|
1005
|
+
open,
|
|
1006
|
+
onClose: () => onClose(false),
|
|
1007
|
+
"aria-labelledby": "confirm-dialog-title",
|
|
1008
|
+
"aria-describedby": "confirm-dialog-description",
|
|
1009
|
+
children: [
|
|
1010
|
+
/* @__PURE__ */ jsx2(DialogTitle, { id: "confirm-dialog-title", children: title }),
|
|
1011
|
+
/* @__PURE__ */ jsx2(DialogContent, { children: /* @__PURE__ */ jsx2(DialogContentText, { id: "confirm-dialog-description", children: message }) }),
|
|
1012
|
+
/* @__PURE__ */ jsxs2(DialogActions, { children: [
|
|
1013
|
+
/* @__PURE__ */ jsx2(Button, { onClick: () => onClose(false), color: "primary", children: "Cancelar" }),
|
|
1014
|
+
/* @__PURE__ */ jsx2(Button, { onClick: () => onClose(true), color: "error", autoFocus: true, children: "Confirmar" })
|
|
1015
|
+
] })
|
|
1016
|
+
]
|
|
1017
|
+
}
|
|
1018
|
+
);
|
|
1019
|
+
};
|
|
1020
|
+
|
|
1021
|
+
// src/components/grid/renderers/headerCellRenderers.tsx
|
|
1022
|
+
import { Box, IconButton, Tooltip, Typography } from "@mui/material";
|
|
1023
|
+
import SearchIcon from "@mui/icons-material/Search";
|
|
1024
|
+
import SearchOffIcon from "@mui/icons-material/SearchOff";
|
|
1025
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
1026
|
+
var defaultColumnHeaderCellRenderer = (props, fieldDef) => {
|
|
1003
1027
|
const { column } = props;
|
|
1004
|
-
const isPrimaryKey =
|
|
1005
|
-
return /* @__PURE__ */
|
|
1028
|
+
const isPrimaryKey = fieldDef.isPk;
|
|
1029
|
+
return /* @__PURE__ */ jsx3(
|
|
1006
1030
|
Box,
|
|
1007
1031
|
{
|
|
1008
1032
|
sx: {
|
|
@@ -1014,7 +1038,7 @@ function PkHeaderRenderer(props) {
|
|
|
1014
1038
|
boxSizing: "border-box",
|
|
1015
1039
|
height: "100%"
|
|
1016
1040
|
},
|
|
1017
|
-
children: /* @__PURE__ */
|
|
1041
|
+
children: /* @__PURE__ */ jsx3(
|
|
1018
1042
|
Typography,
|
|
1019
1043
|
{
|
|
1020
1044
|
variant: "body2",
|
|
@@ -1029,73 +1053,29 @@ function PkHeaderRenderer(props) {
|
|
|
1029
1053
|
)
|
|
1030
1054
|
}
|
|
1031
1055
|
);
|
|
1032
|
-
}
|
|
1033
|
-
var PkHeaderRenderer_default = PkHeaderRenderer;
|
|
1034
|
-
|
|
1035
|
-
// src/components/grid/PkCellRenderer.tsx
|
|
1036
|
-
import { Typography as Typography2 } from "@mui/material";
|
|
1037
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
1038
|
-
function PkCellRenderer(props) {
|
|
1039
|
-
const { column, row } = props;
|
|
1040
|
-
const isPrimaryKey = column.isPK;
|
|
1041
|
-
const rowAsRecord = row;
|
|
1042
|
-
const value = rowAsRecord[column.key];
|
|
1043
|
-
return /* @__PURE__ */ jsx3(
|
|
1044
|
-
Typography2,
|
|
1045
|
-
{
|
|
1046
|
-
variant: "body2",
|
|
1047
|
-
sx: {
|
|
1048
|
-
//fontWeight: isPrimaryKey ? 'bold' : 'normal',
|
|
1049
|
-
fontSize: "0.875rem",
|
|
1050
|
-
// Ajusta el tamaño si es necesario
|
|
1051
|
-
whiteSpace: "nowrap",
|
|
1052
|
-
overflow: "hidden",
|
|
1053
|
-
textOverflow: "ellipsis",
|
|
1054
|
-
width: "100%"
|
|
1055
|
-
},
|
|
1056
|
-
children: value === null || value === void 0 ? "" : String(value)
|
|
1057
|
-
}
|
|
1058
|
-
);
|
|
1059
|
-
}
|
|
1060
|
-
var PkCellRenderer_default = PkCellRenderer;
|
|
1061
|
-
|
|
1062
|
-
// src/components/ConfirmDialog.tsx
|
|
1063
|
-
import Dialog from "@mui/material/Dialog";
|
|
1064
|
-
import DialogTitle from "@mui/material/DialogTitle";
|
|
1065
|
-
import DialogContent from "@mui/material/DialogContent";
|
|
1066
|
-
import DialogContentText from "@mui/material/DialogContentText";
|
|
1067
|
-
import DialogActions from "@mui/material/DialogActions";
|
|
1068
|
-
import Button from "@mui/material/Button";
|
|
1069
|
-
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1070
|
-
var ConfirmDialog = ({ open, onClose, title, message }) => {
|
|
1071
|
-
return /* @__PURE__ */ jsxs2(
|
|
1072
|
-
Dialog,
|
|
1073
|
-
{
|
|
1074
|
-
open,
|
|
1075
|
-
onClose: () => onClose(false),
|
|
1076
|
-
"aria-labelledby": "confirm-dialog-title",
|
|
1077
|
-
"aria-describedby": "confirm-dialog-description",
|
|
1078
|
-
children: [
|
|
1079
|
-
/* @__PURE__ */ jsx4(DialogTitle, { id: "confirm-dialog-title", children: title }),
|
|
1080
|
-
/* @__PURE__ */ jsx4(DialogContent, { children: /* @__PURE__ */ jsx4(DialogContentText, { id: "confirm-dialog-description", children: message }) }),
|
|
1081
|
-
/* @__PURE__ */ jsxs2(DialogActions, { children: [
|
|
1082
|
-
/* @__PURE__ */ jsx4(Button, { onClick: () => onClose(false), color: "primary", children: "Cancelar" }),
|
|
1083
|
-
/* @__PURE__ */ jsx4(Button, { onClick: () => onClose(true), color: "error", autoFocus: true, children: "Confirmar" })
|
|
1084
|
-
] })
|
|
1085
|
-
]
|
|
1086
|
-
}
|
|
1087
|
-
);
|
|
1088
1056
|
};
|
|
1057
|
+
var actionsColumnHeaderCellRenderer = (props, isFilterRowVisible, toggleFilterVisibility) => /* @__PURE__ */ jsx3(
|
|
1058
|
+
IconButton,
|
|
1059
|
+
{
|
|
1060
|
+
color: "inherit",
|
|
1061
|
+
onClick: toggleFilterVisibility,
|
|
1062
|
+
size: "small",
|
|
1063
|
+
title: isFilterRowVisible ? "Ocultar filtros" : "Mostrar filtros",
|
|
1064
|
+
sx: { p: 0.5 },
|
|
1065
|
+
children: isFilterRowVisible ? /* @__PURE__ */ jsx3(SearchOffIcon, { sx: { fontSize: 20 } }) : /* @__PURE__ */ jsx3(SearchIcon, { sx: { fontSize: 20 } })
|
|
1066
|
+
}
|
|
1067
|
+
);
|
|
1068
|
+
var detailColumnCellHeaderRenderer = (props, detailTable) => /* @__PURE__ */ jsx3(Tooltip, { title: detailTable.label, children: /* @__PURE__ */ jsx3(Typography, { variant: "caption", sx: { fontSize: "0.75rem", fontWeight: "bold" }, children: detailTable.abr.toUpperCase() }) });
|
|
1089
1069
|
|
|
1090
1070
|
// src/components/grid/FilterInputRender.tsx
|
|
1091
1071
|
import { InputBase } from "@mui/material";
|
|
1092
|
-
import { jsx as
|
|
1072
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
1093
1073
|
function FilterInputRenderer({
|
|
1094
1074
|
column,
|
|
1095
1075
|
filters,
|
|
1096
1076
|
setFilters
|
|
1097
1077
|
}) {
|
|
1098
|
-
return /* @__PURE__ */
|
|
1078
|
+
return /* @__PURE__ */ jsx4(
|
|
1099
1079
|
InputBase,
|
|
1100
1080
|
{
|
|
1101
1081
|
value: filters[column.key] || "",
|
|
@@ -1118,10 +1098,231 @@ function FilterInputRenderer({
|
|
|
1118
1098
|
}
|
|
1119
1099
|
var FilterInputRender_default = FilterInputRenderer;
|
|
1120
1100
|
|
|
1121
|
-
// src/components/grid/
|
|
1101
|
+
// src/components/grid/renderers/summaryCellRenderers.tsx
|
|
1102
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1103
|
+
var defaultColumnSummaryCellRenderer = (props, fixedFields, isFilterRowVisible, filters, setFilters) => {
|
|
1104
|
+
const { column } = props;
|
|
1105
|
+
const fixedFieldEntry = fixedFields?.find((f) => f.fieldName === column.key);
|
|
1106
|
+
if (fixedFieldEntry && fixedFieldEntry.until === void 0 || !isFilterRowVisible) return null;
|
|
1107
|
+
return /* @__PURE__ */ jsx5(
|
|
1108
|
+
FilterInputRender_default,
|
|
1109
|
+
{
|
|
1110
|
+
column,
|
|
1111
|
+
filters,
|
|
1112
|
+
setFilters
|
|
1113
|
+
}
|
|
1114
|
+
);
|
|
1115
|
+
};
|
|
1116
|
+
var actionsColumnSummaryCellRenderer = (props) => null;
|
|
1117
|
+
var detailColumnCellSummaryRenderer = (props) => null;
|
|
1118
|
+
|
|
1119
|
+
// src/components/grid/renderers/cellRenderers.tsx
|
|
1120
|
+
import { Box as Box4, Button as Button2, IconButton as IconButton2, Tooltip as Tooltip3, Typography as Typography4, useTheme } from "@mui/material";
|
|
1121
|
+
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
|
|
1122
|
+
import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
|
|
1123
|
+
import DeleteIcon from "@mui/icons-material/Delete";
|
|
1124
|
+
|
|
1125
|
+
// src/components/grid/ExampleClientSideComponent.tsx
|
|
1126
|
+
import { Box as Box2, Typography as Typography2 } from "@mui/material";
|
|
1127
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1128
|
+
var ExampleClientSideComponent = ({ row, column, fieldDefinition }) => {
|
|
1129
|
+
const value = row[column.key];
|
|
1130
|
+
return /* @__PURE__ */ jsx6(Box2, { sx: {
|
|
1131
|
+
padding: 0.5,
|
|
1132
|
+
width: "100%",
|
|
1133
|
+
height: "100%",
|
|
1134
|
+
display: "flex",
|
|
1135
|
+
alignItems: "center",
|
|
1136
|
+
backgroundColor: value === "Special" ? "lightblue" : "transparent"
|
|
1137
|
+
}, children: /* @__PURE__ */ jsx6(Typography2, { variant: "body2", sx: { fontWeight: "bold" }, children: value ? `CS: ${value}` : "N/A" }) });
|
|
1138
|
+
};
|
|
1139
|
+
var ExampleClientSideComponent_default = ExampleClientSideComponent;
|
|
1140
|
+
|
|
1141
|
+
// src/components/grid/FallbackClientSideRenderer.tsx
|
|
1142
|
+
import { Box as Box3, Typography as Typography3, Tooltip as Tooltip2 } from "@mui/material";
|
|
1143
|
+
import WarningAmberIcon from "@mui/icons-material/WarningAmber";
|
|
1144
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1145
|
+
var FallbackClientSideRenderer = ({ column, row, fieldDefinition }) => {
|
|
1146
|
+
const clientSideName = fieldDefinition?.clientSide || "Desconocido";
|
|
1147
|
+
return /* @__PURE__ */ jsx7(Tooltip2, { title: `Componente clientSide '${clientSideName}' no implementado. Mostrando valor por defecto.`, children: /* @__PURE__ */ jsxs3(
|
|
1148
|
+
Box3,
|
|
1149
|
+
{
|
|
1150
|
+
sx: {
|
|
1151
|
+
display: "flex",
|
|
1152
|
+
alignItems: "center",
|
|
1153
|
+
justifyContent: "space-between",
|
|
1154
|
+
// Para espaciar el valor y el icono
|
|
1155
|
+
gap: 1,
|
|
1156
|
+
// Espacio entre elementos
|
|
1157
|
+
width: "100%",
|
|
1158
|
+
height: "100%",
|
|
1159
|
+
paddingLeft: "8px",
|
|
1160
|
+
backgroundColor: "rgba(255, 193, 7, 0.1)",
|
|
1161
|
+
// Amarillo claro para advertencia
|
|
1162
|
+
border: "1px dashed rgba(255, 193, 7, 0.5)",
|
|
1163
|
+
boxSizing: "border-box",
|
|
1164
|
+
overflow: "hidden"
|
|
1165
|
+
// Evita que el contenido se desborde
|
|
1166
|
+
},
|
|
1167
|
+
children: [
|
|
1168
|
+
/* @__PURE__ */ jsx7(Typography3, { variant: "body2", noWrap: true, sx: { flexGrow: 1 }, children: clientSideName + " not found" }),
|
|
1169
|
+
/* @__PURE__ */ jsx7(
|
|
1170
|
+
WarningAmberIcon,
|
|
1171
|
+
{
|
|
1172
|
+
sx: {
|
|
1173
|
+
fontSize: 18,
|
|
1174
|
+
color: "warning.main",
|
|
1175
|
+
marginRight: "4px"
|
|
1176
|
+
// Pequeño margen a la derecha del icono
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
)
|
|
1180
|
+
]
|
|
1181
|
+
}
|
|
1182
|
+
) });
|
|
1183
|
+
};
|
|
1184
|
+
var FallbackClientSideRenderer_default = FallbackClientSideRenderer;
|
|
1185
|
+
|
|
1186
|
+
// src/components/grid/clientSides.ts
|
|
1187
|
+
var clientSides = {
|
|
1188
|
+
"ExampleClientSideComponent": ExampleClientSideComponent_default,
|
|
1189
|
+
// Aseguramos el tipo aquí también
|
|
1190
|
+
"FallbackClientSideRenderer": FallbackClientSideRenderer_default
|
|
1191
|
+
// Y aquí
|
|
1192
|
+
};
|
|
1193
|
+
var extendClientSides = (newRenderers) => {
|
|
1194
|
+
clientSides = { ...clientSides, ...newRenderers };
|
|
1195
|
+
console.log("clientSides extendidos:", clientSides);
|
|
1196
|
+
};
|
|
1197
|
+
|
|
1198
|
+
// src/components/grid/renderers/cellRenderers.tsx
|
|
1199
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1200
|
+
var allColumnsCellRenderer = (props) => {
|
|
1201
|
+
const theme = useTheme();
|
|
1202
|
+
const column = props.column;
|
|
1203
|
+
const { row, rowIdx } = props;
|
|
1204
|
+
if (row[DETAIL_ROW_INDICATOR]) {
|
|
1205
|
+
const detailTableAbr = row[DETAIL_ROW_INDICATOR];
|
|
1206
|
+
const detailColumn = column;
|
|
1207
|
+
if (column.customType === "detail" && detailColumn.detailTable.abr === detailTableAbr) {
|
|
1208
|
+
const detailTable = detailColumn.tableDefinition.detailTables.find((dt) => dt.abr === detailTableAbr);
|
|
1209
|
+
let fixedFields = [];
|
|
1210
|
+
detailTable.fields.forEach((field) => {
|
|
1211
|
+
if (typeof field === "string") {
|
|
1212
|
+
fixedFields.push({ fieldName: field, value: row[field] });
|
|
1213
|
+
} else {
|
|
1214
|
+
fixedFields.push({ fieldName: field.target, value: row[field.source] });
|
|
1215
|
+
}
|
|
1216
|
+
});
|
|
1217
|
+
return /* @__PURE__ */ jsx8(
|
|
1218
|
+
Box4,
|
|
1219
|
+
{
|
|
1220
|
+
sx: {
|
|
1221
|
+
// Se eliminó el padding para que la sub-grilla se extienda por completo
|
|
1222
|
+
minHeight: "200px",
|
|
1223
|
+
width: "100%",
|
|
1224
|
+
height: "100%",
|
|
1225
|
+
//display: 'flex',
|
|
1226
|
+
//flexDirection: 'column',
|
|
1227
|
+
boxSizing: "border-box"
|
|
1228
|
+
},
|
|
1229
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
1230
|
+
onClick: (e) => e.stopPropagation(),
|
|
1231
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
1232
|
+
onDoubleClick: (e) => e.stopPropagation(),
|
|
1233
|
+
children: /* @__PURE__ */ jsx8(GenericDataGrid_default, { tableName: detailTable.table, fixedFields })
|
|
1234
|
+
}
|
|
1235
|
+
);
|
|
1236
|
+
}
|
|
1237
|
+
return void 0;
|
|
1238
|
+
}
|
|
1239
|
+
switch (column.customType) {
|
|
1240
|
+
case "default": {
|
|
1241
|
+
const defaultColumn = column;
|
|
1242
|
+
const { fieldDef, tableDefinition, primaryKey, cellFeedback, fixedFields, localCellChanges } = defaultColumn;
|
|
1243
|
+
const rowId = getPrimaryKeyValues(row, primaryKey);
|
|
1244
|
+
if (fieldDef?.clientSide) {
|
|
1245
|
+
const ClientSideComponent = clientSides[fieldDef.clientSide];
|
|
1246
|
+
if (ClientSideComponent) {
|
|
1247
|
+
return /* @__PURE__ */ jsx8(ClientSideComponent, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
|
|
1248
|
+
}
|
|
1249
|
+
return /* @__PURE__ */ jsx8(FallbackClientSideRenderer_default, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
|
|
1250
|
+
}
|
|
1251
|
+
let cellBackgroundColor = "transparent";
|
|
1252
|
+
if (cellFeedback && cellFeedback.rowId === rowId && cellFeedback.columnKey === props.column.key) {
|
|
1253
|
+
cellBackgroundColor = cellFeedback.type === "error" ? theme.palette.error.light : theme.palette.success.light;
|
|
1254
|
+
} else {
|
|
1255
|
+
const isNewRowLocalCheck = row[NEW_ROW_INDICATOR];
|
|
1256
|
+
const isMandatory = tableDefinition.primaryKey.includes(props.column.key) || tableDefinition.fields.find((f) => f.name === props.column.key)?.nullable === false;
|
|
1257
|
+
const hasValue = row[props.column.key] !== null && row[props.column.key] !== void 0 && String(row[props.column.key]).trim() !== "";
|
|
1258
|
+
const isFixedFieldCurrent = fixedFields?.some((f) => f.fieldName === props.column.key);
|
|
1259
|
+
if (isFixedFieldCurrent) {
|
|
1260
|
+
cellBackgroundColor = theme.palette.action.selected;
|
|
1261
|
+
} else if (isNewRowLocalCheck && isMandatory && !hasValue || localCellChanges.has(rowId) && localCellChanges.get(rowId)?.has(props.column.key)) {
|
|
1262
|
+
cellBackgroundColor = theme.palette.info.light;
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
const value = row[props.column.key];
|
|
1266
|
+
return /* @__PURE__ */ jsx8(Tooltip3, { title: cellFeedback && cellFeedback.rowId === rowId && cellFeedback.columnKey === props.column.key ? cellFeedback?.message : "", children: /* @__PURE__ */ jsx8(Box4, { 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__ */ jsx8(Typography4, { variant: "body2", sx: { fontSize: "0.875rem", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", width: "100%" }, children: value === null || value === void 0 ? "" : String(value) }) }) });
|
|
1267
|
+
}
|
|
1268
|
+
case "detail": {
|
|
1269
|
+
const detailColumn = column;
|
|
1270
|
+
const { detailTable, primaryKey, tableData, setTableData, detailKey } = detailColumn;
|
|
1271
|
+
const isExpanded = tableData.some(
|
|
1272
|
+
(r) => r[DETAIL_ROW_INDICATOR] === detailTable.abr && getPrimaryKeyValues(r, primaryKey) === getPrimaryKeyValues({ ...row, [DETAIL_ROW_INDICATOR]: detailTable.abr }, primaryKey)
|
|
1273
|
+
);
|
|
1274
|
+
return /* @__PURE__ */ jsx8(Tooltip3, { title: detailTable.label, children: /* @__PURE__ */ jsx8(Box4, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%" }, children: /* @__PURE__ */ jsx8(
|
|
1275
|
+
IconButton2,
|
|
1276
|
+
{
|
|
1277
|
+
size: "small",
|
|
1278
|
+
onClick: (event) => {
|
|
1279
|
+
let rows = [...tableData];
|
|
1280
|
+
const rowId = getPrimaryKeyValues({ ...row, [DETAIL_ROW_INDICATOR]: detailTable.abr }, primaryKey);
|
|
1281
|
+
if (isExpanded) {
|
|
1282
|
+
setTableData(rows.filter(
|
|
1283
|
+
(r) => !(r[DETAIL_ROW_INDICATOR] === detailTable.abr && getPrimaryKeyValues(r, primaryKey) === rowId)
|
|
1284
|
+
));
|
|
1285
|
+
} else {
|
|
1286
|
+
const parentRowIndex = rowIdx;
|
|
1287
|
+
rows.splice(parentRowIndex + 1, 0, {
|
|
1288
|
+
...row,
|
|
1289
|
+
[DETAIL_ROW_INDICATOR]: detailTable.abr
|
|
1290
|
+
});
|
|
1291
|
+
setTableData(rows);
|
|
1292
|
+
}
|
|
1293
|
+
event.stopPropagation();
|
|
1294
|
+
},
|
|
1295
|
+
title: isExpanded ? "Contraer detalle" : "Expandir detalle",
|
|
1296
|
+
sx: { p: 0.5 },
|
|
1297
|
+
children: isExpanded ? /* @__PURE__ */ jsx8(KeyboardArrowUpIcon, { sx: { fontSize: 20 } }) : /* @__PURE__ */ jsx8(KeyboardArrowDownIcon, { sx: { fontSize: 20 } })
|
|
1298
|
+
}
|
|
1299
|
+
) }) });
|
|
1300
|
+
}
|
|
1301
|
+
case "action": {
|
|
1302
|
+
const actionColumn = column;
|
|
1303
|
+
const { tableDefinition, handleDeleteRow } = actionColumn;
|
|
1304
|
+
if (!tableDefinition.allow?.delete) return void 0;
|
|
1305
|
+
return /* @__PURE__ */ jsx8(Box4, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%" }, children: /* @__PURE__ */ jsx8(Button2, { variant: "outlined", color: "error", size: "small", onClick: () => handleDeleteRow(row), title: "Eliminar fila", sx: { minWidth: 35, height: 30, p: 0.5, "& .MuiButton-startIcon": { m: 0 } }, children: /* @__PURE__ */ jsx8(DeleteIcon, { sx: { fontSize: 18 } }) }) });
|
|
1306
|
+
}
|
|
1307
|
+
default:
|
|
1308
|
+
return void 0;
|
|
1309
|
+
}
|
|
1310
|
+
};
|
|
1311
|
+
|
|
1312
|
+
// src/components/grid/InputRenderer.tsx
|
|
1122
1313
|
import { useCallback as useCallback3, useMemo, useState as useState3 } from "react";
|
|
1123
1314
|
import InputBase2 from "@mui/material/InputBase";
|
|
1124
|
-
import {
|
|
1315
|
+
import { useTheme as useTheme2 } from "@mui/material";
|
|
1316
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1317
|
+
function findChangedValues(oldRowData, newRowData) {
|
|
1318
|
+
let changes = [];
|
|
1319
|
+
for (const key in newRowData) {
|
|
1320
|
+
if (Object.prototype.hasOwnProperty.call(oldRowData, key) && oldRowData[key] !== newRowData[key]) {
|
|
1321
|
+
changes.push(key);
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
return changes;
|
|
1325
|
+
}
|
|
1125
1326
|
function InputRenderer({
|
|
1126
1327
|
column,
|
|
1127
1328
|
row,
|
|
@@ -1129,6 +1330,7 @@ function InputRenderer({
|
|
|
1129
1330
|
tableDefinition,
|
|
1130
1331
|
onRowChange,
|
|
1131
1332
|
onClose,
|
|
1333
|
+
cellFeedback,
|
|
1132
1334
|
setCellFeedback,
|
|
1133
1335
|
onEnterPress,
|
|
1134
1336
|
setTableData,
|
|
@@ -1138,9 +1340,15 @@ function InputRenderer({
|
|
|
1138
1340
|
}) {
|
|
1139
1341
|
const tableName = tableDefinition.tableName;
|
|
1140
1342
|
const [editingValue, setEditingValue] = useState3(row[column.key]);
|
|
1343
|
+
const theme = useTheme2();
|
|
1141
1344
|
const { showSuccess, showError } = useSnackbar();
|
|
1345
|
+
const rowId = getPrimaryKeyValues(row, primaryKey);
|
|
1346
|
+
let cellBackgroundColor;
|
|
1347
|
+
if (cellFeedback && cellFeedback.rowId === rowId && cellFeedback.columnKey === column.key) {
|
|
1348
|
+
cellBackgroundColor = cellFeedback.type === "error" ? theme.palette.error.light : theme.palette.success.light;
|
|
1349
|
+
}
|
|
1142
1350
|
const initialRowId = useMemo(() => getPrimaryKeyValues(row, primaryKey), [row, primaryKey]);
|
|
1143
|
-
const { callApi
|
|
1351
|
+
const { callApi } = useApiCall();
|
|
1144
1352
|
const handleCommit = useCallback3(async (currentValue, closeEditor, focusNextCell) => {
|
|
1145
1353
|
const processedNewValue = typeof currentValue === "string" ? currentValue.trim() === "" ? null : currentValue.trim() : currentValue;
|
|
1146
1354
|
const potentialUpdatedRow = { ...row, [column.key]: processedNewValue };
|
|
@@ -1152,27 +1360,12 @@ function InputRenderer({
|
|
|
1152
1360
|
const isMandatoryFieldEmpty = isNewRow && isMandatoryField && (processedNewValue === null || processedNewValue === void 0 || String(processedNewValue).trim() === "");
|
|
1153
1361
|
if (processedNewValue === row[column.key] && !isNewRow && !isMandatoryFieldEmpty) {
|
|
1154
1362
|
console.log("No se guard\xF3: el valor no cambi\xF3 (y no es una nueva fila o campo obligatorio vac\xEDo que se est\xE1 iniciando).");
|
|
1155
|
-
onClose(false, focusNextCell);
|
|
1156
|
-
setLocalCellChanges((prev) => {
|
|
1157
|
-
const newMap = new Map(prev);
|
|
1158
|
-
const columnKeys = newMap.get(initialRowId);
|
|
1159
|
-
if (columnKeys) {
|
|
1160
|
-
columnKeys.delete(column.key);
|
|
1161
|
-
if (columnKeys.size === 0) {
|
|
1162
|
-
newMap.delete(initialRowId);
|
|
1163
|
-
} else {
|
|
1164
|
-
newMap.set(initialRowId, columnKeys);
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
return newMap;
|
|
1168
|
-
});
|
|
1169
1363
|
return;
|
|
1170
1364
|
}
|
|
1171
1365
|
const oldRowData = { ...row };
|
|
1172
1366
|
const primaryKeyValuesForBackend = tableDefinition.primaryKey.map((key) => potentialUpdatedRow[key]);
|
|
1173
1367
|
const currentRowIdBeforeUpdate = getPrimaryKeyValues(oldRowData, tableDefinition.primaryKey);
|
|
1174
1368
|
onRowChange({ ...row, [column.key]: processedNewValue }, true);
|
|
1175
|
-
onClose(true, focusNextCell);
|
|
1176
1369
|
if (isNewRow) {
|
|
1177
1370
|
const areAllMandatoryFieldsFilled = tableDefinition.fields.every((fieldDef) => {
|
|
1178
1371
|
const isMandatory = fieldDef.nullable === false || fieldDef.isPk;
|
|
@@ -1239,21 +1432,7 @@ function InputRenderer({
|
|
|
1239
1432
|
newRow: rowToSend,
|
|
1240
1433
|
oldRow: oldRowData,
|
|
1241
1434
|
status
|
|
1242
|
-
});
|
|
1243
|
-
setLocalCellChanges((prev) => {
|
|
1244
|
-
const newMap = new Map(prev);
|
|
1245
|
-
const columnKeys = newMap.get(initialRowId);
|
|
1246
|
-
if (columnKeys) {
|
|
1247
|
-
columnKeys.delete(column.key);
|
|
1248
|
-
if (columnKeys.size === 0) {
|
|
1249
|
-
newMap.delete(initialRowId);
|
|
1250
|
-
} else {
|
|
1251
|
-
newMap.set(initialRowId, columnKeys);
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
return newMap;
|
|
1255
|
-
});
|
|
1256
|
-
showSuccess("Registro guardado exitosamente!");
|
|
1435
|
+
}, { reportOnSnackbar: false });
|
|
1257
1436
|
let finalRowIdForFeedback;
|
|
1258
1437
|
let persistedRowData;
|
|
1259
1438
|
if (response.row && isNewRow) {
|
|
@@ -1276,15 +1455,18 @@ function InputRenderer({
|
|
|
1276
1455
|
});
|
|
1277
1456
|
finalRowIdForFeedback = getPrimaryKeyValues(persistedRowData, tableDefinition.primaryKey);
|
|
1278
1457
|
} else {
|
|
1279
|
-
persistedRowData =
|
|
1458
|
+
persistedRowData = response.row;
|
|
1280
1459
|
const isPrimaryKeyColumn = tableDefinition.primaryKey.includes(column.key);
|
|
1281
1460
|
finalRowIdForFeedback = isPrimaryKeyColumn ? getPrimaryKeyValues(potentialUpdatedRow, tableDefinition.primaryKey) : currentRowIdBeforeUpdate;
|
|
1461
|
+
onRowChange({ ...response.row }, true);
|
|
1462
|
+
onClose(true, focusNextCell);
|
|
1282
1463
|
}
|
|
1283
|
-
|
|
1464
|
+
findChangedValues(oldRowData, response.row).forEach(
|
|
1465
|
+
(key) => setCellFeedback({ rowId: finalRowIdForFeedback, columnKey: key, type: "success" })
|
|
1466
|
+
);
|
|
1284
1467
|
} catch (err) {
|
|
1285
1468
|
console.error("Error al guardar el registro:", err);
|
|
1286
|
-
setCellFeedback({ rowId: currentRowIdBeforeUpdate, columnKey: column.key, type: "error" });
|
|
1287
|
-
onRowChange(oldRowData, true);
|
|
1469
|
+
setCellFeedback({ rowId: currentRowIdBeforeUpdate, columnKey: column.key, type: "error", message: err.message });
|
|
1288
1470
|
}
|
|
1289
1471
|
}, [
|
|
1290
1472
|
column,
|
|
@@ -1303,6 +1485,7 @@ function InputRenderer({
|
|
|
1303
1485
|
initialRowId
|
|
1304
1486
|
]);
|
|
1305
1487
|
const handleKeyDown = useCallback3((event) => {
|
|
1488
|
+
console.log("entra");
|
|
1306
1489
|
if (event.key === "Enter") {
|
|
1307
1490
|
handleCommit(editingValue, true, true);
|
|
1308
1491
|
event.preventDefault();
|
|
@@ -1318,7 +1501,7 @@ function InputRenderer({
|
|
|
1318
1501
|
}, [handleCommit, editingValue]);
|
|
1319
1502
|
const fieldDefinition = tableDefinition.fields.find((f) => f.name === column.key);
|
|
1320
1503
|
const isFieldEditable = fieldDefinition?.editable !== false;
|
|
1321
|
-
return /* @__PURE__ */
|
|
1504
|
+
return /* @__PURE__ */ jsx9(
|
|
1322
1505
|
InputBase2,
|
|
1323
1506
|
{
|
|
1324
1507
|
value: editingValue === null ? "" : editingValue,
|
|
@@ -1333,7 +1516,8 @@ function InputRenderer({
|
|
|
1333
1516
|
borderRadius: "4px",
|
|
1334
1517
|
padding: "2px 4px",
|
|
1335
1518
|
fontSize: "0.8rem",
|
|
1336
|
-
boxSizing: "border-box"
|
|
1519
|
+
boxSizing: "border-box",
|
|
1520
|
+
backgroundColor: cellBackgroundColor
|
|
1337
1521
|
},
|
|
1338
1522
|
onClick: (e) => e.stopPropagation(),
|
|
1339
1523
|
autoFocus: true,
|
|
@@ -1341,90 +1525,94 @@ function InputRenderer({
|
|
|
1341
1525
|
}
|
|
1342
1526
|
);
|
|
1343
1527
|
}
|
|
1344
|
-
var
|
|
1345
|
-
|
|
1346
|
-
// src/components/grid/ExampleClientSideComponent.tsx
|
|
1347
|
-
import { Box as Box2, Typography as Typography3 } from "@mui/material";
|
|
1348
|
-
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1349
|
-
var ExampleClientSideComponent = ({ row, column, fieldDefinition }) => {
|
|
1350
|
-
const value = row[column.key];
|
|
1351
|
-
return /* @__PURE__ */ jsx7(Box2, { sx: {
|
|
1352
|
-
padding: 0.5,
|
|
1353
|
-
width: "100%",
|
|
1354
|
-
height: "100%",
|
|
1355
|
-
display: "flex",
|
|
1356
|
-
alignItems: "center",
|
|
1357
|
-
backgroundColor: value === "Special" ? "lightblue" : "transparent"
|
|
1358
|
-
}, children: /* @__PURE__ */ jsx7(Typography3, { variant: "body2", sx: { fontWeight: "bold" }, children: value ? `CS: ${value}` : "N/A" }) });
|
|
1359
|
-
};
|
|
1360
|
-
var ExampleClientSideComponent_default = ExampleClientSideComponent;
|
|
1528
|
+
var InputRenderer_default = InputRenderer;
|
|
1361
1529
|
|
|
1362
|
-
// src/components/grid/
|
|
1363
|
-
import {
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
children: [
|
|
1390
|
-
/* @__PURE__ */ jsx8(Typography4, { variant: "body2", noWrap: true, sx: { flexGrow: 1 }, children: value !== null && value !== void 0 ? String(value) : "*Vac\xEDo*" }),
|
|
1391
|
-
/* @__PURE__ */ jsx8(
|
|
1392
|
-
WarningAmberIcon,
|
|
1530
|
+
// src/components/grid/renderers/editCellRenderers.tsx
|
|
1531
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1532
|
+
var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
1533
|
+
const column = props.column;
|
|
1534
|
+
switch (column.customType) {
|
|
1535
|
+
case "default": {
|
|
1536
|
+
const defaultColumn = column;
|
|
1537
|
+
const {
|
|
1538
|
+
tableDefinition,
|
|
1539
|
+
fixedFields,
|
|
1540
|
+
primaryKey,
|
|
1541
|
+
setTableData,
|
|
1542
|
+
cellFeedback,
|
|
1543
|
+
setCellFeedback,
|
|
1544
|
+
handleEnterKeyPressInEditor,
|
|
1545
|
+
localCellChanges,
|
|
1546
|
+
setLocalCellChanges
|
|
1547
|
+
} = defaultColumn;
|
|
1548
|
+
if (column.editable) {
|
|
1549
|
+
const fieldDefinition = tableDefinition.fields.find((f) => f.name === column.key);
|
|
1550
|
+
const isFixedField = fixedFields?.some((f) => f.fieldName === column.key);
|
|
1551
|
+
const isFieldEditableByUI = fieldDefinition?.editable !== false && !isFixedField;
|
|
1552
|
+
if (!isFieldEditableByUI) {
|
|
1553
|
+
return void 0;
|
|
1554
|
+
}
|
|
1555
|
+
return /* @__PURE__ */ jsx10(
|
|
1556
|
+
InputRenderer_default,
|
|
1393
1557
|
{
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1558
|
+
...props,
|
|
1559
|
+
tableDefinition,
|
|
1560
|
+
setCellFeedback,
|
|
1561
|
+
cellFeedback,
|
|
1562
|
+
onEnterPress: (rowIndex, columnKey) => handleEnterKeyPressInEditor(rowIndex, columnKey, allColumns),
|
|
1563
|
+
setTableData,
|
|
1564
|
+
setLocalCellChanges,
|
|
1565
|
+
localCellChanges,
|
|
1566
|
+
primaryKey
|
|
1400
1567
|
}
|
|
1401
|
-
)
|
|
1402
|
-
|
|
1568
|
+
);
|
|
1569
|
+
}
|
|
1570
|
+
return void 0;
|
|
1403
1571
|
}
|
|
1404
|
-
|
|
1572
|
+
case "detail": {
|
|
1573
|
+
return void 0;
|
|
1574
|
+
}
|
|
1575
|
+
case "action": {
|
|
1576
|
+
return void 0;
|
|
1577
|
+
}
|
|
1578
|
+
default:
|
|
1579
|
+
return void 0;
|
|
1580
|
+
}
|
|
1405
1581
|
};
|
|
1406
|
-
var FallbackClientSideRenderer_default = FallbackClientSideRenderer;
|
|
1407
1582
|
|
|
1408
|
-
// src/components/grid/
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1583
|
+
// src/components/grid/renderers/emptyRowRenderer.tsx
|
|
1584
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1585
|
+
function EmptyRowsRenderer() {
|
|
1586
|
+
return /* @__PURE__ */ jsx11("div", { style: {
|
|
1587
|
+
// Posicionamiento absoluto respecto a la pantalla
|
|
1588
|
+
position: "fixed",
|
|
1589
|
+
top: "50%",
|
|
1590
|
+
// Centrado verticalmente
|
|
1591
|
+
left: "50%",
|
|
1592
|
+
// Centrado horizontalmente
|
|
1593
|
+
transform: "translate(-50%, -50%)",
|
|
1594
|
+
// Ajuste para el 50% del tamaño del div
|
|
1595
|
+
// Estilos de visualización
|
|
1596
|
+
backgroundColor: "rgba(255, 255, 255, 0.9)",
|
|
1597
|
+
border: "1px solid #ccc",
|
|
1598
|
+
borderRadius: "4px",
|
|
1599
|
+
padding: "16px 24px",
|
|
1600
|
+
boxShadow: "0 2px 10px rgba(0,0,0,0.1)"
|
|
1601
|
+
}, children: /* @__PURE__ */ jsx11("div", { style: { textAlign: "center" }, children: "No hay filas para mostrar" }) });
|
|
1602
|
+
}
|
|
1419
1603
|
|
|
1420
1604
|
// src/components/grid/GenericDataGrid.tsx
|
|
1421
|
-
import {
|
|
1605
|
+
import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1422
1606
|
var getPrimaryKeyValues = (row, primaryKey) => {
|
|
1607
|
+
if (row[DETAIL_ROW_INDICATOR]) {
|
|
1608
|
+
primaryKey = primaryKey.concat(DETAIL_ROW_INDICATOR);
|
|
1609
|
+
}
|
|
1423
1610
|
return primaryKey.map((key) => {
|
|
1424
1611
|
return row[key] !== void 0 && row[key] !== null ? String(row[key]) : "NULL_OR_UNDEFINED";
|
|
1425
1612
|
}).join("|");
|
|
1426
1613
|
};
|
|
1427
|
-
var NEW_ROW_INDICATOR = "
|
|
1614
|
+
var NEW_ROW_INDICATOR = "$new";
|
|
1615
|
+
var DETAIL_ROW_INDICATOR = "$detail";
|
|
1428
1616
|
var GenericDataGrid = ({
|
|
1429
1617
|
tableName,
|
|
1430
1618
|
fixedFields
|
|
@@ -1434,9 +1622,10 @@ var GenericDataGrid = ({
|
|
|
1434
1622
|
const [isFilterRowVisible, setIsFilterRowVisible] = useState4(false);
|
|
1435
1623
|
const [filters, setFilters] = useState4({});
|
|
1436
1624
|
const [selectedRows, setSelectedRows] = useState4(() => /* @__PURE__ */ new Set());
|
|
1625
|
+
const [selectedCell, setSelectedCell] = useState4(void 0);
|
|
1437
1626
|
const [cellFeedback, setCellFeedback] = useState4(null);
|
|
1438
1627
|
const [localCellChanges, setLocalCellChanges] = useState4(/* @__PURE__ */ new Map());
|
|
1439
|
-
const theme =
|
|
1628
|
+
const theme = useTheme3();
|
|
1440
1629
|
const [openConfirmDialog, setOpenConfirmDialog] = useState4(false);
|
|
1441
1630
|
const [rowToDelete, setRowToDelete] = useState4(null);
|
|
1442
1631
|
const [exitingRowIds, setExitingRowIds] = useState4(/* @__PURE__ */ new Set());
|
|
@@ -1444,6 +1633,8 @@ var GenericDataGrid = ({
|
|
|
1444
1633
|
const feedbackTimerRef = useRef(null);
|
|
1445
1634
|
const dataGridRef = useRef(null);
|
|
1446
1635
|
const { callApi, loading, error } = useApiCall();
|
|
1636
|
+
const getRowCount = () => tableData.filter((row) => !row[DETAIL_ROW_INDICATOR]).length;
|
|
1637
|
+
const getFilteredRowCount = () => filteredRows.filter((row) => !row[DETAIL_ROW_INDICATOR]).length;
|
|
1447
1638
|
useEffect(() => {
|
|
1448
1639
|
setFilters({});
|
|
1449
1640
|
setIsFilterRowVisible(false);
|
|
@@ -1467,7 +1658,6 @@ var GenericDataGrid = ({
|
|
|
1467
1658
|
const data = await callApi("table_data", {
|
|
1468
1659
|
table: tableName,
|
|
1469
1660
|
fixedFields
|
|
1470
|
-
// Envía el array fixedFields directamente a la API
|
|
1471
1661
|
});
|
|
1472
1662
|
setTableData(data);
|
|
1473
1663
|
} catch (err) {
|
|
@@ -1478,15 +1668,20 @@ var GenericDataGrid = ({
|
|
|
1478
1668
|
}
|
|
1479
1669
|
};
|
|
1480
1670
|
fetchDataAndDefinition();
|
|
1481
|
-
}, [
|
|
1671
|
+
}, [
|
|
1672
|
+
tableName,
|
|
1673
|
+
/*fixedFields,*/
|
|
1674
|
+
showError
|
|
1675
|
+
]);
|
|
1482
1676
|
useEffect(() => {
|
|
1483
1677
|
if (cellFeedback) {
|
|
1484
1678
|
if (feedbackTimerRef.current) {
|
|
1485
1679
|
clearTimeout(feedbackTimerRef.current);
|
|
1486
1680
|
}
|
|
1487
|
-
const timerDuration =
|
|
1681
|
+
const timerDuration = 3e3;
|
|
1488
1682
|
feedbackTimerRef.current = setTimeout(() => {
|
|
1489
|
-
|
|
1683
|
+
if (cellFeedback.type == "success")
|
|
1684
|
+
setCellFeedback(null);
|
|
1490
1685
|
}, timerDuration);
|
|
1491
1686
|
}
|
|
1492
1687
|
return () => {
|
|
@@ -1638,225 +1833,120 @@ var GenericDataGrid = ({
|
|
|
1638
1833
|
const handleEnterKeyPressInEditor = useCallback4((rowIndex, columnKey, currentColumns) => {
|
|
1639
1834
|
if (dataGridRef.current && tableDefinition) {
|
|
1640
1835
|
const currentColumnIndex = currentColumns.findIndex((col) => col.key === columnKey);
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1836
|
+
const editableColumns = currentColumns.filter((col) => {
|
|
1837
|
+
const fieldDefinition = tableDefinition.fields.find((f) => f.name === col.key);
|
|
1838
|
+
return col.key !== "filterToggle" && col.key !== "deleteAction" && (fieldDefinition?.editable !== false && !fieldDefinition?.clientSide);
|
|
1839
|
+
});
|
|
1840
|
+
if (currentColumnIndex !== -1 && editableColumns.length > 0) {
|
|
1841
|
+
const editableColumnKeys = editableColumns.map((col) => col.key);
|
|
1842
|
+
let currentEditableColumnIndex = editableColumnKeys.indexOf(columnKey);
|
|
1843
|
+
if (currentEditableColumnIndex !== -1) {
|
|
1844
|
+
let nextEditableColumnIndex = currentEditableColumnIndex + 1;
|
|
1845
|
+
let nextRowIndex = rowIndex;
|
|
1846
|
+
if (nextEditableColumnIndex >= editableColumns.length) {
|
|
1847
|
+
nextEditableColumnIndex = 0;
|
|
1648
1848
|
nextRowIndex++;
|
|
1649
1849
|
if (nextRowIndex >= filteredRows.length) {
|
|
1650
1850
|
nextRowIndex = 0;
|
|
1651
|
-
nextColumnIndex = 0;
|
|
1652
|
-
if (filteredRows.length === 0 || rowIndex === filteredRows.length - 1 && currentColumnIndex === currentColumns.length - 1) {
|
|
1653
|
-
foundNextTarget = true;
|
|
1654
|
-
break;
|
|
1655
|
-
}
|
|
1656
1851
|
}
|
|
1657
1852
|
}
|
|
1658
|
-
const
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
const isEditableField = fieldDefinition?.editable !== false;
|
|
1662
|
-
if (nextColumn.key !== "filterToggle" && nextColumn.key !== "deleteAction" && isEditableField) {
|
|
1663
|
-
foundNextTarget = true;
|
|
1664
|
-
} else {
|
|
1665
|
-
nextColumnIndex++;
|
|
1666
|
-
}
|
|
1667
|
-
} else {
|
|
1668
|
-
nextColumnIndex++;
|
|
1669
|
-
}
|
|
1670
|
-
}
|
|
1671
|
-
if (foundNextTarget) {
|
|
1672
|
-
dataGridRef.current.selectCell({ rowIdx: nextRowIndex, idx: nextColumnIndex }, { enableEditor: false, scrollIntoView: true });
|
|
1853
|
+
const nextColumnKey = editableColumnKeys[nextEditableColumnIndex];
|
|
1854
|
+
const nextColumnIndex = currentColumns.findIndex((col) => col.key === nextColumnKey);
|
|
1855
|
+
dataGridRef.current.selectCell({ rowIdx: nextRowIndex, idx: nextColumnIndex }, { enableEditor: true, shouldFocusCell: true });
|
|
1673
1856
|
}
|
|
1674
1857
|
}
|
|
1675
1858
|
}
|
|
1676
1859
|
}, [filteredRows, tableDefinition]);
|
|
1860
|
+
const handleSelectedCellChange = useCallback4((args) => {
|
|
1861
|
+
setSelectedCell(args);
|
|
1862
|
+
}, []);
|
|
1677
1863
|
const columns = useMemo2(() => {
|
|
1678
1864
|
if (!tableDefinition) return [];
|
|
1679
1865
|
const fieldsToShow = tableDefinition.fields.filter((field) => {
|
|
1680
1866
|
const fixedFieldEntry = fixedFields?.find((f) => f.fieldName === field.name);
|
|
1681
1867
|
return !(fixedFieldEntry && fixedFieldEntry.until === void 0);
|
|
1682
1868
|
});
|
|
1683
|
-
const defaultColumns = fieldsToShow.map((
|
|
1684
|
-
const isFixedField = fixedFields?.some((f) => f.fieldName ===
|
|
1685
|
-
const isFieldEditable =
|
|
1869
|
+
const defaultColumns = fieldsToShow.map((fieldDef) => {
|
|
1870
|
+
const isFixedField = fixedFields?.some((f) => f.fieldName === fieldDef.name);
|
|
1871
|
+
const isFieldEditable = fieldDef.editable !== false && !isFixedField;
|
|
1686
1872
|
return {
|
|
1687
|
-
key:
|
|
1688
|
-
|
|
1873
|
+
key: fieldDef.name,
|
|
1874
|
+
customType: "default",
|
|
1875
|
+
tableDefinition,
|
|
1876
|
+
fieldDef,
|
|
1877
|
+
cellFeedback,
|
|
1878
|
+
primaryKey,
|
|
1879
|
+
fixedFields,
|
|
1880
|
+
localCellChanges,
|
|
1881
|
+
setLocalCellChanges,
|
|
1882
|
+
setTableData,
|
|
1883
|
+
setCellFeedback,
|
|
1884
|
+
name: fieldDef.label || cambiarGuionesBajosPorEspacios(fieldDef.name),
|
|
1689
1885
|
resizable: true,
|
|
1690
1886
|
sortable: true,
|
|
1691
1887
|
editable: isFieldEditable,
|
|
1692
|
-
|
|
1888
|
+
handleEnterKeyPressInEditor,
|
|
1693
1889
|
flexGrow: 1,
|
|
1694
1890
|
minWidth: 60,
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
renderSummaryCell: ({ column }) => {
|
|
1698
|
-
const fixedFieldEntry = fixedFields?.find((f) => f.fieldName === column.key);
|
|
1699
|
-
if (fixedFieldEntry && fixedFieldEntry.until === void 0) return null;
|
|
1700
|
-
return isFilterRowVisible ? /* @__PURE__ */ jsx9(
|
|
1701
|
-
FilterInputRender_default,
|
|
1702
|
-
{
|
|
1703
|
-
column,
|
|
1704
|
-
filters,
|
|
1705
|
-
setFilters
|
|
1706
|
-
}
|
|
1707
|
-
) : null;
|
|
1708
|
-
},
|
|
1709
|
-
renderCell: (props) => {
|
|
1710
|
-
const rowId = getPrimaryKeyValues(props.row, primaryKey);
|
|
1711
|
-
const fieldDefinition = tableDefinition.fields.find((f) => f.name === props.column.key);
|
|
1712
|
-
if (fieldDefinition?.clientSide) {
|
|
1713
|
-
const ClientSideComponent = clientSides[fieldDefinition.clientSide];
|
|
1714
|
-
if (ClientSideComponent) {
|
|
1715
|
-
return /* @__PURE__ */ jsx9(
|
|
1716
|
-
ClientSideComponent,
|
|
1717
|
-
{
|
|
1718
|
-
...props,
|
|
1719
|
-
fieldDefinition,
|
|
1720
|
-
tableDefinition,
|
|
1721
|
-
primaryKey
|
|
1722
|
-
}
|
|
1723
|
-
);
|
|
1724
|
-
} else {
|
|
1725
|
-
return /* @__PURE__ */ jsx9(
|
|
1726
|
-
FallbackClientSideRenderer_default,
|
|
1727
|
-
{
|
|
1728
|
-
...props,
|
|
1729
|
-
fieldDefinition,
|
|
1730
|
-
tableDefinition,
|
|
1731
|
-
primaryKey
|
|
1732
|
-
}
|
|
1733
|
-
);
|
|
1734
|
-
}
|
|
1735
|
-
}
|
|
1736
|
-
let cellBackgroundColor = "transparent";
|
|
1737
|
-
if (cellFeedback && cellFeedback.rowId === rowId && cellFeedback.columnKey === props.column.key) {
|
|
1738
|
-
cellBackgroundColor = cellFeedback.type === "error" ? theme.palette.error.light : theme.palette.success.light;
|
|
1739
|
-
} else {
|
|
1740
|
-
const isNewRowLocalCheck = props.row[NEW_ROW_INDICATOR];
|
|
1741
|
-
const isMandatory = tableDefinition.primaryKey.includes(props.column.key) || tableDefinition.fields.find((f) => f.name === props.column.key)?.nullable === false;
|
|
1742
|
-
const hasValue = props.row[props.column.key] !== null && props.row[props.column.key] !== void 0 && String(props.row[props.column.key]).trim() !== "";
|
|
1743
|
-
const isFixedFieldCurrent = fixedFields?.some((f) => f.fieldName === props.column.key);
|
|
1744
|
-
if (isFixedFieldCurrent) {
|
|
1745
|
-
cellBackgroundColor = theme.palette.action.selected;
|
|
1746
|
-
} else if (isNewRowLocalCheck && isMandatory && !hasValue || localCellChanges.has(rowId) && localCellChanges.get(rowId)?.has(props.column.key)) {
|
|
1747
|
-
cellBackgroundColor = theme.palette.info.light;
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
return /* @__PURE__ */ jsx9(
|
|
1751
|
-
Box4,
|
|
1752
|
-
{
|
|
1753
|
-
sx: {
|
|
1754
|
-
position: "absolute",
|
|
1755
|
-
top: 0,
|
|
1756
|
-
left: 0,
|
|
1757
|
-
width: "100%",
|
|
1758
|
-
height: "100%",
|
|
1759
|
-
backgroundColor: cellBackgroundColor,
|
|
1760
|
-
transition: "background-color 0.3s ease-in-out",
|
|
1761
|
-
display: "flex",
|
|
1762
|
-
alignItems: "center",
|
|
1763
|
-
paddingLeft: "8px",
|
|
1764
|
-
boxSizing: "border-box"
|
|
1765
|
-
},
|
|
1766
|
-
children: /* @__PURE__ */ jsx9(
|
|
1767
|
-
PkCellRenderer_default,
|
|
1768
|
-
{
|
|
1769
|
-
...props,
|
|
1770
|
-
column: { ...props.column, isPK: !!field.isPk }
|
|
1771
|
-
}
|
|
1772
|
-
)
|
|
1773
|
-
}
|
|
1774
|
-
);
|
|
1775
|
-
}
|
|
1891
|
+
renderHeaderCell: (props) => defaultColumnHeaderCellRenderer(props, fieldDef),
|
|
1892
|
+
renderSummaryCell: (props) => defaultColumnSummaryCellRenderer(props, fixedFields, isFilterRowVisible, filters, setFilters)
|
|
1776
1893
|
};
|
|
1777
1894
|
});
|
|
1778
|
-
const
|
|
1895
|
+
const actionsColumn = {
|
|
1779
1896
|
key: "filterToggle",
|
|
1780
|
-
|
|
1897
|
+
customType: "action",
|
|
1898
|
+
tableDefinition,
|
|
1899
|
+
handleDeleteRow,
|
|
1900
|
+
name: "filterCol",
|
|
1781
1901
|
width: 50,
|
|
1902
|
+
editable: false,
|
|
1782
1903
|
resizable: false,
|
|
1783
1904
|
sortable: false,
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
IconButton,
|
|
1787
|
-
{
|
|
1788
|
-
color: "inherit",
|
|
1789
|
-
onClick: toggleFilterVisibility,
|
|
1790
|
-
size: "small",
|
|
1791
|
-
title: isFilterRowVisible ? "Ocultar filtros" : "Mostrar filtros",
|
|
1792
|
-
sx: { p: 0.5 },
|
|
1793
|
-
children: isFilterRowVisible ? /* @__PURE__ */ jsx9(SearchOffIcon, { sx: { fontSize: 20 } }) : /* @__PURE__ */ jsx9(SearchIcon, { sx: { fontSize: 20 } })
|
|
1794
|
-
}
|
|
1795
|
-
),
|
|
1796
|
-
renderSummaryCell: () => null
|
|
1905
|
+
renderHeaderCell: (props) => actionsColumnHeaderCellRenderer(props, isFilterRowVisible, toggleFilterVisibility),
|
|
1906
|
+
renderSummaryCell: (props) => actionsColumnSummaryCellRenderer(props)
|
|
1797
1907
|
};
|
|
1798
|
-
const
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1908
|
+
const detailColumns = [];
|
|
1909
|
+
if (tableDefinition.detailTables && tableDefinition.detailTables.length > 0) {
|
|
1910
|
+
tableDefinition.detailTables.forEach((detailTable) => {
|
|
1911
|
+
const detailKey = `detail_${detailTable.abr}`;
|
|
1912
|
+
detailColumns.push({
|
|
1913
|
+
key: detailKey,
|
|
1914
|
+
customType: "detail",
|
|
1915
|
+
tableDefinition,
|
|
1916
|
+
detailTable,
|
|
1917
|
+
primaryKey,
|
|
1918
|
+
tableData,
|
|
1919
|
+
setTableData,
|
|
1920
|
+
detailKey,
|
|
1921
|
+
name: detailTable.label || `Detalle ${detailTable.abr}`,
|
|
1922
|
+
resizable: false,
|
|
1923
|
+
sortable: false,
|
|
1924
|
+
editable: false,
|
|
1925
|
+
width: 50,
|
|
1926
|
+
renderHeaderCell: (props) => detailColumnCellHeaderRenderer(props, detailTable),
|
|
1927
|
+
renderSummaryCell: (props) => detailColumnCellSummaryRenderer(props)
|
|
1928
|
+
});
|
|
1929
|
+
});
|
|
1930
|
+
}
|
|
1931
|
+
const allColumns = [
|
|
1932
|
+
actionsColumn,
|
|
1933
|
+
...detailColumns,
|
|
1934
|
+
...defaultColumns
|
|
1935
|
+
];
|
|
1936
|
+
return allColumns.map((col) => ({
|
|
1937
|
+
...col,
|
|
1938
|
+
colSpan: (args) => {
|
|
1939
|
+
if (args.type === "ROW") {
|
|
1940
|
+
const detailTableAbr = args.row[DETAIL_ROW_INDICATOR];
|
|
1941
|
+
if (col.key === `detail_${detailTableAbr}`) {
|
|
1942
|
+
return allColumns.length;
|
|
1826
1943
|
}
|
|
1827
|
-
) });
|
|
1828
|
-
}
|
|
1829
|
-
};
|
|
1830
|
-
const allColumns = [filterToggleColumn, deleteActionColumn, ...defaultColumns];
|
|
1831
|
-
return allColumns.map((col) => {
|
|
1832
|
-
if (col.editable) {
|
|
1833
|
-
const fieldDefinition = tableDefinition.fields.find((f) => f.name === col.key);
|
|
1834
|
-
const isFixedField = fixedFields?.some((f) => f.fieldName === col.key);
|
|
1835
|
-
const isFieldEditableByUI = fieldDefinition?.editable !== false && !isFixedField;
|
|
1836
|
-
if (!isFieldEditableByUI) {
|
|
1837
|
-
return { ...col, renderEditCell: void 0 };
|
|
1838
1944
|
}
|
|
1839
|
-
return
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
{
|
|
1845
|
-
...props,
|
|
1846
|
-
tableDefinition,
|
|
1847
|
-
setCellFeedback,
|
|
1848
|
-
onEnterPress: (rowIndex, columnKey) => handleEnterKeyPressInEditor(rowIndex, columnKey, allColumns),
|
|
1849
|
-
setTableData,
|
|
1850
|
-
setLocalCellChanges,
|
|
1851
|
-
localCellChanges,
|
|
1852
|
-
primaryKey
|
|
1853
|
-
}
|
|
1854
|
-
);
|
|
1855
|
-
}
|
|
1856
|
-
};
|
|
1857
|
-
}
|
|
1858
|
-
return col;
|
|
1859
|
-
});
|
|
1945
|
+
return void 0;
|
|
1946
|
+
},
|
|
1947
|
+
renderEditCell: (props) => allColumnsEditCellRenderer(props, allColumns),
|
|
1948
|
+
renderCell: (props) => allColumnsCellRenderer(props)
|
|
1949
|
+
}));
|
|
1860
1950
|
}, [
|
|
1861
1951
|
tableDefinition,
|
|
1862
1952
|
isFilterRowVisible,
|
|
@@ -1868,19 +1958,28 @@ var GenericDataGrid = ({
|
|
|
1868
1958
|
theme.palette.error.light,
|
|
1869
1959
|
theme.palette.info.light,
|
|
1870
1960
|
theme.palette.action.selected,
|
|
1871
|
-
// Añade el color de campos fijos
|
|
1872
1961
|
handleEnterKeyPressInEditor,
|
|
1873
1962
|
setTableData,
|
|
1874
1963
|
localCellChanges,
|
|
1875
1964
|
handleDeleteRow,
|
|
1876
|
-
fixedFields
|
|
1877
|
-
|
|
1965
|
+
fixedFields,
|
|
1966
|
+
tableData
|
|
1878
1967
|
]);
|
|
1879
|
-
const showNoRowsMessage = filteredRows.length === 0 && !loading && !error;
|
|
1880
1968
|
const handleRowsChange = useCallback4((updatedRows) => {
|
|
1881
1969
|
setTableData(updatedRows);
|
|
1882
1970
|
}, []);
|
|
1971
|
+
const deselectAllOtherGrids = (currentGridElement) => {
|
|
1972
|
+
const allSelectedCells = document.querySelectorAll("div[aria-selected='true']");
|
|
1973
|
+
allSelectedCells.forEach((cell) => {
|
|
1974
|
+
const parentGrid = cell.closest(".rdg");
|
|
1975
|
+
if (parentGrid && parentGrid !== currentGridElement) {
|
|
1976
|
+
cell.setAttribute("aria-selected", "false");
|
|
1977
|
+
}
|
|
1978
|
+
});
|
|
1979
|
+
};
|
|
1883
1980
|
const handleCellClick = useCallback4((args) => {
|
|
1981
|
+
deselectAllOtherGrids(dataGridRef.current?.element);
|
|
1982
|
+
args.selectCell(true);
|
|
1884
1983
|
const fieldDefinition = tableDefinition?.fields.find((f) => f.name === args.column.key);
|
|
1885
1984
|
const isFixedField = fixedFields?.some((f) => f.fieldName === args.column.key);
|
|
1886
1985
|
const isEditable = fieldDefinition?.editable !== false && !isFixedField;
|
|
@@ -1889,41 +1988,54 @@ var GenericDataGrid = ({
|
|
|
1889
1988
|
console.log("Is editable:", isEditable);
|
|
1890
1989
|
}, [tableDefinition, fixedFields]);
|
|
1891
1990
|
if (loading) {
|
|
1892
|
-
return /* @__PURE__ */ jsxs4(
|
|
1893
|
-
/* @__PURE__ */
|
|
1894
|
-
/* @__PURE__ */
|
|
1991
|
+
return /* @__PURE__ */ jsxs4(Box5, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: [
|
|
1992
|
+
/* @__PURE__ */ jsx12(CircularProgress, {}),
|
|
1993
|
+
/* @__PURE__ */ jsx12(Typography5, { variant: "h6", sx: { ml: 2 }, children: "Cargando tabla..." })
|
|
1895
1994
|
] });
|
|
1896
1995
|
}
|
|
1897
1996
|
if (error) {
|
|
1898
|
-
return /* @__PURE__ */
|
|
1997
|
+
return /* @__PURE__ */ jsx12(Box5, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsx12(Alert, { severity: "error", children: error.message }) });
|
|
1899
1998
|
}
|
|
1900
1999
|
if (!tableDefinition) {
|
|
1901
|
-
return /* @__PURE__ */
|
|
2000
|
+
return /* @__PURE__ */ jsx12(Box5, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsx12(Alert, { severity: "warning", children: "No se pudo cargar la definici\xF3n de la tabla." }) });
|
|
1902
2001
|
}
|
|
1903
|
-
return /* @__PURE__ */ jsxs4(
|
|
1904
|
-
/* @__PURE__ */
|
|
1905
|
-
|
|
1906
|
-
Button2,
|
|
2002
|
+
return /* @__PURE__ */ jsxs4(Box5, { sx: { pt: 2, display: "flex", flexDirection: "column", height: "100%", boxSizing: "border-box" }, children: [
|
|
2003
|
+
tableDefinition.allow?.insert && /* @__PURE__ */ jsx12(Box5, { sx: { display: "flex", px: 2, pb: 1 }, children: /* @__PURE__ */ jsx12(
|
|
2004
|
+
Button3,
|
|
1907
2005
|
{
|
|
1908
2006
|
variant: "contained",
|
|
1909
2007
|
onClick: handleAddRow,
|
|
1910
|
-
startIcon: /* @__PURE__ */
|
|
2008
|
+
startIcon: /* @__PURE__ */ jsx12(AddIcon, {}),
|
|
1911
2009
|
children: "Nuevo Registro"
|
|
1912
2010
|
}
|
|
1913
2011
|
) }),
|
|
1914
|
-
/* @__PURE__ */
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
2012
|
+
/* @__PURE__ */ jsx12(
|
|
2013
|
+
Box5,
|
|
2014
|
+
{
|
|
2015
|
+
sx: {
|
|
2016
|
+
backgroundColor: theme.palette.primary.main,
|
|
2017
|
+
color: theme.palette.primary.contrastText,
|
|
2018
|
+
padding: theme.spacing(1),
|
|
2019
|
+
textAlign: "left",
|
|
2020
|
+
fontWeight: "bold",
|
|
2021
|
+
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
2022
|
+
borderTopLeftRadius: theme.shape.borderRadius,
|
|
2023
|
+
borderTopRightRadius: theme.shape.borderRadius,
|
|
2024
|
+
ml: 2,
|
|
2025
|
+
mr: 2
|
|
2026
|
+
},
|
|
2027
|
+
children: /* @__PURE__ */ jsxs4(Typography5, { variant: "subtitle1", component: "div", children: [
|
|
2028
|
+
cambiarGuionesBajosPorEspacios(tableDefinition.title || tableDefinition.name),
|
|
2029
|
+
" - mostrando ",
|
|
2030
|
+
getFilteredRowCount() === getRowCount() ? `${getRowCount()} registros` : `${getFilteredRowCount()} registros filtrados`
|
|
2031
|
+
] })
|
|
2032
|
+
}
|
|
2033
|
+
),
|
|
2034
|
+
/* @__PURE__ */ jsx12(
|
|
2035
|
+
Box5,
|
|
1923
2036
|
{
|
|
1924
2037
|
sx: {
|
|
1925
|
-
flexGrow:
|
|
1926
|
-
height: showNoRowsMessage ? "150px" : "100%",
|
|
2038
|
+
flexGrow: 1,
|
|
1927
2039
|
boxSizing: "border-box",
|
|
1928
2040
|
position: "relative",
|
|
1929
2041
|
overflowX: "auto",
|
|
@@ -1931,54 +2043,33 @@ var GenericDataGrid = ({
|
|
|
1931
2043
|
px: 2,
|
|
1932
2044
|
pb: 2
|
|
1933
2045
|
},
|
|
1934
|
-
children:
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
Box4,
|
|
1959
|
-
{
|
|
1960
|
-
sx: {
|
|
1961
|
-
position: "absolute",
|
|
1962
|
-
top: isFilterRowVisible ? "70px" : "36px",
|
|
1963
|
-
left: (theme2) => theme2.spacing(2),
|
|
1964
|
-
right: (theme2) => theme2.spacing(2),
|
|
1965
|
-
bottom: (theme2) => theme2.spacing(2),
|
|
1966
|
-
display: "flex",
|
|
1967
|
-
justifyContent: "center",
|
|
1968
|
-
alignItems: "center",
|
|
1969
|
-
backgroundColor: "rgba(255, 255, 255, 0.9)",
|
|
1970
|
-
color: (theme2) => theme2.palette.text.secondary,
|
|
1971
|
-
border: (theme2) => `1px solid ${theme2.palette.divider}`,
|
|
1972
|
-
borderRadius: "4px",
|
|
1973
|
-
zIndex: 1
|
|
1974
|
-
},
|
|
1975
|
-
children: /* @__PURE__ */ jsx9(Typography5, { variant: "h6", children: "No hay filas para mostrar." })
|
|
1976
|
-
}
|
|
1977
|
-
)
|
|
1978
|
-
]
|
|
2046
|
+
children: /* @__PURE__ */ jsx12(
|
|
2047
|
+
DataGrid,
|
|
2048
|
+
{
|
|
2049
|
+
ref: dataGridRef,
|
|
2050
|
+
columns,
|
|
2051
|
+
rows: filteredRows.map((row) => ({
|
|
2052
|
+
...row,
|
|
2053
|
+
style: exitingRowIds.has(getPrimaryKeyValues(row, primaryKey)) ? { maxHeight: 0, opacity: 0, overflow: "hidden" } : { maxHeight: "35px", opacity: 1 }
|
|
2054
|
+
})),
|
|
2055
|
+
enableVirtualization: true,
|
|
2056
|
+
rowKeyGetter: (row) => getPrimaryKeyValues(row, primaryKey),
|
|
2057
|
+
onSelectedRowsChange: setSelectedRows,
|
|
2058
|
+
onSelectedCellChange: handleSelectedCellChange,
|
|
2059
|
+
onRowsChange: handleRowsChange,
|
|
2060
|
+
selectedRows,
|
|
2061
|
+
rowHeight: (row) => row[DETAIL_ROW_INDICATOR] ? 400 : 35,
|
|
2062
|
+
style: { height: "100%", width: "100%", boxSizing: "border-box" },
|
|
2063
|
+
headerRowHeight: 35,
|
|
2064
|
+
topSummaryRows: isFilterRowVisible ? [{ id: "filterRow" }] : void 0,
|
|
2065
|
+
summaryRowHeight: isFilterRowVisible ? 35 : 0,
|
|
2066
|
+
renderers: { noRowsFallback: /* @__PURE__ */ jsx12(EmptyRowsRenderer, {}) },
|
|
2067
|
+
onCellClick: handleCellClick
|
|
2068
|
+
}
|
|
2069
|
+
)
|
|
1979
2070
|
}
|
|
1980
2071
|
),
|
|
1981
|
-
/* @__PURE__ */
|
|
2072
|
+
/* @__PURE__ */ jsx12(
|
|
1982
2073
|
ConfirmDialog,
|
|
1983
2074
|
{
|
|
1984
2075
|
open: openConfirmDialog,
|
|
@@ -1999,15 +2090,15 @@ import { BrowserRouter, Routes, Route, useLocation as useLocation4, Navigate as
|
|
|
1999
2090
|
import { useEffect as useEffect3 } from "react";
|
|
2000
2091
|
import { Outlet } from "react-router-dom";
|
|
2001
2092
|
import {
|
|
2002
|
-
Box as
|
|
2093
|
+
Box as Box8,
|
|
2003
2094
|
AppBar,
|
|
2004
2095
|
Toolbar,
|
|
2005
2096
|
Typography as Typography8,
|
|
2006
|
-
Button as
|
|
2097
|
+
Button as Button4,
|
|
2007
2098
|
Drawer,
|
|
2008
2099
|
CssBaseline,
|
|
2009
|
-
IconButton as
|
|
2010
|
-
useTheme as
|
|
2100
|
+
IconButton as IconButton3,
|
|
2101
|
+
useTheme as useTheme4,
|
|
2011
2102
|
useMediaQuery
|
|
2012
2103
|
} from "@mui/material";
|
|
2013
2104
|
|
|
@@ -2015,7 +2106,7 @@ import {
|
|
|
2015
2106
|
import { createContext as createContext2, useContext as useContext2, useState as useState5, useEffect as useEffect2, useCallback as useCallback5, useMemo as useMemo3 } from "react";
|
|
2016
2107
|
import { useNavigate } from "react-router-dom";
|
|
2017
2108
|
import { useSelector as useSelector2, useDispatch as useDispatch2 } from "react-redux";
|
|
2018
|
-
import { jsx as
|
|
2109
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
2019
2110
|
var AuthContext = createContext2(void 0);
|
|
2020
2111
|
var useApp = () => {
|
|
2021
2112
|
const context = useContext2(AuthContext);
|
|
@@ -2083,7 +2174,7 @@ var AppProvider = ({ children }) => {
|
|
|
2083
2174
|
showSessionExpiredMessage,
|
|
2084
2175
|
setShowSessionExpiredMessage
|
|
2085
2176
|
]);
|
|
2086
|
-
return /* @__PURE__ */
|
|
2177
|
+
return /* @__PURE__ */ jsx13(AuthContext.Provider, { value: authContextValue, children });
|
|
2087
2178
|
};
|
|
2088
2179
|
|
|
2089
2180
|
// src/components/MainLayout.tsx
|
|
@@ -2092,7 +2183,7 @@ import MenuIcon from "@mui/icons-material/Menu";
|
|
|
2092
2183
|
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
2093
2184
|
|
|
2094
2185
|
// src/components/SideMenu.tsx
|
|
2095
|
-
import { List, ListItem, ListItemButton, ListItemIcon, ListItemText, Divider, Box as
|
|
2186
|
+
import { List, ListItem, ListItemButton, ListItemIcon, ListItemText, Divider, Box as Box7, Typography as Typography7, Collapse } from "@mui/material";
|
|
2096
2187
|
import ExpandLess from "@mui/icons-material/ExpandLess";
|
|
2097
2188
|
import ExpandMore from "@mui/icons-material/ExpandMore";
|
|
2098
2189
|
import TableChartIcon from "@mui/icons-material/TableChart";
|
|
@@ -2107,30 +2198,30 @@ import { useNavigate as useNavigate2, useLocation } from "react-router-dom";
|
|
|
2107
2198
|
import { blue, orange, teal, red, grey } from "@mui/material/colors";
|
|
2108
2199
|
|
|
2109
2200
|
// src/pages/WScreens.tsx
|
|
2110
|
-
import { Box as
|
|
2201
|
+
import { Box as Box6, Typography as Typography6, Paper } from "@mui/material";
|
|
2111
2202
|
import ConstructionIcon from "@mui/icons-material/Construction";
|
|
2112
2203
|
import WarningAmberIcon2 from "@mui/icons-material/WarningAmber";
|
|
2113
|
-
import { jsx as
|
|
2204
|
+
import { jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2114
2205
|
var MyCustomDashboard = ({ screenName }) => {
|
|
2115
|
-
return /* @__PURE__ */
|
|
2206
|
+
return /* @__PURE__ */ jsx14(Box6, { sx: { p: 4, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", height: "100%" }, children: /* @__PURE__ */ jsxs5(Paper, { elevation: 3, sx: { p: 4, textAlign: "center", maxWidth: 600 }, children: [
|
|
2116
2207
|
/* @__PURE__ */ jsxs5(Typography6, { variant: "h5", component: "h1", gutterBottom: true, children: [
|
|
2117
2208
|
"\xA1Bienvenido a tu WScreen: ",
|
|
2118
2209
|
screenName,
|
|
2119
2210
|
"!"
|
|
2120
2211
|
] }),
|
|
2121
|
-
/* @__PURE__ */
|
|
2122
|
-
/* @__PURE__ */
|
|
2212
|
+
/* @__PURE__ */ jsx14(Typography6, { variant: "body1", color: "text.secondary", children: "Esta es una pantalla de interfaz de usuario personalizada." }),
|
|
2213
|
+
/* @__PURE__ */ jsx14(Box6, { sx: { mt: 3 }, children: /* @__PURE__ */ jsx14(ConstructionIcon, { sx: { fontSize: 80, color: "primary.main" } }) })
|
|
2123
2214
|
] }) });
|
|
2124
2215
|
};
|
|
2125
2216
|
var FallbackWScreen = ({ screenName }) => {
|
|
2126
|
-
return /* @__PURE__ */
|
|
2127
|
-
/* @__PURE__ */
|
|
2217
|
+
return /* @__PURE__ */ jsx14(Box6, { sx: { p: 4, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", height: "100%" }, children: /* @__PURE__ */ jsxs5(Paper, { elevation: 3, sx: { p: 4, textAlign: "center", maxWidth: 600, backgroundColor: "warning.light", border: "1px solid orange" }, children: [
|
|
2218
|
+
/* @__PURE__ */ jsx14(Typography6, { variant: "h5", component: "h1", gutterBottom: true, color: "warning.dark", children: "WScreen No Implementada" }),
|
|
2128
2219
|
/* @__PURE__ */ jsxs5(Typography6, { variant: "body1", color: "warning.dark", children: [
|
|
2129
2220
|
'No se encontr\xF3 un componente implementado para la **WScreen**: **`"$',
|
|
2130
2221
|
screenName,
|
|
2131
2222
|
'"`**. 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.'
|
|
2132
2223
|
] }),
|
|
2133
|
-
/* @__PURE__ */
|
|
2224
|
+
/* @__PURE__ */ jsx14(Box6, { sx: { mt: 3 }, children: /* @__PURE__ */ jsx14(WarningAmberIcon2, { sx: { fontSize: 80, color: "warning.dark" } }) })
|
|
2134
2225
|
] }) });
|
|
2135
2226
|
};
|
|
2136
2227
|
var wScreens = {
|
|
@@ -2141,7 +2232,7 @@ var wScreens = {
|
|
|
2141
2232
|
var WScreens_default = FallbackWScreen;
|
|
2142
2233
|
|
|
2143
2234
|
// src/components/SideMenu.tsx
|
|
2144
|
-
import { Fragment
|
|
2235
|
+
import { Fragment, jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2145
2236
|
var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
2146
2237
|
const navigate = useNavigate2();
|
|
2147
2238
|
const location = useLocation();
|
|
@@ -2182,17 +2273,17 @@ var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
|
2182
2273
|
const getIcon = (item2) => {
|
|
2183
2274
|
switch (item2.menuType) {
|
|
2184
2275
|
case "table":
|
|
2185
|
-
return /* @__PURE__ */
|
|
2276
|
+
return /* @__PURE__ */ jsx15(TableChartIcon, { sx: { color: blue[700] } });
|
|
2186
2277
|
case "proc":
|
|
2187
|
-
return /* @__PURE__ */
|
|
2278
|
+
return /* @__PURE__ */ jsx15(DnsIcon, { sx: { color: teal[700] } });
|
|
2188
2279
|
case "menu":
|
|
2189
|
-
return /* @__PURE__ */
|
|
2280
|
+
return /* @__PURE__ */ jsx15(FolderIcon, { sx: { color: orange[800] } });
|
|
2190
2281
|
default:
|
|
2191
2282
|
const WScreenComponent = wScreens[item2.menuType];
|
|
2192
2283
|
if (WScreenComponent !== void 0) {
|
|
2193
|
-
return /* @__PURE__ */
|
|
2284
|
+
return /* @__PURE__ */ jsx15(DesktopWindowsIcon, { sx: { color: grey[700] } });
|
|
2194
2285
|
}
|
|
2195
|
-
return /* @__PURE__ */
|
|
2286
|
+
return /* @__PURE__ */ jsx15(WarningAmberIcon3, { sx: { color: red[500] } });
|
|
2196
2287
|
}
|
|
2197
2288
|
};
|
|
2198
2289
|
const currentPath = location.pathname;
|
|
@@ -2204,7 +2295,7 @@ var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
|
2204
2295
|
} else {
|
|
2205
2296
|
isSelected = currentPath.startsWith(`/wScreens/${item.menuType}`) || currentPath.startsWith(`/wScreens-fallback/${item.menuType}`);
|
|
2206
2297
|
}
|
|
2207
|
-
return /* @__PURE__ */ jsxs6(
|
|
2298
|
+
return /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
2208
2299
|
/* @__PURE__ */ jsxs6(
|
|
2209
2300
|
ListItemButton,
|
|
2210
2301
|
{
|
|
@@ -2212,13 +2303,13 @@ var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
|
2212
2303
|
sx: { pl: level * 2 },
|
|
2213
2304
|
selected: isSelected,
|
|
2214
2305
|
children: [
|
|
2215
|
-
/* @__PURE__ */
|
|
2216
|
-
/* @__PURE__ */
|
|
2217
|
-
item.menuType === "menu" ? open ? /* @__PURE__ */
|
|
2306
|
+
/* @__PURE__ */ jsx15(ListItemIcon, { sx: { minWidth: "38px" }, children: getIcon(item) }),
|
|
2307
|
+
/* @__PURE__ */ jsx15(ListItemText, { primary: item.label || item.name }),
|
|
2308
|
+
item.menuType === "menu" ? open ? /* @__PURE__ */ jsx15(ExpandLess, {}) : /* @__PURE__ */ jsx15(ExpandMore, {}) : null
|
|
2218
2309
|
]
|
|
2219
2310
|
}
|
|
2220
2311
|
),
|
|
2221
|
-
item.menuType === "menu" && /* @__PURE__ */
|
|
2312
|
+
item.menuType === "menu" && /* @__PURE__ */ jsx15(Collapse, { in: open, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ jsx15(List, { component: "div", disablePadding: true, children: item.menuContent.map((subItem) => /* @__PURE__ */ jsx15(
|
|
2222
2313
|
MenuListItem,
|
|
2223
2314
|
{
|
|
2224
2315
|
item: subItem,
|
|
@@ -2248,22 +2339,22 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
2248
2339
|
dispatch(setAllSubMenusOpen(!isMostlyOpen));
|
|
2249
2340
|
};
|
|
2250
2341
|
if (!clientContext || !clientContext.menu) {
|
|
2251
|
-
return /* @__PURE__ */
|
|
2342
|
+
return /* @__PURE__ */ jsx15(Box7, { sx: { p: 2, textAlign: "center" }, children: /* @__PURE__ */ jsx15(Typography7, { variant: "body2", color: "text.secondary", children: "Cargando men\xFA..." }) });
|
|
2252
2343
|
}
|
|
2253
2344
|
const isHomeSelected = location.pathname === "/home";
|
|
2254
|
-
return /* @__PURE__ */ jsxs6(
|
|
2255
|
-
clientContext.menu.some((item) => item.menuType === "menu") && /* @__PURE__ */
|
|
2256
|
-
/* @__PURE__ */
|
|
2257
|
-
/* @__PURE__ */
|
|
2345
|
+
return /* @__PURE__ */ jsxs6(Box7, { sx: { width: "100%", flexShrink: 0 }, children: [
|
|
2346
|
+
clientContext.menu.some((item) => item.menuType === "menu") && /* @__PURE__ */ jsx15(ListItem, { disablePadding: true, children: /* @__PURE__ */ jsxs6(ListItemButton, { onClick: handleToggleAllSubMenus, children: [
|
|
2347
|
+
/* @__PURE__ */ jsx15(ListItemIcon, { sx: { minWidth: "38px" }, children: isMostlyOpen ? /* @__PURE__ */ jsx15(UnfoldLessIcon, {}) : /* @__PURE__ */ jsx15(UnfoldMoreIcon, {}) }),
|
|
2348
|
+
/* @__PURE__ */ jsx15(ListItemText, { primary: isMostlyOpen ? "colapsar " : "expandir" })
|
|
2258
2349
|
] }) }),
|
|
2259
|
-
/* @__PURE__ */
|
|
2350
|
+
/* @__PURE__ */ jsx15(Divider, {}),
|
|
2260
2351
|
/* @__PURE__ */ jsxs6(List, { children: [
|
|
2261
|
-
/* @__PURE__ */
|
|
2262
|
-
/* @__PURE__ */
|
|
2263
|
-
/* @__PURE__ */
|
|
2352
|
+
/* @__PURE__ */ jsx15(ListItem, { disablePadding: true, children: /* @__PURE__ */ jsxs6(ListItemButton, { onClick: handleHomeClick, selected: isHomeSelected, children: [
|
|
2353
|
+
/* @__PURE__ */ jsx15(ListItemIcon, { sx: { minWidth: "38px" }, children: /* @__PURE__ */ jsx15(HomeIcon, {}) }),
|
|
2354
|
+
/* @__PURE__ */ jsx15(ListItemText, { primary: "Inicio" })
|
|
2264
2355
|
] }) }),
|
|
2265
|
-
/* @__PURE__ */
|
|
2266
|
-
clientContext.menu.map((menuItem) => /* @__PURE__ */
|
|
2356
|
+
/* @__PURE__ */ jsx15(Divider, {}),
|
|
2357
|
+
clientContext.menu.map((menuItem) => /* @__PURE__ */ jsx15(
|
|
2267
2358
|
MenuListItem,
|
|
2268
2359
|
{
|
|
2269
2360
|
item: menuItem,
|
|
@@ -2306,14 +2397,14 @@ var useLogout = () => {
|
|
|
2306
2397
|
var useLogout_default = useLogout;
|
|
2307
2398
|
|
|
2308
2399
|
// src/components/MainLayout.tsx
|
|
2309
|
-
import { jsx as
|
|
2400
|
+
import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2310
2401
|
var drawerWidth = 240;
|
|
2311
2402
|
var MainLayout = () => {
|
|
2312
2403
|
const { clientContext } = useApp();
|
|
2313
2404
|
const logout = useLogout_default();
|
|
2314
2405
|
const isDrawerOpen = useIsDrawerOpen();
|
|
2315
2406
|
const dispatch = useAppDispatch();
|
|
2316
|
-
const theme =
|
|
2407
|
+
const theme = useTheme4();
|
|
2317
2408
|
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
|
2318
2409
|
useEffect3(() => {
|
|
2319
2410
|
if (isMobile && isDrawerOpen) {
|
|
@@ -2329,12 +2420,12 @@ var MainLayout = () => {
|
|
|
2329
2420
|
}
|
|
2330
2421
|
};
|
|
2331
2422
|
if (!clientContext) {
|
|
2332
|
-
return /* @__PURE__ */
|
|
2423
|
+
return /* @__PURE__ */ jsx16(Box8, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ jsx16(Typography8, { children: "Cargando dise\xF1o de la aplicaci\xF3n..." }) });
|
|
2333
2424
|
}
|
|
2334
2425
|
const appBarOffset = theme.mixins.toolbar;
|
|
2335
|
-
return /* @__PURE__ */ jsxs7(
|
|
2336
|
-
/* @__PURE__ */
|
|
2337
|
-
/* @__PURE__ */
|
|
2426
|
+
return /* @__PURE__ */ jsxs7(Box8, { sx: { display: "flex", height: "100vh" }, children: [
|
|
2427
|
+
/* @__PURE__ */ jsx16(CssBaseline, {}),
|
|
2428
|
+
/* @__PURE__ */ jsx16(
|
|
2338
2429
|
AppBar,
|
|
2339
2430
|
{
|
|
2340
2431
|
position: "fixed",
|
|
@@ -2354,8 +2445,8 @@ var MainLayout = () => {
|
|
|
2354
2445
|
}
|
|
2355
2446
|
},
|
|
2356
2447
|
children: /* @__PURE__ */ jsxs7(Toolbar, { children: [
|
|
2357
|
-
/* @__PURE__ */
|
|
2358
|
-
|
|
2448
|
+
/* @__PURE__ */ jsx16(
|
|
2449
|
+
IconButton3,
|
|
2359
2450
|
{
|
|
2360
2451
|
color: "inherit",
|
|
2361
2452
|
"aria-label": "open drawer",
|
|
@@ -2364,17 +2455,17 @@ var MainLayout = () => {
|
|
|
2364
2455
|
sx: {
|
|
2365
2456
|
marginRight: 2.2
|
|
2366
2457
|
},
|
|
2367
|
-
children: isDrawerOpen ? /* @__PURE__ */
|
|
2458
|
+
children: isDrawerOpen ? /* @__PURE__ */ jsx16(ChevronLeftIcon, {}) : /* @__PURE__ */ jsx16(MenuIcon, {})
|
|
2368
2459
|
}
|
|
2369
2460
|
),
|
|
2370
|
-
/* @__PURE__ */
|
|
2371
|
-
/* @__PURE__ */
|
|
2372
|
-
/* @__PURE__ */
|
|
2373
|
-
|
|
2461
|
+
/* @__PURE__ */ jsx16(Typography8, { variant: "h6", noWrap: true, component: "div", sx: { flexGrow: 1 }, children: isDrawerOpen ? "" : clientContext.config.title }),
|
|
2462
|
+
/* @__PURE__ */ jsx16(Typography8, { variant: "subtitle1", component: "div", sx: { mr: 2 }, children: clientContext.username }),
|
|
2463
|
+
/* @__PURE__ */ jsx16(
|
|
2464
|
+
Button4,
|
|
2374
2465
|
{
|
|
2375
2466
|
color: "inherit",
|
|
2376
2467
|
onClick: logout,
|
|
2377
|
-
startIcon: /* @__PURE__ */
|
|
2468
|
+
startIcon: /* @__PURE__ */ jsx16(LogoutIcon, {}),
|
|
2378
2469
|
children: "Salir"
|
|
2379
2470
|
}
|
|
2380
2471
|
)
|
|
@@ -2398,7 +2489,7 @@ var MainLayout = () => {
|
|
|
2398
2489
|
}
|
|
2399
2490
|
},
|
|
2400
2491
|
children: [
|
|
2401
|
-
/* @__PURE__ */
|
|
2492
|
+
/* @__PURE__ */ jsx16(
|
|
2402
2493
|
Toolbar,
|
|
2403
2494
|
{
|
|
2404
2495
|
sx: {
|
|
@@ -2412,12 +2503,12 @@ var MainLayout = () => {
|
|
|
2412
2503
|
children: isDrawerOpen ? clientContext.config.title : ""
|
|
2413
2504
|
}
|
|
2414
2505
|
),
|
|
2415
|
-
/* @__PURE__ */
|
|
2506
|
+
/* @__PURE__ */ jsx16(SideMenu_default, { onMenuItemClick: handleDrawerCloseMobile })
|
|
2416
2507
|
]
|
|
2417
2508
|
}
|
|
2418
2509
|
),
|
|
2419
|
-
/* @__PURE__ */
|
|
2420
|
-
|
|
2510
|
+
/* @__PURE__ */ jsx16(
|
|
2511
|
+
Box8,
|
|
2421
2512
|
{
|
|
2422
2513
|
component: "main",
|
|
2423
2514
|
sx: {
|
|
@@ -2444,7 +2535,7 @@ var MainLayout = () => {
|
|
|
2444
2535
|
flexDirection: "column",
|
|
2445
2536
|
width: isDrawerOpen ? `calc(100% - ${drawerWidth}px)` : "100%"
|
|
2446
2537
|
},
|
|
2447
|
-
children: /* @__PURE__ */
|
|
2538
|
+
children: /* @__PURE__ */ jsx16(Outlet, {})
|
|
2448
2539
|
}
|
|
2449
2540
|
)
|
|
2450
2541
|
] });
|
|
@@ -2452,9 +2543,9 @@ var MainLayout = () => {
|
|
|
2452
2543
|
var MainLayout_default = MainLayout;
|
|
2453
2544
|
|
|
2454
2545
|
// src/components/SessionExpiredMessage.tsx
|
|
2455
|
-
import { Box as
|
|
2546
|
+
import { Box as Box9, Typography as Typography9, Button as Button5, Modal } from "@mui/material";
|
|
2456
2547
|
import { useNavigate as useNavigate4 } from "react-router-dom";
|
|
2457
|
-
import { jsx as
|
|
2548
|
+
import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2458
2549
|
var style = {
|
|
2459
2550
|
position: "absolute",
|
|
2460
2551
|
top: "50%",
|
|
@@ -2476,7 +2567,7 @@ var SessionExpiredMessage = () => {
|
|
|
2476
2567
|
setIsLoggedIn(false);
|
|
2477
2568
|
navigate("/login", { replace: true });
|
|
2478
2569
|
};
|
|
2479
|
-
return /* @__PURE__ */
|
|
2570
|
+
return /* @__PURE__ */ jsx17(
|
|
2480
2571
|
Modal,
|
|
2481
2572
|
{
|
|
2482
2573
|
open: showSessionExpiredMessage,
|
|
@@ -2496,10 +2587,10 @@ var SessionExpiredMessage = () => {
|
|
|
2496
2587
|
}
|
|
2497
2588
|
}
|
|
2498
2589
|
},
|
|
2499
|
-
children: /* @__PURE__ */ jsxs8(
|
|
2500
|
-
/* @__PURE__ */
|
|
2501
|
-
/* @__PURE__ */
|
|
2502
|
-
/* @__PURE__ */
|
|
2590
|
+
children: /* @__PURE__ */ jsxs8(Box9, { sx: style, children: [
|
|
2591
|
+
/* @__PURE__ */ jsx17(Typography9, { id: "session-expired-modal-title", variant: "h6", component: "h2", gutterBottom: true, children: "\xA1Sesi\xF3n Expirada!" }),
|
|
2592
|
+
/* @__PURE__ */ jsx17(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." }),
|
|
2593
|
+
/* @__PURE__ */ jsx17(Button5, { variant: "contained", color: "primary", onClick: handleClose, children: "Ir al Login" })
|
|
2503
2594
|
] })
|
|
2504
2595
|
}
|
|
2505
2596
|
);
|
|
@@ -2507,27 +2598,27 @@ var SessionExpiredMessage = () => {
|
|
|
2507
2598
|
var SessionExpiredMessage_default = SessionExpiredMessage;
|
|
2508
2599
|
|
|
2509
2600
|
// src/pages/HomePage.tsx
|
|
2510
|
-
import { Box as
|
|
2511
|
-
import { jsx as
|
|
2601
|
+
import { Box as Box10, Typography as Typography10 } from "@mui/material";
|
|
2602
|
+
import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2512
2603
|
var HomePage = () => {
|
|
2513
2604
|
const { clientContext } = useApp();
|
|
2514
|
-
return /* @__PURE__ */ jsxs9(
|
|
2515
|
-
/* @__PURE__ */
|
|
2516
|
-
/* @__PURE__ */
|
|
2605
|
+
return /* @__PURE__ */ jsxs9(Box10, { sx: { p: 3 }, children: [
|
|
2606
|
+
/* @__PURE__ */ jsx18(Typography10, { variant: "h4", component: "h1", gutterBottom: true, children: `Bienvenido/a ${clientContext?.username}` }),
|
|
2607
|
+
/* @__PURE__ */ jsx18(Typography10, { variant: "body1", children: "Usa el men\xFA lateral para navegar por las diferentes secciones." })
|
|
2517
2608
|
] });
|
|
2518
2609
|
};
|
|
2519
2610
|
var HomePage_default = HomePage;
|
|
2520
2611
|
|
|
2521
2612
|
// src/pages/LogoutPage.tsx
|
|
2522
2613
|
import { useEffect as useEffect4 } from "react";
|
|
2523
|
-
import { Box as
|
|
2524
|
-
import { jsx as
|
|
2614
|
+
import { Box as Box11, Typography as Typography11, CircularProgress as CircularProgress2 } from "@mui/material";
|
|
2615
|
+
import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2525
2616
|
var LogoutPage = () => {
|
|
2526
2617
|
const logout = useLogout_default();
|
|
2527
2618
|
useEffect4(() => {
|
|
2528
2619
|
logout();
|
|
2529
2620
|
}, [logout]);
|
|
2530
|
-
return /* @__PURE__ */ jsxs10(
|
|
2621
|
+
return /* @__PURE__ */ jsxs10(Box11, { sx: {
|
|
2531
2622
|
display: "flex",
|
|
2532
2623
|
flexDirection: "column",
|
|
2533
2624
|
justifyContent: "center",
|
|
@@ -2535,21 +2626,21 @@ var LogoutPage = () => {
|
|
|
2535
2626
|
height: "100vh",
|
|
2536
2627
|
textAlign: "center"
|
|
2537
2628
|
}, children: [
|
|
2538
|
-
/* @__PURE__ */
|
|
2539
|
-
/* @__PURE__ */
|
|
2629
|
+
/* @__PURE__ */ jsx19(CircularProgress2, { size: 60 }),
|
|
2630
|
+
/* @__PURE__ */ jsx19(Typography11, { variant: "h6", sx: { mt: 2 }, children: "Cerrando sesi\xF3n..." })
|
|
2540
2631
|
] });
|
|
2541
2632
|
};
|
|
2542
2633
|
var LogoutPage_default = LogoutPage;
|
|
2543
2634
|
|
|
2544
2635
|
// src/pages/LoginPage.tsx
|
|
2545
2636
|
import { useState as useState6 } from "react";
|
|
2546
|
-
import { Button as
|
|
2637
|
+
import { Button as Button6, TextField, Typography as Typography12, Alert as Alert2, AlertTitle, Box as Box12, CircularProgress as CircularProgress3 } from "@mui/material";
|
|
2547
2638
|
import { useForm, Controller } from "react-hook-form";
|
|
2548
2639
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
2549
2640
|
import * as z from "zod";
|
|
2550
2641
|
import { useNavigate as useNavigate5 } from "react-router-dom";
|
|
2551
2642
|
import { useDispatch as useDispatch4 } from "react-redux";
|
|
2552
|
-
import { Fragment as
|
|
2643
|
+
import { Fragment as Fragment2, jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2553
2644
|
var loginSchema = z.object({
|
|
2554
2645
|
username: z.string().min(1, "El usuario es requerido"),
|
|
2555
2646
|
// Añadir validación básica
|
|
@@ -2605,8 +2696,8 @@ var LoginPage = () => {
|
|
|
2605
2696
|
setIsSubmitting(false);
|
|
2606
2697
|
}
|
|
2607
2698
|
};
|
|
2608
|
-
return /* @__PURE__ */
|
|
2609
|
-
|
|
2699
|
+
return /* @__PURE__ */ jsx20(
|
|
2700
|
+
Box12,
|
|
2610
2701
|
{
|
|
2611
2702
|
display: "flex",
|
|
2612
2703
|
alignItems: "center",
|
|
@@ -2614,7 +2705,7 @@ var LoginPage = () => {
|
|
|
2614
2705
|
minHeight: "100vh",
|
|
2615
2706
|
bgcolor: "#f5f5f5",
|
|
2616
2707
|
children: /* @__PURE__ */ jsxs11(
|
|
2617
|
-
|
|
2708
|
+
Box12,
|
|
2618
2709
|
{
|
|
2619
2710
|
width: "100%",
|
|
2620
2711
|
maxWidth: "400px",
|
|
@@ -2623,16 +2714,16 @@ var LoginPage = () => {
|
|
|
2623
2714
|
borderRadius: 8,
|
|
2624
2715
|
boxShadow: 3,
|
|
2625
2716
|
children: [
|
|
2626
|
-
/* @__PURE__ */
|
|
2717
|
+
/* @__PURE__ */ jsx20(Typography12, { variant: "h5", align: "center", gutterBottom: true, children: "Iniciar Sesi\xF3n" }),
|
|
2627
2718
|
/* @__PURE__ */ jsxs11("form", { onSubmit: handleSubmit(onSubmit), className: "space-y-4", children: [
|
|
2628
2719
|
/* @__PURE__ */ jsxs11("div", { children: [
|
|
2629
|
-
/* @__PURE__ */
|
|
2630
|
-
/* @__PURE__ */
|
|
2720
|
+
/* @__PURE__ */ jsx20("label", { htmlFor: "username", children: /* @__PURE__ */ jsx20(Typography12, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Usuario" }) }),
|
|
2721
|
+
/* @__PURE__ */ jsx20(
|
|
2631
2722
|
Controller,
|
|
2632
2723
|
{
|
|
2633
2724
|
name: "username",
|
|
2634
2725
|
control,
|
|
2635
|
-
render: ({ field }) => /* @__PURE__ */
|
|
2726
|
+
render: ({ field }) => /* @__PURE__ */ jsx20(
|
|
2636
2727
|
TextField,
|
|
2637
2728
|
{
|
|
2638
2729
|
...field,
|
|
@@ -2649,13 +2740,13 @@ var LoginPage = () => {
|
|
|
2649
2740
|
)
|
|
2650
2741
|
] }),
|
|
2651
2742
|
/* @__PURE__ */ jsxs11("div", { children: [
|
|
2652
|
-
/* @__PURE__ */
|
|
2653
|
-
/* @__PURE__ */
|
|
2743
|
+
/* @__PURE__ */ jsx20("label", { htmlFor: "password", children: /* @__PURE__ */ jsx20(Typography12, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Contrase\xF1a" }) }),
|
|
2744
|
+
/* @__PURE__ */ jsx20(
|
|
2654
2745
|
Controller,
|
|
2655
2746
|
{
|
|
2656
2747
|
name: "password",
|
|
2657
2748
|
control,
|
|
2658
|
-
render: ({ field }) => /* @__PURE__ */
|
|
2749
|
+
render: ({ field }) => /* @__PURE__ */ jsx20(
|
|
2659
2750
|
TextField,
|
|
2660
2751
|
{
|
|
2661
2752
|
...field,
|
|
@@ -2671,14 +2762,14 @@ var LoginPage = () => {
|
|
|
2671
2762
|
}
|
|
2672
2763
|
)
|
|
2673
2764
|
] }),
|
|
2674
|
-
/* @__PURE__ */
|
|
2675
|
-
/* @__PURE__ */
|
|
2765
|
+
/* @__PURE__ */ jsx20(Button6, { type: "submit", fullWidth: true, variant: "contained", color: "primary", disabled: isSubmitting, sx: { mt: 2 }, children: isSubmitting ? /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
2766
|
+
/* @__PURE__ */ jsx20(CircularProgress3, { size: 20, sx: { mr: 1 } }),
|
|
2676
2767
|
"Iniciando sesi\xF3n..."
|
|
2677
2768
|
] }) : "Iniciar Sesi\xF3n" })
|
|
2678
2769
|
] }),
|
|
2679
2770
|
loginError && /* @__PURE__ */ jsxs11(Alert2, { severity: "error", sx: { mt: 2, maxHeight: "200px" }, children: [
|
|
2680
2771
|
" ",
|
|
2681
|
-
/* @__PURE__ */
|
|
2772
|
+
/* @__PURE__ */ jsx20(AlertTitle, { children: "Error" }),
|
|
2682
2773
|
loginError
|
|
2683
2774
|
] })
|
|
2684
2775
|
]
|
|
@@ -2694,7 +2785,7 @@ import React7, { useState as useState7, useCallback as useCallback7, useMemo as
|
|
|
2694
2785
|
import { useParams } from "react-router-dom";
|
|
2695
2786
|
import {
|
|
2696
2787
|
TextField as TextField2,
|
|
2697
|
-
Button as
|
|
2788
|
+
Button as Button7,
|
|
2698
2789
|
FormControl,
|
|
2699
2790
|
InputLabel,
|
|
2700
2791
|
Select,
|
|
@@ -2703,7 +2794,7 @@ import {
|
|
|
2703
2794
|
FormControlLabel,
|
|
2704
2795
|
FormHelperText,
|
|
2705
2796
|
Typography as Typography14,
|
|
2706
|
-
Box as
|
|
2797
|
+
Box as Box14,
|
|
2707
2798
|
CircularProgress as CircularProgress4,
|
|
2708
2799
|
Alert as Alert3,
|
|
2709
2800
|
Divider as Divider2,
|
|
@@ -2711,14 +2802,14 @@ import {
|
|
|
2711
2802
|
} from "@mui/material";
|
|
2712
2803
|
|
|
2713
2804
|
// src/pages/procedure-results/SuccessDisplay.tsx
|
|
2714
|
-
import { Box as
|
|
2715
|
-
import { jsx as
|
|
2805
|
+
import { Box as Box13, Typography as Typography13, Paper as Paper2 } from "@mui/material";
|
|
2806
|
+
import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2716
2807
|
var SuccessDisplay = ({ data }) => {
|
|
2717
2808
|
return /* @__PURE__ */ jsxs12(Paper2, { elevation: 2, sx: { p: 2, mt: 2, bgcolor: "success.light", color: "success.contrastText" }, children: [
|
|
2718
|
-
/* @__PURE__ */
|
|
2719
|
-
/* @__PURE__ */
|
|
2720
|
-
/* @__PURE__ */
|
|
2721
|
-
/* @__PURE__ */
|
|
2809
|
+
/* @__PURE__ */ jsx21(Typography13, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: "\xA1Operaci\xF3n Exitosa!" }),
|
|
2810
|
+
/* @__PURE__ */ jsx21(Typography13, { variant: "body2", sx: { fontSize: "0.85rem" }, children: "Detalles del resultado:" }),
|
|
2811
|
+
/* @__PURE__ */ jsx21(Box13, { sx: { bgcolor: "success.dark", p: 1, borderRadius: 1, mt: 1, overflowX: "auto" }, children: /* @__PURE__ */ jsx21("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(data, null, 2) }) }),
|
|
2812
|
+
/* @__PURE__ */ jsx21(Typography13, { variant: "body2", sx: { fontSize: "0.8rem", mt: 1 }, children: "Puedes revisar los detalles anteriores o cerrar este mensaje." })
|
|
2722
2813
|
] });
|
|
2723
2814
|
};
|
|
2724
2815
|
var SuccessDisplay_default = SuccessDisplay;
|
|
@@ -2732,7 +2823,7 @@ var extendResultsOk = (newComponents) => {
|
|
|
2732
2823
|
};
|
|
2733
2824
|
|
|
2734
2825
|
// src/components/ProcedureForm.tsx
|
|
2735
|
-
import { jsx as
|
|
2826
|
+
import { jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2736
2827
|
var ProcedureForm = () => {
|
|
2737
2828
|
const { procedureName } = useParams();
|
|
2738
2829
|
const { clientContext } = useApp();
|
|
@@ -2948,7 +3039,7 @@ var ProcedureForm = () => {
|
|
|
2948
3039
|
};
|
|
2949
3040
|
if (param.options && param.options.length > 0) {
|
|
2950
3041
|
return /* @__PURE__ */ jsxs13(FormControl, { fullWidth: true, margin: "dense", size: "small", error: hasError, required: commonProps.required, children: [
|
|
2951
|
-
/* @__PURE__ */
|
|
3042
|
+
/* @__PURE__ */ jsx22(InputLabel, { id: `${param.name}-label`, sx: { fontSize: "0.8rem" }, children: param.label || param.name }),
|
|
2952
3043
|
/* @__PURE__ */ jsxs13(
|
|
2953
3044
|
Select,
|
|
2954
3045
|
{
|
|
@@ -2960,14 +3051,14 @@ var ProcedureForm = () => {
|
|
|
2960
3051
|
label: param.label || param.name,
|
|
2961
3052
|
disabled: apiLoading,
|
|
2962
3053
|
sx: { fontSize: "0.8rem" },
|
|
2963
|
-
renderValue: (selected) => /* @__PURE__ */
|
|
3054
|
+
renderValue: (selected) => /* @__PURE__ */ jsx22(Typography14, { sx: { fontSize: "0.8rem" }, children: selected }),
|
|
2964
3055
|
children: [
|
|
2965
|
-
(!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */
|
|
2966
|
-
param.options.map((option) => /* @__PURE__ */
|
|
3056
|
+
(!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */ jsx22(MenuItem, { value: "", sx: { fontSize: "0.8rem" }, children: /* @__PURE__ */ jsx22("em", { children: "Seleccione..." }) }),
|
|
3057
|
+
param.options.map((option) => /* @__PURE__ */ jsx22(MenuItem, { value: option, sx: { fontSize: "0.8rem" }, children: option }, option))
|
|
2967
3058
|
]
|
|
2968
3059
|
}
|
|
2969
3060
|
),
|
|
2970
|
-
(param.description || errorMessage) && /* @__PURE__ */
|
|
3061
|
+
(param.description || errorMessage) && /* @__PURE__ */ jsx22(FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
|
|
2971
3062
|
] });
|
|
2972
3063
|
}
|
|
2973
3064
|
switch (param.typeName) {
|
|
@@ -2976,18 +3067,18 @@ var ProcedureForm = () => {
|
|
|
2976
3067
|
case "tsrange":
|
|
2977
3068
|
case "time_range":
|
|
2978
3069
|
case "daterange":
|
|
2979
|
-
return /* @__PURE__ */
|
|
3070
|
+
return /* @__PURE__ */ jsx22(TextField2, { type: "text", value: formValues[param.name] || "", ...commonProps });
|
|
2980
3071
|
case "decimal":
|
|
2981
3072
|
case "double":
|
|
2982
|
-
return /* @__PURE__ */
|
|
3073
|
+
return /* @__PURE__ */ jsx22(TextField2, { type: "number", inputProps: { step: "any", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
|
|
2983
3074
|
case "integer":
|
|
2984
3075
|
case "bigint":
|
|
2985
|
-
return /* @__PURE__ */
|
|
3076
|
+
return /* @__PURE__ */ jsx22(TextField2, { type: "number", inputProps: { step: "1", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
|
|
2986
3077
|
case "boolean":
|
|
2987
|
-
return /* @__PURE__ */
|
|
3078
|
+
return /* @__PURE__ */ jsx22(
|
|
2988
3079
|
FormControlLabel,
|
|
2989
3080
|
{
|
|
2990
|
-
control: /* @__PURE__ */
|
|
3081
|
+
control: /* @__PURE__ */ jsx22(
|
|
2991
3082
|
Checkbox,
|
|
2992
3083
|
{
|
|
2993
3084
|
checked: !!formValues[param.name],
|
|
@@ -2998,21 +3089,21 @@ var ProcedureForm = () => {
|
|
|
2998
3089
|
size: "small"
|
|
2999
3090
|
}
|
|
3000
3091
|
),
|
|
3001
|
-
label: /* @__PURE__ */
|
|
3092
|
+
label: /* @__PURE__ */ jsx22(Typography14, { sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "inherit" }, children: param.label || param.name }),
|
|
3002
3093
|
sx: { mt: 1, mb: 0 }
|
|
3003
3094
|
}
|
|
3004
3095
|
);
|
|
3005
3096
|
case "date":
|
|
3006
3097
|
case "timestamp":
|
|
3007
3098
|
case "time":
|
|
3008
|
-
return /* @__PURE__ */
|
|
3099
|
+
return /* @__PURE__ */ jsx22(TextField2, { type: param.typeName === "date" ? "date" : param.typeName === "timestamp" ? "datetime-local" : "time", value: formValues[param.name] || "", ...commonProps, InputLabelProps: { shrink: true, sx: { fontSize: "0.8rem" } } });
|
|
3009
3100
|
case "jsonb":
|
|
3010
3101
|
case "jsona":
|
|
3011
|
-
return /* @__PURE__ */
|
|
3102
|
+
return /* @__PURE__ */ jsx22(TextField2, { multiline: true, rows: 5, value: formValues[param.name] || "", ...commonProps, InputProps: { sx: { fontSize: "0.8rem" } } });
|
|
3012
3103
|
case "bytea":
|
|
3013
3104
|
return /* @__PURE__ */ jsxs13(FormControl, { fullWidth: true, margin: "dense", error: hasError, required: commonProps.required, children: [
|
|
3014
|
-
/* @__PURE__ */
|
|
3015
|
-
/* @__PURE__ */
|
|
3105
|
+
/* @__PURE__ */ jsx22(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 }),
|
|
3106
|
+
/* @__PURE__ */ jsx22(
|
|
3016
3107
|
"input",
|
|
3017
3108
|
{
|
|
3018
3109
|
type: "file",
|
|
@@ -3026,17 +3117,17 @@ var ProcedureForm = () => {
|
|
|
3026
3117
|
style: { padding: "6px 0", fontSize: "0.8rem" }
|
|
3027
3118
|
}
|
|
3028
3119
|
),
|
|
3029
|
-
(param.description || errorMessage) && /* @__PURE__ */
|
|
3120
|
+
(param.description || errorMessage) && /* @__PURE__ */ jsx22(FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
|
|
3030
3121
|
] });
|
|
3031
3122
|
default:
|
|
3032
|
-
return /* @__PURE__ */
|
|
3123
|
+
return /* @__PURE__ */ jsx22(TextField2, { type: "text", value: formValues[param.name] || "", ...commonProps });
|
|
3033
3124
|
}
|
|
3034
3125
|
}, [formValues, handleChange, apiLoading, validationErrors]);
|
|
3035
3126
|
const ResultDisplayContent = useMemo4(() => {
|
|
3036
3127
|
if (!procedureResultData || !procedure?.resultOk) return null;
|
|
3037
3128
|
const ComponentToRender = resultsOk[procedure.resultOk];
|
|
3038
3129
|
if (ComponentToRender) {
|
|
3039
|
-
return /* @__PURE__ */
|
|
3130
|
+
return /* @__PURE__ */ jsx22(ComponentToRender, { data: procedureResultData });
|
|
3040
3131
|
} else {
|
|
3041
3132
|
return /* @__PURE__ */ jsxs13(Paper3, { elevation: 2, sx: { p: 2, mt: 0, bgcolor: "warning.light" }, children: [
|
|
3042
3133
|
/* @__PURE__ */ jsxs13(Typography14, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: [
|
|
@@ -3044,16 +3135,16 @@ var ProcedureForm = () => {
|
|
|
3044
3135
|
procedure.resultOk,
|
|
3045
3136
|
"' definido en el procedure no existe o no est\xE1 mapeado."
|
|
3046
3137
|
] }),
|
|
3047
|
-
/* @__PURE__ */
|
|
3138
|
+
/* @__PURE__ */ jsx22(Box14, { sx: {
|
|
3048
3139
|
bgcolor: "warning.dark",
|
|
3049
3140
|
p: 1,
|
|
3050
3141
|
borderRadius: 1
|
|
3051
|
-
}, children: /* @__PURE__ */
|
|
3142
|
+
}, children: /* @__PURE__ */ jsx22("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(procedureResultData, null, 2) }) })
|
|
3052
3143
|
] });
|
|
3053
3144
|
}
|
|
3054
3145
|
}, [procedureResultData, procedure]);
|
|
3055
3146
|
if (!procedure) {
|
|
3056
|
-
return /* @__PURE__ */ jsxs13(
|
|
3147
|
+
return /* @__PURE__ */ jsxs13(Box14, { sx: {
|
|
3057
3148
|
p: 2,
|
|
3058
3149
|
width: "100%",
|
|
3059
3150
|
boxSizing: "border-box",
|
|
@@ -3063,13 +3154,13 @@ var ProcedureForm = () => {
|
|
|
3063
3154
|
boxShadow: 3,
|
|
3064
3155
|
textAlign: "center"
|
|
3065
3156
|
}, children: [
|
|
3066
|
-
/* @__PURE__ */
|
|
3067
|
-
/* @__PURE__ */
|
|
3157
|
+
/* @__PURE__ */ jsx22(CircularProgress4, { sx: { mb: 2 } }),
|
|
3158
|
+
/* @__PURE__ */ jsx22(Typography14, { variant: "h6", color: "text.secondary", children: "Cargando procedimiento o no encontrado..." })
|
|
3068
3159
|
] });
|
|
3069
3160
|
}
|
|
3070
3161
|
return (
|
|
3071
3162
|
// Esta es la Box más externa que ahora controlará el scroll
|
|
3072
|
-
/* @__PURE__ */ jsxs13(
|
|
3163
|
+
/* @__PURE__ */ jsxs13(Box14, { sx: {
|
|
3073
3164
|
p: 2,
|
|
3074
3165
|
ml: 1,
|
|
3075
3166
|
mt: 2,
|
|
@@ -3086,17 +3177,17 @@ var ProcedureForm = () => {
|
|
|
3086
3177
|
overflowX: "hidden"
|
|
3087
3178
|
// Oculta el scroll horizontal si no es necesario para el contenedor principal
|
|
3088
3179
|
}, children: [
|
|
3089
|
-
/* @__PURE__ */
|
|
3180
|
+
/* @__PURE__ */ jsx22(Typography14, { variant: "h5", component: "h2", gutterBottom: true, align: "left", children: cambiarGuionesBajosPorEspacios(procedure.proceedLabel || procedure.action) }),
|
|
3090
3181
|
Object.values(validationErrors).some((err) => err !== null) && /* @__PURE__ */ jsxs13(Alert3, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: [
|
|
3091
3182
|
"Por favor, corrige los errores en el formulario antes de enviar.",
|
|
3092
|
-
/* @__PURE__ */
|
|
3183
|
+
/* @__PURE__ */ jsx22("ul", { children: Object.values(validationErrors).map((err, idx) => err && /* @__PURE__ */ jsx22("li", { children: err }, idx)) })
|
|
3093
3184
|
] }),
|
|
3094
|
-
!Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */
|
|
3095
|
-
!Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */
|
|
3185
|
+
!Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */ jsx22(Alert3, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: apiError.message }),
|
|
3186
|
+
!Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */ jsx22(Alert3, { severity: "success", sx: { mb: 2, fontSize: "0.8rem" }, children: successMessage }),
|
|
3096
3187
|
/* @__PURE__ */ jsxs13("form", { onSubmit: handleSubmit, children: [
|
|
3097
|
-
procedure.parameters.map((param) => /* @__PURE__ */
|
|
3098
|
-
/* @__PURE__ */
|
|
3099
|
-
|
|
3188
|
+
procedure.parameters.map((param) => /* @__PURE__ */ jsx22("div", { children: renderInputField(param) }, param.name)),
|
|
3189
|
+
/* @__PURE__ */ jsx22(
|
|
3190
|
+
Button7,
|
|
3100
3191
|
{
|
|
3101
3192
|
type: "submit",
|
|
3102
3193
|
variant: "contained",
|
|
@@ -3104,20 +3195,20 @@ var ProcedureForm = () => {
|
|
|
3104
3195
|
disabled: apiLoading || Object.values(validationErrors).some((err) => err !== null),
|
|
3105
3196
|
sx: { mt: 2 },
|
|
3106
3197
|
size: "medium",
|
|
3107
|
-
startIcon: apiLoading ? /* @__PURE__ */
|
|
3198
|
+
startIcon: apiLoading ? /* @__PURE__ */ jsx22(CircularProgress4, { size: 20, color: "inherit" }) : null,
|
|
3108
3199
|
children: apiLoading ? "Ejecutando..." : procedure.proceedLabel || "Ejecutar"
|
|
3109
3200
|
}
|
|
3110
3201
|
)
|
|
3111
3202
|
] }),
|
|
3112
|
-
ResultDisplayContent && /* @__PURE__ */ jsxs13(
|
|
3203
|
+
ResultDisplayContent && /* @__PURE__ */ jsxs13(Box14, { sx: { mt: 2 }, children: [
|
|
3113
3204
|
" ",
|
|
3114
3205
|
ResultDisplayContent
|
|
3115
3206
|
] }),
|
|
3116
|
-
executionLog.length > 0 && /* @__PURE__ */ jsxs13(
|
|
3117
|
-
/* @__PURE__ */
|
|
3118
|
-
/* @__PURE__ */
|
|
3119
|
-
/* @__PURE__ */
|
|
3120
|
-
|
|
3207
|
+
executionLog.length > 0 && /* @__PURE__ */ jsxs13(Box14, { sx: { mt: 3 }, children: [
|
|
3208
|
+
/* @__PURE__ */ jsx22(Divider2, { sx: { mb: 2 } }),
|
|
3209
|
+
/* @__PURE__ */ jsx22(Typography14, { variant: "h6", gutterBottom: true, sx: { fontSize: "0.9rem" }, children: "Registro de Ejecuci\xF3n" }),
|
|
3210
|
+
/* @__PURE__ */ jsx22(
|
|
3211
|
+
Box14,
|
|
3121
3212
|
{
|
|
3122
3213
|
sx: {
|
|
3123
3214
|
bgcolor: "grey.100",
|
|
@@ -3130,7 +3221,7 @@ var ProcedureForm = () => {
|
|
|
3130
3221
|
fontSize: "0.75rem",
|
|
3131
3222
|
whiteSpace: "pre-wrap"
|
|
3132
3223
|
},
|
|
3133
|
-
children: executionLog.map((log, index) => /* @__PURE__ */
|
|
3224
|
+
children: executionLog.map((log, index) => /* @__PURE__ */ jsx22(
|
|
3134
3225
|
Typography14,
|
|
3135
3226
|
{
|
|
3136
3227
|
component: "pre",
|
|
@@ -3158,7 +3249,7 @@ import { PersistGate } from "redux-persist/integration/react";
|
|
|
3158
3249
|
// src/components/PrivateRoute.tsx
|
|
3159
3250
|
import { useEffect as useEffect5 } from "react";
|
|
3160
3251
|
import { Navigate, useLocation as useLocation2 } from "react-router-dom";
|
|
3161
|
-
import { Fragment as
|
|
3252
|
+
import { Fragment as Fragment3, jsx as jsx23 } from "react/jsx-runtime";
|
|
3162
3253
|
var PrivateRoute = ({ children }) => {
|
|
3163
3254
|
const location = useLocation2();
|
|
3164
3255
|
const dispatch = useAppDispatch();
|
|
@@ -3182,14 +3273,14 @@ var PrivateRoute = ({ children }) => {
|
|
|
3182
3273
|
}, [isAuthenticated, isLoadingAuth, location, dispatch, clientContextStatus]);
|
|
3183
3274
|
if (isLoadingAuth) {
|
|
3184
3275
|
console.log(`[PrivateRoute] Returning loading state...`);
|
|
3185
|
-
return /* @__PURE__ */
|
|
3276
|
+
return /* @__PURE__ */ jsx23("p", { children: "Verificando autenticaci\xF3n..." });
|
|
3186
3277
|
}
|
|
3187
3278
|
if (!isAuthenticated) {
|
|
3188
3279
|
console.log(`[PrivateRoute] User not authenticated, navigating to /login`);
|
|
3189
|
-
return /* @__PURE__ */
|
|
3280
|
+
return /* @__PURE__ */ jsx23(Navigate, { to: "/login", replace: true });
|
|
3190
3281
|
}
|
|
3191
3282
|
console.log(`[PrivateRoute] User authenticated, rendering children.`);
|
|
3192
|
-
return /* @__PURE__ */
|
|
3283
|
+
return /* @__PURE__ */ jsx23(Fragment3, { children });
|
|
3193
3284
|
};
|
|
3194
3285
|
var PrivateRoute_default = PrivateRoute;
|
|
3195
3286
|
|
|
@@ -3223,25 +3314,25 @@ var InitialRedirectHandler_default = InitialRedirectHandler;
|
|
|
3223
3314
|
|
|
3224
3315
|
// src/pages/GenericDataGridPage.tsx
|
|
3225
3316
|
import { useParams as useParams2 } from "react-router-dom";
|
|
3226
|
-
import { Box as
|
|
3227
|
-
import { jsx as
|
|
3317
|
+
import { Box as Box15, Alert as Alert4, Typography as Typography15 } from "@mui/material";
|
|
3318
|
+
import { jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3228
3319
|
var GenericDataGridPage = () => {
|
|
3229
3320
|
const { tableName } = useParams2();
|
|
3230
3321
|
if (!tableName) {
|
|
3231
|
-
return /* @__PURE__ */
|
|
3232
|
-
/* @__PURE__ */
|
|
3233
|
-
/* @__PURE__ */
|
|
3322
|
+
return /* @__PURE__ */ jsx24(Box15, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsxs14(Alert4, { severity: "error", children: [
|
|
3323
|
+
/* @__PURE__ */ jsx24(Typography15, { variant: "h6", children: "Error: Nombre de tabla no especificado en la URL." }),
|
|
3324
|
+
/* @__PURE__ */ jsx24(Typography15, { variant: "body1", children: "Por favor, aseg\xFArate de que la URL contenga el nombre de la tabla (ej. `/data/users`)." })
|
|
3234
3325
|
] }) });
|
|
3235
3326
|
}
|
|
3236
|
-
return /* @__PURE__ */
|
|
3327
|
+
return /* @__PURE__ */ jsx24(GenericDataGrid_default, { tableName, fixedFields: [] });
|
|
3237
3328
|
};
|
|
3238
3329
|
var GenericDataGridPage_default = GenericDataGridPage;
|
|
3239
3330
|
|
|
3240
3331
|
// src/pages/MenuTablePage.tsx
|
|
3241
3332
|
import { useMemo as useMemo5 } from "react";
|
|
3242
3333
|
import { useParams as useParams3 } from "react-router-dom";
|
|
3243
|
-
import { Box as
|
|
3244
|
-
import { jsx as
|
|
3334
|
+
import { Box as Box16, Alert as Alert5, Typography as Typography16 } from "@mui/material";
|
|
3335
|
+
import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3245
3336
|
var MenuTablePage = () => {
|
|
3246
3337
|
const { menuName } = useParams3();
|
|
3247
3338
|
const { clientContext } = useApp();
|
|
@@ -3283,12 +3374,12 @@ var MenuTablePage = () => {
|
|
|
3283
3374
|
};
|
|
3284
3375
|
}, [menuName, clientContext]);
|
|
3285
3376
|
if (!currentTableName) {
|
|
3286
|
-
return /* @__PURE__ */
|
|
3287
|
-
/* @__PURE__ */
|
|
3288
|
-
/* @__PURE__ */
|
|
3377
|
+
return /* @__PURE__ */ jsx25(Box16, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsxs15(Alert5, { severity: "error", children: [
|
|
3378
|
+
/* @__PURE__ */ jsx25(Typography16, { variant: "h6", children: "Error: No se pudo cargar la informaci\xF3n de la tabla." }),
|
|
3379
|
+
/* @__PURE__ */ jsx25(Typography16, { variant: "body1", children: "Verifique la configuraci\xF3n del men\xFA o el nombre de la tabla en la URL." })
|
|
3289
3380
|
] }) });
|
|
3290
3381
|
}
|
|
3291
|
-
return /* @__PURE__ */
|
|
3382
|
+
return /* @__PURE__ */ jsx25(
|
|
3292
3383
|
GenericDataGrid_default,
|
|
3293
3384
|
{
|
|
3294
3385
|
tableName: currentTableName,
|
|
@@ -3299,7 +3390,7 @@ var MenuTablePage = () => {
|
|
|
3299
3390
|
var MenuTablePage_default = MenuTablePage;
|
|
3300
3391
|
|
|
3301
3392
|
// src/App.tsx
|
|
3302
|
-
import { jsx as
|
|
3393
|
+
import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3303
3394
|
var LocationTracker = () => {
|
|
3304
3395
|
const location = useLocation4();
|
|
3305
3396
|
const dispatch = useAppDispatch();
|
|
@@ -3311,18 +3402,18 @@ var LocationTracker = () => {
|
|
|
3311
3402
|
function FrontendPlusReactRoutes({ myRoutes, myWScreens }) {
|
|
3312
3403
|
const allWScreens = { ...wScreens, ...myWScreens || {} };
|
|
3313
3404
|
return /* @__PURE__ */ jsxs16(Routes, { children: [
|
|
3314
|
-
/* @__PURE__ */
|
|
3315
|
-
/* @__PURE__ */
|
|
3405
|
+
/* @__PURE__ */ jsx26(Route, { path: "/login", element: /* @__PURE__ */ jsx26(LoginPage_default, {}) }),
|
|
3406
|
+
/* @__PURE__ */ jsx26(Route, { path: "/logout", element: /* @__PURE__ */ jsx26(LogoutPage_default, {}) }),
|
|
3316
3407
|
/* @__PURE__ */ jsxs16(Route, { element: /* @__PURE__ */ jsxs16(PrivateRoute_default, { children: [
|
|
3317
|
-
/* @__PURE__ */
|
|
3318
|
-
/* @__PURE__ */
|
|
3408
|
+
/* @__PURE__ */ jsx26(InitialRedirectHandler_default, {}),
|
|
3409
|
+
/* @__PURE__ */ jsx26(MainLayout_default, {})
|
|
3319
3410
|
] }), children: [
|
|
3320
|
-
/* @__PURE__ */
|
|
3321
|
-
/* @__PURE__ */
|
|
3322
|
-
/* @__PURE__ */
|
|
3323
|
-
/* @__PURE__ */
|
|
3324
|
-
/* @__PURE__ */
|
|
3325
|
-
Object.keys(allWScreens).map((screenName) => /* @__PURE__ */
|
|
3411
|
+
/* @__PURE__ */ jsx26(Route, { path: "/", element: /* @__PURE__ */ jsx26(HomePage_default, {}) }),
|
|
3412
|
+
/* @__PURE__ */ jsx26(Route, { path: "/home", element: /* @__PURE__ */ jsx26(HomePage_default, {}) }),
|
|
3413
|
+
/* @__PURE__ */ jsx26(Route, { path: "/table/:tableName", element: /* @__PURE__ */ jsx26(GenericDataGridPage_default, {}) }),
|
|
3414
|
+
/* @__PURE__ */ jsx26(Route, { path: "/menu/:menuName", element: /* @__PURE__ */ jsx26(MenuTablePage_default, {}) }),
|
|
3415
|
+
/* @__PURE__ */ jsx26(Route, { path: "/procedures/:procedureName", element: /* @__PURE__ */ jsx26(ProcedureForm_default, {}) }),
|
|
3416
|
+
Object.keys(allWScreens).map((screenName) => /* @__PURE__ */ jsx26(
|
|
3326
3417
|
Route,
|
|
3327
3418
|
{
|
|
3328
3419
|
path: `/wScreens/${screenName}`,
|
|
@@ -3330,17 +3421,17 @@ function FrontendPlusReactRoutes({ myRoutes, myWScreens }) {
|
|
|
3330
3421
|
},
|
|
3331
3422
|
screenName
|
|
3332
3423
|
)),
|
|
3333
|
-
/* @__PURE__ */
|
|
3424
|
+
/* @__PURE__ */ jsx26(
|
|
3334
3425
|
Route,
|
|
3335
3426
|
{
|
|
3336
3427
|
path: "/wScreens-fallback/:screenName",
|
|
3337
|
-
element: /* @__PURE__ */
|
|
3428
|
+
element: /* @__PURE__ */ jsx26(WScreens_default, { screenName: ":screenName" })
|
|
3338
3429
|
}
|
|
3339
3430
|
),
|
|
3340
|
-
/* @__PURE__ */
|
|
3431
|
+
/* @__PURE__ */ jsx26(Route, { path: "*", element: /* @__PURE__ */ jsx26("div", { style: { marginTop: "20px", marginLeft: "10px" }, children: "404 - Recurso No Encontrado" }) })
|
|
3341
3432
|
] }),
|
|
3342
3433
|
myRoutes,
|
|
3343
|
-
/* @__PURE__ */
|
|
3434
|
+
/* @__PURE__ */ jsx26(Route, { path: "*", element: /* @__PURE__ */ jsx26(Navigate2, { to: "/", replace: true }) })
|
|
3344
3435
|
] });
|
|
3345
3436
|
}
|
|
3346
3437
|
var App = ({
|
|
@@ -3357,17 +3448,17 @@ var App = ({
|
|
|
3357
3448
|
extendResultsOk(myResultsOk);
|
|
3358
3449
|
}
|
|
3359
3450
|
}, [myClientSides, myResultsOk]);
|
|
3360
|
-
return /* @__PURE__ */
|
|
3361
|
-
/* @__PURE__ */
|
|
3362
|
-
/* @__PURE__ */
|
|
3363
|
-
/* @__PURE__ */
|
|
3451
|
+
return /* @__PURE__ */ jsx26(Provider, { store, children: /* @__PURE__ */ jsx26(PersistGate, { loading: null, persistor, children: /* @__PURE__ */ jsxs16(BrowserRouter, { children: [
|
|
3452
|
+
/* @__PURE__ */ jsx26(LocationTracker, {}),
|
|
3453
|
+
/* @__PURE__ */ jsx26(AppProvider, { children: /* @__PURE__ */ jsxs16(SnackbarProvider, { children: [
|
|
3454
|
+
/* @__PURE__ */ jsx26(
|
|
3364
3455
|
FrontendPlusReactRoutes,
|
|
3365
3456
|
{
|
|
3366
3457
|
myRoutes,
|
|
3367
3458
|
myWScreens
|
|
3368
3459
|
}
|
|
3369
3460
|
),
|
|
3370
|
-
/* @__PURE__ */
|
|
3461
|
+
/* @__PURE__ */ jsx26(SessionExpiredMessage_default, {})
|
|
3371
3462
|
] }) })
|
|
3372
3463
|
] }) }) });
|
|
3373
3464
|
};
|