frontend-plus-react 0.1.4 → 0.1.6
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 +267 -153
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +347 -233
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/index.d.cts +0 -200
- package/dist/index.d.ts +0 -200
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,14 +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 Box5,
|
|
788
|
-
Alert,
|
|
789
|
-
useTheme as useTheme2,
|
|
790
|
-
Button as Button3
|
|
791
|
-
} from "@mui/material";
|
|
789
|
+
import { CircularProgress, Typography as Typography5, Box as Box7, Alert, useTheme as useTheme3 } from "@mui/material";
|
|
792
790
|
|
|
793
791
|
// src/utils/functions.tsx
|
|
794
792
|
var JSON4all = __toESM(require_json4all(), 1);
|
|
@@ -988,9 +986,18 @@ var useRedirectPath = () => {
|
|
|
988
986
|
|
|
989
987
|
// src/utils/functions.tsx
|
|
990
988
|
var cambiarGuionesBajosPorEspacios = (texto) => texto.replace(/_/g, " ");
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
989
|
+
var getDetailTableAndFixedFieldsForDetailTableAbr = (tableDefinition, detailTableAbr, row) => {
|
|
990
|
+
const detailTable = tableDefinition.detailTables.find((dt) => dt.abr === detailTableAbr);
|
|
991
|
+
let fixedFields = [];
|
|
992
|
+
detailTable.fields.forEach((field) => {
|
|
993
|
+
if (typeof field === "string") {
|
|
994
|
+
fixedFields.push({ fieldName: field, value: row[field] });
|
|
995
|
+
} else {
|
|
996
|
+
fixedFields.push({ fieldName: field.target, value: row[field.source] });
|
|
997
|
+
}
|
|
998
|
+
});
|
|
999
|
+
return { detailTable, fixedFields };
|
|
1000
|
+
};
|
|
994
1001
|
|
|
995
1002
|
// src/components/ConfirmDialog.tsx
|
|
996
1003
|
import Dialog from "@mui/material/Dialog";
|
|
@@ -1024,7 +1031,8 @@ var ConfirmDialog = ({ open, onClose, title, message }) => {
|
|
|
1024
1031
|
import { Box, IconButton, Tooltip, Typography } from "@mui/material";
|
|
1025
1032
|
import SearchIcon from "@mui/icons-material/Search";
|
|
1026
1033
|
import SearchOffIcon from "@mui/icons-material/SearchOff";
|
|
1027
|
-
import
|
|
1034
|
+
import MoreVertIcon from "@mui/icons-material/MoreVert";
|
|
1035
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1028
1036
|
var defaultColumnHeaderCellRenderer = (props, fieldDef) => {
|
|
1029
1037
|
const { column } = props;
|
|
1030
1038
|
const isPrimaryKey = fieldDef.isPk;
|
|
@@ -1047,7 +1055,7 @@ var defaultColumnHeaderCellRenderer = (props, fieldDef) => {
|
|
|
1047
1055
|
sx: {
|
|
1048
1056
|
fontWeight: "bold",
|
|
1049
1057
|
textDecoration: isPrimaryKey ? "underline" : "none",
|
|
1050
|
-
fontSize: "
|
|
1058
|
+
fontSize: "o.930rem"
|
|
1051
1059
|
// Puedes ajustar el tamaño si es necesario
|
|
1052
1060
|
},
|
|
1053
1061
|
children: column.name
|
|
@@ -1056,17 +1064,30 @@ var defaultColumnHeaderCellRenderer = (props, fieldDef) => {
|
|
|
1056
1064
|
}
|
|
1057
1065
|
);
|
|
1058
1066
|
};
|
|
1059
|
-
var actionsColumnHeaderCellRenderer = (props, isFilterRowVisible, toggleFilterVisibility) => /* @__PURE__ */
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1067
|
+
var actionsColumnHeaderCellRenderer = (props, isFilterRowVisible, toggleFilterVisibility) => /* @__PURE__ */ jsxs3(Box, { sx: { display: "flex", flexDirection: "row", alignItems: "center", justifyContent: "center", gap: 0.2 }, children: [
|
|
1068
|
+
/* @__PURE__ */ jsx3(
|
|
1069
|
+
IconButton,
|
|
1070
|
+
{
|
|
1071
|
+
color: "inherit",
|
|
1072
|
+
onClick: toggleFilterVisibility,
|
|
1073
|
+
size: "small",
|
|
1074
|
+
title: isFilterRowVisible ? "Ocultar filtros" : "Mostrar filtros",
|
|
1075
|
+
sx: { p: 0.25 },
|
|
1076
|
+
children: isFilterRowVisible ? /* @__PURE__ */ jsx3(SearchOffIcon, { sx: { fontSize: 18 } }) : /* @__PURE__ */ jsx3(SearchIcon, { sx: { fontSize: 18 } })
|
|
1077
|
+
}
|
|
1078
|
+
),
|
|
1079
|
+
/* @__PURE__ */ jsx3(
|
|
1080
|
+
IconButton,
|
|
1081
|
+
{
|
|
1082
|
+
onClick: () => {
|
|
1083
|
+
},
|
|
1084
|
+
size: "small",
|
|
1085
|
+
title: "Opciones de esta tabla",
|
|
1086
|
+
sx: { p: 0.25 },
|
|
1087
|
+
children: /* @__PURE__ */ jsx3(MoreVertIcon, { sx: { fontSize: 20, variant: "filled", size: "small" } })
|
|
1088
|
+
}
|
|
1089
|
+
)
|
|
1090
|
+
] });
|
|
1070
1091
|
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() }) });
|
|
1071
1092
|
|
|
1072
1093
|
// src/components/grid/FilterInputRender.tsx
|
|
@@ -1087,6 +1108,7 @@ function FilterInputRenderer({
|
|
|
1087
1108
|
}),
|
|
1088
1109
|
sx: {
|
|
1089
1110
|
width: "100%",
|
|
1111
|
+
height: 25,
|
|
1090
1112
|
margin: "0",
|
|
1091
1113
|
border: "1px solid #ccc",
|
|
1092
1114
|
borderRadius: "4px",
|
|
@@ -1101,35 +1123,38 @@ function FilterInputRenderer({
|
|
|
1101
1123
|
var FilterInputRender_default = FilterInputRenderer;
|
|
1102
1124
|
|
|
1103
1125
|
// src/components/grid/renderers/summaryCellRenderers.tsx
|
|
1126
|
+
import { Box as Box2 } from "@mui/material";
|
|
1104
1127
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1105
1128
|
var defaultColumnSummaryCellRenderer = (props, fixedFields, isFilterRowVisible, filters, setFilters) => {
|
|
1106
1129
|
const { column } = props;
|
|
1107
1130
|
const fixedFieldEntry = fixedFields?.find((f) => f.fieldName === column.key);
|
|
1108
1131
|
if (fixedFieldEntry && fixedFieldEntry.until === void 0 || !isFilterRowVisible) return null;
|
|
1109
|
-
return /* @__PURE__ */ jsx5(
|
|
1132
|
+
return /* @__PURE__ */ jsx5(Box2, { children: /* @__PURE__ */ jsx5(
|
|
1110
1133
|
FilterInputRender_default,
|
|
1111
1134
|
{
|
|
1112
1135
|
column,
|
|
1113
1136
|
filters,
|
|
1114
1137
|
setFilters
|
|
1115
1138
|
}
|
|
1116
|
-
);
|
|
1139
|
+
) });
|
|
1117
1140
|
};
|
|
1118
1141
|
var actionsColumnSummaryCellRenderer = (props) => null;
|
|
1119
1142
|
var detailColumnCellSummaryRenderer = (props) => null;
|
|
1120
1143
|
|
|
1121
1144
|
// src/components/grid/renderers/cellRenderers.tsx
|
|
1122
|
-
import { Box as
|
|
1145
|
+
import { Box as Box5, Button as Button2, IconButton as IconButton2, Tooltip as Tooltip3, Typography as Typography4, useTheme } from "@mui/material";
|
|
1123
1146
|
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
|
|
1124
1147
|
import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
|
|
1148
|
+
import ViewHeadlineIcon from "@mui/icons-material/ViewHeadline";
|
|
1125
1149
|
import DeleteIcon from "@mui/icons-material/Delete";
|
|
1150
|
+
import AddIcon from "@mui/icons-material/Add";
|
|
1126
1151
|
|
|
1127
1152
|
// src/components/grid/ExampleClientSideComponent.tsx
|
|
1128
|
-
import { Box as
|
|
1153
|
+
import { Box as Box3, Typography as Typography2 } from "@mui/material";
|
|
1129
1154
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1130
1155
|
var ExampleClientSideComponent = ({ row, column, fieldDefinition }) => {
|
|
1131
1156
|
const value = row[column.key];
|
|
1132
|
-
return /* @__PURE__ */ jsx6(
|
|
1157
|
+
return /* @__PURE__ */ jsx6(Box3, { sx: {
|
|
1133
1158
|
padding: 0.5,
|
|
1134
1159
|
width: "100%",
|
|
1135
1160
|
height: "100%",
|
|
@@ -1141,14 +1166,13 @@ var ExampleClientSideComponent = ({ row, column, fieldDefinition }) => {
|
|
|
1141
1166
|
var ExampleClientSideComponent_default = ExampleClientSideComponent;
|
|
1142
1167
|
|
|
1143
1168
|
// src/components/grid/FallbackClientSideRenderer.tsx
|
|
1144
|
-
import { Box as
|
|
1169
|
+
import { Box as Box4, Typography as Typography3, Tooltip as Tooltip2 } from "@mui/material";
|
|
1145
1170
|
import WarningAmberIcon from "@mui/icons-material/WarningAmber";
|
|
1146
|
-
import { jsx as jsx7, jsxs as
|
|
1171
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1147
1172
|
var FallbackClientSideRenderer = ({ column, row, fieldDefinition }) => {
|
|
1148
|
-
const value = row[column.key];
|
|
1149
1173
|
const clientSideName = fieldDefinition?.clientSide || "Desconocido";
|
|
1150
|
-
return /* @__PURE__ */ jsx7(Tooltip2, { title: `Componente clientSide '${clientSideName}' no implementado. Mostrando valor por defecto.`, children: /* @__PURE__ */
|
|
1151
|
-
|
|
1174
|
+
return /* @__PURE__ */ jsx7(Tooltip2, { title: `Componente clientSide '${clientSideName}' no implementado. Mostrando valor por defecto.`, children: /* @__PURE__ */ jsxs4(
|
|
1175
|
+
Box4,
|
|
1152
1176
|
{
|
|
1153
1177
|
sx: {
|
|
1154
1178
|
display: "flex",
|
|
@@ -1168,7 +1192,7 @@ var FallbackClientSideRenderer = ({ column, row, fieldDefinition }) => {
|
|
|
1168
1192
|
// Evita que el contenido se desborde
|
|
1169
1193
|
},
|
|
1170
1194
|
children: [
|
|
1171
|
-
/* @__PURE__ */ jsx7(Typography3, { variant: "body2", noWrap: true, sx: { flexGrow: 1 }, children:
|
|
1195
|
+
/* @__PURE__ */ jsx7(Typography3, { variant: "body2", noWrap: true, sx: { flexGrow: 1 }, children: clientSideName + " not found" }),
|
|
1172
1196
|
/* @__PURE__ */ jsx7(
|
|
1173
1197
|
WarningAmberIcon,
|
|
1174
1198
|
{
|
|
@@ -1208,24 +1232,26 @@ var allColumnsCellRenderer = (props) => {
|
|
|
1208
1232
|
const detailTableAbr = row[DETAIL_ROW_INDICATOR];
|
|
1209
1233
|
const detailColumn = column;
|
|
1210
1234
|
if (column.customType === "detail" && detailColumn.detailTable.abr === detailTableAbr) {
|
|
1211
|
-
const detailTable = detailColumn.tableDefinition
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1235
|
+
const { detailTable, fixedFields } = getDetailTableAndFixedFieldsForDetailTableAbr(detailColumn.tableDefinition, detailTableAbr, row);
|
|
1236
|
+
return /* @__PURE__ */ jsx8(
|
|
1237
|
+
Box5,
|
|
1238
|
+
{
|
|
1239
|
+
sx: {
|
|
1240
|
+
// Se eliminó el padding para que la sub-grilla se extienda por completo
|
|
1241
|
+
minHeight: "200px",
|
|
1242
|
+
width: "100%",
|
|
1243
|
+
height: "100%",
|
|
1244
|
+
//display: 'flex',
|
|
1245
|
+
//flexDirection: 'column',
|
|
1246
|
+
boxSizing: "border-box"
|
|
1247
|
+
},
|
|
1248
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
1249
|
+
onClick: (e) => e.stopPropagation(),
|
|
1250
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
1251
|
+
onDoubleClick: (e) => e.stopPropagation(),
|
|
1252
|
+
children: /* @__PURE__ */ jsx8(GenericDataGrid_default, { tableName: detailTable.table, fixedFields, gridStyles: { height: 322 } })
|
|
1218
1253
|
}
|
|
1219
|
-
|
|
1220
|
-
return /* @__PURE__ */ jsx8(Box4, { 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
|
-
}, children: /* @__PURE__ */ jsx8(GenericDataGrid_default, { tableName: detailTable.table, fixedFields }) });
|
|
1254
|
+
);
|
|
1229
1255
|
}
|
|
1230
1256
|
return void 0;
|
|
1231
1257
|
}
|
|
@@ -1256,7 +1282,7 @@ var allColumnsCellRenderer = (props) => {
|
|
|
1256
1282
|
}
|
|
1257
1283
|
}
|
|
1258
1284
|
const value = row[props.column.key];
|
|
1259
|
-
return /* @__PURE__ */ jsx8(
|
|
1285
|
+
return /* @__PURE__ */ jsx8(Tooltip3, { title: cellFeedback && cellFeedback.rowId === rowId && cellFeedback.columnKey === props.column.key ? cellFeedback?.message : "", children: /* @__PURE__ */ jsx8(Box5, { 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) }) }) });
|
|
1260
1286
|
}
|
|
1261
1287
|
case "detail": {
|
|
1262
1288
|
const detailColumn = column;
|
|
@@ -1264,10 +1290,9 @@ var allColumnsCellRenderer = (props) => {
|
|
|
1264
1290
|
const isExpanded = tableData.some(
|
|
1265
1291
|
(r) => r[DETAIL_ROW_INDICATOR] === detailTable.abr && getPrimaryKeyValues(r, primaryKey) === getPrimaryKeyValues({ ...row, [DETAIL_ROW_INDICATOR]: detailTable.abr }, primaryKey)
|
|
1266
1292
|
);
|
|
1267
|
-
return /* @__PURE__ */ jsx8(Tooltip3, { title: detailTable.label, children: /* @__PURE__ */ jsx8(
|
|
1293
|
+
return /* @__PURE__ */ jsx8(Tooltip3, { title: detailTable.label, children: /* @__PURE__ */ jsx8(Box5, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%" }, children: /* @__PURE__ */ jsx8(
|
|
1268
1294
|
IconButton2,
|
|
1269
1295
|
{
|
|
1270
|
-
size: "small",
|
|
1271
1296
|
onClick: (event) => {
|
|
1272
1297
|
let rows = [...tableData];
|
|
1273
1298
|
const rowId = getPrimaryKeyValues({ ...row, [DETAIL_ROW_INDICATOR]: detailTable.abr }, primaryKey);
|
|
@@ -1285,17 +1310,51 @@ var allColumnsCellRenderer = (props) => {
|
|
|
1285
1310
|
}
|
|
1286
1311
|
event.stopPropagation();
|
|
1287
1312
|
},
|
|
1288
|
-
title: isExpanded ? "Contraer detalle" : "Expandir detalle",
|
|
1289
|
-
sx: { p: 0.5 },
|
|
1290
1313
|
children: isExpanded ? /* @__PURE__ */ jsx8(KeyboardArrowUpIcon, { sx: { fontSize: 20 } }) : /* @__PURE__ */ jsx8(KeyboardArrowDownIcon, { sx: { fontSize: 20 } })
|
|
1291
1314
|
}
|
|
1292
1315
|
) }) });
|
|
1293
1316
|
}
|
|
1294
1317
|
case "action": {
|
|
1295
1318
|
const actionColumn = column;
|
|
1296
|
-
const { tableDefinition, handleDeleteRow } = actionColumn;
|
|
1297
|
-
|
|
1298
|
-
|
|
1319
|
+
const { tableDefinition, handleDeleteRow, handleAddRow } = actionColumn;
|
|
1320
|
+
const gridActionButtons = [
|
|
1321
|
+
{
|
|
1322
|
+
action: "insert",
|
|
1323
|
+
handler: handleAddRow,
|
|
1324
|
+
icon: AddIcon,
|
|
1325
|
+
title: "Agregar registro",
|
|
1326
|
+
color: "success"
|
|
1327
|
+
},
|
|
1328
|
+
{
|
|
1329
|
+
action: "delete",
|
|
1330
|
+
handler: handleDeleteRow,
|
|
1331
|
+
icon: DeleteIcon,
|
|
1332
|
+
title: "Eliminar registro",
|
|
1333
|
+
color: "error"
|
|
1334
|
+
},
|
|
1335
|
+
{
|
|
1336
|
+
action: "vertical-edit",
|
|
1337
|
+
handler: () => {
|
|
1338
|
+
},
|
|
1339
|
+
// implementar funcion
|
|
1340
|
+
icon: ViewHeadlineIcon,
|
|
1341
|
+
title: "Editar registro en forma de ficha",
|
|
1342
|
+
color: "primary"
|
|
1343
|
+
}
|
|
1344
|
+
];
|
|
1345
|
+
return /* @__PURE__ */ jsx8(Box5, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%", gap: 0.5 }, children: gridActionButtons.map((actionDef) => tableDefinition.allow[actionDef.action] ? /* @__PURE__ */ jsx8(
|
|
1346
|
+
Button2,
|
|
1347
|
+
{
|
|
1348
|
+
variant: "outlined",
|
|
1349
|
+
color: actionDef.color,
|
|
1350
|
+
size: "small",
|
|
1351
|
+
onClick: () => actionDef.handler(row),
|
|
1352
|
+
title: actionDef.title,
|
|
1353
|
+
sx: { width: 22, minWidth: 22, height: 22, "& .MuiButton-startIcon": { m: 0 } },
|
|
1354
|
+
children: /* @__PURE__ */ jsx8(actionDef.icon, { sx: { fontSize: 18 } })
|
|
1355
|
+
},
|
|
1356
|
+
actionDef.action
|
|
1357
|
+
) : null) });
|
|
1299
1358
|
}
|
|
1300
1359
|
default:
|
|
1301
1360
|
return void 0;
|
|
@@ -1305,7 +1364,17 @@ var allColumnsCellRenderer = (props) => {
|
|
|
1305
1364
|
// src/components/grid/InputRenderer.tsx
|
|
1306
1365
|
import { useCallback as useCallback3, useMemo, useState as useState3 } from "react";
|
|
1307
1366
|
import InputBase2 from "@mui/material/InputBase";
|
|
1367
|
+
import { useTheme as useTheme2 } from "@mui/material";
|
|
1308
1368
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1369
|
+
function findChangedValues(oldRowData, newRowData) {
|
|
1370
|
+
let changes = [];
|
|
1371
|
+
for (const key in newRowData) {
|
|
1372
|
+
if (Object.prototype.hasOwnProperty.call(oldRowData, key) && oldRowData[key] !== newRowData[key]) {
|
|
1373
|
+
changes.push(key);
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
return changes;
|
|
1377
|
+
}
|
|
1309
1378
|
function InputRenderer({
|
|
1310
1379
|
column,
|
|
1311
1380
|
row,
|
|
@@ -1313,6 +1382,7 @@ function InputRenderer({
|
|
|
1313
1382
|
tableDefinition,
|
|
1314
1383
|
onRowChange,
|
|
1315
1384
|
onClose,
|
|
1385
|
+
cellFeedback,
|
|
1316
1386
|
setCellFeedback,
|
|
1317
1387
|
onEnterPress,
|
|
1318
1388
|
setTableData,
|
|
@@ -1322,7 +1392,13 @@ function InputRenderer({
|
|
|
1322
1392
|
}) {
|
|
1323
1393
|
const tableName = tableDefinition.tableName;
|
|
1324
1394
|
const [editingValue, setEditingValue] = useState3(row[column.key]);
|
|
1395
|
+
const theme = useTheme2();
|
|
1325
1396
|
const { showSuccess, showError } = useSnackbar();
|
|
1397
|
+
const rowId = getPrimaryKeyValues(row, primaryKey);
|
|
1398
|
+
let cellBackgroundColor;
|
|
1399
|
+
if (cellFeedback && cellFeedback.rowId === rowId && cellFeedback.columnKey === column.key) {
|
|
1400
|
+
cellBackgroundColor = cellFeedback.type === "error" ? theme.palette.error.light : theme.palette.success.light;
|
|
1401
|
+
}
|
|
1326
1402
|
const initialRowId = useMemo(() => getPrimaryKeyValues(row, primaryKey), [row, primaryKey]);
|
|
1327
1403
|
const { callApi } = useApiCall();
|
|
1328
1404
|
const handleCommit = useCallback3(async (currentValue, closeEditor, focusNextCell) => {
|
|
@@ -1336,27 +1412,12 @@ function InputRenderer({
|
|
|
1336
1412
|
const isMandatoryFieldEmpty = isNewRow && isMandatoryField && (processedNewValue === null || processedNewValue === void 0 || String(processedNewValue).trim() === "");
|
|
1337
1413
|
if (processedNewValue === row[column.key] && !isNewRow && !isMandatoryFieldEmpty) {
|
|
1338
1414
|
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).");
|
|
1339
|
-
onClose(false, focusNextCell);
|
|
1340
|
-
setLocalCellChanges((prev) => {
|
|
1341
|
-
const newMap = new Map(prev);
|
|
1342
|
-
const columnKeys = newMap.get(initialRowId);
|
|
1343
|
-
if (columnKeys) {
|
|
1344
|
-
columnKeys.delete(column.key);
|
|
1345
|
-
if (columnKeys.size === 0) {
|
|
1346
|
-
newMap.delete(initialRowId);
|
|
1347
|
-
} else {
|
|
1348
|
-
newMap.set(initialRowId, columnKeys);
|
|
1349
|
-
}
|
|
1350
|
-
}
|
|
1351
|
-
return newMap;
|
|
1352
|
-
});
|
|
1353
1415
|
return;
|
|
1354
1416
|
}
|
|
1355
1417
|
const oldRowData = { ...row };
|
|
1356
1418
|
const primaryKeyValuesForBackend = tableDefinition.primaryKey.map((key) => potentialUpdatedRow[key]);
|
|
1357
1419
|
const currentRowIdBeforeUpdate = getPrimaryKeyValues(oldRowData, tableDefinition.primaryKey);
|
|
1358
1420
|
onRowChange({ ...row, [column.key]: processedNewValue }, true);
|
|
1359
|
-
onClose(true, focusNextCell);
|
|
1360
1421
|
if (isNewRow) {
|
|
1361
1422
|
const areAllMandatoryFieldsFilled = tableDefinition.fields.every((fieldDef) => {
|
|
1362
1423
|
const isMandatory = fieldDef.nullable === false || fieldDef.isPk;
|
|
@@ -1424,20 +1485,6 @@ function InputRenderer({
|
|
|
1424
1485
|
oldRow: oldRowData,
|
|
1425
1486
|
status
|
|
1426
1487
|
});
|
|
1427
|
-
setLocalCellChanges((prev) => {
|
|
1428
|
-
const newMap = new Map(prev);
|
|
1429
|
-
const columnKeys = newMap.get(initialRowId);
|
|
1430
|
-
if (columnKeys) {
|
|
1431
|
-
columnKeys.delete(column.key);
|
|
1432
|
-
if (columnKeys.size === 0) {
|
|
1433
|
-
newMap.delete(initialRowId);
|
|
1434
|
-
} else {
|
|
1435
|
-
newMap.set(initialRowId, columnKeys);
|
|
1436
|
-
}
|
|
1437
|
-
}
|
|
1438
|
-
return newMap;
|
|
1439
|
-
});
|
|
1440
|
-
showSuccess("Registro guardado exitosamente!");
|
|
1441
1488
|
let finalRowIdForFeedback;
|
|
1442
1489
|
let persistedRowData;
|
|
1443
1490
|
if (response.row && isNewRow) {
|
|
@@ -1460,15 +1507,17 @@ function InputRenderer({
|
|
|
1460
1507
|
});
|
|
1461
1508
|
finalRowIdForFeedback = getPrimaryKeyValues(persistedRowData, tableDefinition.primaryKey);
|
|
1462
1509
|
} else {
|
|
1463
|
-
persistedRowData =
|
|
1510
|
+
persistedRowData = response.row;
|
|
1464
1511
|
const isPrimaryKeyColumn = tableDefinition.primaryKey.includes(column.key);
|
|
1465
1512
|
finalRowIdForFeedback = isPrimaryKeyColumn ? getPrimaryKeyValues(potentialUpdatedRow, tableDefinition.primaryKey) : currentRowIdBeforeUpdate;
|
|
1513
|
+
onRowChange({ ...response.row }, true);
|
|
1466
1514
|
}
|
|
1467
|
-
|
|
1515
|
+
findChangedValues(oldRowData, response.row).forEach(
|
|
1516
|
+
(key) => setCellFeedback({ rowId: finalRowIdForFeedback, columnKey: key, type: "success" })
|
|
1517
|
+
);
|
|
1468
1518
|
} catch (err) {
|
|
1469
1519
|
console.error("Error al guardar el registro:", err);
|
|
1470
|
-
setCellFeedback({ rowId: currentRowIdBeforeUpdate, columnKey: column.key, type: "error" });
|
|
1471
|
-
onRowChange(oldRowData, true);
|
|
1520
|
+
setCellFeedback({ rowId: currentRowIdBeforeUpdate, columnKey: column.key, type: "error", message: err.message });
|
|
1472
1521
|
}
|
|
1473
1522
|
}, [
|
|
1474
1523
|
column,
|
|
@@ -1487,14 +1536,12 @@ function InputRenderer({
|
|
|
1487
1536
|
initialRowId
|
|
1488
1537
|
]);
|
|
1489
1538
|
const handleKeyDown = useCallback3((event) => {
|
|
1490
|
-
if (
|
|
1539
|
+
if (["Enter", "Tab", "ArrowDown", "ArrowUp", "ArrowRight"].includes(event.key)) {
|
|
1491
1540
|
handleCommit(editingValue, true, true);
|
|
1492
1541
|
event.preventDefault();
|
|
1493
1542
|
if (onEnterPress) {
|
|
1494
|
-
onEnterPress(rowIdx, column.key);
|
|
1543
|
+
onEnterPress(rowIdx, column.key, event.key);
|
|
1495
1544
|
}
|
|
1496
|
-
} else if (event.key === "Tab") {
|
|
1497
|
-
handleCommit(editingValue, true, true);
|
|
1498
1545
|
}
|
|
1499
1546
|
}, [handleCommit, editingValue, column.key, rowIdx, onEnterPress]);
|
|
1500
1547
|
const handleBlur = useCallback3(() => {
|
|
@@ -1517,7 +1564,8 @@ function InputRenderer({
|
|
|
1517
1564
|
borderRadius: "4px",
|
|
1518
1565
|
padding: "2px 4px",
|
|
1519
1566
|
fontSize: "0.8rem",
|
|
1520
|
-
boxSizing: "border-box"
|
|
1567
|
+
boxSizing: "border-box",
|
|
1568
|
+
backgroundColor: cellBackgroundColor
|
|
1521
1569
|
},
|
|
1522
1570
|
onClick: (e) => e.stopPropagation(),
|
|
1523
1571
|
autoFocus: true,
|
|
@@ -1528,29 +1576,57 @@ function InputRenderer({
|
|
|
1528
1576
|
var InputRenderer_default = InputRenderer;
|
|
1529
1577
|
|
|
1530
1578
|
// src/components/grid/renderers/editCellRenderers.tsx
|
|
1579
|
+
import { Box as Box6, Tooltip as Tooltip4 } from "@mui/material";
|
|
1531
1580
|
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1532
|
-
var
|
|
1533
|
-
const
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
if (!isFieldEditableByUI) {
|
|
1539
|
-
return void 0;
|
|
1540
|
-
}
|
|
1541
|
-
return /* @__PURE__ */ jsx10(
|
|
1542
|
-
InputRenderer_default,
|
|
1543
|
-
{
|
|
1544
|
-
...props,
|
|
1581
|
+
var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
1582
|
+
const column = props.column;
|
|
1583
|
+
switch (column.customType) {
|
|
1584
|
+
case "default": {
|
|
1585
|
+
const defaultColumn = column;
|
|
1586
|
+
const {
|
|
1545
1587
|
tableDefinition,
|
|
1546
|
-
|
|
1547
|
-
|
|
1588
|
+
fixedFields,
|
|
1589
|
+
primaryKey,
|
|
1548
1590
|
setTableData,
|
|
1549
|
-
|
|
1591
|
+
cellFeedback,
|
|
1592
|
+
setCellFeedback,
|
|
1593
|
+
handleEnterKeyPressInEditor,
|
|
1550
1594
|
localCellChanges,
|
|
1551
|
-
|
|
1595
|
+
setLocalCellChanges
|
|
1596
|
+
} = defaultColumn;
|
|
1597
|
+
if (column.editable) {
|
|
1598
|
+
const fieldDefinition = tableDefinition.fields.find((f) => f.name === column.key);
|
|
1599
|
+
const isFixedField = fixedFields?.some((f) => f.fieldName === column.key);
|
|
1600
|
+
const isFieldEditableByUI = fieldDefinition?.editable !== false && !isFixedField;
|
|
1601
|
+
if (!isFieldEditableByUI) {
|
|
1602
|
+
return void 0;
|
|
1603
|
+
}
|
|
1604
|
+
const rowId = getPrimaryKeyValues(props.row, primaryKey);
|
|
1605
|
+
return /* @__PURE__ */ jsx10(Tooltip4, { title: cellFeedback && cellFeedback.rowId === rowId && cellFeedback.columnKey === props.column.key ? cellFeedback?.message : "", children: /* @__PURE__ */ jsx10(Box6, { children: /* @__PURE__ */ jsx10(
|
|
1606
|
+
InputRenderer_default,
|
|
1607
|
+
{
|
|
1608
|
+
...props,
|
|
1609
|
+
tableDefinition,
|
|
1610
|
+
setCellFeedback,
|
|
1611
|
+
cellFeedback,
|
|
1612
|
+
onEnterPress: (rowIndex, columnKey, key) => handleEnterKeyPressInEditor(rowIndex, columnKey, key, allColumns),
|
|
1613
|
+
setTableData,
|
|
1614
|
+
setLocalCellChanges,
|
|
1615
|
+
localCellChanges,
|
|
1616
|
+
primaryKey
|
|
1617
|
+
}
|
|
1618
|
+
) }) });
|
|
1552
1619
|
}
|
|
1553
|
-
|
|
1620
|
+
return void 0;
|
|
1621
|
+
}
|
|
1622
|
+
case "detail": {
|
|
1623
|
+
return void 0;
|
|
1624
|
+
}
|
|
1625
|
+
case "action": {
|
|
1626
|
+
return void 0;
|
|
1627
|
+
}
|
|
1628
|
+
default:
|
|
1629
|
+
return void 0;
|
|
1554
1630
|
}
|
|
1555
1631
|
};
|
|
1556
1632
|
|
|
@@ -1576,9 +1652,12 @@ function EmptyRowsRenderer() {
|
|
|
1576
1652
|
}
|
|
1577
1653
|
|
|
1578
1654
|
// src/components/grid/GenericDataGrid.tsx
|
|
1579
|
-
import { jsx as jsx12, jsxs as
|
|
1655
|
+
import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1580
1656
|
var getPrimaryKeyValues = (row, primaryKey) => {
|
|
1581
|
-
|
|
1657
|
+
if (row[DETAIL_ROW_INDICATOR]) {
|
|
1658
|
+
primaryKey = primaryKey.concat(DETAIL_ROW_INDICATOR);
|
|
1659
|
+
}
|
|
1660
|
+
return primaryKey.map((key) => {
|
|
1582
1661
|
return row[key] !== void 0 && row[key] !== null ? String(row[key]) : "NULL_OR_UNDEFINED";
|
|
1583
1662
|
}).join("|");
|
|
1584
1663
|
};
|
|
@@ -1586,16 +1665,19 @@ var NEW_ROW_INDICATOR = "$new";
|
|
|
1586
1665
|
var DETAIL_ROW_INDICATOR = "$detail";
|
|
1587
1666
|
var GenericDataGrid = ({
|
|
1588
1667
|
tableName,
|
|
1589
|
-
fixedFields
|
|
1668
|
+
fixedFields,
|
|
1669
|
+
gridStyles
|
|
1590
1670
|
}) => {
|
|
1671
|
+
const isOpenMenu = useIsDrawerOpen();
|
|
1591
1672
|
const [tableDefinition, setTableDefinition] = useState4(null);
|
|
1592
1673
|
const [tableData, setTableData] = useState4([]);
|
|
1593
1674
|
const [isFilterRowVisible, setIsFilterRowVisible] = useState4(false);
|
|
1594
1675
|
const [filters, setFilters] = useState4({});
|
|
1595
1676
|
const [selectedRows, setSelectedRows] = useState4(() => /* @__PURE__ */ new Set());
|
|
1677
|
+
const [selectedCell, setSelectedCell] = useState4(void 0);
|
|
1596
1678
|
const [cellFeedback, setCellFeedback] = useState4(null);
|
|
1597
1679
|
const [localCellChanges, setLocalCellChanges] = useState4(/* @__PURE__ */ new Map());
|
|
1598
|
-
const theme =
|
|
1680
|
+
const theme = useTheme3();
|
|
1599
1681
|
const [openConfirmDialog, setOpenConfirmDialog] = useState4(false);
|
|
1600
1682
|
const [rowToDelete, setRowToDelete] = useState4(null);
|
|
1601
1683
|
const [exitingRowIds, setExitingRowIds] = useState4(/* @__PURE__ */ new Set());
|
|
@@ -1638,7 +1720,11 @@ var GenericDataGrid = ({
|
|
|
1638
1720
|
}
|
|
1639
1721
|
};
|
|
1640
1722
|
fetchDataAndDefinition();
|
|
1641
|
-
}, [
|
|
1723
|
+
}, [
|
|
1724
|
+
tableName,
|
|
1725
|
+
/*fixedFields,*/
|
|
1726
|
+
showError
|
|
1727
|
+
]);
|
|
1642
1728
|
useEffect(() => {
|
|
1643
1729
|
if (cellFeedback) {
|
|
1644
1730
|
if (feedbackTimerRef.current) {
|
|
@@ -1646,7 +1732,8 @@ var GenericDataGrid = ({
|
|
|
1646
1732
|
}
|
|
1647
1733
|
const timerDuration = 3e3;
|
|
1648
1734
|
feedbackTimerRef.current = setTimeout(() => {
|
|
1649
|
-
|
|
1735
|
+
if (cellFeedback.type == "success")
|
|
1736
|
+
setCellFeedback(null);
|
|
1650
1737
|
}, timerDuration);
|
|
1651
1738
|
}
|
|
1652
1739
|
return () => {
|
|
@@ -1795,12 +1882,12 @@ var GenericDataGrid = ({
|
|
|
1795
1882
|
}
|
|
1796
1883
|
return rows;
|
|
1797
1884
|
}, [tableData, filters, isFilterRowVisible]);
|
|
1798
|
-
const handleEnterKeyPressInEditor = useCallback4((rowIndex, columnKey, currentColumns) => {
|
|
1885
|
+
const handleEnterKeyPressInEditor = useCallback4((rowIndex, columnKey, key, currentColumns) => {
|
|
1799
1886
|
if (dataGridRef.current && tableDefinition) {
|
|
1800
1887
|
const currentColumnIndex = currentColumns.findIndex((col) => col.key === columnKey);
|
|
1801
1888
|
const editableColumns = currentColumns.filter((col) => {
|
|
1802
1889
|
const fieldDefinition = tableDefinition.fields.find((f) => f.name === col.key);
|
|
1803
|
-
return col.key !== "
|
|
1890
|
+
return col.key !== "actionsColumn" && col.customType != "detail" && (fieldDefinition?.editable !== false && !fieldDefinition?.clientSide);
|
|
1804
1891
|
});
|
|
1805
1892
|
if (currentColumnIndex !== -1 && editableColumns.length > 0) {
|
|
1806
1893
|
const editableColumnKeys = editableColumns.map((col) => col.key);
|
|
@@ -1817,11 +1904,14 @@ var GenericDataGrid = ({
|
|
|
1817
1904
|
}
|
|
1818
1905
|
const nextColumnKey = editableColumnKeys[nextEditableColumnIndex];
|
|
1819
1906
|
const nextColumnIndex = currentColumns.findIndex((col) => col.key === nextColumnKey);
|
|
1820
|
-
dataGridRef.current
|
|
1907
|
+
dataGridRef.current?.selectCell({ rowIdx: nextRowIndex, idx: nextColumnIndex }, { enableEditor: true, shouldFocusCell: true });
|
|
1821
1908
|
}
|
|
1822
1909
|
}
|
|
1823
1910
|
}
|
|
1824
1911
|
}, [filteredRows, tableDefinition]);
|
|
1912
|
+
const handleSelectedCellChange = useCallback4((args) => {
|
|
1913
|
+
setSelectedCell(args);
|
|
1914
|
+
}, []);
|
|
1825
1915
|
const columns = useMemo2(() => {
|
|
1826
1916
|
if (!tableDefinition) return [];
|
|
1827
1917
|
const fieldsToShow = tableDefinition.fields.filter((field) => {
|
|
@@ -1840,27 +1930,37 @@ var GenericDataGrid = ({
|
|
|
1840
1930
|
primaryKey,
|
|
1841
1931
|
fixedFields,
|
|
1842
1932
|
localCellChanges,
|
|
1933
|
+
setLocalCellChanges,
|
|
1934
|
+
setTableData,
|
|
1935
|
+
setCellFeedback,
|
|
1843
1936
|
name: fieldDef.label || cambiarGuionesBajosPorEspacios(fieldDef.name),
|
|
1844
1937
|
resizable: true,
|
|
1845
1938
|
sortable: true,
|
|
1846
|
-
//frozen: true,
|
|
1847
1939
|
editable: isFieldEditable,
|
|
1940
|
+
handleEnterKeyPressInEditor,
|
|
1848
1941
|
flexGrow: 1,
|
|
1849
1942
|
minWidth: 60,
|
|
1850
1943
|
renderHeaderCell: (props) => defaultColumnHeaderCellRenderer(props, fieldDef),
|
|
1851
1944
|
renderSummaryCell: (props) => defaultColumnSummaryCellRenderer(props, fixedFields, isFilterRowVisible, filters, setFilters)
|
|
1852
1945
|
};
|
|
1853
1946
|
});
|
|
1947
|
+
const availableActions = [
|
|
1948
|
+
tableDefinition.allow?.insert,
|
|
1949
|
+
tableDefinition.allow?.delete,
|
|
1950
|
+
tableDefinition.allow?.["vertical-edit"]
|
|
1951
|
+
].filter(Boolean).length;
|
|
1952
|
+
const actionColumnWidth = availableActions === 0 ? 30 : 12 + availableActions * 25;
|
|
1854
1953
|
const actionsColumn = {
|
|
1855
|
-
key: "
|
|
1954
|
+
key: "actionsColumn",
|
|
1856
1955
|
customType: "action",
|
|
1857
1956
|
tableDefinition,
|
|
1858
1957
|
handleDeleteRow,
|
|
1958
|
+
handleAddRow,
|
|
1859
1959
|
name: "filterCol",
|
|
1860
|
-
width:
|
|
1960
|
+
width: actionColumnWidth,
|
|
1961
|
+
editable: false,
|
|
1861
1962
|
resizable: false,
|
|
1862
1963
|
sortable: false,
|
|
1863
|
-
//frozen: true,
|
|
1864
1964
|
renderHeaderCell: (props) => actionsColumnHeaderCellRenderer(props, isFilterRowVisible, toggleFilterVisibility),
|
|
1865
1965
|
renderSummaryCell: (props) => actionsColumnSummaryCellRenderer(props)
|
|
1866
1966
|
};
|
|
@@ -1880,8 +1980,9 @@ var GenericDataGrid = ({
|
|
|
1880
1980
|
name: detailTable.label || `Detalle ${detailTable.abr}`,
|
|
1881
1981
|
resizable: false,
|
|
1882
1982
|
sortable: false,
|
|
1883
|
-
|
|
1884
|
-
|
|
1983
|
+
editable: false,
|
|
1984
|
+
width: 30,
|
|
1985
|
+
minWidth: 30,
|
|
1885
1986
|
renderHeaderCell: (props) => detailColumnCellHeaderRenderer(props, detailTable),
|
|
1886
1987
|
renderSummaryCell: (props) => detailColumnCellSummaryRenderer(props)
|
|
1887
1988
|
});
|
|
@@ -1903,7 +2004,9 @@ var GenericDataGrid = ({
|
|
|
1903
2004
|
}
|
|
1904
2005
|
return void 0;
|
|
1905
2006
|
},
|
|
1906
|
-
|
|
2007
|
+
editorOptions: { closeOnExternalRowChange: false },
|
|
2008
|
+
//con esto no se pierde el foco
|
|
2009
|
+
renderEditCell: (props) => allColumnsEditCellRenderer(props, allColumns),
|
|
1907
2010
|
renderCell: (props) => allColumnsCellRenderer(props)
|
|
1908
2011
|
}));
|
|
1909
2012
|
}, [
|
|
@@ -1921,13 +2024,30 @@ var GenericDataGrid = ({
|
|
|
1921
2024
|
setTableData,
|
|
1922
2025
|
localCellChanges,
|
|
1923
2026
|
handleDeleteRow,
|
|
2027
|
+
handleAddRow,
|
|
1924
2028
|
fixedFields,
|
|
1925
2029
|
tableData
|
|
1926
2030
|
]);
|
|
1927
2031
|
const handleRowsChange = useCallback4((updatedRows) => {
|
|
1928
2032
|
setTableData(updatedRows);
|
|
1929
2033
|
}, []);
|
|
2034
|
+
const deselectAllOtherGrids = (currentGridElement) => {
|
|
2035
|
+
const allSelectedCells = document.querySelectorAll("div[aria-selected='true']");
|
|
2036
|
+
allSelectedCells.forEach((cell) => {
|
|
2037
|
+
const parentGrid = cell.closest(".rdg");
|
|
2038
|
+
if (parentGrid && parentGrid !== currentGridElement) {
|
|
2039
|
+
cell.setAttribute("aria-selected", "false");
|
|
2040
|
+
}
|
|
2041
|
+
});
|
|
2042
|
+
};
|
|
2043
|
+
const handleCellKeyDown = (args, event) => {
|
|
2044
|
+
if (["Tab", "Enter"].includes(event.key)) {
|
|
2045
|
+
event.preventGridDefault();
|
|
2046
|
+
}
|
|
2047
|
+
};
|
|
1930
2048
|
const handleCellClick = useCallback4((args) => {
|
|
2049
|
+
deselectAllOtherGrids(dataGridRef.current?.element);
|
|
2050
|
+
args.selectCell(true);
|
|
1931
2051
|
const fieldDefinition = tableDefinition?.fields.find((f) => f.name === args.column.key);
|
|
1932
2052
|
const isFixedField = fixedFields?.some((f) => f.fieldName === args.column.key);
|
|
1933
2053
|
const isEditable = fieldDefinition?.editable !== false && !isFixedField;
|
|
@@ -1936,29 +2056,20 @@ var GenericDataGrid = ({
|
|
|
1936
2056
|
console.log("Is editable:", isEditable);
|
|
1937
2057
|
}, [tableDefinition, fixedFields]);
|
|
1938
2058
|
if (loading) {
|
|
1939
|
-
return /* @__PURE__ */
|
|
2059
|
+
return /* @__PURE__ */ jsxs5(Box7, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: [
|
|
1940
2060
|
/* @__PURE__ */ jsx12(CircularProgress, {}),
|
|
1941
2061
|
/* @__PURE__ */ jsx12(Typography5, { variant: "h6", sx: { ml: 2 }, children: "Cargando tabla..." })
|
|
1942
2062
|
] });
|
|
1943
2063
|
}
|
|
1944
2064
|
if (error) {
|
|
1945
|
-
return /* @__PURE__ */ jsx12(
|
|
2065
|
+
return /* @__PURE__ */ jsx12(Box7, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsx12(Alert, { severity: "error", children: error.message }) });
|
|
1946
2066
|
}
|
|
1947
2067
|
if (!tableDefinition) {
|
|
1948
|
-
return /* @__PURE__ */ jsx12(
|
|
2068
|
+
return /* @__PURE__ */ jsx12(Box7, { 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." }) });
|
|
1949
2069
|
}
|
|
1950
|
-
return /* @__PURE__ */
|
|
1951
|
-
tableDefinition.allow?.insert && /* @__PURE__ */ jsx12(Box5, { sx: { display: "flex", px: 2, pb: 1 }, children: /* @__PURE__ */ jsx12(
|
|
1952
|
-
Button3,
|
|
1953
|
-
{
|
|
1954
|
-
variant: "contained",
|
|
1955
|
-
onClick: handleAddRow,
|
|
1956
|
-
startIcon: /* @__PURE__ */ jsx12(AddIcon, {}),
|
|
1957
|
-
children: "Nuevo Registro"
|
|
1958
|
-
}
|
|
1959
|
-
) }),
|
|
2070
|
+
return /* @__PURE__ */ jsxs5(Box7, { sx: { pt: 2, display: "flex", flexDirection: "column", height: "100%", boxSizing: "border-box" }, children: [
|
|
1960
2071
|
/* @__PURE__ */ jsx12(
|
|
1961
|
-
|
|
2072
|
+
Box7,
|
|
1962
2073
|
{
|
|
1963
2074
|
sx: {
|
|
1964
2075
|
backgroundColor: theme.palette.primary.main,
|
|
@@ -1972,15 +2083,15 @@ var GenericDataGrid = ({
|
|
|
1972
2083
|
ml: 2,
|
|
1973
2084
|
mr: 2
|
|
1974
2085
|
},
|
|
1975
|
-
children: /* @__PURE__ */
|
|
2086
|
+
children: /* @__PURE__ */ jsxs5(Typography5, { variant: "subtitle2", component: "div", children: [
|
|
1976
2087
|
cambiarGuionesBajosPorEspacios(tableDefinition.title || tableDefinition.name),
|
|
1977
|
-
" -
|
|
1978
|
-
getFilteredRowCount() === getRowCount() ? `${getRowCount()} registros` : `${getFilteredRowCount()}
|
|
2088
|
+
" - ",
|
|
2089
|
+
getFilteredRowCount() === getRowCount() ? `${getRowCount()} registros` : `${getFilteredRowCount()} (F)`
|
|
1979
2090
|
] })
|
|
1980
2091
|
}
|
|
1981
2092
|
),
|
|
1982
2093
|
/* @__PURE__ */ jsx12(
|
|
1983
|
-
|
|
2094
|
+
Box7,
|
|
1984
2095
|
{
|
|
1985
2096
|
sx: {
|
|
1986
2097
|
flexGrow: 1,
|
|
@@ -1994,6 +2105,7 @@ var GenericDataGrid = ({
|
|
|
1994
2105
|
children: /* @__PURE__ */ jsx12(
|
|
1995
2106
|
DataGrid,
|
|
1996
2107
|
{
|
|
2108
|
+
className: "rdg-light",
|
|
1997
2109
|
ref: dataGridRef,
|
|
1998
2110
|
columns,
|
|
1999
2111
|
rows: filteredRows.map((row) => ({
|
|
@@ -2003,15 +2115,17 @@ var GenericDataGrid = ({
|
|
|
2003
2115
|
enableVirtualization: true,
|
|
2004
2116
|
rowKeyGetter: (row) => getPrimaryKeyValues(row, primaryKey),
|
|
2005
2117
|
onSelectedRowsChange: setSelectedRows,
|
|
2118
|
+
onSelectedCellChange: handleSelectedCellChange,
|
|
2006
2119
|
onRowsChange: handleRowsChange,
|
|
2007
2120
|
selectedRows,
|
|
2008
|
-
rowHeight: (row) => row[DETAIL_ROW_INDICATOR] ? 400 :
|
|
2009
|
-
style: { height: "100%", width: "100%", boxSizing: "border-box" },
|
|
2010
|
-
headerRowHeight:
|
|
2121
|
+
rowHeight: (row) => row[DETAIL_ROW_INDICATOR] ? 400 : 30,
|
|
2122
|
+
style: { ...{ height: "100%", width: "100%", boxSizing: "border-box" }, ...gridStyles },
|
|
2123
|
+
headerRowHeight: 30,
|
|
2011
2124
|
topSummaryRows: isFilterRowVisible ? [{ id: "filterRow" }] : void 0,
|
|
2012
|
-
summaryRowHeight: isFilterRowVisible ?
|
|
2125
|
+
summaryRowHeight: isFilterRowVisible ? 30 : 0,
|
|
2126
|
+
renderers: { noRowsFallback: /* @__PURE__ */ jsx12(EmptyRowsRenderer, {}) },
|
|
2013
2127
|
onCellClick: handleCellClick,
|
|
2014
|
-
|
|
2128
|
+
onCellKeyDown: handleCellKeyDown
|
|
2015
2129
|
}
|
|
2016
2130
|
)
|
|
2017
2131
|
}
|
|
@@ -2037,7 +2151,7 @@ import { BrowserRouter, Routes, Route, useLocation as useLocation4, Navigate as
|
|
|
2037
2151
|
import { useEffect as useEffect3 } from "react";
|
|
2038
2152
|
import { Outlet } from "react-router-dom";
|
|
2039
2153
|
import {
|
|
2040
|
-
Box as
|
|
2154
|
+
Box as Box10,
|
|
2041
2155
|
AppBar,
|
|
2042
2156
|
Toolbar,
|
|
2043
2157
|
Typography as Typography8,
|
|
@@ -2045,7 +2159,7 @@ import {
|
|
|
2045
2159
|
Drawer,
|
|
2046
2160
|
CssBaseline,
|
|
2047
2161
|
IconButton as IconButton3,
|
|
2048
|
-
useTheme as
|
|
2162
|
+
useTheme as useTheme4,
|
|
2049
2163
|
useMediaQuery
|
|
2050
2164
|
} from "@mui/material";
|
|
2051
2165
|
|
|
@@ -2130,7 +2244,7 @@ import MenuIcon from "@mui/icons-material/Menu";
|
|
|
2130
2244
|
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
2131
2245
|
|
|
2132
2246
|
// src/components/SideMenu.tsx
|
|
2133
|
-
import { List, ListItem, ListItemButton, ListItemIcon, ListItemText, Divider, Box as
|
|
2247
|
+
import { List, ListItem, ListItemButton, ListItemIcon, ListItemText, Divider, Box as Box9, Typography as Typography7, Collapse } from "@mui/material";
|
|
2134
2248
|
import ExpandLess from "@mui/icons-material/ExpandLess";
|
|
2135
2249
|
import ExpandMore from "@mui/icons-material/ExpandMore";
|
|
2136
2250
|
import TableChartIcon from "@mui/icons-material/TableChart";
|
|
@@ -2145,30 +2259,30 @@ import { useNavigate as useNavigate2, useLocation } from "react-router-dom";
|
|
|
2145
2259
|
import { blue, orange, teal, red, grey } from "@mui/material/colors";
|
|
2146
2260
|
|
|
2147
2261
|
// src/pages/WScreens.tsx
|
|
2148
|
-
import { Box as
|
|
2262
|
+
import { Box as Box8, Typography as Typography6, Paper } from "@mui/material";
|
|
2149
2263
|
import ConstructionIcon from "@mui/icons-material/Construction";
|
|
2150
2264
|
import WarningAmberIcon2 from "@mui/icons-material/WarningAmber";
|
|
2151
|
-
import { jsx as jsx14, jsxs as
|
|
2265
|
+
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2152
2266
|
var MyCustomDashboard = ({ screenName }) => {
|
|
2153
|
-
return /* @__PURE__ */ jsx14(
|
|
2154
|
-
/* @__PURE__ */
|
|
2267
|
+
return /* @__PURE__ */ jsx14(Box8, { sx: { p: 4, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", height: "100%" }, children: /* @__PURE__ */ jsxs6(Paper, { elevation: 3, sx: { p: 4, textAlign: "center", maxWidth: 600 }, children: [
|
|
2268
|
+
/* @__PURE__ */ jsxs6(Typography6, { variant: "h5", component: "h1", gutterBottom: true, children: [
|
|
2155
2269
|
"\xA1Bienvenido a tu WScreen: ",
|
|
2156
2270
|
screenName,
|
|
2157
2271
|
"!"
|
|
2158
2272
|
] }),
|
|
2159
2273
|
/* @__PURE__ */ jsx14(Typography6, { variant: "body1", color: "text.secondary", children: "Esta es una pantalla de interfaz de usuario personalizada." }),
|
|
2160
|
-
/* @__PURE__ */ jsx14(
|
|
2274
|
+
/* @__PURE__ */ jsx14(Box8, { sx: { mt: 3 }, children: /* @__PURE__ */ jsx14(ConstructionIcon, { sx: { fontSize: 80, color: "primary.main" } }) })
|
|
2161
2275
|
] }) });
|
|
2162
2276
|
};
|
|
2163
2277
|
var FallbackWScreen = ({ screenName }) => {
|
|
2164
|
-
return /* @__PURE__ */ jsx14(
|
|
2278
|
+
return /* @__PURE__ */ jsx14(Box8, { sx: { p: 4, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", height: "100%" }, children: /* @__PURE__ */ jsxs6(Paper, { elevation: 3, sx: { p: 4, textAlign: "center", maxWidth: 600, backgroundColor: "warning.light", border: "1px solid orange" }, children: [
|
|
2165
2279
|
/* @__PURE__ */ jsx14(Typography6, { variant: "h5", component: "h1", gutterBottom: true, color: "warning.dark", children: "WScreen No Implementada" }),
|
|
2166
|
-
/* @__PURE__ */
|
|
2280
|
+
/* @__PURE__ */ jsxs6(Typography6, { variant: "body1", color: "warning.dark", children: [
|
|
2167
2281
|
'No se encontr\xF3 un componente implementado para la **WScreen**: **`"$',
|
|
2168
2282
|
screenName,
|
|
2169
2283
|
'"`**. 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.'
|
|
2170
2284
|
] }),
|
|
2171
|
-
/* @__PURE__ */ jsx14(
|
|
2285
|
+
/* @__PURE__ */ jsx14(Box8, { sx: { mt: 3 }, children: /* @__PURE__ */ jsx14(WarningAmberIcon2, { sx: { fontSize: 80, color: "warning.dark" } }) })
|
|
2172
2286
|
] }) });
|
|
2173
2287
|
};
|
|
2174
2288
|
var wScreens = {
|
|
@@ -2179,7 +2293,7 @@ var wScreens = {
|
|
|
2179
2293
|
var WScreens_default = FallbackWScreen;
|
|
2180
2294
|
|
|
2181
2295
|
// src/components/SideMenu.tsx
|
|
2182
|
-
import { Fragment, jsx as jsx15, jsxs as
|
|
2296
|
+
import { Fragment, jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2183
2297
|
var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
2184
2298
|
const navigate = useNavigate2();
|
|
2185
2299
|
const location = useLocation();
|
|
@@ -2242,8 +2356,8 @@ var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
|
2242
2356
|
} else {
|
|
2243
2357
|
isSelected = currentPath.startsWith(`/wScreens/${item.menuType}`) || currentPath.startsWith(`/wScreens-fallback/${item.menuType}`);
|
|
2244
2358
|
}
|
|
2245
|
-
return /* @__PURE__ */
|
|
2246
|
-
/* @__PURE__ */
|
|
2359
|
+
return /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
2360
|
+
/* @__PURE__ */ jsxs7(
|
|
2247
2361
|
ListItemButton,
|
|
2248
2362
|
{
|
|
2249
2363
|
onClick: handleClick,
|
|
@@ -2286,17 +2400,17 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
2286
2400
|
dispatch(setAllSubMenusOpen(!isMostlyOpen));
|
|
2287
2401
|
};
|
|
2288
2402
|
if (!clientContext || !clientContext.menu) {
|
|
2289
|
-
return /* @__PURE__ */ jsx15(
|
|
2403
|
+
return /* @__PURE__ */ jsx15(Box9, { sx: { p: 2, textAlign: "center" }, children: /* @__PURE__ */ jsx15(Typography7, { variant: "body2", color: "text.secondary", children: "Cargando men\xFA..." }) });
|
|
2290
2404
|
}
|
|
2291
2405
|
const isHomeSelected = location.pathname === "/home";
|
|
2292
|
-
return /* @__PURE__ */
|
|
2293
|
-
clientContext.menu.some((item) => item.menuType === "menu") && /* @__PURE__ */ jsx15(ListItem, { disablePadding: true, children: /* @__PURE__ */
|
|
2406
|
+
return /* @__PURE__ */ jsxs7(Box9, { sx: { width: "100%", flexShrink: 0 }, children: [
|
|
2407
|
+
clientContext.menu.some((item) => item.menuType === "menu") && /* @__PURE__ */ jsx15(ListItem, { disablePadding: true, children: /* @__PURE__ */ jsxs7(ListItemButton, { onClick: handleToggleAllSubMenus, children: [
|
|
2294
2408
|
/* @__PURE__ */ jsx15(ListItemIcon, { sx: { minWidth: "38px" }, children: isMostlyOpen ? /* @__PURE__ */ jsx15(UnfoldLessIcon, {}) : /* @__PURE__ */ jsx15(UnfoldMoreIcon, {}) }),
|
|
2295
2409
|
/* @__PURE__ */ jsx15(ListItemText, { primary: isMostlyOpen ? "colapsar " : "expandir" })
|
|
2296
2410
|
] }) }),
|
|
2297
2411
|
/* @__PURE__ */ jsx15(Divider, {}),
|
|
2298
|
-
/* @__PURE__ */
|
|
2299
|
-
/* @__PURE__ */ jsx15(ListItem, { disablePadding: true, children: /* @__PURE__ */
|
|
2412
|
+
/* @__PURE__ */ jsxs7(List, { children: [
|
|
2413
|
+
/* @__PURE__ */ jsx15(ListItem, { disablePadding: true, children: /* @__PURE__ */ jsxs7(ListItemButton, { onClick: handleHomeClick, selected: isHomeSelected, children: [
|
|
2300
2414
|
/* @__PURE__ */ jsx15(ListItemIcon, { sx: { minWidth: "38px" }, children: /* @__PURE__ */ jsx15(HomeIcon, {}) }),
|
|
2301
2415
|
/* @__PURE__ */ jsx15(ListItemText, { primary: "Inicio" })
|
|
2302
2416
|
] }) }),
|
|
@@ -2344,14 +2458,14 @@ var useLogout = () => {
|
|
|
2344
2458
|
var useLogout_default = useLogout;
|
|
2345
2459
|
|
|
2346
2460
|
// src/components/MainLayout.tsx
|
|
2347
|
-
import { jsx as jsx16, jsxs as
|
|
2461
|
+
import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2348
2462
|
var drawerWidth = 240;
|
|
2349
2463
|
var MainLayout = () => {
|
|
2350
2464
|
const { clientContext } = useApp();
|
|
2351
2465
|
const logout = useLogout_default();
|
|
2352
2466
|
const isDrawerOpen = useIsDrawerOpen();
|
|
2353
2467
|
const dispatch = useAppDispatch();
|
|
2354
|
-
const theme =
|
|
2468
|
+
const theme = useTheme4();
|
|
2355
2469
|
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
|
2356
2470
|
useEffect3(() => {
|
|
2357
2471
|
if (isMobile && isDrawerOpen) {
|
|
@@ -2367,10 +2481,10 @@ var MainLayout = () => {
|
|
|
2367
2481
|
}
|
|
2368
2482
|
};
|
|
2369
2483
|
if (!clientContext) {
|
|
2370
|
-
return /* @__PURE__ */ jsx16(
|
|
2484
|
+
return /* @__PURE__ */ jsx16(Box10, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ jsx16(Typography8, { children: "Cargando dise\xF1o de la aplicaci\xF3n..." }) });
|
|
2371
2485
|
}
|
|
2372
2486
|
const appBarOffset = theme.mixins.toolbar;
|
|
2373
|
-
return /* @__PURE__ */
|
|
2487
|
+
return /* @__PURE__ */ jsxs8(Box10, { sx: { display: "flex", height: "100vh" }, children: [
|
|
2374
2488
|
/* @__PURE__ */ jsx16(CssBaseline, {}),
|
|
2375
2489
|
/* @__PURE__ */ jsx16(
|
|
2376
2490
|
AppBar,
|
|
@@ -2391,7 +2505,7 @@ var MainLayout = () => {
|
|
|
2391
2505
|
})
|
|
2392
2506
|
}
|
|
2393
2507
|
},
|
|
2394
|
-
children: /* @__PURE__ */
|
|
2508
|
+
children: /* @__PURE__ */ jsxs8(Toolbar, { children: [
|
|
2395
2509
|
/* @__PURE__ */ jsx16(
|
|
2396
2510
|
IconButton3,
|
|
2397
2511
|
{
|
|
@@ -2419,7 +2533,7 @@ var MainLayout = () => {
|
|
|
2419
2533
|
] })
|
|
2420
2534
|
}
|
|
2421
2535
|
),
|
|
2422
|
-
/* @__PURE__ */
|
|
2536
|
+
/* @__PURE__ */ jsxs8(
|
|
2423
2537
|
Drawer,
|
|
2424
2538
|
{
|
|
2425
2539
|
variant: "persistent",
|
|
@@ -2455,7 +2569,7 @@ var MainLayout = () => {
|
|
|
2455
2569
|
}
|
|
2456
2570
|
),
|
|
2457
2571
|
/* @__PURE__ */ jsx16(
|
|
2458
|
-
|
|
2572
|
+
Box10,
|
|
2459
2573
|
{
|
|
2460
2574
|
component: "main",
|
|
2461
2575
|
sx: {
|
|
@@ -2490,9 +2604,9 @@ var MainLayout = () => {
|
|
|
2490
2604
|
var MainLayout_default = MainLayout;
|
|
2491
2605
|
|
|
2492
2606
|
// src/components/SessionExpiredMessage.tsx
|
|
2493
|
-
import { Box as
|
|
2607
|
+
import { Box as Box11, Typography as Typography9, Button as Button5, Modal } from "@mui/material";
|
|
2494
2608
|
import { useNavigate as useNavigate4 } from "react-router-dom";
|
|
2495
|
-
import { jsx as jsx17, jsxs as
|
|
2609
|
+
import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2496
2610
|
var style = {
|
|
2497
2611
|
position: "absolute",
|
|
2498
2612
|
top: "50%",
|
|
@@ -2534,7 +2648,7 @@ var SessionExpiredMessage = () => {
|
|
|
2534
2648
|
}
|
|
2535
2649
|
}
|
|
2536
2650
|
},
|
|
2537
|
-
children: /* @__PURE__ */
|
|
2651
|
+
children: /* @__PURE__ */ jsxs9(Box11, { sx: style, children: [
|
|
2538
2652
|
/* @__PURE__ */ jsx17(Typography9, { id: "session-expired-modal-title", variant: "h6", component: "h2", gutterBottom: true, children: "\xA1Sesi\xF3n Expirada!" }),
|
|
2539
2653
|
/* @__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." }),
|
|
2540
2654
|
/* @__PURE__ */ jsx17(Button5, { variant: "contained", color: "primary", onClick: handleClose, children: "Ir al Login" })
|
|
@@ -2545,11 +2659,11 @@ var SessionExpiredMessage = () => {
|
|
|
2545
2659
|
var SessionExpiredMessage_default = SessionExpiredMessage;
|
|
2546
2660
|
|
|
2547
2661
|
// src/pages/HomePage.tsx
|
|
2548
|
-
import { Box as
|
|
2549
|
-
import { jsx as jsx18, jsxs as
|
|
2662
|
+
import { Box as Box12, Typography as Typography10 } from "@mui/material";
|
|
2663
|
+
import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2550
2664
|
var HomePage = () => {
|
|
2551
2665
|
const { clientContext } = useApp();
|
|
2552
|
-
return /* @__PURE__ */
|
|
2666
|
+
return /* @__PURE__ */ jsxs10(Box12, { sx: { p: 3 }, children: [
|
|
2553
2667
|
/* @__PURE__ */ jsx18(Typography10, { variant: "h4", component: "h1", gutterBottom: true, children: `Bienvenido/a ${clientContext?.username}` }),
|
|
2554
2668
|
/* @__PURE__ */ jsx18(Typography10, { variant: "body1", children: "Usa el men\xFA lateral para navegar por las diferentes secciones." })
|
|
2555
2669
|
] });
|
|
@@ -2558,14 +2672,14 @@ var HomePage_default = HomePage;
|
|
|
2558
2672
|
|
|
2559
2673
|
// src/pages/LogoutPage.tsx
|
|
2560
2674
|
import { useEffect as useEffect4 } from "react";
|
|
2561
|
-
import { Box as
|
|
2562
|
-
import { jsx as jsx19, jsxs as
|
|
2675
|
+
import { Box as Box13, Typography as Typography11, CircularProgress as CircularProgress2 } from "@mui/material";
|
|
2676
|
+
import { jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2563
2677
|
var LogoutPage = () => {
|
|
2564
2678
|
const logout = useLogout_default();
|
|
2565
2679
|
useEffect4(() => {
|
|
2566
2680
|
logout();
|
|
2567
2681
|
}, [logout]);
|
|
2568
|
-
return /* @__PURE__ */
|
|
2682
|
+
return /* @__PURE__ */ jsxs11(Box13, { sx: {
|
|
2569
2683
|
display: "flex",
|
|
2570
2684
|
flexDirection: "column",
|
|
2571
2685
|
justifyContent: "center",
|
|
@@ -2581,13 +2695,13 @@ var LogoutPage_default = LogoutPage;
|
|
|
2581
2695
|
|
|
2582
2696
|
// src/pages/LoginPage.tsx
|
|
2583
2697
|
import { useState as useState6 } from "react";
|
|
2584
|
-
import { Button as Button6, TextField, Typography as Typography12, Alert as Alert2, AlertTitle, Box as
|
|
2698
|
+
import { Button as Button6, TextField, Typography as Typography12, Alert as Alert2, AlertTitle, Box as Box14, CircularProgress as CircularProgress3 } from "@mui/material";
|
|
2585
2699
|
import { useForm, Controller } from "react-hook-form";
|
|
2586
2700
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
2587
2701
|
import * as z from "zod";
|
|
2588
2702
|
import { useNavigate as useNavigate5 } from "react-router-dom";
|
|
2589
2703
|
import { useDispatch as useDispatch4 } from "react-redux";
|
|
2590
|
-
import { Fragment as Fragment2, jsx as jsx20, jsxs as
|
|
2704
|
+
import { Fragment as Fragment2, jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2591
2705
|
var loginSchema = z.object({
|
|
2592
2706
|
username: z.string().min(1, "El usuario es requerido"),
|
|
2593
2707
|
// Añadir validación básica
|
|
@@ -2644,15 +2758,15 @@ var LoginPage = () => {
|
|
|
2644
2758
|
}
|
|
2645
2759
|
};
|
|
2646
2760
|
return /* @__PURE__ */ jsx20(
|
|
2647
|
-
|
|
2761
|
+
Box14,
|
|
2648
2762
|
{
|
|
2649
2763
|
display: "flex",
|
|
2650
2764
|
alignItems: "center",
|
|
2651
2765
|
justifyContent: "center",
|
|
2652
2766
|
minHeight: "100vh",
|
|
2653
2767
|
bgcolor: "#f5f5f5",
|
|
2654
|
-
children: /* @__PURE__ */
|
|
2655
|
-
|
|
2768
|
+
children: /* @__PURE__ */ jsxs12(
|
|
2769
|
+
Box14,
|
|
2656
2770
|
{
|
|
2657
2771
|
width: "100%",
|
|
2658
2772
|
maxWidth: "400px",
|
|
@@ -2662,8 +2776,8 @@ var LoginPage = () => {
|
|
|
2662
2776
|
boxShadow: 3,
|
|
2663
2777
|
children: [
|
|
2664
2778
|
/* @__PURE__ */ jsx20(Typography12, { variant: "h5", align: "center", gutterBottom: true, children: "Iniciar Sesi\xF3n" }),
|
|
2665
|
-
/* @__PURE__ */
|
|
2666
|
-
/* @__PURE__ */
|
|
2779
|
+
/* @__PURE__ */ jsxs12("form", { onSubmit: handleSubmit(onSubmit), className: "space-y-4", children: [
|
|
2780
|
+
/* @__PURE__ */ jsxs12("div", { children: [
|
|
2667
2781
|
/* @__PURE__ */ jsx20("label", { htmlFor: "username", children: /* @__PURE__ */ jsx20(Typography12, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Usuario" }) }),
|
|
2668
2782
|
/* @__PURE__ */ jsx20(
|
|
2669
2783
|
Controller,
|
|
@@ -2686,7 +2800,7 @@ var LoginPage = () => {
|
|
|
2686
2800
|
}
|
|
2687
2801
|
)
|
|
2688
2802
|
] }),
|
|
2689
|
-
/* @__PURE__ */
|
|
2803
|
+
/* @__PURE__ */ jsxs12("div", { children: [
|
|
2690
2804
|
/* @__PURE__ */ jsx20("label", { htmlFor: "password", children: /* @__PURE__ */ jsx20(Typography12, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Contrase\xF1a" }) }),
|
|
2691
2805
|
/* @__PURE__ */ jsx20(
|
|
2692
2806
|
Controller,
|
|
@@ -2709,12 +2823,12 @@ var LoginPage = () => {
|
|
|
2709
2823
|
}
|
|
2710
2824
|
)
|
|
2711
2825
|
] }),
|
|
2712
|
-
/* @__PURE__ */ jsx20(Button6, { type: "submit", fullWidth: true, variant: "contained", color: "primary", disabled: isSubmitting, sx: { mt: 2 }, children: isSubmitting ? /* @__PURE__ */
|
|
2826
|
+
/* @__PURE__ */ jsx20(Button6, { type: "submit", fullWidth: true, variant: "contained", color: "primary", disabled: isSubmitting, sx: { mt: 2 }, children: isSubmitting ? /* @__PURE__ */ jsxs12(Fragment2, { children: [
|
|
2713
2827
|
/* @__PURE__ */ jsx20(CircularProgress3, { size: 20, sx: { mr: 1 } }),
|
|
2714
2828
|
"Iniciando sesi\xF3n..."
|
|
2715
2829
|
] }) : "Iniciar Sesi\xF3n" })
|
|
2716
2830
|
] }),
|
|
2717
|
-
loginError && /* @__PURE__ */
|
|
2831
|
+
loginError && /* @__PURE__ */ jsxs12(Alert2, { severity: "error", sx: { mt: 2, maxHeight: "200px" }, children: [
|
|
2718
2832
|
" ",
|
|
2719
2833
|
/* @__PURE__ */ jsx20(AlertTitle, { children: "Error" }),
|
|
2720
2834
|
loginError
|
|
@@ -2741,7 +2855,7 @@ import {
|
|
|
2741
2855
|
FormControlLabel,
|
|
2742
2856
|
FormHelperText,
|
|
2743
2857
|
Typography as Typography14,
|
|
2744
|
-
Box as
|
|
2858
|
+
Box as Box16,
|
|
2745
2859
|
CircularProgress as CircularProgress4,
|
|
2746
2860
|
Alert as Alert3,
|
|
2747
2861
|
Divider as Divider2,
|
|
@@ -2749,13 +2863,13 @@ import {
|
|
|
2749
2863
|
} from "@mui/material";
|
|
2750
2864
|
|
|
2751
2865
|
// src/pages/procedure-results/SuccessDisplay.tsx
|
|
2752
|
-
import { Box as
|
|
2753
|
-
import { jsx as jsx21, jsxs as
|
|
2866
|
+
import { Box as Box15, Typography as Typography13, Paper as Paper2 } from "@mui/material";
|
|
2867
|
+
import { jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2754
2868
|
var SuccessDisplay = ({ data }) => {
|
|
2755
|
-
return /* @__PURE__ */
|
|
2869
|
+
return /* @__PURE__ */ jsxs13(Paper2, { elevation: 2, sx: { p: 2, mt: 2, bgcolor: "success.light", color: "success.contrastText" }, children: [
|
|
2756
2870
|
/* @__PURE__ */ jsx21(Typography13, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: "\xA1Operaci\xF3n Exitosa!" }),
|
|
2757
2871
|
/* @__PURE__ */ jsx21(Typography13, { variant: "body2", sx: { fontSize: "0.85rem" }, children: "Detalles del resultado:" }),
|
|
2758
|
-
/* @__PURE__ */ jsx21(
|
|
2872
|
+
/* @__PURE__ */ jsx21(Box15, { 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) }) }),
|
|
2759
2873
|
/* @__PURE__ */ jsx21(Typography13, { variant: "body2", sx: { fontSize: "0.8rem", mt: 1 }, children: "Puedes revisar los detalles anteriores o cerrar este mensaje." })
|
|
2760
2874
|
] });
|
|
2761
2875
|
};
|
|
@@ -2770,7 +2884,7 @@ var extendResultsOk = (newComponents) => {
|
|
|
2770
2884
|
};
|
|
2771
2885
|
|
|
2772
2886
|
// src/components/ProcedureForm.tsx
|
|
2773
|
-
import { jsx as jsx22, jsxs as
|
|
2887
|
+
import { jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2774
2888
|
var ProcedureForm = () => {
|
|
2775
2889
|
const { procedureName } = useParams();
|
|
2776
2890
|
const { clientContext } = useApp();
|
|
@@ -2985,9 +3099,9 @@ var ProcedureForm = () => {
|
|
|
2985
3099
|
sx: { fontSize: "0.8rem" }
|
|
2986
3100
|
};
|
|
2987
3101
|
if (param.options && param.options.length > 0) {
|
|
2988
|
-
return /* @__PURE__ */
|
|
3102
|
+
return /* @__PURE__ */ jsxs14(FormControl, { fullWidth: true, margin: "dense", size: "small", error: hasError, required: commonProps.required, children: [
|
|
2989
3103
|
/* @__PURE__ */ jsx22(InputLabel, { id: `${param.name}-label`, sx: { fontSize: "0.8rem" }, children: param.label || param.name }),
|
|
2990
|
-
/* @__PURE__ */
|
|
3104
|
+
/* @__PURE__ */ jsxs14(
|
|
2991
3105
|
Select,
|
|
2992
3106
|
{
|
|
2993
3107
|
labelId: `${param.name}-label`,
|
|
@@ -3048,7 +3162,7 @@ var ProcedureForm = () => {
|
|
|
3048
3162
|
case "jsona":
|
|
3049
3163
|
return /* @__PURE__ */ jsx22(TextField2, { multiline: true, rows: 5, value: formValues[param.name] || "", ...commonProps, InputProps: { sx: { fontSize: "0.8rem" } } });
|
|
3050
3164
|
case "bytea":
|
|
3051
|
-
return /* @__PURE__ */
|
|
3165
|
+
return /* @__PURE__ */ jsxs14(FormControl, { fullWidth: true, margin: "dense", error: hasError, required: commonProps.required, children: [
|
|
3052
3166
|
/* @__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 }),
|
|
3053
3167
|
/* @__PURE__ */ jsx22(
|
|
3054
3168
|
"input",
|
|
@@ -3076,13 +3190,13 @@ var ProcedureForm = () => {
|
|
|
3076
3190
|
if (ComponentToRender) {
|
|
3077
3191
|
return /* @__PURE__ */ jsx22(ComponentToRender, { data: procedureResultData });
|
|
3078
3192
|
} else {
|
|
3079
|
-
return /* @__PURE__ */
|
|
3080
|
-
/* @__PURE__ */
|
|
3193
|
+
return /* @__PURE__ */ jsxs14(Paper3, { elevation: 2, sx: { p: 2, mt: 0, bgcolor: "warning.light" }, children: [
|
|
3194
|
+
/* @__PURE__ */ jsxs14(Typography14, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: [
|
|
3081
3195
|
"el componente para resolver el resultOk: '",
|
|
3082
3196
|
procedure.resultOk,
|
|
3083
3197
|
"' definido en el procedure no existe o no est\xE1 mapeado."
|
|
3084
3198
|
] }),
|
|
3085
|
-
/* @__PURE__ */ jsx22(
|
|
3199
|
+
/* @__PURE__ */ jsx22(Box16, { sx: {
|
|
3086
3200
|
bgcolor: "warning.dark",
|
|
3087
3201
|
p: 1,
|
|
3088
3202
|
borderRadius: 1
|
|
@@ -3091,7 +3205,7 @@ var ProcedureForm = () => {
|
|
|
3091
3205
|
}
|
|
3092
3206
|
}, [procedureResultData, procedure]);
|
|
3093
3207
|
if (!procedure) {
|
|
3094
|
-
return /* @__PURE__ */
|
|
3208
|
+
return /* @__PURE__ */ jsxs14(Box16, { sx: {
|
|
3095
3209
|
p: 2,
|
|
3096
3210
|
width: "100%",
|
|
3097
3211
|
boxSizing: "border-box",
|
|
@@ -3107,7 +3221,7 @@ var ProcedureForm = () => {
|
|
|
3107
3221
|
}
|
|
3108
3222
|
return (
|
|
3109
3223
|
// Esta es la Box más externa que ahora controlará el scroll
|
|
3110
|
-
/* @__PURE__ */
|
|
3224
|
+
/* @__PURE__ */ jsxs14(Box16, { sx: {
|
|
3111
3225
|
p: 2,
|
|
3112
3226
|
ml: 1,
|
|
3113
3227
|
mt: 2,
|
|
@@ -3125,13 +3239,13 @@ var ProcedureForm = () => {
|
|
|
3125
3239
|
// Oculta el scroll horizontal si no es necesario para el contenedor principal
|
|
3126
3240
|
}, children: [
|
|
3127
3241
|
/* @__PURE__ */ jsx22(Typography14, { variant: "h5", component: "h2", gutterBottom: true, align: "left", children: cambiarGuionesBajosPorEspacios(procedure.proceedLabel || procedure.action) }),
|
|
3128
|
-
Object.values(validationErrors).some((err) => err !== null) && /* @__PURE__ */
|
|
3242
|
+
Object.values(validationErrors).some((err) => err !== null) && /* @__PURE__ */ jsxs14(Alert3, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: [
|
|
3129
3243
|
"Por favor, corrige los errores en el formulario antes de enviar.",
|
|
3130
3244
|
/* @__PURE__ */ jsx22("ul", { children: Object.values(validationErrors).map((err, idx) => err && /* @__PURE__ */ jsx22("li", { children: err }, idx)) })
|
|
3131
3245
|
] }),
|
|
3132
3246
|
!Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */ jsx22(Alert3, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: apiError.message }),
|
|
3133
3247
|
!Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */ jsx22(Alert3, { severity: "success", sx: { mb: 2, fontSize: "0.8rem" }, children: successMessage }),
|
|
3134
|
-
/* @__PURE__ */
|
|
3248
|
+
/* @__PURE__ */ jsxs14("form", { onSubmit: handleSubmit, children: [
|
|
3135
3249
|
procedure.parameters.map((param) => /* @__PURE__ */ jsx22("div", { children: renderInputField(param) }, param.name)),
|
|
3136
3250
|
/* @__PURE__ */ jsx22(
|
|
3137
3251
|
Button7,
|
|
@@ -3147,15 +3261,15 @@ var ProcedureForm = () => {
|
|
|
3147
3261
|
}
|
|
3148
3262
|
)
|
|
3149
3263
|
] }),
|
|
3150
|
-
ResultDisplayContent && /* @__PURE__ */
|
|
3264
|
+
ResultDisplayContent && /* @__PURE__ */ jsxs14(Box16, { sx: { mt: 2 }, children: [
|
|
3151
3265
|
" ",
|
|
3152
3266
|
ResultDisplayContent
|
|
3153
3267
|
] }),
|
|
3154
|
-
executionLog.length > 0 && /* @__PURE__ */
|
|
3268
|
+
executionLog.length > 0 && /* @__PURE__ */ jsxs14(Box16, { sx: { mt: 3 }, children: [
|
|
3155
3269
|
/* @__PURE__ */ jsx22(Divider2, { sx: { mb: 2 } }),
|
|
3156
3270
|
/* @__PURE__ */ jsx22(Typography14, { variant: "h6", gutterBottom: true, sx: { fontSize: "0.9rem" }, children: "Registro de Ejecuci\xF3n" }),
|
|
3157
3271
|
/* @__PURE__ */ jsx22(
|
|
3158
|
-
|
|
3272
|
+
Box16,
|
|
3159
3273
|
{
|
|
3160
3274
|
sx: {
|
|
3161
3275
|
bgcolor: "grey.100",
|
|
@@ -3261,12 +3375,12 @@ var InitialRedirectHandler_default = InitialRedirectHandler;
|
|
|
3261
3375
|
|
|
3262
3376
|
// src/pages/GenericDataGridPage.tsx
|
|
3263
3377
|
import { useParams as useParams2 } from "react-router-dom";
|
|
3264
|
-
import { Box as
|
|
3265
|
-
import { jsx as jsx24, jsxs as
|
|
3378
|
+
import { Box as Box17, Alert as Alert4, Typography as Typography15 } from "@mui/material";
|
|
3379
|
+
import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3266
3380
|
var GenericDataGridPage = () => {
|
|
3267
3381
|
const { tableName } = useParams2();
|
|
3268
3382
|
if (!tableName) {
|
|
3269
|
-
return /* @__PURE__ */ jsx24(
|
|
3383
|
+
return /* @__PURE__ */ jsx24(Box17, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsxs15(Alert4, { severity: "error", children: [
|
|
3270
3384
|
/* @__PURE__ */ jsx24(Typography15, { variant: "h6", children: "Error: Nombre de tabla no especificado en la URL." }),
|
|
3271
3385
|
/* @__PURE__ */ jsx24(Typography15, { variant: "body1", children: "Por favor, aseg\xFArate de que la URL contenga el nombre de la tabla (ej. `/data/users`)." })
|
|
3272
3386
|
] }) });
|
|
@@ -3278,8 +3392,8 @@ var GenericDataGridPage_default = GenericDataGridPage;
|
|
|
3278
3392
|
// src/pages/MenuTablePage.tsx
|
|
3279
3393
|
import { useMemo as useMemo5 } from "react";
|
|
3280
3394
|
import { useParams as useParams3 } from "react-router-dom";
|
|
3281
|
-
import { Box as
|
|
3282
|
-
import { jsx as jsx25, jsxs as
|
|
3395
|
+
import { Box as Box18, Alert as Alert5, Typography as Typography16 } from "@mui/material";
|
|
3396
|
+
import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3283
3397
|
var MenuTablePage = () => {
|
|
3284
3398
|
const { menuName } = useParams3();
|
|
3285
3399
|
const { clientContext } = useApp();
|
|
@@ -3321,7 +3435,7 @@ var MenuTablePage = () => {
|
|
|
3321
3435
|
};
|
|
3322
3436
|
}, [menuName, clientContext]);
|
|
3323
3437
|
if (!currentTableName) {
|
|
3324
|
-
return /* @__PURE__ */ jsx25(
|
|
3438
|
+
return /* @__PURE__ */ jsx25(Box18, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsxs16(Alert5, { severity: "error", children: [
|
|
3325
3439
|
/* @__PURE__ */ jsx25(Typography16, { variant: "h6", children: "Error: No se pudo cargar la informaci\xF3n de la tabla." }),
|
|
3326
3440
|
/* @__PURE__ */ jsx25(Typography16, { variant: "body1", children: "Verifique la configuraci\xF3n del men\xFA o el nombre de la tabla en la URL." })
|
|
3327
3441
|
] }) });
|
|
@@ -3337,7 +3451,7 @@ var MenuTablePage = () => {
|
|
|
3337
3451
|
var MenuTablePage_default = MenuTablePage;
|
|
3338
3452
|
|
|
3339
3453
|
// src/App.tsx
|
|
3340
|
-
import { jsx as jsx26, jsxs as
|
|
3454
|
+
import { jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3341
3455
|
var LocationTracker = () => {
|
|
3342
3456
|
const location = useLocation4();
|
|
3343
3457
|
const dispatch = useAppDispatch();
|
|
@@ -3348,10 +3462,10 @@ var LocationTracker = () => {
|
|
|
3348
3462
|
};
|
|
3349
3463
|
function FrontendPlusReactRoutes({ myRoutes, myWScreens }) {
|
|
3350
3464
|
const allWScreens = { ...wScreens, ...myWScreens || {} };
|
|
3351
|
-
return /* @__PURE__ */
|
|
3465
|
+
return /* @__PURE__ */ jsxs17(Routes, { children: [
|
|
3352
3466
|
/* @__PURE__ */ jsx26(Route, { path: "/login", element: /* @__PURE__ */ jsx26(LoginPage_default, {}) }),
|
|
3353
3467
|
/* @__PURE__ */ jsx26(Route, { path: "/logout", element: /* @__PURE__ */ jsx26(LogoutPage_default, {}) }),
|
|
3354
|
-
/* @__PURE__ */
|
|
3468
|
+
/* @__PURE__ */ jsxs17(Route, { element: /* @__PURE__ */ jsxs17(PrivateRoute_default, { children: [
|
|
3355
3469
|
/* @__PURE__ */ jsx26(InitialRedirectHandler_default, {}),
|
|
3356
3470
|
/* @__PURE__ */ jsx26(MainLayout_default, {})
|
|
3357
3471
|
] }), children: [
|
|
@@ -3395,9 +3509,9 @@ var App = ({
|
|
|
3395
3509
|
extendResultsOk(myResultsOk);
|
|
3396
3510
|
}
|
|
3397
3511
|
}, [myClientSides, myResultsOk]);
|
|
3398
|
-
return /* @__PURE__ */ jsx26(Provider, { store, children: /* @__PURE__ */ jsx26(PersistGate, { loading: null, persistor, children: /* @__PURE__ */
|
|
3512
|
+
return /* @__PURE__ */ jsx26(Provider, { store, children: /* @__PURE__ */ jsx26(PersistGate, { loading: null, persistor, children: /* @__PURE__ */ jsxs17(BrowserRouter, { children: [
|
|
3399
3513
|
/* @__PURE__ */ jsx26(LocationTracker, {}),
|
|
3400
|
-
/* @__PURE__ */ jsx26(AppProvider, { children: /* @__PURE__ */
|
|
3514
|
+
/* @__PURE__ */ jsx26(AppProvider, { children: /* @__PURE__ */ jsxs17(SnackbarProvider, { children: [
|
|
3401
3515
|
/* @__PURE__ */ jsx26(
|
|
3402
3516
|
FrontendPlusReactRoutes,
|
|
3403
3517
|
{
|