frontend-plus-react 0.4.2 → 0.6.0
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/CLAUDE.md +27 -0
- package/README.md +8 -0
- package/dist/index.cjs +1356 -734
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -2
- package/dist/index.d.ts +21 -2
- package/dist/index.js +1320 -698
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/components/grid/GenericDataGrid.tsx
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as useState16, useEffect as useEffect6, useCallback as useCallback12, useContext as useContext4, useMemo as useMemo10, useRef as useRef7 } from "react";
|
|
3
3
|
import { DataGrid } from "react-data-grid";
|
|
4
4
|
import "react-data-grid/lib/styles.css";
|
|
5
5
|
|
|
@@ -317,7 +317,7 @@ var useApiCallWithoutSnackbar = () => {
|
|
|
317
317
|
};
|
|
318
318
|
|
|
319
319
|
// src/components/grid/GenericDataGrid.tsx
|
|
320
|
-
import { CircularProgress as CircularProgress4, Typography as
|
|
320
|
+
import { CircularProgress as CircularProgress4, Typography as Typography10, Box as Box12, Alert as Alert2, useTheme as useTheme4, Dialog as Dialog4 } from "@mui/material";
|
|
321
321
|
|
|
322
322
|
// src/store/index.ts
|
|
323
323
|
import { configureStore, combineReducers } from "@reduxjs/toolkit";
|
|
@@ -1046,6 +1046,16 @@ var getBestTypedValue = (valor, typer) => {
|
|
|
1046
1046
|
}
|
|
1047
1047
|
return BestControls.text.getTypedValue(value, typer);
|
|
1048
1048
|
};
|
|
1049
|
+
var tiparEntrada = (valor, typer) => {
|
|
1050
|
+
const entrada = typeof valor === "string" && valor.trim() === "" && typer.typeName !== "text" ? "" : valor;
|
|
1051
|
+
const tipado = getBestTypedValue(entrada, typer);
|
|
1052
|
+
if (tipado === null && typeof entrada === "string" && entrada !== "") {
|
|
1053
|
+
throw new Error(`\xAB${valor}\xBB no es un valor v\xE1lido para este campo (${typer.typeName})`);
|
|
1054
|
+
}
|
|
1055
|
+
return tipado;
|
|
1056
|
+
};
|
|
1057
|
+
var caracterRechazado = (caracter, typer) => caracter.length === 1 && typer.rejectedChar(caracter);
|
|
1058
|
+
var textoPegadoRechazado = (texto, typer) => Array.from(texto).some((caracter) => typer.rejectedChar(caracter));
|
|
1049
1059
|
|
|
1050
1060
|
// src/hooks/grid/useGridDataView.ts
|
|
1051
1061
|
var MAXIMO_FILAS_EDICION_PUNTUAL = 3;
|
|
@@ -1087,6 +1097,22 @@ var useGridDataView = ({ tableData, tableDefinition }) => {
|
|
|
1087
1097
|
return !prev;
|
|
1088
1098
|
});
|
|
1089
1099
|
}, []);
|
|
1100
|
+
const aplicarFiltrosIniciales = useCallback4((condiciones2, definicion) => {
|
|
1101
|
+
const iniciales = {};
|
|
1102
|
+
condiciones2.forEach(({ column, operator, value }) => {
|
|
1103
|
+
const fieldDef = definicion.fields.find((f) => f.name === column);
|
|
1104
|
+
let texto = value === null || value === void 0 ? "" : String(value);
|
|
1105
|
+
if (fieldDef && value !== null && value !== void 0) {
|
|
1106
|
+
try {
|
|
1107
|
+
texto = typeStore2.typerFrom(fieldDef).toLocalString(value);
|
|
1108
|
+
} catch (e) {
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
iniciales[column] = { operator, value: texto };
|
|
1112
|
+
});
|
|
1113
|
+
setFilters(iniciales);
|
|
1114
|
+
setIsFilterRowVisible(true);
|
|
1115
|
+
}, []);
|
|
1090
1116
|
const vistaAnteriorRef = useRef(null);
|
|
1091
1117
|
const filteredRows = useMemo(() => {
|
|
1092
1118
|
const anterior = vistaAnteriorRef.current;
|
|
@@ -1244,6 +1270,7 @@ var useGridDataView = ({ tableData, tableDefinition }) => {
|
|
|
1244
1270
|
setFilters,
|
|
1245
1271
|
isFilterRowVisible,
|
|
1246
1272
|
toggleFilterVisibility,
|
|
1273
|
+
aplicarFiltrosIniciales,
|
|
1247
1274
|
// Data
|
|
1248
1275
|
filteredRows,
|
|
1249
1276
|
summaryData,
|
|
@@ -1393,10 +1420,155 @@ function CeldaDetalle({ fila }) {
|
|
|
1393
1420
|
return /* @__PURE__ */ jsx5(Fragment2, { children: renderDetalle(fila) });
|
|
1394
1421
|
}
|
|
1395
1422
|
|
|
1423
|
+
// src/hooks/grid/teclasDeCelda.ts
|
|
1424
|
+
function direccionDeSalida(tecla, cursor, teclaAnterior) {
|
|
1425
|
+
if (tecla.ctrlKey || tecla.altKey || tecla.metaKey) return null;
|
|
1426
|
+
const conShift = !!tecla.shiftKey;
|
|
1427
|
+
switch (tecla.key) {
|
|
1428
|
+
case "Enter":
|
|
1429
|
+
return conShift ? null : "siguiente";
|
|
1430
|
+
case "Tab":
|
|
1431
|
+
return conShift ? "anterior" : "siguiente";
|
|
1432
|
+
case "ArrowUp":
|
|
1433
|
+
return conShift ? null : "arriba";
|
|
1434
|
+
case "ArrowDown":
|
|
1435
|
+
return conShift ? null : "abajo";
|
|
1436
|
+
case "ArrowLeft":
|
|
1437
|
+
return !conShift && (cursor.vacio || cursor.alPrincipio) ? "izquierda" : null;
|
|
1438
|
+
case "ArrowRight":
|
|
1439
|
+
return !conShift && (cursor.vacio || teclaAnterior === "ArrowRight" && cursor.alFinal) ? "derecha" : null;
|
|
1440
|
+
default:
|
|
1441
|
+
return null;
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
function posicionDelCursor(elemento) {
|
|
1445
|
+
if (elemento instanceof HTMLInputElement || elemento instanceof HTMLTextAreaElement) {
|
|
1446
|
+
const fin = elemento.selectionEnd ?? elemento.value.length;
|
|
1447
|
+
return { vacio: elemento.value === "", alPrincipio: fin === 0, alFinal: fin === elemento.value.length };
|
|
1448
|
+
}
|
|
1449
|
+
return { vacio: true, alPrincipio: true, alFinal: true };
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
// src/utils/fixedFields.ts
|
|
1453
|
+
function fijaElValor(fixedField) {
|
|
1454
|
+
return !fixedField.range && fixedField.until === void 0;
|
|
1455
|
+
}
|
|
1456
|
+
function valorFijoDe(fixedFields, columna) {
|
|
1457
|
+
return fixedFields?.find((f) => f.fieldName === columna && fijaElValor(f));
|
|
1458
|
+
}
|
|
1459
|
+
function columnaOcultaPorFixedField(fixedFields, columna) {
|
|
1460
|
+
const fijo = valorFijoDe(fixedFields, columna);
|
|
1461
|
+
return fijo !== void 0 && !fijo.show;
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
// src/utils/referencias.ts
|
|
1465
|
+
var esParDeCampos = (par) => typeof par === "object" && par !== null && "source" in par && "target" in par && typeof par.source === "string" && typeof par.target === "string";
|
|
1466
|
+
var esCampoConReferencia = (campo) => typeof campo.references === "string" && campo.references !== "" && (!("referencesFields" in campo) || campo.referencesFields === void 0 || Array.isArray(campo.referencesFields) && campo.referencesFields.every(esParDeCampos)) && !("skipReferenceLookup" in campo && campo.skipReferenceLookup);
|
|
1467
|
+
var camposDeNombre = (definicion) => {
|
|
1468
|
+
const comoTextos = (campos) => Array.isArray(campos) ? campos.filter((c) => typeof c === "string") : [];
|
|
1469
|
+
if (definicion.lookupFields && definicion.lookupFields.length > 0) return definicion.lookupFields;
|
|
1470
|
+
return "nameFields" in definicion ? comoTextos(definicion.nameFields) : [];
|
|
1471
|
+
};
|
|
1472
|
+
var campoDeActivo = (definicion) => "activeRecords" in definicion && typeof definicion.activeRecords === "object" && definicion.activeRecords !== null && "fieldName" in definicion.activeRecords && typeof definicion.activeRecords.fieldName === "string" ? definicion.activeRecords.fieldName : null;
|
|
1473
|
+
var comoTexto = (valor) => valor === null || valor === void 0 ? "" : String(valor);
|
|
1474
|
+
var opcionesDeReferencia = (campo, definicionReferenciada, filasReferenciadas, filaActual, admiteNulo) => {
|
|
1475
|
+
const pares = campo.referencesFields ?? [];
|
|
1476
|
+
const columnaDelValor = pares.length > 0 ? pares[pares.length - 1].target : definicionReferenciada.primaryKey[definicionReferenciada.primaryKey.length - 1];
|
|
1477
|
+
const anteriores = pares.slice(0, -1);
|
|
1478
|
+
const activo = campoDeActivo(definicionReferenciada);
|
|
1479
|
+
const nombres = camposDeNombre(definicionReferenciada);
|
|
1480
|
+
const columnasDeEtiqueta = nombres.length > 0 ? [...definicionReferenciada.primaryKey, ...nombres] : definicionReferenciada.primaryKey;
|
|
1481
|
+
const opciones = filasReferenciadas.filter((fila) => (activo === null || !!fila[activo]) && (filaActual === null || anteriores.every((par) => comoTexto(fila[par.target]) === comoTexto(filaActual[par.source])))).map((fila) => {
|
|
1482
|
+
const etiquetas = columnasDeEtiqueta.map((columna) => comoTexto(fila[columna]));
|
|
1483
|
+
return { valor: fila[columnaDelValor], etiquetas, texto: `${etiquetas.join(", ")}; ${definicionReferenciada.primaryKey.join(", ")}` };
|
|
1484
|
+
});
|
|
1485
|
+
const ordenar = new Intl.Collator("es", { numeric: true, sensitivity: "base" });
|
|
1486
|
+
opciones.sort((a, b) => ordenar.compare(a.texto, b.texto));
|
|
1487
|
+
if (admiteNulo) opciones.push({ valor: null, etiquetas: ["", "(vac\xEDo)"], texto: "" });
|
|
1488
|
+
return opciones;
|
|
1489
|
+
};
|
|
1490
|
+
var filtrarOpciones = (opciones, busqueda) => {
|
|
1491
|
+
const simplificar = (texto) => texto.normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase();
|
|
1492
|
+
const palabras = simplificar(busqueda).split(/\s+/).filter((p) => p !== "");
|
|
1493
|
+
if (palabras.length === 0) return opciones;
|
|
1494
|
+
return opciones.filter((opcion) => opcion.valor === null || palabras.every((p) => simplificar(opcion.etiquetas.join(" ")).includes(p)));
|
|
1495
|
+
};
|
|
1496
|
+
var VIGENCIA_DE_REFERENCIA_MS = 2 * 60 * 1e3;
|
|
1497
|
+
var referencias = /* @__PURE__ */ new Map();
|
|
1498
|
+
var cargarReferencia = (tabla) => {
|
|
1499
|
+
const guardada = referencias.get(tabla);
|
|
1500
|
+
if (guardada && Date.now() - guardada.cuando < VIGENCIA_DE_REFERENCIA_MS) return guardada.cargada;
|
|
1501
|
+
const cargada = (async () => {
|
|
1502
|
+
const [definicion, filas] = await Promise.all([
|
|
1503
|
+
executeBackendProcedure("table_structure", { table: tabla }),
|
|
1504
|
+
executeBackendProcedure("table_data", { table: tabla, fixedFields: [] })
|
|
1505
|
+
]);
|
|
1506
|
+
return { definicion: requerido(definicion, `la estructura de '${tabla}'`), filas: requerido(filas, `los datos de '${tabla}'`) };
|
|
1507
|
+
})();
|
|
1508
|
+
referencias.set(tabla, { cargada, cuando: Date.now() });
|
|
1509
|
+
cargada.catch(() => {
|
|
1510
|
+
if (referencias.get(tabla)?.cargada === cargada) referencias.delete(tabla);
|
|
1511
|
+
});
|
|
1512
|
+
return cargada;
|
|
1513
|
+
};
|
|
1514
|
+
|
|
1515
|
+
// src/utils/expanders.ts
|
|
1516
|
+
var tipoDeExpander = (campo, editable) => {
|
|
1517
|
+
if (campo.typeName === "jsonb" && !editable) return "json";
|
|
1518
|
+
if (editable) {
|
|
1519
|
+
if (esCampoConReferencia(campo)) return "referencia";
|
|
1520
|
+
if (campo.typeName === "boolean") return "booleano";
|
|
1521
|
+
if (campo.options && campo.options.length > 0) return "opciones";
|
|
1522
|
+
if (campo.typeName === "date") return "fecha";
|
|
1523
|
+
}
|
|
1524
|
+
return campo.clientSide ? null : "texto";
|
|
1525
|
+
};
|
|
1526
|
+
var SI_NO_VACIO = { si: "S\xED", no: "No", vacio: "(vac\xEDo)" };
|
|
1527
|
+
var opcionesDeBooleano = (admiteNulo) => {
|
|
1528
|
+
const opciones = [
|
|
1529
|
+
{ valor: true, etiquetas: [SI_NO_VACIO.si], texto: SI_NO_VACIO.si },
|
|
1530
|
+
{ valor: false, etiquetas: [SI_NO_VACIO.no], texto: SI_NO_VACIO.no }
|
|
1531
|
+
];
|
|
1532
|
+
if (admiteNulo) opciones.push({ valor: null, etiquetas: ["", SI_NO_VACIO.vacio], texto: "" });
|
|
1533
|
+
return opciones;
|
|
1534
|
+
};
|
|
1535
|
+
var opcionesDeEnumerado = (opciones, admiteNulo) => {
|
|
1536
|
+
const resultado = opciones.map((opcion) => typeof opcion === "string" ? { valor: opcion, etiquetas: [opcion], texto: opcion } : { valor: opcion.option, etiquetas: [String(opcion.option), opcion.label], texto: `${opcion.option} ${opcion.label}` });
|
|
1537
|
+
if (admiteNulo) resultado.push({ valor: null, etiquetas: ["", SI_NO_VACIO.vacio], texto: "" });
|
|
1538
|
+
return resultado;
|
|
1539
|
+
};
|
|
1540
|
+
var fechaDeValor = (valor) => {
|
|
1541
|
+
if (valor instanceof Date && !isNaN(valor.getTime())) return { anio: valor.getFullYear(), mes: valor.getMonth(), dia: valor.getDate() };
|
|
1542
|
+
if (typeof valor === "string") {
|
|
1543
|
+
const partes = /^(\d{4})-(\d{2})-(\d{2})/.exec(valor);
|
|
1544
|
+
if (partes) return { anio: Number(partes[1]), mes: Number(partes[2]) - 1, dia: Number(partes[3]) };
|
|
1545
|
+
}
|
|
1546
|
+
return null;
|
|
1547
|
+
};
|
|
1548
|
+
var fechaATexto = ({ anio, mes, dia }) => `${String(anio).padStart(4, "0")}-${String(mes + 1).padStart(2, "0")}-${String(dia).padStart(2, "0")}`;
|
|
1549
|
+
var semanasDelMes = (anio, mes) => {
|
|
1550
|
+
const primero = new Date(anio, mes, 1);
|
|
1551
|
+
const desfase = (primero.getDay() + 6) % 7;
|
|
1552
|
+
const diasDelMes = new Date(anio, mes + 1, 0).getDate();
|
|
1553
|
+
const semanas = [];
|
|
1554
|
+
for (let celda = 0; celda < Math.ceil((desfase + diasDelMes) / 7) * 7; celda++) {
|
|
1555
|
+
const fecha = new Date(anio, mes, 1 - desfase + celda);
|
|
1556
|
+
const dia = { anio: fecha.getFullYear(), mes: fecha.getMonth(), dia: fecha.getDate(), delMesMostrado: fecha.getMonth() === mes };
|
|
1557
|
+
if (celda % 7 === 0) semanas.push([]);
|
|
1558
|
+
semanas[semanas.length - 1].push(dia);
|
|
1559
|
+
}
|
|
1560
|
+
return semanas;
|
|
1561
|
+
};
|
|
1562
|
+
var textoParaVer = (valor) => {
|
|
1563
|
+
if (valor === null || valor === void 0) return "";
|
|
1564
|
+
if (typeof valor === "object" && !(valor instanceof Date)) return JSON.stringify(valor, null, 2);
|
|
1565
|
+
return String(valor);
|
|
1566
|
+
};
|
|
1567
|
+
|
|
1396
1568
|
// src/hooks/grid/useGridEvents.ts
|
|
1397
1569
|
var VIGENCIA_TECLA_PENDIENTE = 400;
|
|
1398
1570
|
var VIGENCIA_VALOR_PENDIENTE_F4 = 1e3;
|
|
1399
|
-
var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fixedFields, setSelectedCell, setTableData, setSortColumns }) => {
|
|
1571
|
+
var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fixedFields, setSelectedCell, setTableData, setSortColumns, verContenido }) => {
|
|
1400
1572
|
const filteredRowsRef = useRef3(filteredRows);
|
|
1401
1573
|
filteredRowsRef.current = filteredRows;
|
|
1402
1574
|
const tableDefinitionRef = useRef3(tableDefinition);
|
|
@@ -1404,6 +1576,7 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1404
1576
|
const valoresF4Pendientes = useRef3(/* @__PURE__ */ new Map());
|
|
1405
1577
|
const teclasPendientes = useRef3([]);
|
|
1406
1578
|
const editorActivo = useRef3(null);
|
|
1579
|
+
const teclaAnteriorRef = useRef3(null);
|
|
1407
1580
|
const registrarEditor = useCallback5((procesar) => {
|
|
1408
1581
|
editorActivo.current = procesar;
|
|
1409
1582
|
const cola = teclasPendientes.current;
|
|
@@ -1414,7 +1587,8 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1414
1587
|
if (editorActivo.current === procesar) editorActivo.current = null;
|
|
1415
1588
|
};
|
|
1416
1589
|
}, []);
|
|
1417
|
-
const handleKeyPressInEditor = useCallback5((rowIndex, columnKey, event, currentColumns, handleCommit) => {
|
|
1590
|
+
const handleKeyPressInEditor = useCallback5((rowIndex, columnKey, event, currentColumns, handleCommit, valorActual) => {
|
|
1591
|
+
let resuelta = false;
|
|
1418
1592
|
const tableDefinition2 = tableDefinitionRef.current;
|
|
1419
1593
|
const filteredRows2 = filteredRowsRef.current;
|
|
1420
1594
|
if (dataGridRef.current && tableDefinition2) {
|
|
@@ -1424,7 +1598,9 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1424
1598
|
return col.key !== "actionsColumn" && !(esColumnaPropia(col) && col.customType === "detail") && (fieldDefinition?.editable !== false && !fieldDefinition?.clientSide);
|
|
1425
1599
|
});
|
|
1426
1600
|
const { key, target } = event;
|
|
1427
|
-
const
|
|
1601
|
+
const teclaAnterior = teclaAnteriorRef.current;
|
|
1602
|
+
teclaAnteriorRef.current = key;
|
|
1603
|
+
const direccion = direccionDeSalida(event, posicionDelCursor(target), teclaAnterior);
|
|
1428
1604
|
if (currentColumnIndex !== -1 && editableColumns.length > 0) {
|
|
1429
1605
|
const editableColumnKeys = editableColumns.map((col) => col.key);
|
|
1430
1606
|
let currentEditableColumnIndex = editableColumnKeys.indexOf(columnKey);
|
|
@@ -1448,57 +1624,42 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1448
1624
|
const nextColumnIndex = currentColumns.findIndex((col) => col.key === nextColumnKey);
|
|
1449
1625
|
return { rowIdx: nextRowIndex, idx: nextColumnIndex };
|
|
1450
1626
|
};
|
|
1451
|
-
const
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
const
|
|
1459
|
-
return { rowIdx:
|
|
1627
|
+
const indiceDeColumna = (indiceEditable) => currentColumns.findIndex((col) => col.key === editableColumnKeys[indiceEditable]);
|
|
1628
|
+
const calcularColumnaAnteriorConSalto = () => {
|
|
1629
|
+
if (currentEditableColumnIndex > 0) return { rowIdx: rowIndex, idx: indiceDeColumna(currentEditableColumnIndex - 1) };
|
|
1630
|
+
const filaAnterior = filaDeDatos(rowIndex, -1);
|
|
1631
|
+
return filaAnterior === -1 ? null : { rowIdx: filaAnterior, idx: indiceDeColumna(editableColumnKeys.length - 1) };
|
|
1632
|
+
};
|
|
1633
|
+
const calcularColumnaVecina = (paso) => {
|
|
1634
|
+
const vecina = currentEditableColumnIndex + paso;
|
|
1635
|
+
return vecina < 0 || vecina >= editableColumnKeys.length ? null : { rowIdx: rowIndex, idx: indiceDeColumna(vecina) };
|
|
1636
|
+
};
|
|
1637
|
+
const calcularFilaVecina = (paso) => {
|
|
1638
|
+
const vecina = filaDeDatos(rowIndex, paso);
|
|
1639
|
+
return vecina === -1 ? null : { rowIdx: vecina, idx: currentColumnIndex };
|
|
1460
1640
|
};
|
|
1461
1641
|
const calcularFilaSiguiente = () => {
|
|
1462
1642
|
const nextRowIndex = filaDeDatos(rowIndex, 1);
|
|
1463
1643
|
return { rowIdx: nextRowIndex === -1 ? rowIndex : nextRowIndex, idx: currentColumnIndex };
|
|
1464
1644
|
};
|
|
1465
|
-
const calcularFilaAnterior = () => {
|
|
1466
|
-
const nextRowIndex = filaDeDatos(rowIndex, -1);
|
|
1467
|
-
return { rowIdx: nextRowIndex === -1 ? rowIndex : nextRowIndex, idx: currentColumnIndex };
|
|
1468
|
-
};
|
|
1469
1645
|
if (currentEditableColumnIndex !== -1) {
|
|
1470
1646
|
switch (true) {
|
|
1471
|
-
case
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
}
|
|
1485
|
-
case key === "ArrowLeft": {
|
|
1486
|
-
if (input && typeof input.selectionStart === "number") {
|
|
1487
|
-
const cursorPosition = input.selectionStart;
|
|
1488
|
-
if (cursorPosition === 0) {
|
|
1489
|
-
hacerFoco(calcularColumnaAnterior());
|
|
1490
|
-
}
|
|
1647
|
+
case direccion !== null: {
|
|
1648
|
+
resuelta = true;
|
|
1649
|
+
const destino = {
|
|
1650
|
+
siguiente: calcularColumnaSiguiente,
|
|
1651
|
+
anterior: calcularColumnaAnteriorConSalto,
|
|
1652
|
+
izquierda: () => calcularColumnaVecina(-1),
|
|
1653
|
+
derecha: () => calcularColumnaVecina(1),
|
|
1654
|
+
arriba: () => calcularFilaVecina(-1),
|
|
1655
|
+
abajo: () => calcularFilaVecina(1)
|
|
1656
|
+
}[direccion]();
|
|
1657
|
+
if (destino) {
|
|
1658
|
+
void handleCommit(valorActual, true, true);
|
|
1659
|
+
hacerFoco(destino);
|
|
1491
1660
|
}
|
|
1492
1661
|
break;
|
|
1493
1662
|
}
|
|
1494
|
-
case key === "ArrowUp": {
|
|
1495
|
-
hacerFoco(calcularFilaAnterior());
|
|
1496
|
-
break;
|
|
1497
|
-
}
|
|
1498
|
-
case key === "ArrowDown": {
|
|
1499
|
-
hacerFoco(calcularFilaSiguiente());
|
|
1500
|
-
break;
|
|
1501
|
-
}
|
|
1502
1663
|
case key === "F4": {
|
|
1503
1664
|
const { rowIdx, idx } = calcularFilaSiguiente();
|
|
1504
1665
|
const indiceAnterior = filaDeDatos(rowIndex, -1);
|
|
@@ -1519,8 +1680,26 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1519
1680
|
}
|
|
1520
1681
|
}
|
|
1521
1682
|
}
|
|
1683
|
+
return resuelta;
|
|
1522
1684
|
}, [dataGridRef]);
|
|
1523
1685
|
const handleCellKeyDown = useCallback5((args, event) => {
|
|
1686
|
+
const esExpander = event.key === "F9" && !event.shiftKey && !event.ctrlKey && !event.altKey || event.key === "ArrowDown" && event.altKey && !event.shiftKey && !event.ctrlKey;
|
|
1687
|
+
if (esExpander && !(event.target instanceof HTMLInputElement) && !esFilaDetalle(args.row)) {
|
|
1688
|
+
const campo = tableDefinitionRef.current?.fields.find((f) => f.name === args.column.key);
|
|
1689
|
+
const editable = typeof args.column.editable === "function" ? args.column.editable(args.row) : args.column.editable === true;
|
|
1690
|
+
const tipo = campo ? tipoDeExpander(campo, editable) : null;
|
|
1691
|
+
if (campo && editable && tipo !== null) {
|
|
1692
|
+
teclasPendientes.current.push({ key: "F9", cuando: Date.now() });
|
|
1693
|
+
dataGridRef.current?.selectCell({ rowIdx: args.rowIdx, idx: args.column.idx }, { enableEditor: true, shouldFocusCell: true });
|
|
1694
|
+
event.preventGridDefault();
|
|
1695
|
+
return;
|
|
1696
|
+
}
|
|
1697
|
+
if (campo && !editable && (tipo === "json" || tipo === "texto") && verContenido && event.target instanceof HTMLElement) {
|
|
1698
|
+
verContenido(event.target, textoParaVer(args.row[campo.name]));
|
|
1699
|
+
event.preventGridDefault();
|
|
1700
|
+
return;
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1524
1703
|
if (event.key === "F4" && !(event.target instanceof HTMLInputElement) && !esFilaDetalle(args.row)) {
|
|
1525
1704
|
const fieldDefinition = tableDefinitionRef.current?.fields.find((f) => f.name === args.column.key);
|
|
1526
1705
|
if (fieldDefinition && fieldDefinition.editable !== false && !fieldDefinition.clientSide) {
|
|
@@ -1533,7 +1712,7 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1533
1712
|
if (["Enter", "Tab", "ArrowDown", "ArrowUp", "ArrowRight", "ArrowLeft"].includes(event.key)) {
|
|
1534
1713
|
event.preventGridDefault();
|
|
1535
1714
|
}
|
|
1536
|
-
}, []);
|
|
1715
|
+
}, [dataGridRef, verContenido]);
|
|
1537
1716
|
const handleCellMouseDown = useCallback5((_args, event) => {
|
|
1538
1717
|
event.preventGridDefault();
|
|
1539
1718
|
}, []);
|
|
@@ -1546,10 +1725,12 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1546
1725
|
const handleCellClick = useCallback5((args, _event) => {
|
|
1547
1726
|
if (esFilaDetalle(args.row)) return;
|
|
1548
1727
|
const fieldDefinition = tableDefinition?.fields.find((f) => f.name === args.column.key);
|
|
1549
|
-
const isFixedField = fixedFields
|
|
1728
|
+
const isFixedField = valorFijoDe(fixedFields, args.column.key) !== void 0;
|
|
1550
1729
|
const isEditable = fieldDefinition?.editable !== false && !isFixedField;
|
|
1551
1730
|
if (isEditable) {
|
|
1552
1731
|
args.selectCell(true);
|
|
1732
|
+
} else if (fieldDefinition && tipoDeExpander(fieldDefinition, false) !== null) {
|
|
1733
|
+
args.selectCell(false);
|
|
1553
1734
|
}
|
|
1554
1735
|
}, [tableDefinition, fixedFields]);
|
|
1555
1736
|
const handleRowsChange = useCallback5((updatedRows, data) => {
|
|
@@ -1722,7 +1903,7 @@ var useGridMenu = ({
|
|
|
1722
1903
|
};
|
|
1723
1904
|
|
|
1724
1905
|
// src/hooks/grid/useGridColumns.ts
|
|
1725
|
-
import
|
|
1906
|
+
import React13, { useMemo as useMemo8 } from "react";
|
|
1726
1907
|
|
|
1727
1908
|
// src/utils/functions.tsx
|
|
1728
1909
|
import * as JSON4all2 from "json4all";
|
|
@@ -1880,11 +2061,11 @@ var ActionsColumnHeaderCell = ({
|
|
|
1880
2061
|
var detailColumnCellHeaderRenderer = (props, detailTable) => /* @__PURE__ */ jsx6(Tooltip2, { title: detailTable.label, children: /* @__PURE__ */ jsx6(Typography2, { variant: "caption", sx: { fontSize: "0.75rem", fontWeight: "bold" }, children: detailTable.abr.toUpperCase() }) });
|
|
1881
2062
|
|
|
1882
2063
|
// src/components/grid/FilterInputRender.tsx
|
|
1883
|
-
import { InputBase, Box as Box4 } from "@mui/material";
|
|
1884
|
-
import
|
|
2064
|
+
import { InputBase as InputBase3, Box as Box4 } from "@mui/material";
|
|
2065
|
+
import React10 from "react";
|
|
1885
2066
|
|
|
1886
2067
|
// src/components/forms/TypedField.tsx
|
|
1887
|
-
import { useState as
|
|
2068
|
+
import { useState as useState11, useEffect as useEffect4, useMemo as useMemo6, useCallback as useCallback8 } from "react";
|
|
1888
2069
|
import {
|
|
1889
2070
|
TextField,
|
|
1890
2071
|
FormControl,
|
|
@@ -1896,13 +2077,282 @@ import {
|
|
|
1896
2077
|
useTheme
|
|
1897
2078
|
} from "@mui/material";
|
|
1898
2079
|
import typeStore3 from "type-store";
|
|
1899
|
-
import { useRef as
|
|
2080
|
+
import { useRef as useRef5 } from "react";
|
|
2081
|
+
|
|
2082
|
+
// src/hooks/grid/useExpander.tsx
|
|
2083
|
+
import React8, { useCallback as useCallback7, useState as useState10 } from "react";
|
|
2084
|
+
import IconButton4 from "@mui/material/IconButton";
|
|
2085
|
+
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
|
|
2086
|
+
import CalendarMonthIcon from "@mui/icons-material/CalendarMonth";
|
|
2087
|
+
import SearchIcon2 from "@mui/icons-material/Search";
|
|
2088
|
+
|
|
2089
|
+
// src/components/grid/MenuDeOpciones.tsx
|
|
2090
|
+
import { useEffect as useEffect3, useMemo as useMemo5, useRef as useRef4, useState as useState7 } from "react";
|
|
2091
|
+
import { InputBase, List as List2, ListItemButton as ListItemButton2, Popover as Popover2, Typography as Typography3 } from "@mui/material";
|
|
1900
2092
|
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2093
|
+
function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar }) {
|
|
2094
|
+
const [busqueda, setBusqueda] = useState7(busquedaInicial);
|
|
2095
|
+
const [indice, setIndice] = useState7(0);
|
|
2096
|
+
const visibles = useMemo5(() => filtrarOpciones(opciones, busqueda), [opciones, busqueda]);
|
|
2097
|
+
const elegida = useRef4(null);
|
|
2098
|
+
useEffect3(() => {
|
|
2099
|
+
elegida.current?.scrollIntoView({ block: "nearest" });
|
|
2100
|
+
}, [indice, visibles]);
|
|
2101
|
+
const alApretar = (evento) => {
|
|
2102
|
+
if (evento.key === "ArrowDown") {
|
|
2103
|
+
setIndice((i) => Math.min(i + 1, visibles.length - 1));
|
|
2104
|
+
} else if (evento.key === "ArrowUp") {
|
|
2105
|
+
setIndice((i) => Math.max(i - 1, 0));
|
|
2106
|
+
} else if (evento.key === "Enter") {
|
|
2107
|
+
if (visibles[indice]) onElegir(visibles[indice].valor);
|
|
2108
|
+
} else if (evento.key === "F9" || evento.key === "Escape") {
|
|
2109
|
+
onCerrar();
|
|
2110
|
+
} else {
|
|
2111
|
+
return;
|
|
2112
|
+
}
|
|
2113
|
+
evento.preventDefault();
|
|
2114
|
+
evento.stopPropagation();
|
|
2115
|
+
};
|
|
2116
|
+
return /* @__PURE__ */ jsxs6(
|
|
2117
|
+
Popover2,
|
|
2118
|
+
{
|
|
2119
|
+
open: true,
|
|
2120
|
+
anchorEl: anclaje,
|
|
2121
|
+
onClose: onCerrar,
|
|
2122
|
+
disableRestoreFocus: true,
|
|
2123
|
+
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
2124
|
+
slotProps: { paper: { sx: { minWidth: 300, maxWidth: 520 } } },
|
|
2125
|
+
children: [
|
|
2126
|
+
/* @__PURE__ */ jsx7(
|
|
2127
|
+
InputBase,
|
|
2128
|
+
{
|
|
2129
|
+
autoFocus: true,
|
|
2130
|
+
fullWidth: true,
|
|
2131
|
+
value: busqueda,
|
|
2132
|
+
onChange: (e) => {
|
|
2133
|
+
setBusqueda(e.target.value);
|
|
2134
|
+
setIndice(0);
|
|
2135
|
+
},
|
|
2136
|
+
onKeyDown: alApretar,
|
|
2137
|
+
placeholder: "buscar",
|
|
2138
|
+
sx: { px: 1, py: 0.5, fontSize: "0.8rem", borderBottom: "1px solid #ccc" },
|
|
2139
|
+
inputProps: { "aria-label": "buscar" }
|
|
2140
|
+
}
|
|
2141
|
+
),
|
|
2142
|
+
/* @__PURE__ */ jsxs6(List2, { dense: true, disablePadding: true, sx: { maxHeight: 320, overflowY: "auto" }, role: "listbox", children: [
|
|
2143
|
+
visibles.length === 0 && /* @__PURE__ */ jsx7(Typography3, { variant: "body2", sx: { p: 1, color: "text.secondary" }, children: "sin coincidencias" }),
|
|
2144
|
+
visibles.map((opcion, i) => /* @__PURE__ */ jsx7(
|
|
2145
|
+
ListItemButton2,
|
|
2146
|
+
{
|
|
2147
|
+
ref: i === indice ? elegida : null,
|
|
2148
|
+
selected: i === indice,
|
|
2149
|
+
role: "option",
|
|
2150
|
+
onClick: () => onElegir(opcion.valor),
|
|
2151
|
+
sx: { gap: 2, py: 0.25, fontSize: "0.8rem" },
|
|
2152
|
+
children: opcion.etiquetas.map((etiqueta, j) => /* @__PURE__ */ jsx7("span", { style: { fontWeight: j === 0 ? 600 : 400, minWidth: j === 0 ? 40 : void 0 }, children: etiqueta }, j))
|
|
2153
|
+
},
|
|
2154
|
+
i
|
|
2155
|
+
))
|
|
2156
|
+
] })
|
|
2157
|
+
]
|
|
2158
|
+
}
|
|
2159
|
+
);
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
// src/components/grid/SelectorDeFecha.tsx
|
|
2163
|
+
import { useState as useState8 } from "react";
|
|
2164
|
+
import { Button as Button2, IconButton as IconButton3, Popover as Popover3, Typography as Typography4 } from "@mui/material";
|
|
2165
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2166
|
+
var MESES = ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"];
|
|
2167
|
+
var DIAS = ["lu", "ma", "mi", "ju", "vi", "s\xE1", "do"];
|
|
2168
|
+
var mismaFecha = (a, b) => b !== null && a.anio === b.anio && a.mes === b.mes && a.dia === b.dia;
|
|
2169
|
+
var MOVIMIENTOS = {
|
|
2170
|
+
ArrowLeft: [-1, 0],
|
|
2171
|
+
ArrowRight: [1, 0],
|
|
2172
|
+
ArrowUp: [-7, 0],
|
|
2173
|
+
ArrowDown: [7, 0],
|
|
2174
|
+
PageUp: [0, -1],
|
|
2175
|
+
PageDown: [0, 1]
|
|
2176
|
+
};
|
|
2177
|
+
function SelectorDeFecha({ anclaje, fechaActual, admiteNulo, onElegir, onCerrar }) {
|
|
2178
|
+
const hoy = /* @__PURE__ */ new Date();
|
|
2179
|
+
const fechaDeHoy = { anio: hoy.getFullYear(), mes: hoy.getMonth(), dia: hoy.getDate() };
|
|
2180
|
+
const [cursor, setCursor] = useState8(fechaActual ?? fechaDeHoy);
|
|
2181
|
+
const mover = (dias, meses) => {
|
|
2182
|
+
const nueva = new Date(cursor.anio, cursor.mes + meses, cursor.dia + dias);
|
|
2183
|
+
setCursor({ anio: nueva.getFullYear(), mes: nueva.getMonth(), dia: nueva.getDate() });
|
|
2184
|
+
};
|
|
2185
|
+
const alApretar = (evento) => {
|
|
2186
|
+
if (evento.key in MOVIMIENTOS) {
|
|
2187
|
+
mover(...MOVIMIENTOS[evento.key]);
|
|
2188
|
+
} else if (evento.key === "Enter") {
|
|
2189
|
+
onElegir(fechaATexto(cursor));
|
|
2190
|
+
} else if (evento.key === "F9" || evento.key === "Escape") {
|
|
2191
|
+
onCerrar();
|
|
2192
|
+
} else {
|
|
2193
|
+
return;
|
|
2194
|
+
}
|
|
2195
|
+
evento.preventDefault();
|
|
2196
|
+
evento.stopPropagation();
|
|
2197
|
+
};
|
|
2198
|
+
return /* @__PURE__ */ jsx8(Popover3, { open: true, anchorEl: anclaje, onClose: onCerrar, disableRestoreFocus: true, anchorOrigin: { vertical: "bottom", horizontal: "left" }, children: /* @__PURE__ */ jsxs7("div", { tabIndex: 0, ref: (el) => el?.focus(), onKeyDown: alApretar, style: { padding: 8, outline: "none", width: 252 }, "aria-label": "calendario", children: [
|
|
2199
|
+
/* @__PURE__ */ jsxs7("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
2200
|
+
/* @__PURE__ */ jsx8(IconButton3, { size: "small", "aria-label": "mes anterior", onClick: () => mover(0, -1), children: "\u2039" }),
|
|
2201
|
+
/* @__PURE__ */ jsxs7(Typography4, { variant: "body2", sx: { fontWeight: 600 }, children: [
|
|
2202
|
+
MESES[cursor.mes],
|
|
2203
|
+
" ",
|
|
2204
|
+
cursor.anio
|
|
2205
|
+
] }),
|
|
2206
|
+
/* @__PURE__ */ jsx8(IconButton3, { size: "small", "aria-label": "mes siguiente", onClick: () => mover(0, 1), children: "\u203A" })
|
|
2207
|
+
] }),
|
|
2208
|
+
/* @__PURE__ */ jsxs7("table", { style: { borderCollapse: "collapse", width: "100%", textAlign: "center", fontSize: "0.8rem" }, children: [
|
|
2209
|
+
/* @__PURE__ */ jsx8("thead", { children: /* @__PURE__ */ jsx8("tr", { children: DIAS.map((d) => /* @__PURE__ */ jsx8("th", { style: { fontWeight: 400, color: "#777" }, children: d }, d)) }) }),
|
|
2210
|
+
/* @__PURE__ */ jsx8("tbody", { children: semanasDelMes(cursor.anio, cursor.mes).map((semana, i) => /* @__PURE__ */ jsx8("tr", { children: semana.map((dia) => {
|
|
2211
|
+
const elegido = mismaFecha(dia, fechaActual);
|
|
2212
|
+
const enCursor = mismaFecha(dia, cursor);
|
|
2213
|
+
return /* @__PURE__ */ jsx8("td", { style: { padding: 1 }, children: /* @__PURE__ */ jsx8(
|
|
2214
|
+
"button",
|
|
2215
|
+
{
|
|
2216
|
+
type: "button",
|
|
2217
|
+
tabIndex: -1,
|
|
2218
|
+
onClick: () => onElegir(fechaATexto(dia)),
|
|
2219
|
+
style: {
|
|
2220
|
+
width: 32,
|
|
2221
|
+
height: 26,
|
|
2222
|
+
border: enCursor ? "1px solid #1976d2" : "1px solid transparent",
|
|
2223
|
+
borderRadius: 4,
|
|
2224
|
+
cursor: "pointer",
|
|
2225
|
+
background: elegido ? "#1976d2" : "transparent",
|
|
2226
|
+
color: elegido ? "#fff" : dia.delMesMostrado ? "#000" : "#aaa"
|
|
2227
|
+
},
|
|
2228
|
+
children: dia.dia
|
|
2229
|
+
}
|
|
2230
|
+
) }, `${dia.mes}-${dia.dia}`);
|
|
2231
|
+
}) }, i)) })
|
|
2232
|
+
] }),
|
|
2233
|
+
/* @__PURE__ */ jsxs7("div", { style: { display: "flex", justifyContent: "space-between", marginTop: 4 }, children: [
|
|
2234
|
+
/* @__PURE__ */ jsx8(Button2, { size: "small", onClick: () => onElegir(fechaATexto(fechaDeHoy)), children: "hoy" }),
|
|
2235
|
+
admiteNulo && /* @__PURE__ */ jsx8(Button2, { size: "small", onClick: () => onElegir(null), children: "vac\xEDo" })
|
|
2236
|
+
] })
|
|
2237
|
+
] }) });
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2240
|
+
// src/components/grid/VentanaDeTexto.tsx
|
|
2241
|
+
import { useState as useState9 } from "react";
|
|
2242
|
+
import { Button as Button3, InputBase as InputBase2, Popover as Popover4 } from "@mui/material";
|
|
2243
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2244
|
+
function VentanaDeTexto({ anclaje, texto, editable, onAceptar, onCerrar }) {
|
|
2245
|
+
const [valor, setValor] = useState9(texto);
|
|
2246
|
+
const alApretar = (evento) => {
|
|
2247
|
+
if (evento.key === "Escape" || evento.key === "F9") {
|
|
2248
|
+
onCerrar();
|
|
2249
|
+
} else if (evento.key === "Enter" && evento.ctrlKey && editable) {
|
|
2250
|
+
onAceptar(valor);
|
|
2251
|
+
} else {
|
|
2252
|
+
return;
|
|
2253
|
+
}
|
|
2254
|
+
evento.preventDefault();
|
|
2255
|
+
evento.stopPropagation();
|
|
2256
|
+
};
|
|
2257
|
+
return /* @__PURE__ */ jsx9(Popover4, { open: true, anchorEl: anclaje, onClose: onCerrar, disableRestoreFocus: true, anchorOrigin: { vertical: "bottom", horizontal: "left" }, children: /* @__PURE__ */ jsxs8("div", { style: { padding: 8, minWidth: 320, maxWidth: 640 }, children: [
|
|
2258
|
+
/* @__PURE__ */ jsx9(
|
|
2259
|
+
InputBase2,
|
|
2260
|
+
{
|
|
2261
|
+
autoFocus: true,
|
|
2262
|
+
multiline: true,
|
|
2263
|
+
fullWidth: true,
|
|
2264
|
+
readOnly: !editable,
|
|
2265
|
+
value: valor,
|
|
2266
|
+
onChange: (e) => setValor(e.target.value),
|
|
2267
|
+
onKeyDown: alApretar,
|
|
2268
|
+
minRows: 2,
|
|
2269
|
+
maxRows: 16,
|
|
2270
|
+
sx: { fontFamily: "monospace", fontSize: "0.8rem", border: "1px solid #ccc", borderRadius: "4px", p: 0.5 },
|
|
2271
|
+
inputProps: { "aria-label": "contenido de la celda" }
|
|
2272
|
+
}
|
|
2273
|
+
),
|
|
2274
|
+
editable && /* @__PURE__ */ jsxs8("div", { style: { display: "flex", justifyContent: "flex-end", gap: 8, marginTop: 4 }, children: [
|
|
2275
|
+
/* @__PURE__ */ jsx9(Button3, { size: "small", onClick: onCerrar, children: "cancelar" }),
|
|
2276
|
+
/* @__PURE__ */ jsx9(Button3, { size: "small", variant: "contained", onClick: () => onAceptar(valor), children: "aceptar" })
|
|
2277
|
+
] })
|
|
2278
|
+
] }) });
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2281
|
+
// src/hooks/grid/useExpander.tsx
|
|
2282
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
2283
|
+
var useExpander = ({ campo, editable, fila, admiteNulo, tipos, anclaje, textoActual, valorActual, alElegirValor, alConfirmarTexto, alFallar }) => {
|
|
2284
|
+
const [expansion, setExpansion] = useState10(null);
|
|
2285
|
+
const abierto = React8.useRef(false);
|
|
2286
|
+
const tipoDelCampo = tipoDeExpander(campo, editable);
|
|
2287
|
+
const tipo = tipoDelCampo === null || tipoDelCampo === "json" || tipos && !tipos.includes(tipoDelCampo) ? null : tipoDelCampo;
|
|
2288
|
+
const abrir = useCallback7(async (busqueda) => {
|
|
2289
|
+
if (tipo === null || abierto.current) return;
|
|
2290
|
+
abierto.current = true;
|
|
2291
|
+
try {
|
|
2292
|
+
if (tipo === "referencia" && esCampoConReferencia(campo)) {
|
|
2293
|
+
const { definicion, filas } = await cargarReferencia(campo.references);
|
|
2294
|
+
setExpansion({ tipo: "opciones", opciones: opcionesDeReferencia(campo, definicion, filas, fila, admiteNulo), busqueda });
|
|
2295
|
+
} else if (tipo === "booleano") {
|
|
2296
|
+
setExpansion({ tipo: "opciones", opciones: opcionesDeBooleano(admiteNulo), busqueda });
|
|
2297
|
+
} else if (tipo === "opciones") {
|
|
2298
|
+
setExpansion({ tipo: "opciones", opciones: opcionesDeEnumerado(campo.options ?? [], admiteNulo), busqueda });
|
|
2299
|
+
} else {
|
|
2300
|
+
setExpansion({ tipo: tipo === "fecha" ? "fecha" : "texto" });
|
|
2301
|
+
}
|
|
2302
|
+
} catch (err) {
|
|
2303
|
+
abierto.current = false;
|
|
2304
|
+
alFallar(mensajeDeError(err));
|
|
2305
|
+
}
|
|
2306
|
+
}, [tipo, campo, fila, admiteNulo, alFallar]);
|
|
2307
|
+
const cerrar = useCallback7(() => {
|
|
2308
|
+
abierto.current = false;
|
|
2309
|
+
setExpansion(null);
|
|
2310
|
+
setTimeout(() => anclaje.current?.focus(), 0);
|
|
2311
|
+
}, [anclaje]);
|
|
2312
|
+
const elegirValor = useCallback7((valor) => {
|
|
2313
|
+
cerrar();
|
|
2314
|
+
alElegirValor(valor);
|
|
2315
|
+
}, [cerrar, alElegirValor]);
|
|
2316
|
+
const confirmarTexto = useCallback7((texto) => {
|
|
2317
|
+
cerrar();
|
|
2318
|
+
alConfirmarTexto(texto);
|
|
2319
|
+
}, [cerrar, alConfirmarTexto]);
|
|
2320
|
+
const manejarTecla = useCallback7((event) => {
|
|
2321
|
+
const esExpander = event.key === "F9" && !event.shiftKey && !event.ctrlKey && !event.altKey || event.key === "ArrowDown" && event.altKey && !event.shiftKey && !event.ctrlKey;
|
|
2322
|
+
if (tipo === null || !esExpander) return false;
|
|
2323
|
+
event.preventDefault();
|
|
2324
|
+
void abrir("");
|
|
2325
|
+
return true;
|
|
2326
|
+
}, [tipo, abrir]);
|
|
2327
|
+
const titulo = tipo === "fecha" ? "elegir fecha (F9)" : tipo === "texto" ? "ver el contenido completo (F9)" : "elegir un valor (F9)";
|
|
2328
|
+
const lupa = tipo === null ? null : /* @__PURE__ */ jsx10(
|
|
2329
|
+
IconButton4,
|
|
2330
|
+
{
|
|
2331
|
+
size: "small",
|
|
2332
|
+
tabIndex: -1,
|
|
2333
|
+
"aria-label": titulo.replace(" (F9)", ""),
|
|
2334
|
+
title: titulo,
|
|
2335
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
2336
|
+
onClick: (e) => {
|
|
2337
|
+
e.stopPropagation();
|
|
2338
|
+
void abrir("");
|
|
2339
|
+
},
|
|
2340
|
+
sx: { p: 0, ml: 0.25, color: "primary.main", "&:hover": { backgroundColor: "action.hover" } },
|
|
2341
|
+
children: tipo === "fecha" ? /* @__PURE__ */ jsx10(CalendarMonthIcon, { sx: { fontSize: 16 } }) : tipo === "texto" ? /* @__PURE__ */ jsx10(SearchIcon2, { sx: { fontSize: 16 } }) : /* @__PURE__ */ jsx10(ArrowDropDownIcon, { sx: { fontSize: 20 } })
|
|
2342
|
+
}
|
|
2343
|
+
);
|
|
2344
|
+
const base = anclaje.current;
|
|
2345
|
+
const ventana = !expansion || !base ? null : expansion.tipo === "opciones" ? /* @__PURE__ */ jsx10(MenuDeOpciones, { anclaje: base, opciones: expansion.opciones, busquedaInicial: expansion.busqueda, onElegir: elegirValor, onCerrar: cerrar }) : expansion.tipo === "fecha" ? /* @__PURE__ */ jsx10(SelectorDeFecha, { anclaje: base, fechaActual: fechaDeValor(valorActual), admiteNulo, onElegir: confirmarTexto, onCerrar: cerrar }) : /* @__PURE__ */ jsx10(VentanaDeTexto, { anclaje: base, texto: textoActual, editable: true, onAceptar: confirmarTexto, onCerrar: cerrar });
|
|
2346
|
+
return { tipo, abierto, abrir, manejarTecla, lupa, ventana };
|
|
2347
|
+
};
|
|
2348
|
+
|
|
2349
|
+
// src/components/forms/TypedField.tsx
|
|
2350
|
+
import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1901
2351
|
var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode = false, feedback, isMandatory = false }) => {
|
|
1902
2352
|
const theme = useTheme();
|
|
1903
|
-
const typer =
|
|
1904
|
-
const isBoolean = fieldDef.typeName === "boolean";
|
|
1905
|
-
const [localString, setLocalString] =
|
|
2353
|
+
const typer = useMemo6(() => typeStore3.typerFrom(fieldDef), [fieldDef]);
|
|
2354
|
+
const isBoolean = fieldDef.typeName === "boolean" && !isFilterMode;
|
|
2355
|
+
const [localString, setLocalString] = useState11(() => {
|
|
1906
2356
|
if (isBoolean) return "";
|
|
1907
2357
|
if (isFilterMode) return value !== null && value !== void 0 ? String(value) : "";
|
|
1908
2358
|
try {
|
|
@@ -1911,10 +2361,10 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
1911
2361
|
return value === null || value === void 0 ? "" : String(value);
|
|
1912
2362
|
}
|
|
1913
2363
|
});
|
|
1914
|
-
const [errorMsg, setErrorMsg] =
|
|
1915
|
-
const lastValueRef =
|
|
1916
|
-
const lastCommittedStringRef =
|
|
1917
|
-
|
|
2364
|
+
const [errorMsg, setErrorMsg] = useState11(null);
|
|
2365
|
+
const lastValueRef = useRef5(value);
|
|
2366
|
+
const lastCommittedStringRef = useRef5(localString);
|
|
2367
|
+
useEffect4(() => {
|
|
1918
2368
|
if (!isBoolean) {
|
|
1919
2369
|
if (value !== lastValueRef.current) {
|
|
1920
2370
|
lastValueRef.current = value;
|
|
@@ -1931,7 +2381,27 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
1931
2381
|
}
|
|
1932
2382
|
}
|
|
1933
2383
|
}, [value, typer, isBoolean, isFilterMode]);
|
|
1934
|
-
const
|
|
2384
|
+
const entradaRef = useRef5(null);
|
|
2385
|
+
const [enfocado, setEnfocado] = useState11(false);
|
|
2386
|
+
const escribirEnFiltro = useCallback8((texto) => {
|
|
2387
|
+
setLocalString(texto);
|
|
2388
|
+
lastValueRef.current = texto;
|
|
2389
|
+
onChange(fieldDef.name, texto, true);
|
|
2390
|
+
}, [onChange, fieldDef.name]);
|
|
2391
|
+
const expander = useExpander({
|
|
2392
|
+
campo: fieldDef,
|
|
2393
|
+
editable: true,
|
|
2394
|
+
fila: null,
|
|
2395
|
+
admiteNulo: false,
|
|
2396
|
+
tipos: isFilterMode ? ["referencia", "booleano", "opciones", "fecha"] : [],
|
|
2397
|
+
anclaje: entradaRef,
|
|
2398
|
+
textoActual: localString,
|
|
2399
|
+
valorActual: localString,
|
|
2400
|
+
alElegirValor: (valor) => escribirEnFiltro(valor === null || valor === void 0 ? "" : typeof valor === "boolean" ? typer.toLocalString(valor) : String(valor)),
|
|
2401
|
+
alConfirmarTexto: (texto) => escribirEnFiltro(texto ?? ""),
|
|
2402
|
+
alFallar: (mensaje) => setErrorMsg(mensaje)
|
|
2403
|
+
});
|
|
2404
|
+
const handleTextChange = useCallback8((e) => {
|
|
1935
2405
|
const newValueString = e.target.value;
|
|
1936
2406
|
setLocalString(newValueString);
|
|
1937
2407
|
let parsedValue = null;
|
|
@@ -1952,7 +2422,7 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
1952
2422
|
lastValueRef.current = parsedValue;
|
|
1953
2423
|
onChange(fieldDef.name, parsedValue, isValid);
|
|
1954
2424
|
}, [typer, onChange, fieldDef.name, isFilterMode]);
|
|
1955
|
-
const handleTextCommit =
|
|
2425
|
+
const handleTextCommit = useCallback8(() => {
|
|
1956
2426
|
if (!onCommit) return;
|
|
1957
2427
|
if (localString === lastCommittedStringRef.current) return;
|
|
1958
2428
|
lastCommittedStringRef.current = localString;
|
|
@@ -1970,13 +2440,14 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
1970
2440
|
}
|
|
1971
2441
|
onCommit(fieldDef.name, parsedValue, isValid);
|
|
1972
2442
|
}, [onCommit, fieldDef.name, localString, isFilterMode, typer]);
|
|
1973
|
-
const handleTextKeyDown =
|
|
2443
|
+
const handleTextKeyDown = useCallback8((e) => {
|
|
2444
|
+
if (expander.manejarTecla(e)) return;
|
|
1974
2445
|
if (e.key === "Enter") {
|
|
1975
2446
|
e.preventDefault();
|
|
1976
2447
|
handleTextCommit();
|
|
1977
2448
|
}
|
|
1978
|
-
}, [handleTextCommit]);
|
|
1979
|
-
const handleBooleanChange =
|
|
2449
|
+
}, [handleTextCommit, expander]);
|
|
2450
|
+
const handleBooleanChange = useCallback8((e) => {
|
|
1980
2451
|
const val = e.target.value;
|
|
1981
2452
|
let finalValue = null;
|
|
1982
2453
|
if (val === "true") finalValue = true;
|
|
@@ -2004,28 +2475,28 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2004
2475
|
}
|
|
2005
2476
|
const cellBackgroundColor2 = feedback === "error" ? theme.palette.error.light : feedback === "success" ? theme.palette.success.light : defaultBgColor;
|
|
2006
2477
|
const transitionStyle2 = "background-color 0.3s ease-in-out";
|
|
2007
|
-
return /* @__PURE__ */
|
|
2008
|
-
!isFilterMode && /* @__PURE__ */
|
|
2009
|
-
/* @__PURE__ */
|
|
2478
|
+
return /* @__PURE__ */ jsxs9(FormControl, { fullWidth: true, error: !!errorMsg && !isFilterMode, disabled: isDisabled, size: "small", margin: "dense", children: [
|
|
2479
|
+
!isFilterMode && /* @__PURE__ */ jsx11(InputLabel, { shrink: true, children: fieldDef.name }),
|
|
2480
|
+
/* @__PURE__ */ jsxs9(
|
|
2010
2481
|
Select,
|
|
2011
2482
|
{
|
|
2012
2483
|
value: boolVal,
|
|
2013
2484
|
label: !isFilterMode ? fieldDef.name : void 0,
|
|
2014
2485
|
onChange: handleBooleanChange,
|
|
2015
|
-
startAdornment: isMandatory && isEmpty && !isFilterMode ? /* @__PURE__ */
|
|
2486
|
+
startAdornment: isMandatory && isEmpty && !isFilterMode ? /* @__PURE__ */ jsx11(InputAdornment, { position: "start", sx: { color: "text.secondary", ml: 0.5 }, children: "*" }) : void 0,
|
|
2016
2487
|
displayEmpty: true,
|
|
2017
2488
|
sx: isFilterMode ? { height: 25, fontSize: "0.8rem", backgroundColor: "background.paper" } : {
|
|
2018
2489
|
backgroundColor: cellBackgroundColor2,
|
|
2019
2490
|
transition: transitionStyle2
|
|
2020
2491
|
},
|
|
2021
2492
|
children: [
|
|
2022
|
-
fieldDef.nullable !== false && /* @__PURE__ */
|
|
2023
|
-
/* @__PURE__ */
|
|
2024
|
-
/* @__PURE__ */
|
|
2493
|
+
fieldDef.nullable !== false && /* @__PURE__ */ jsx11(MenuItem, { value: "", children: /* @__PURE__ */ jsx11("em", { children: "Nulo / Sin Especificar" }) }),
|
|
2494
|
+
/* @__PURE__ */ jsx11(MenuItem, { value: "true", children: "S\xED (Verdadero)" }),
|
|
2495
|
+
/* @__PURE__ */ jsx11(MenuItem, { value: "false", children: "No (Falso)" })
|
|
2025
2496
|
]
|
|
2026
2497
|
}
|
|
2027
2498
|
),
|
|
2028
|
-
errorMsg && !isFilterMode && /* @__PURE__ */
|
|
2499
|
+
errorMsg && !isFilterMode && /* @__PURE__ */ jsx11(FormHelperText, { children: errorMsg })
|
|
2029
2500
|
] });
|
|
2030
2501
|
}
|
|
2031
2502
|
let inputType = "text";
|
|
@@ -2039,54 +2510,65 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2039
2510
|
}
|
|
2040
2511
|
const cellBackgroundColor = feedback === "error" ? theme.palette.error.light : feedback === "success" ? theme.palette.success.light : defaultTextBgColor;
|
|
2041
2512
|
const transitionStyle = "background-color 0.3s ease-in-out";
|
|
2042
|
-
return /* @__PURE__ */
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
minWidth: 50,
|
|
2070
|
-
fontSize: "0.8rem",
|
|
2071
|
-
padding: "0px"
|
|
2072
|
-
}
|
|
2073
|
-
} : {
|
|
2074
|
-
"& .MuiOutlinedInput-root": {
|
|
2075
|
-
backgroundColor: cellBackgroundColor,
|
|
2076
|
-
transition: transitionStyle
|
|
2513
|
+
return /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
2514
|
+
/* @__PURE__ */ jsx11(
|
|
2515
|
+
TextField,
|
|
2516
|
+
{
|
|
2517
|
+
fullWidth: true,
|
|
2518
|
+
inputRef: entradaRef,
|
|
2519
|
+
type: inputType,
|
|
2520
|
+
label: isFilterMode ? void 0 : fieldDef.name,
|
|
2521
|
+
variant: "outlined",
|
|
2522
|
+
size: "small",
|
|
2523
|
+
margin: isFilterMode ? "none" : "dense",
|
|
2524
|
+
value: localString,
|
|
2525
|
+
onChange: handleTextChange,
|
|
2526
|
+
disabled: isDisabled,
|
|
2527
|
+
error: !!errorMsg && !isFilterMode,
|
|
2528
|
+
helperText: !isFilterMode ? errorMsg || (isMandatory ? "Obligatorio" : "") : void 0,
|
|
2529
|
+
InputLabelProps: !isFilterMode ? { shrink: true } : void 0,
|
|
2530
|
+
InputProps: isFilterMode ? {
|
|
2531
|
+
// la lupa solo al enfocar el filtro, como en backend-plus
|
|
2532
|
+
endAdornment: enfocado || expander.abierto.current ? expander.lupa : void 0
|
|
2533
|
+
} : isMandatory && isEmptyText ? {
|
|
2534
|
+
startAdornment: /* @__PURE__ */ jsx11(InputAdornment, { position: "start", sx: { color: "text.secondary", mr: 0.5 }, children: "*" })
|
|
2535
|
+
} : {},
|
|
2536
|
+
inputProps: {
|
|
2537
|
+
style: {
|
|
2538
|
+
textAlign: isNumericType(fieldDef.typeName) ? "right" : "left"
|
|
2539
|
+
}
|
|
2077
2540
|
},
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2541
|
+
sx: isFilterMode ? {
|
|
2542
|
+
"& .MuiOutlinedInput-root": {
|
|
2543
|
+
backgroundColor: "background.paper",
|
|
2544
|
+
height: FILTER_ROW_HEIGHT - 5,
|
|
2545
|
+
minWidth: 50,
|
|
2546
|
+
fontSize: "0.8rem",
|
|
2547
|
+
padding: "0px"
|
|
2548
|
+
}
|
|
2549
|
+
} : {
|
|
2550
|
+
"& .MuiOutlinedInput-root": {
|
|
2551
|
+
backgroundColor: cellBackgroundColor,
|
|
2552
|
+
transition: transitionStyle
|
|
2553
|
+
},
|
|
2554
|
+
"& .MuiOutlinedInput-input": {
|
|
2555
|
+
padding: "6px 12px"
|
|
2556
|
+
}
|
|
2557
|
+
},
|
|
2558
|
+
onFocus: () => setEnfocado(true),
|
|
2559
|
+
onBlur: () => {
|
|
2560
|
+
setEnfocado(false);
|
|
2561
|
+
handleTextCommit();
|
|
2562
|
+
},
|
|
2563
|
+
onKeyDown: handleTextKeyDown
|
|
2564
|
+
}
|
|
2565
|
+
),
|
|
2566
|
+
expander.ventana
|
|
2567
|
+
] });
|
|
2086
2568
|
};
|
|
2087
2569
|
|
|
2088
2570
|
// src/components/grid/FilterInputRender.tsx
|
|
2089
|
-
import { jsx as
|
|
2571
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2090
2572
|
function FilterInputRenderer({
|
|
2091
2573
|
columnKey,
|
|
2092
2574
|
currentFilter,
|
|
@@ -2109,8 +2591,8 @@ function FilterInputRenderer({
|
|
|
2109
2591
|
[columnKey]: { operator: newOp, value: formattedVal }
|
|
2110
2592
|
}));
|
|
2111
2593
|
};
|
|
2112
|
-
return /* @__PURE__ */
|
|
2113
|
-
/* @__PURE__ */
|
|
2594
|
+
return /* @__PURE__ */ jsxs10(Box4, { sx: { mt: 0, display: "flex", alignItems: "center", gap: 0.5, pr: 1 }, children: [
|
|
2595
|
+
/* @__PURE__ */ jsx12(
|
|
2114
2596
|
"select",
|
|
2115
2597
|
{
|
|
2116
2598
|
value: operator,
|
|
@@ -2126,10 +2608,10 @@ function FilterInputRenderer({
|
|
|
2126
2608
|
textAlign: "center",
|
|
2127
2609
|
cursor: "pointer"
|
|
2128
2610
|
},
|
|
2129
|
-
children: filterOperators.map((op) => /* @__PURE__ */
|
|
2611
|
+
children: filterOperators.map((op) => /* @__PURE__ */ jsx12("option", { value: op.value, children: op.label }, op.value))
|
|
2130
2612
|
}
|
|
2131
2613
|
),
|
|
2132
|
-
/* @__PURE__ */
|
|
2614
|
+
/* @__PURE__ */ jsx12(
|
|
2133
2615
|
TypedField,
|
|
2134
2616
|
{
|
|
2135
2617
|
fieldDef,
|
|
@@ -2140,8 +2622,8 @@ function FilterInputRenderer({
|
|
|
2140
2622
|
)
|
|
2141
2623
|
] });
|
|
2142
2624
|
}
|
|
2143
|
-
return /* @__PURE__ */
|
|
2144
|
-
|
|
2625
|
+
return /* @__PURE__ */ jsx12(
|
|
2626
|
+
InputBase3,
|
|
2145
2627
|
{
|
|
2146
2628
|
value: currentFilter || "",
|
|
2147
2629
|
onChange: (e) => setFilters((prev) => ({
|
|
@@ -2163,19 +2645,18 @@ function FilterInputRenderer({
|
|
|
2163
2645
|
}
|
|
2164
2646
|
);
|
|
2165
2647
|
}
|
|
2166
|
-
var FilterInputRender_default =
|
|
2648
|
+
var FilterInputRender_default = React10.memo(FilterInputRenderer);
|
|
2167
2649
|
|
|
2168
2650
|
// src/components/grid/renderers/summaryCellRenderers.tsx
|
|
2169
2651
|
import { Box as Box5 } from "@mui/material";
|
|
2170
|
-
import { jsx as
|
|
2652
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2171
2653
|
var defaultColumnSummaryCellRenderer = (props, fixedFields) => {
|
|
2172
2654
|
const { column, row } = props;
|
|
2173
2655
|
if (row.id === "filterRow") {
|
|
2174
2656
|
const { filters, setFilters } = row;
|
|
2175
|
-
|
|
2176
|
-
if (fixedFieldEntry && fixedFieldEntry.until === void 0) return null;
|
|
2657
|
+
if (valorFijoDe(fixedFields, column.key)) return null;
|
|
2177
2658
|
const fieldDef = esColumnaPropia(column) && column.customType === "default" ? column.fieldDef : void 0;
|
|
2178
|
-
return /* @__PURE__ */
|
|
2659
|
+
return /* @__PURE__ */ jsx13(Box5, { sx: { width: "100%", height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsx13(
|
|
2179
2660
|
FilterInputRender_default,
|
|
2180
2661
|
{
|
|
2181
2662
|
columnKey: column.key,
|
|
@@ -2217,7 +2698,7 @@ var defaultColumnSummaryCellRenderer = (props, fixedFields) => {
|
|
|
2217
2698
|
label = "Cant S\xED: ";
|
|
2218
2699
|
break;
|
|
2219
2700
|
}
|
|
2220
|
-
return /* @__PURE__ */
|
|
2701
|
+
return /* @__PURE__ */ jsxs11(Box5, { sx: {
|
|
2221
2702
|
px: 0,
|
|
2222
2703
|
fontWeight: "bold",
|
|
2223
2704
|
fontSize: "0.875rem",
|
|
@@ -2235,35 +2716,35 @@ var actionsColumnSummaryCellRenderer = (_props) => null;
|
|
|
2235
2716
|
var detailColumnCellSummaryRenderer = (_props) => null;
|
|
2236
2717
|
|
|
2237
2718
|
// src/components/grid/renderers/cellRenderers.tsx
|
|
2238
|
-
import
|
|
2239
|
-
import { Box as Box8, Button as
|
|
2719
|
+
import React11 from "react";
|
|
2720
|
+
import { Box as Box8, Button as Button4, Tooltip as Tooltip4, useTheme as useTheme2 } from "@mui/material";
|
|
2240
2721
|
import ViewHeadlineIcon from "@mui/icons-material/ViewHeadline";
|
|
2241
2722
|
import DeleteIcon from "@mui/icons-material/Delete";
|
|
2242
2723
|
import AddIcon2 from "@mui/icons-material/Add";
|
|
2243
2724
|
|
|
2244
2725
|
// src/components/grid/ExampleClientSideComponent.tsx
|
|
2245
|
-
import { Box as Box6, Typography as
|
|
2246
|
-
import { jsx as
|
|
2726
|
+
import { Box as Box6, Typography as Typography5 } from "@mui/material";
|
|
2727
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
2247
2728
|
var ExampleClientSideComponent = ({ row, column, fieldDefinition }) => {
|
|
2248
2729
|
const value = row[column.key];
|
|
2249
|
-
return /* @__PURE__ */
|
|
2730
|
+
return /* @__PURE__ */ jsx14(Box6, { sx: {
|
|
2250
2731
|
padding: 0.5,
|
|
2251
2732
|
width: "100%",
|
|
2252
2733
|
height: "100%",
|
|
2253
2734
|
display: "flex",
|
|
2254
2735
|
alignItems: "center",
|
|
2255
2736
|
backgroundColor: value === "Special" ? "lightblue" : "transparent"
|
|
2256
|
-
}, children: /* @__PURE__ */
|
|
2737
|
+
}, children: /* @__PURE__ */ jsx14(Typography5, { variant: "body2", sx: { fontWeight: "bold" }, children: value ? `CS: ${value}` : "N/A" }) });
|
|
2257
2738
|
};
|
|
2258
2739
|
var ExampleClientSideComponent_default = ExampleClientSideComponent;
|
|
2259
2740
|
|
|
2260
2741
|
// src/components/grid/FallbackClientSideRenderer.tsx
|
|
2261
|
-
import { Box as Box7, Typography as
|
|
2742
|
+
import { Box as Box7, Typography as Typography6, Tooltip as Tooltip3 } from "@mui/material";
|
|
2262
2743
|
import WarningAmberIcon2 from "@mui/icons-material/WarningAmber";
|
|
2263
|
-
import { jsx as
|
|
2744
|
+
import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2264
2745
|
var FallbackClientSideRenderer = ({ column, row, fieldDefinition }) => {
|
|
2265
2746
|
const clientSideName = fieldDefinition?.clientSide || "Desconocido";
|
|
2266
|
-
return /* @__PURE__ */
|
|
2747
|
+
return /* @__PURE__ */ jsx15(Tooltip3, { title: `Componente clientSide '${clientSideName}' no implementado. Mostrando valor por defecto.`, children: /* @__PURE__ */ jsxs12(
|
|
2267
2748
|
Box7,
|
|
2268
2749
|
{
|
|
2269
2750
|
sx: {
|
|
@@ -2284,8 +2765,8 @@ var FallbackClientSideRenderer = ({ column, row, fieldDefinition }) => {
|
|
|
2284
2765
|
// Evita que el contenido se desborde
|
|
2285
2766
|
},
|
|
2286
2767
|
children: [
|
|
2287
|
-
/* @__PURE__ */
|
|
2288
|
-
/* @__PURE__ */
|
|
2768
|
+
/* @__PURE__ */ jsx15(Typography6, { variant: "body2", noWrap: true, sx: { flexGrow: 1 }, children: clientSideName + " not found" }),
|
|
2769
|
+
/* @__PURE__ */ jsx15(
|
|
2289
2770
|
WarningAmberIcon2,
|
|
2290
2771
|
{
|
|
2291
2772
|
sx: {
|
|
@@ -2313,8 +2794,8 @@ var extendClientSides = (newRenderers) => {
|
|
|
2313
2794
|
};
|
|
2314
2795
|
|
|
2315
2796
|
// src/components/grid/renderers/cellRenderers.tsx
|
|
2316
|
-
import { jsx as
|
|
2317
|
-
var CeldaDato =
|
|
2797
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
2798
|
+
var CeldaDato = React11.memo(function CeldaDato2({ row, columnKey, defaultColumn }) {
|
|
2318
2799
|
const theme = useTheme2();
|
|
2319
2800
|
const { primaryKey, fixedFields, typer, isMandatory, isNumeric } = defaultColumn;
|
|
2320
2801
|
const rowId = getPrimaryKeyValues(row, primaryKey);
|
|
@@ -2325,7 +2806,7 @@ var CeldaDato = React7.memo(function CeldaDato2({ row, columnKey, defaultColumn
|
|
|
2325
2806
|
let cellBackgroundColor = "transparent";
|
|
2326
2807
|
if (currentCellFeedback) {
|
|
2327
2808
|
cellBackgroundColor = currentCellFeedback.type === "error" ? theme.palette.error.light : theme.palette.success.light;
|
|
2328
|
-
} else if (fixedFields
|
|
2809
|
+
} else if (valorFijoDe(fixedFields, columnKey)) {
|
|
2329
2810
|
cellBackgroundColor = theme.palette.action.selected;
|
|
2330
2811
|
} else if (isMandatory && !hasValue || pendiente) {
|
|
2331
2812
|
cellBackgroundColor = "#e3f2fd";
|
|
@@ -2335,7 +2816,7 @@ var CeldaDato = React7.memo(function CeldaDato2({ row, columnKey, defaultColumn
|
|
|
2335
2816
|
displayValue = "* " + displayValue;
|
|
2336
2817
|
}
|
|
2337
2818
|
const signal = displayValue === "--" ? "typed-controls-signal-no-data" : displayValue === "//" ? "typed-controls-signal-unknown-data" : "";
|
|
2338
|
-
const celda = /* @__PURE__ */
|
|
2819
|
+
const celda = /* @__PURE__ */ jsx16(
|
|
2339
2820
|
"div",
|
|
2340
2821
|
{
|
|
2341
2822
|
className: `fpr-celda ${isNumeric ? "fpr-celda-numerica" : ""} ${signal} ${row[NEW_ROW_INDICATOR] ? "new-row-cell-animation" : ""}`,
|
|
@@ -2343,13 +2824,13 @@ var CeldaDato = React7.memo(function CeldaDato2({ row, columnKey, defaultColumn
|
|
|
2343
2824
|
children: displayValue
|
|
2344
2825
|
}
|
|
2345
2826
|
);
|
|
2346
|
-
return currentCellFeedback?.message ? /* @__PURE__ */
|
|
2827
|
+
return currentCellFeedback?.message ? /* @__PURE__ */ jsx16(Tooltip4, { title: currentCellFeedback.message, children: celda }) : celda;
|
|
2347
2828
|
});
|
|
2348
2829
|
var allColumnsCellRenderer = (props) => {
|
|
2349
2830
|
const { row, column } = props;
|
|
2350
2831
|
if (!esColumnaPropia(column)) return void 0;
|
|
2351
2832
|
if (esFilaDetalle(row)) {
|
|
2352
|
-
return column.customType === "action" ? /* @__PURE__ */
|
|
2833
|
+
return column.customType === "action" ? /* @__PURE__ */ jsx16(CeldaDetalle, { fila: row }) : null;
|
|
2353
2834
|
}
|
|
2354
2835
|
switch (column.customType) {
|
|
2355
2836
|
case "default": {
|
|
@@ -2358,15 +2839,15 @@ var allColumnsCellRenderer = (props) => {
|
|
|
2358
2839
|
if (fieldDef?.clientSide) {
|
|
2359
2840
|
const ClientSideComponent = clientSides[fieldDef.clientSide];
|
|
2360
2841
|
if (ClientSideComponent) {
|
|
2361
|
-
return /* @__PURE__ */
|
|
2842
|
+
return /* @__PURE__ */ jsx16(ClientSideComponent, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
|
|
2362
2843
|
}
|
|
2363
|
-
return /* @__PURE__ */
|
|
2844
|
+
return /* @__PURE__ */ jsx16(FallbackClientSideRenderer_default, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
|
|
2364
2845
|
}
|
|
2365
|
-
return /* @__PURE__ */
|
|
2846
|
+
return /* @__PURE__ */ jsx16(CeldaDato, { row, columnKey: props.column.key, defaultColumn });
|
|
2366
2847
|
}
|
|
2367
2848
|
case "detail": {
|
|
2368
2849
|
const { detailTable, primaryKey } = column;
|
|
2369
|
-
return /* @__PURE__ */
|
|
2850
|
+
return /* @__PURE__ */ jsx16(
|
|
2370
2851
|
BotonDetalle,
|
|
2371
2852
|
{
|
|
2372
2853
|
row,
|
|
@@ -2401,8 +2882,8 @@ var allColumnsCellRenderer = (props) => {
|
|
|
2401
2882
|
color: "primary"
|
|
2402
2883
|
}
|
|
2403
2884
|
];
|
|
2404
|
-
return /* @__PURE__ */
|
|
2405
|
-
|
|
2885
|
+
return /* @__PURE__ */ jsx16(Box8, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%", gap: 0.5 }, children: gridActionButtons.map((actionDef) => tableDefinition.allow[actionDef.action] ? /* @__PURE__ */ jsx16(
|
|
2886
|
+
Button4,
|
|
2406
2887
|
{
|
|
2407
2888
|
variant: "outlined",
|
|
2408
2889
|
color: actionDef.color,
|
|
@@ -2410,7 +2891,7 @@ var allColumnsCellRenderer = (props) => {
|
|
|
2410
2891
|
onClick: () => actionDef.handler(row),
|
|
2411
2892
|
title: actionDef.title,
|
|
2412
2893
|
sx: { width: 22, minWidth: 22, height: 22, "& .MuiButton-startIcon": { m: 0 } },
|
|
2413
|
-
children: /* @__PURE__ */
|
|
2894
|
+
children: /* @__PURE__ */ jsx16(actionDef.icon, { sx: { fontSize: 18 } })
|
|
2414
2895
|
},
|
|
2415
2896
|
actionDef.action
|
|
2416
2897
|
) : null) });
|
|
@@ -2421,14 +2902,13 @@ var allColumnsCellRenderer = (props) => {
|
|
|
2421
2902
|
};
|
|
2422
2903
|
|
|
2423
2904
|
// src/components/grid/InputRenderer.tsx
|
|
2424
|
-
import
|
|
2905
|
+
import React12, { useCallback as useCallback10, useEffect as useEffect5, useMemo as useMemo7, useState as useState12 } from "react";
|
|
2425
2906
|
|
|
2426
2907
|
// src/hooks/useTableRecordSave.ts
|
|
2427
|
-
import { useCallback as
|
|
2908
|
+
import { useCallback as useCallback9 } from "react";
|
|
2428
2909
|
var useTableRecordSave = () => {
|
|
2429
2910
|
const { callApi, loading, error } = useApiCall();
|
|
2430
|
-
const saveRecord =
|
|
2431
|
-
tableName,
|
|
2911
|
+
const saveRecord = useCallback9(async ({
|
|
2432
2912
|
tableDefinition,
|
|
2433
2913
|
isNewRow,
|
|
2434
2914
|
formData,
|
|
@@ -2457,13 +2937,12 @@ var useTableRecordSave = () => {
|
|
|
2457
2937
|
}
|
|
2458
2938
|
});
|
|
2459
2939
|
}
|
|
2460
|
-
tableDefinition.primaryKey.forEach((pkField) => {
|
|
2461
|
-
rowToSend[pkField] = formData[pkField];
|
|
2462
|
-
});
|
|
2463
2940
|
}
|
|
2464
2941
|
const primaryKeyValuesForBackend = isNewRow ? [] : tableDefinition.primaryKey.map((key) => initialData[key]);
|
|
2465
2942
|
const response = await callApi("table_record_save", {
|
|
2466
|
-
|
|
2943
|
+
// como backend-plus (`depot.def.name`): el servidor busca la definición por este nombre. Una definición que guarda en
|
|
2944
|
+
// otra tabla (`tableName`, con campos de `table`) no existe con el nombre de la física: ahí faltarían sus campos
|
|
2945
|
+
table: tableDefinition.name,
|
|
2467
2946
|
primaryKeyValues: primaryKeyValuesForBackend,
|
|
2468
2947
|
newRow: rowToSend,
|
|
2469
2948
|
oldRow: isNewRow ? {} : initialData,
|
|
@@ -2475,10 +2954,10 @@ var useTableRecordSave = () => {
|
|
|
2475
2954
|
};
|
|
2476
2955
|
|
|
2477
2956
|
// src/components/grid/InputRenderer.tsx
|
|
2478
|
-
import
|
|
2957
|
+
import InputBase4 from "@mui/material/InputBase";
|
|
2479
2958
|
import { Tooltip as Tooltip5, useTheme as useTheme3 } from "@mui/material";
|
|
2480
2959
|
import typeStore4 from "type-store";
|
|
2481
|
-
import { jsx as
|
|
2960
|
+
import { Fragment as Fragment4, jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2482
2961
|
function findChangedValues(oldRowData, newRowData, isNewRow) {
|
|
2483
2962
|
let changes = [];
|
|
2484
2963
|
for (const key in newRowData) {
|
|
@@ -2504,13 +2983,13 @@ function InputRenderer({
|
|
|
2504
2983
|
const setCellFeedbackMap = estadoGrilla.setFeedback;
|
|
2505
2984
|
const setLocalCellChanges = estadoGrilla.setCambiosLocales;
|
|
2506
2985
|
const fieldDefinition = requerido(tableDefinition.fields.find((f) => f.name === column.key), `el campo '${column.key}'`);
|
|
2507
|
-
const typer =
|
|
2508
|
-
const [editingValue, setEditingValue] =
|
|
2509
|
-
const isCommitInProgress =
|
|
2986
|
+
const typer = useMemo7(() => typeStore4.typerFrom(fieldDefinition), [fieldDefinition]);
|
|
2987
|
+
const [editingValue, setEditingValue] = useState12(() => row[column.key] !== null ? isNumericType(fieldDefinition?.typeName) ? row[column.key] : typer.toLocalString(row[column.key]) : null);
|
|
2988
|
+
const isCommitInProgress = React12.useRef(false);
|
|
2989
|
+
const entradaRef = React12.useRef(null);
|
|
2510
2990
|
const theme = useTheme3();
|
|
2511
2991
|
const { showSuccess, showError } = useSnackbar();
|
|
2512
2992
|
const { saveRecord } = useTableRecordSave();
|
|
2513
|
-
const tableName = tableDefinition.tableName;
|
|
2514
2993
|
const rowId = getPrimaryKeyValues(row, primaryKey);
|
|
2515
2994
|
const cellKey = `${rowId}-${column.key}`;
|
|
2516
2995
|
const currentCellFeedback = useFeedbackCelda(cellKey);
|
|
@@ -2522,16 +3001,18 @@ function InputRenderer({
|
|
|
2522
3001
|
cellBackgroundColor = currentCellFeedback.type === "error" ? theme.palette.error.light : theme.palette.success.light;
|
|
2523
3002
|
cellBorderColor = currentCellFeedback.type === "error" ? theme.palette.error.main : theme.palette.success.main;
|
|
2524
3003
|
}
|
|
2525
|
-
const initialRowId =
|
|
2526
|
-
const handleCommit =
|
|
3004
|
+
const initialRowId = useMemo7(() => getPrimaryKeyValues(row, primaryKey), [row, primaryKey]);
|
|
3005
|
+
const handleCommit = useCallback10(async (currentValue, closeEditor, focusNextCell) => {
|
|
2527
3006
|
if (isCommitInProgress.current) return;
|
|
2528
3007
|
isCommitInProgress.current = true;
|
|
2529
3008
|
let processedNewValue;
|
|
2530
3009
|
try {
|
|
2531
|
-
processedNewValue =
|
|
3010
|
+
processedNewValue = tiparEntrada(currentValue, typer);
|
|
2532
3011
|
typer.validateTypedData(processedNewValue);
|
|
2533
3012
|
} catch (err) {
|
|
2534
3013
|
showError(mensajeDeError(err));
|
|
3014
|
+
const claveDeLaCelda = `${getPrimaryKeyValues(row, tableDefinition.primaryKey)}-${column.key}`;
|
|
3015
|
+
setCellFeedbackMap((prev) => new Map(prev).set(claveDeLaCelda, { rowId: getPrimaryKeyValues(row, tableDefinition.primaryKey), columnKey: column.key, type: "error", message: mensajeDeError(err) }));
|
|
2535
3016
|
isCommitInProgress.current = false;
|
|
2536
3017
|
return;
|
|
2537
3018
|
}
|
|
@@ -2588,7 +3069,6 @@ function InputRenderer({
|
|
|
2588
3069
|
}
|
|
2589
3070
|
try {
|
|
2590
3071
|
const response = await saveRecord({
|
|
2591
|
-
tableName,
|
|
2592
3072
|
tableDefinition,
|
|
2593
3073
|
isNewRow,
|
|
2594
3074
|
formData: potentialUpdatedRow,
|
|
@@ -2654,7 +3134,6 @@ function InputRenderer({
|
|
|
2654
3134
|
column,
|
|
2655
3135
|
row,
|
|
2656
3136
|
onRowChange,
|
|
2657
|
-
tableName,
|
|
2658
3137
|
tableDefinition.primaryKey,
|
|
2659
3138
|
tableDefinition.fields,
|
|
2660
3139
|
showSuccess,
|
|
@@ -2666,42 +3145,75 @@ function InputRenderer({
|
|
|
2666
3145
|
initialRowId,
|
|
2667
3146
|
typer
|
|
2668
3147
|
]);
|
|
2669
|
-
const
|
|
3148
|
+
const confirmarEnExpansion = useCallback10((nuevo) => {
|
|
3149
|
+
setEditingValue(nuevo);
|
|
3150
|
+
void handleCommit(nuevo, true, false);
|
|
3151
|
+
}, [handleCommit]);
|
|
3152
|
+
const elegirOpcion = useCallback10((valor) => {
|
|
3153
|
+
confirmarEnExpansion(valor === null || valor === void 0 ? null : typeof valor === "boolean" || isNumericType(fieldDefinition.typeName) ? valor : typer.toLocalString(valor));
|
|
3154
|
+
}, [fieldDefinition.typeName, typer, confirmarEnExpansion]);
|
|
3155
|
+
const expander = useExpander({
|
|
3156
|
+
campo: fieldDefinition,
|
|
3157
|
+
editable: fieldDefinition.editable !== false,
|
|
3158
|
+
fila: row,
|
|
3159
|
+
admiteNulo: fieldDefinition.nullable !== false,
|
|
3160
|
+
anclaje: entradaRef,
|
|
3161
|
+
textoActual: editingValue === null || editingValue === void 0 ? "" : String(editingValue),
|
|
3162
|
+
valorActual: row[column.key],
|
|
3163
|
+
alElegirValor: elegirOpcion,
|
|
3164
|
+
alConfirmarTexto: confirmarEnExpansion,
|
|
3165
|
+
alFallar: showError
|
|
3166
|
+
});
|
|
3167
|
+
const handleKeyDown = useCallback10(async (event) => {
|
|
3168
|
+
if (expander.manejarTecla(event)) return;
|
|
3169
|
+
if (event.key.length === 1 && !event.ctrlKey && !event.altKey && !event.metaKey && caracterRechazado(event.key, typer)) {
|
|
3170
|
+
event.preventDefault();
|
|
3171
|
+
if (expander.tipo === "referencia") void expander.abrir(event.key);
|
|
3172
|
+
return;
|
|
3173
|
+
}
|
|
2670
3174
|
if (event.key === "F4") {
|
|
2671
3175
|
event.preventDefault();
|
|
2672
3176
|
if (onKeyPress) {
|
|
2673
|
-
onKeyPress(rowIdx, column.key, event, handleCommit);
|
|
3177
|
+
onKeyPress(rowIdx, column.key, event, handleCommit, editingValue);
|
|
2674
3178
|
}
|
|
2675
3179
|
return;
|
|
2676
3180
|
}
|
|
2677
|
-
if (
|
|
2678
|
-
|
|
2679
|
-
if (onKeyPress) {
|
|
2680
|
-
onKeyPress(rowIdx, column.key, event, handleCommit);
|
|
2681
|
-
}
|
|
3181
|
+
if (onKeyPress?.(rowIdx, column.key, event, handleCommit, editingValue)) {
|
|
3182
|
+
event.preventDefault();
|
|
2682
3183
|
}
|
|
2683
|
-
}, [handleCommit, editingValue, column.key, rowIdx, onKeyPress]);
|
|
2684
|
-
const procesarTecla =
|
|
3184
|
+
}, [handleCommit, editingValue, column.key, rowIdx, onKeyPress, expander, typer]);
|
|
3185
|
+
const procesarTecla = React12.useRef(() => {
|
|
2685
3186
|
});
|
|
2686
3187
|
procesarTecla.current = (key) => {
|
|
2687
|
-
if (key === "
|
|
2688
|
-
|
|
3188
|
+
if (key === "F9") {
|
|
3189
|
+
void expander.abrir("");
|
|
3190
|
+
} else if (key === "F4" && onKeyPress) {
|
|
3191
|
+
onKeyPress(rowIdx, column.key, { key, target: document.activeElement ?? document.body }, handleCommit, editingValue);
|
|
2689
3192
|
}
|
|
2690
3193
|
};
|
|
2691
|
-
|
|
2692
|
-
const handleBlur =
|
|
3194
|
+
useEffect5(() => registrarEditor?.((key) => procesarTecla.current(key)), []);
|
|
3195
|
+
const handleBlur = useCallback10(() => {
|
|
3196
|
+
if (expander.abierto.current) return;
|
|
2693
3197
|
handleCommit(editingValue, true, false);
|
|
2694
3198
|
}, [handleCommit, editingValue]);
|
|
2695
3199
|
const isFieldEditable = fieldDefinition?.editable !== false;
|
|
2696
3200
|
const isNumeric = isNumericType(fieldDefinition?.typeName);
|
|
2697
|
-
const editor = /* @__PURE__ */
|
|
2698
|
-
|
|
3201
|
+
const editor = /* @__PURE__ */ jsx17(
|
|
3202
|
+
InputBase4,
|
|
2699
3203
|
{
|
|
2700
3204
|
autoFocus: true,
|
|
2701
3205
|
value: editingValue,
|
|
2702
3206
|
onChange: (e) => setEditingValue(e.target.value),
|
|
2703
3207
|
onKeyDown: handleKeyDown,
|
|
3208
|
+
onPaste: (e) => {
|
|
3209
|
+
const pegado = e.clipboardData.getData("text");
|
|
3210
|
+
if (textoPegadoRechazado(pegado, typer)) {
|
|
3211
|
+
e.preventDefault();
|
|
3212
|
+
showError(`\xAB${pegado}\xBB no es un valor v\xE1lido para este campo (${typer.typeName})`);
|
|
3213
|
+
}
|
|
3214
|
+
},
|
|
2704
3215
|
onBlur: handleBlur,
|
|
3216
|
+
inputRef: entradaRef,
|
|
2705
3217
|
placeholder: isMandatory ? "*" : "",
|
|
2706
3218
|
className: editingValue === "--" ? "typed-controls-signal-no-data" : editingValue === "//" ? "typed-controls-signal-unknown-data" : "",
|
|
2707
3219
|
sx: {
|
|
@@ -2718,15 +3230,20 @@ function InputRenderer({
|
|
|
2718
3230
|
}
|
|
2719
3231
|
},
|
|
2720
3232
|
onClick: (e) => e.stopPropagation(),
|
|
2721
|
-
disabled: !isFieldEditable
|
|
3233
|
+
disabled: !isFieldEditable,
|
|
3234
|
+
endAdornment: expander.lupa
|
|
2722
3235
|
}
|
|
2723
3236
|
);
|
|
2724
|
-
|
|
3237
|
+
const conMenu = /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
3238
|
+
editor,
|
|
3239
|
+
expander.ventana
|
|
3240
|
+
] });
|
|
3241
|
+
return currentCellFeedback?.message ? /* @__PURE__ */ jsx17(Tooltip5, { title: currentCellFeedback.message, children: /* @__PURE__ */ jsx17("div", { style: { width: "100%" }, children: conMenu }) }) : conMenu;
|
|
2725
3242
|
}
|
|
2726
3243
|
var InputRenderer_default = InputRenderer;
|
|
2727
3244
|
|
|
2728
3245
|
// src/components/grid/renderers/editCellRenderers.tsx
|
|
2729
|
-
import { jsx as
|
|
3246
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
2730
3247
|
var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
2731
3248
|
const column = props.column;
|
|
2732
3249
|
if (!esColumnaPropia(column)) return void 0;
|
|
@@ -2743,17 +3260,17 @@ var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
|
2743
3260
|
} = defaultColumn;
|
|
2744
3261
|
if (column.editable) {
|
|
2745
3262
|
const fieldDefinition = tableDefinition.fields.find((f) => f.name === column.key);
|
|
2746
|
-
const isFixedField = fixedFields
|
|
3263
|
+
const isFixedField = valorFijoDe(fixedFields, column.key) !== void 0;
|
|
2747
3264
|
const isFieldEditableByUI = fieldDefinition?.editable !== false && !isFixedField;
|
|
2748
3265
|
if (!isFieldEditableByUI) {
|
|
2749
3266
|
return void 0;
|
|
2750
3267
|
}
|
|
2751
|
-
return /* @__PURE__ */
|
|
3268
|
+
return /* @__PURE__ */ jsx18(
|
|
2752
3269
|
InputRenderer_default,
|
|
2753
3270
|
{
|
|
2754
3271
|
...props,
|
|
2755
3272
|
tableDefinition,
|
|
2756
|
-
onKeyPress: (rowIndex, columnKey, event, handleCommit) => handleKeyPressInEditor(rowIndex, columnKey, event, allColumns, handleCommit),
|
|
3273
|
+
onKeyPress: (rowIndex, columnKey, event, handleCommit, valorActual) => handleKeyPressInEditor(rowIndex, columnKey, event, allColumns, handleCommit, valorActual),
|
|
2757
3274
|
registrarEditor,
|
|
2758
3275
|
setTableData,
|
|
2759
3276
|
primaryKey
|
|
@@ -2779,6 +3296,10 @@ var calcularAnchosDeColumnas = (tableDefinition, filas) => {
|
|
|
2779
3296
|
const anchos = /* @__PURE__ */ new Map();
|
|
2780
3297
|
const muestra = filas.slice(0, 50);
|
|
2781
3298
|
tableDefinition.fields.forEach((fieldDef) => {
|
|
3299
|
+
if (typeof fieldDef.width === "number" && fieldDef.width > 0) {
|
|
3300
|
+
anchos.set(fieldDef.name, fieldDef.width);
|
|
3301
|
+
return;
|
|
3302
|
+
}
|
|
2782
3303
|
const headerLabel = fieldDef.label || fieldDef.name;
|
|
2783
3304
|
const type = fieldDef.typeName?.toLowerCase() || "";
|
|
2784
3305
|
let typeMinWidth = 60;
|
|
@@ -2816,14 +3337,13 @@ var useGridColumns = ({
|
|
|
2816
3337
|
toggleFilterVisibility,
|
|
2817
3338
|
abrirOpcionesDeGrilla
|
|
2818
3339
|
}) => {
|
|
2819
|
-
const columns =
|
|
3340
|
+
const columns = useMemo8(() => {
|
|
2820
3341
|
if (!tableDefinition) return [];
|
|
2821
3342
|
const fieldsToShow = tableDefinition.fields.filter((field) => {
|
|
2822
|
-
|
|
2823
|
-
return !isFixedField && field.visible !== false;
|
|
3343
|
+
return !columnaOcultaPorFixedField(fixedFields, field.name) && field.visible !== false;
|
|
2824
3344
|
});
|
|
2825
3345
|
const defaultColumns = fieldsToShow.map((fieldDef) => {
|
|
2826
|
-
const isFixedField = fixedFields
|
|
3346
|
+
const isFixedField = valorFijoDe(fixedFields, fieldDef.name) !== void 0;
|
|
2827
3347
|
const isFieldEditable = fieldDef.editable !== false && !isFixedField;
|
|
2828
3348
|
const colWidth = anchosCalculados.get(fieldDef.name) ?? estimateTextWidth(fieldDef.label || fieldDef.name) + 20;
|
|
2829
3349
|
const column = {
|
|
@@ -2868,7 +3388,7 @@ var useGridColumns = ({
|
|
|
2868
3388
|
editable: false,
|
|
2869
3389
|
resizable: false,
|
|
2870
3390
|
sortable: false,
|
|
2871
|
-
renderHeaderCell: () =>
|
|
3391
|
+
renderHeaderCell: () => React13.createElement(ActionsColumnHeaderCell, {
|
|
2872
3392
|
toggleFilterVisibility,
|
|
2873
3393
|
handleDataGridOptions: (e) => abrirOpcionesDeGrilla(e.currentTarget),
|
|
2874
3394
|
handleAddRow,
|
|
@@ -2902,7 +3422,9 @@ var useGridColumns = ({
|
|
|
2902
3422
|
return allColumns.map((col) => ({
|
|
2903
3423
|
...col,
|
|
2904
3424
|
colSpan: col.customType === "action" ? colSpanDetalle : col.colSpan,
|
|
2905
|
-
|
|
3425
|
+
// el editor guarda por su cuenta (Enter, Tab, flechas y, al perder el foco, el clic afuera): con commitOnOutsideClick react-data-grid
|
|
3426
|
+
// lo cierra sin guardar y los menús (F9), que son un modal, cuentan como «afuera»
|
|
3427
|
+
editorOptions: { closeOnExternalRowChange: false, commitOnOutsideClick: false },
|
|
2906
3428
|
renderEditCell: (props) => allColumnsEditCellRenderer(props, allColumns),
|
|
2907
3429
|
renderCell: (props) => allColumnsCellRenderer(props)
|
|
2908
3430
|
}));
|
|
@@ -2911,25 +3433,25 @@ var useGridColumns = ({
|
|
|
2911
3433
|
};
|
|
2912
3434
|
|
|
2913
3435
|
// src/components/grid/ImportDialog.tsx
|
|
2914
|
-
import { useState as
|
|
3436
|
+
import { useState as useState13 } from "react";
|
|
2915
3437
|
import {
|
|
2916
3438
|
Dialog as Dialog2,
|
|
2917
3439
|
DialogTitle as DialogTitle2,
|
|
2918
3440
|
DialogContent as DialogContent2,
|
|
2919
3441
|
DialogActions as DialogActions2,
|
|
2920
|
-
Button as
|
|
3442
|
+
Button as Button5,
|
|
2921
3443
|
FormControlLabel,
|
|
2922
3444
|
Checkbox,
|
|
2923
3445
|
Box as Box9,
|
|
2924
|
-
Typography as
|
|
3446
|
+
Typography as Typography7,
|
|
2925
3447
|
Stack,
|
|
2926
3448
|
Divider
|
|
2927
3449
|
} from "@mui/material";
|
|
2928
3450
|
import FileUploadIcon2 from "@mui/icons-material/FileUpload";
|
|
2929
|
-
import { jsx as
|
|
3451
|
+
import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2930
3452
|
var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
2931
|
-
const [file, setFile] =
|
|
2932
|
-
const [options, setOptions] =
|
|
3453
|
+
const [file, setFile] = useState13(null);
|
|
3454
|
+
const [options, setOptions] = useState13({
|
|
2933
3455
|
skipUnknownFieldsAtImport: false,
|
|
2934
3456
|
simplificateSpaces: true,
|
|
2935
3457
|
replaceNewLineWithSpace: true
|
|
@@ -2948,15 +3470,15 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
2948
3470
|
onClose();
|
|
2949
3471
|
}
|
|
2950
3472
|
};
|
|
2951
|
-
return /* @__PURE__ */
|
|
2952
|
-
/* @__PURE__ */
|
|
2953
|
-
/* @__PURE__ */
|
|
3473
|
+
return /* @__PURE__ */ jsxs14(Dialog2, { open, onClose: loading ? void 0 : onClose, maxWidth: "sm", fullWidth: true, children: [
|
|
3474
|
+
/* @__PURE__ */ jsxs14(DialogTitle2, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
3475
|
+
/* @__PURE__ */ jsx19(FileUploadIcon2, { color: "primary" }),
|
|
2954
3476
|
"Importar datos desde archivo"
|
|
2955
3477
|
] }),
|
|
2956
|
-
/* @__PURE__ */
|
|
2957
|
-
/* @__PURE__ */
|
|
2958
|
-
/* @__PURE__ */
|
|
2959
|
-
/* @__PURE__ */
|
|
3478
|
+
/* @__PURE__ */ jsx19(DialogContent2, { dividers: true, children: /* @__PURE__ */ jsxs14(Stack, { spacing: 3, sx: { mt: 1 }, children: [
|
|
3479
|
+
/* @__PURE__ */ jsxs14(Box9, { children: [
|
|
3480
|
+
/* @__PURE__ */ jsx19(Typography7, { variant: "subtitle2", gutterBottom: true, fontWeight: "bold", children: "Seleccionar archivo" }),
|
|
3481
|
+
/* @__PURE__ */ jsxs14(
|
|
2960
3482
|
Box9,
|
|
2961
3483
|
{
|
|
2962
3484
|
sx: {
|
|
@@ -2969,7 +3491,7 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
2969
3491
|
position: "relative"
|
|
2970
3492
|
},
|
|
2971
3493
|
children: [
|
|
2972
|
-
/* @__PURE__ */
|
|
3494
|
+
/* @__PURE__ */ jsx19(
|
|
2973
3495
|
"input",
|
|
2974
3496
|
{
|
|
2975
3497
|
type: "file",
|
|
@@ -2986,19 +3508,19 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
2986
3508
|
}
|
|
2987
3509
|
}
|
|
2988
3510
|
),
|
|
2989
|
-
/* @__PURE__ */
|
|
3511
|
+
/* @__PURE__ */ jsx19(Typography7, { variant: "body2", color: file ? "textPrimary" : "textSecondary", children: file ? file.name : "Haz clic aqu\xED para seleccionar un archivo" })
|
|
2990
3512
|
]
|
|
2991
3513
|
}
|
|
2992
3514
|
)
|
|
2993
3515
|
] }),
|
|
2994
|
-
/* @__PURE__ */
|
|
2995
|
-
/* @__PURE__ */
|
|
2996
|
-
/* @__PURE__ */
|
|
2997
|
-
/* @__PURE__ */
|
|
2998
|
-
/* @__PURE__ */
|
|
3516
|
+
/* @__PURE__ */ jsx19(Divider, {}),
|
|
3517
|
+
/* @__PURE__ */ jsxs14(Box9, { children: [
|
|
3518
|
+
/* @__PURE__ */ jsx19(Typography7, { variant: "subtitle2", gutterBottom: true, fontWeight: "bold", children: "Opciones de importaci\xF3n" }),
|
|
3519
|
+
/* @__PURE__ */ jsxs14(Stack, { children: [
|
|
3520
|
+
/* @__PURE__ */ jsx19(
|
|
2999
3521
|
FormControlLabel,
|
|
3000
3522
|
{
|
|
3001
|
-
control: /* @__PURE__ */
|
|
3523
|
+
control: /* @__PURE__ */ jsx19(
|
|
3002
3524
|
Checkbox,
|
|
3003
3525
|
{
|
|
3004
3526
|
checked: options.skipUnknownFieldsAtImport,
|
|
@@ -3006,13 +3528,13 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3006
3528
|
size: "small"
|
|
3007
3529
|
}
|
|
3008
3530
|
),
|
|
3009
|
-
label: /* @__PURE__ */
|
|
3531
|
+
label: /* @__PURE__ */ jsx19(Typography7, { variant: "body2", children: "Omitir campos desconocidos al importar" })
|
|
3010
3532
|
}
|
|
3011
3533
|
),
|
|
3012
|
-
/* @__PURE__ */
|
|
3534
|
+
/* @__PURE__ */ jsx19(
|
|
3013
3535
|
FormControlLabel,
|
|
3014
3536
|
{
|
|
3015
|
-
control: /* @__PURE__ */
|
|
3537
|
+
control: /* @__PURE__ */ jsx19(
|
|
3016
3538
|
Checkbox,
|
|
3017
3539
|
{
|
|
3018
3540
|
checked: options.simplificateSpaces,
|
|
@@ -3020,13 +3542,13 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3020
3542
|
size: "small"
|
|
3021
3543
|
}
|
|
3022
3544
|
),
|
|
3023
|
-
label: /* @__PURE__ */
|
|
3545
|
+
label: /* @__PURE__ */ jsx19(Typography7, { variant: "body2", children: "Simplificar espacios" })
|
|
3024
3546
|
}
|
|
3025
3547
|
),
|
|
3026
|
-
/* @__PURE__ */
|
|
3548
|
+
/* @__PURE__ */ jsx19(
|
|
3027
3549
|
FormControlLabel,
|
|
3028
3550
|
{
|
|
3029
|
-
control: /* @__PURE__ */
|
|
3551
|
+
control: /* @__PURE__ */ jsx19(
|
|
3030
3552
|
Checkbox,
|
|
3031
3553
|
{
|
|
3032
3554
|
checked: options.replaceNewLineWithSpace,
|
|
@@ -3034,21 +3556,21 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3034
3556
|
size: "small"
|
|
3035
3557
|
}
|
|
3036
3558
|
),
|
|
3037
|
-
label: /* @__PURE__ */
|
|
3559
|
+
label: /* @__PURE__ */ jsx19(Typography7, { variant: "body2", children: "Reemplazar saltos de l\xEDnea con espacios" })
|
|
3038
3560
|
}
|
|
3039
3561
|
)
|
|
3040
3562
|
] })
|
|
3041
3563
|
] })
|
|
3042
3564
|
] }) }),
|
|
3043
|
-
/* @__PURE__ */
|
|
3044
|
-
/* @__PURE__ */
|
|
3045
|
-
/* @__PURE__ */
|
|
3046
|
-
|
|
3565
|
+
/* @__PURE__ */ jsxs14(DialogActions2, { sx: { px: 3, py: 2 }, children: [
|
|
3566
|
+
/* @__PURE__ */ jsx19(Button5, { onClick: onClose, disabled: loading, children: "Cancelar" }),
|
|
3567
|
+
/* @__PURE__ */ jsx19(
|
|
3568
|
+
Button5,
|
|
3047
3569
|
{
|
|
3048
3570
|
onClick: handleConfirm,
|
|
3049
3571
|
variant: "contained",
|
|
3050
3572
|
disabled: !file || loading,
|
|
3051
|
-
startIcon: /* @__PURE__ */
|
|
3573
|
+
startIcon: /* @__PURE__ */ jsx19(FileUploadIcon2, {}),
|
|
3052
3574
|
children: loading ? "Procesando..." : "Confirmar Importaci\xF3n"
|
|
3053
3575
|
}
|
|
3054
3576
|
)
|
|
@@ -3057,13 +3579,13 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3057
3579
|
};
|
|
3058
3580
|
|
|
3059
3581
|
// src/components/grid/ExportDialog.tsx
|
|
3060
|
-
import { useState as
|
|
3582
|
+
import { useState as useState14 } from "react";
|
|
3061
3583
|
import {
|
|
3062
3584
|
Dialog as Dialog3,
|
|
3063
3585
|
DialogTitle as DialogTitle3,
|
|
3064
3586
|
DialogContent as DialogContent3,
|
|
3065
3587
|
DialogActions as DialogActions3,
|
|
3066
|
-
Button as
|
|
3588
|
+
Button as Button6,
|
|
3067
3589
|
FormControl as FormControl2,
|
|
3068
3590
|
FormLabel,
|
|
3069
3591
|
RadioGroup,
|
|
@@ -3072,12 +3594,12 @@ import {
|
|
|
3072
3594
|
Checkbox as Checkbox2,
|
|
3073
3595
|
FormGroup,
|
|
3074
3596
|
Box as Box10,
|
|
3075
|
-
Typography as
|
|
3597
|
+
Typography as Typography8,
|
|
3076
3598
|
CircularProgress as CircularProgress2
|
|
3077
3599
|
} from "@mui/material";
|
|
3078
3600
|
import * as XLSX from "xlsx";
|
|
3079
3601
|
import typeStore5 from "type-store";
|
|
3080
|
-
import { jsx as
|
|
3602
|
+
import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3081
3603
|
var ExportDialog = ({
|
|
3082
3604
|
open,
|
|
3083
3605
|
onClose,
|
|
@@ -3086,13 +3608,13 @@ var ExportDialog = ({
|
|
|
3086
3608
|
filteredRows,
|
|
3087
3609
|
username = "anonymous"
|
|
3088
3610
|
}) => {
|
|
3089
|
-
const [format, setFormat] =
|
|
3090
|
-
const [options, setOptions] =
|
|
3611
|
+
const [format, setFormat] = useState14("xlsx");
|
|
3612
|
+
const [options, setOptions] = useState14({
|
|
3091
3613
|
fromOtherTables: true,
|
|
3092
3614
|
readOnly: true,
|
|
3093
3615
|
hiddens: false
|
|
3094
3616
|
});
|
|
3095
|
-
const [isPreparing, setIsPreparing] =
|
|
3617
|
+
const [isPreparing, setIsPreparing] = useState14(false);
|
|
3096
3618
|
const handleOptionChange = (event) => {
|
|
3097
3619
|
setOptions({
|
|
3098
3620
|
...options,
|
|
@@ -3222,76 +3744,76 @@ var ExportDialog = ({
|
|
|
3222
3744
|
URL.revokeObjectURL(url);
|
|
3223
3745
|
}, 0);
|
|
3224
3746
|
};
|
|
3225
|
-
return /* @__PURE__ */
|
|
3226
|
-
/* @__PURE__ */
|
|
3227
|
-
/* @__PURE__ */
|
|
3228
|
-
/* @__PURE__ */
|
|
3229
|
-
/* @__PURE__ */
|
|
3230
|
-
] }) : /* @__PURE__ */
|
|
3231
|
-
/* @__PURE__ */
|
|
3232
|
-
/* @__PURE__ */
|
|
3233
|
-
/* @__PURE__ */
|
|
3747
|
+
return /* @__PURE__ */ jsxs15(Dialog3, { open, onClose, maxWidth: "xs", fullWidth: true, children: [
|
|
3748
|
+
/* @__PURE__ */ jsx20(DialogTitle3, { children: "Exportar Datos" }),
|
|
3749
|
+
/* @__PURE__ */ jsx20(DialogContent3, { children: isPreparing ? /* @__PURE__ */ jsxs15(Box10, { display: "flex", flexDirection: "column", alignItems: "center", py: 4, children: [
|
|
3750
|
+
/* @__PURE__ */ jsx20(CircularProgress2, {}),
|
|
3751
|
+
/* @__PURE__ */ jsx20(Typography8, { sx: { mt: 2 }, children: "Preparando exportaci\xF3n..." })
|
|
3752
|
+
] }) : /* @__PURE__ */ jsxs15(Box10, { sx: { mt: 1 }, children: [
|
|
3753
|
+
/* @__PURE__ */ jsxs15(FormControl2, { component: "fieldset", children: [
|
|
3754
|
+
/* @__PURE__ */ jsx20(FormLabel, { component: "legend", children: "Formato" }),
|
|
3755
|
+
/* @__PURE__ */ jsxs15(
|
|
3234
3756
|
RadioGroup,
|
|
3235
3757
|
{
|
|
3236
3758
|
value: format,
|
|
3237
3759
|
onChange: (e) => setFormat(e.target.value),
|
|
3238
3760
|
children: [
|
|
3239
|
-
/* @__PURE__ */
|
|
3240
|
-
/* @__PURE__ */
|
|
3241
|
-
/* @__PURE__ */
|
|
3761
|
+
/* @__PURE__ */ jsx20(FormControlLabel2, { value: "xlsx", control: /* @__PURE__ */ jsx20(Radio, {}), label: "Excel (.xlsx)" }),
|
|
3762
|
+
/* @__PURE__ */ jsx20(FormControlLabel2, { value: "tab", control: /* @__PURE__ */ jsx20(Radio, {}), label: "Tabulado (.tab | )" }),
|
|
3763
|
+
/* @__PURE__ */ jsx20(FormControlLabel2, { value: "csv", control: /* @__PURE__ */ jsx20(Radio, {}), label: "CSV (.csv , )" })
|
|
3242
3764
|
]
|
|
3243
3765
|
}
|
|
3244
3766
|
)
|
|
3245
3767
|
] }),
|
|
3246
|
-
/* @__PURE__ */
|
|
3247
|
-
/* @__PURE__ */
|
|
3248
|
-
/* @__PURE__ */
|
|
3249
|
-
/* @__PURE__ */
|
|
3768
|
+
/* @__PURE__ */ jsxs15(Box10, { sx: { mt: 3 }, children: [
|
|
3769
|
+
/* @__PURE__ */ jsx20(Typography8, { variant: "subtitle2", gutterBottom: true, children: "Opciones de campos:" }),
|
|
3770
|
+
/* @__PURE__ */ jsxs15(FormGroup, { children: [
|
|
3771
|
+
/* @__PURE__ */ jsx20(
|
|
3250
3772
|
FormControlLabel2,
|
|
3251
3773
|
{
|
|
3252
|
-
control: /* @__PURE__ */
|
|
3774
|
+
control: /* @__PURE__ */ jsx20(Checkbox2, { checked: options.fromOtherTables, onChange: handleOptionChange, name: "fromOtherTables" }),
|
|
3253
3775
|
label: "Desde otras tablas"
|
|
3254
3776
|
}
|
|
3255
3777
|
),
|
|
3256
|
-
/* @__PURE__ */
|
|
3778
|
+
/* @__PURE__ */ jsx20(
|
|
3257
3779
|
FormControlLabel2,
|
|
3258
3780
|
{
|
|
3259
|
-
control: /* @__PURE__ */
|
|
3781
|
+
control: /* @__PURE__ */ jsx20(Checkbox2, { checked: options.readOnly, onChange: handleOptionChange, name: "readOnly" }),
|
|
3260
3782
|
label: "Solo lectura"
|
|
3261
3783
|
}
|
|
3262
3784
|
),
|
|
3263
|
-
/* @__PURE__ */
|
|
3785
|
+
/* @__PURE__ */ jsx20(
|
|
3264
3786
|
FormControlLabel2,
|
|
3265
3787
|
{
|
|
3266
|
-
control: /* @__PURE__ */
|
|
3788
|
+
control: /* @__PURE__ */ jsx20(Checkbox2, { checked: options.hiddens, onChange: handleOptionChange, name: "hiddens" }),
|
|
3267
3789
|
label: "Ocultos"
|
|
3268
3790
|
}
|
|
3269
3791
|
)
|
|
3270
3792
|
] })
|
|
3271
3793
|
] })
|
|
3272
3794
|
] }) }),
|
|
3273
|
-
/* @__PURE__ */
|
|
3274
|
-
/* @__PURE__ */
|
|
3275
|
-
/* @__PURE__ */
|
|
3795
|
+
/* @__PURE__ */ jsxs15(DialogActions3, { children: [
|
|
3796
|
+
/* @__PURE__ */ jsx20(Button6, { onClick: onClose, disabled: isPreparing, children: "Cancelar" }),
|
|
3797
|
+
/* @__PURE__ */ jsx20(Button6, { onClick: handlePrepareExport, variant: "contained", disabled: isPreparing, children: "Descargar" })
|
|
3276
3798
|
] })
|
|
3277
3799
|
] });
|
|
3278
3800
|
};
|
|
3279
3801
|
|
|
3280
3802
|
// src/pages/VerticalEditorPage.tsx
|
|
3281
|
-
import { useState as
|
|
3803
|
+
import { useState as useState15, useCallback as useCallback11, useMemo as useMemo9, useRef as useRef6 } from "react";
|
|
3282
3804
|
import {
|
|
3283
3805
|
DialogTitle as DialogTitle4,
|
|
3284
3806
|
DialogContent as DialogContent4,
|
|
3285
3807
|
DialogActions as DialogActions4,
|
|
3286
|
-
Button as
|
|
3808
|
+
Button as Button7,
|
|
3287
3809
|
Alert,
|
|
3288
3810
|
Box as Box11,
|
|
3289
3811
|
CircularProgress as CircularProgress3,
|
|
3290
|
-
IconButton as
|
|
3291
|
-
Typography as
|
|
3812
|
+
IconButton as IconButton5,
|
|
3813
|
+
Typography as Typography9
|
|
3292
3814
|
} from "@mui/material";
|
|
3293
3815
|
import CloseIcon from "@mui/icons-material/Close";
|
|
3294
|
-
import { jsx as
|
|
3816
|
+
import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3295
3817
|
var VerticalEditorPage = ({
|
|
3296
3818
|
tableName,
|
|
3297
3819
|
tableDefinition,
|
|
@@ -3302,20 +3824,20 @@ var VerticalEditorPage = ({
|
|
|
3302
3824
|
onClose
|
|
3303
3825
|
}) => {
|
|
3304
3826
|
const { saveRecord } = useTableRecordSave();
|
|
3305
|
-
const [internalIsNewRow, setInternalIsNewRow] =
|
|
3306
|
-
const [formData, setFormData] =
|
|
3307
|
-
const [lastSavedData, setLastSavedData] =
|
|
3308
|
-
const [validityMap, setValidityMap] =
|
|
3309
|
-
const [globalError, setGlobalError] =
|
|
3310
|
-
const [isSaving, setIsSaving] =
|
|
3311
|
-
const [fieldFeedback, setFieldFeedback] =
|
|
3312
|
-
const feedbackTimersRef =
|
|
3313
|
-
const handleFieldChange =
|
|
3827
|
+
const [internalIsNewRow, setInternalIsNewRow] = useState15(isNewRow);
|
|
3828
|
+
const [formData, setFormData] = useState15(initialData);
|
|
3829
|
+
const [lastSavedData, setLastSavedData] = useState15(initialData);
|
|
3830
|
+
const [validityMap, setValidityMap] = useState15({});
|
|
3831
|
+
const [globalError, setGlobalError] = useState15(null);
|
|
3832
|
+
const [isSaving, setIsSaving] = useState15(false);
|
|
3833
|
+
const [fieldFeedback, setFieldFeedback] = useState15({});
|
|
3834
|
+
const feedbackTimersRef = useRef6({});
|
|
3835
|
+
const handleFieldChange = useCallback11((fieldName, newValue, isValid) => {
|
|
3314
3836
|
setFormData((prev) => ({ ...prev, [fieldName]: newValue }));
|
|
3315
3837
|
setValidityMap((prev) => ({ ...prev, [fieldName]: isValid }));
|
|
3316
3838
|
setGlobalError(null);
|
|
3317
3839
|
}, []);
|
|
3318
|
-
const isFormValid =
|
|
3840
|
+
const isFormValid = useMemo9(() => {
|
|
3319
3841
|
for (const key in validityMap) {
|
|
3320
3842
|
if (validityMap[key] === false) return false;
|
|
3321
3843
|
}
|
|
@@ -3328,7 +3850,7 @@ var VerticalEditorPage = ({
|
|
|
3328
3850
|
}
|
|
3329
3851
|
return true;
|
|
3330
3852
|
}, [formData, validityMap, tableDefinition.fields]);
|
|
3331
|
-
const handleCommit =
|
|
3853
|
+
const handleCommit = useCallback11(async (fieldName, newValue, isValid) => {
|
|
3332
3854
|
if (!isValid) return;
|
|
3333
3855
|
if (sameValue(newValue, lastSavedData[fieldName])) {
|
|
3334
3856
|
return;
|
|
@@ -3350,7 +3872,6 @@ var VerticalEditorPage = ({
|
|
|
3350
3872
|
setGlobalError(null);
|
|
3351
3873
|
try {
|
|
3352
3874
|
const response = await saveRecord({
|
|
3353
|
-
tableName,
|
|
3354
3875
|
tableDefinition,
|
|
3355
3876
|
isNewRow: internalIsNewRow,
|
|
3356
3877
|
formData: potentialUpdatedRow,
|
|
@@ -3419,21 +3940,21 @@ var VerticalEditorPage = ({
|
|
|
3419
3940
|
tableDefinition,
|
|
3420
3941
|
onSaveSuccess
|
|
3421
3942
|
]);
|
|
3422
|
-
return /* @__PURE__ */
|
|
3423
|
-
/* @__PURE__ */
|
|
3424
|
-
/* @__PURE__ */
|
|
3943
|
+
return /* @__PURE__ */ jsxs16(Box11, { sx: { p: 2, display: "flex", flexDirection: "column", height: "100%" }, children: [
|
|
3944
|
+
/* @__PURE__ */ jsxs16(DialogTitle4, { sx: { px: 0, pt: 0, display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
3945
|
+
/* @__PURE__ */ jsxs16(Typography9, { component: "div", variant: "h6", children: [
|
|
3425
3946
|
isNewRow ? "Nuevo Registro" : "Editar Registro",
|
|
3426
3947
|
" - ",
|
|
3427
3948
|
tableDefinition.title || tableName
|
|
3428
3949
|
] }),
|
|
3429
|
-
/* @__PURE__ */
|
|
3950
|
+
/* @__PURE__ */ jsx21(IconButton5, { onClick: onClose, size: "small", edge: "end", children: /* @__PURE__ */ jsx21(CloseIcon, {}) })
|
|
3430
3951
|
] }),
|
|
3431
|
-
/* @__PURE__ */
|
|
3432
|
-
globalError && /* @__PURE__ */
|
|
3433
|
-
/* @__PURE__ */
|
|
3952
|
+
/* @__PURE__ */ jsxs16(DialogContent4, { dividers: true, sx: { px: 2, flexGrow: 1, py: 1 }, children: [
|
|
3953
|
+
globalError && /* @__PURE__ */ jsx21(Alert, { severity: "error", sx: { mb: 2 }, children: globalError }),
|
|
3954
|
+
/* @__PURE__ */ jsx21(Box11, { sx: { display: "flex", flexDirection: "column", gap: 0.5 }, children: tableDefinition.fields.map((field) => {
|
|
3434
3955
|
const isFixed = fixedFields?.some((ff) => ff.fieldName === field.name);
|
|
3435
3956
|
const isMandatory = field.nullable === false || tableDefinition.primaryKey.includes(field.name);
|
|
3436
|
-
return /* @__PURE__ */
|
|
3957
|
+
return /* @__PURE__ */ jsx21(Box11, { sx: { width: "100%", maxWidth: "100%" }, children: /* @__PURE__ */ jsx21(
|
|
3437
3958
|
TypedField,
|
|
3438
3959
|
{
|
|
3439
3960
|
fieldDef: field,
|
|
@@ -3447,22 +3968,89 @@ var VerticalEditorPage = ({
|
|
|
3447
3968
|
) }, field.name);
|
|
3448
3969
|
}) })
|
|
3449
3970
|
] }),
|
|
3450
|
-
/* @__PURE__ */
|
|
3451
|
-
/* @__PURE__ */
|
|
3452
|
-
isSaving && /* @__PURE__ */
|
|
3453
|
-
/* @__PURE__ */
|
|
3971
|
+
/* @__PURE__ */ jsxs16(DialogActions4, { sx: { px: 0, pb: 0, pt: 2, justifyContent: "space-between", alignItems: "center" }, children: [
|
|
3972
|
+
/* @__PURE__ */ jsxs16(Box11, { children: [
|
|
3973
|
+
isSaving && /* @__PURE__ */ jsx21(CircularProgress3, { size: 20, sx: { ml: 2 } }),
|
|
3974
|
+
/* @__PURE__ */ jsx21("span", { style: { marginLeft: 10, fontSize: "0.8rem", color: "#666" }, children: isSaving ? "Guardando..." : "Cambios auto-guardados" })
|
|
3454
3975
|
] }),
|
|
3455
|
-
/* @__PURE__ */
|
|
3976
|
+
/* @__PURE__ */ jsx21(Button7, { variant: "outlined", onClick: onClose, children: "Cerrar" })
|
|
3456
3977
|
] })
|
|
3457
3978
|
] });
|
|
3458
3979
|
};
|
|
3459
3980
|
|
|
3981
|
+
// src/utils/parametrosDeTabla.ts
|
|
3982
|
+
import JSON4all3 from "json4all";
|
|
3983
|
+
function esRegistro(valor) {
|
|
3984
|
+
return typeof valor === "object" && valor !== null && !Array.isArray(valor) && !(valor instanceof Date);
|
|
3985
|
+
}
|
|
3986
|
+
var CODIFICADOS = ["ff", "fc", "td", "pf"];
|
|
3987
|
+
function parametrosDeDireccion(direccion) {
|
|
3988
|
+
const resultado = {};
|
|
3989
|
+
direccion.split("&").forEach((par) => {
|
|
3990
|
+
const sinMarca = par.replace(/^[#?]/, "");
|
|
3991
|
+
const igual = sinMarca.indexOf("=");
|
|
3992
|
+
if (igual === -1) return;
|
|
3993
|
+
const nombre = sinMarca.slice(0, igual);
|
|
3994
|
+
try {
|
|
3995
|
+
const texto = decodeURIComponent(sinMarca.slice(igual + 1));
|
|
3996
|
+
resultado[nombre] = CODIFICADOS.includes(nombre) ? JSON4all3.parse(texto) : texto;
|
|
3997
|
+
} catch (err) {
|
|
3998
|
+
console.warn(`No se pudo interpretar el par\xE1metro '${nombre}' de la direcci\xF3n:`, err);
|
|
3999
|
+
}
|
|
4000
|
+
});
|
|
4001
|
+
return resultado;
|
|
4002
|
+
}
|
|
4003
|
+
function aFixedFields(valor) {
|
|
4004
|
+
if (Array.isArray(valor)) {
|
|
4005
|
+
return valor.flatMap((par) => {
|
|
4006
|
+
if (!esRegistro(par) || typeof par.fieldName !== "string") return [];
|
|
4007
|
+
const fixedField = { fieldName: par.fieldName, value: par.value };
|
|
4008
|
+
if (par.until !== void 0) fixedField.until = par.until;
|
|
4009
|
+
if (typeof par.range === "boolean") fixedField.range = par.range;
|
|
4010
|
+
if (typeof par.show === "boolean") fixedField.show = par.show;
|
|
4011
|
+
return [fixedField];
|
|
4012
|
+
});
|
|
4013
|
+
}
|
|
4014
|
+
if (esRegistro(valor)) return Object.entries(valor).map(([fieldName, value]) => ({ fieldName, value }));
|
|
4015
|
+
return [];
|
|
4016
|
+
}
|
|
4017
|
+
function aFiltrosIniciales(valor) {
|
|
4018
|
+
if (!Array.isArray(valor) || valor.length === 0) return [];
|
|
4019
|
+
const filas = Array.isArray(valor[0]) ? valor : [valor];
|
|
4020
|
+
return filas.map((fila) => Array.isArray(fila) ? fila.flatMap((condicion) => {
|
|
4021
|
+
if (!esRegistro(condicion) || typeof condicion.operator !== "string") return [];
|
|
4022
|
+
const columna = condicion.column ?? condicion.fieldName;
|
|
4023
|
+
return typeof columna === "string" ? [{ column: columna, operator: condicion.operator, value: condicion.value }] : [];
|
|
4024
|
+
}) : []).filter((fila) => fila.length > 0);
|
|
4025
|
+
}
|
|
4026
|
+
function parametrosDeTabla(item, direccion) {
|
|
4027
|
+
const origen = { ...item, ...parametrosDeDireccion(direccion) };
|
|
4028
|
+
const parametros = {};
|
|
4029
|
+
const fixedFields = aFixedFields(origen.ff ?? origen.fixedFields);
|
|
4030
|
+
if (fixedFields.length > 0) parametros.fixedFields = fixedFields;
|
|
4031
|
+
const filterColumns = aFiltrosIniciales(origen.fc);
|
|
4032
|
+
if (filterColumns.length > 0) parametros.filterColumns = filterColumns;
|
|
4033
|
+
if (esRegistro(origen.td)) parametros.tableDef = origen.td;
|
|
4034
|
+
if (esRegistro(origen.pf)) parametros.parameterFunctions = origen.pf;
|
|
4035
|
+
if (typeof origen.pick === "string") parametros.pick = origen.pick;
|
|
4036
|
+
if (typeof origen.label === "string") parametros.label = origen.label;
|
|
4037
|
+
return parametros;
|
|
4038
|
+
}
|
|
4039
|
+
function fusionar(base, cambios) {
|
|
4040
|
+
const resultado = { ...base };
|
|
4041
|
+
for (const [clave, valor] of Object.entries(cambios)) {
|
|
4042
|
+
const actual = Reflect.get(resultado, clave);
|
|
4043
|
+
Reflect.set(resultado, clave, esRegistro(actual) && esRegistro(valor) ? fusionar(actual, valor) : valor);
|
|
4044
|
+
}
|
|
4045
|
+
return resultado;
|
|
4046
|
+
}
|
|
4047
|
+
|
|
3460
4048
|
// src/rutaBase.ts
|
|
3461
4049
|
var baseDelBundler = import.meta.env?.BASE_URL ?? "/";
|
|
3462
4050
|
var rutaBase = baseDelBundler.replace(/\/+$/, "");
|
|
3463
4051
|
|
|
3464
4052
|
// src/components/grid/GenericDataGrid.tsx
|
|
3465
|
-
import { jsx as
|
|
4053
|
+
import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3466
4054
|
var SUMMARY_ROW_HEIGHT = 35;
|
|
3467
4055
|
var FILTER_ROW_HEIGHT = 35;
|
|
3468
4056
|
var HEADER_ROW_HEIGHT = 30;
|
|
@@ -3483,7 +4071,7 @@ var cargasEnCurso = /* @__PURE__ */ new Map();
|
|
|
3483
4071
|
var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
3484
4072
|
const theme = useTheme4();
|
|
3485
4073
|
const { tableDefinition, row } = ancestor;
|
|
3486
|
-
const columns =
|
|
4074
|
+
const columns = useMemo10(() => {
|
|
3487
4075
|
const filteredFields = tableDefinition.fields.filter(
|
|
3488
4076
|
(field) => !fieldsToHide?.some((ff) => ff.fieldName === field.name)
|
|
3489
4077
|
);
|
|
@@ -3494,8 +4082,8 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
3494
4082
|
name: field.label || cambiarGuionesBajosPorEspacios(field.name),
|
|
3495
4083
|
width: 150,
|
|
3496
4084
|
editable: false,
|
|
3497
|
-
renderHeaderCell: () => /* @__PURE__ */
|
|
3498
|
-
|
|
4085
|
+
renderHeaderCell: () => /* @__PURE__ */ jsx22(Box12, { sx: { p: 0.5, height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsx22(
|
|
4086
|
+
Typography10,
|
|
3499
4087
|
{
|
|
3500
4088
|
variant: "caption",
|
|
3501
4089
|
sx: {
|
|
@@ -3506,11 +4094,11 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
3506
4094
|
children: field.label || cambiarGuionesBajosPorEspacios(field.name)
|
|
3507
4095
|
}
|
|
3508
4096
|
) }),
|
|
3509
|
-
renderCell: (props) => /* @__PURE__ */
|
|
4097
|
+
renderCell: (props) => /* @__PURE__ */ jsx22(Box12, { sx: { px: 1, height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsx22(Typography10, { variant: "body2", sx: { fontSize: "0.875rem" }, noWrap: true, children: String(props.row[field.name] ?? "") }) })
|
|
3510
4098
|
};
|
|
3511
4099
|
});
|
|
3512
4100
|
}, [tableDefinition, fieldsToHide]);
|
|
3513
|
-
return /* @__PURE__ */
|
|
4101
|
+
return /* @__PURE__ */ jsxs17(Box12, { sx: {
|
|
3514
4102
|
mb: 1.5,
|
|
3515
4103
|
ml: index * 4,
|
|
3516
4104
|
// El primer ancestro (index 0) no tiene margen, los siguientes sí
|
|
@@ -3521,7 +4109,7 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
3521
4109
|
boxShadow: theme.shadows[1],
|
|
3522
4110
|
bgcolor: "background.paper"
|
|
3523
4111
|
}, children: [
|
|
3524
|
-
/* @__PURE__ */
|
|
4112
|
+
/* @__PURE__ */ jsx22(Box12, { sx: {
|
|
3525
4113
|
bgcolor: "primary.main",
|
|
3526
4114
|
color: "primary.contrastText",
|
|
3527
4115
|
px: 1.5,
|
|
@@ -3532,8 +4120,8 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
3532
4120
|
alignItems: "center",
|
|
3533
4121
|
fontWeight: "bold",
|
|
3534
4122
|
gap: 1
|
|
3535
|
-
}, children: /* @__PURE__ */
|
|
3536
|
-
/* @__PURE__ */
|
|
4123
|
+
}, children: /* @__PURE__ */ jsx22(Typography10, { variant: "subtitle2", component: "div", children: cambiarGuionesBajosPorEspacios(ancestor.tableName) }) }),
|
|
4124
|
+
/* @__PURE__ */ jsx22(
|
|
3537
4125
|
DataGrid,
|
|
3538
4126
|
{
|
|
3539
4127
|
className: "rdg-light",
|
|
@@ -3550,6 +4138,10 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
3550
4138
|
var GenericDataGrid = ({
|
|
3551
4139
|
tableName,
|
|
3552
4140
|
fixedFields: fixedFieldsRecibidos,
|
|
4141
|
+
filterColumns: filterColumnsRecibidos,
|
|
4142
|
+
tableDef: tableDefRecibido,
|
|
4143
|
+
parameterFunctions: parameterFunctionsRecibido,
|
|
4144
|
+
pick: pickRecibido,
|
|
3553
4145
|
gridStyles,
|
|
3554
4146
|
onOpenDetail,
|
|
3555
4147
|
ancestors = SIN_ANCESTROS,
|
|
@@ -3562,36 +4154,42 @@ var GenericDataGrid = ({
|
|
|
3562
4154
|
altoMaximoDetalle
|
|
3563
4155
|
}) => {
|
|
3564
4156
|
const claveFixedFields = JSON.stringify(fixedFieldsRecibidos ?? null);
|
|
3565
|
-
const fixedFields =
|
|
4157
|
+
const fixedFields = useMemo10(() => fixedFieldsRecibidos, [claveFixedFields]);
|
|
4158
|
+
const claveParametros = JSON.stringify([filterColumnsRecibidos ?? null, tableDefRecibido ?? null, parameterFunctionsRecibido ?? null, pickRecibido ?? null]);
|
|
4159
|
+
const parametros = useMemo10(
|
|
4160
|
+
() => ({ filterColumns: filterColumnsRecibidos, tableDef: tableDefRecibido, parameterFunctions: parameterFunctionsRecibido, pick: pickRecibido }),
|
|
4161
|
+
[claveParametros]
|
|
4162
|
+
// eslint-disable-line react-hooks/exhaustive-deps
|
|
4163
|
+
);
|
|
3566
4164
|
const cacheHeredado = useContext4(CacheGrillasContext);
|
|
3567
|
-
const [cachePropio] =
|
|
4165
|
+
const [cachePropio] = useState16(() => /* @__PURE__ */ new Map());
|
|
3568
4166
|
const cache = cacheHeredado ?? cachePropio;
|
|
3569
|
-
const [guardada] =
|
|
3570
|
-
const claveCargadaRef =
|
|
3571
|
-
const [tableDefinition, setTableDefinition] =
|
|
3572
|
-
const [tableData, setTableData] =
|
|
3573
|
-
const [cargandoInicial, setCargandoInicial] =
|
|
3574
|
-
const [errorDeCarga, setErrorDeCarga] =
|
|
3575
|
-
const [anchosCalculados, setAnchosCalculados] =
|
|
3576
|
-
const [detallesAbiertos, setDetallesAbiertos] =
|
|
3577
|
-
const [altosDetalle, setAltosDetalle] =
|
|
3578
|
-
const [anchosDetalle, setAnchosDetalle] =
|
|
3579
|
-
const [selectedRows, setSelectedRows] =
|
|
3580
|
-
const [, setSelectedCell] =
|
|
3581
|
-
const [estadoGrilla] =
|
|
4167
|
+
const [guardada] = useState16(() => claveCache ? cache.get(claveCache) : void 0);
|
|
4168
|
+
const claveCargadaRef = useRef7(guardada ? `${tableName}|${claveFixedFields}|${claveParametros}` : null);
|
|
4169
|
+
const [tableDefinition, setTableDefinition] = useState16(guardada?.tableDefinition ?? null);
|
|
4170
|
+
const [tableData, setTableData] = useState16(guardada?.tableData ?? []);
|
|
4171
|
+
const [cargandoInicial, setCargandoInicial] = useState16(!guardada);
|
|
4172
|
+
const [errorDeCarga, setErrorDeCarga] = useState16(null);
|
|
4173
|
+
const [anchosCalculados, setAnchosCalculados] = useState16(() => guardada?.anchosCalculados ?? /* @__PURE__ */ new Map());
|
|
4174
|
+
const [detallesAbiertos, setDetallesAbiertos] = useState16(guardada?.detallesAbiertos ?? []);
|
|
4175
|
+
const [altosDetalle, setAltosDetalle] = useState16(() => guardada?.altosDetalle ?? /* @__PURE__ */ new Map());
|
|
4176
|
+
const [anchosDetalle, setAnchosDetalle] = useState16(() => /* @__PURE__ */ new Map());
|
|
4177
|
+
const [selectedRows, setSelectedRows] = useState16(() => /* @__PURE__ */ new Set());
|
|
4178
|
+
const [, setSelectedCell] = useState16(void 0);
|
|
4179
|
+
const [estadoGrilla] = useState16(crearEstadoGrilla);
|
|
3582
4180
|
const theme = useTheme4();
|
|
3583
|
-
const [openDataGridOptions, setOpenDataGridOptions] =
|
|
3584
|
-
const [dataGridOptionsAnchorEl, setDataGridOptionsAnchorEl] =
|
|
3585
|
-
const [exitingRowIds, setExitingRowIds] =
|
|
4181
|
+
const [openDataGridOptions, setOpenDataGridOptions] = useState16(false);
|
|
4182
|
+
const [dataGridOptionsAnchorEl, setDataGridOptionsAnchorEl] = useState16(null);
|
|
4183
|
+
const [exitingRowIds, setExitingRowIds] = useState16(/* @__PURE__ */ new Set());
|
|
3586
4184
|
const { showError } = useSnackbar();
|
|
3587
4185
|
const { username: usuario } = useClientContext();
|
|
3588
|
-
const dataGridRef =
|
|
3589
|
-
const rowAtEditStartRef =
|
|
3590
|
-
const [openImportDialog, setOpenImportDialog] =
|
|
3591
|
-
const [openExportDialog, setOpenExportDialog] =
|
|
3592
|
-
const [columnWidths, setColumnWidths] =
|
|
4186
|
+
const dataGridRef = useRef7(null);
|
|
4187
|
+
const rowAtEditStartRef = useRef7(null);
|
|
4188
|
+
const [openImportDialog, setOpenImportDialog] = useState16(false);
|
|
4189
|
+
const [openExportDialog, setOpenExportDialog] = useState16(false);
|
|
4190
|
+
const [columnWidths, setColumnWidths] = useState16(() => /* @__PURE__ */ new Map());
|
|
3593
4191
|
const { callApi, callApiUpload, loading } = useApiCall();
|
|
3594
|
-
const primaryKey =
|
|
4192
|
+
const primaryKey = useMemo10(() => {
|
|
3595
4193
|
if (!tableDefinition) return ["id"];
|
|
3596
4194
|
return tableDefinition.primaryKey && tableDefinition.primaryKey.length > 0 ? tableDefinition.primaryKey : ["id"];
|
|
3597
4195
|
}, [tableDefinition]);
|
|
@@ -3605,13 +4203,14 @@ var GenericDataGrid = ({
|
|
|
3605
4203
|
setFilters,
|
|
3606
4204
|
isFilterRowVisible,
|
|
3607
4205
|
toggleFilterVisibility,
|
|
4206
|
+
aplicarFiltrosIniciales,
|
|
3608
4207
|
filteredRows,
|
|
3609
4208
|
summaryData,
|
|
3610
4209
|
resetView
|
|
3611
4210
|
} = useGridDataView({ tableData, tableDefinition });
|
|
3612
|
-
const abiertos =
|
|
3613
|
-
const filasDetalleRef =
|
|
3614
|
-
const filasMostradas =
|
|
4211
|
+
const abiertos = useMemo10(() => new Set(detallesAbiertos), [detallesAbiertos]);
|
|
4212
|
+
const filasDetalleRef = useRef7(/* @__PURE__ */ new Map());
|
|
4213
|
+
const filasMostradas = useMemo10(() => {
|
|
3615
4214
|
const detailTables = tableDefinition?.detailTables ?? [];
|
|
3616
4215
|
if (abiertos.size === 0 || detailTables.length === 0) return filteredRows;
|
|
3617
4216
|
const anteriores = filasDetalleRef.current;
|
|
@@ -3638,8 +4237,8 @@ var GenericDataGrid = ({
|
|
|
3638
4237
|
filasDetalleRef.current = nuevas;
|
|
3639
4238
|
return filas;
|
|
3640
4239
|
}, [filteredRows, abiertos, tableDefinition, primaryKey]);
|
|
3641
|
-
const altoDeDetalle =
|
|
3642
|
-
const altoDetalles =
|
|
4240
|
+
const altoDeDetalle = useCallback12((clave) => altosDetalle.get(clave) ?? ALTO_INICIAL_DETALLE, [altosDetalle]);
|
|
4241
|
+
const altoDetalles = useMemo10(
|
|
3643
4242
|
() => filasMostradas.reduce((total, row) => esFilaDetalle(row) ? total + altoDeDetalle(row.clave) : total, 0),
|
|
3644
4243
|
[filasMostradas, altoDeDetalle]
|
|
3645
4244
|
);
|
|
@@ -3685,6 +4284,13 @@ var GenericDataGrid = ({
|
|
|
3685
4284
|
filasVisiblesMax,
|
|
3686
4285
|
conPie
|
|
3687
4286
|
});
|
|
4287
|
+
const [contenidoDeCelda, setContenidoDeCelda] = useState16(null);
|
|
4288
|
+
const verContenido = useCallback12((anclaje, texto) => setContenidoDeCelda({ anclaje, texto }), []);
|
|
4289
|
+
const cerrarContenidoDeCelda = useCallback12(() => {
|
|
4290
|
+
const anclaje = contenidoDeCelda?.anclaje;
|
|
4291
|
+
setContenidoDeCelda(null);
|
|
4292
|
+
setTimeout(() => anclaje?.focus(), 0);
|
|
4293
|
+
}, [contenidoDeCelda]);
|
|
3688
4294
|
const { handleCellDoubleClick, handleCellClick, handleCellKeyDown, handleCellMouseDown, handleKeyPressInEditor, registrarEditor, handleSelectedCellChange, handleRowsChange } = useGridEvents({
|
|
3689
4295
|
dataGridRef,
|
|
3690
4296
|
filteredRows: filasMostradas,
|
|
@@ -3693,10 +4299,11 @@ var GenericDataGrid = ({
|
|
|
3693
4299
|
tableDefinition,
|
|
3694
4300
|
setSelectedCell,
|
|
3695
4301
|
setTableData,
|
|
3696
|
-
setSortColumns
|
|
4302
|
+
setSortColumns,
|
|
4303
|
+
verContenido
|
|
3697
4304
|
});
|
|
3698
|
-
const tableNameAnteriorRef =
|
|
3699
|
-
|
|
4305
|
+
const tableNameAnteriorRef = useRef7(tableName);
|
|
4306
|
+
useEffect6(() => {
|
|
3700
4307
|
if (tableNameAnteriorRef.current === tableName) return;
|
|
3701
4308
|
tableNameAnteriorRef.current = tableName;
|
|
3702
4309
|
setDetallesAbiertos([]);
|
|
@@ -3710,8 +4317,8 @@ var GenericDataGrid = ({
|
|
|
3710
4317
|
setExitingRowIds(/* @__PURE__ */ new Set());
|
|
3711
4318
|
setColumnWidths(/* @__PURE__ */ new Map());
|
|
3712
4319
|
}, [tableName, estadoGrilla, resetView]);
|
|
3713
|
-
|
|
3714
|
-
const claveCarga = `${tableName}|${claveFixedFields}`;
|
|
4320
|
+
useEffect6(() => {
|
|
4321
|
+
const claveCarga = `${tableName}|${claveFixedFields}|${claveParametros}`;
|
|
3715
4322
|
if (claveCargadaRef.current === claveCarga) {
|
|
3716
4323
|
if (guardada) setSortColumns(guardada.sortColumns);
|
|
3717
4324
|
return;
|
|
@@ -3721,7 +4328,7 @@ var GenericDataGrid = ({
|
|
|
3721
4328
|
setCargandoInicial(true);
|
|
3722
4329
|
setErrorDeCarga(null);
|
|
3723
4330
|
try {
|
|
3724
|
-
const clavePedido = `${tableName}|${claveFixedFields}`;
|
|
4331
|
+
const clavePedido = `${tableName}|${claveFixedFields}|${JSON.stringify([parametros.parameterFunctions ?? null, parametros.pick ?? null])}`;
|
|
3725
4332
|
let pedido = cargasEnCurso.get(clavePedido);
|
|
3726
4333
|
if (!pedido) {
|
|
3727
4334
|
const nuevo = (async () => {
|
|
@@ -3735,7 +4342,10 @@ var GenericDataGrid = ({
|
|
|
3735
4342
|
const data2 = requerido(
|
|
3736
4343
|
await callApi("table_data", {
|
|
3737
4344
|
table: tableName,
|
|
3738
|
-
fixedFields: validFixedFields ?? []
|
|
4345
|
+
fixedFields: validFixedFields ?? [],
|
|
4346
|
+
// como backend-plus (TableConnector.getData); solo si vienen, para no cambiarle el pedido a quien no los usa
|
|
4347
|
+
...parametros.parameterFunctions ? { paramfun: parametros.parameterFunctions } : {},
|
|
4348
|
+
...parametros.pick !== void 0 ? { pick: parametros.pick } : {}
|
|
3739
4349
|
}, { isCritical: true }),
|
|
3740
4350
|
`los datos de '${tableName}'`
|
|
3741
4351
|
);
|
|
@@ -3748,13 +4358,17 @@ var GenericDataGrid = ({
|
|
|
3748
4358
|
nuevo.then(sacar, sacar);
|
|
3749
4359
|
pedido = nuevo;
|
|
3750
4360
|
}
|
|
3751
|
-
const { definition, data } = await pedido;
|
|
4361
|
+
const { definition: definicionDelServidor, data } = await pedido;
|
|
3752
4362
|
if (!vigente) return;
|
|
3753
4363
|
claveCargadaRef.current = claveCarga;
|
|
4364
|
+
const definition = parametros.tableDef ? fusionar(definicionDelServidor, parametros.tableDef) : definicionDelServidor;
|
|
3754
4365
|
setTableDefinition(definition);
|
|
3755
4366
|
setSortColumns(getInitialSortColumns(definition));
|
|
3756
4367
|
setAnchosCalculados(calcularAnchosDeColumnas(definition, data));
|
|
3757
4368
|
setTableData(data);
|
|
4369
|
+
const filasDeFiltros = parametros.filterColumns ?? aFiltrosIniciales(definition.filterColumns);
|
|
4370
|
+
if (filasDeFiltros.length > 1) console.warn(`'${tableName}': varias filas de filtros (alternativas) todav\xEDa no est\xE1n soportadas; se aplica la primera`);
|
|
4371
|
+
if (filasDeFiltros.length > 0) aplicarFiltrosIniciales(filasDeFiltros[0], definition);
|
|
3758
4372
|
} catch (err) {
|
|
3759
4373
|
if (!vigente) return;
|
|
3760
4374
|
setTableDefinition(null);
|
|
@@ -3770,12 +4384,12 @@ var GenericDataGrid = ({
|
|
|
3770
4384
|
return () => {
|
|
3771
4385
|
vigente = false;
|
|
3772
4386
|
};
|
|
3773
|
-
}, [tableName, claveFixedFields, fixedFields, showError, callApi, getInitialSortColumns, setSortColumns, guardada]);
|
|
3774
|
-
|
|
4387
|
+
}, [tableName, claveFixedFields, fixedFields, claveParametros, parametros, showError, callApi, getInitialSortColumns, setSortColumns, aplicarFiltrosIniciales, guardada]);
|
|
4388
|
+
useEffect6(() => {
|
|
3775
4389
|
if (!claveCache || !tableDefinition || cargandoInicial) return;
|
|
3776
4390
|
cache.set(claveCache, { tableDefinition, tableData, anchosCalculados, sortColumns, detallesAbiertos, altosDetalle });
|
|
3777
4391
|
}, [cache, claveCache, tableDefinition, tableData, anchosCalculados, sortColumns, detallesAbiertos, altosDetalle, cargandoInicial]);
|
|
3778
|
-
|
|
4392
|
+
useEffect6(() => {
|
|
3779
4393
|
let timer = null;
|
|
3780
4394
|
const desuscribir = estadoGrilla.suscribir(() => {
|
|
3781
4395
|
const hayExitos = Array.from(estadoGrilla.obtenerFeedback().values()).some((f) => f.type === "success");
|
|
@@ -3800,11 +4414,11 @@ var GenericDataGrid = ({
|
|
|
3800
4414
|
if (timer) clearTimeout(timer);
|
|
3801
4415
|
};
|
|
3802
4416
|
}, [estadoGrilla]);
|
|
3803
|
-
const resetSortingDeLaTabla =
|
|
4417
|
+
const resetSortingDeLaTabla = useCallback12(() => {
|
|
3804
4418
|
if (tableDefinition) resetSorting(tableDefinition);
|
|
3805
4419
|
}, [tableDefinition, resetSorting]);
|
|
3806
|
-
const abrirImportacion =
|
|
3807
|
-
const abrirExportacion =
|
|
4420
|
+
const abrirImportacion = useCallback12(() => setOpenImportDialog(true), []);
|
|
4421
|
+
const abrirExportacion = useCallback12(() => setOpenExportDialog(true), []);
|
|
3808
4422
|
const { menuOptions } = useGridMenu({
|
|
3809
4423
|
tableDefinition,
|
|
3810
4424
|
tableName,
|
|
@@ -3815,11 +4429,11 @@ var GenericDataGrid = ({
|
|
|
3815
4429
|
triggerImport: abrirImportacion,
|
|
3816
4430
|
triggerExport: abrirExportacion
|
|
3817
4431
|
});
|
|
3818
|
-
const abrirOpcionesDeGrilla =
|
|
4432
|
+
const abrirOpcionesDeGrilla = useCallback12((anchorEl) => {
|
|
3819
4433
|
setDataGridOptionsAnchorEl(anchorEl);
|
|
3820
4434
|
setOpenDataGridOptions(true);
|
|
3821
4435
|
}, []);
|
|
3822
|
-
const editarEnFicha =
|
|
4436
|
+
const editarEnFicha = useCallback12((row) => {
|
|
3823
4437
|
rowAtEditStartRef.current = { ...row };
|
|
3824
4438
|
handleVerticalEditRow(row);
|
|
3825
4439
|
}, [handleVerticalEditRow]);
|
|
@@ -3837,7 +4451,7 @@ var GenericDataGrid = ({
|
|
|
3837
4451
|
toggleFilterVisibility,
|
|
3838
4452
|
abrirOpcionesDeGrilla
|
|
3839
4453
|
});
|
|
3840
|
-
const abrirDetalleEnPestana =
|
|
4454
|
+
const abrirDetalleEnPestana = useCallback12((row, detailTable) => {
|
|
3841
4455
|
if (!onOpenDetail || !tableDefinition || !detailTable.table) return;
|
|
3842
4456
|
const porCampo = /* @__PURE__ */ new Map();
|
|
3843
4457
|
[...fixedFields ?? [], ...calcularFixedFieldsDetalle(detailTable, row)].forEach((ff) => porCampo.set(ff.fieldName, ff));
|
|
@@ -3847,12 +4461,12 @@ var GenericDataGrid = ({
|
|
|
3847
4461
|
const newAncestors = [...ancestors, { tableName: tableDefinition.name, row, tableDefinition, fixedFields: allFixedFields }];
|
|
3848
4462
|
onOpenDetail(detailTable.table, allFixedFields, label, newAncestors);
|
|
3849
4463
|
}, [onOpenDetail, tableDefinition, fixedFields, ancestors]);
|
|
3850
|
-
const abrirWScreenEnPestana =
|
|
3851
|
-
const
|
|
3852
|
-
calcularFixedFieldsDetalle(detailTable, row).forEach((ff) =>
|
|
3853
|
-
window.open(`${window.location.origin}${rutaBase}/wScreens/${detailTable.wScreen}?${
|
|
4464
|
+
const abrirWScreenEnPestana = useCallback12((row, detailTable) => {
|
|
4465
|
+
const parametros2 = new URLSearchParams();
|
|
4466
|
+
calcularFixedFieldsDetalle(detailTable, row).forEach((ff) => parametros2.set(ff.fieldName, String(ff.value)));
|
|
4467
|
+
window.open(`${window.location.origin}${rutaBase}/wScreens/${detailTable.wScreen}?${parametros2}`, "_blank");
|
|
3854
4468
|
}, []);
|
|
3855
|
-
const alternarDetalle =
|
|
4469
|
+
const alternarDetalle = useCallback12((row, rowId, detailTable, enOtraPestana) => {
|
|
3856
4470
|
if (enOtraPestana && detailTable.wScreen) {
|
|
3857
4471
|
abrirWScreenEnPestana(row, detailTable);
|
|
3858
4472
|
return;
|
|
@@ -3864,8 +4478,8 @@ var GenericDataGrid = ({
|
|
|
3864
4478
|
const clave = claveDetalle(rowId, detailTable);
|
|
3865
4479
|
setDetallesAbiertos((anteriores) => anteriores.includes(clave) ? anteriores.filter((c) => c !== clave) : [...anteriores, clave]);
|
|
3866
4480
|
}, [onOpenDetail, abrirDetalleEnPestana, abrirWScreenEnPestana]);
|
|
3867
|
-
const [medidas, setMedidas] =
|
|
3868
|
-
|
|
4481
|
+
const [medidas, setMedidas] = useState16(null);
|
|
4482
|
+
useEffect6(() => {
|
|
3869
4483
|
const elemento = dataGridRef.current?.element;
|
|
3870
4484
|
if (!elemento) return;
|
|
3871
4485
|
const medir = () => setMedidas((anteriores) => {
|
|
@@ -3878,8 +4492,8 @@ var GenericDataGrid = ({
|
|
|
3878
4492
|
return () => observador.disconnect();
|
|
3879
4493
|
}, [tableDefinition, cargandoInicial]);
|
|
3880
4494
|
const anchoVisible = medidas?.ancho ?? null;
|
|
3881
|
-
const [altoDeVentana, setAltoDeVentana] =
|
|
3882
|
-
|
|
4495
|
+
const [altoDeVentana, setAltoDeVentana] = useState16(null);
|
|
4496
|
+
useEffect6(() => {
|
|
3883
4497
|
if (anidada) return;
|
|
3884
4498
|
const elemento = dataGridRef.current?.element;
|
|
3885
4499
|
if (!elemento) return;
|
|
@@ -3891,22 +4505,22 @@ var GenericDataGrid = ({
|
|
|
3891
4505
|
const altoDeContexto = useContext4(AltoDisponibleContext);
|
|
3892
4506
|
const altoDeEstaGrilla = anidada ? altoDisponible ?? (altoDeContexto === void 0 ? void 0 : altoDeContexto - ALTO_TITULO_ANIDADA) : altoDeVentana ?? void 0;
|
|
3893
4507
|
const altoMaximoDetalleEfectivo = altoMaximoDetalle ?? (altoDeEstaGrilla !== void 0 ? Math.max(ALTO_MINIMO_DETALLE, altoDeEstaGrilla - HEADER_ROW_HEIGHT - (conPie ? SUMMARY_ROW_HEIGHT : 0) - ROW_HEIGHT - (isFilterRowVisible ? FILTER_ROW_HEIGHT : 0)) : void 0);
|
|
3894
|
-
const cambiarAnchoDetalle =
|
|
4508
|
+
const cambiarAnchoDetalle = useCallback12((clave, ancho) => {
|
|
3895
4509
|
setAnchosDetalle((anteriores) => anteriores.get(clave) === ancho ? anteriores : new Map(anteriores).set(clave, ancho));
|
|
3896
4510
|
}, []);
|
|
3897
|
-
const cambiarAltoDetalle =
|
|
4511
|
+
const cambiarAltoDetalle = useCallback12((clave, altoDeseado2) => {
|
|
3898
4512
|
const alto = Math.min(Math.max(Math.round(altoDeseado2), ALTO_MINIMO_DETALLE), altoMaximoDetalleEfectivo ?? Infinity);
|
|
3899
4513
|
setAltosDetalle((anteriores) => anteriores.get(clave) === alto ? anteriores : new Map(anteriores).set(clave, alto));
|
|
3900
4514
|
}, [altoMaximoDetalleEfectivo]);
|
|
3901
|
-
const renderDetalle =
|
|
4515
|
+
const renderDetalle = useCallback12((fila) => {
|
|
3902
4516
|
const { detailTable } = fila;
|
|
3903
|
-
return /* @__PURE__ */
|
|
4517
|
+
return /* @__PURE__ */ jsx22(
|
|
3904
4518
|
"div",
|
|
3905
4519
|
{
|
|
3906
4520
|
className: "fpr-detalle",
|
|
3907
4521
|
style: { maxWidth: anchoVisible ? anchoVisible - 2 : void 0 },
|
|
3908
4522
|
onKeyDown: (e) => e.stopPropagation(),
|
|
3909
|
-
children: detailTable.table ? /* @__PURE__ */
|
|
4523
|
+
children: detailTable.table ? /* @__PURE__ */ jsx22(
|
|
3910
4524
|
GenericDataGrid,
|
|
3911
4525
|
{
|
|
3912
4526
|
tableName: detailTable.table,
|
|
@@ -3919,7 +4533,7 @@ var GenericDataGrid = ({
|
|
|
3919
4533
|
onOpenDetail,
|
|
3920
4534
|
ancestors: tableDefinition ? [...ancestors, { tableName: tableDefinition.name, row: fila.filaPadre, tableDefinition, fixedFields: fila.fixedFields }] : ancestors
|
|
3921
4535
|
}
|
|
3922
|
-
) : detailTable.wScreen ? /* @__PURE__ */
|
|
4536
|
+
) : detailTable.wScreen ? /* @__PURE__ */ jsx22(
|
|
3923
4537
|
DetalleWScreen,
|
|
3924
4538
|
{
|
|
3925
4539
|
fila,
|
|
@@ -3927,7 +4541,7 @@ var GenericDataGrid = ({
|
|
|
3927
4541
|
onAlto: (alto) => cambiarAltoDetalle(fila.clave, alto),
|
|
3928
4542
|
onAncho: (ancho) => cambiarAnchoDetalle(fila.clave, ancho)
|
|
3929
4543
|
}
|
|
3930
|
-
) : /* @__PURE__ */
|
|
4544
|
+
) : /* @__PURE__ */ jsxs17(Alert2, { severity: "warning", children: [
|
|
3931
4545
|
"El detalle '",
|
|
3932
4546
|
detailTable.abr,
|
|
3933
4547
|
"' no tiene ni tabla ni wScreen."
|
|
@@ -3935,18 +4549,18 @@ var GenericDataGrid = ({
|
|
|
3935
4549
|
}
|
|
3936
4550
|
);
|
|
3937
4551
|
}, [anchoVisible, claveCache, tableName, cambiarAltoDetalle, cambiarAnchoDetalle, altoMaximoDetalleEfectivo, onOpenDetail, tableDefinition, ancestors]);
|
|
3938
|
-
const detallesGrilla =
|
|
4552
|
+
const detallesGrilla = useMemo10(() => ({ abiertos, alternarDetalle, renderDetalle }), [abiertos, alternarDetalle, renderDetalle]);
|
|
3939
4553
|
const altoDeseado = cargandoInicial ? ALTO_INICIAL_DETALLE : gridHeight + ALTO_TITULO_ANIDADA + 8;
|
|
3940
|
-
|
|
4554
|
+
useEffect6(() => {
|
|
3941
4555
|
onAltoDeseado?.(altoDeseado);
|
|
3942
4556
|
}, [onAltoDeseado, altoDeseado]);
|
|
3943
|
-
const rowKeyGetter =
|
|
3944
|
-
const rowHeight =
|
|
3945
|
-
const rowClass =
|
|
4557
|
+
const rowKeyGetter = useCallback12((row) => esFilaDetalle(row) ? `detalle:${row.clave}` : getPrimaryKeyValues(row, primaryKey), [primaryKey]);
|
|
4558
|
+
const rowHeight = useCallback12((row) => esFilaDetalle(row) ? altoDeDetalle(row.clave) : ROW_HEIGHT, [altoDeDetalle]);
|
|
4559
|
+
const rowClass = useCallback12(
|
|
3946
4560
|
(row) => esFilaDetalle(row) ? "fpr-fila-detalle" : exitingRowIds.has(getPrimaryKeyValues(row, primaryKey)) ? "fpr-fila-saliendo" : void 0,
|
|
3947
4561
|
[exitingRowIds, primaryKey]
|
|
3948
4562
|
);
|
|
3949
|
-
const anchoContenido =
|
|
4563
|
+
const anchoContenido = useMemo10(() => {
|
|
3950
4564
|
if (!anidada || columns.length === 0) return void 0;
|
|
3951
4565
|
const sumaColumnas = columns.reduce((total, col) => {
|
|
3952
4566
|
const medido = columnWidths.get(col.key)?.width;
|
|
@@ -3956,12 +4570,12 @@ var GenericDataGrid = ({
|
|
|
3956
4570
|
const anchoDetalleMax = detallesAbiertos.reduce((max, clave) => Math.max(max, anchosDetalle.get(clave) ?? 0), 0);
|
|
3957
4571
|
return Math.max(ANCHO_MINIMO_ANIDADA, propio, anchoDetalleMax > 0 ? anchoDetalleMax + SANGRIA_DETALLE + (medidas?.barra ?? 0) + 2 : 0);
|
|
3958
4572
|
}, [anidada, columns, columnWidths, medidas?.barra, detallesAbiertos, anchosDetalle]);
|
|
3959
|
-
|
|
4573
|
+
useEffect6(() => {
|
|
3960
4574
|
if (anchoContenido !== void 0) onAnchoDeseado?.(anchoContenido);
|
|
3961
4575
|
}, [onAnchoDeseado, anchoContenido]);
|
|
3962
|
-
const estiloGrilla =
|
|
3963
|
-
const bottomSummaryRows =
|
|
3964
|
-
const vistaGrilla =
|
|
4576
|
+
const estiloGrilla = useMemo10(() => ({ height: "100%", width: "100%", boxSizing: "border-box", ...gridStyles }), [gridStyles]);
|
|
4577
|
+
const bottomSummaryRows = useMemo10(() => conPie ? [bottomSummaryRow] : [], [conPie, bottomSummaryRow]);
|
|
4578
|
+
const vistaGrilla = useMemo10(() => ({ isFilterRowVisible }), [isFilterRowVisible]);
|
|
3965
4579
|
const getFallBackMessage = () => {
|
|
3966
4580
|
if (tableData.length === 0) {
|
|
3967
4581
|
return "No hay filas para mostrar";
|
|
@@ -3973,19 +4587,19 @@ var GenericDataGrid = ({
|
|
|
3973
4587
|
};
|
|
3974
4588
|
const fallBackMessage = getFallBackMessage();
|
|
3975
4589
|
if (cargandoInicial) {
|
|
3976
|
-
return /* @__PURE__ */
|
|
3977
|
-
/* @__PURE__ */
|
|
3978
|
-
/* @__PURE__ */
|
|
4590
|
+
return /* @__PURE__ */ jsxs17(Box12, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: [
|
|
4591
|
+
/* @__PURE__ */ jsx22(CircularProgress4, {}),
|
|
4592
|
+
/* @__PURE__ */ jsx22(Typography10, { variant: "h6", sx: { ml: 2 }, children: "Cargando tabla..." })
|
|
3979
4593
|
] });
|
|
3980
4594
|
}
|
|
3981
4595
|
if (errorDeCarga) {
|
|
3982
|
-
return /* @__PURE__ */
|
|
4596
|
+
return /* @__PURE__ */ jsx22(Box12, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsx22(Alert2, { severity: "error", children: errorDeCarga }) });
|
|
3983
4597
|
}
|
|
3984
4598
|
if (!tableDefinition) {
|
|
3985
|
-
return /* @__PURE__ */
|
|
4599
|
+
return /* @__PURE__ */ jsx22(Box12, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsx22(Alert2, { severity: "warning", children: "No se pudo cargar la definici\xF3n de la tabla." }) });
|
|
3986
4600
|
}
|
|
3987
|
-
return /* @__PURE__ */
|
|
3988
|
-
!anidada && ancestors.length > 0 && /* @__PURE__ */
|
|
4601
|
+
return /* @__PURE__ */ jsx22(CacheGrillasContext.Provider, { value: cache, children: /* @__PURE__ */ jsxs17(Box12, { sx: { pt: anidada ? 0 : 2, display: "flex", flexDirection: "column", height: "100%", boxSizing: "border-box", width: anchoContenido ?? void 0, maxWidth: "100%" }, children: [
|
|
4602
|
+
!anidada && ancestors.length > 0 && /* @__PURE__ */ jsx22(Box12, { sx: { px: 2, pt: 0, pb: 1, display: "flex", flexDirection: "column" }, children: ancestors.map((ancestor, index) => /* @__PURE__ */ jsx22(
|
|
3989
4603
|
StaticAncestorGrid,
|
|
3990
4604
|
{
|
|
3991
4605
|
ancestor,
|
|
@@ -3994,7 +4608,7 @@ var GenericDataGrid = ({
|
|
|
3994
4608
|
},
|
|
3995
4609
|
index
|
|
3996
4610
|
)) }),
|
|
3997
|
-
/* @__PURE__ */
|
|
4611
|
+
/* @__PURE__ */ jsxs17(
|
|
3998
4612
|
Box12,
|
|
3999
4613
|
{
|
|
4000
4614
|
sx: {
|
|
@@ -4017,16 +4631,16 @@ var GenericDataGrid = ({
|
|
|
4017
4631
|
gap: 1
|
|
4018
4632
|
},
|
|
4019
4633
|
children: [
|
|
4020
|
-
/* @__PURE__ */
|
|
4634
|
+
/* @__PURE__ */ jsxs17(Typography10, { variant: "subtitle2", component: "div", children: [
|
|
4021
4635
|
titulo ?? cambiarGuionesBajosPorEspacios(tableDefinition.title || tableDefinition.name),
|
|
4022
4636
|
" - ",
|
|
4023
4637
|
filteredRows.length === tableData.length ? `${tableData.length} registros` : `${filteredRows.length} (F)`
|
|
4024
4638
|
] }),
|
|
4025
|
-
loading && /* @__PURE__ */
|
|
4639
|
+
loading && /* @__PURE__ */ jsx22(CircularProgress4, { size: 14, color: "inherit" })
|
|
4026
4640
|
]
|
|
4027
4641
|
}
|
|
4028
4642
|
),
|
|
4029
|
-
/* @__PURE__ */
|
|
4643
|
+
/* @__PURE__ */ jsxs17(
|
|
4030
4644
|
Box12,
|
|
4031
4645
|
{
|
|
4032
4646
|
sx: {
|
|
@@ -4045,7 +4659,7 @@ var GenericDataGrid = ({
|
|
|
4045
4659
|
pb: anidada ? 0 : 3
|
|
4046
4660
|
},
|
|
4047
4661
|
children: [
|
|
4048
|
-
/* @__PURE__ */
|
|
4662
|
+
/* @__PURE__ */ jsx22(EstadoGrillaContext.Provider, { value: estadoGrilla, children: /* @__PURE__ */ jsx22(VistaGrillaContext.Provider, { value: vistaGrilla, children: /* @__PURE__ */ jsx22(DetallesGrillaContext.Provider, { value: detallesGrilla, children: /* @__PURE__ */ jsx22(
|
|
4049
4663
|
DataGrid,
|
|
4050
4664
|
{
|
|
4051
4665
|
className: "rdg-light",
|
|
@@ -4075,7 +4689,7 @@ var GenericDataGrid = ({
|
|
|
4075
4689
|
onCellKeyDown: handleCellKeyDown
|
|
4076
4690
|
}
|
|
4077
4691
|
) }) }) }),
|
|
4078
|
-
fallBackMessage && /* @__PURE__ */
|
|
4692
|
+
fallBackMessage && /* @__PURE__ */ jsx22(
|
|
4079
4693
|
Box12,
|
|
4080
4694
|
{
|
|
4081
4695
|
sx: {
|
|
@@ -4092,13 +4706,13 @@ var GenericDataGrid = ({
|
|
|
4092
4706
|
zIndex: tableData.length === 0 ? 10 : 1
|
|
4093
4707
|
// Mantenemos el zIndex superior para el estado vacío total
|
|
4094
4708
|
},
|
|
4095
|
-
children: /* @__PURE__ */
|
|
4709
|
+
children: /* @__PURE__ */ jsx22(Typography10, { variant: "body2", color: "textSecondary", children: fallBackMessage })
|
|
4096
4710
|
}
|
|
4097
4711
|
)
|
|
4098
4712
|
]
|
|
4099
4713
|
}
|
|
4100
4714
|
),
|
|
4101
|
-
/* @__PURE__ */
|
|
4715
|
+
/* @__PURE__ */ jsx22(
|
|
4102
4716
|
ExportDialog,
|
|
4103
4717
|
{
|
|
4104
4718
|
open: openExportDialog,
|
|
@@ -4109,7 +4723,7 @@ var GenericDataGrid = ({
|
|
|
4109
4723
|
username: usuario || "anonymous"
|
|
4110
4724
|
}
|
|
4111
4725
|
),
|
|
4112
|
-
/* @__PURE__ */
|
|
4726
|
+
/* @__PURE__ */ jsx22(
|
|
4113
4727
|
ConfirmDialog,
|
|
4114
4728
|
{
|
|
4115
4729
|
open: openConfirmDialog,
|
|
@@ -4118,7 +4732,7 @@ var GenericDataGrid = ({
|
|
|
4118
4732
|
message: rowToDelete && rowToDelete[NEW_ROW_INDICATOR] ? `\xBFEst\xE1s seguro de que quieres eliminar esta nueva fila (ID: ${getPrimaryKeyValues(rowToDelete, primaryKey)}) localmente?` : rowToDelete ? `\xBFEst\xE1s seguro de que quieres eliminar la fila con ID: ${getPrimaryKeyValues(rowToDelete, primaryKey)} de la base de datos? Esta acci\xF3n es irreversible.` : "\xBFEst\xE1s seguro de que quieres eliminar este registro? Esta acci\xF3n es irreversible."
|
|
4119
4733
|
}
|
|
4120
4734
|
),
|
|
4121
|
-
/* @__PURE__ */
|
|
4735
|
+
/* @__PURE__ */ jsx22(
|
|
4122
4736
|
DataGridOptionsDialog,
|
|
4123
4737
|
{
|
|
4124
4738
|
open: openDataGridOptions,
|
|
@@ -4127,7 +4741,7 @@ var GenericDataGrid = ({
|
|
|
4127
4741
|
anchorEl: dataGridOptionsAnchorEl
|
|
4128
4742
|
}
|
|
4129
4743
|
),
|
|
4130
|
-
/* @__PURE__ */
|
|
4744
|
+
/* @__PURE__ */ jsx22(
|
|
4131
4745
|
ImportDialog,
|
|
4132
4746
|
{
|
|
4133
4747
|
open: openImportDialog,
|
|
@@ -4136,14 +4750,14 @@ var GenericDataGrid = ({
|
|
|
4136
4750
|
loading
|
|
4137
4751
|
}
|
|
4138
4752
|
),
|
|
4139
|
-
/* @__PURE__ */
|
|
4753
|
+
/* @__PURE__ */ jsx22(
|
|
4140
4754
|
Dialog4,
|
|
4141
4755
|
{
|
|
4142
4756
|
open: openVerticalEditDialog,
|
|
4143
4757
|
onClose: () => setOpenVerticalEditDialog(false),
|
|
4144
4758
|
maxWidth: "sm",
|
|
4145
4759
|
fullWidth: true,
|
|
4146
|
-
children: rowToEditVertical && /* @__PURE__ */
|
|
4760
|
+
children: rowToEditVertical && /* @__PURE__ */ jsx22(
|
|
4147
4761
|
VerticalEditorPage,
|
|
4148
4762
|
{
|
|
4149
4763
|
tableName,
|
|
@@ -4187,36 +4801,37 @@ var GenericDataGrid = ({
|
|
|
4187
4801
|
}
|
|
4188
4802
|
)
|
|
4189
4803
|
}
|
|
4190
|
-
)
|
|
4804
|
+
),
|
|
4805
|
+
contenidoDeCelda && /* @__PURE__ */ jsx22(VentanaDeTexto, { anclaje: contenidoDeCelda.anclaje, texto: contenidoDeCelda.texto, editable: false, onAceptar: cerrarContenidoDeCelda, onCerrar: cerrarContenidoDeCelda })
|
|
4191
4806
|
] }) });
|
|
4192
4807
|
};
|
|
4193
4808
|
var GenericDataGrid_default = GenericDataGrid;
|
|
4194
4809
|
|
|
4195
4810
|
// src/App.tsx
|
|
4196
|
-
import
|
|
4197
|
-
import { BrowserRouter, Routes, Route, useLocation as
|
|
4811
|
+
import React33, { useEffect as useEffect18, useMemo as useMemo16 } from "react";
|
|
4812
|
+
import { BrowserRouter, Routes, Route, useLocation as useLocation8, Navigate as Navigate4, Outlet as Outlet2 } from "react-router-dom";
|
|
4198
4813
|
|
|
4199
4814
|
// src/components/MainLayout.tsx
|
|
4200
|
-
import { useEffect as
|
|
4815
|
+
import { useEffect as useEffect9 } from "react";
|
|
4201
4816
|
import { Outlet } from "react-router-dom";
|
|
4202
4817
|
import {
|
|
4203
4818
|
Box as Box14,
|
|
4204
4819
|
AppBar,
|
|
4205
4820
|
Toolbar,
|
|
4206
|
-
Typography as
|
|
4207
|
-
Button as
|
|
4821
|
+
Typography as Typography12,
|
|
4822
|
+
Button as Button8,
|
|
4208
4823
|
Drawer,
|
|
4209
4824
|
CssBaseline,
|
|
4210
|
-
IconButton as
|
|
4825
|
+
IconButton as IconButton6,
|
|
4211
4826
|
useTheme as useTheme5,
|
|
4212
4827
|
useMediaQuery
|
|
4213
4828
|
} from "@mui/material";
|
|
4214
4829
|
|
|
4215
4830
|
// src/contexts/AppContext.tsx
|
|
4216
|
-
import { createContext as createContext4, useContext as useContext5, useState as
|
|
4831
|
+
import { createContext as createContext4, useContext as useContext5, useState as useState17, useEffect as useEffect7, useCallback as useCallback13, useMemo as useMemo11, useRef as useRef8 } from "react";
|
|
4217
4832
|
import { useLocation, useNavigate } from "react-router-dom";
|
|
4218
4833
|
import { useSelector as useSelector2, useDispatch as useDispatch2 } from "react-redux";
|
|
4219
|
-
import { jsx as
|
|
4834
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
4220
4835
|
var AuthContext = createContext4(void 0);
|
|
4221
4836
|
var useApp = () => {
|
|
4222
4837
|
const context = useContext5(AuthContext);
|
|
@@ -4228,15 +4843,15 @@ var useApp = () => {
|
|
|
4228
4843
|
};
|
|
4229
4844
|
var AppProvider = ({ children, publicPaths = [] }) => {
|
|
4230
4845
|
console.log("AppProvider rendered/re-rendered");
|
|
4231
|
-
const [isLoggedIn, setIsLoggedIn] =
|
|
4232
|
-
const [showSessionExpiredMessage, setShowSessionExpiredMessage] =
|
|
4233
|
-
const isRedirectingRef =
|
|
4234
|
-
const huboSesionRef =
|
|
4846
|
+
const [isLoggedIn, setIsLoggedIn] = useState17(false);
|
|
4847
|
+
const [showSessionExpiredMessage, setShowSessionExpiredMessage] = useState17(false);
|
|
4848
|
+
const isRedirectingRef = useRef8(false);
|
|
4849
|
+
const huboSesionRef = useRef8(false);
|
|
4235
4850
|
const dispatch = useDispatch2();
|
|
4236
4851
|
const clientContext = useSelector2((state) => state.clientContext);
|
|
4237
4852
|
if (clientContext.status === "succeeded") huboSesionRef.current = true;
|
|
4238
4853
|
const navigate = useNavigate();
|
|
4239
|
-
const handleExpiredSessionRedirect =
|
|
4854
|
+
const handleExpiredSessionRedirect = useCallback13(() => {
|
|
4240
4855
|
isRedirectingRef.current = true;
|
|
4241
4856
|
setShowSessionExpiredMessage(false);
|
|
4242
4857
|
setIsLoggedIn(false);
|
|
@@ -4246,11 +4861,11 @@ var AppProvider = ({ children, publicPaths = [] }) => {
|
|
|
4246
4861
|
}, 2e3);
|
|
4247
4862
|
}, [navigate]);
|
|
4248
4863
|
const location = useLocation();
|
|
4249
|
-
const isCurrentPathPublic =
|
|
4864
|
+
const isCurrentPathPublic = useCallback13(() => {
|
|
4250
4865
|
const current = location.pathname;
|
|
4251
4866
|
return publicPaths.some((path) => current === path || current.startsWith(`${path}/`));
|
|
4252
4867
|
}, [location.pathname, publicPaths]);
|
|
4253
|
-
const checkSession =
|
|
4868
|
+
const checkSession = useCallback13(async () => {
|
|
4254
4869
|
if (isRedirectingRef.current) return;
|
|
4255
4870
|
try {
|
|
4256
4871
|
const response = await fetchApi("/keep-alive.json", { method: "GET" });
|
|
@@ -4288,14 +4903,14 @@ var AppProvider = ({ children, publicPaths = [] }) => {
|
|
|
4288
4903
|
}
|
|
4289
4904
|
}
|
|
4290
4905
|
}, [dispatch, clientContext.status, showSessionExpiredMessage, isCurrentPathPublic]);
|
|
4291
|
-
|
|
4906
|
+
useEffect7(() => {
|
|
4292
4907
|
checkSession();
|
|
4293
4908
|
const intervalId = setInterval(checkSession, 15 * 1e3);
|
|
4294
4909
|
return () => {
|
|
4295
4910
|
clearInterval(intervalId);
|
|
4296
4911
|
};
|
|
4297
4912
|
}, [checkSession]);
|
|
4298
|
-
const authContextValue =
|
|
4913
|
+
const authContextValue = useMemo11(() => ({
|
|
4299
4914
|
isLoggedIn,
|
|
4300
4915
|
setIsLoggedIn,
|
|
4301
4916
|
checkSession,
|
|
@@ -4310,7 +4925,7 @@ var AppProvider = ({ children, publicPaths = [] }) => {
|
|
|
4310
4925
|
setShowSessionExpiredMessage,
|
|
4311
4926
|
handleExpiredSessionRedirect
|
|
4312
4927
|
]);
|
|
4313
|
-
return /* @__PURE__ */
|
|
4928
|
+
return /* @__PURE__ */ jsx23(AuthContext.Provider, { value: authContextValue, children });
|
|
4314
4929
|
};
|
|
4315
4930
|
|
|
4316
4931
|
// src/components/MainLayout.tsx
|
|
@@ -4319,8 +4934,8 @@ import MenuIcon from "@mui/icons-material/Menu";
|
|
|
4319
4934
|
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
4320
4935
|
|
|
4321
4936
|
// src/components/SideMenu.tsx
|
|
4322
|
-
import
|
|
4323
|
-
import { List as
|
|
4937
|
+
import React19, { useEffect as useEffect8 } from "react";
|
|
4938
|
+
import { List as List3, ListItem, ListItemButton as ListItemButton3, ListItemIcon as ListItemIcon2, ListItemText as ListItemText2, Divider as Divider2, Box as Box13, Typography as Typography11, Collapse } from "@mui/material";
|
|
4324
4939
|
import ExpandLess from "@mui/icons-material/ExpandLess";
|
|
4325
4940
|
import ExpandMore from "@mui/icons-material/ExpandMore";
|
|
4326
4941
|
import TableChartIcon from "@mui/icons-material/TableChart";
|
|
@@ -4353,7 +4968,7 @@ function itemInicial(menu) {
|
|
|
4353
4968
|
}
|
|
4354
4969
|
|
|
4355
4970
|
// src/components/SideMenu.tsx
|
|
4356
|
-
import { jsx as
|
|
4971
|
+
import { jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4357
4972
|
var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
4358
4973
|
const navigate = useNavigate2();
|
|
4359
4974
|
const location = useLocation2();
|
|
@@ -4372,17 +4987,17 @@ var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
|
4372
4987
|
const getIcon = (item2) => {
|
|
4373
4988
|
switch (item2.menuType) {
|
|
4374
4989
|
case "table":
|
|
4375
|
-
return /* @__PURE__ */
|
|
4990
|
+
return /* @__PURE__ */ jsx24(TableChartIcon, { sx: { color: blue[700] } });
|
|
4376
4991
|
case "proc":
|
|
4377
|
-
return /* @__PURE__ */
|
|
4992
|
+
return /* @__PURE__ */ jsx24(DnsIcon, { sx: { color: teal[700] } });
|
|
4378
4993
|
case "menu":
|
|
4379
|
-
return /* @__PURE__ */
|
|
4994
|
+
return /* @__PURE__ */ jsx24(FolderIcon, { sx: { color: orange[800] } });
|
|
4380
4995
|
default:
|
|
4381
4996
|
const WScreenComponent = wScreens[item2.menuType];
|
|
4382
4997
|
if (WScreenComponent !== void 0) {
|
|
4383
|
-
return /* @__PURE__ */
|
|
4998
|
+
return /* @__PURE__ */ jsx24(DesktopWindowsIcon, { sx: { color: grey[700] } });
|
|
4384
4999
|
}
|
|
4385
|
-
return /* @__PURE__ */
|
|
5000
|
+
return /* @__PURE__ */ jsx24(WarningAmberIcon3, { sx: { color: red[500] } });
|
|
4386
5001
|
}
|
|
4387
5002
|
};
|
|
4388
5003
|
const currentPath = location.pathname;
|
|
@@ -4396,27 +5011,27 @@ var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
|
4396
5011
|
} else if (item.menuType !== "menu") {
|
|
4397
5012
|
isSelected = currentPath.startsWith(`/wScreens/${item.menuType}`) || currentPath.startsWith(`/wScreens-fallback/${item.menuType}`);
|
|
4398
5013
|
}
|
|
4399
|
-
const itemRef =
|
|
4400
|
-
|
|
5014
|
+
const itemRef = React19.useRef(null);
|
|
5015
|
+
useEffect8(() => {
|
|
4401
5016
|
if (isSelected && itemRef.current) {
|
|
4402
5017
|
itemRef.current.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
4403
5018
|
}
|
|
4404
5019
|
}, [isSelected]);
|
|
4405
|
-
return /* @__PURE__ */
|
|
4406
|
-
/* @__PURE__ */
|
|
4407
|
-
|
|
5020
|
+
return /* @__PURE__ */ jsxs18("div", { ref: itemRef, children: [
|
|
5021
|
+
/* @__PURE__ */ jsxs18(
|
|
5022
|
+
ListItemButton3,
|
|
4408
5023
|
{
|
|
4409
5024
|
onClick: handleClick,
|
|
4410
5025
|
sx: { pl: level * 2 },
|
|
4411
5026
|
selected: isSelected,
|
|
4412
5027
|
children: [
|
|
4413
|
-
/* @__PURE__ */
|
|
4414
|
-
/* @__PURE__ */
|
|
4415
|
-
item.menuType === "menu" ? open ? /* @__PURE__ */
|
|
5028
|
+
/* @__PURE__ */ jsx24(ListItemIcon2, { sx: { minWidth: "38px" }, children: getIcon(item) }),
|
|
5029
|
+
/* @__PURE__ */ jsx24(ListItemText2, { primary: item.label || item.name }),
|
|
5030
|
+
item.menuType === "menu" ? open ? /* @__PURE__ */ jsx24(ExpandLess, {}) : /* @__PURE__ */ jsx24(ExpandMore, {}) : null
|
|
4416
5031
|
]
|
|
4417
5032
|
}
|
|
4418
5033
|
),
|
|
4419
|
-
item.menuType === "menu" && /* @__PURE__ */
|
|
5034
|
+
item.menuType === "menu" && /* @__PURE__ */ jsx24(Collapse, { in: open, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ jsx24(List3, { component: "div", disablePadding: true, children: item.menuContent.map((subItem) => /* @__PURE__ */ jsx24(
|
|
4420
5035
|
MenuListItem,
|
|
4421
5036
|
{
|
|
4422
5037
|
item: subItem,
|
|
@@ -4440,9 +5055,9 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
4440
5055
|
dispatch(setAllSubMenusOpen(!isMostlyOpen));
|
|
4441
5056
|
};
|
|
4442
5057
|
if (!clientContext || !clientContext.menu) {
|
|
4443
|
-
return /* @__PURE__ */
|
|
5058
|
+
return /* @__PURE__ */ jsx24(Box13, { sx: { p: 2, textAlign: "center" }, children: /* @__PURE__ */ jsx24(Typography11, { variant: "body2", color: "text.secondary", children: "Cargando men\xFA..." }) });
|
|
4444
5059
|
}
|
|
4445
|
-
|
|
5060
|
+
useEffect8(() => {
|
|
4446
5061
|
if (!clientContext?.menu) return;
|
|
4447
5062
|
const expandParents = (items, targetPath, parentNames = []) => {
|
|
4448
5063
|
const pathParts = targetPath.split("/");
|
|
@@ -4471,13 +5086,13 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
4471
5086
|
};
|
|
4472
5087
|
expandParents(clientContext.menu, location.pathname);
|
|
4473
5088
|
}, [location.pathname, clientContext, dispatch]);
|
|
4474
|
-
return /* @__PURE__ */
|
|
4475
|
-
clientContext.menu.some((item) => item.menuType === "menu") && /* @__PURE__ */
|
|
4476
|
-
/* @__PURE__ */
|
|
4477
|
-
/* @__PURE__ */
|
|
5089
|
+
return /* @__PURE__ */ jsxs18(Box13, { sx: { width: "100%", flexShrink: 0 }, children: [
|
|
5090
|
+
clientContext.menu.some((item) => item.menuType === "menu") && /* @__PURE__ */ jsx24(ListItem, { disablePadding: true, children: /* @__PURE__ */ jsxs18(ListItemButton3, { onClick: handleToggleAllSubMenus, children: [
|
|
5091
|
+
/* @__PURE__ */ jsx24(ListItemIcon2, { sx: { minWidth: "38px" }, children: isMostlyOpen ? /* @__PURE__ */ jsx24(UnfoldLessIcon, {}) : /* @__PURE__ */ jsx24(UnfoldMoreIcon, {}) }),
|
|
5092
|
+
/* @__PURE__ */ jsx24(ListItemText2, { primary: isMostlyOpen ? "colapsar " : "expandir" })
|
|
4478
5093
|
] }) }),
|
|
4479
|
-
/* @__PURE__ */
|
|
4480
|
-
/* @__PURE__ */
|
|
5094
|
+
/* @__PURE__ */ jsx24(Divider2, {}),
|
|
5095
|
+
/* @__PURE__ */ jsx24(List3, { children: clientContext.menu.map((menuItem) => /* @__PURE__ */ jsx24(
|
|
4481
5096
|
MenuListItem,
|
|
4482
5097
|
{
|
|
4483
5098
|
item: menuItem,
|
|
@@ -4491,14 +5106,14 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
4491
5106
|
var SideMenu_default = SideMenu;
|
|
4492
5107
|
|
|
4493
5108
|
// src/hooks/useLogout.tsx
|
|
4494
|
-
import { useCallback as
|
|
5109
|
+
import { useCallback as useCallback14 } from "react";
|
|
4495
5110
|
import { useNavigate as useNavigate3 } from "react-router-dom";
|
|
4496
5111
|
import { useDispatch as useDispatch3 } from "react-redux";
|
|
4497
5112
|
var useLogout = () => {
|
|
4498
5113
|
const { setIsLoggedIn } = useApp();
|
|
4499
5114
|
const dispatch = useDispatch3();
|
|
4500
5115
|
const navigate = useNavigate3();
|
|
4501
|
-
const logout =
|
|
5116
|
+
const logout = useCallback14(async () => {
|
|
4502
5117
|
try {
|
|
4503
5118
|
const response = await fetchApi("/logout", { method: "GET" });
|
|
4504
5119
|
if (response.status === 401 || response.ok) {
|
|
@@ -4519,7 +5134,7 @@ var useLogout = () => {
|
|
|
4519
5134
|
var useLogout_default = useLogout;
|
|
4520
5135
|
|
|
4521
5136
|
// src/components/MainLayout.tsx
|
|
4522
|
-
import { jsx as
|
|
5137
|
+
import { jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4523
5138
|
var drawerWidth = 240;
|
|
4524
5139
|
var MainLayout = () => {
|
|
4525
5140
|
const { clientContext } = useApp();
|
|
@@ -4528,7 +5143,7 @@ var MainLayout = () => {
|
|
|
4528
5143
|
const dispatch = useAppDispatch();
|
|
4529
5144
|
const theme = useTheme5();
|
|
4530
5145
|
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
|
4531
|
-
|
|
5146
|
+
useEffect9(() => {
|
|
4532
5147
|
if (isMobile && isDrawerOpen) {
|
|
4533
5148
|
dispatch(setDrawerOpen(false));
|
|
4534
5149
|
}
|
|
@@ -4542,11 +5157,11 @@ var MainLayout = () => {
|
|
|
4542
5157
|
}
|
|
4543
5158
|
};
|
|
4544
5159
|
if (!clientContext) {
|
|
4545
|
-
return /* @__PURE__ */
|
|
5160
|
+
return /* @__PURE__ */ jsx25(Box14, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ jsx25(Typography12, { children: "Cargando dise\xF1o de la aplicaci\xF3n..." }) });
|
|
4546
5161
|
}
|
|
4547
|
-
return /* @__PURE__ */
|
|
4548
|
-
/* @__PURE__ */
|
|
4549
|
-
/* @__PURE__ */
|
|
5162
|
+
return /* @__PURE__ */ jsxs19(Box14, { sx: { display: "flex", height: "100vh" }, children: [
|
|
5163
|
+
/* @__PURE__ */ jsx25(CssBaseline, {}),
|
|
5164
|
+
/* @__PURE__ */ jsx25(
|
|
4550
5165
|
AppBar,
|
|
4551
5166
|
{
|
|
4552
5167
|
position: "fixed",
|
|
@@ -4565,9 +5180,9 @@ var MainLayout = () => {
|
|
|
4565
5180
|
})
|
|
4566
5181
|
}
|
|
4567
5182
|
},
|
|
4568
|
-
children: /* @__PURE__ */
|
|
4569
|
-
/* @__PURE__ */
|
|
4570
|
-
|
|
5183
|
+
children: /* @__PURE__ */ jsxs19(Toolbar, { children: [
|
|
5184
|
+
/* @__PURE__ */ jsx25(
|
|
5185
|
+
IconButton6,
|
|
4571
5186
|
{
|
|
4572
5187
|
color: "inherit",
|
|
4573
5188
|
"aria-label": "open drawer",
|
|
@@ -4576,10 +5191,10 @@ var MainLayout = () => {
|
|
|
4576
5191
|
sx: {
|
|
4577
5192
|
marginRight: 2
|
|
4578
5193
|
},
|
|
4579
|
-
children: isDrawerOpen ? /* @__PURE__ */
|
|
5194
|
+
children: isDrawerOpen ? /* @__PURE__ */ jsx25(ChevronLeftIcon, {}) : /* @__PURE__ */ jsx25(MenuIcon, {})
|
|
4580
5195
|
}
|
|
4581
5196
|
),
|
|
4582
|
-
!isDrawerOpen && /* @__PURE__ */
|
|
5197
|
+
!isDrawerOpen && /* @__PURE__ */ jsx25(
|
|
4583
5198
|
"img",
|
|
4584
5199
|
{
|
|
4585
5200
|
src: `${envConfig.backendUrl}/img/logo-128.png`,
|
|
@@ -4587,21 +5202,21 @@ var MainLayout = () => {
|
|
|
4587
5202
|
style: { height: "32px", marginRight: "12px", objectFit: "contain" }
|
|
4588
5203
|
}
|
|
4589
5204
|
),
|
|
4590
|
-
/* @__PURE__ */
|
|
4591
|
-
/* @__PURE__ */
|
|
4592
|
-
/* @__PURE__ */
|
|
4593
|
-
|
|
5205
|
+
/* @__PURE__ */ jsx25(Typography12, { variant: "h6", noWrap: true, component: "div", sx: { flexGrow: 1 }, children: isDrawerOpen ? "" : clientContext.config.title }),
|
|
5206
|
+
/* @__PURE__ */ jsx25(Typography12, { variant: "subtitle1", component: "div", sx: { mr: 2 }, children: clientContext.username }),
|
|
5207
|
+
/* @__PURE__ */ jsx25(
|
|
5208
|
+
Button8,
|
|
4594
5209
|
{
|
|
4595
5210
|
color: "inherit",
|
|
4596
5211
|
onClick: logout,
|
|
4597
|
-
startIcon: /* @__PURE__ */
|
|
5212
|
+
startIcon: /* @__PURE__ */ jsx25(LogoutIcon, {}),
|
|
4598
5213
|
children: "Salir"
|
|
4599
5214
|
}
|
|
4600
5215
|
)
|
|
4601
5216
|
] })
|
|
4602
5217
|
}
|
|
4603
5218
|
),
|
|
4604
|
-
/* @__PURE__ */
|
|
5219
|
+
/* @__PURE__ */ jsxs19(
|
|
4605
5220
|
Drawer,
|
|
4606
5221
|
{
|
|
4607
5222
|
variant: "persistent",
|
|
@@ -4618,7 +5233,7 @@ var MainLayout = () => {
|
|
|
4618
5233
|
}
|
|
4619
5234
|
},
|
|
4620
5235
|
children: [
|
|
4621
|
-
/* @__PURE__ */
|
|
5236
|
+
/* @__PURE__ */ jsxs19(
|
|
4622
5237
|
Toolbar,
|
|
4623
5238
|
{
|
|
4624
5239
|
sx: {
|
|
@@ -4631,7 +5246,7 @@ var MainLayout = () => {
|
|
|
4631
5246
|
gap: 1.5
|
|
4632
5247
|
},
|
|
4633
5248
|
children: [
|
|
4634
|
-
/* @__PURE__ */
|
|
5249
|
+
/* @__PURE__ */ jsx25(
|
|
4635
5250
|
"img",
|
|
4636
5251
|
{
|
|
4637
5252
|
src: `${envConfig.backendUrl}/img/logo-128.png`,
|
|
@@ -4639,15 +5254,15 @@ var MainLayout = () => {
|
|
|
4639
5254
|
style: { height: "32px", objectFit: "contain" }
|
|
4640
5255
|
}
|
|
4641
5256
|
),
|
|
4642
|
-
/* @__PURE__ */
|
|
5257
|
+
/* @__PURE__ */ jsx25(Typography12, { variant: "h6", sx: { fontWeight: "bold" }, children: clientContext.config.title })
|
|
4643
5258
|
]
|
|
4644
5259
|
}
|
|
4645
5260
|
),
|
|
4646
|
-
/* @__PURE__ */
|
|
5261
|
+
/* @__PURE__ */ jsx25(SideMenu_default, { onMenuItemClick: handleDrawerCloseMobile })
|
|
4647
5262
|
]
|
|
4648
5263
|
}
|
|
4649
5264
|
),
|
|
4650
|
-
/* @__PURE__ */
|
|
5265
|
+
/* @__PURE__ */ jsxs19(
|
|
4651
5266
|
Box14,
|
|
4652
5267
|
{
|
|
4653
5268
|
component: "main",
|
|
@@ -4674,8 +5289,8 @@ var MainLayout = () => {
|
|
|
4674
5289
|
width: isDrawerOpen ? `calc(100% - ${drawerWidth}px)` : "100%"
|
|
4675
5290
|
},
|
|
4676
5291
|
children: [
|
|
4677
|
-
/* @__PURE__ */
|
|
4678
|
-
/* @__PURE__ */
|
|
5292
|
+
/* @__PURE__ */ jsx25(Toolbar, {}),
|
|
5293
|
+
/* @__PURE__ */ jsx25(Box14, { sx: { flex: 1, minHeight: 0, overflowY: "auto", display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ jsx25(Outlet, {}) })
|
|
4679
5294
|
]
|
|
4680
5295
|
}
|
|
4681
5296
|
)
|
|
@@ -4684,8 +5299,8 @@ var MainLayout = () => {
|
|
|
4684
5299
|
var MainLayout_default = MainLayout;
|
|
4685
5300
|
|
|
4686
5301
|
// src/components/SessionExpiredMessage.tsx
|
|
4687
|
-
import { Box as Box15, Typography as
|
|
4688
|
-
import { jsx as
|
|
5302
|
+
import { Box as Box15, Typography as Typography13, Button as Button9, Modal } from "@mui/material";
|
|
5303
|
+
import { jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4689
5304
|
var style = {
|
|
4690
5305
|
position: "absolute",
|
|
4691
5306
|
top: "50%",
|
|
@@ -4704,7 +5319,7 @@ var SessionExpiredMessage = () => {
|
|
|
4704
5319
|
const handleClose = () => {
|
|
4705
5320
|
handleExpiredSessionRedirect();
|
|
4706
5321
|
};
|
|
4707
|
-
return /* @__PURE__ */
|
|
5322
|
+
return /* @__PURE__ */ jsx26(
|
|
4708
5323
|
Modal,
|
|
4709
5324
|
{
|
|
4710
5325
|
open: showSessionExpiredMessage,
|
|
@@ -4724,10 +5339,10 @@ var SessionExpiredMessage = () => {
|
|
|
4724
5339
|
}
|
|
4725
5340
|
}
|
|
4726
5341
|
},
|
|
4727
|
-
children: /* @__PURE__ */
|
|
4728
|
-
/* @__PURE__ */
|
|
4729
|
-
/* @__PURE__ */
|
|
4730
|
-
/* @__PURE__ */
|
|
5342
|
+
children: /* @__PURE__ */ jsxs20(Box15, { sx: style, children: [
|
|
5343
|
+
/* @__PURE__ */ jsx26(Typography13, { id: "session-expired-modal-title", variant: "h6", component: "h2", gutterBottom: true, children: "\xA1Sesi\xF3n Expirada!" }),
|
|
5344
|
+
/* @__PURE__ */ jsx26(Typography13, { 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." }),
|
|
5345
|
+
/* @__PURE__ */ jsx26(Button9, { variant: "contained", color: "primary", onClick: handleClose, children: "Ir al Login" })
|
|
4731
5346
|
] })
|
|
4732
5347
|
}
|
|
4733
5348
|
);
|
|
@@ -4736,24 +5351,24 @@ var SessionExpiredMessage_default = SessionExpiredMessage;
|
|
|
4736
5351
|
|
|
4737
5352
|
// src/pages/PantallaInicial.tsx
|
|
4738
5353
|
import { Navigate } from "react-router-dom";
|
|
4739
|
-
import { jsx as
|
|
5354
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
4740
5355
|
var PantallaInicial = () => {
|
|
4741
5356
|
const { clientContext } = useApp();
|
|
4742
5357
|
const item = clientContext.menu ? itemInicial(clientContext.menu) : void 0;
|
|
4743
|
-
return item ? /* @__PURE__ */
|
|
5358
|
+
return item ? /* @__PURE__ */ jsx27(Navigate, { to: rutaDeItemDeMenu(item), replace: true }) : null;
|
|
4744
5359
|
};
|
|
4745
5360
|
var PantallaInicial_default = PantallaInicial;
|
|
4746
5361
|
|
|
4747
5362
|
// src/pages/LogoutPage.tsx
|
|
4748
|
-
import { useEffect as
|
|
4749
|
-
import { Box as Box16, Typography as
|
|
4750
|
-
import { jsx as
|
|
5363
|
+
import { useEffect as useEffect10 } from "react";
|
|
5364
|
+
import { Box as Box16, Typography as Typography14, CircularProgress as CircularProgress5 } from "@mui/material";
|
|
5365
|
+
import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4751
5366
|
var LogoutPage = () => {
|
|
4752
5367
|
const logout = useLogout_default();
|
|
4753
|
-
|
|
5368
|
+
useEffect10(() => {
|
|
4754
5369
|
logout();
|
|
4755
5370
|
}, [logout]);
|
|
4756
|
-
return /* @__PURE__ */
|
|
5371
|
+
return /* @__PURE__ */ jsxs21(Box16, { sx: {
|
|
4757
5372
|
display: "flex",
|
|
4758
5373
|
flexDirection: "column",
|
|
4759
5374
|
justifyContent: "center",
|
|
@@ -4761,20 +5376,20 @@ var LogoutPage = () => {
|
|
|
4761
5376
|
height: "100vh",
|
|
4762
5377
|
textAlign: "center"
|
|
4763
5378
|
}, children: [
|
|
4764
|
-
/* @__PURE__ */
|
|
4765
|
-
/* @__PURE__ */
|
|
5379
|
+
/* @__PURE__ */ jsx28(CircularProgress5, { size: 60 }),
|
|
5380
|
+
/* @__PURE__ */ jsx28(Typography14, { variant: "h6", sx: { mt: 2 }, children: "Cerrando sesi\xF3n..." })
|
|
4766
5381
|
] });
|
|
4767
5382
|
};
|
|
4768
5383
|
var LogoutPage_default = LogoutPage;
|
|
4769
5384
|
|
|
4770
5385
|
// src/pages/LoginPage.tsx
|
|
4771
|
-
import { useState as
|
|
4772
|
-
import { Button as
|
|
5386
|
+
import { useState as useState18 } from "react";
|
|
5387
|
+
import { Button as Button10, TextField as TextField2, Typography as Typography15, Alert as Alert3, AlertTitle, Box as Box17, CircularProgress as CircularProgress6 } from "@mui/material";
|
|
4773
5388
|
import { useForm, Controller } from "react-hook-form";
|
|
4774
5389
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
4775
5390
|
import * as z from "zod";
|
|
4776
5391
|
import { useDispatch as useDispatch4 } from "react-redux";
|
|
4777
|
-
import { Fragment as
|
|
5392
|
+
import { Fragment as Fragment5, jsx as jsx29, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4778
5393
|
var loginSchema = z.object({
|
|
4779
5394
|
username: z.string().min(1, "El usuario es requerido"),
|
|
4780
5395
|
// Añadir validación básica
|
|
@@ -4782,8 +5397,8 @@ var loginSchema = z.object({
|
|
|
4782
5397
|
// Añadir validación básica
|
|
4783
5398
|
});
|
|
4784
5399
|
var LoginPage = () => {
|
|
4785
|
-
const [loginError, setLoginError] =
|
|
4786
|
-
const [isSubmitting, setIsSubmitting] =
|
|
5400
|
+
const [loginError, setLoginError] = useState18(null);
|
|
5401
|
+
const [isSubmitting, setIsSubmitting] = useState18(false);
|
|
4787
5402
|
const { setIsLoggedIn, checkSession } = useApp();
|
|
4788
5403
|
const dispatch = useDispatch4();
|
|
4789
5404
|
const {
|
|
@@ -4828,7 +5443,7 @@ var LoginPage = () => {
|
|
|
4828
5443
|
setIsSubmitting(false);
|
|
4829
5444
|
}
|
|
4830
5445
|
};
|
|
4831
|
-
return /* @__PURE__ */
|
|
5446
|
+
return /* @__PURE__ */ jsx29(
|
|
4832
5447
|
Box17,
|
|
4833
5448
|
{
|
|
4834
5449
|
display: "flex",
|
|
@@ -4836,7 +5451,7 @@ var LoginPage = () => {
|
|
|
4836
5451
|
justifyContent: "center",
|
|
4837
5452
|
minHeight: "100vh",
|
|
4838
5453
|
bgcolor: "#f5f5f5",
|
|
4839
|
-
children: /* @__PURE__ */
|
|
5454
|
+
children: /* @__PURE__ */ jsxs22(
|
|
4840
5455
|
Box17,
|
|
4841
5456
|
{
|
|
4842
5457
|
width: "100%",
|
|
@@ -4846,7 +5461,7 @@ var LoginPage = () => {
|
|
|
4846
5461
|
borderRadius: 8,
|
|
4847
5462
|
boxShadow: 3,
|
|
4848
5463
|
children: [
|
|
4849
|
-
/* @__PURE__ */
|
|
5464
|
+
/* @__PURE__ */ jsx29(Box17, { sx: { display: "flex", justifyContent: "center", mb: 3 }, children: /* @__PURE__ */ jsx29(
|
|
4850
5465
|
"img",
|
|
4851
5466
|
{
|
|
4852
5467
|
src: `${envConfig.backendUrl}/img/login-logo-icon.png`,
|
|
@@ -4854,16 +5469,16 @@ var LoginPage = () => {
|
|
|
4854
5469
|
style: { height: "192px", maxWidth: "100%", objectFit: "contain" }
|
|
4855
5470
|
}
|
|
4856
5471
|
) }),
|
|
4857
|
-
/* @__PURE__ */
|
|
4858
|
-
/* @__PURE__ */
|
|
4859
|
-
/* @__PURE__ */
|
|
4860
|
-
/* @__PURE__ */
|
|
4861
|
-
/* @__PURE__ */
|
|
5472
|
+
/* @__PURE__ */ jsx29(Typography15, { variant: "h5", align: "center", gutterBottom: true, sx: { fontWeight: "bold", color: "primary.main" }, children: "Iniciar Sesi\xF3n" }),
|
|
5473
|
+
/* @__PURE__ */ jsxs22("form", { onSubmit: handleSubmit(onSubmit), className: "space-y-4", children: [
|
|
5474
|
+
/* @__PURE__ */ jsxs22("div", { children: [
|
|
5475
|
+
/* @__PURE__ */ jsx29("label", { htmlFor: "username", children: /* @__PURE__ */ jsx29(Typography15, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Usuario" }) }),
|
|
5476
|
+
/* @__PURE__ */ jsx29(
|
|
4862
5477
|
Controller,
|
|
4863
5478
|
{
|
|
4864
5479
|
name: "username",
|
|
4865
5480
|
control,
|
|
4866
|
-
render: ({ field }) => /* @__PURE__ */
|
|
5481
|
+
render: ({ field }) => /* @__PURE__ */ jsx29(
|
|
4867
5482
|
TextField2,
|
|
4868
5483
|
{
|
|
4869
5484
|
...field,
|
|
@@ -4879,14 +5494,14 @@ var LoginPage = () => {
|
|
|
4879
5494
|
}
|
|
4880
5495
|
)
|
|
4881
5496
|
] }),
|
|
4882
|
-
/* @__PURE__ */
|
|
4883
|
-
/* @__PURE__ */
|
|
4884
|
-
/* @__PURE__ */
|
|
5497
|
+
/* @__PURE__ */ jsxs22("div", { children: [
|
|
5498
|
+
/* @__PURE__ */ jsx29("label", { htmlFor: "password", children: /* @__PURE__ */ jsx29(Typography15, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Contrase\xF1a" }) }),
|
|
5499
|
+
/* @__PURE__ */ jsx29(
|
|
4885
5500
|
Controller,
|
|
4886
5501
|
{
|
|
4887
5502
|
name: "password",
|
|
4888
5503
|
control,
|
|
4889
|
-
render: ({ field }) => /* @__PURE__ */
|
|
5504
|
+
render: ({ field }) => /* @__PURE__ */ jsx29(
|
|
4890
5505
|
TextField2,
|
|
4891
5506
|
{
|
|
4892
5507
|
...field,
|
|
@@ -4902,14 +5517,14 @@ var LoginPage = () => {
|
|
|
4902
5517
|
}
|
|
4903
5518
|
)
|
|
4904
5519
|
] }),
|
|
4905
|
-
/* @__PURE__ */
|
|
4906
|
-
/* @__PURE__ */
|
|
5520
|
+
/* @__PURE__ */ jsx29(Button10, { type: "submit", fullWidth: true, variant: "contained", color: "primary", disabled: isSubmitting, sx: { mt: 2 }, children: isSubmitting ? /* @__PURE__ */ jsxs22(Fragment5, { children: [
|
|
5521
|
+
/* @__PURE__ */ jsx29(CircularProgress6, { size: 20, sx: { mr: 1 } }),
|
|
4907
5522
|
"Iniciando sesi\xF3n..."
|
|
4908
5523
|
] }) : "Iniciar Sesi\xF3n" })
|
|
4909
5524
|
] }),
|
|
4910
|
-
loginError && /* @__PURE__ */
|
|
5525
|
+
loginError && /* @__PURE__ */ jsxs22(Alert3, { severity: "error", sx: { mt: 2, maxHeight: "200px" }, children: [
|
|
4911
5526
|
" ",
|
|
4912
|
-
/* @__PURE__ */
|
|
5527
|
+
/* @__PURE__ */ jsx29(AlertTitle, { children: "Error" }),
|
|
4913
5528
|
loginError
|
|
4914
5529
|
] })
|
|
4915
5530
|
]
|
|
@@ -4921,11 +5536,11 @@ var LoginPage = () => {
|
|
|
4921
5536
|
var LoginPage_default = LoginPage;
|
|
4922
5537
|
|
|
4923
5538
|
// src/components/ProcedureForm.tsx
|
|
4924
|
-
import
|
|
5539
|
+
import React23, { useState as useState19, useCallback as useCallback15, useMemo as useMemo12 } from "react";
|
|
4925
5540
|
import { useParams } from "react-router-dom";
|
|
4926
5541
|
import {
|
|
4927
5542
|
TextField as TextField3,
|
|
4928
|
-
Button as
|
|
5543
|
+
Button as Button11,
|
|
4929
5544
|
FormControl as FormControl3,
|
|
4930
5545
|
InputLabel as InputLabel2,
|
|
4931
5546
|
Select as Select2,
|
|
@@ -4933,7 +5548,7 @@ import {
|
|
|
4933
5548
|
Checkbox as Checkbox3,
|
|
4934
5549
|
FormControlLabel as FormControlLabel3,
|
|
4935
5550
|
FormHelperText as FormHelperText2,
|
|
4936
|
-
Typography as
|
|
5551
|
+
Typography as Typography17,
|
|
4937
5552
|
Box as Box19,
|
|
4938
5553
|
CircularProgress as CircularProgress7,
|
|
4939
5554
|
Alert as Alert4,
|
|
@@ -4942,14 +5557,14 @@ import {
|
|
|
4942
5557
|
} from "@mui/material";
|
|
4943
5558
|
|
|
4944
5559
|
// src/pages/procedure-results/SuccessDisplay.tsx
|
|
4945
|
-
import { Box as Box18, Typography as
|
|
4946
|
-
import { jsx as
|
|
5560
|
+
import { Box as Box18, Typography as Typography16, Paper as Paper3 } from "@mui/material";
|
|
5561
|
+
import { jsx as jsx30, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4947
5562
|
var SuccessDisplay = ({ data }) => {
|
|
4948
|
-
return /* @__PURE__ */
|
|
4949
|
-
/* @__PURE__ */
|
|
4950
|
-
/* @__PURE__ */
|
|
4951
|
-
/* @__PURE__ */
|
|
4952
|
-
/* @__PURE__ */
|
|
5563
|
+
return /* @__PURE__ */ jsxs23(Paper3, { elevation: 2, sx: { p: 2, mt: 2, bgcolor: "success.light", color: "success.contrastText" }, children: [
|
|
5564
|
+
/* @__PURE__ */ jsx30(Typography16, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: "\xA1Operaci\xF3n Exitosa!" }),
|
|
5565
|
+
/* @__PURE__ */ jsx30(Typography16, { variant: "body2", sx: { fontSize: "0.85rem" }, children: "Detalles del resultado:" }),
|
|
5566
|
+
/* @__PURE__ */ jsx30(Box18, { sx: { bgcolor: "success.dark", p: 1, borderRadius: 1, mt: 1, overflowX: "auto" }, children: /* @__PURE__ */ jsx30("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(data, null, 2) }) }),
|
|
5567
|
+
/* @__PURE__ */ jsx30(Typography16, { variant: "body2", sx: { fontSize: "0.8rem", mt: 1 }, children: "Puedes revisar los detalles anteriores o cerrar este mensaje." })
|
|
4953
5568
|
] });
|
|
4954
5569
|
};
|
|
4955
5570
|
var SuccessDisplay_default = SuccessDisplay;
|
|
@@ -4963,22 +5578,22 @@ var extendResultsOk = (newComponents) => {
|
|
|
4963
5578
|
};
|
|
4964
5579
|
|
|
4965
5580
|
// src/components/ProcedureForm.tsx
|
|
4966
|
-
import { jsx as
|
|
5581
|
+
import { jsx as jsx31, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4967
5582
|
var ProcedureForm = () => {
|
|
4968
5583
|
const { procedureName } = useParams();
|
|
4969
5584
|
const { clientContext } = useApp();
|
|
4970
5585
|
const { callApi, loading: apiLoading, error: apiError } = useApiCall();
|
|
4971
|
-
const [validationErrors, setValidationErrors] =
|
|
4972
|
-
const [successMessage, setSuccessMessage] =
|
|
4973
|
-
const [executionLog, setExecutionLog] =
|
|
4974
|
-
const [procedureResultData, setProcedureResultData] =
|
|
4975
|
-
const procedure =
|
|
5586
|
+
const [validationErrors, setValidationErrors] = useState19({});
|
|
5587
|
+
const [successMessage, setSuccessMessage] = useState19(null);
|
|
5588
|
+
const [executionLog, setExecutionLog] = useState19([]);
|
|
5589
|
+
const [procedureResultData, setProcedureResultData] = useState19(null);
|
|
5590
|
+
const procedure = useMemo12(() => {
|
|
4976
5591
|
if (procedureName && clientContext?.procedure) {
|
|
4977
5592
|
return clientContext.procedure[procedureName];
|
|
4978
5593
|
}
|
|
4979
5594
|
return void 0;
|
|
4980
5595
|
}, [procedureName, clientContext]);
|
|
4981
|
-
const [formValues, setFormValues] =
|
|
5596
|
+
const [formValues, setFormValues] = useState19(() => {
|
|
4982
5597
|
if (!procedure) return {};
|
|
4983
5598
|
const initialValues = {};
|
|
4984
5599
|
procedure.parameters.forEach((param) => {
|
|
@@ -5003,7 +5618,7 @@ var ProcedureForm = () => {
|
|
|
5003
5618
|
});
|
|
5004
5619
|
return initialValues;
|
|
5005
5620
|
});
|
|
5006
|
-
|
|
5621
|
+
React23.useEffect(() => {
|
|
5007
5622
|
if (procedure) {
|
|
5008
5623
|
setValidationErrors({});
|
|
5009
5624
|
setSuccessMessage(null);
|
|
@@ -5033,11 +5648,11 @@ var ProcedureForm = () => {
|
|
|
5033
5648
|
setExecutionLog([]);
|
|
5034
5649
|
}
|
|
5035
5650
|
}, [procedure]);
|
|
5036
|
-
const addLogMessage =
|
|
5651
|
+
const addLogMessage = useCallback15((message, isError = false) => {
|
|
5037
5652
|
const timestamp = (/* @__PURE__ */ new Date()).toLocaleTimeString("es-AR");
|
|
5038
5653
|
setExecutionLog((prev) => [...prev, `[${timestamp}] ${isError ? "ERROR: " : ""}${message}`]);
|
|
5039
5654
|
}, []);
|
|
5040
|
-
const handleChange =
|
|
5655
|
+
const handleChange = useCallback15((e, child) => {
|
|
5041
5656
|
const { name, value } = e.target;
|
|
5042
5657
|
let newValue = value;
|
|
5043
5658
|
if (e.target.type === "checkbox") {
|
|
@@ -5159,7 +5774,7 @@ var ProcedureForm = () => {
|
|
|
5159
5774
|
addLogMessage("Ejecuci\xF3n finalizada.");
|
|
5160
5775
|
}
|
|
5161
5776
|
};
|
|
5162
|
-
const renderInputField =
|
|
5777
|
+
const renderInputField = useCallback15((param) => {
|
|
5163
5778
|
const hasError = !!validationErrors[param.name];
|
|
5164
5779
|
const errorMessage = validationErrors[param.name];
|
|
5165
5780
|
const commonProps = {
|
|
@@ -5178,9 +5793,9 @@ var ProcedureForm = () => {
|
|
|
5178
5793
|
sx: { fontSize: "0.8rem" }
|
|
5179
5794
|
};
|
|
5180
5795
|
if (param.options && param.options.length > 0) {
|
|
5181
|
-
return /* @__PURE__ */
|
|
5182
|
-
/* @__PURE__ */
|
|
5183
|
-
/* @__PURE__ */
|
|
5796
|
+
return /* @__PURE__ */ jsxs24(FormControl3, { fullWidth: true, margin: "dense", size: "small", error: hasError, required: commonProps.required, children: [
|
|
5797
|
+
/* @__PURE__ */ jsx31(InputLabel2, { id: `${param.name}-label`, sx: { fontSize: "0.8rem" }, children: param.label || param.name }),
|
|
5798
|
+
/* @__PURE__ */ jsxs24(
|
|
5184
5799
|
Select2,
|
|
5185
5800
|
{
|
|
5186
5801
|
labelId: `${param.name}-label`,
|
|
@@ -5191,14 +5806,14 @@ var ProcedureForm = () => {
|
|
|
5191
5806
|
label: param.label || param.name,
|
|
5192
5807
|
disabled: apiLoading,
|
|
5193
5808
|
sx: { fontSize: "0.8rem" },
|
|
5194
|
-
renderValue: (selected) => /* @__PURE__ */
|
|
5809
|
+
renderValue: (selected) => /* @__PURE__ */ jsx31(Typography17, { sx: { fontSize: "0.8rem" }, children: selected }),
|
|
5195
5810
|
children: [
|
|
5196
|
-
(!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */
|
|
5197
|
-
param.options.map((option) => /* @__PURE__ */
|
|
5811
|
+
(!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */ jsx31(MenuItem2, { value: "", sx: { fontSize: "0.8rem" }, children: /* @__PURE__ */ jsx31("em", { children: "Seleccione..." }) }),
|
|
5812
|
+
param.options.map((option) => /* @__PURE__ */ jsx31(MenuItem2, { value: option, sx: { fontSize: "0.8rem" }, children: option }, option))
|
|
5198
5813
|
]
|
|
5199
5814
|
}
|
|
5200
5815
|
),
|
|
5201
|
-
(param.description || errorMessage) && /* @__PURE__ */
|
|
5816
|
+
(param.description || errorMessage) && /* @__PURE__ */ jsx31(FormHelperText2, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
|
|
5202
5817
|
] });
|
|
5203
5818
|
}
|
|
5204
5819
|
switch (param.typeName) {
|
|
@@ -5207,18 +5822,18 @@ var ProcedureForm = () => {
|
|
|
5207
5822
|
case "tsrange":
|
|
5208
5823
|
case "time_range":
|
|
5209
5824
|
case "daterange":
|
|
5210
|
-
return /* @__PURE__ */
|
|
5825
|
+
return /* @__PURE__ */ jsx31(TextField3, { type: "text", value: formValues[param.name] || "", ...commonProps });
|
|
5211
5826
|
case "decimal":
|
|
5212
5827
|
case "double":
|
|
5213
|
-
return /* @__PURE__ */
|
|
5828
|
+
return /* @__PURE__ */ jsx31(TextField3, { type: "number", inputProps: { step: "any", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
|
|
5214
5829
|
case "integer":
|
|
5215
5830
|
case "bigint":
|
|
5216
|
-
return /* @__PURE__ */
|
|
5831
|
+
return /* @__PURE__ */ jsx31(TextField3, { type: "number", inputProps: { step: "1", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
|
|
5217
5832
|
case "boolean":
|
|
5218
|
-
return /* @__PURE__ */
|
|
5833
|
+
return /* @__PURE__ */ jsx31(
|
|
5219
5834
|
FormControlLabel3,
|
|
5220
5835
|
{
|
|
5221
|
-
control: /* @__PURE__ */
|
|
5836
|
+
control: /* @__PURE__ */ jsx31(
|
|
5222
5837
|
Checkbox3,
|
|
5223
5838
|
{
|
|
5224
5839
|
checked: !!formValues[param.name],
|
|
@@ -5229,21 +5844,21 @@ var ProcedureForm = () => {
|
|
|
5229
5844
|
size: "small"
|
|
5230
5845
|
}
|
|
5231
5846
|
),
|
|
5232
|
-
label: /* @__PURE__ */
|
|
5847
|
+
label: /* @__PURE__ */ jsx31(Typography17, { sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "inherit" }, children: param.label || param.name }),
|
|
5233
5848
|
sx: { mt: 1, mb: 0 }
|
|
5234
5849
|
}
|
|
5235
5850
|
);
|
|
5236
5851
|
case "date":
|
|
5237
5852
|
case "timestamp":
|
|
5238
5853
|
case "time":
|
|
5239
|
-
return /* @__PURE__ */
|
|
5854
|
+
return /* @__PURE__ */ jsx31(TextField3, { type: param.typeName === "date" ? "date" : param.typeName === "timestamp" ? "datetime-local" : "time", value: formValues[param.name] || "", ...commonProps, InputLabelProps: { shrink: true, sx: { fontSize: "0.8rem" } } });
|
|
5240
5855
|
case "jsonb":
|
|
5241
5856
|
case "jsona":
|
|
5242
|
-
return /* @__PURE__ */
|
|
5857
|
+
return /* @__PURE__ */ jsx31(TextField3, { multiline: true, rows: 5, value: formValues[param.name] || "", ...commonProps, InputProps: { sx: { fontSize: "0.8rem" } } });
|
|
5243
5858
|
case "bytea":
|
|
5244
|
-
return /* @__PURE__ */
|
|
5245
|
-
/* @__PURE__ */
|
|
5246
|
-
/* @__PURE__ */
|
|
5859
|
+
return /* @__PURE__ */ jsxs24(FormControl3, { fullWidth: true, margin: "dense", error: hasError, required: commonProps.required, children: [
|
|
5860
|
+
/* @__PURE__ */ jsx31(Typography17, { variant: "body2", color: "textSecondary", component: "label", htmlFor: param.name, sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "text.secondary" }, children: param.label || param.name }),
|
|
5861
|
+
/* @__PURE__ */ jsx31(
|
|
5247
5862
|
"input",
|
|
5248
5863
|
{
|
|
5249
5864
|
type: "file",
|
|
@@ -5257,34 +5872,34 @@ var ProcedureForm = () => {
|
|
|
5257
5872
|
style: { padding: "6px 0", fontSize: "0.8rem" }
|
|
5258
5873
|
}
|
|
5259
5874
|
),
|
|
5260
|
-
(param.description || errorMessage) && /* @__PURE__ */
|
|
5875
|
+
(param.description || errorMessage) && /* @__PURE__ */ jsx31(FormHelperText2, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
|
|
5261
5876
|
] });
|
|
5262
5877
|
default:
|
|
5263
|
-
return /* @__PURE__ */
|
|
5878
|
+
return /* @__PURE__ */ jsx31(TextField3, { type: "text", value: formValues[param.name] || "", ...commonProps });
|
|
5264
5879
|
}
|
|
5265
5880
|
}, [formValues, handleChange, apiLoading, validationErrors]);
|
|
5266
|
-
const ResultDisplayContent =
|
|
5881
|
+
const ResultDisplayContent = useMemo12(() => {
|
|
5267
5882
|
if (!procedureResultData || !procedure?.resultOk) return null;
|
|
5268
5883
|
const ComponentToRender = resultsOk[procedure.resultOk];
|
|
5269
5884
|
if (ComponentToRender) {
|
|
5270
|
-
return /* @__PURE__ */
|
|
5885
|
+
return /* @__PURE__ */ jsx31(ComponentToRender, { data: procedureResultData });
|
|
5271
5886
|
} else {
|
|
5272
|
-
return /* @__PURE__ */
|
|
5273
|
-
/* @__PURE__ */
|
|
5887
|
+
return /* @__PURE__ */ jsxs24(Paper4, { elevation: 2, sx: { p: 2, mt: 0, bgcolor: "warning.light" }, children: [
|
|
5888
|
+
/* @__PURE__ */ jsxs24(Typography17, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: [
|
|
5274
5889
|
"el componente para resolver el resultOk: '",
|
|
5275
5890
|
procedure.resultOk,
|
|
5276
5891
|
"' definido en el procedure no existe o no est\xE1 mapeado."
|
|
5277
5892
|
] }),
|
|
5278
|
-
/* @__PURE__ */
|
|
5893
|
+
/* @__PURE__ */ jsx31(Box19, { sx: {
|
|
5279
5894
|
bgcolor: "warning.dark",
|
|
5280
5895
|
p: 1,
|
|
5281
5896
|
borderRadius: 1
|
|
5282
|
-
}, children: /* @__PURE__ */
|
|
5897
|
+
}, children: /* @__PURE__ */ jsx31("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(procedureResultData, null, 2) }) })
|
|
5283
5898
|
] });
|
|
5284
5899
|
}
|
|
5285
5900
|
}, [procedureResultData, procedure]);
|
|
5286
5901
|
if (!procedure) {
|
|
5287
|
-
return /* @__PURE__ */
|
|
5902
|
+
return /* @__PURE__ */ jsxs24(Box19, { sx: {
|
|
5288
5903
|
p: 2,
|
|
5289
5904
|
width: "100%",
|
|
5290
5905
|
boxSizing: "border-box",
|
|
@@ -5294,13 +5909,13 @@ var ProcedureForm = () => {
|
|
|
5294
5909
|
boxShadow: 3,
|
|
5295
5910
|
textAlign: "center"
|
|
5296
5911
|
}, children: [
|
|
5297
|
-
/* @__PURE__ */
|
|
5298
|
-
/* @__PURE__ */
|
|
5912
|
+
/* @__PURE__ */ jsx31(CircularProgress7, { sx: { mb: 2 } }),
|
|
5913
|
+
/* @__PURE__ */ jsx31(Typography17, { variant: "h6", color: "text.secondary", children: "Cargando procedimiento o no encontrado..." })
|
|
5299
5914
|
] });
|
|
5300
5915
|
}
|
|
5301
5916
|
return (
|
|
5302
5917
|
// Esta es la Box más externa que ahora controlará el scroll
|
|
5303
|
-
/* @__PURE__ */
|
|
5918
|
+
/* @__PURE__ */ jsxs24(Box19, { sx: {
|
|
5304
5919
|
p: 2,
|
|
5305
5920
|
ml: 1,
|
|
5306
5921
|
mt: 2,
|
|
@@ -5317,17 +5932,17 @@ var ProcedureForm = () => {
|
|
|
5317
5932
|
overflowX: "hidden"
|
|
5318
5933
|
// Oculta el scroll horizontal si no es necesario para el contenedor principal
|
|
5319
5934
|
}, children: [
|
|
5320
|
-
/* @__PURE__ */
|
|
5321
|
-
Object.values(validationErrors).some((err) => err !== null) && /* @__PURE__ */
|
|
5935
|
+
/* @__PURE__ */ jsx31(Typography17, { variant: "h5", component: "h2", gutterBottom: true, align: "left", children: cambiarGuionesBajosPorEspacios(procedure.proceedLabel || procedure.action) }),
|
|
5936
|
+
Object.values(validationErrors).some((err) => err !== null) && /* @__PURE__ */ jsxs24(Alert4, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: [
|
|
5322
5937
|
"Por favor, corrige los errores en el formulario antes de enviar.",
|
|
5323
|
-
/* @__PURE__ */
|
|
5938
|
+
/* @__PURE__ */ jsx31("ul", { children: Object.values(validationErrors).map((err, idx) => err && /* @__PURE__ */ jsx31("li", { children: err }, idx)) })
|
|
5324
5939
|
] }),
|
|
5325
|
-
!Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */
|
|
5326
|
-
!Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */
|
|
5327
|
-
/* @__PURE__ */
|
|
5328
|
-
procedure.parameters.map((param) => /* @__PURE__ */
|
|
5329
|
-
/* @__PURE__ */
|
|
5330
|
-
|
|
5940
|
+
!Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */ jsx31(Alert4, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: apiError.message }),
|
|
5941
|
+
!Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */ jsx31(Alert4, { severity: "success", sx: { mb: 2, fontSize: "0.8rem" }, children: successMessage }),
|
|
5942
|
+
/* @__PURE__ */ jsxs24("form", { onSubmit: handleSubmit, children: [
|
|
5943
|
+
procedure.parameters.map((param) => /* @__PURE__ */ jsx31("div", { children: renderInputField(param) }, param.name)),
|
|
5944
|
+
/* @__PURE__ */ jsx31(
|
|
5945
|
+
Button11,
|
|
5331
5946
|
{
|
|
5332
5947
|
type: "submit",
|
|
5333
5948
|
variant: "contained",
|
|
@@ -5335,19 +5950,19 @@ var ProcedureForm = () => {
|
|
|
5335
5950
|
disabled: apiLoading || Object.values(validationErrors).some((err) => err !== null),
|
|
5336
5951
|
sx: { mt: 2 },
|
|
5337
5952
|
size: "medium",
|
|
5338
|
-
startIcon: apiLoading ? /* @__PURE__ */
|
|
5953
|
+
startIcon: apiLoading ? /* @__PURE__ */ jsx31(CircularProgress7, { size: 20, color: "inherit" }) : null,
|
|
5339
5954
|
children: apiLoading ? "Ejecutando..." : procedure.proceedLabel || "Ejecutar"
|
|
5340
5955
|
}
|
|
5341
5956
|
)
|
|
5342
5957
|
] }),
|
|
5343
|
-
ResultDisplayContent && /* @__PURE__ */
|
|
5958
|
+
ResultDisplayContent && /* @__PURE__ */ jsxs24(Box19, { sx: { mt: 2 }, children: [
|
|
5344
5959
|
" ",
|
|
5345
5960
|
ResultDisplayContent
|
|
5346
5961
|
] }),
|
|
5347
|
-
executionLog.length > 0 && /* @__PURE__ */
|
|
5348
|
-
/* @__PURE__ */
|
|
5349
|
-
/* @__PURE__ */
|
|
5350
|
-
/* @__PURE__ */
|
|
5962
|
+
executionLog.length > 0 && /* @__PURE__ */ jsxs24(Box19, { sx: { mt: 3 }, children: [
|
|
5963
|
+
/* @__PURE__ */ jsx31(Divider3, { sx: { mb: 2 } }),
|
|
5964
|
+
/* @__PURE__ */ jsx31(Typography17, { variant: "h6", gutterBottom: true, sx: { fontSize: "0.9rem" }, children: "Registro de Ejecuci\xF3n" }),
|
|
5965
|
+
/* @__PURE__ */ jsx31(
|
|
5351
5966
|
Box19,
|
|
5352
5967
|
{
|
|
5353
5968
|
sx: {
|
|
@@ -5361,8 +5976,8 @@ var ProcedureForm = () => {
|
|
|
5361
5976
|
fontSize: "0.75rem",
|
|
5362
5977
|
whiteSpace: "pre-wrap"
|
|
5363
5978
|
},
|
|
5364
|
-
children: executionLog.map((log, index) => /* @__PURE__ */
|
|
5365
|
-
|
|
5979
|
+
children: executionLog.map((log, index) => /* @__PURE__ */ jsx31(
|
|
5980
|
+
Typography17,
|
|
5366
5981
|
{
|
|
5367
5982
|
component: "pre",
|
|
5368
5983
|
sx: {
|
|
@@ -5387,9 +6002,9 @@ import { Provider } from "react-redux";
|
|
|
5387
6002
|
import { PersistGate } from "redux-persist/integration/react";
|
|
5388
6003
|
|
|
5389
6004
|
// src/components/PrivateRoute.tsx
|
|
5390
|
-
import { useEffect as
|
|
6005
|
+
import { useEffect as useEffect11 } from "react";
|
|
5391
6006
|
import { Navigate as Navigate2, useLocation as useLocation3 } from "react-router-dom";
|
|
5392
|
-
import { Fragment as
|
|
6007
|
+
import { Fragment as Fragment6, jsx as jsx32 } from "react/jsx-runtime";
|
|
5393
6008
|
var PrivateRoute = ({ children }) => {
|
|
5394
6009
|
const location = useLocation3();
|
|
5395
6010
|
const dispatch = useAppDispatch();
|
|
@@ -5397,7 +6012,7 @@ var PrivateRoute = ({ children }) => {
|
|
|
5397
6012
|
const isAuthenticated = clientContextStatus === "succeeded";
|
|
5398
6013
|
const isLoadingAuth = clientContextStatus === "loading";
|
|
5399
6014
|
console.log(`[PrivateRoute] Render: Path=${location.pathname}, AuthStatus=${clientContextStatus}, IsAuthenticated=${isAuthenticated}, IsLoadingAuth=${isLoadingAuth}`);
|
|
5400
|
-
|
|
6015
|
+
useEffect11(() => {
|
|
5401
6016
|
console.log(`[PrivateRoute] Effect: Path=${location.pathname}, AuthStatus=${clientContextStatus}, IsAuthenticated=${isAuthenticated}, IsLoadingAuth=${isLoadingAuth}`);
|
|
5402
6017
|
if (!isAuthenticated && !isLoadingAuth && location.pathname !== "/login") {
|
|
5403
6018
|
const path = location.pathname + location.search + location.hash;
|
|
@@ -5413,19 +6028,19 @@ var PrivateRoute = ({ children }) => {
|
|
|
5413
6028
|
}, [isAuthenticated, isLoadingAuth, location, dispatch, clientContextStatus]);
|
|
5414
6029
|
if (isLoadingAuth) {
|
|
5415
6030
|
console.log(`[PrivateRoute] Returning loading state...`);
|
|
5416
|
-
return /* @__PURE__ */
|
|
6031
|
+
return /* @__PURE__ */ jsx32("p", { children: "Verificando autenticaci\xF3n..." });
|
|
5417
6032
|
}
|
|
5418
6033
|
if (!isAuthenticated) {
|
|
5419
6034
|
console.log(`[PrivateRoute] User not authenticated, navigating to /login`);
|
|
5420
|
-
return /* @__PURE__ */
|
|
6035
|
+
return /* @__PURE__ */ jsx32(Navigate2, { to: "/login", replace: true });
|
|
5421
6036
|
}
|
|
5422
6037
|
console.log(`[PrivateRoute] User authenticated, rendering children.`);
|
|
5423
|
-
return /* @__PURE__ */
|
|
6038
|
+
return /* @__PURE__ */ jsx32(Fragment6, { children });
|
|
5424
6039
|
};
|
|
5425
6040
|
var PrivateRoute_default = PrivateRoute;
|
|
5426
6041
|
|
|
5427
6042
|
// src/components/InitialRedirectHandler.tsx
|
|
5428
|
-
import { useEffect as
|
|
6043
|
+
import { useEffect as useEffect12, useRef as useRef9 } from "react";
|
|
5429
6044
|
import { useLocation as useLocation4, useNavigate as useNavigate4 } from "react-router-dom";
|
|
5430
6045
|
var InitialRedirectHandler = () => {
|
|
5431
6046
|
const location = useLocation4();
|
|
@@ -5433,14 +6048,14 @@ var InitialRedirectHandler = () => {
|
|
|
5433
6048
|
const dispatch = useAppDispatch();
|
|
5434
6049
|
const redirectPath = useRedirectPath();
|
|
5435
6050
|
const clientContextStatus = useClientContextStatus();
|
|
5436
|
-
|
|
6051
|
+
useEffect12(() => {
|
|
5437
6052
|
dispatch(setCurrentPath(location.pathname + location.search));
|
|
5438
6053
|
}, [location, dispatch]);
|
|
5439
|
-
const navegandoRef =
|
|
5440
|
-
|
|
6054
|
+
const navegandoRef = useRef9(false);
|
|
6055
|
+
useEffect12(() => {
|
|
5441
6056
|
navegandoRef.current = false;
|
|
5442
6057
|
}, [location.pathname]);
|
|
5443
|
-
|
|
6058
|
+
useEffect12(() => {
|
|
5444
6059
|
if (clientContextStatus === "succeeded") {
|
|
5445
6060
|
if (redirectPath && redirectPath !== "/login") {
|
|
5446
6061
|
console.log("Redirigiendo a la ruta guardada:", redirectPath);
|
|
@@ -5458,35 +6073,40 @@ var InitialRedirectHandler = () => {
|
|
|
5458
6073
|
var InitialRedirectHandler_default = InitialRedirectHandler;
|
|
5459
6074
|
|
|
5460
6075
|
// src/pages/GenericDataGridPage.tsx
|
|
5461
|
-
import
|
|
6076
|
+
import React26, { useState as useState20, useCallback as useCallback16, useMemo as useMemo13 } from "react";
|
|
5462
6077
|
import { useParams as useParams2, useLocation as useLocation5 } from "react-router-dom";
|
|
5463
|
-
import { Box as Box20, Alert as Alert5, Typography as
|
|
6078
|
+
import { Box as Box20, Alert as Alert5, Typography as Typography18, Tabs, Tab, IconButton as IconButton7 } from "@mui/material";
|
|
5464
6079
|
import CloseIcon2 from "@mui/icons-material/Close";
|
|
5465
|
-
import { jsx as
|
|
6080
|
+
import { jsx as jsx33, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5466
6081
|
var GenericDataGridPage = ({
|
|
5467
6082
|
initialTableName,
|
|
5468
|
-
initialFixedFields = []
|
|
6083
|
+
initialFixedFields = [],
|
|
6084
|
+
parametros: parametrosRecibidos
|
|
5469
6085
|
}) => {
|
|
5470
6086
|
const { tableName: urlTableName } = useParams2();
|
|
5471
6087
|
const effectiveTableName = initialTableName || urlTableName;
|
|
5472
|
-
const [tabs, setTabs] =
|
|
5473
|
-
const [activeTabIdx, setActiveTabIdx] =
|
|
6088
|
+
const [tabs, setTabs] = useState20([]);
|
|
6089
|
+
const [activeTabIdx, setActiveTabIdx] = useState20(0);
|
|
5474
6090
|
const ffKey = JSON.stringify(initialFixedFields);
|
|
5475
6091
|
const location = useLocation5();
|
|
5476
|
-
|
|
6092
|
+
const parametros = useMemo13(() => parametrosRecibidos ?? parametrosDeTabla(void 0, location.search), [parametrosRecibidos, location.search]);
|
|
6093
|
+
const fixedFieldsIniciales = initialFixedFields.length > 0 ? initialFixedFields : parametros.fixedFields ?? [];
|
|
6094
|
+
const parametrosKey = JSON.stringify(parametros);
|
|
6095
|
+
React26.useEffect(() => {
|
|
5477
6096
|
if (effectiveTableName) {
|
|
5478
6097
|
setTabs([{
|
|
5479
|
-
id: `main-${effectiveTableName}-${ffKey}`,
|
|
6098
|
+
id: `main-${effectiveTableName}-${ffKey}-${parametrosKey}`,
|
|
5480
6099
|
// ID único que incluye filtros
|
|
5481
|
-
label: effectiveTableName.replace(/_/g, " ").toUpperCase(),
|
|
6100
|
+
label: parametros.label ?? effectiveTableName.replace(/_/g, " ").toUpperCase(),
|
|
5482
6101
|
tableName: effectiveTableName,
|
|
5483
|
-
fixedFields:
|
|
6102
|
+
fixedFields: fixedFieldsIniciales,
|
|
6103
|
+
parametros,
|
|
5484
6104
|
ancestors: []
|
|
5485
6105
|
}]);
|
|
5486
6106
|
setActiveTabIdx(0);
|
|
5487
6107
|
}
|
|
5488
|
-
}, [effectiveTableName, ffKey, location.key]);
|
|
5489
|
-
const handleOpenDetail =
|
|
6108
|
+
}, [effectiveTableName, ffKey, parametrosKey, location.key]);
|
|
6109
|
+
const handleOpenDetail = useCallback16((tableName, fixedFields, label, ancestors) => {
|
|
5490
6110
|
const tabId = `${tableName}-${JSON.stringify(fixedFields)}`;
|
|
5491
6111
|
setTabs((prevTabs) => {
|
|
5492
6112
|
const existingTabIdx = prevTabs.findIndex((t) => t.id === tabId);
|
|
@@ -5508,30 +6128,34 @@ var GenericDataGridPage = ({
|
|
|
5508
6128
|
else if (activeTabIdx === index) setActiveTabIdx(index - 1);
|
|
5509
6129
|
};
|
|
5510
6130
|
if (!effectiveTableName) {
|
|
5511
|
-
return /* @__PURE__ */
|
|
6131
|
+
return /* @__PURE__ */ jsx33(Box20, { p: 3, children: /* @__PURE__ */ jsx33(Alert5, { severity: "error", children: "No se especific\xF3 una tabla." }) });
|
|
5512
6132
|
}
|
|
5513
|
-
return /* @__PURE__ */
|
|
5514
|
-
/* @__PURE__ */
|
|
6133
|
+
return /* @__PURE__ */ jsxs25(Box20, { sx: { width: "100%", height: "calc(100vh - 64px)", display: "flex", flexDirection: "column" }, children: [
|
|
6134
|
+
/* @__PURE__ */ jsx33(Box20, { sx: { borderBottom: 1, borderColor: "divider", bgcolor: "background.paper" }, children: /* @__PURE__ */ jsx33(Tabs, { value: activeTabIdx, onChange: (_, v) => setActiveTabIdx(v), variant: "scrollable", children: tabs.map((tab, index) => /* @__PURE__ */ jsx33(
|
|
5515
6135
|
Tab,
|
|
5516
6136
|
{
|
|
5517
|
-
label: /* @__PURE__ */
|
|
5518
|
-
/* @__PURE__ */
|
|
5519
|
-
index !== 0 && /* @__PURE__ */
|
|
6137
|
+
label: /* @__PURE__ */ jsxs25(Box20, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
6138
|
+
/* @__PURE__ */ jsx33(Typography18, { variant: "caption", sx: { fontWeight: "bold" }, children: tab.label }),
|
|
6139
|
+
index !== 0 && /* @__PURE__ */ jsx33(IconButton7, { size: "small", onClick: (e) => handleCloseTab(index, e), children: /* @__PURE__ */ jsx33(CloseIcon2, { fontSize: "inherit" }) })
|
|
5520
6140
|
] })
|
|
5521
6141
|
},
|
|
5522
6142
|
tab.id
|
|
5523
6143
|
)) }) }),
|
|
5524
|
-
tabs.map((tab, index) => /* @__PURE__ */
|
|
6144
|
+
tabs.map((tab, index) => /* @__PURE__ */ jsx33(
|
|
5525
6145
|
Box20,
|
|
5526
6146
|
{
|
|
5527
6147
|
role: "tabpanel",
|
|
5528
6148
|
hidden: activeTabIdx !== index,
|
|
5529
6149
|
sx: { flexGrow: 1, display: activeTabIdx === index ? "flex" : "none", flexDirection: "column", overflow: "hidden" },
|
|
5530
|
-
children: /* @__PURE__ */
|
|
6150
|
+
children: /* @__PURE__ */ jsx33(
|
|
5531
6151
|
GenericDataGrid_default,
|
|
5532
6152
|
{
|
|
5533
6153
|
tableName: tab.tableName,
|
|
5534
6154
|
fixedFields: tab.fixedFields,
|
|
6155
|
+
filterColumns: tab.parametros?.filterColumns,
|
|
6156
|
+
tableDef: tab.parametros?.tableDef,
|
|
6157
|
+
parameterFunctions: tab.parametros?.parameterFunctions,
|
|
6158
|
+
pick: tab.parametros?.pick,
|
|
5535
6159
|
onOpenDetail: handleOpenDetail,
|
|
5536
6160
|
ancestors: tab.ancestors
|
|
5537
6161
|
}
|
|
@@ -5544,32 +6168,26 @@ var GenericDataGridPage = ({
|
|
|
5544
6168
|
var GenericDataGridPage_default = GenericDataGridPage;
|
|
5545
6169
|
|
|
5546
6170
|
// src/pages/PantallaDeRuta.tsx
|
|
5547
|
-
import { useMemo as
|
|
6171
|
+
import { useMemo as useMemo14 } from "react";
|
|
5548
6172
|
import { useSearchParams } from "react-router-dom";
|
|
5549
6173
|
import { Box as Box21 } from "@mui/material";
|
|
5550
|
-
import { jsx as
|
|
6174
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
5551
6175
|
var PantallaDeRuta = ({ screenName }) => {
|
|
5552
6176
|
const [busqueda] = useSearchParams();
|
|
5553
|
-
const params =
|
|
6177
|
+
const params = useMemo14(() => Object.fromEntries(busqueda.entries()), [busqueda]);
|
|
5554
6178
|
const Pantalla = wScreens[screenName];
|
|
5555
|
-
return /* @__PURE__ */
|
|
6179
|
+
return /* @__PURE__ */ jsx34(Box21, { sx: { pt: 3, pl: 4 }, children: Pantalla ? /* @__PURE__ */ jsx34(Pantalla, { screenName, params }) : /* @__PURE__ */ jsx34(FallbackWScreen, { screenName }) });
|
|
5556
6180
|
};
|
|
5557
6181
|
|
|
5558
6182
|
// src/pages/MenuTablePage.tsx
|
|
5559
|
-
import { useMemo as
|
|
5560
|
-
import { useParams as useParams3 } from "react-router-dom";
|
|
5561
|
-
import { Box as Box22, Alert as Alert6, Typography as
|
|
5562
|
-
import { jsx as
|
|
5563
|
-
function fixedFieldsDeMenu(ff) {
|
|
5564
|
-
if (!ff) return [];
|
|
5565
|
-
if (Array.isArray(ff)) {
|
|
5566
|
-
return ff.map(({ fieldName, value }) => ({ fieldName, value }));
|
|
5567
|
-
}
|
|
5568
|
-
return Object.entries(ff).map(([fieldName, value]) => ({ fieldName, value }));
|
|
5569
|
-
}
|
|
6183
|
+
import { useMemo as useMemo15 } from "react";
|
|
6184
|
+
import { useLocation as useLocation6, useParams as useParams3 } from "react-router-dom";
|
|
6185
|
+
import { Box as Box22, Alert as Alert6, Typography as Typography19 } from "@mui/material";
|
|
6186
|
+
import { jsx as jsx35, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5570
6187
|
var MenuTablePage = () => {
|
|
5571
6188
|
const { menuName } = useParams3();
|
|
5572
6189
|
const { clientContext } = useApp();
|
|
6190
|
+
const { search } = useLocation6();
|
|
5573
6191
|
const findMenuItem = (items, nameToFind) => {
|
|
5574
6192
|
for (const item of items) {
|
|
5575
6193
|
if (item.name === nameToFind && item.menuType === "table") {
|
|
@@ -5582,51 +6200,55 @@ var MenuTablePage = () => {
|
|
|
5582
6200
|
}
|
|
5583
6201
|
return void 0;
|
|
5584
6202
|
};
|
|
5585
|
-
const { currentTableName, currentFixedFields } =
|
|
6203
|
+
const { currentTableName, currentFixedFields, parametros } = useMemo15(() => {
|
|
5586
6204
|
let tableName = void 0;
|
|
5587
6205
|
let fixedFields = [];
|
|
6206
|
+
let parametros2 = {};
|
|
5588
6207
|
if (menuName && clientContext && clientContext.menu) {
|
|
5589
6208
|
const menuItem = findMenuItem(clientContext.menu, menuName);
|
|
5590
6209
|
if (menuItem) {
|
|
5591
6210
|
tableName = menuItem.table || menuItem.name;
|
|
5592
|
-
|
|
6211
|
+
parametros2 = parametrosDeTabla(menuItem, search);
|
|
6212
|
+
fixedFields = parametros2.fixedFields ?? [];
|
|
5593
6213
|
} else {
|
|
5594
6214
|
console.warn(`[${menuName}] \xCDtem de men\xFA '${menuName}' no encontrado o no es de tipo 'table' en clientContext.menu.`);
|
|
5595
6215
|
}
|
|
5596
6216
|
}
|
|
5597
6217
|
return {
|
|
5598
6218
|
currentTableName: tableName,
|
|
5599
|
-
currentFixedFields: fixedFields
|
|
6219
|
+
currentFixedFields: fixedFields,
|
|
6220
|
+
parametros: parametros2
|
|
5600
6221
|
};
|
|
5601
|
-
}, [menuName, clientContext]);
|
|
6222
|
+
}, [menuName, clientContext, search]);
|
|
5602
6223
|
if (!currentTableName) {
|
|
5603
|
-
return /* @__PURE__ */
|
|
5604
|
-
/* @__PURE__ */
|
|
5605
|
-
/* @__PURE__ */
|
|
6224
|
+
return /* @__PURE__ */ jsx35(Box22, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsxs26(Alert6, { severity: "error", children: [
|
|
6225
|
+
/* @__PURE__ */ jsx35(Typography19, { variant: "h6", children: "Error: No se pudo cargar la informaci\xF3n de la tabla." }),
|
|
6226
|
+
/* @__PURE__ */ jsx35(Typography19, { variant: "body1", children: "Verifique la configuraci\xF3n del men\xFA o el nombre de la tabla en la URL." })
|
|
5606
6227
|
] }) });
|
|
5607
6228
|
}
|
|
5608
|
-
return /* @__PURE__ */
|
|
6229
|
+
return /* @__PURE__ */ jsx35(
|
|
5609
6230
|
GenericDataGridPage_default,
|
|
5610
6231
|
{
|
|
5611
6232
|
initialTableName: currentTableName,
|
|
5612
|
-
initialFixedFields: currentFixedFields
|
|
6233
|
+
initialFixedFields: currentFixedFields,
|
|
6234
|
+
parametros
|
|
5613
6235
|
}
|
|
5614
6236
|
);
|
|
5615
6237
|
};
|
|
5616
6238
|
var MenuTablePage_default = MenuTablePage;
|
|
5617
6239
|
|
|
5618
6240
|
// src/puente/PantallaBP.tsx
|
|
5619
|
-
import { useEffect as
|
|
5620
|
-
import { Navigate as Navigate3, useLocation as
|
|
6241
|
+
import { useEffect as useEffect15, useRef as useRef10, useState as useState21 } from "react";
|
|
6242
|
+
import { Navigate as Navigate3, useLocation as useLocation7, useParams as useParams4 } from "react-router-dom";
|
|
5621
6243
|
import { Alert as Alert7, Box as Box24, CircularProgress as CircularProgress8 } from "@mui/material";
|
|
5622
6244
|
|
|
5623
6245
|
// src/puente/clienteBP.ts
|
|
5624
6246
|
function extraerRecursos(html) {
|
|
5625
6247
|
const documento = new DOMParser().parseFromString(html, "text/html");
|
|
5626
|
-
const
|
|
6248
|
+
const referencias2 = (selector, atributo) => Array.from(documento.querySelectorAll(selector)).map((elemento) => elemento.getAttribute(atributo)).filter((ruta) => !!ruta);
|
|
5627
6249
|
return {
|
|
5628
|
-
hojasDeEstilo:
|
|
5629
|
-
scripts:
|
|
6250
|
+
hojasDeEstilo: referencias2("link[rel=stylesheet]", "href"),
|
|
6251
|
+
scripts: referencias2("script[src]", "src")
|
|
5630
6252
|
};
|
|
5631
6253
|
}
|
|
5632
6254
|
function fijarBase(urlBackend) {
|
|
@@ -5707,9 +6329,9 @@ async function cargarSinMemoria(urlBackend) {
|
|
|
5707
6329
|
}
|
|
5708
6330
|
|
|
5709
6331
|
// src/puente/ConsolaBP.tsx
|
|
5710
|
-
import { useEffect as
|
|
6332
|
+
import { useEffect as useEffect14 } from "react";
|
|
5711
6333
|
import { Box as Box23 } from "@mui/material";
|
|
5712
|
-
import { jsx as
|
|
6334
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
5713
6335
|
var MARGEN_DE_REPETIDO_MS = 1e3;
|
|
5714
6336
|
function descartarRepetidos(consola, agregados, ahora) {
|
|
5715
6337
|
for (const nodo of agregados) {
|
|
@@ -5722,7 +6344,7 @@ function descartarRepetidos(consola, agregados, ahora) {
|
|
|
5722
6344
|
}
|
|
5723
6345
|
}
|
|
5724
6346
|
var ConsolaBP = () => {
|
|
5725
|
-
|
|
6347
|
+
useEffect14(() => {
|
|
5726
6348
|
const consola = document.getElementById("mini-console");
|
|
5727
6349
|
if (!consola) return;
|
|
5728
6350
|
const observador = new MutationObserver(
|
|
@@ -5731,7 +6353,7 @@ var ConsolaBP = () => {
|
|
|
5731
6353
|
observador.observe(consola, { childList: true });
|
|
5732
6354
|
return () => observador.disconnect();
|
|
5733
6355
|
}, []);
|
|
5734
|
-
return /* @__PURE__ */
|
|
6356
|
+
return /* @__PURE__ */ jsx36(
|
|
5735
6357
|
Box23,
|
|
5736
6358
|
{
|
|
5737
6359
|
id: "mini-console",
|
|
@@ -5828,7 +6450,7 @@ var habilitarPuenteBP = () => {
|
|
|
5828
6450
|
var puenteBPHabilitado = () => habilitado;
|
|
5829
6451
|
|
|
5830
6452
|
// src/puente/PantallaBP.tsx
|
|
5831
|
-
import { jsx as
|
|
6453
|
+
import { jsx as jsx37, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
5832
6454
|
function buscarItemDeMenu(items, tipo) {
|
|
5833
6455
|
for (const item of items) {
|
|
5834
6456
|
if (item.menuType === tipo) return item;
|
|
@@ -5841,12 +6463,12 @@ function buscarItemDeMenu(items, tipo) {
|
|
|
5841
6463
|
}
|
|
5842
6464
|
var PantallaBP = ({ nombre, direccion }) => {
|
|
5843
6465
|
const { clientContext } = useApp();
|
|
5844
|
-
const [cargando, setCargando] =
|
|
5845
|
-
const [error, setError] =
|
|
5846
|
-
const [noExiste, setNoExiste] =
|
|
5847
|
-
const contenedor =
|
|
6466
|
+
const [cargando, setCargando] = useState21(true);
|
|
6467
|
+
const [error, setError] = useState21(null);
|
|
6468
|
+
const [noExiste, setNoExiste] = useState21(false);
|
|
6469
|
+
const contenedor = useRef10(null);
|
|
5848
6470
|
const menu = clientContext.menu;
|
|
5849
|
-
|
|
6471
|
+
useEffect15(() => {
|
|
5850
6472
|
const elemento = contenedor.current;
|
|
5851
6473
|
if (!elemento) return;
|
|
5852
6474
|
let vigente = true;
|
|
@@ -5877,49 +6499,49 @@ var PantallaBP = ({ nombre, direccion }) => {
|
|
|
5877
6499
|
elemento.replaceChildren();
|
|
5878
6500
|
};
|
|
5879
6501
|
}, [nombre, direccion, menu]);
|
|
5880
|
-
if (noExiste) return /* @__PURE__ */
|
|
6502
|
+
if (noExiste) return /* @__PURE__ */ jsx37(FallbackWScreen, { screenName: nombre });
|
|
5881
6503
|
return (
|
|
5882
6504
|
// el indicador de carga flota: si ocupara lugar, el contenido de backend-plus empezaría más abajo mientras carga y subiría al terminar
|
|
5883
|
-
/* @__PURE__ */
|
|
5884
|
-
cargando && /* @__PURE__ */
|
|
5885
|
-
error && /* @__PURE__ */
|
|
5886
|
-
/* @__PURE__ */
|
|
5887
|
-
/* @__PURE__ */
|
|
6505
|
+
/* @__PURE__ */ jsxs27(Box24, { sx: { position: "relative" }, children: [
|
|
6506
|
+
cargando && /* @__PURE__ */ jsx37(CircularProgress8, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
|
|
6507
|
+
error && /* @__PURE__ */ jsx37(Alert7, { severity: "error", sx: { m: 2 }, children: error }),
|
|
6508
|
+
/* @__PURE__ */ jsx37("div", { id: "main_layout", ref: contenedor }),
|
|
6509
|
+
/* @__PURE__ */ jsx37(ConsolaBP, {})
|
|
5888
6510
|
] })
|
|
5889
6511
|
);
|
|
5890
6512
|
};
|
|
5891
6513
|
var PantallaDeRespaldo = () => {
|
|
5892
6514
|
const { screenName = "" } = useParams4();
|
|
5893
|
-
const { search } =
|
|
6515
|
+
const { search } = useLocation7();
|
|
5894
6516
|
if (!puenteBPHabilitado()) {
|
|
5895
|
-
return /* @__PURE__ */
|
|
6517
|
+
return /* @__PURE__ */ jsx37(Box24, { sx: { p: 3 }, children: /* @__PURE__ */ jsx37(FallbackWScreen, { screenName }) });
|
|
5896
6518
|
}
|
|
5897
|
-
return /* @__PURE__ */
|
|
6519
|
+
return /* @__PURE__ */ jsx37(Navigate3, { to: rutaDePantallaBP(screenName, search), replace: true });
|
|
5898
6520
|
};
|
|
5899
6521
|
var PaginaBP = () => {
|
|
5900
|
-
const { hash, search } =
|
|
6522
|
+
const { hash, search } = useLocation7();
|
|
5901
6523
|
const direccion = hash || search;
|
|
5902
6524
|
const nombre = new URLSearchParams(direccion.replace(/^[#?]/, "")).get("w");
|
|
5903
|
-
if (!puenteBPHabilitado()) return /* @__PURE__ */
|
|
5904
|
-
if (!nombre) return /* @__PURE__ */
|
|
6525
|
+
if (!puenteBPHabilitado()) return /* @__PURE__ */ jsx37(Navigate3, { to: "/", replace: true });
|
|
6526
|
+
if (!nombre) return /* @__PURE__ */ jsx37(Box24, { sx: { p: 3 }, children: /* @__PURE__ */ jsxs27(Alert7, { severity: "warning", children: [
|
|
5905
6527
|
"Falta la pantalla de backend-plus (",
|
|
5906
|
-
/* @__PURE__ */
|
|
6528
|
+
/* @__PURE__ */ jsx37("code", { children: "#w=..." }),
|
|
5907
6529
|
")."
|
|
5908
6530
|
] }) });
|
|
5909
|
-
return /* @__PURE__ */
|
|
6531
|
+
return /* @__PURE__ */ jsx37(PantallaBP, { nombre, direccion }, nombre);
|
|
5910
6532
|
};
|
|
5911
6533
|
|
|
5912
6534
|
// src/puente/GrillaBP.tsx
|
|
5913
|
-
import { useEffect as
|
|
6535
|
+
import { useEffect as useEffect16, useRef as useRef11, useState as useState22 } from "react";
|
|
5914
6536
|
import { useParams as useParams5 } from "react-router-dom";
|
|
5915
6537
|
import { Alert as Alert8, Box as Box25, CircularProgress as CircularProgress9 } from "@mui/material";
|
|
5916
|
-
import { jsx as
|
|
6538
|
+
import { jsx as jsx38, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
5917
6539
|
var GrillaBP = ({ tabla, fixedFields }) => {
|
|
5918
|
-
const contenedor =
|
|
5919
|
-
const [cargando, setCargando] =
|
|
5920
|
-
const [error, setError] =
|
|
6540
|
+
const contenedor = useRef11(null);
|
|
6541
|
+
const [cargando, setCargando] = useState22(true);
|
|
6542
|
+
const [error, setError] = useState22(null);
|
|
5921
6543
|
const clave = JSON.stringify(fixedFields ?? []);
|
|
5922
|
-
|
|
6544
|
+
useEffect16(() => {
|
|
5923
6545
|
const elemento = contenedor.current;
|
|
5924
6546
|
if (!elemento) return;
|
|
5925
6547
|
let vigente = true;
|
|
@@ -5942,21 +6564,21 @@ var GrillaBP = ({ tabla, fixedFields }) => {
|
|
|
5942
6564
|
}, [tabla, clave]);
|
|
5943
6565
|
return (
|
|
5944
6566
|
// el indicador de carga flota: si ocupara lugar, el contenido de backend-plus empezaría más abajo mientras carga y subiría al terminar
|
|
5945
|
-
/* @__PURE__ */
|
|
5946
|
-
cargando && /* @__PURE__ */
|
|
5947
|
-
error && /* @__PURE__ */
|
|
5948
|
-
/* @__PURE__ */
|
|
5949
|
-
/* @__PURE__ */
|
|
6567
|
+
/* @__PURE__ */ jsxs28(Box25, { sx: { position: "relative" }, children: [
|
|
6568
|
+
cargando && /* @__PURE__ */ jsx38(CircularProgress9, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
|
|
6569
|
+
error && /* @__PURE__ */ jsx38(Alert8, { severity: "error", sx: { m: 2 }, children: error }),
|
|
6570
|
+
/* @__PURE__ */ jsx38("div", { ref: contenedor }),
|
|
6571
|
+
/* @__PURE__ */ jsx38(ConsolaBP, {})
|
|
5950
6572
|
] })
|
|
5951
6573
|
);
|
|
5952
6574
|
};
|
|
5953
6575
|
var PaginaGrillaBP = () => {
|
|
5954
6576
|
const { tableName = "" } = useParams5();
|
|
5955
|
-
return /* @__PURE__ */
|
|
6577
|
+
return /* @__PURE__ */ jsx38(GrillaBP, { tabla: tableName }, tableName);
|
|
5956
6578
|
};
|
|
5957
6579
|
|
|
5958
6580
|
// src/puente/CapturaBP.tsx
|
|
5959
|
-
import { useEffect as
|
|
6581
|
+
import { useEffect as useEffect17 } from "react";
|
|
5960
6582
|
import { useNavigate as useNavigate5 } from "react-router-dom";
|
|
5961
6583
|
|
|
5962
6584
|
// src/puente/capturaDeNavegacion.ts
|
|
@@ -6003,61 +6625,61 @@ function capturarNavegacionBP(urlBackend, navegar) {
|
|
|
6003
6625
|
// src/puente/CapturaBP.tsx
|
|
6004
6626
|
var CapturaBP = () => {
|
|
6005
6627
|
const navigate = useNavigate5();
|
|
6006
|
-
|
|
6628
|
+
useEffect17(() => capturarNavegacionBP(envConfig.backendUrl, navigate), [navigate]);
|
|
6007
6629
|
return null;
|
|
6008
6630
|
};
|
|
6009
6631
|
|
|
6010
6632
|
// src/App.tsx
|
|
6011
6633
|
import typeStore6 from "type-store";
|
|
6012
|
-
import { Fragment as
|
|
6634
|
+
import { Fragment as Fragment7, jsx as jsx39, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6013
6635
|
var LocationTracker = () => {
|
|
6014
|
-
const location =
|
|
6636
|
+
const location = useLocation8();
|
|
6015
6637
|
const dispatch = useAppDispatch();
|
|
6016
|
-
|
|
6638
|
+
useEffect18(() => {
|
|
6017
6639
|
dispatch(setCurrentPath(location.pathname + location.search));
|
|
6018
6640
|
}, [location, dispatch]);
|
|
6019
6641
|
return null;
|
|
6020
6642
|
};
|
|
6021
6643
|
function FrontendPlusReactRoutes({ myRoutes, myUnloggedRoutes, layout: Layout = MainLayout_default, unloggedLayout: UnloggedLayout }) {
|
|
6022
|
-
return /* @__PURE__ */
|
|
6023
|
-
/* @__PURE__ */
|
|
6024
|
-
puenteBPHabilitado() && /* @__PURE__ */
|
|
6025
|
-
/* @__PURE__ */
|
|
6026
|
-
/* @__PURE__ */
|
|
6027
|
-
/* @__PURE__ */
|
|
6028
|
-
/* @__PURE__ */
|
|
6644
|
+
return /* @__PURE__ */ jsxs29(Fragment7, { children: [
|
|
6645
|
+
/* @__PURE__ */ jsx39(InitialRedirectHandler_default, {}),
|
|
6646
|
+
puenteBPHabilitado() && /* @__PURE__ */ jsx39(CapturaBP, {}),
|
|
6647
|
+
/* @__PURE__ */ jsxs29(Routes, { children: [
|
|
6648
|
+
/* @__PURE__ */ jsxs29(Route, { element: UnloggedLayout ? /* @__PURE__ */ jsx39(UnloggedLayout, {}) : /* @__PURE__ */ jsx39(Outlet2, {}), children: [
|
|
6649
|
+
/* @__PURE__ */ jsx39(Route, { path: "/login", element: /* @__PURE__ */ jsx39(LoginPage_default, {}) }),
|
|
6650
|
+
/* @__PURE__ */ jsx39(Route, { path: "/logout", element: /* @__PURE__ */ jsx39(LogoutPage_default, {}) }),
|
|
6029
6651
|
myUnloggedRoutes
|
|
6030
6652
|
] }),
|
|
6031
|
-
/* @__PURE__ */
|
|
6032
|
-
/* @__PURE__ */
|
|
6033
|
-
/* @__PURE__ */
|
|
6034
|
-
/* @__PURE__ */
|
|
6035
|
-
/* @__PURE__ */
|
|
6036
|
-
Object.keys(wScreens).map((screenName) => /* @__PURE__ */
|
|
6653
|
+
/* @__PURE__ */ jsxs29(Route, { element: /* @__PURE__ */ jsx39(PrivateRoute_default, { children: /* @__PURE__ */ jsx39(Layout, {}) }), children: [
|
|
6654
|
+
/* @__PURE__ */ jsx39(Route, { path: "/", element: /* @__PURE__ */ jsx39(PantallaInicial_default, {}) }),
|
|
6655
|
+
/* @__PURE__ */ jsx39(Route, { path: "/table/:tableName", element: /* @__PURE__ */ jsx39(GenericDataGridPage_default, {}) }),
|
|
6656
|
+
/* @__PURE__ */ jsx39(Route, { path: "/menu/:menuName", element: /* @__PURE__ */ jsx39(MenuTablePage_default, {}) }),
|
|
6657
|
+
/* @__PURE__ */ jsx39(Route, { path: "/procedures/:procedureName", element: /* @__PURE__ */ jsx39(ProcedureForm_default, {}) }),
|
|
6658
|
+
Object.keys(wScreens).map((screenName) => /* @__PURE__ */ jsx39(
|
|
6037
6659
|
Route,
|
|
6038
6660
|
{
|
|
6039
6661
|
path: `/wScreens/${screenName}`,
|
|
6040
|
-
element: /* @__PURE__ */
|
|
6662
|
+
element: /* @__PURE__ */ jsx39(PantallaDeRuta, { screenName })
|
|
6041
6663
|
},
|
|
6042
6664
|
screenName
|
|
6043
6665
|
)),
|
|
6044
|
-
/* @__PURE__ */
|
|
6045
|
-
puenteBPHabilitado() && /* @__PURE__ */
|
|
6046
|
-
puenteBPHabilitado() && /* @__PURE__ */
|
|
6666
|
+
/* @__PURE__ */ jsx39(Route, { path: "/wScreens-fallback/:screenName", element: /* @__PURE__ */ jsx39(PantallaDeRespaldo, {}) }),
|
|
6667
|
+
puenteBPHabilitado() && /* @__PURE__ */ jsx39(Route, { path: "/bp/menu", element: /* @__PURE__ */ jsx39(PaginaBP, {}) }),
|
|
6668
|
+
puenteBPHabilitado() && /* @__PURE__ */ jsx39(Route, { path: "/bp/table/:tableName", element: /* @__PURE__ */ jsx39(PaginaGrillaBP, {}) }),
|
|
6047
6669
|
myRoutes,
|
|
6048
|
-
/* @__PURE__ */
|
|
6670
|
+
/* @__PURE__ */ jsx39(Route, { path: "*", element: /* @__PURE__ */ jsx39("div", { style: { marginTop: "20px", marginLeft: "10px" }, children: "404 - Recurso No Encontrado" }) })
|
|
6049
6671
|
] }),
|
|
6050
|
-
/* @__PURE__ */
|
|
6672
|
+
/* @__PURE__ */ jsx39(Route, { path: "*", element: /* @__PURE__ */ jsx39(Navigate4, { to: "/", replace: true }) })
|
|
6051
6673
|
] })
|
|
6052
6674
|
] });
|
|
6053
6675
|
}
|
|
6054
6676
|
var FrontendPlusProviders = ({ children, publicPaths }) => {
|
|
6055
|
-
return /* @__PURE__ */
|
|
6056
|
-
/* @__PURE__ */
|
|
6677
|
+
return /* @__PURE__ */ jsx39(Provider, { store, children: /* @__PURE__ */ jsx39(PersistGate, { loading: null, persistor, children: /* @__PURE__ */ jsxs29(BrowserRouter, { basename: rutaBase, children: [
|
|
6678
|
+
/* @__PURE__ */ jsx39(LocationTracker, {}),
|
|
6057
6679
|
" ",
|
|
6058
|
-
/* @__PURE__ */
|
|
6680
|
+
/* @__PURE__ */ jsx39(AppProvider, { publicPaths, children: /* @__PURE__ */ jsxs29(SnackbarProvider, { children: [
|
|
6059
6681
|
children,
|
|
6060
|
-
/* @__PURE__ */
|
|
6682
|
+
/* @__PURE__ */ jsx39(SessionExpiredMessage_default, {})
|
|
6061
6683
|
] }) })
|
|
6062
6684
|
] }) }) });
|
|
6063
6685
|
};
|
|
@@ -6071,7 +6693,7 @@ var App = ({
|
|
|
6071
6693
|
myConditions,
|
|
6072
6694
|
puenteBP
|
|
6073
6695
|
}) => {
|
|
6074
|
-
|
|
6696
|
+
useMemo16(() => {
|
|
6075
6697
|
if (myClientSides) {
|
|
6076
6698
|
extendClientSides(myClientSides);
|
|
6077
6699
|
}
|
|
@@ -6088,7 +6710,7 @@ var App = ({
|
|
|
6088
6710
|
habilitarPuenteBP();
|
|
6089
6711
|
}
|
|
6090
6712
|
}, [myClientSides, myResultsOk, myWScreens, myConditions, puenteBP]);
|
|
6091
|
-
|
|
6713
|
+
useEffect18(() => {
|
|
6092
6714
|
typeStore6.messages = typeStore6.i18n.messages.es;
|
|
6093
6715
|
typeStore6.locale = typeStore6.i18n.locale.es;
|
|
6094
6716
|
const link = document.querySelector("link[rel*='icon']") || document.createElement("link");
|
|
@@ -6097,11 +6719,11 @@ var App = ({
|
|
|
6097
6719
|
link.href = `${envConfig.backendUrl}/img/logo-128.png`;
|
|
6098
6720
|
document.getElementsByTagName("head")[0].appendChild(link);
|
|
6099
6721
|
}, []);
|
|
6100
|
-
const safePaths =
|
|
6722
|
+
const safePaths = React33.useMemo(() => {
|
|
6101
6723
|
const extracted = extractPathsFromRoutes(myUnloggedRoutes);
|
|
6102
6724
|
return ["/login", "/logout", ...extracted];
|
|
6103
6725
|
}, [myUnloggedRoutes]);
|
|
6104
|
-
return /* @__PURE__ */
|
|
6726
|
+
return /* @__PURE__ */ jsx39(FrontendPlusProviders, { publicPaths: safePaths, children: /* @__PURE__ */ jsx39(
|
|
6105
6727
|
FrontendPlusReactRoutes,
|
|
6106
6728
|
{
|
|
6107
6729
|
myRoutes,
|