frontend-plus-react 0.4.2 → 0.5.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 +26 -0
- package/README.md +8 -0
- package/dist/index.cjs +1207 -625
- 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 +1148 -566
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -59,7 +59,7 @@ __export(src_exports, {
|
|
|
59
59
|
module.exports = __toCommonJS(src_exports);
|
|
60
60
|
|
|
61
61
|
// src/components/grid/GenericDataGrid.tsx
|
|
62
|
-
var
|
|
62
|
+
var import_react25 = require("react");
|
|
63
63
|
var import_react_data_grid = require("react-data-grid");
|
|
64
64
|
var import_styles = require("react-data-grid/lib/styles.css");
|
|
65
65
|
|
|
@@ -378,7 +378,7 @@ var useApiCallWithoutSnackbar = () => {
|
|
|
378
378
|
};
|
|
379
379
|
|
|
380
380
|
// src/components/grid/GenericDataGrid.tsx
|
|
381
|
-
var
|
|
381
|
+
var import_material18 = require("@mui/material");
|
|
382
382
|
|
|
383
383
|
// src/store/index.ts
|
|
384
384
|
var import_toolkit4 = require("@reduxjs/toolkit");
|
|
@@ -1089,6 +1089,16 @@ var getBestTypedValue = (valor, typer) => {
|
|
|
1089
1089
|
}
|
|
1090
1090
|
return BestControls.text.getTypedValue(value, typer);
|
|
1091
1091
|
};
|
|
1092
|
+
var tiparEntrada = (valor, typer) => {
|
|
1093
|
+
const entrada = typeof valor === "string" && valor.trim() === "" && typer.typeName !== "text" ? "" : valor;
|
|
1094
|
+
const tipado = getBestTypedValue(entrada, typer);
|
|
1095
|
+
if (tipado === null && typeof entrada === "string" && entrada !== "") {
|
|
1096
|
+
throw new Error(`\xAB${valor}\xBB no es un valor v\xE1lido para este campo (${typer.typeName})`);
|
|
1097
|
+
}
|
|
1098
|
+
return tipado;
|
|
1099
|
+
};
|
|
1100
|
+
var caracterRechazado = (caracter, typer) => caracter.length === 1 && typer.rejectedChar(caracter);
|
|
1101
|
+
var textoPegadoRechazado = (texto, typer) => Array.from(texto).some((caracter) => typer.rejectedChar(caracter));
|
|
1092
1102
|
|
|
1093
1103
|
// src/hooks/grid/useGridDataView.ts
|
|
1094
1104
|
var MAXIMO_FILAS_EDICION_PUNTUAL = 3;
|
|
@@ -1130,6 +1140,22 @@ var useGridDataView = ({ tableData, tableDefinition }) => {
|
|
|
1130
1140
|
return !prev;
|
|
1131
1141
|
});
|
|
1132
1142
|
}, []);
|
|
1143
|
+
const aplicarFiltrosIniciales = (0, import_react6.useCallback)((condiciones2, definicion) => {
|
|
1144
|
+
const iniciales = {};
|
|
1145
|
+
condiciones2.forEach(({ column, operator, value }) => {
|
|
1146
|
+
const fieldDef = definicion.fields.find((f) => f.name === column);
|
|
1147
|
+
let texto = value === null || value === void 0 ? "" : String(value);
|
|
1148
|
+
if (fieldDef && value !== null && value !== void 0) {
|
|
1149
|
+
try {
|
|
1150
|
+
texto = import_type_store2.default.typerFrom(fieldDef).toLocalString(value);
|
|
1151
|
+
} catch (e) {
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
iniciales[column] = { operator, value: texto };
|
|
1155
|
+
});
|
|
1156
|
+
setFilters(iniciales);
|
|
1157
|
+
setIsFilterRowVisible(true);
|
|
1158
|
+
}, []);
|
|
1133
1159
|
const vistaAnteriorRef = (0, import_react6.useRef)(null);
|
|
1134
1160
|
const filteredRows = (0, import_react6.useMemo)(() => {
|
|
1135
1161
|
const anterior = vistaAnteriorRef.current;
|
|
@@ -1287,6 +1313,7 @@ var useGridDataView = ({ tableData, tableDefinition }) => {
|
|
|
1287
1313
|
setFilters,
|
|
1288
1314
|
isFilterRowVisible,
|
|
1289
1315
|
toggleFilterVisibility,
|
|
1316
|
+
aplicarFiltrosIniciales,
|
|
1290
1317
|
// Data
|
|
1291
1318
|
filteredRows,
|
|
1292
1319
|
summaryData,
|
|
@@ -1436,10 +1463,155 @@ function CeldaDetalle({ fila }) {
|
|
|
1436
1463
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: renderDetalle(fila) });
|
|
1437
1464
|
}
|
|
1438
1465
|
|
|
1466
|
+
// src/hooks/grid/teclasDeCelda.ts
|
|
1467
|
+
function direccionDeSalida(tecla, cursor, teclaAnterior) {
|
|
1468
|
+
if (tecla.ctrlKey || tecla.altKey || tecla.metaKey) return null;
|
|
1469
|
+
const conShift = !!tecla.shiftKey;
|
|
1470
|
+
switch (tecla.key) {
|
|
1471
|
+
case "Enter":
|
|
1472
|
+
return conShift ? null : "siguiente";
|
|
1473
|
+
case "Tab":
|
|
1474
|
+
return conShift ? "anterior" : "siguiente";
|
|
1475
|
+
case "ArrowUp":
|
|
1476
|
+
return conShift ? null : "arriba";
|
|
1477
|
+
case "ArrowDown":
|
|
1478
|
+
return conShift ? null : "abajo";
|
|
1479
|
+
case "ArrowLeft":
|
|
1480
|
+
return !conShift && (cursor.vacio || cursor.alPrincipio) ? "izquierda" : null;
|
|
1481
|
+
case "ArrowRight":
|
|
1482
|
+
return !conShift && (cursor.vacio || teclaAnterior === "ArrowRight" && cursor.alFinal) ? "derecha" : null;
|
|
1483
|
+
default:
|
|
1484
|
+
return null;
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
function posicionDelCursor(elemento) {
|
|
1488
|
+
if (elemento instanceof HTMLInputElement || elemento instanceof HTMLTextAreaElement) {
|
|
1489
|
+
const fin = elemento.selectionEnd ?? elemento.value.length;
|
|
1490
|
+
return { vacio: elemento.value === "", alPrincipio: fin === 0, alFinal: fin === elemento.value.length };
|
|
1491
|
+
}
|
|
1492
|
+
return { vacio: true, alPrincipio: true, alFinal: true };
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
// src/utils/fixedFields.ts
|
|
1496
|
+
function fijaElValor(fixedField) {
|
|
1497
|
+
return !fixedField.range && fixedField.until === void 0;
|
|
1498
|
+
}
|
|
1499
|
+
function valorFijoDe(fixedFields, columna) {
|
|
1500
|
+
return fixedFields?.find((f) => f.fieldName === columna && fijaElValor(f));
|
|
1501
|
+
}
|
|
1502
|
+
function columnaOcultaPorFixedField(fixedFields, columna) {
|
|
1503
|
+
const fijo = valorFijoDe(fixedFields, columna);
|
|
1504
|
+
return fijo !== void 0 && !fijo.show;
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
// src/utils/referencias.ts
|
|
1508
|
+
var esParDeCampos = (par) => typeof par === "object" && par !== null && "source" in par && "target" in par && typeof par.source === "string" && typeof par.target === "string";
|
|
1509
|
+
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);
|
|
1510
|
+
var camposDeNombre = (definicion) => {
|
|
1511
|
+
const comoTextos = (campos) => Array.isArray(campos) ? campos.filter((c) => typeof c === "string") : [];
|
|
1512
|
+
if (definicion.lookupFields && definicion.lookupFields.length > 0) return definicion.lookupFields;
|
|
1513
|
+
return "nameFields" in definicion ? comoTextos(definicion.nameFields) : [];
|
|
1514
|
+
};
|
|
1515
|
+
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;
|
|
1516
|
+
var comoTexto = (valor) => valor === null || valor === void 0 ? "" : String(valor);
|
|
1517
|
+
var opcionesDeReferencia = (campo, definicionReferenciada, filasReferenciadas, filaActual, admiteNulo) => {
|
|
1518
|
+
const pares = campo.referencesFields ?? [];
|
|
1519
|
+
const columnaDelValor = pares.length > 0 ? pares[pares.length - 1].target : definicionReferenciada.primaryKey[definicionReferenciada.primaryKey.length - 1];
|
|
1520
|
+
const anteriores = pares.slice(0, -1);
|
|
1521
|
+
const activo = campoDeActivo(definicionReferenciada);
|
|
1522
|
+
const nombres = camposDeNombre(definicionReferenciada);
|
|
1523
|
+
const columnasDeEtiqueta = nombres.length > 0 ? [...definicionReferenciada.primaryKey, ...nombres] : definicionReferenciada.primaryKey;
|
|
1524
|
+
const opciones = filasReferenciadas.filter((fila) => (activo === null || !!fila[activo]) && anteriores.every((par) => comoTexto(fila[par.target]) === comoTexto(filaActual[par.source]))).map((fila) => {
|
|
1525
|
+
const etiquetas = columnasDeEtiqueta.map((columna) => comoTexto(fila[columna]));
|
|
1526
|
+
return { valor: fila[columnaDelValor], etiquetas, texto: `${etiquetas.join(", ")}; ${definicionReferenciada.primaryKey.join(", ")}` };
|
|
1527
|
+
});
|
|
1528
|
+
const ordenar = new Intl.Collator("es", { numeric: true, sensitivity: "base" });
|
|
1529
|
+
opciones.sort((a, b) => ordenar.compare(a.texto, b.texto));
|
|
1530
|
+
if (admiteNulo) opciones.push({ valor: null, etiquetas: ["", "(vac\xEDo)"], texto: "" });
|
|
1531
|
+
return opciones;
|
|
1532
|
+
};
|
|
1533
|
+
var filtrarOpciones = (opciones, busqueda) => {
|
|
1534
|
+
const simplificar = (texto) => texto.normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase();
|
|
1535
|
+
const palabras = simplificar(busqueda).split(/\s+/).filter((p) => p !== "");
|
|
1536
|
+
if (palabras.length === 0) return opciones;
|
|
1537
|
+
return opciones.filter((opcion) => opcion.valor === null || palabras.every((p) => simplificar(opcion.etiquetas.join(" ")).includes(p)));
|
|
1538
|
+
};
|
|
1539
|
+
var VIGENCIA_DE_REFERENCIA_MS = 2 * 60 * 1e3;
|
|
1540
|
+
var referencias = /* @__PURE__ */ new Map();
|
|
1541
|
+
var cargarReferencia = (tabla) => {
|
|
1542
|
+
const guardada = referencias.get(tabla);
|
|
1543
|
+
if (guardada && Date.now() - guardada.cuando < VIGENCIA_DE_REFERENCIA_MS) return guardada.cargada;
|
|
1544
|
+
const cargada = (async () => {
|
|
1545
|
+
const [definicion, filas] = await Promise.all([
|
|
1546
|
+
executeBackendProcedure("table_structure", { table: tabla }),
|
|
1547
|
+
executeBackendProcedure("table_data", { table: tabla, fixedFields: [] })
|
|
1548
|
+
]);
|
|
1549
|
+
return { definicion: requerido(definicion, `la estructura de '${tabla}'`), filas: requerido(filas, `los datos de '${tabla}'`) };
|
|
1550
|
+
})();
|
|
1551
|
+
referencias.set(tabla, { cargada, cuando: Date.now() });
|
|
1552
|
+
cargada.catch(() => {
|
|
1553
|
+
if (referencias.get(tabla)?.cargada === cargada) referencias.delete(tabla);
|
|
1554
|
+
});
|
|
1555
|
+
return cargada;
|
|
1556
|
+
};
|
|
1557
|
+
|
|
1558
|
+
// src/utils/expanders.ts
|
|
1559
|
+
var tipoDeExpander = (campo, editable) => {
|
|
1560
|
+
if (campo.typeName === "jsonb" && !editable) return "json";
|
|
1561
|
+
if (editable) {
|
|
1562
|
+
if (esCampoConReferencia(campo)) return "referencia";
|
|
1563
|
+
if (campo.typeName === "boolean") return "booleano";
|
|
1564
|
+
if (campo.options && campo.options.length > 0) return "opciones";
|
|
1565
|
+
if (campo.typeName === "date") return "fecha";
|
|
1566
|
+
}
|
|
1567
|
+
return campo.clientSide ? null : "texto";
|
|
1568
|
+
};
|
|
1569
|
+
var SI_NO_VACIO = { si: "S\xED", no: "No", vacio: "(vac\xEDo)" };
|
|
1570
|
+
var opcionesDeBooleano = (admiteNulo) => {
|
|
1571
|
+
const opciones = [
|
|
1572
|
+
{ valor: true, etiquetas: [SI_NO_VACIO.si], texto: SI_NO_VACIO.si },
|
|
1573
|
+
{ valor: false, etiquetas: [SI_NO_VACIO.no], texto: SI_NO_VACIO.no }
|
|
1574
|
+
];
|
|
1575
|
+
if (admiteNulo) opciones.push({ valor: null, etiquetas: ["", SI_NO_VACIO.vacio], texto: "" });
|
|
1576
|
+
return opciones;
|
|
1577
|
+
};
|
|
1578
|
+
var opcionesDeEnumerado = (opciones, admiteNulo) => {
|
|
1579
|
+
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}` });
|
|
1580
|
+
if (admiteNulo) resultado.push({ valor: null, etiquetas: ["", SI_NO_VACIO.vacio], texto: "" });
|
|
1581
|
+
return resultado;
|
|
1582
|
+
};
|
|
1583
|
+
var fechaDeValor = (valor) => {
|
|
1584
|
+
if (valor instanceof Date && !isNaN(valor.getTime())) return { anio: valor.getFullYear(), mes: valor.getMonth(), dia: valor.getDate() };
|
|
1585
|
+
if (typeof valor === "string") {
|
|
1586
|
+
const partes = /^(\d{4})-(\d{2})-(\d{2})/.exec(valor);
|
|
1587
|
+
if (partes) return { anio: Number(partes[1]), mes: Number(partes[2]) - 1, dia: Number(partes[3]) };
|
|
1588
|
+
}
|
|
1589
|
+
return null;
|
|
1590
|
+
};
|
|
1591
|
+
var fechaATexto = ({ anio, mes, dia }) => `${String(anio).padStart(4, "0")}-${String(mes + 1).padStart(2, "0")}-${String(dia).padStart(2, "0")}`;
|
|
1592
|
+
var semanasDelMes = (anio, mes) => {
|
|
1593
|
+
const primero = new Date(anio, mes, 1);
|
|
1594
|
+
const desfase = (primero.getDay() + 6) % 7;
|
|
1595
|
+
const diasDelMes = new Date(anio, mes + 1, 0).getDate();
|
|
1596
|
+
const semanas = [];
|
|
1597
|
+
for (let celda = 0; celda < Math.ceil((desfase + diasDelMes) / 7) * 7; celda++) {
|
|
1598
|
+
const fecha = new Date(anio, mes, 1 - desfase + celda);
|
|
1599
|
+
const dia = { anio: fecha.getFullYear(), mes: fecha.getMonth(), dia: fecha.getDate(), delMesMostrado: fecha.getMonth() === mes };
|
|
1600
|
+
if (celda % 7 === 0) semanas.push([]);
|
|
1601
|
+
semanas[semanas.length - 1].push(dia);
|
|
1602
|
+
}
|
|
1603
|
+
return semanas;
|
|
1604
|
+
};
|
|
1605
|
+
var textoParaVer = (valor) => {
|
|
1606
|
+
if (valor === null || valor === void 0) return "";
|
|
1607
|
+
if (typeof valor === "object" && !(valor instanceof Date)) return JSON.stringify(valor, null, 2);
|
|
1608
|
+
return String(valor);
|
|
1609
|
+
};
|
|
1610
|
+
|
|
1439
1611
|
// src/hooks/grid/useGridEvents.ts
|
|
1440
1612
|
var VIGENCIA_TECLA_PENDIENTE = 400;
|
|
1441
1613
|
var VIGENCIA_VALOR_PENDIENTE_F4 = 1e3;
|
|
1442
|
-
var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fixedFields, setSelectedCell, setTableData, setSortColumns }) => {
|
|
1614
|
+
var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fixedFields, setSelectedCell, setTableData, setSortColumns, verContenido }) => {
|
|
1443
1615
|
const filteredRowsRef = (0, import_react8.useRef)(filteredRows);
|
|
1444
1616
|
filteredRowsRef.current = filteredRows;
|
|
1445
1617
|
const tableDefinitionRef = (0, import_react8.useRef)(tableDefinition);
|
|
@@ -1447,6 +1619,7 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1447
1619
|
const valoresF4Pendientes = (0, import_react8.useRef)(/* @__PURE__ */ new Map());
|
|
1448
1620
|
const teclasPendientes = (0, import_react8.useRef)([]);
|
|
1449
1621
|
const editorActivo = (0, import_react8.useRef)(null);
|
|
1622
|
+
const teclaAnteriorRef = (0, import_react8.useRef)(null);
|
|
1450
1623
|
const registrarEditor = (0, import_react8.useCallback)((procesar) => {
|
|
1451
1624
|
editorActivo.current = procesar;
|
|
1452
1625
|
const cola = teclasPendientes.current;
|
|
@@ -1457,7 +1630,8 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1457
1630
|
if (editorActivo.current === procesar) editorActivo.current = null;
|
|
1458
1631
|
};
|
|
1459
1632
|
}, []);
|
|
1460
|
-
const handleKeyPressInEditor = (0, import_react8.useCallback)((rowIndex, columnKey, event, currentColumns, handleCommit) => {
|
|
1633
|
+
const handleKeyPressInEditor = (0, import_react8.useCallback)((rowIndex, columnKey, event, currentColumns, handleCommit, valorActual) => {
|
|
1634
|
+
let resuelta = false;
|
|
1461
1635
|
const tableDefinition2 = tableDefinitionRef.current;
|
|
1462
1636
|
const filteredRows2 = filteredRowsRef.current;
|
|
1463
1637
|
if (dataGridRef.current && tableDefinition2) {
|
|
@@ -1467,7 +1641,9 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1467
1641
|
return col.key !== "actionsColumn" && !(esColumnaPropia(col) && col.customType === "detail") && (fieldDefinition?.editable !== false && !fieldDefinition?.clientSide);
|
|
1468
1642
|
});
|
|
1469
1643
|
const { key, target } = event;
|
|
1470
|
-
const
|
|
1644
|
+
const teclaAnterior = teclaAnteriorRef.current;
|
|
1645
|
+
teclaAnteriorRef.current = key;
|
|
1646
|
+
const direccion = direccionDeSalida(event, posicionDelCursor(target), teclaAnterior);
|
|
1471
1647
|
if (currentColumnIndex !== -1 && editableColumns.length > 0) {
|
|
1472
1648
|
const editableColumnKeys = editableColumns.map((col) => col.key);
|
|
1473
1649
|
let currentEditableColumnIndex = editableColumnKeys.indexOf(columnKey);
|
|
@@ -1491,57 +1667,42 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1491
1667
|
const nextColumnIndex = currentColumns.findIndex((col) => col.key === nextColumnKey);
|
|
1492
1668
|
return { rowIdx: nextRowIndex, idx: nextColumnIndex };
|
|
1493
1669
|
};
|
|
1494
|
-
const
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
const
|
|
1502
|
-
return { rowIdx:
|
|
1670
|
+
const indiceDeColumna = (indiceEditable) => currentColumns.findIndex((col) => col.key === editableColumnKeys[indiceEditable]);
|
|
1671
|
+
const calcularColumnaAnteriorConSalto = () => {
|
|
1672
|
+
if (currentEditableColumnIndex > 0) return { rowIdx: rowIndex, idx: indiceDeColumna(currentEditableColumnIndex - 1) };
|
|
1673
|
+
const filaAnterior = filaDeDatos(rowIndex, -1);
|
|
1674
|
+
return filaAnterior === -1 ? null : { rowIdx: filaAnterior, idx: indiceDeColumna(editableColumnKeys.length - 1) };
|
|
1675
|
+
};
|
|
1676
|
+
const calcularColumnaVecina = (paso) => {
|
|
1677
|
+
const vecina = currentEditableColumnIndex + paso;
|
|
1678
|
+
return vecina < 0 || vecina >= editableColumnKeys.length ? null : { rowIdx: rowIndex, idx: indiceDeColumna(vecina) };
|
|
1679
|
+
};
|
|
1680
|
+
const calcularFilaVecina = (paso) => {
|
|
1681
|
+
const vecina = filaDeDatos(rowIndex, paso);
|
|
1682
|
+
return vecina === -1 ? null : { rowIdx: vecina, idx: currentColumnIndex };
|
|
1503
1683
|
};
|
|
1504
1684
|
const calcularFilaSiguiente = () => {
|
|
1505
1685
|
const nextRowIndex = filaDeDatos(rowIndex, 1);
|
|
1506
1686
|
return { rowIdx: nextRowIndex === -1 ? rowIndex : nextRowIndex, idx: currentColumnIndex };
|
|
1507
1687
|
};
|
|
1508
|
-
const calcularFilaAnterior = () => {
|
|
1509
|
-
const nextRowIndex = filaDeDatos(rowIndex, -1);
|
|
1510
|
-
return { rowIdx: nextRowIndex === -1 ? rowIndex : nextRowIndex, idx: currentColumnIndex };
|
|
1511
|
-
};
|
|
1512
1688
|
if (currentEditableColumnIndex !== -1) {
|
|
1513
1689
|
switch (true) {
|
|
1514
|
-
case
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
}
|
|
1528
|
-
case key === "ArrowLeft": {
|
|
1529
|
-
if (input && typeof input.selectionStart === "number") {
|
|
1530
|
-
const cursorPosition = input.selectionStart;
|
|
1531
|
-
if (cursorPosition === 0) {
|
|
1532
|
-
hacerFoco(calcularColumnaAnterior());
|
|
1533
|
-
}
|
|
1690
|
+
case direccion !== null: {
|
|
1691
|
+
resuelta = true;
|
|
1692
|
+
const destino = {
|
|
1693
|
+
siguiente: calcularColumnaSiguiente,
|
|
1694
|
+
anterior: calcularColumnaAnteriorConSalto,
|
|
1695
|
+
izquierda: () => calcularColumnaVecina(-1),
|
|
1696
|
+
derecha: () => calcularColumnaVecina(1),
|
|
1697
|
+
arriba: () => calcularFilaVecina(-1),
|
|
1698
|
+
abajo: () => calcularFilaVecina(1)
|
|
1699
|
+
}[direccion]();
|
|
1700
|
+
if (destino) {
|
|
1701
|
+
void handleCommit(valorActual, true, true);
|
|
1702
|
+
hacerFoco(destino);
|
|
1534
1703
|
}
|
|
1535
1704
|
break;
|
|
1536
1705
|
}
|
|
1537
|
-
case key === "ArrowUp": {
|
|
1538
|
-
hacerFoco(calcularFilaAnterior());
|
|
1539
|
-
break;
|
|
1540
|
-
}
|
|
1541
|
-
case key === "ArrowDown": {
|
|
1542
|
-
hacerFoco(calcularFilaSiguiente());
|
|
1543
|
-
break;
|
|
1544
|
-
}
|
|
1545
1706
|
case key === "F4": {
|
|
1546
1707
|
const { rowIdx, idx } = calcularFilaSiguiente();
|
|
1547
1708
|
const indiceAnterior = filaDeDatos(rowIndex, -1);
|
|
@@ -1562,8 +1723,26 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1562
1723
|
}
|
|
1563
1724
|
}
|
|
1564
1725
|
}
|
|
1726
|
+
return resuelta;
|
|
1565
1727
|
}, [dataGridRef]);
|
|
1566
1728
|
const handleCellKeyDown = (0, import_react8.useCallback)((args, event) => {
|
|
1729
|
+
const esExpander = event.key === "F9" && !event.shiftKey && !event.ctrlKey && !event.altKey || event.key === "ArrowDown" && event.altKey && !event.shiftKey && !event.ctrlKey;
|
|
1730
|
+
if (esExpander && !(event.target instanceof HTMLInputElement) && !esFilaDetalle(args.row)) {
|
|
1731
|
+
const campo = tableDefinitionRef.current?.fields.find((f) => f.name === args.column.key);
|
|
1732
|
+
const editable = typeof args.column.editable === "function" ? args.column.editable(args.row) : args.column.editable === true;
|
|
1733
|
+
const tipo = campo ? tipoDeExpander(campo, editable) : null;
|
|
1734
|
+
if (campo && editable && tipo !== null) {
|
|
1735
|
+
teclasPendientes.current.push({ key: "F9", cuando: Date.now() });
|
|
1736
|
+
dataGridRef.current?.selectCell({ rowIdx: args.rowIdx, idx: args.column.idx }, { enableEditor: true, shouldFocusCell: true });
|
|
1737
|
+
event.preventGridDefault();
|
|
1738
|
+
return;
|
|
1739
|
+
}
|
|
1740
|
+
if (campo && !editable && (tipo === "json" || tipo === "texto") && verContenido && event.target instanceof HTMLElement) {
|
|
1741
|
+
verContenido(event.target, textoParaVer(args.row[campo.name]));
|
|
1742
|
+
event.preventGridDefault();
|
|
1743
|
+
return;
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1567
1746
|
if (event.key === "F4" && !(event.target instanceof HTMLInputElement) && !esFilaDetalle(args.row)) {
|
|
1568
1747
|
const fieldDefinition = tableDefinitionRef.current?.fields.find((f) => f.name === args.column.key);
|
|
1569
1748
|
if (fieldDefinition && fieldDefinition.editable !== false && !fieldDefinition.clientSide) {
|
|
@@ -1576,7 +1755,7 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1576
1755
|
if (["Enter", "Tab", "ArrowDown", "ArrowUp", "ArrowRight", "ArrowLeft"].includes(event.key)) {
|
|
1577
1756
|
event.preventGridDefault();
|
|
1578
1757
|
}
|
|
1579
|
-
}, []);
|
|
1758
|
+
}, [dataGridRef, verContenido]);
|
|
1580
1759
|
const handleCellMouseDown = (0, import_react8.useCallback)((_args, event) => {
|
|
1581
1760
|
event.preventGridDefault();
|
|
1582
1761
|
}, []);
|
|
@@ -1589,10 +1768,12 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1589
1768
|
const handleCellClick = (0, import_react8.useCallback)((args, _event) => {
|
|
1590
1769
|
if (esFilaDetalle(args.row)) return;
|
|
1591
1770
|
const fieldDefinition = tableDefinition?.fields.find((f) => f.name === args.column.key);
|
|
1592
|
-
const isFixedField = fixedFields
|
|
1771
|
+
const isFixedField = valorFijoDe(fixedFields, args.column.key) !== void 0;
|
|
1593
1772
|
const isEditable = fieldDefinition?.editable !== false && !isFixedField;
|
|
1594
1773
|
if (isEditable) {
|
|
1595
1774
|
args.selectCell(true);
|
|
1775
|
+
} else if (fieldDefinition && tipoDeExpander(fieldDefinition, false) !== null) {
|
|
1776
|
+
args.selectCell(false);
|
|
1596
1777
|
}
|
|
1597
1778
|
}, [tableDefinition, fixedFields]);
|
|
1598
1779
|
const handleRowsChange = (0, import_react8.useCallback)((updatedRows, data) => {
|
|
@@ -1765,7 +1946,7 @@ var useGridMenu = ({
|
|
|
1765
1946
|
};
|
|
1766
1947
|
|
|
1767
1948
|
// src/hooks/grid/useGridColumns.ts
|
|
1768
|
-
var
|
|
1949
|
+
var import_react21 = __toESM(require("react"), 1);
|
|
1769
1950
|
|
|
1770
1951
|
// src/utils/functions.tsx
|
|
1771
1952
|
var JSON4all2 = __toESM(require("json4all"), 1);
|
|
@@ -2206,8 +2387,7 @@ var defaultColumnSummaryCellRenderer = (props, fixedFields) => {
|
|
|
2206
2387
|
const { column, row } = props;
|
|
2207
2388
|
if (row.id === "filterRow") {
|
|
2208
2389
|
const { filters, setFilters } = row;
|
|
2209
|
-
|
|
2210
|
-
if (fixedFieldEntry && fixedFieldEntry.until === void 0) return null;
|
|
2390
|
+
if (valorFijoDe(fixedFields, column.key)) return null;
|
|
2211
2391
|
const fieldDef = esColumnaPropia(column) && column.customType === "default" ? column.fieldDef : void 0;
|
|
2212
2392
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material7.Box, { sx: { width: "100%", height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2213
2393
|
FilterInputRender_default,
|
|
@@ -2359,7 +2539,7 @@ var CeldaDato = import_react15.default.memo(function CeldaDato2({ row, columnKey
|
|
|
2359
2539
|
let cellBackgroundColor = "transparent";
|
|
2360
2540
|
if (currentCellFeedback) {
|
|
2361
2541
|
cellBackgroundColor = currentCellFeedback.type === "error" ? theme.palette.error.light : theme.palette.success.light;
|
|
2362
|
-
} else if (fixedFields
|
|
2542
|
+
} else if (valorFijoDe(fixedFields, columnKey)) {
|
|
2363
2543
|
cellBackgroundColor = theme.palette.action.selected;
|
|
2364
2544
|
} else if (isMandatory && !hasValue || pendiente) {
|
|
2365
2545
|
cellBackgroundColor = "#e3f2fd";
|
|
@@ -2455,14 +2635,13 @@ var allColumnsCellRenderer = (props) => {
|
|
|
2455
2635
|
};
|
|
2456
2636
|
|
|
2457
2637
|
// src/components/grid/InputRenderer.tsx
|
|
2458
|
-
var
|
|
2638
|
+
var import_react20 = __toESM(require("react"), 1);
|
|
2459
2639
|
|
|
2460
2640
|
// src/hooks/useTableRecordSave.ts
|
|
2461
2641
|
var import_react16 = require("react");
|
|
2462
2642
|
var useTableRecordSave = () => {
|
|
2463
2643
|
const { callApi, loading, error } = useApiCall();
|
|
2464
2644
|
const saveRecord = (0, import_react16.useCallback)(async ({
|
|
2465
|
-
tableName,
|
|
2466
2645
|
tableDefinition,
|
|
2467
2646
|
isNewRow,
|
|
2468
2647
|
formData,
|
|
@@ -2491,13 +2670,12 @@ var useTableRecordSave = () => {
|
|
|
2491
2670
|
}
|
|
2492
2671
|
});
|
|
2493
2672
|
}
|
|
2494
|
-
tableDefinition.primaryKey.forEach((pkField) => {
|
|
2495
|
-
rowToSend[pkField] = formData[pkField];
|
|
2496
|
-
});
|
|
2497
2673
|
}
|
|
2498
2674
|
const primaryKeyValuesForBackend = isNewRow ? [] : tableDefinition.primaryKey.map((key) => initialData[key]);
|
|
2499
2675
|
const response = await callApi("table_record_save", {
|
|
2500
|
-
|
|
2676
|
+
// como backend-plus (`depot.def.name`): el servidor busca la definición por este nombre. Una definición que guarda en
|
|
2677
|
+
// otra tabla (`tableName`, con campos de `table`) no existe con el nombre de la física: ahí faltarían sus campos
|
|
2678
|
+
table: tableDefinition.name,
|
|
2501
2679
|
primaryKeyValues: primaryKeyValuesForBackend,
|
|
2502
2680
|
newRow: rowToSend,
|
|
2503
2681
|
oldRow: isNewRow ? {} : initialData,
|
|
@@ -2510,9 +2688,207 @@ var useTableRecordSave = () => {
|
|
|
2510
2688
|
|
|
2511
2689
|
// src/components/grid/InputRenderer.tsx
|
|
2512
2690
|
var import_InputBase = __toESM(require("@mui/material/InputBase"), 1);
|
|
2691
|
+
var import_IconButton = __toESM(require("@mui/material/IconButton"), 1);
|
|
2692
|
+
var import_ArrowDropDown = __toESM(require("@mui/icons-material/ArrowDropDown"), 1);
|
|
2693
|
+
var import_CalendarMonth = __toESM(require("@mui/icons-material/CalendarMonth"), 1);
|
|
2694
|
+
var import_Search2 = __toESM(require("@mui/icons-material/Search"), 1);
|
|
2695
|
+
var import_material14 = require("@mui/material");
|
|
2696
|
+
|
|
2697
|
+
// src/components/grid/MenuDeOpciones.tsx
|
|
2698
|
+
var import_react17 = require("react");
|
|
2513
2699
|
var import_material11 = require("@mui/material");
|
|
2514
|
-
var import_type_store4 = __toESM(require("type-store"), 1);
|
|
2515
2700
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2701
|
+
function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar }) {
|
|
2702
|
+
const [busqueda, setBusqueda] = (0, import_react17.useState)(busquedaInicial);
|
|
2703
|
+
const [indice, setIndice] = (0, import_react17.useState)(0);
|
|
2704
|
+
const visibles = (0, import_react17.useMemo)(() => filtrarOpciones(opciones, busqueda), [opciones, busqueda]);
|
|
2705
|
+
const elegida = (0, import_react17.useRef)(null);
|
|
2706
|
+
(0, import_react17.useEffect)(() => {
|
|
2707
|
+
elegida.current?.scrollIntoView({ block: "nearest" });
|
|
2708
|
+
}, [indice, visibles]);
|
|
2709
|
+
const alApretar = (evento) => {
|
|
2710
|
+
if (evento.key === "ArrowDown") {
|
|
2711
|
+
setIndice((i) => Math.min(i + 1, visibles.length - 1));
|
|
2712
|
+
} else if (evento.key === "ArrowUp") {
|
|
2713
|
+
setIndice((i) => Math.max(i - 1, 0));
|
|
2714
|
+
} else if (evento.key === "Enter") {
|
|
2715
|
+
if (visibles[indice]) onElegir(visibles[indice].valor);
|
|
2716
|
+
} else if (evento.key === "F9" || evento.key === "Escape") {
|
|
2717
|
+
onCerrar();
|
|
2718
|
+
} else {
|
|
2719
|
+
return;
|
|
2720
|
+
}
|
|
2721
|
+
evento.preventDefault();
|
|
2722
|
+
evento.stopPropagation();
|
|
2723
|
+
};
|
|
2724
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2725
|
+
import_material11.Popover,
|
|
2726
|
+
{
|
|
2727
|
+
open: true,
|
|
2728
|
+
anchorEl: anclaje,
|
|
2729
|
+
onClose: onCerrar,
|
|
2730
|
+
disableRestoreFocus: true,
|
|
2731
|
+
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
2732
|
+
slotProps: { paper: { sx: { minWidth: 300, maxWidth: 520 } } },
|
|
2733
|
+
children: [
|
|
2734
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2735
|
+
import_material11.InputBase,
|
|
2736
|
+
{
|
|
2737
|
+
autoFocus: true,
|
|
2738
|
+
fullWidth: true,
|
|
2739
|
+
value: busqueda,
|
|
2740
|
+
onChange: (e) => {
|
|
2741
|
+
setBusqueda(e.target.value);
|
|
2742
|
+
setIndice(0);
|
|
2743
|
+
},
|
|
2744
|
+
onKeyDown: alApretar,
|
|
2745
|
+
placeholder: "buscar",
|
|
2746
|
+
sx: { px: 1, py: 0.5, fontSize: "0.8rem", borderBottom: "1px solid #ccc" },
|
|
2747
|
+
inputProps: { "aria-label": "buscar" }
|
|
2748
|
+
}
|
|
2749
|
+
),
|
|
2750
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_material11.List, { dense: true, disablePadding: true, sx: { maxHeight: 320, overflowY: "auto" }, role: "listbox", children: [
|
|
2751
|
+
visibles.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_material11.Typography, { variant: "body2", sx: { p: 1, color: "text.secondary" }, children: "sin coincidencias" }),
|
|
2752
|
+
visibles.map((opcion, i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2753
|
+
import_material11.ListItemButton,
|
|
2754
|
+
{
|
|
2755
|
+
ref: i === indice ? elegida : null,
|
|
2756
|
+
selected: i === indice,
|
|
2757
|
+
role: "option",
|
|
2758
|
+
onClick: () => onElegir(opcion.valor),
|
|
2759
|
+
sx: { gap: 2, py: 0.25, fontSize: "0.8rem" },
|
|
2760
|
+
children: opcion.etiquetas.map((etiqueta, j) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontWeight: j === 0 ? 600 : 400, minWidth: j === 0 ? 40 : void 0 }, children: etiqueta }, j))
|
|
2761
|
+
},
|
|
2762
|
+
i
|
|
2763
|
+
))
|
|
2764
|
+
] })
|
|
2765
|
+
]
|
|
2766
|
+
}
|
|
2767
|
+
);
|
|
2768
|
+
}
|
|
2769
|
+
|
|
2770
|
+
// src/components/grid/SelectorDeFecha.tsx
|
|
2771
|
+
var import_react18 = require("react");
|
|
2772
|
+
var import_material12 = require("@mui/material");
|
|
2773
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2774
|
+
var MESES = ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"];
|
|
2775
|
+
var DIAS = ["lu", "ma", "mi", "ju", "vi", "s\xE1", "do"];
|
|
2776
|
+
var mismaFecha = (a, b) => b !== null && a.anio === b.anio && a.mes === b.mes && a.dia === b.dia;
|
|
2777
|
+
var MOVIMIENTOS = {
|
|
2778
|
+
ArrowLeft: [-1, 0],
|
|
2779
|
+
ArrowRight: [1, 0],
|
|
2780
|
+
ArrowUp: [-7, 0],
|
|
2781
|
+
ArrowDown: [7, 0],
|
|
2782
|
+
PageUp: [0, -1],
|
|
2783
|
+
PageDown: [0, 1]
|
|
2784
|
+
};
|
|
2785
|
+
function SelectorDeFecha({ anclaje, fechaActual, admiteNulo, onElegir, onCerrar }) {
|
|
2786
|
+
const hoy = /* @__PURE__ */ new Date();
|
|
2787
|
+
const fechaDeHoy = { anio: hoy.getFullYear(), mes: hoy.getMonth(), dia: hoy.getDate() };
|
|
2788
|
+
const [cursor, setCursor] = (0, import_react18.useState)(fechaActual ?? fechaDeHoy);
|
|
2789
|
+
const mover = (dias, meses) => {
|
|
2790
|
+
const nueva = new Date(cursor.anio, cursor.mes + meses, cursor.dia + dias);
|
|
2791
|
+
setCursor({ anio: nueva.getFullYear(), mes: nueva.getMonth(), dia: nueva.getDate() });
|
|
2792
|
+
};
|
|
2793
|
+
const alApretar = (evento) => {
|
|
2794
|
+
if (evento.key in MOVIMIENTOS) {
|
|
2795
|
+
mover(...MOVIMIENTOS[evento.key]);
|
|
2796
|
+
} else if (evento.key === "Enter") {
|
|
2797
|
+
onElegir(fechaATexto(cursor));
|
|
2798
|
+
} else if (evento.key === "F9" || evento.key === "Escape") {
|
|
2799
|
+
onCerrar();
|
|
2800
|
+
} else {
|
|
2801
|
+
return;
|
|
2802
|
+
}
|
|
2803
|
+
evento.preventDefault();
|
|
2804
|
+
evento.stopPropagation();
|
|
2805
|
+
};
|
|
2806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Popover, { open: true, anchorEl: anclaje, onClose: onCerrar, disableRestoreFocus: true, anchorOrigin: { vertical: "bottom", horizontal: "left" }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { tabIndex: 0, ref: (el) => el?.focus(), onKeyDown: alApretar, style: { padding: 8, outline: "none", width: 252 }, "aria-label": "calendario", children: [
|
|
2807
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
2808
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.IconButton, { size: "small", "aria-label": "mes anterior", onClick: () => mover(0, -1), children: "\u2039" }),
|
|
2809
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Typography, { variant: "body2", sx: { fontWeight: 600 }, children: [
|
|
2810
|
+
MESES[cursor.mes],
|
|
2811
|
+
" ",
|
|
2812
|
+
cursor.anio
|
|
2813
|
+
] }),
|
|
2814
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.IconButton, { size: "small", "aria-label": "mes siguiente", onClick: () => mover(0, 1), children: "\u203A" })
|
|
2815
|
+
] }),
|
|
2816
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("table", { style: { borderCollapse: "collapse", width: "100%", textAlign: "center", fontSize: "0.8rem" }, children: [
|
|
2817
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tr", { children: DIAS.map((d) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("th", { style: { fontWeight: 400, color: "#777" }, children: d }, d)) }) }),
|
|
2818
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tbody", { children: semanasDelMes(cursor.anio, cursor.mes).map((semana, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tr", { children: semana.map((dia) => {
|
|
2819
|
+
const elegido = mismaFecha(dia, fechaActual);
|
|
2820
|
+
const enCursor = mismaFecha(dia, cursor);
|
|
2821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { style: { padding: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2822
|
+
"button",
|
|
2823
|
+
{
|
|
2824
|
+
type: "button",
|
|
2825
|
+
tabIndex: -1,
|
|
2826
|
+
onClick: () => onElegir(fechaATexto(dia)),
|
|
2827
|
+
style: {
|
|
2828
|
+
width: 32,
|
|
2829
|
+
height: 26,
|
|
2830
|
+
border: enCursor ? "1px solid #1976d2" : "1px solid transparent",
|
|
2831
|
+
borderRadius: 4,
|
|
2832
|
+
cursor: "pointer",
|
|
2833
|
+
background: elegido ? "#1976d2" : "transparent",
|
|
2834
|
+
color: elegido ? "#fff" : dia.delMesMostrado ? "#000" : "#aaa"
|
|
2835
|
+
},
|
|
2836
|
+
children: dia.dia
|
|
2837
|
+
}
|
|
2838
|
+
) }, `${dia.mes}-${dia.dia}`);
|
|
2839
|
+
}) }, i)) })
|
|
2840
|
+
] }),
|
|
2841
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", marginTop: 4 }, children: [
|
|
2842
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Button, { size: "small", onClick: () => onElegir(fechaATexto(fechaDeHoy)), children: "hoy" }),
|
|
2843
|
+
admiteNulo && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Button, { size: "small", onClick: () => onElegir(null), children: "vac\xEDo" })
|
|
2844
|
+
] })
|
|
2845
|
+
] }) });
|
|
2846
|
+
}
|
|
2847
|
+
|
|
2848
|
+
// src/components/grid/VentanaDeTexto.tsx
|
|
2849
|
+
var import_react19 = require("react");
|
|
2850
|
+
var import_material13 = require("@mui/material");
|
|
2851
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2852
|
+
function VentanaDeTexto({ anclaje, texto, editable, onAceptar, onCerrar }) {
|
|
2853
|
+
const [valor, setValor] = (0, import_react19.useState)(texto);
|
|
2854
|
+
const alApretar = (evento) => {
|
|
2855
|
+
if (evento.key === "Escape" || evento.key === "F9") {
|
|
2856
|
+
onCerrar();
|
|
2857
|
+
} else if (evento.key === "Enter" && evento.ctrlKey && editable) {
|
|
2858
|
+
onAceptar(valor);
|
|
2859
|
+
} else {
|
|
2860
|
+
return;
|
|
2861
|
+
}
|
|
2862
|
+
evento.preventDefault();
|
|
2863
|
+
evento.stopPropagation();
|
|
2864
|
+
};
|
|
2865
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material13.Popover, { open: true, anchorEl: anclaje, onClose: onCerrar, disableRestoreFocus: true, anchorOrigin: { vertical: "bottom", horizontal: "left" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { padding: 8, minWidth: 320, maxWidth: 640 }, children: [
|
|
2866
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2867
|
+
import_material13.InputBase,
|
|
2868
|
+
{
|
|
2869
|
+
autoFocus: true,
|
|
2870
|
+
multiline: true,
|
|
2871
|
+
fullWidth: true,
|
|
2872
|
+
readOnly: !editable,
|
|
2873
|
+
value: valor,
|
|
2874
|
+
onChange: (e) => setValor(e.target.value),
|
|
2875
|
+
onKeyDown: alApretar,
|
|
2876
|
+
minRows: 2,
|
|
2877
|
+
maxRows: 16,
|
|
2878
|
+
sx: { fontFamily: "monospace", fontSize: "0.8rem", border: "1px solid #ccc", borderRadius: "4px", p: 0.5 },
|
|
2879
|
+
inputProps: { "aria-label": "contenido de la celda" }
|
|
2880
|
+
}
|
|
2881
|
+
),
|
|
2882
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", justifyContent: "flex-end", gap: 8, marginTop: 4 }, children: [
|
|
2883
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material13.Button, { size: "small", onClick: onCerrar, children: "cancelar" }),
|
|
2884
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material13.Button, { size: "small", variant: "contained", onClick: () => onAceptar(valor), children: "aceptar" })
|
|
2885
|
+
] })
|
|
2886
|
+
] }) });
|
|
2887
|
+
}
|
|
2888
|
+
|
|
2889
|
+
// src/components/grid/InputRenderer.tsx
|
|
2890
|
+
var import_type_store4 = __toESM(require("type-store"), 1);
|
|
2891
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2516
2892
|
function findChangedValues(oldRowData, newRowData, isNewRow) {
|
|
2517
2893
|
let changes = [];
|
|
2518
2894
|
for (const key in newRowData) {
|
|
@@ -2538,13 +2914,15 @@ function InputRenderer({
|
|
|
2538
2914
|
const setCellFeedbackMap = estadoGrilla.setFeedback;
|
|
2539
2915
|
const setLocalCellChanges = estadoGrilla.setCambiosLocales;
|
|
2540
2916
|
const fieldDefinition = requerido(tableDefinition.fields.find((f) => f.name === column.key), `el campo '${column.key}'`);
|
|
2541
|
-
const typer = (0,
|
|
2542
|
-
const [editingValue, setEditingValue] = (0,
|
|
2543
|
-
const isCommitInProgress =
|
|
2544
|
-
const
|
|
2917
|
+
const typer = (0, import_react20.useMemo)(() => import_type_store4.default.typerFrom(fieldDefinition), [fieldDefinition]);
|
|
2918
|
+
const [editingValue, setEditingValue] = (0, import_react20.useState)(() => row[column.key] !== null ? isNumericType(fieldDefinition?.typeName) ? row[column.key] : typer.toLocalString(row[column.key]) : null);
|
|
2919
|
+
const isCommitInProgress = import_react20.default.useRef(false);
|
|
2920
|
+
const [expansion, setExpansion] = (0, import_react20.useState)(null);
|
|
2921
|
+
const menuAbierto = import_react20.default.useRef(false);
|
|
2922
|
+
const entradaRef = import_react20.default.useRef(null);
|
|
2923
|
+
const theme = (0, import_material14.useTheme)();
|
|
2545
2924
|
const { showSuccess, showError } = useSnackbar();
|
|
2546
2925
|
const { saveRecord } = useTableRecordSave();
|
|
2547
|
-
const tableName = tableDefinition.tableName;
|
|
2548
2926
|
const rowId = getPrimaryKeyValues(row, primaryKey);
|
|
2549
2927
|
const cellKey = `${rowId}-${column.key}`;
|
|
2550
2928
|
const currentCellFeedback = useFeedbackCelda(cellKey);
|
|
@@ -2556,16 +2934,18 @@ function InputRenderer({
|
|
|
2556
2934
|
cellBackgroundColor = currentCellFeedback.type === "error" ? theme.palette.error.light : theme.palette.success.light;
|
|
2557
2935
|
cellBorderColor = currentCellFeedback.type === "error" ? theme.palette.error.main : theme.palette.success.main;
|
|
2558
2936
|
}
|
|
2559
|
-
const initialRowId = (0,
|
|
2560
|
-
const handleCommit = (0,
|
|
2937
|
+
const initialRowId = (0, import_react20.useMemo)(() => getPrimaryKeyValues(row, primaryKey), [row, primaryKey]);
|
|
2938
|
+
const handleCommit = (0, import_react20.useCallback)(async (currentValue, closeEditor, focusNextCell) => {
|
|
2561
2939
|
if (isCommitInProgress.current) return;
|
|
2562
2940
|
isCommitInProgress.current = true;
|
|
2563
2941
|
let processedNewValue;
|
|
2564
2942
|
try {
|
|
2565
|
-
processedNewValue =
|
|
2943
|
+
processedNewValue = tiparEntrada(currentValue, typer);
|
|
2566
2944
|
typer.validateTypedData(processedNewValue);
|
|
2567
2945
|
} catch (err) {
|
|
2568
2946
|
showError(mensajeDeError(err));
|
|
2947
|
+
const claveDeLaCelda = `${getPrimaryKeyValues(row, tableDefinition.primaryKey)}-${column.key}`;
|
|
2948
|
+
setCellFeedbackMap((prev) => new Map(prev).set(claveDeLaCelda, { rowId: getPrimaryKeyValues(row, tableDefinition.primaryKey), columnKey: column.key, type: "error", message: mensajeDeError(err) }));
|
|
2569
2949
|
isCommitInProgress.current = false;
|
|
2570
2950
|
return;
|
|
2571
2951
|
}
|
|
@@ -2622,7 +3002,6 @@ function InputRenderer({
|
|
|
2622
3002
|
}
|
|
2623
3003
|
try {
|
|
2624
3004
|
const response = await saveRecord({
|
|
2625
|
-
tableName,
|
|
2626
3005
|
tableDefinition,
|
|
2627
3006
|
isNewRow,
|
|
2628
3007
|
formData: potentialUpdatedRow,
|
|
@@ -2688,7 +3067,6 @@ function InputRenderer({
|
|
|
2688
3067
|
column,
|
|
2689
3068
|
row,
|
|
2690
3069
|
onRowChange,
|
|
2691
|
-
tableName,
|
|
2692
3070
|
tableDefinition.primaryKey,
|
|
2693
3071
|
tableDefinition.fields,
|
|
2694
3072
|
showSuccess,
|
|
@@ -2700,42 +3078,94 @@ function InputRenderer({
|
|
|
2700
3078
|
initialRowId,
|
|
2701
3079
|
typer
|
|
2702
3080
|
]);
|
|
2703
|
-
const
|
|
3081
|
+
const tipoExpander = tipoDeExpander(fieldDefinition, fieldDefinition.editable !== false);
|
|
3082
|
+
const abrirExpander = (0, import_react20.useCallback)(async (busqueda) => {
|
|
3083
|
+
if (tipoExpander === null || tipoExpander === "json" || menuAbierto.current) return;
|
|
3084
|
+
menuAbierto.current = true;
|
|
3085
|
+
const admiteNulo = fieldDefinition.nullable !== false;
|
|
3086
|
+
try {
|
|
3087
|
+
if (tipoExpander === "referencia" && esCampoConReferencia(fieldDefinition)) {
|
|
3088
|
+
const { definicion, filas } = await cargarReferencia(fieldDefinition.references);
|
|
3089
|
+
setExpansion({ tipo: "opciones", opciones: opcionesDeReferencia(fieldDefinition, definicion, filas, row, admiteNulo), busqueda });
|
|
3090
|
+
} else if (tipoExpander === "booleano") {
|
|
3091
|
+
setExpansion({ tipo: "opciones", opciones: opcionesDeBooleano(admiteNulo), busqueda });
|
|
3092
|
+
} else if (tipoExpander === "opciones") {
|
|
3093
|
+
setExpansion({ tipo: "opciones", opciones: opcionesDeEnumerado(fieldDefinition.options ?? [], admiteNulo), busqueda });
|
|
3094
|
+
} else {
|
|
3095
|
+
setExpansion({ tipo: tipoExpander === "fecha" ? "fecha" : "texto" });
|
|
3096
|
+
}
|
|
3097
|
+
} catch (err) {
|
|
3098
|
+
menuAbierto.current = false;
|
|
3099
|
+
showError(mensajeDeError(err));
|
|
3100
|
+
}
|
|
3101
|
+
}, [tipoExpander, fieldDefinition, row, showError]);
|
|
3102
|
+
const cerrarExpansion = (0, import_react20.useCallback)(() => {
|
|
3103
|
+
menuAbierto.current = false;
|
|
3104
|
+
setExpansion(null);
|
|
3105
|
+
setTimeout(() => entradaRef.current?.focus(), 0);
|
|
3106
|
+
}, []);
|
|
3107
|
+
const confirmarEnExpansion = (0, import_react20.useCallback)((nuevo) => {
|
|
3108
|
+
setEditingValue(nuevo);
|
|
3109
|
+
cerrarExpansion();
|
|
3110
|
+
void handleCommit(nuevo, true, false);
|
|
3111
|
+
}, [cerrarExpansion, handleCommit]);
|
|
3112
|
+
const elegirOpcion = (0, import_react20.useCallback)((valor) => {
|
|
3113
|
+
confirmarEnExpansion(valor === null || valor === void 0 ? null : typeof valor === "boolean" || isNumericType(fieldDefinition.typeName) ? valor : typer.toLocalString(valor));
|
|
3114
|
+
}, [fieldDefinition.typeName, typer, confirmarEnExpansion]);
|
|
3115
|
+
const handleKeyDown = (0, import_react20.useCallback)(async (event) => {
|
|
3116
|
+
if (tipoExpander !== null && (event.key === "F9" && !event.shiftKey && !event.ctrlKey && !event.altKey || event.key === "ArrowDown" && event.altKey && !event.shiftKey && !event.ctrlKey)) {
|
|
3117
|
+
event.preventDefault();
|
|
3118
|
+
void abrirExpander("");
|
|
3119
|
+
return;
|
|
3120
|
+
}
|
|
3121
|
+
if (event.key.length === 1 && !event.ctrlKey && !event.altKey && !event.metaKey && caracterRechazado(event.key, typer)) {
|
|
3122
|
+
event.preventDefault();
|
|
3123
|
+
if (tipoExpander === "referencia") void abrirExpander(event.key);
|
|
3124
|
+
return;
|
|
3125
|
+
}
|
|
2704
3126
|
if (event.key === "F4") {
|
|
2705
3127
|
event.preventDefault();
|
|
2706
3128
|
if (onKeyPress) {
|
|
2707
|
-
onKeyPress(rowIdx, column.key, event, handleCommit);
|
|
3129
|
+
onKeyPress(rowIdx, column.key, event, handleCommit, editingValue);
|
|
2708
3130
|
}
|
|
2709
3131
|
return;
|
|
2710
3132
|
}
|
|
2711
|
-
if (
|
|
2712
|
-
|
|
2713
|
-
if (onKeyPress) {
|
|
2714
|
-
onKeyPress(rowIdx, column.key, event, handleCommit);
|
|
2715
|
-
}
|
|
3133
|
+
if (onKeyPress?.(rowIdx, column.key, event, handleCommit, editingValue)) {
|
|
3134
|
+
event.preventDefault();
|
|
2716
3135
|
}
|
|
2717
|
-
}, [handleCommit, editingValue, column.key, rowIdx, onKeyPress]);
|
|
2718
|
-
const procesarTecla =
|
|
3136
|
+
}, [handleCommit, editingValue, column.key, rowIdx, onKeyPress, tipoExpander, abrirExpander, typer]);
|
|
3137
|
+
const procesarTecla = import_react20.default.useRef(() => {
|
|
2719
3138
|
});
|
|
2720
3139
|
procesarTecla.current = (key) => {
|
|
2721
|
-
if (key === "
|
|
2722
|
-
|
|
3140
|
+
if (key === "F9") {
|
|
3141
|
+
void abrirExpander("");
|
|
3142
|
+
} else if (key === "F4" && onKeyPress) {
|
|
3143
|
+
onKeyPress(rowIdx, column.key, { key, target: document.activeElement ?? document.body }, handleCommit, editingValue);
|
|
2723
3144
|
}
|
|
2724
3145
|
};
|
|
2725
|
-
(0,
|
|
2726
|
-
const handleBlur = (0,
|
|
3146
|
+
(0, import_react20.useEffect)(() => registrarEditor?.((key) => procesarTecla.current(key)), []);
|
|
3147
|
+
const handleBlur = (0, import_react20.useCallback)(() => {
|
|
3148
|
+
if (menuAbierto.current) return;
|
|
2727
3149
|
handleCommit(editingValue, true, false);
|
|
2728
3150
|
}, [handleCommit, editingValue]);
|
|
2729
3151
|
const isFieldEditable = fieldDefinition?.editable !== false;
|
|
2730
3152
|
const isNumeric = isNumericType(fieldDefinition?.typeName);
|
|
2731
|
-
const editor = /* @__PURE__ */ (0,
|
|
3153
|
+
const editor = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2732
3154
|
import_InputBase.default,
|
|
2733
3155
|
{
|
|
2734
3156
|
autoFocus: true,
|
|
2735
3157
|
value: editingValue,
|
|
2736
3158
|
onChange: (e) => setEditingValue(e.target.value),
|
|
2737
3159
|
onKeyDown: handleKeyDown,
|
|
3160
|
+
onPaste: (e) => {
|
|
3161
|
+
const pegado = e.clipboardData.getData("text");
|
|
3162
|
+
if (textoPegadoRechazado(pegado, typer)) {
|
|
3163
|
+
e.preventDefault();
|
|
3164
|
+
showError(`\xAB${pegado}\xBB no es un valor v\xE1lido para este campo (${typer.typeName})`);
|
|
3165
|
+
}
|
|
3166
|
+
},
|
|
2738
3167
|
onBlur: handleBlur,
|
|
3168
|
+
inputRef: entradaRef,
|
|
2739
3169
|
placeholder: isMandatory ? "*" : "",
|
|
2740
3170
|
className: editingValue === "--" ? "typed-controls-signal-no-data" : editingValue === "//" ? "typed-controls-signal-unknown-data" : "",
|
|
2741
3171
|
sx: {
|
|
@@ -2752,15 +3182,62 @@ function InputRenderer({
|
|
|
2752
3182
|
}
|
|
2753
3183
|
},
|
|
2754
3184
|
onClick: (e) => e.stopPropagation(),
|
|
2755
|
-
disabled: !isFieldEditable
|
|
3185
|
+
disabled: !isFieldEditable,
|
|
3186
|
+
endAdornment: tipoExpander !== null && tipoExpander !== "json" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3187
|
+
import_IconButton.default,
|
|
3188
|
+
{
|
|
3189
|
+
size: "small",
|
|
3190
|
+
tabIndex: -1,
|
|
3191
|
+
"aria-label": tipoExpander === "fecha" ? "elegir fecha" : tipoExpander === "texto" ? "ver el contenido completo" : "elegir un valor",
|
|
3192
|
+
title: tipoExpander === "fecha" ? "elegir fecha (F9)" : tipoExpander === "texto" ? "ver el contenido completo (F9)" : "elegir un valor (F9)",
|
|
3193
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
3194
|
+
onClick: (e) => {
|
|
3195
|
+
e.stopPropagation();
|
|
3196
|
+
void abrirExpander("");
|
|
3197
|
+
},
|
|
3198
|
+
sx: { p: 0, ml: 0.25, color: "primary.main", "&:hover": { backgroundColor: "action.hover" } },
|
|
3199
|
+
children: tipoExpander === "fecha" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_CalendarMonth.default, { sx: { fontSize: 16 } }) : tipoExpander === "texto" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_Search2.default, { sx: { fontSize: 16 } }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_ArrowDropDown.default, { sx: { fontSize: 20 } })
|
|
3200
|
+
}
|
|
3201
|
+
)
|
|
2756
3202
|
}
|
|
2757
3203
|
);
|
|
2758
|
-
|
|
3204
|
+
const conMenu = /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
3205
|
+
editor,
|
|
3206
|
+
expansion && entradaRef.current && (expansion.tipo === "opciones" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3207
|
+
MenuDeOpciones,
|
|
3208
|
+
{
|
|
3209
|
+
anclaje: entradaRef.current,
|
|
3210
|
+
opciones: expansion.opciones,
|
|
3211
|
+
busquedaInicial: expansion.busqueda,
|
|
3212
|
+
onElegir: elegirOpcion,
|
|
3213
|
+
onCerrar: cerrarExpansion
|
|
3214
|
+
}
|
|
3215
|
+
) : expansion.tipo === "fecha" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3216
|
+
SelectorDeFecha,
|
|
3217
|
+
{
|
|
3218
|
+
anclaje: entradaRef.current,
|
|
3219
|
+
fechaActual: fechaDeValor(row[column.key]),
|
|
3220
|
+
admiteNulo: fieldDefinition.nullable !== false,
|
|
3221
|
+
onElegir: confirmarEnExpansion,
|
|
3222
|
+
onCerrar: cerrarExpansion
|
|
3223
|
+
}
|
|
3224
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3225
|
+
VentanaDeTexto,
|
|
3226
|
+
{
|
|
3227
|
+
anclaje: entradaRef.current,
|
|
3228
|
+
texto: editingValue === null || editingValue === void 0 ? "" : String(editingValue),
|
|
3229
|
+
editable: true,
|
|
3230
|
+
onAceptar: confirmarEnExpansion,
|
|
3231
|
+
onCerrar: cerrarExpansion
|
|
3232
|
+
}
|
|
3233
|
+
))
|
|
3234
|
+
] });
|
|
3235
|
+
return currentCellFeedback?.message ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material14.Tooltip, { title: currentCellFeedback.message, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { width: "100%" }, children: conMenu }) }) : conMenu;
|
|
2759
3236
|
}
|
|
2760
3237
|
var InputRenderer_default = InputRenderer;
|
|
2761
3238
|
|
|
2762
3239
|
// src/components/grid/renderers/editCellRenderers.tsx
|
|
2763
|
-
var
|
|
3240
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2764
3241
|
var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
2765
3242
|
const column = props.column;
|
|
2766
3243
|
if (!esColumnaPropia(column)) return void 0;
|
|
@@ -2777,17 +3254,17 @@ var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
|
2777
3254
|
} = defaultColumn;
|
|
2778
3255
|
if (column.editable) {
|
|
2779
3256
|
const fieldDefinition = tableDefinition.fields.find((f) => f.name === column.key);
|
|
2780
|
-
const isFixedField = fixedFields
|
|
3257
|
+
const isFixedField = valorFijoDe(fixedFields, column.key) !== void 0;
|
|
2781
3258
|
const isFieldEditableByUI = fieldDefinition?.editable !== false && !isFixedField;
|
|
2782
3259
|
if (!isFieldEditableByUI) {
|
|
2783
3260
|
return void 0;
|
|
2784
3261
|
}
|
|
2785
|
-
return /* @__PURE__ */ (0,
|
|
3262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2786
3263
|
InputRenderer_default,
|
|
2787
3264
|
{
|
|
2788
3265
|
...props,
|
|
2789
3266
|
tableDefinition,
|
|
2790
|
-
onKeyPress: (rowIndex, columnKey, event, handleCommit) => handleKeyPressInEditor(rowIndex, columnKey, event, allColumns, handleCommit),
|
|
3267
|
+
onKeyPress: (rowIndex, columnKey, event, handleCommit, valorActual) => handleKeyPressInEditor(rowIndex, columnKey, event, allColumns, handleCommit, valorActual),
|
|
2791
3268
|
registrarEditor,
|
|
2792
3269
|
setTableData,
|
|
2793
3270
|
primaryKey
|
|
@@ -2813,6 +3290,10 @@ var calcularAnchosDeColumnas = (tableDefinition, filas) => {
|
|
|
2813
3290
|
const anchos = /* @__PURE__ */ new Map();
|
|
2814
3291
|
const muestra = filas.slice(0, 50);
|
|
2815
3292
|
tableDefinition.fields.forEach((fieldDef) => {
|
|
3293
|
+
if (typeof fieldDef.width === "number" && fieldDef.width > 0) {
|
|
3294
|
+
anchos.set(fieldDef.name, fieldDef.width);
|
|
3295
|
+
return;
|
|
3296
|
+
}
|
|
2816
3297
|
const headerLabel = fieldDef.label || fieldDef.name;
|
|
2817
3298
|
const type = fieldDef.typeName?.toLowerCase() || "";
|
|
2818
3299
|
let typeMinWidth = 60;
|
|
@@ -2850,14 +3331,13 @@ var useGridColumns = ({
|
|
|
2850
3331
|
toggleFilterVisibility,
|
|
2851
3332
|
abrirOpcionesDeGrilla
|
|
2852
3333
|
}) => {
|
|
2853
|
-
const columns = (0,
|
|
3334
|
+
const columns = (0, import_react21.useMemo)(() => {
|
|
2854
3335
|
if (!tableDefinition) return [];
|
|
2855
3336
|
const fieldsToShow = tableDefinition.fields.filter((field) => {
|
|
2856
|
-
|
|
2857
|
-
return !isFixedField && field.visible !== false;
|
|
3337
|
+
return !columnaOcultaPorFixedField(fixedFields, field.name) && field.visible !== false;
|
|
2858
3338
|
});
|
|
2859
3339
|
const defaultColumns = fieldsToShow.map((fieldDef) => {
|
|
2860
|
-
const isFixedField = fixedFields
|
|
3340
|
+
const isFixedField = valorFijoDe(fixedFields, fieldDef.name) !== void 0;
|
|
2861
3341
|
const isFieldEditable = fieldDef.editable !== false && !isFixedField;
|
|
2862
3342
|
const colWidth = anchosCalculados.get(fieldDef.name) ?? estimateTextWidth(fieldDef.label || fieldDef.name) + 20;
|
|
2863
3343
|
const column = {
|
|
@@ -2902,7 +3382,7 @@ var useGridColumns = ({
|
|
|
2902
3382
|
editable: false,
|
|
2903
3383
|
resizable: false,
|
|
2904
3384
|
sortable: false,
|
|
2905
|
-
renderHeaderCell: () =>
|
|
3385
|
+
renderHeaderCell: () => import_react21.default.createElement(ActionsColumnHeaderCell, {
|
|
2906
3386
|
toggleFilterVisibility,
|
|
2907
3387
|
handleDataGridOptions: (e) => abrirOpcionesDeGrilla(e.currentTarget),
|
|
2908
3388
|
handleAddRow,
|
|
@@ -2936,7 +3416,9 @@ var useGridColumns = ({
|
|
|
2936
3416
|
return allColumns.map((col) => ({
|
|
2937
3417
|
...col,
|
|
2938
3418
|
colSpan: col.customType === "action" ? colSpanDetalle : col.colSpan,
|
|
2939
|
-
|
|
3419
|
+
// el editor guarda por su cuenta (Enter, Tab, flechas y, al perder el foco, el clic afuera): con commitOnOutsideClick react-data-grid
|
|
3420
|
+
// lo cierra sin guardar y los menús (F9), que son un modal, cuentan como «afuera»
|
|
3421
|
+
editorOptions: { closeOnExternalRowChange: false, commitOnOutsideClick: false },
|
|
2940
3422
|
renderEditCell: (props) => allColumnsEditCellRenderer(props, allColumns),
|
|
2941
3423
|
renderCell: (props) => allColumnsCellRenderer(props)
|
|
2942
3424
|
}));
|
|
@@ -2945,13 +3427,13 @@ var useGridColumns = ({
|
|
|
2945
3427
|
};
|
|
2946
3428
|
|
|
2947
3429
|
// src/components/grid/ImportDialog.tsx
|
|
2948
|
-
var
|
|
2949
|
-
var
|
|
3430
|
+
var import_react22 = require("react");
|
|
3431
|
+
var import_material15 = require("@mui/material");
|
|
2950
3432
|
var import_FileUpload2 = __toESM(require("@mui/icons-material/FileUpload"), 1);
|
|
2951
|
-
var
|
|
3433
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2952
3434
|
var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
2953
|
-
const [file, setFile] = (0,
|
|
2954
|
-
const [options, setOptions] = (0,
|
|
3435
|
+
const [file, setFile] = (0, import_react22.useState)(null);
|
|
3436
|
+
const [options, setOptions] = (0, import_react22.useState)({
|
|
2955
3437
|
skipUnknownFieldsAtImport: false,
|
|
2956
3438
|
simplificateSpaces: true,
|
|
2957
3439
|
replaceNewLineWithSpace: true
|
|
@@ -2970,16 +3452,16 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
2970
3452
|
onClose();
|
|
2971
3453
|
}
|
|
2972
3454
|
};
|
|
2973
|
-
return /* @__PURE__ */ (0,
|
|
2974
|
-
/* @__PURE__ */ (0,
|
|
2975
|
-
/* @__PURE__ */ (0,
|
|
3455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material15.Dialog, { open, onClose: loading ? void 0 : onClose, maxWidth: "sm", fullWidth: true, children: [
|
|
3456
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material15.DialogTitle, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
3457
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_FileUpload2.default, { color: "primary" }),
|
|
2976
3458
|
"Importar datos desde archivo"
|
|
2977
3459
|
] }),
|
|
2978
|
-
/* @__PURE__ */ (0,
|
|
2979
|
-
/* @__PURE__ */ (0,
|
|
2980
|
-
/* @__PURE__ */ (0,
|
|
2981
|
-
/* @__PURE__ */ (0,
|
|
2982
|
-
|
|
3460
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.DialogContent, { dividers: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material15.Stack, { spacing: 3, sx: { mt: 1 }, children: [
|
|
3461
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material15.Box, { children: [
|
|
3462
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.Typography, { variant: "subtitle2", gutterBottom: true, fontWeight: "bold", children: "Seleccionar archivo" }),
|
|
3463
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3464
|
+
import_material15.Box,
|
|
2983
3465
|
{
|
|
2984
3466
|
sx: {
|
|
2985
3467
|
border: "1px dashed",
|
|
@@ -2991,7 +3473,7 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
2991
3473
|
position: "relative"
|
|
2992
3474
|
},
|
|
2993
3475
|
children: [
|
|
2994
|
-
/* @__PURE__ */ (0,
|
|
3476
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2995
3477
|
"input",
|
|
2996
3478
|
{
|
|
2997
3479
|
type: "file",
|
|
@@ -3008,69 +3490,69 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3008
3490
|
}
|
|
3009
3491
|
}
|
|
3010
3492
|
),
|
|
3011
|
-
/* @__PURE__ */ (0,
|
|
3493
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.Typography, { variant: "body2", color: file ? "textPrimary" : "textSecondary", children: file ? file.name : "Haz clic aqu\xED para seleccionar un archivo" })
|
|
3012
3494
|
]
|
|
3013
3495
|
}
|
|
3014
3496
|
)
|
|
3015
3497
|
] }),
|
|
3016
|
-
/* @__PURE__ */ (0,
|
|
3017
|
-
/* @__PURE__ */ (0,
|
|
3018
|
-
/* @__PURE__ */ (0,
|
|
3019
|
-
/* @__PURE__ */ (0,
|
|
3020
|
-
/* @__PURE__ */ (0,
|
|
3021
|
-
|
|
3498
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.Divider, {}),
|
|
3499
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material15.Box, { children: [
|
|
3500
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.Typography, { variant: "subtitle2", gutterBottom: true, fontWeight: "bold", children: "Opciones de importaci\xF3n" }),
|
|
3501
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material15.Stack, { children: [
|
|
3502
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3503
|
+
import_material15.FormControlLabel,
|
|
3022
3504
|
{
|
|
3023
|
-
control: /* @__PURE__ */ (0,
|
|
3024
|
-
|
|
3505
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3506
|
+
import_material15.Checkbox,
|
|
3025
3507
|
{
|
|
3026
3508
|
checked: options.skipUnknownFieldsAtImport,
|
|
3027
3509
|
onChange: handleOptionChange("skipUnknownFieldsAtImport"),
|
|
3028
3510
|
size: "small"
|
|
3029
3511
|
}
|
|
3030
3512
|
),
|
|
3031
|
-
label: /* @__PURE__ */ (0,
|
|
3513
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.Typography, { variant: "body2", children: "Omitir campos desconocidos al importar" })
|
|
3032
3514
|
}
|
|
3033
3515
|
),
|
|
3034
|
-
/* @__PURE__ */ (0,
|
|
3035
|
-
|
|
3516
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3517
|
+
import_material15.FormControlLabel,
|
|
3036
3518
|
{
|
|
3037
|
-
control: /* @__PURE__ */ (0,
|
|
3038
|
-
|
|
3519
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3520
|
+
import_material15.Checkbox,
|
|
3039
3521
|
{
|
|
3040
3522
|
checked: options.simplificateSpaces,
|
|
3041
3523
|
onChange: handleOptionChange("simplificateSpaces"),
|
|
3042
3524
|
size: "small"
|
|
3043
3525
|
}
|
|
3044
3526
|
),
|
|
3045
|
-
label: /* @__PURE__ */ (0,
|
|
3527
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.Typography, { variant: "body2", children: "Simplificar espacios" })
|
|
3046
3528
|
}
|
|
3047
3529
|
),
|
|
3048
|
-
/* @__PURE__ */ (0,
|
|
3049
|
-
|
|
3530
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3531
|
+
import_material15.FormControlLabel,
|
|
3050
3532
|
{
|
|
3051
|
-
control: /* @__PURE__ */ (0,
|
|
3052
|
-
|
|
3533
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3534
|
+
import_material15.Checkbox,
|
|
3053
3535
|
{
|
|
3054
3536
|
checked: options.replaceNewLineWithSpace,
|
|
3055
3537
|
onChange: handleOptionChange("replaceNewLineWithSpace"),
|
|
3056
3538
|
size: "small"
|
|
3057
3539
|
}
|
|
3058
3540
|
),
|
|
3059
|
-
label: /* @__PURE__ */ (0,
|
|
3541
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.Typography, { variant: "body2", children: "Reemplazar saltos de l\xEDnea con espacios" })
|
|
3060
3542
|
}
|
|
3061
3543
|
)
|
|
3062
3544
|
] })
|
|
3063
3545
|
] })
|
|
3064
3546
|
] }) }),
|
|
3065
|
-
/* @__PURE__ */ (0,
|
|
3066
|
-
/* @__PURE__ */ (0,
|
|
3067
|
-
/* @__PURE__ */ (0,
|
|
3068
|
-
|
|
3547
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material15.DialogActions, { sx: { px: 3, py: 2 }, children: [
|
|
3548
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.Button, { onClick: onClose, disabled: loading, children: "Cancelar" }),
|
|
3549
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3550
|
+
import_material15.Button,
|
|
3069
3551
|
{
|
|
3070
3552
|
onClick: handleConfirm,
|
|
3071
3553
|
variant: "contained",
|
|
3072
3554
|
disabled: !file || loading,
|
|
3073
|
-
startIcon: /* @__PURE__ */ (0,
|
|
3555
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_FileUpload2.default, {}),
|
|
3074
3556
|
children: loading ? "Procesando..." : "Confirmar Importaci\xF3n"
|
|
3075
3557
|
}
|
|
3076
3558
|
)
|
|
@@ -3079,11 +3561,11 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3079
3561
|
};
|
|
3080
3562
|
|
|
3081
3563
|
// src/components/grid/ExportDialog.tsx
|
|
3082
|
-
var
|
|
3083
|
-
var
|
|
3564
|
+
var import_react23 = require("react");
|
|
3565
|
+
var import_material16 = require("@mui/material");
|
|
3084
3566
|
var XLSX = __toESM(require("xlsx"), 1);
|
|
3085
3567
|
var import_type_store5 = __toESM(require("type-store"), 1);
|
|
3086
|
-
var
|
|
3568
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3087
3569
|
var ExportDialog = ({
|
|
3088
3570
|
open,
|
|
3089
3571
|
onClose,
|
|
@@ -3092,13 +3574,13 @@ var ExportDialog = ({
|
|
|
3092
3574
|
filteredRows,
|
|
3093
3575
|
username = "anonymous"
|
|
3094
3576
|
}) => {
|
|
3095
|
-
const [format, setFormat] = (0,
|
|
3096
|
-
const [options, setOptions] = (0,
|
|
3577
|
+
const [format, setFormat] = (0, import_react23.useState)("xlsx");
|
|
3578
|
+
const [options, setOptions] = (0, import_react23.useState)({
|
|
3097
3579
|
fromOtherTables: true,
|
|
3098
3580
|
readOnly: true,
|
|
3099
3581
|
hiddens: false
|
|
3100
3582
|
});
|
|
3101
|
-
const [isPreparing, setIsPreparing] = (0,
|
|
3583
|
+
const [isPreparing, setIsPreparing] = (0, import_react23.useState)(false);
|
|
3102
3584
|
const handleOptionChange = (event) => {
|
|
3103
3585
|
setOptions({
|
|
3104
3586
|
...options,
|
|
@@ -3228,66 +3710,66 @@ var ExportDialog = ({
|
|
|
3228
3710
|
URL.revokeObjectURL(url);
|
|
3229
3711
|
}, 0);
|
|
3230
3712
|
};
|
|
3231
|
-
return /* @__PURE__ */ (0,
|
|
3232
|
-
/* @__PURE__ */ (0,
|
|
3233
|
-
/* @__PURE__ */ (0,
|
|
3234
|
-
/* @__PURE__ */ (0,
|
|
3235
|
-
/* @__PURE__ */ (0,
|
|
3236
|
-
] }) : /* @__PURE__ */ (0,
|
|
3237
|
-
/* @__PURE__ */ (0,
|
|
3238
|
-
/* @__PURE__ */ (0,
|
|
3239
|
-
/* @__PURE__ */ (0,
|
|
3240
|
-
|
|
3713
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material16.Dialog, { open, onClose, maxWidth: "xs", fullWidth: true, children: [
|
|
3714
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.DialogTitle, { children: "Exportar Datos" }),
|
|
3715
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.DialogContent, { children: isPreparing ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material16.Box, { display: "flex", flexDirection: "column", alignItems: "center", py: 4, children: [
|
|
3716
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.CircularProgress, {}),
|
|
3717
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.Typography, { sx: { mt: 2 }, children: "Preparando exportaci\xF3n..." })
|
|
3718
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material16.Box, { sx: { mt: 1 }, children: [
|
|
3719
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material16.FormControl, { component: "fieldset", children: [
|
|
3720
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.FormLabel, { component: "legend", children: "Formato" }),
|
|
3721
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
3722
|
+
import_material16.RadioGroup,
|
|
3241
3723
|
{
|
|
3242
3724
|
value: format,
|
|
3243
3725
|
onChange: (e) => setFormat(e.target.value),
|
|
3244
3726
|
children: [
|
|
3245
|
-
/* @__PURE__ */ (0,
|
|
3246
|
-
/* @__PURE__ */ (0,
|
|
3247
|
-
/* @__PURE__ */ (0,
|
|
3727
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.FormControlLabel, { value: "xlsx", control: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.Radio, {}), label: "Excel (.xlsx)" }),
|
|
3728
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.FormControlLabel, { value: "tab", control: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.Radio, {}), label: "Tabulado (.tab | )" }),
|
|
3729
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.FormControlLabel, { value: "csv", control: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.Radio, {}), label: "CSV (.csv , )" })
|
|
3248
3730
|
]
|
|
3249
3731
|
}
|
|
3250
3732
|
)
|
|
3251
3733
|
] }),
|
|
3252
|
-
/* @__PURE__ */ (0,
|
|
3253
|
-
/* @__PURE__ */ (0,
|
|
3254
|
-
/* @__PURE__ */ (0,
|
|
3255
|
-
/* @__PURE__ */ (0,
|
|
3256
|
-
|
|
3734
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material16.Box, { sx: { mt: 3 }, children: [
|
|
3735
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.Typography, { variant: "subtitle2", gutterBottom: true, children: "Opciones de campos:" }),
|
|
3736
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material16.FormGroup, { children: [
|
|
3737
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3738
|
+
import_material16.FormControlLabel,
|
|
3257
3739
|
{
|
|
3258
|
-
control: /* @__PURE__ */ (0,
|
|
3740
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.Checkbox, { checked: options.fromOtherTables, onChange: handleOptionChange, name: "fromOtherTables" }),
|
|
3259
3741
|
label: "Desde otras tablas"
|
|
3260
3742
|
}
|
|
3261
3743
|
),
|
|
3262
|
-
/* @__PURE__ */ (0,
|
|
3263
|
-
|
|
3744
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3745
|
+
import_material16.FormControlLabel,
|
|
3264
3746
|
{
|
|
3265
|
-
control: /* @__PURE__ */ (0,
|
|
3747
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.Checkbox, { checked: options.readOnly, onChange: handleOptionChange, name: "readOnly" }),
|
|
3266
3748
|
label: "Solo lectura"
|
|
3267
3749
|
}
|
|
3268
3750
|
),
|
|
3269
|
-
/* @__PURE__ */ (0,
|
|
3270
|
-
|
|
3751
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3752
|
+
import_material16.FormControlLabel,
|
|
3271
3753
|
{
|
|
3272
|
-
control: /* @__PURE__ */ (0,
|
|
3754
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.Checkbox, { checked: options.hiddens, onChange: handleOptionChange, name: "hiddens" }),
|
|
3273
3755
|
label: "Ocultos"
|
|
3274
3756
|
}
|
|
3275
3757
|
)
|
|
3276
3758
|
] })
|
|
3277
3759
|
] })
|
|
3278
3760
|
] }) }),
|
|
3279
|
-
/* @__PURE__ */ (0,
|
|
3280
|
-
/* @__PURE__ */ (0,
|
|
3281
|
-
/* @__PURE__ */ (0,
|
|
3761
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material16.DialogActions, { children: [
|
|
3762
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.Button, { onClick: onClose, disabled: isPreparing, children: "Cancelar" }),
|
|
3763
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.Button, { onClick: handlePrepareExport, variant: "contained", disabled: isPreparing, children: "Descargar" })
|
|
3282
3764
|
] })
|
|
3283
3765
|
] });
|
|
3284
3766
|
};
|
|
3285
3767
|
|
|
3286
3768
|
// src/pages/VerticalEditorPage.tsx
|
|
3287
|
-
var
|
|
3288
|
-
var
|
|
3769
|
+
var import_react24 = require("react");
|
|
3770
|
+
var import_material17 = require("@mui/material");
|
|
3289
3771
|
var import_Close = __toESM(require("@mui/icons-material/Close"), 1);
|
|
3290
|
-
var
|
|
3772
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3291
3773
|
var VerticalEditorPage = ({
|
|
3292
3774
|
tableName,
|
|
3293
3775
|
tableDefinition,
|
|
@@ -3298,20 +3780,20 @@ var VerticalEditorPage = ({
|
|
|
3298
3780
|
onClose
|
|
3299
3781
|
}) => {
|
|
3300
3782
|
const { saveRecord } = useTableRecordSave();
|
|
3301
|
-
const [internalIsNewRow, setInternalIsNewRow] = (0,
|
|
3302
|
-
const [formData, setFormData] = (0,
|
|
3303
|
-
const [lastSavedData, setLastSavedData] = (0,
|
|
3304
|
-
const [validityMap, setValidityMap] = (0,
|
|
3305
|
-
const [globalError, setGlobalError] = (0,
|
|
3306
|
-
const [isSaving, setIsSaving] = (0,
|
|
3307
|
-
const [fieldFeedback, setFieldFeedback] = (0,
|
|
3308
|
-
const feedbackTimersRef = (0,
|
|
3309
|
-
const handleFieldChange = (0,
|
|
3783
|
+
const [internalIsNewRow, setInternalIsNewRow] = (0, import_react24.useState)(isNewRow);
|
|
3784
|
+
const [formData, setFormData] = (0, import_react24.useState)(initialData);
|
|
3785
|
+
const [lastSavedData, setLastSavedData] = (0, import_react24.useState)(initialData);
|
|
3786
|
+
const [validityMap, setValidityMap] = (0, import_react24.useState)({});
|
|
3787
|
+
const [globalError, setGlobalError] = (0, import_react24.useState)(null);
|
|
3788
|
+
const [isSaving, setIsSaving] = (0, import_react24.useState)(false);
|
|
3789
|
+
const [fieldFeedback, setFieldFeedback] = (0, import_react24.useState)({});
|
|
3790
|
+
const feedbackTimersRef = (0, import_react24.useRef)({});
|
|
3791
|
+
const handleFieldChange = (0, import_react24.useCallback)((fieldName, newValue, isValid) => {
|
|
3310
3792
|
setFormData((prev) => ({ ...prev, [fieldName]: newValue }));
|
|
3311
3793
|
setValidityMap((prev) => ({ ...prev, [fieldName]: isValid }));
|
|
3312
3794
|
setGlobalError(null);
|
|
3313
3795
|
}, []);
|
|
3314
|
-
const isFormValid = (0,
|
|
3796
|
+
const isFormValid = (0, import_react24.useMemo)(() => {
|
|
3315
3797
|
for (const key in validityMap) {
|
|
3316
3798
|
if (validityMap[key] === false) return false;
|
|
3317
3799
|
}
|
|
@@ -3324,7 +3806,7 @@ var VerticalEditorPage = ({
|
|
|
3324
3806
|
}
|
|
3325
3807
|
return true;
|
|
3326
3808
|
}, [formData, validityMap, tableDefinition.fields]);
|
|
3327
|
-
const handleCommit = (0,
|
|
3809
|
+
const handleCommit = (0, import_react24.useCallback)(async (fieldName, newValue, isValid) => {
|
|
3328
3810
|
if (!isValid) return;
|
|
3329
3811
|
if (sameValue(newValue, lastSavedData[fieldName])) {
|
|
3330
3812
|
return;
|
|
@@ -3346,7 +3828,6 @@ var VerticalEditorPage = ({
|
|
|
3346
3828
|
setGlobalError(null);
|
|
3347
3829
|
try {
|
|
3348
3830
|
const response = await saveRecord({
|
|
3349
|
-
tableName,
|
|
3350
3831
|
tableDefinition,
|
|
3351
3832
|
isNewRow: internalIsNewRow,
|
|
3352
3833
|
formData: potentialUpdatedRow,
|
|
@@ -3415,21 +3896,21 @@ var VerticalEditorPage = ({
|
|
|
3415
3896
|
tableDefinition,
|
|
3416
3897
|
onSaveSuccess
|
|
3417
3898
|
]);
|
|
3418
|
-
return /* @__PURE__ */ (0,
|
|
3419
|
-
/* @__PURE__ */ (0,
|
|
3420
|
-
/* @__PURE__ */ (0,
|
|
3899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material17.Box, { sx: { p: 2, display: "flex", flexDirection: "column", height: "100%" }, children: [
|
|
3900
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material17.DialogTitle, { sx: { px: 0, pt: 0, display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
3901
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material17.Typography, { component: "div", variant: "h6", children: [
|
|
3421
3902
|
isNewRow ? "Nuevo Registro" : "Editar Registro",
|
|
3422
3903
|
" - ",
|
|
3423
3904
|
tableDefinition.title || tableName
|
|
3424
3905
|
] }),
|
|
3425
|
-
/* @__PURE__ */ (0,
|
|
3906
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material17.IconButton, { onClick: onClose, size: "small", edge: "end", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_Close.default, {}) })
|
|
3426
3907
|
] }),
|
|
3427
|
-
/* @__PURE__ */ (0,
|
|
3428
|
-
globalError && /* @__PURE__ */ (0,
|
|
3429
|
-
/* @__PURE__ */ (0,
|
|
3908
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material17.DialogContent, { dividers: true, sx: { px: 2, flexGrow: 1, py: 1 }, children: [
|
|
3909
|
+
globalError && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material17.Alert, { severity: "error", sx: { mb: 2 }, children: globalError }),
|
|
3910
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material17.Box, { sx: { display: "flex", flexDirection: "column", gap: 0.5 }, children: tableDefinition.fields.map((field) => {
|
|
3430
3911
|
const isFixed = fixedFields?.some((ff) => ff.fieldName === field.name);
|
|
3431
3912
|
const isMandatory = field.nullable === false || tableDefinition.primaryKey.includes(field.name);
|
|
3432
|
-
return /* @__PURE__ */ (0,
|
|
3913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material17.Box, { sx: { width: "100%", maxWidth: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3433
3914
|
TypedField,
|
|
3434
3915
|
{
|
|
3435
3916
|
fieldDef: field,
|
|
@@ -3443,23 +3924,90 @@ var VerticalEditorPage = ({
|
|
|
3443
3924
|
) }, field.name);
|
|
3444
3925
|
}) })
|
|
3445
3926
|
] }),
|
|
3446
|
-
/* @__PURE__ */ (0,
|
|
3447
|
-
/* @__PURE__ */ (0,
|
|
3448
|
-
isSaving && /* @__PURE__ */ (0,
|
|
3449
|
-
/* @__PURE__ */ (0,
|
|
3927
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material17.DialogActions, { sx: { px: 0, pb: 0, pt: 2, justifyContent: "space-between", alignItems: "center" }, children: [
|
|
3928
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material17.Box, { children: [
|
|
3929
|
+
isSaving && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material17.CircularProgress, { size: 20, sx: { ml: 2 } }),
|
|
3930
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { style: { marginLeft: 10, fontSize: "0.8rem", color: "#666" }, children: isSaving ? "Guardando..." : "Cambios auto-guardados" })
|
|
3450
3931
|
] }),
|
|
3451
|
-
/* @__PURE__ */ (0,
|
|
3932
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material17.Button, { variant: "outlined", onClick: onClose, children: "Cerrar" })
|
|
3452
3933
|
] })
|
|
3453
3934
|
] });
|
|
3454
3935
|
};
|
|
3455
3936
|
|
|
3937
|
+
// src/utils/parametrosDeTabla.ts
|
|
3938
|
+
var import_json4all2 = __toESM(require("json4all"), 1);
|
|
3939
|
+
function esRegistro(valor) {
|
|
3940
|
+
return typeof valor === "object" && valor !== null && !Array.isArray(valor) && !(valor instanceof Date);
|
|
3941
|
+
}
|
|
3942
|
+
var CODIFICADOS = ["ff", "fc", "td", "pf"];
|
|
3943
|
+
function parametrosDeDireccion(direccion) {
|
|
3944
|
+
const resultado = {};
|
|
3945
|
+
direccion.split("&").forEach((par) => {
|
|
3946
|
+
const sinMarca = par.replace(/^[#?]/, "");
|
|
3947
|
+
const igual = sinMarca.indexOf("=");
|
|
3948
|
+
if (igual === -1) return;
|
|
3949
|
+
const nombre = sinMarca.slice(0, igual);
|
|
3950
|
+
try {
|
|
3951
|
+
const texto = decodeURIComponent(sinMarca.slice(igual + 1));
|
|
3952
|
+
resultado[nombre] = CODIFICADOS.includes(nombre) ? import_json4all2.default.parse(texto) : texto;
|
|
3953
|
+
} catch (err) {
|
|
3954
|
+
console.warn(`No se pudo interpretar el par\xE1metro '${nombre}' de la direcci\xF3n:`, err);
|
|
3955
|
+
}
|
|
3956
|
+
});
|
|
3957
|
+
return resultado;
|
|
3958
|
+
}
|
|
3959
|
+
function aFixedFields(valor) {
|
|
3960
|
+
if (Array.isArray(valor)) {
|
|
3961
|
+
return valor.flatMap((par) => {
|
|
3962
|
+
if (!esRegistro(par) || typeof par.fieldName !== "string") return [];
|
|
3963
|
+
const fixedField = { fieldName: par.fieldName, value: par.value };
|
|
3964
|
+
if (par.until !== void 0) fixedField.until = par.until;
|
|
3965
|
+
if (typeof par.range === "boolean") fixedField.range = par.range;
|
|
3966
|
+
if (typeof par.show === "boolean") fixedField.show = par.show;
|
|
3967
|
+
return [fixedField];
|
|
3968
|
+
});
|
|
3969
|
+
}
|
|
3970
|
+
if (esRegistro(valor)) return Object.entries(valor).map(([fieldName, value]) => ({ fieldName, value }));
|
|
3971
|
+
return [];
|
|
3972
|
+
}
|
|
3973
|
+
function aFiltrosIniciales(valor) {
|
|
3974
|
+
if (!Array.isArray(valor) || valor.length === 0) return [];
|
|
3975
|
+
const filas = Array.isArray(valor[0]) ? valor : [valor];
|
|
3976
|
+
return filas.map((fila) => Array.isArray(fila) ? fila.flatMap((condicion) => {
|
|
3977
|
+
if (!esRegistro(condicion) || typeof condicion.operator !== "string") return [];
|
|
3978
|
+
const columna = condicion.column ?? condicion.fieldName;
|
|
3979
|
+
return typeof columna === "string" ? [{ column: columna, operator: condicion.operator, value: condicion.value }] : [];
|
|
3980
|
+
}) : []).filter((fila) => fila.length > 0);
|
|
3981
|
+
}
|
|
3982
|
+
function parametrosDeTabla(item, direccion) {
|
|
3983
|
+
const origen = { ...item, ...parametrosDeDireccion(direccion) };
|
|
3984
|
+
const parametros = {};
|
|
3985
|
+
const fixedFields = aFixedFields(origen.ff ?? origen.fixedFields);
|
|
3986
|
+
if (fixedFields.length > 0) parametros.fixedFields = fixedFields;
|
|
3987
|
+
const filterColumns = aFiltrosIniciales(origen.fc);
|
|
3988
|
+
if (filterColumns.length > 0) parametros.filterColumns = filterColumns;
|
|
3989
|
+
if (esRegistro(origen.td)) parametros.tableDef = origen.td;
|
|
3990
|
+
if (esRegistro(origen.pf)) parametros.parameterFunctions = origen.pf;
|
|
3991
|
+
if (typeof origen.pick === "string") parametros.pick = origen.pick;
|
|
3992
|
+
if (typeof origen.label === "string") parametros.label = origen.label;
|
|
3993
|
+
return parametros;
|
|
3994
|
+
}
|
|
3995
|
+
function fusionar(base, cambios) {
|
|
3996
|
+
const resultado = { ...base };
|
|
3997
|
+
for (const [clave, valor] of Object.entries(cambios)) {
|
|
3998
|
+
const actual = Reflect.get(resultado, clave);
|
|
3999
|
+
Reflect.set(resultado, clave, esRegistro(actual) && esRegistro(valor) ? fusionar(actual, valor) : valor);
|
|
4000
|
+
}
|
|
4001
|
+
return resultado;
|
|
4002
|
+
}
|
|
4003
|
+
|
|
3456
4004
|
// src/rutaBase.ts
|
|
3457
4005
|
var import_meta2 = {};
|
|
3458
4006
|
var baseDelBundler = import_meta2.env?.BASE_URL ?? "/";
|
|
3459
4007
|
var rutaBase = baseDelBundler.replace(/\/+$/, "");
|
|
3460
4008
|
|
|
3461
4009
|
// src/components/grid/GenericDataGrid.tsx
|
|
3462
|
-
var
|
|
4010
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3463
4011
|
var SUMMARY_ROW_HEIGHT = 35;
|
|
3464
4012
|
var FILTER_ROW_HEIGHT = 35;
|
|
3465
4013
|
var HEADER_ROW_HEIGHT = 30;
|
|
@@ -3478,9 +4026,9 @@ var esColumnaPropia = (columna) => "customType" in columna;
|
|
|
3478
4026
|
var SIN_ANCESTROS = [];
|
|
3479
4027
|
var cargasEnCurso = /* @__PURE__ */ new Map();
|
|
3480
4028
|
var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
3481
|
-
const theme = (0,
|
|
4029
|
+
const theme = (0, import_material18.useTheme)();
|
|
3482
4030
|
const { tableDefinition, row } = ancestor;
|
|
3483
|
-
const columns = (0,
|
|
4031
|
+
const columns = (0, import_react25.useMemo)(() => {
|
|
3484
4032
|
const filteredFields = tableDefinition.fields.filter(
|
|
3485
4033
|
(field) => !fieldsToHide?.some((ff) => ff.fieldName === field.name)
|
|
3486
4034
|
);
|
|
@@ -3491,8 +4039,8 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
3491
4039
|
name: field.label || cambiarGuionesBajosPorEspacios(field.name),
|
|
3492
4040
|
width: 150,
|
|
3493
4041
|
editable: false,
|
|
3494
|
-
renderHeaderCell: () => /* @__PURE__ */ (0,
|
|
3495
|
-
|
|
4042
|
+
renderHeaderCell: () => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Box, { sx: { p: 0.5, height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4043
|
+
import_material18.Typography,
|
|
3496
4044
|
{
|
|
3497
4045
|
variant: "caption",
|
|
3498
4046
|
sx: {
|
|
@@ -3503,11 +4051,11 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
3503
4051
|
children: field.label || cambiarGuionesBajosPorEspacios(field.name)
|
|
3504
4052
|
}
|
|
3505
4053
|
) }),
|
|
3506
|
-
renderCell: (props) => /* @__PURE__ */ (0,
|
|
4054
|
+
renderCell: (props) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Box, { sx: { px: 1, height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Typography, { variant: "body2", sx: { fontSize: "0.875rem" }, noWrap: true, children: String(props.row[field.name] ?? "") }) })
|
|
3507
4055
|
};
|
|
3508
4056
|
});
|
|
3509
4057
|
}, [tableDefinition, fieldsToHide]);
|
|
3510
|
-
return /* @__PURE__ */ (0,
|
|
4058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material18.Box, { sx: {
|
|
3511
4059
|
mb: 1.5,
|
|
3512
4060
|
ml: index * 4,
|
|
3513
4061
|
// El primer ancestro (index 0) no tiene margen, los siguientes sí
|
|
@@ -3518,7 +4066,7 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
3518
4066
|
boxShadow: theme.shadows[1],
|
|
3519
4067
|
bgcolor: "background.paper"
|
|
3520
4068
|
}, children: [
|
|
3521
|
-
/* @__PURE__ */ (0,
|
|
4069
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Box, { sx: {
|
|
3522
4070
|
bgcolor: "primary.main",
|
|
3523
4071
|
color: "primary.contrastText",
|
|
3524
4072
|
px: 1.5,
|
|
@@ -3529,8 +4077,8 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
3529
4077
|
alignItems: "center",
|
|
3530
4078
|
fontWeight: "bold",
|
|
3531
4079
|
gap: 1
|
|
3532
|
-
}, children: /* @__PURE__ */ (0,
|
|
3533
|
-
/* @__PURE__ */ (0,
|
|
4080
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Typography, { variant: "subtitle2", component: "div", children: cambiarGuionesBajosPorEspacios(ancestor.tableName) }) }),
|
|
4081
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3534
4082
|
import_react_data_grid.DataGrid,
|
|
3535
4083
|
{
|
|
3536
4084
|
className: "rdg-light",
|
|
@@ -3547,6 +4095,10 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
3547
4095
|
var GenericDataGrid = ({
|
|
3548
4096
|
tableName,
|
|
3549
4097
|
fixedFields: fixedFieldsRecibidos,
|
|
4098
|
+
filterColumns: filterColumnsRecibidos,
|
|
4099
|
+
tableDef: tableDefRecibido,
|
|
4100
|
+
parameterFunctions: parameterFunctionsRecibido,
|
|
4101
|
+
pick: pickRecibido,
|
|
3550
4102
|
gridStyles,
|
|
3551
4103
|
onOpenDetail,
|
|
3552
4104
|
ancestors = SIN_ANCESTROS,
|
|
@@ -3559,36 +4111,42 @@ var GenericDataGrid = ({
|
|
|
3559
4111
|
altoMaximoDetalle
|
|
3560
4112
|
}) => {
|
|
3561
4113
|
const claveFixedFields = JSON.stringify(fixedFieldsRecibidos ?? null);
|
|
3562
|
-
const fixedFields = (0,
|
|
3563
|
-
const
|
|
3564
|
-
const
|
|
4114
|
+
const fixedFields = (0, import_react25.useMemo)(() => fixedFieldsRecibidos, [claveFixedFields]);
|
|
4115
|
+
const claveParametros = JSON.stringify([filterColumnsRecibidos ?? null, tableDefRecibido ?? null, parameterFunctionsRecibido ?? null, pickRecibido ?? null]);
|
|
4116
|
+
const parametros = (0, import_react25.useMemo)(
|
|
4117
|
+
() => ({ filterColumns: filterColumnsRecibidos, tableDef: tableDefRecibido, parameterFunctions: parameterFunctionsRecibido, pick: pickRecibido }),
|
|
4118
|
+
[claveParametros]
|
|
4119
|
+
// eslint-disable-line react-hooks/exhaustive-deps
|
|
4120
|
+
);
|
|
4121
|
+
const cacheHeredado = (0, import_react25.useContext)(CacheGrillasContext);
|
|
4122
|
+
const [cachePropio] = (0, import_react25.useState)(() => /* @__PURE__ */ new Map());
|
|
3565
4123
|
const cache = cacheHeredado ?? cachePropio;
|
|
3566
|
-
const [guardada] = (0,
|
|
3567
|
-
const claveCargadaRef = (0,
|
|
3568
|
-
const [tableDefinition, setTableDefinition] = (0,
|
|
3569
|
-
const [tableData, setTableData] = (0,
|
|
3570
|
-
const [cargandoInicial, setCargandoInicial] = (0,
|
|
3571
|
-
const [errorDeCarga, setErrorDeCarga] = (0,
|
|
3572
|
-
const [anchosCalculados, setAnchosCalculados] = (0,
|
|
3573
|
-
const [detallesAbiertos, setDetallesAbiertos] = (0,
|
|
3574
|
-
const [altosDetalle, setAltosDetalle] = (0,
|
|
3575
|
-
const [anchosDetalle, setAnchosDetalle] = (0,
|
|
3576
|
-
const [selectedRows, setSelectedRows] = (0,
|
|
3577
|
-
const [, setSelectedCell] = (0,
|
|
3578
|
-
const [estadoGrilla] = (0,
|
|
3579
|
-
const theme = (0,
|
|
3580
|
-
const [openDataGridOptions, setOpenDataGridOptions] = (0,
|
|
3581
|
-
const [dataGridOptionsAnchorEl, setDataGridOptionsAnchorEl] = (0,
|
|
3582
|
-
const [exitingRowIds, setExitingRowIds] = (0,
|
|
4124
|
+
const [guardada] = (0, import_react25.useState)(() => claveCache ? cache.get(claveCache) : void 0);
|
|
4125
|
+
const claveCargadaRef = (0, import_react25.useRef)(guardada ? `${tableName}|${claveFixedFields}|${claveParametros}` : null);
|
|
4126
|
+
const [tableDefinition, setTableDefinition] = (0, import_react25.useState)(guardada?.tableDefinition ?? null);
|
|
4127
|
+
const [tableData, setTableData] = (0, import_react25.useState)(guardada?.tableData ?? []);
|
|
4128
|
+
const [cargandoInicial, setCargandoInicial] = (0, import_react25.useState)(!guardada);
|
|
4129
|
+
const [errorDeCarga, setErrorDeCarga] = (0, import_react25.useState)(null);
|
|
4130
|
+
const [anchosCalculados, setAnchosCalculados] = (0, import_react25.useState)(() => guardada?.anchosCalculados ?? /* @__PURE__ */ new Map());
|
|
4131
|
+
const [detallesAbiertos, setDetallesAbiertos] = (0, import_react25.useState)(guardada?.detallesAbiertos ?? []);
|
|
4132
|
+
const [altosDetalle, setAltosDetalle] = (0, import_react25.useState)(() => guardada?.altosDetalle ?? /* @__PURE__ */ new Map());
|
|
4133
|
+
const [anchosDetalle, setAnchosDetalle] = (0, import_react25.useState)(() => /* @__PURE__ */ new Map());
|
|
4134
|
+
const [selectedRows, setSelectedRows] = (0, import_react25.useState)(() => /* @__PURE__ */ new Set());
|
|
4135
|
+
const [, setSelectedCell] = (0, import_react25.useState)(void 0);
|
|
4136
|
+
const [estadoGrilla] = (0, import_react25.useState)(crearEstadoGrilla);
|
|
4137
|
+
const theme = (0, import_material18.useTheme)();
|
|
4138
|
+
const [openDataGridOptions, setOpenDataGridOptions] = (0, import_react25.useState)(false);
|
|
4139
|
+
const [dataGridOptionsAnchorEl, setDataGridOptionsAnchorEl] = (0, import_react25.useState)(null);
|
|
4140
|
+
const [exitingRowIds, setExitingRowIds] = (0, import_react25.useState)(/* @__PURE__ */ new Set());
|
|
3583
4141
|
const { showError } = useSnackbar();
|
|
3584
4142
|
const { username: usuario } = useClientContext();
|
|
3585
|
-
const dataGridRef = (0,
|
|
3586
|
-
const rowAtEditStartRef = (0,
|
|
3587
|
-
const [openImportDialog, setOpenImportDialog] = (0,
|
|
3588
|
-
const [openExportDialog, setOpenExportDialog] = (0,
|
|
3589
|
-
const [columnWidths, setColumnWidths] = (0,
|
|
4143
|
+
const dataGridRef = (0, import_react25.useRef)(null);
|
|
4144
|
+
const rowAtEditStartRef = (0, import_react25.useRef)(null);
|
|
4145
|
+
const [openImportDialog, setOpenImportDialog] = (0, import_react25.useState)(false);
|
|
4146
|
+
const [openExportDialog, setOpenExportDialog] = (0, import_react25.useState)(false);
|
|
4147
|
+
const [columnWidths, setColumnWidths] = (0, import_react25.useState)(() => /* @__PURE__ */ new Map());
|
|
3590
4148
|
const { callApi, callApiUpload, loading } = useApiCall();
|
|
3591
|
-
const primaryKey = (0,
|
|
4149
|
+
const primaryKey = (0, import_react25.useMemo)(() => {
|
|
3592
4150
|
if (!tableDefinition) return ["id"];
|
|
3593
4151
|
return tableDefinition.primaryKey && tableDefinition.primaryKey.length > 0 ? tableDefinition.primaryKey : ["id"];
|
|
3594
4152
|
}, [tableDefinition]);
|
|
@@ -3602,13 +4160,14 @@ var GenericDataGrid = ({
|
|
|
3602
4160
|
setFilters,
|
|
3603
4161
|
isFilterRowVisible,
|
|
3604
4162
|
toggleFilterVisibility,
|
|
4163
|
+
aplicarFiltrosIniciales,
|
|
3605
4164
|
filteredRows,
|
|
3606
4165
|
summaryData,
|
|
3607
4166
|
resetView
|
|
3608
4167
|
} = useGridDataView({ tableData, tableDefinition });
|
|
3609
|
-
const abiertos = (0,
|
|
3610
|
-
const filasDetalleRef = (0,
|
|
3611
|
-
const filasMostradas = (0,
|
|
4168
|
+
const abiertos = (0, import_react25.useMemo)(() => new Set(detallesAbiertos), [detallesAbiertos]);
|
|
4169
|
+
const filasDetalleRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
|
|
4170
|
+
const filasMostradas = (0, import_react25.useMemo)(() => {
|
|
3612
4171
|
const detailTables = tableDefinition?.detailTables ?? [];
|
|
3613
4172
|
if (abiertos.size === 0 || detailTables.length === 0) return filteredRows;
|
|
3614
4173
|
const anteriores = filasDetalleRef.current;
|
|
@@ -3635,8 +4194,8 @@ var GenericDataGrid = ({
|
|
|
3635
4194
|
filasDetalleRef.current = nuevas;
|
|
3636
4195
|
return filas;
|
|
3637
4196
|
}, [filteredRows, abiertos, tableDefinition, primaryKey]);
|
|
3638
|
-
const altoDeDetalle = (0,
|
|
3639
|
-
const altoDetalles = (0,
|
|
4197
|
+
const altoDeDetalle = (0, import_react25.useCallback)((clave) => altosDetalle.get(clave) ?? ALTO_INICIAL_DETALLE, [altosDetalle]);
|
|
4198
|
+
const altoDetalles = (0, import_react25.useMemo)(
|
|
3640
4199
|
() => filasMostradas.reduce((total, row) => esFilaDetalle(row) ? total + altoDeDetalle(row.clave) : total, 0),
|
|
3641
4200
|
[filasMostradas, altoDeDetalle]
|
|
3642
4201
|
);
|
|
@@ -3682,6 +4241,13 @@ var GenericDataGrid = ({
|
|
|
3682
4241
|
filasVisiblesMax,
|
|
3683
4242
|
conPie
|
|
3684
4243
|
});
|
|
4244
|
+
const [contenidoDeCelda, setContenidoDeCelda] = (0, import_react25.useState)(null);
|
|
4245
|
+
const verContenido = (0, import_react25.useCallback)((anclaje, texto) => setContenidoDeCelda({ anclaje, texto }), []);
|
|
4246
|
+
const cerrarContenidoDeCelda = (0, import_react25.useCallback)(() => {
|
|
4247
|
+
const anclaje = contenidoDeCelda?.anclaje;
|
|
4248
|
+
setContenidoDeCelda(null);
|
|
4249
|
+
setTimeout(() => anclaje?.focus(), 0);
|
|
4250
|
+
}, [contenidoDeCelda]);
|
|
3685
4251
|
const { handleCellDoubleClick, handleCellClick, handleCellKeyDown, handleCellMouseDown, handleKeyPressInEditor, registrarEditor, handleSelectedCellChange, handleRowsChange } = useGridEvents({
|
|
3686
4252
|
dataGridRef,
|
|
3687
4253
|
filteredRows: filasMostradas,
|
|
@@ -3690,10 +4256,11 @@ var GenericDataGrid = ({
|
|
|
3690
4256
|
tableDefinition,
|
|
3691
4257
|
setSelectedCell,
|
|
3692
4258
|
setTableData,
|
|
3693
|
-
setSortColumns
|
|
4259
|
+
setSortColumns,
|
|
4260
|
+
verContenido
|
|
3694
4261
|
});
|
|
3695
|
-
const tableNameAnteriorRef = (0,
|
|
3696
|
-
(0,
|
|
4262
|
+
const tableNameAnteriorRef = (0, import_react25.useRef)(tableName);
|
|
4263
|
+
(0, import_react25.useEffect)(() => {
|
|
3697
4264
|
if (tableNameAnteriorRef.current === tableName) return;
|
|
3698
4265
|
tableNameAnteriorRef.current = tableName;
|
|
3699
4266
|
setDetallesAbiertos([]);
|
|
@@ -3707,8 +4274,8 @@ var GenericDataGrid = ({
|
|
|
3707
4274
|
setExitingRowIds(/* @__PURE__ */ new Set());
|
|
3708
4275
|
setColumnWidths(/* @__PURE__ */ new Map());
|
|
3709
4276
|
}, [tableName, estadoGrilla, resetView]);
|
|
3710
|
-
(0,
|
|
3711
|
-
const claveCarga = `${tableName}|${claveFixedFields}`;
|
|
4277
|
+
(0, import_react25.useEffect)(() => {
|
|
4278
|
+
const claveCarga = `${tableName}|${claveFixedFields}|${claveParametros}`;
|
|
3712
4279
|
if (claveCargadaRef.current === claveCarga) {
|
|
3713
4280
|
if (guardada) setSortColumns(guardada.sortColumns);
|
|
3714
4281
|
return;
|
|
@@ -3718,7 +4285,7 @@ var GenericDataGrid = ({
|
|
|
3718
4285
|
setCargandoInicial(true);
|
|
3719
4286
|
setErrorDeCarga(null);
|
|
3720
4287
|
try {
|
|
3721
|
-
const clavePedido = `${tableName}|${claveFixedFields}`;
|
|
4288
|
+
const clavePedido = `${tableName}|${claveFixedFields}|${JSON.stringify([parametros.parameterFunctions ?? null, parametros.pick ?? null])}`;
|
|
3722
4289
|
let pedido = cargasEnCurso.get(clavePedido);
|
|
3723
4290
|
if (!pedido) {
|
|
3724
4291
|
const nuevo = (async () => {
|
|
@@ -3732,7 +4299,10 @@ var GenericDataGrid = ({
|
|
|
3732
4299
|
const data2 = requerido(
|
|
3733
4300
|
await callApi("table_data", {
|
|
3734
4301
|
table: tableName,
|
|
3735
|
-
fixedFields: validFixedFields ?? []
|
|
4302
|
+
fixedFields: validFixedFields ?? [],
|
|
4303
|
+
// como backend-plus (TableConnector.getData); solo si vienen, para no cambiarle el pedido a quien no los usa
|
|
4304
|
+
...parametros.parameterFunctions ? { paramfun: parametros.parameterFunctions } : {},
|
|
4305
|
+
...parametros.pick !== void 0 ? { pick: parametros.pick } : {}
|
|
3736
4306
|
}, { isCritical: true }),
|
|
3737
4307
|
`los datos de '${tableName}'`
|
|
3738
4308
|
);
|
|
@@ -3745,13 +4315,17 @@ var GenericDataGrid = ({
|
|
|
3745
4315
|
nuevo.then(sacar, sacar);
|
|
3746
4316
|
pedido = nuevo;
|
|
3747
4317
|
}
|
|
3748
|
-
const { definition, data } = await pedido;
|
|
4318
|
+
const { definition: definicionDelServidor, data } = await pedido;
|
|
3749
4319
|
if (!vigente) return;
|
|
3750
4320
|
claveCargadaRef.current = claveCarga;
|
|
4321
|
+
const definition = parametros.tableDef ? fusionar(definicionDelServidor, parametros.tableDef) : definicionDelServidor;
|
|
3751
4322
|
setTableDefinition(definition);
|
|
3752
4323
|
setSortColumns(getInitialSortColumns(definition));
|
|
3753
4324
|
setAnchosCalculados(calcularAnchosDeColumnas(definition, data));
|
|
3754
4325
|
setTableData(data);
|
|
4326
|
+
const filasDeFiltros = parametros.filterColumns ?? aFiltrosIniciales(definition.filterColumns);
|
|
4327
|
+
if (filasDeFiltros.length > 1) console.warn(`'${tableName}': varias filas de filtros (alternativas) todav\xEDa no est\xE1n soportadas; se aplica la primera`);
|
|
4328
|
+
if (filasDeFiltros.length > 0) aplicarFiltrosIniciales(filasDeFiltros[0], definition);
|
|
3755
4329
|
} catch (err) {
|
|
3756
4330
|
if (!vigente) return;
|
|
3757
4331
|
setTableDefinition(null);
|
|
@@ -3767,12 +4341,12 @@ var GenericDataGrid = ({
|
|
|
3767
4341
|
return () => {
|
|
3768
4342
|
vigente = false;
|
|
3769
4343
|
};
|
|
3770
|
-
}, [tableName, claveFixedFields, fixedFields, showError, callApi, getInitialSortColumns, setSortColumns, guardada]);
|
|
3771
|
-
(0,
|
|
4344
|
+
}, [tableName, claveFixedFields, fixedFields, claveParametros, parametros, showError, callApi, getInitialSortColumns, setSortColumns, aplicarFiltrosIniciales, guardada]);
|
|
4345
|
+
(0, import_react25.useEffect)(() => {
|
|
3772
4346
|
if (!claveCache || !tableDefinition || cargandoInicial) return;
|
|
3773
4347
|
cache.set(claveCache, { tableDefinition, tableData, anchosCalculados, sortColumns, detallesAbiertos, altosDetalle });
|
|
3774
4348
|
}, [cache, claveCache, tableDefinition, tableData, anchosCalculados, sortColumns, detallesAbiertos, altosDetalle, cargandoInicial]);
|
|
3775
|
-
(0,
|
|
4349
|
+
(0, import_react25.useEffect)(() => {
|
|
3776
4350
|
let timer = null;
|
|
3777
4351
|
const desuscribir = estadoGrilla.suscribir(() => {
|
|
3778
4352
|
const hayExitos = Array.from(estadoGrilla.obtenerFeedback().values()).some((f) => f.type === "success");
|
|
@@ -3797,11 +4371,11 @@ var GenericDataGrid = ({
|
|
|
3797
4371
|
if (timer) clearTimeout(timer);
|
|
3798
4372
|
};
|
|
3799
4373
|
}, [estadoGrilla]);
|
|
3800
|
-
const resetSortingDeLaTabla = (0,
|
|
4374
|
+
const resetSortingDeLaTabla = (0, import_react25.useCallback)(() => {
|
|
3801
4375
|
if (tableDefinition) resetSorting(tableDefinition);
|
|
3802
4376
|
}, [tableDefinition, resetSorting]);
|
|
3803
|
-
const abrirImportacion = (0,
|
|
3804
|
-
const abrirExportacion = (0,
|
|
4377
|
+
const abrirImportacion = (0, import_react25.useCallback)(() => setOpenImportDialog(true), []);
|
|
4378
|
+
const abrirExportacion = (0, import_react25.useCallback)(() => setOpenExportDialog(true), []);
|
|
3805
4379
|
const { menuOptions } = useGridMenu({
|
|
3806
4380
|
tableDefinition,
|
|
3807
4381
|
tableName,
|
|
@@ -3812,11 +4386,11 @@ var GenericDataGrid = ({
|
|
|
3812
4386
|
triggerImport: abrirImportacion,
|
|
3813
4387
|
triggerExport: abrirExportacion
|
|
3814
4388
|
});
|
|
3815
|
-
const abrirOpcionesDeGrilla = (0,
|
|
4389
|
+
const abrirOpcionesDeGrilla = (0, import_react25.useCallback)((anchorEl) => {
|
|
3816
4390
|
setDataGridOptionsAnchorEl(anchorEl);
|
|
3817
4391
|
setOpenDataGridOptions(true);
|
|
3818
4392
|
}, []);
|
|
3819
|
-
const editarEnFicha = (0,
|
|
4393
|
+
const editarEnFicha = (0, import_react25.useCallback)((row) => {
|
|
3820
4394
|
rowAtEditStartRef.current = { ...row };
|
|
3821
4395
|
handleVerticalEditRow(row);
|
|
3822
4396
|
}, [handleVerticalEditRow]);
|
|
@@ -3834,7 +4408,7 @@ var GenericDataGrid = ({
|
|
|
3834
4408
|
toggleFilterVisibility,
|
|
3835
4409
|
abrirOpcionesDeGrilla
|
|
3836
4410
|
});
|
|
3837
|
-
const abrirDetalleEnPestana = (0,
|
|
4411
|
+
const abrirDetalleEnPestana = (0, import_react25.useCallback)((row, detailTable) => {
|
|
3838
4412
|
if (!onOpenDetail || !tableDefinition || !detailTable.table) return;
|
|
3839
4413
|
const porCampo = /* @__PURE__ */ new Map();
|
|
3840
4414
|
[...fixedFields ?? [], ...calcularFixedFieldsDetalle(detailTable, row)].forEach((ff) => porCampo.set(ff.fieldName, ff));
|
|
@@ -3844,12 +4418,12 @@ var GenericDataGrid = ({
|
|
|
3844
4418
|
const newAncestors = [...ancestors, { tableName: tableDefinition.name, row, tableDefinition, fixedFields: allFixedFields }];
|
|
3845
4419
|
onOpenDetail(detailTable.table, allFixedFields, label, newAncestors);
|
|
3846
4420
|
}, [onOpenDetail, tableDefinition, fixedFields, ancestors]);
|
|
3847
|
-
const abrirWScreenEnPestana = (0,
|
|
3848
|
-
const
|
|
3849
|
-
calcularFixedFieldsDetalle(detailTable, row).forEach((ff) =>
|
|
3850
|
-
window.open(`${window.location.origin}${rutaBase}/wScreens/${detailTable.wScreen}?${
|
|
4421
|
+
const abrirWScreenEnPestana = (0, import_react25.useCallback)((row, detailTable) => {
|
|
4422
|
+
const parametros2 = new URLSearchParams();
|
|
4423
|
+
calcularFixedFieldsDetalle(detailTable, row).forEach((ff) => parametros2.set(ff.fieldName, String(ff.value)));
|
|
4424
|
+
window.open(`${window.location.origin}${rutaBase}/wScreens/${detailTable.wScreen}?${parametros2}`, "_blank");
|
|
3851
4425
|
}, []);
|
|
3852
|
-
const alternarDetalle = (0,
|
|
4426
|
+
const alternarDetalle = (0, import_react25.useCallback)((row, rowId, detailTable, enOtraPestana) => {
|
|
3853
4427
|
if (enOtraPestana && detailTable.wScreen) {
|
|
3854
4428
|
abrirWScreenEnPestana(row, detailTable);
|
|
3855
4429
|
return;
|
|
@@ -3861,8 +4435,8 @@ var GenericDataGrid = ({
|
|
|
3861
4435
|
const clave = claveDetalle(rowId, detailTable);
|
|
3862
4436
|
setDetallesAbiertos((anteriores) => anteriores.includes(clave) ? anteriores.filter((c) => c !== clave) : [...anteriores, clave]);
|
|
3863
4437
|
}, [onOpenDetail, abrirDetalleEnPestana, abrirWScreenEnPestana]);
|
|
3864
|
-
const [medidas, setMedidas] = (0,
|
|
3865
|
-
(0,
|
|
4438
|
+
const [medidas, setMedidas] = (0, import_react25.useState)(null);
|
|
4439
|
+
(0, import_react25.useEffect)(() => {
|
|
3866
4440
|
const elemento = dataGridRef.current?.element;
|
|
3867
4441
|
if (!elemento) return;
|
|
3868
4442
|
const medir = () => setMedidas((anteriores) => {
|
|
@@ -3875,8 +4449,8 @@ var GenericDataGrid = ({
|
|
|
3875
4449
|
return () => observador.disconnect();
|
|
3876
4450
|
}, [tableDefinition, cargandoInicial]);
|
|
3877
4451
|
const anchoVisible = medidas?.ancho ?? null;
|
|
3878
|
-
const [altoDeVentana, setAltoDeVentana] = (0,
|
|
3879
|
-
(0,
|
|
4452
|
+
const [altoDeVentana, setAltoDeVentana] = (0, import_react25.useState)(null);
|
|
4453
|
+
(0, import_react25.useEffect)(() => {
|
|
3880
4454
|
if (anidada) return;
|
|
3881
4455
|
const elemento = dataGridRef.current?.element;
|
|
3882
4456
|
if (!elemento) return;
|
|
@@ -3885,25 +4459,25 @@ var GenericDataGrid = ({
|
|
|
3885
4459
|
window.addEventListener("resize", calcular);
|
|
3886
4460
|
return () => window.removeEventListener("resize", calcular);
|
|
3887
4461
|
}, [anidada, tableDefinition, cargandoInicial]);
|
|
3888
|
-
const altoDeContexto = (0,
|
|
4462
|
+
const altoDeContexto = (0, import_react25.useContext)(AltoDisponibleContext);
|
|
3889
4463
|
const altoDeEstaGrilla = anidada ? altoDisponible ?? (altoDeContexto === void 0 ? void 0 : altoDeContexto - ALTO_TITULO_ANIDADA) : altoDeVentana ?? void 0;
|
|
3890
4464
|
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);
|
|
3891
|
-
const cambiarAnchoDetalle = (0,
|
|
4465
|
+
const cambiarAnchoDetalle = (0, import_react25.useCallback)((clave, ancho) => {
|
|
3892
4466
|
setAnchosDetalle((anteriores) => anteriores.get(clave) === ancho ? anteriores : new Map(anteriores).set(clave, ancho));
|
|
3893
4467
|
}, []);
|
|
3894
|
-
const cambiarAltoDetalle = (0,
|
|
4468
|
+
const cambiarAltoDetalle = (0, import_react25.useCallback)((clave, altoDeseado2) => {
|
|
3895
4469
|
const alto = Math.min(Math.max(Math.round(altoDeseado2), ALTO_MINIMO_DETALLE), altoMaximoDetalleEfectivo ?? Infinity);
|
|
3896
4470
|
setAltosDetalle((anteriores) => anteriores.get(clave) === alto ? anteriores : new Map(anteriores).set(clave, alto));
|
|
3897
4471
|
}, [altoMaximoDetalleEfectivo]);
|
|
3898
|
-
const renderDetalle = (0,
|
|
4472
|
+
const renderDetalle = (0, import_react25.useCallback)((fila) => {
|
|
3899
4473
|
const { detailTable } = fila;
|
|
3900
|
-
return /* @__PURE__ */ (0,
|
|
4474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3901
4475
|
"div",
|
|
3902
4476
|
{
|
|
3903
4477
|
className: "fpr-detalle",
|
|
3904
4478
|
style: { maxWidth: anchoVisible ? anchoVisible - 2 : void 0 },
|
|
3905
4479
|
onKeyDown: (e) => e.stopPropagation(),
|
|
3906
|
-
children: detailTable.table ? /* @__PURE__ */ (0,
|
|
4480
|
+
children: detailTable.table ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3907
4481
|
GenericDataGrid,
|
|
3908
4482
|
{
|
|
3909
4483
|
tableName: detailTable.table,
|
|
@@ -3916,7 +4490,7 @@ var GenericDataGrid = ({
|
|
|
3916
4490
|
onOpenDetail,
|
|
3917
4491
|
ancestors: tableDefinition ? [...ancestors, { tableName: tableDefinition.name, row: fila.filaPadre, tableDefinition, fixedFields: fila.fixedFields }] : ancestors
|
|
3918
4492
|
}
|
|
3919
|
-
) : detailTable.wScreen ? /* @__PURE__ */ (0,
|
|
4493
|
+
) : detailTable.wScreen ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3920
4494
|
DetalleWScreen,
|
|
3921
4495
|
{
|
|
3922
4496
|
fila,
|
|
@@ -3924,7 +4498,7 @@ var GenericDataGrid = ({
|
|
|
3924
4498
|
onAlto: (alto) => cambiarAltoDetalle(fila.clave, alto),
|
|
3925
4499
|
onAncho: (ancho) => cambiarAnchoDetalle(fila.clave, ancho)
|
|
3926
4500
|
}
|
|
3927
|
-
) : /* @__PURE__ */ (0,
|
|
4501
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material18.Alert, { severity: "warning", children: [
|
|
3928
4502
|
"El detalle '",
|
|
3929
4503
|
detailTable.abr,
|
|
3930
4504
|
"' no tiene ni tabla ni wScreen."
|
|
@@ -3932,18 +4506,18 @@ var GenericDataGrid = ({
|
|
|
3932
4506
|
}
|
|
3933
4507
|
);
|
|
3934
4508
|
}, [anchoVisible, claveCache, tableName, cambiarAltoDetalle, cambiarAnchoDetalle, altoMaximoDetalleEfectivo, onOpenDetail, tableDefinition, ancestors]);
|
|
3935
|
-
const detallesGrilla = (0,
|
|
4509
|
+
const detallesGrilla = (0, import_react25.useMemo)(() => ({ abiertos, alternarDetalle, renderDetalle }), [abiertos, alternarDetalle, renderDetalle]);
|
|
3936
4510
|
const altoDeseado = cargandoInicial ? ALTO_INICIAL_DETALLE : gridHeight + ALTO_TITULO_ANIDADA + 8;
|
|
3937
|
-
(0,
|
|
4511
|
+
(0, import_react25.useEffect)(() => {
|
|
3938
4512
|
onAltoDeseado?.(altoDeseado);
|
|
3939
4513
|
}, [onAltoDeseado, altoDeseado]);
|
|
3940
|
-
const rowKeyGetter = (0,
|
|
3941
|
-
const rowHeight = (0,
|
|
3942
|
-
const rowClass = (0,
|
|
4514
|
+
const rowKeyGetter = (0, import_react25.useCallback)((row) => esFilaDetalle(row) ? `detalle:${row.clave}` : getPrimaryKeyValues(row, primaryKey), [primaryKey]);
|
|
4515
|
+
const rowHeight = (0, import_react25.useCallback)((row) => esFilaDetalle(row) ? altoDeDetalle(row.clave) : ROW_HEIGHT, [altoDeDetalle]);
|
|
4516
|
+
const rowClass = (0, import_react25.useCallback)(
|
|
3943
4517
|
(row) => esFilaDetalle(row) ? "fpr-fila-detalle" : exitingRowIds.has(getPrimaryKeyValues(row, primaryKey)) ? "fpr-fila-saliendo" : void 0,
|
|
3944
4518
|
[exitingRowIds, primaryKey]
|
|
3945
4519
|
);
|
|
3946
|
-
const anchoContenido = (0,
|
|
4520
|
+
const anchoContenido = (0, import_react25.useMemo)(() => {
|
|
3947
4521
|
if (!anidada || columns.length === 0) return void 0;
|
|
3948
4522
|
const sumaColumnas = columns.reduce((total, col) => {
|
|
3949
4523
|
const medido = columnWidths.get(col.key)?.width;
|
|
@@ -3953,12 +4527,12 @@ var GenericDataGrid = ({
|
|
|
3953
4527
|
const anchoDetalleMax = detallesAbiertos.reduce((max, clave) => Math.max(max, anchosDetalle.get(clave) ?? 0), 0);
|
|
3954
4528
|
return Math.max(ANCHO_MINIMO_ANIDADA, propio, anchoDetalleMax > 0 ? anchoDetalleMax + SANGRIA_DETALLE + (medidas?.barra ?? 0) + 2 : 0);
|
|
3955
4529
|
}, [anidada, columns, columnWidths, medidas?.barra, detallesAbiertos, anchosDetalle]);
|
|
3956
|
-
(0,
|
|
4530
|
+
(0, import_react25.useEffect)(() => {
|
|
3957
4531
|
if (anchoContenido !== void 0) onAnchoDeseado?.(anchoContenido);
|
|
3958
4532
|
}, [onAnchoDeseado, anchoContenido]);
|
|
3959
|
-
const estiloGrilla = (0,
|
|
3960
|
-
const bottomSummaryRows = (0,
|
|
3961
|
-
const vistaGrilla = (0,
|
|
4533
|
+
const estiloGrilla = (0, import_react25.useMemo)(() => ({ height: "100%", width: "100%", boxSizing: "border-box", ...gridStyles }), [gridStyles]);
|
|
4534
|
+
const bottomSummaryRows = (0, import_react25.useMemo)(() => conPie ? [bottomSummaryRow] : [], [conPie, bottomSummaryRow]);
|
|
4535
|
+
const vistaGrilla = (0, import_react25.useMemo)(() => ({ isFilterRowVisible }), [isFilterRowVisible]);
|
|
3962
4536
|
const getFallBackMessage = () => {
|
|
3963
4537
|
if (tableData.length === 0) {
|
|
3964
4538
|
return "No hay filas para mostrar";
|
|
@@ -3970,19 +4544,19 @@ var GenericDataGrid = ({
|
|
|
3970
4544
|
};
|
|
3971
4545
|
const fallBackMessage = getFallBackMessage();
|
|
3972
4546
|
if (cargandoInicial) {
|
|
3973
|
-
return /* @__PURE__ */ (0,
|
|
3974
|
-
/* @__PURE__ */ (0,
|
|
3975
|
-
/* @__PURE__ */ (0,
|
|
4547
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material18.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: [
|
|
4548
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.CircularProgress, {}),
|
|
4549
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Typography, { variant: "h6", sx: { ml: 2 }, children: "Cargando tabla..." })
|
|
3976
4550
|
] });
|
|
3977
4551
|
}
|
|
3978
4552
|
if (errorDeCarga) {
|
|
3979
|
-
return /* @__PURE__ */ (0,
|
|
4553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Alert, { severity: "error", children: errorDeCarga }) });
|
|
3980
4554
|
}
|
|
3981
4555
|
if (!tableDefinition) {
|
|
3982
|
-
return /* @__PURE__ */ (0,
|
|
4556
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Alert, { severity: "warning", children: "No se pudo cargar la definici\xF3n de la tabla." }) });
|
|
3983
4557
|
}
|
|
3984
|
-
return /* @__PURE__ */ (0,
|
|
3985
|
-
!anidada && ancestors.length > 0 && /* @__PURE__ */ (0,
|
|
4558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CacheGrillasContext.Provider, { value: cache, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material18.Box, { sx: { pt: anidada ? 0 : 2, display: "flex", flexDirection: "column", height: "100%", boxSizing: "border-box", width: anchoContenido ?? void 0, maxWidth: "100%" }, children: [
|
|
4559
|
+
!anidada && ancestors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Box, { sx: { px: 2, pt: 0, pb: 1, display: "flex", flexDirection: "column" }, children: ancestors.map((ancestor, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3986
4560
|
StaticAncestorGrid,
|
|
3987
4561
|
{
|
|
3988
4562
|
ancestor,
|
|
@@ -3991,8 +4565,8 @@ var GenericDataGrid = ({
|
|
|
3991
4565
|
},
|
|
3992
4566
|
index
|
|
3993
4567
|
)) }),
|
|
3994
|
-
/* @__PURE__ */ (0,
|
|
3995
|
-
|
|
4568
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
4569
|
+
import_material18.Box,
|
|
3996
4570
|
{
|
|
3997
4571
|
sx: {
|
|
3998
4572
|
backgroundColor: theme.palette.primary.main,
|
|
@@ -4014,17 +4588,17 @@ var GenericDataGrid = ({
|
|
|
4014
4588
|
gap: 1
|
|
4015
4589
|
},
|
|
4016
4590
|
children: [
|
|
4017
|
-
/* @__PURE__ */ (0,
|
|
4591
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material18.Typography, { variant: "subtitle2", component: "div", children: [
|
|
4018
4592
|
titulo ?? cambiarGuionesBajosPorEspacios(tableDefinition.title || tableDefinition.name),
|
|
4019
4593
|
" - ",
|
|
4020
4594
|
filteredRows.length === tableData.length ? `${tableData.length} registros` : `${filteredRows.length} (F)`
|
|
4021
4595
|
] }),
|
|
4022
|
-
loading && /* @__PURE__ */ (0,
|
|
4596
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.CircularProgress, { size: 14, color: "inherit" })
|
|
4023
4597
|
]
|
|
4024
4598
|
}
|
|
4025
4599
|
),
|
|
4026
|
-
/* @__PURE__ */ (0,
|
|
4027
|
-
|
|
4600
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
4601
|
+
import_material18.Box,
|
|
4028
4602
|
{
|
|
4029
4603
|
sx: {
|
|
4030
4604
|
// Una grilla anidada se acota con px (el alto que le dio la de arriba, o el de una wScreen): una wScreen
|
|
@@ -4042,7 +4616,7 @@ var GenericDataGrid = ({
|
|
|
4042
4616
|
pb: anidada ? 0 : 3
|
|
4043
4617
|
},
|
|
4044
4618
|
children: [
|
|
4045
|
-
/* @__PURE__ */ (0,
|
|
4619
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(EstadoGrillaContext.Provider, { value: estadoGrilla, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VistaGrillaContext.Provider, { value: vistaGrilla, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DetallesGrillaContext.Provider, { value: detallesGrilla, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4046
4620
|
import_react_data_grid.DataGrid,
|
|
4047
4621
|
{
|
|
4048
4622
|
className: "rdg-light",
|
|
@@ -4072,8 +4646,8 @@ var GenericDataGrid = ({
|
|
|
4072
4646
|
onCellKeyDown: handleCellKeyDown
|
|
4073
4647
|
}
|
|
4074
4648
|
) }) }) }),
|
|
4075
|
-
fallBackMessage && /* @__PURE__ */ (0,
|
|
4076
|
-
|
|
4649
|
+
fallBackMessage && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4650
|
+
import_material18.Box,
|
|
4077
4651
|
{
|
|
4078
4652
|
sx: {
|
|
4079
4653
|
position: "absolute",
|
|
@@ -4089,13 +4663,13 @@ var GenericDataGrid = ({
|
|
|
4089
4663
|
zIndex: tableData.length === 0 ? 10 : 1
|
|
4090
4664
|
// Mantenemos el zIndex superior para el estado vacío total
|
|
4091
4665
|
},
|
|
4092
|
-
children: /* @__PURE__ */ (0,
|
|
4666
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Typography, { variant: "body2", color: "textSecondary", children: fallBackMessage })
|
|
4093
4667
|
}
|
|
4094
4668
|
)
|
|
4095
4669
|
]
|
|
4096
4670
|
}
|
|
4097
4671
|
),
|
|
4098
|
-
/* @__PURE__ */ (0,
|
|
4672
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4099
4673
|
ExportDialog,
|
|
4100
4674
|
{
|
|
4101
4675
|
open: openExportDialog,
|
|
@@ -4106,7 +4680,7 @@ var GenericDataGrid = ({
|
|
|
4106
4680
|
username: usuario || "anonymous"
|
|
4107
4681
|
}
|
|
4108
4682
|
),
|
|
4109
|
-
/* @__PURE__ */ (0,
|
|
4683
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4110
4684
|
ConfirmDialog,
|
|
4111
4685
|
{
|
|
4112
4686
|
open: openConfirmDialog,
|
|
@@ -4115,7 +4689,7 @@ var GenericDataGrid = ({
|
|
|
4115
4689
|
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."
|
|
4116
4690
|
}
|
|
4117
4691
|
),
|
|
4118
|
-
/* @__PURE__ */ (0,
|
|
4692
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4119
4693
|
DataGridOptionsDialog,
|
|
4120
4694
|
{
|
|
4121
4695
|
open: openDataGridOptions,
|
|
@@ -4124,7 +4698,7 @@ var GenericDataGrid = ({
|
|
|
4124
4698
|
anchorEl: dataGridOptionsAnchorEl
|
|
4125
4699
|
}
|
|
4126
4700
|
),
|
|
4127
|
-
/* @__PURE__ */ (0,
|
|
4701
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4128
4702
|
ImportDialog,
|
|
4129
4703
|
{
|
|
4130
4704
|
open: openImportDialog,
|
|
@@ -4133,14 +4707,14 @@ var GenericDataGrid = ({
|
|
|
4133
4707
|
loading
|
|
4134
4708
|
}
|
|
4135
4709
|
),
|
|
4136
|
-
/* @__PURE__ */ (0,
|
|
4137
|
-
|
|
4710
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4711
|
+
import_material18.Dialog,
|
|
4138
4712
|
{
|
|
4139
4713
|
open: openVerticalEditDialog,
|
|
4140
4714
|
onClose: () => setOpenVerticalEditDialog(false),
|
|
4141
4715
|
maxWidth: "sm",
|
|
4142
4716
|
fullWidth: true,
|
|
4143
|
-
children: rowToEditVertical && /* @__PURE__ */ (0,
|
|
4717
|
+
children: rowToEditVertical && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4144
4718
|
VerticalEditorPage,
|
|
4145
4719
|
{
|
|
4146
4720
|
tableName,
|
|
@@ -4184,28 +4758,29 @@ var GenericDataGrid = ({
|
|
|
4184
4758
|
}
|
|
4185
4759
|
)
|
|
4186
4760
|
}
|
|
4187
|
-
)
|
|
4761
|
+
),
|
|
4762
|
+
contenidoDeCelda && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VentanaDeTexto, { anclaje: contenidoDeCelda.anclaje, texto: contenidoDeCelda.texto, editable: false, onAceptar: cerrarContenidoDeCelda, onCerrar: cerrarContenidoDeCelda })
|
|
4188
4763
|
] }) });
|
|
4189
4764
|
};
|
|
4190
4765
|
var GenericDataGrid_default = GenericDataGrid;
|
|
4191
4766
|
|
|
4192
4767
|
// src/App.tsx
|
|
4193
|
-
var
|
|
4768
|
+
var import_react42 = __toESM(require("react"), 1);
|
|
4194
4769
|
var import_react_router_dom15 = require("react-router-dom");
|
|
4195
4770
|
|
|
4196
4771
|
// src/components/MainLayout.tsx
|
|
4197
|
-
var
|
|
4772
|
+
var import_react29 = require("react");
|
|
4198
4773
|
var import_react_router_dom4 = require("react-router-dom");
|
|
4199
|
-
var
|
|
4774
|
+
var import_material20 = require("@mui/material");
|
|
4200
4775
|
|
|
4201
4776
|
// src/contexts/AppContext.tsx
|
|
4202
|
-
var
|
|
4777
|
+
var import_react26 = require("react");
|
|
4203
4778
|
var import_react_router_dom = require("react-router-dom");
|
|
4204
4779
|
var import_react_redux2 = require("react-redux");
|
|
4205
|
-
var
|
|
4206
|
-
var AuthContext = (0,
|
|
4780
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4781
|
+
var AuthContext = (0, import_react26.createContext)(void 0);
|
|
4207
4782
|
var useApp = () => {
|
|
4208
|
-
const context = (0,
|
|
4783
|
+
const context = (0, import_react26.useContext)(AuthContext);
|
|
4209
4784
|
if (!context) {
|
|
4210
4785
|
throw new Error("useApp must be used within an AppProvider");
|
|
4211
4786
|
}
|
|
@@ -4214,15 +4789,15 @@ var useApp = () => {
|
|
|
4214
4789
|
};
|
|
4215
4790
|
var AppProvider = ({ children, publicPaths = [] }) => {
|
|
4216
4791
|
console.log("AppProvider rendered/re-rendered");
|
|
4217
|
-
const [isLoggedIn, setIsLoggedIn] = (0,
|
|
4218
|
-
const [showSessionExpiredMessage, setShowSessionExpiredMessage] = (0,
|
|
4219
|
-
const isRedirectingRef = (0,
|
|
4220
|
-
const huboSesionRef = (0,
|
|
4792
|
+
const [isLoggedIn, setIsLoggedIn] = (0, import_react26.useState)(false);
|
|
4793
|
+
const [showSessionExpiredMessage, setShowSessionExpiredMessage] = (0, import_react26.useState)(false);
|
|
4794
|
+
const isRedirectingRef = (0, import_react26.useRef)(false);
|
|
4795
|
+
const huboSesionRef = (0, import_react26.useRef)(false);
|
|
4221
4796
|
const dispatch = (0, import_react_redux2.useDispatch)();
|
|
4222
4797
|
const clientContext = (0, import_react_redux2.useSelector)((state) => state.clientContext);
|
|
4223
4798
|
if (clientContext.status === "succeeded") huboSesionRef.current = true;
|
|
4224
4799
|
const navigate = (0, import_react_router_dom.useNavigate)();
|
|
4225
|
-
const handleExpiredSessionRedirect = (0,
|
|
4800
|
+
const handleExpiredSessionRedirect = (0, import_react26.useCallback)(() => {
|
|
4226
4801
|
isRedirectingRef.current = true;
|
|
4227
4802
|
setShowSessionExpiredMessage(false);
|
|
4228
4803
|
setIsLoggedIn(false);
|
|
@@ -4232,11 +4807,11 @@ var AppProvider = ({ children, publicPaths = [] }) => {
|
|
|
4232
4807
|
}, 2e3);
|
|
4233
4808
|
}, [navigate]);
|
|
4234
4809
|
const location = (0, import_react_router_dom.useLocation)();
|
|
4235
|
-
const isCurrentPathPublic = (0,
|
|
4810
|
+
const isCurrentPathPublic = (0, import_react26.useCallback)(() => {
|
|
4236
4811
|
const current = location.pathname;
|
|
4237
4812
|
return publicPaths.some((path) => current === path || current.startsWith(`${path}/`));
|
|
4238
4813
|
}, [location.pathname, publicPaths]);
|
|
4239
|
-
const checkSession = (0,
|
|
4814
|
+
const checkSession = (0, import_react26.useCallback)(async () => {
|
|
4240
4815
|
if (isRedirectingRef.current) return;
|
|
4241
4816
|
try {
|
|
4242
4817
|
const response = await fetchApi("/keep-alive.json", { method: "GET" });
|
|
@@ -4274,14 +4849,14 @@ var AppProvider = ({ children, publicPaths = [] }) => {
|
|
|
4274
4849
|
}
|
|
4275
4850
|
}
|
|
4276
4851
|
}, [dispatch, clientContext.status, showSessionExpiredMessage, isCurrentPathPublic]);
|
|
4277
|
-
(0,
|
|
4852
|
+
(0, import_react26.useEffect)(() => {
|
|
4278
4853
|
checkSession();
|
|
4279
4854
|
const intervalId = setInterval(checkSession, 15 * 1e3);
|
|
4280
4855
|
return () => {
|
|
4281
4856
|
clearInterval(intervalId);
|
|
4282
4857
|
};
|
|
4283
4858
|
}, [checkSession]);
|
|
4284
|
-
const authContextValue = (0,
|
|
4859
|
+
const authContextValue = (0, import_react26.useMemo)(() => ({
|
|
4285
4860
|
isLoggedIn,
|
|
4286
4861
|
setIsLoggedIn,
|
|
4287
4862
|
checkSession,
|
|
@@ -4296,7 +4871,7 @@ var AppProvider = ({ children, publicPaths = [] }) => {
|
|
|
4296
4871
|
setShowSessionExpiredMessage,
|
|
4297
4872
|
handleExpiredSessionRedirect
|
|
4298
4873
|
]);
|
|
4299
|
-
return /* @__PURE__ */ (0,
|
|
4874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AuthContext.Provider, { value: authContextValue, children });
|
|
4300
4875
|
};
|
|
4301
4876
|
|
|
4302
4877
|
// src/components/MainLayout.tsx
|
|
@@ -4305,8 +4880,8 @@ var import_Menu = __toESM(require("@mui/icons-material/Menu"), 1);
|
|
|
4305
4880
|
var import_ChevronLeft = __toESM(require("@mui/icons-material/ChevronLeft"), 1);
|
|
4306
4881
|
|
|
4307
4882
|
// src/components/SideMenu.tsx
|
|
4308
|
-
var
|
|
4309
|
-
var
|
|
4883
|
+
var import_react27 = __toESM(require("react"), 1);
|
|
4884
|
+
var import_material19 = require("@mui/material");
|
|
4310
4885
|
var import_ExpandLess = __toESM(require("@mui/icons-material/ExpandLess"), 1);
|
|
4311
4886
|
var import_ExpandMore = __toESM(require("@mui/icons-material/ExpandMore"), 1);
|
|
4312
4887
|
var import_TableChart = __toESM(require("@mui/icons-material/TableChart"), 1);
|
|
@@ -4339,7 +4914,7 @@ function itemInicial(menu) {
|
|
|
4339
4914
|
}
|
|
4340
4915
|
|
|
4341
4916
|
// src/components/SideMenu.tsx
|
|
4342
|
-
var
|
|
4917
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4343
4918
|
var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
4344
4919
|
const navigate = (0, import_react_router_dom2.useNavigate)();
|
|
4345
4920
|
const location = (0, import_react_router_dom2.useLocation)();
|
|
@@ -4358,17 +4933,17 @@ var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
|
4358
4933
|
const getIcon = (item2) => {
|
|
4359
4934
|
switch (item2.menuType) {
|
|
4360
4935
|
case "table":
|
|
4361
|
-
return /* @__PURE__ */ (0,
|
|
4936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_TableChart.default, { sx: { color: import_colors.blue[700] } });
|
|
4362
4937
|
case "proc":
|
|
4363
|
-
return /* @__PURE__ */ (0,
|
|
4938
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_Dns.default, { sx: { color: import_colors.teal[700] } });
|
|
4364
4939
|
case "menu":
|
|
4365
|
-
return /* @__PURE__ */ (0,
|
|
4940
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_Folder.default, { sx: { color: import_colors.orange[800] } });
|
|
4366
4941
|
default:
|
|
4367
4942
|
const WScreenComponent = wScreens[item2.menuType];
|
|
4368
4943
|
if (WScreenComponent !== void 0) {
|
|
4369
|
-
return /* @__PURE__ */ (0,
|
|
4944
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_DesktopWindows.default, { sx: { color: import_colors.grey[700] } });
|
|
4370
4945
|
}
|
|
4371
|
-
return /* @__PURE__ */ (0,
|
|
4946
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_WarningAmber3.default, { sx: { color: import_colors.red[500] } });
|
|
4372
4947
|
}
|
|
4373
4948
|
};
|
|
4374
4949
|
const currentPath = location.pathname;
|
|
@@ -4382,27 +4957,27 @@ var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
|
4382
4957
|
} else if (item.menuType !== "menu") {
|
|
4383
4958
|
isSelected = currentPath.startsWith(`/wScreens/${item.menuType}`) || currentPath.startsWith(`/wScreens-fallback/${item.menuType}`);
|
|
4384
4959
|
}
|
|
4385
|
-
const itemRef =
|
|
4386
|
-
(0,
|
|
4960
|
+
const itemRef = import_react27.default.useRef(null);
|
|
4961
|
+
(0, import_react27.useEffect)(() => {
|
|
4387
4962
|
if (isSelected && itemRef.current) {
|
|
4388
4963
|
itemRef.current.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
4389
4964
|
}
|
|
4390
4965
|
}, [isSelected]);
|
|
4391
|
-
return /* @__PURE__ */ (0,
|
|
4392
|
-
/* @__PURE__ */ (0,
|
|
4393
|
-
|
|
4966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { ref: itemRef, children: [
|
|
4967
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
4968
|
+
import_material19.ListItemButton,
|
|
4394
4969
|
{
|
|
4395
4970
|
onClick: handleClick,
|
|
4396
4971
|
sx: { pl: level * 2 },
|
|
4397
4972
|
selected: isSelected,
|
|
4398
4973
|
children: [
|
|
4399
|
-
/* @__PURE__ */ (0,
|
|
4400
|
-
/* @__PURE__ */ (0,
|
|
4401
|
-
item.menuType === "menu" ? open ? /* @__PURE__ */ (0,
|
|
4974
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.ListItemIcon, { sx: { minWidth: "38px" }, children: getIcon(item) }),
|
|
4975
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.ListItemText, { primary: item.label || item.name }),
|
|
4976
|
+
item.menuType === "menu" ? open ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_ExpandLess.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_ExpandMore.default, {}) : null
|
|
4402
4977
|
]
|
|
4403
4978
|
}
|
|
4404
4979
|
),
|
|
4405
|
-
item.menuType === "menu" && /* @__PURE__ */ (0,
|
|
4980
|
+
item.menuType === "menu" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Collapse, { in: open, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.List, { component: "div", disablePadding: true, children: item.menuContent.map((subItem) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4406
4981
|
MenuListItem,
|
|
4407
4982
|
{
|
|
4408
4983
|
item: subItem,
|
|
@@ -4426,9 +5001,9 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
4426
5001
|
dispatch(setAllSubMenusOpen(!isMostlyOpen));
|
|
4427
5002
|
};
|
|
4428
5003
|
if (!clientContext || !clientContext.menu) {
|
|
4429
|
-
return /* @__PURE__ */ (0,
|
|
5004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Box, { sx: { p: 2, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Typography, { variant: "body2", color: "text.secondary", children: "Cargando men\xFA..." }) });
|
|
4430
5005
|
}
|
|
4431
|
-
(0,
|
|
5006
|
+
(0, import_react27.useEffect)(() => {
|
|
4432
5007
|
if (!clientContext?.menu) return;
|
|
4433
5008
|
const expandParents = (items, targetPath, parentNames = []) => {
|
|
4434
5009
|
const pathParts = targetPath.split("/");
|
|
@@ -4457,13 +5032,13 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
4457
5032
|
};
|
|
4458
5033
|
expandParents(clientContext.menu, location.pathname);
|
|
4459
5034
|
}, [location.pathname, clientContext, dispatch]);
|
|
4460
|
-
return /* @__PURE__ */ (0,
|
|
4461
|
-
clientContext.menu.some((item) => item.menuType === "menu") && /* @__PURE__ */ (0,
|
|
4462
|
-
/* @__PURE__ */ (0,
|
|
4463
|
-
/* @__PURE__ */ (0,
|
|
5035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material19.Box, { sx: { width: "100%", flexShrink: 0 }, children: [
|
|
5036
|
+
clientContext.menu.some((item) => item.menuType === "menu") && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.ListItem, { disablePadding: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material19.ListItemButton, { onClick: handleToggleAllSubMenus, children: [
|
|
5037
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.ListItemIcon, { sx: { minWidth: "38px" }, children: isMostlyOpen ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_UnfoldLess.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_UnfoldMore.default, {}) }),
|
|
5038
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.ListItemText, { primary: isMostlyOpen ? "colapsar " : "expandir" })
|
|
4464
5039
|
] }) }),
|
|
4465
|
-
/* @__PURE__ */ (0,
|
|
4466
|
-
/* @__PURE__ */ (0,
|
|
5040
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Divider, {}),
|
|
5041
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.List, { children: clientContext.menu.map((menuItem) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4467
5042
|
MenuListItem,
|
|
4468
5043
|
{
|
|
4469
5044
|
item: menuItem,
|
|
@@ -4477,14 +5052,14 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
4477
5052
|
var SideMenu_default = SideMenu;
|
|
4478
5053
|
|
|
4479
5054
|
// src/hooks/useLogout.tsx
|
|
4480
|
-
var
|
|
5055
|
+
var import_react28 = require("react");
|
|
4481
5056
|
var import_react_router_dom3 = require("react-router-dom");
|
|
4482
5057
|
var import_react_redux3 = require("react-redux");
|
|
4483
5058
|
var useLogout = () => {
|
|
4484
5059
|
const { setIsLoggedIn } = useApp();
|
|
4485
5060
|
const dispatch = (0, import_react_redux3.useDispatch)();
|
|
4486
5061
|
const navigate = (0, import_react_router_dom3.useNavigate)();
|
|
4487
|
-
const logout = (0,
|
|
5062
|
+
const logout = (0, import_react28.useCallback)(async () => {
|
|
4488
5063
|
try {
|
|
4489
5064
|
const response = await fetchApi("/logout", { method: "GET" });
|
|
4490
5065
|
if (response.status === 401 || response.ok) {
|
|
@@ -4505,16 +5080,16 @@ var useLogout = () => {
|
|
|
4505
5080
|
var useLogout_default = useLogout;
|
|
4506
5081
|
|
|
4507
5082
|
// src/components/MainLayout.tsx
|
|
4508
|
-
var
|
|
5083
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4509
5084
|
var drawerWidth = 240;
|
|
4510
5085
|
var MainLayout = () => {
|
|
4511
5086
|
const { clientContext } = useApp();
|
|
4512
5087
|
const logout = useLogout_default();
|
|
4513
5088
|
const isDrawerOpen = useIsDrawerOpen();
|
|
4514
5089
|
const dispatch = useAppDispatch();
|
|
4515
|
-
const theme = (0,
|
|
4516
|
-
const isMobile = (0,
|
|
4517
|
-
(0,
|
|
5090
|
+
const theme = (0, import_material20.useTheme)();
|
|
5091
|
+
const isMobile = (0, import_material20.useMediaQuery)(theme.breakpoints.down("sm"));
|
|
5092
|
+
(0, import_react29.useEffect)(() => {
|
|
4518
5093
|
if (isMobile && isDrawerOpen) {
|
|
4519
5094
|
dispatch(setDrawerOpen(false));
|
|
4520
5095
|
}
|
|
@@ -4528,12 +5103,12 @@ var MainLayout = () => {
|
|
|
4528
5103
|
}
|
|
4529
5104
|
};
|
|
4530
5105
|
if (!clientContext) {
|
|
4531
|
-
return /* @__PURE__ */ (0,
|
|
5106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Box, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Typography, { children: "Cargando dise\xF1o de la aplicaci\xF3n..." }) });
|
|
4532
5107
|
}
|
|
4533
|
-
return /* @__PURE__ */ (0,
|
|
4534
|
-
/* @__PURE__ */ (0,
|
|
4535
|
-
/* @__PURE__ */ (0,
|
|
4536
|
-
|
|
5108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Box, { sx: { display: "flex", height: "100vh" }, children: [
|
|
5109
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.CssBaseline, {}),
|
|
5110
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5111
|
+
import_material20.AppBar,
|
|
4537
5112
|
{
|
|
4538
5113
|
position: "fixed",
|
|
4539
5114
|
sx: {
|
|
@@ -4551,9 +5126,9 @@ var MainLayout = () => {
|
|
|
4551
5126
|
})
|
|
4552
5127
|
}
|
|
4553
5128
|
},
|
|
4554
|
-
children: /* @__PURE__ */ (0,
|
|
4555
|
-
/* @__PURE__ */ (0,
|
|
4556
|
-
|
|
5129
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Toolbar, { children: [
|
|
5130
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5131
|
+
import_material20.IconButton,
|
|
4557
5132
|
{
|
|
4558
5133
|
color: "inherit",
|
|
4559
5134
|
"aria-label": "open drawer",
|
|
@@ -4562,10 +5137,10 @@ var MainLayout = () => {
|
|
|
4562
5137
|
sx: {
|
|
4563
5138
|
marginRight: 2
|
|
4564
5139
|
},
|
|
4565
|
-
children: isDrawerOpen ? /* @__PURE__ */ (0,
|
|
5140
|
+
children: isDrawerOpen ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_ChevronLeft.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_Menu.default, {})
|
|
4566
5141
|
}
|
|
4567
5142
|
),
|
|
4568
|
-
!isDrawerOpen && /* @__PURE__ */ (0,
|
|
5143
|
+
!isDrawerOpen && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4569
5144
|
"img",
|
|
4570
5145
|
{
|
|
4571
5146
|
src: `${envConfig.backendUrl}/img/logo-128.png`,
|
|
@@ -4573,22 +5148,22 @@ var MainLayout = () => {
|
|
|
4573
5148
|
style: { height: "32px", marginRight: "12px", objectFit: "contain" }
|
|
4574
5149
|
}
|
|
4575
5150
|
),
|
|
4576
|
-
/* @__PURE__ */ (0,
|
|
4577
|
-
/* @__PURE__ */ (0,
|
|
4578
|
-
/* @__PURE__ */ (0,
|
|
4579
|
-
|
|
5151
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Typography, { variant: "h6", noWrap: true, component: "div", sx: { flexGrow: 1 }, children: isDrawerOpen ? "" : clientContext.config.title }),
|
|
5152
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Typography, { variant: "subtitle1", component: "div", sx: { mr: 2 }, children: clientContext.username }),
|
|
5153
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5154
|
+
import_material20.Button,
|
|
4580
5155
|
{
|
|
4581
5156
|
color: "inherit",
|
|
4582
5157
|
onClick: logout,
|
|
4583
|
-
startIcon: /* @__PURE__ */ (0,
|
|
5158
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_Logout.default, {}),
|
|
4584
5159
|
children: "Salir"
|
|
4585
5160
|
}
|
|
4586
5161
|
)
|
|
4587
5162
|
] })
|
|
4588
5163
|
}
|
|
4589
5164
|
),
|
|
4590
|
-
/* @__PURE__ */ (0,
|
|
4591
|
-
|
|
5165
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
5166
|
+
import_material20.Drawer,
|
|
4592
5167
|
{
|
|
4593
5168
|
variant: "persistent",
|
|
4594
5169
|
anchor: "left",
|
|
@@ -4604,8 +5179,8 @@ var MainLayout = () => {
|
|
|
4604
5179
|
}
|
|
4605
5180
|
},
|
|
4606
5181
|
children: [
|
|
4607
|
-
/* @__PURE__ */ (0,
|
|
4608
|
-
|
|
5182
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
5183
|
+
import_material20.Toolbar,
|
|
4609
5184
|
{
|
|
4610
5185
|
sx: {
|
|
4611
5186
|
display: "flex",
|
|
@@ -4617,7 +5192,7 @@ var MainLayout = () => {
|
|
|
4617
5192
|
gap: 1.5
|
|
4618
5193
|
},
|
|
4619
5194
|
children: [
|
|
4620
|
-
/* @__PURE__ */ (0,
|
|
5195
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4621
5196
|
"img",
|
|
4622
5197
|
{
|
|
4623
5198
|
src: `${envConfig.backendUrl}/img/logo-128.png`,
|
|
@@ -4625,16 +5200,16 @@ var MainLayout = () => {
|
|
|
4625
5200
|
style: { height: "32px", objectFit: "contain" }
|
|
4626
5201
|
}
|
|
4627
5202
|
),
|
|
4628
|
-
/* @__PURE__ */ (0,
|
|
5203
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Typography, { variant: "h6", sx: { fontWeight: "bold" }, children: clientContext.config.title })
|
|
4629
5204
|
]
|
|
4630
5205
|
}
|
|
4631
5206
|
),
|
|
4632
|
-
/* @__PURE__ */ (0,
|
|
5207
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SideMenu_default, { onMenuItemClick: handleDrawerCloseMobile })
|
|
4633
5208
|
]
|
|
4634
5209
|
}
|
|
4635
5210
|
),
|
|
4636
|
-
/* @__PURE__ */ (0,
|
|
4637
|
-
|
|
5211
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
5212
|
+
import_material20.Box,
|
|
4638
5213
|
{
|
|
4639
5214
|
component: "main",
|
|
4640
5215
|
sx: {
|
|
@@ -4660,8 +5235,8 @@ var MainLayout = () => {
|
|
|
4660
5235
|
width: isDrawerOpen ? `calc(100% - ${drawerWidth}px)` : "100%"
|
|
4661
5236
|
},
|
|
4662
5237
|
children: [
|
|
4663
|
-
/* @__PURE__ */ (0,
|
|
4664
|
-
/* @__PURE__ */ (0,
|
|
5238
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Toolbar, {}),
|
|
5239
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Box, { sx: { flex: 1, minHeight: 0, overflowY: "auto", display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_router_dom4.Outlet, {}) })
|
|
4665
5240
|
]
|
|
4666
5241
|
}
|
|
4667
5242
|
)
|
|
@@ -4670,8 +5245,8 @@ var MainLayout = () => {
|
|
|
4670
5245
|
var MainLayout_default = MainLayout;
|
|
4671
5246
|
|
|
4672
5247
|
// src/components/SessionExpiredMessage.tsx
|
|
4673
|
-
var
|
|
4674
|
-
var
|
|
5248
|
+
var import_material21 = require("@mui/material");
|
|
5249
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4675
5250
|
var style = {
|
|
4676
5251
|
position: "absolute",
|
|
4677
5252
|
top: "50%",
|
|
@@ -4690,8 +5265,8 @@ var SessionExpiredMessage = () => {
|
|
|
4690
5265
|
const handleClose = () => {
|
|
4691
5266
|
handleExpiredSessionRedirect();
|
|
4692
5267
|
};
|
|
4693
|
-
return /* @__PURE__ */ (0,
|
|
4694
|
-
|
|
5268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5269
|
+
import_material21.Modal,
|
|
4695
5270
|
{
|
|
4696
5271
|
open: showSessionExpiredMessage,
|
|
4697
5272
|
onClose: () => {
|
|
@@ -4710,10 +5285,10 @@ var SessionExpiredMessage = () => {
|
|
|
4710
5285
|
}
|
|
4711
5286
|
}
|
|
4712
5287
|
},
|
|
4713
|
-
children: /* @__PURE__ */ (0,
|
|
4714
|
-
/* @__PURE__ */ (0,
|
|
4715
|
-
/* @__PURE__ */ (0,
|
|
4716
|
-
/* @__PURE__ */ (0,
|
|
5288
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material21.Box, { sx: style, children: [
|
|
5289
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Typography, { id: "session-expired-modal-title", variant: "h6", component: "h2", gutterBottom: true, children: "\xA1Sesi\xF3n Expirada!" }),
|
|
5290
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Typography, { 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." }),
|
|
5291
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Button, { variant: "contained", color: "primary", onClick: handleClose, children: "Ir al Login" })
|
|
4717
5292
|
] })
|
|
4718
5293
|
}
|
|
4719
5294
|
);
|
|
@@ -4722,24 +5297,24 @@ var SessionExpiredMessage_default = SessionExpiredMessage;
|
|
|
4722
5297
|
|
|
4723
5298
|
// src/pages/PantallaInicial.tsx
|
|
4724
5299
|
var import_react_router_dom5 = require("react-router-dom");
|
|
4725
|
-
var
|
|
5300
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4726
5301
|
var PantallaInicial = () => {
|
|
4727
5302
|
const { clientContext } = useApp();
|
|
4728
5303
|
const item = clientContext.menu ? itemInicial(clientContext.menu) : void 0;
|
|
4729
|
-
return item ? /* @__PURE__ */ (0,
|
|
5304
|
+
return item ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_router_dom5.Navigate, { to: rutaDeItemDeMenu(item), replace: true }) : null;
|
|
4730
5305
|
};
|
|
4731
5306
|
var PantallaInicial_default = PantallaInicial;
|
|
4732
5307
|
|
|
4733
5308
|
// src/pages/LogoutPage.tsx
|
|
4734
|
-
var
|
|
4735
|
-
var
|
|
4736
|
-
var
|
|
5309
|
+
var import_react30 = require("react");
|
|
5310
|
+
var import_material22 = require("@mui/material");
|
|
5311
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4737
5312
|
var LogoutPage = () => {
|
|
4738
5313
|
const logout = useLogout_default();
|
|
4739
|
-
(0,
|
|
5314
|
+
(0, import_react30.useEffect)(() => {
|
|
4740
5315
|
logout();
|
|
4741
5316
|
}, [logout]);
|
|
4742
|
-
return /* @__PURE__ */ (0,
|
|
5317
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material22.Box, { sx: {
|
|
4743
5318
|
display: "flex",
|
|
4744
5319
|
flexDirection: "column",
|
|
4745
5320
|
justifyContent: "center",
|
|
@@ -4747,20 +5322,20 @@ var LogoutPage = () => {
|
|
|
4747
5322
|
height: "100vh",
|
|
4748
5323
|
textAlign: "center"
|
|
4749
5324
|
}, children: [
|
|
4750
|
-
/* @__PURE__ */ (0,
|
|
4751
|
-
/* @__PURE__ */ (0,
|
|
5325
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.CircularProgress, { size: 60 }),
|
|
5326
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.Typography, { variant: "h6", sx: { mt: 2 }, children: "Cerrando sesi\xF3n..." })
|
|
4752
5327
|
] });
|
|
4753
5328
|
};
|
|
4754
5329
|
var LogoutPage_default = LogoutPage;
|
|
4755
5330
|
|
|
4756
5331
|
// src/pages/LoginPage.tsx
|
|
4757
|
-
var
|
|
4758
|
-
var
|
|
5332
|
+
var import_react31 = require("react");
|
|
5333
|
+
var import_material23 = require("@mui/material");
|
|
4759
5334
|
var import_react_hook_form = require("react-hook-form");
|
|
4760
5335
|
var import_zod = require("@hookform/resolvers/zod");
|
|
4761
5336
|
var z = __toESM(require("zod"), 1);
|
|
4762
5337
|
var import_react_redux4 = require("react-redux");
|
|
4763
|
-
var
|
|
5338
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4764
5339
|
var loginSchema = z.object({
|
|
4765
5340
|
username: z.string().min(1, "El usuario es requerido"),
|
|
4766
5341
|
// Añadir validación básica
|
|
@@ -4768,8 +5343,8 @@ var loginSchema = z.object({
|
|
|
4768
5343
|
// Añadir validación básica
|
|
4769
5344
|
});
|
|
4770
5345
|
var LoginPage = () => {
|
|
4771
|
-
const [loginError, setLoginError] = (0,
|
|
4772
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
5346
|
+
const [loginError, setLoginError] = (0, import_react31.useState)(null);
|
|
5347
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react31.useState)(false);
|
|
4773
5348
|
const { setIsLoggedIn, checkSession } = useApp();
|
|
4774
5349
|
const dispatch = (0, import_react_redux4.useDispatch)();
|
|
4775
5350
|
const {
|
|
@@ -4814,16 +5389,16 @@ var LoginPage = () => {
|
|
|
4814
5389
|
setIsSubmitting(false);
|
|
4815
5390
|
}
|
|
4816
5391
|
};
|
|
4817
|
-
return /* @__PURE__ */ (0,
|
|
4818
|
-
|
|
5392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5393
|
+
import_material23.Box,
|
|
4819
5394
|
{
|
|
4820
5395
|
display: "flex",
|
|
4821
5396
|
alignItems: "center",
|
|
4822
5397
|
justifyContent: "center",
|
|
4823
5398
|
minHeight: "100vh",
|
|
4824
5399
|
bgcolor: "#f5f5f5",
|
|
4825
|
-
children: /* @__PURE__ */ (0,
|
|
4826
|
-
|
|
5400
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5401
|
+
import_material23.Box,
|
|
4827
5402
|
{
|
|
4828
5403
|
width: "100%",
|
|
4829
5404
|
maxWidth: "400px",
|
|
@@ -4832,7 +5407,7 @@ var LoginPage = () => {
|
|
|
4832
5407
|
borderRadius: 8,
|
|
4833
5408
|
boxShadow: 3,
|
|
4834
5409
|
children: [
|
|
4835
|
-
/* @__PURE__ */ (0,
|
|
5410
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material23.Box, { sx: { display: "flex", justifyContent: "center", mb: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4836
5411
|
"img",
|
|
4837
5412
|
{
|
|
4838
5413
|
src: `${envConfig.backendUrl}/img/login-logo-icon.png`,
|
|
@@ -4840,17 +5415,17 @@ var LoginPage = () => {
|
|
|
4840
5415
|
style: { height: "192px", maxWidth: "100%", objectFit: "contain" }
|
|
4841
5416
|
}
|
|
4842
5417
|
) }),
|
|
4843
|
-
/* @__PURE__ */ (0,
|
|
4844
|
-
/* @__PURE__ */ (0,
|
|
4845
|
-
/* @__PURE__ */ (0,
|
|
4846
|
-
/* @__PURE__ */ (0,
|
|
4847
|
-
/* @__PURE__ */ (0,
|
|
5418
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material23.Typography, { variant: "h5", align: "center", gutterBottom: true, sx: { fontWeight: "bold", color: "primary.main" }, children: "Iniciar Sesi\xF3n" }),
|
|
5419
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("form", { onSubmit: handleSubmit(onSubmit), className: "space-y-4", children: [
|
|
5420
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { children: [
|
|
5421
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("label", { htmlFor: "username", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material23.Typography, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Usuario" }) }),
|
|
5422
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4848
5423
|
import_react_hook_form.Controller,
|
|
4849
5424
|
{
|
|
4850
5425
|
name: "username",
|
|
4851
5426
|
control,
|
|
4852
|
-
render: ({ field }) => /* @__PURE__ */ (0,
|
|
4853
|
-
|
|
5427
|
+
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5428
|
+
import_material23.TextField,
|
|
4854
5429
|
{
|
|
4855
5430
|
...field,
|
|
4856
5431
|
type: "text",
|
|
@@ -4865,15 +5440,15 @@ var LoginPage = () => {
|
|
|
4865
5440
|
}
|
|
4866
5441
|
)
|
|
4867
5442
|
] }),
|
|
4868
|
-
/* @__PURE__ */ (0,
|
|
4869
|
-
/* @__PURE__ */ (0,
|
|
4870
|
-
/* @__PURE__ */ (0,
|
|
5443
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { children: [
|
|
5444
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("label", { htmlFor: "password", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material23.Typography, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Contrase\xF1a" }) }),
|
|
5445
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4871
5446
|
import_react_hook_form.Controller,
|
|
4872
5447
|
{
|
|
4873
5448
|
name: "password",
|
|
4874
5449
|
control,
|
|
4875
|
-
render: ({ field }) => /* @__PURE__ */ (0,
|
|
4876
|
-
|
|
5450
|
+
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5451
|
+
import_material23.TextField,
|
|
4877
5452
|
{
|
|
4878
5453
|
...field,
|
|
4879
5454
|
type: "password",
|
|
@@ -4888,14 +5463,14 @@ var LoginPage = () => {
|
|
|
4888
5463
|
}
|
|
4889
5464
|
)
|
|
4890
5465
|
] }),
|
|
4891
|
-
/* @__PURE__ */ (0,
|
|
4892
|
-
/* @__PURE__ */ (0,
|
|
5466
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material23.Button, { type: "submit", fullWidth: true, variant: "contained", color: "primary", disabled: isSubmitting, sx: { mt: 2 }, children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
5467
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material23.CircularProgress, { size: 20, sx: { mr: 1 } }),
|
|
4893
5468
|
"Iniciando sesi\xF3n..."
|
|
4894
5469
|
] }) : "Iniciar Sesi\xF3n" })
|
|
4895
5470
|
] }),
|
|
4896
|
-
loginError && /* @__PURE__ */ (0,
|
|
5471
|
+
loginError && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_material23.Alert, { severity: "error", sx: { mt: 2, maxHeight: "200px" }, children: [
|
|
4897
5472
|
" ",
|
|
4898
|
-
/* @__PURE__ */ (0,
|
|
5473
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material23.AlertTitle, { children: "Error" }),
|
|
4899
5474
|
loginError
|
|
4900
5475
|
] })
|
|
4901
5476
|
]
|
|
@@ -4907,19 +5482,19 @@ var LoginPage = () => {
|
|
|
4907
5482
|
var LoginPage_default = LoginPage;
|
|
4908
5483
|
|
|
4909
5484
|
// src/components/ProcedureForm.tsx
|
|
4910
|
-
var
|
|
5485
|
+
var import_react32 = __toESM(require("react"), 1);
|
|
4911
5486
|
var import_react_router_dom6 = require("react-router-dom");
|
|
4912
|
-
var
|
|
5487
|
+
var import_material25 = require("@mui/material");
|
|
4913
5488
|
|
|
4914
5489
|
// src/pages/procedure-results/SuccessDisplay.tsx
|
|
4915
|
-
var
|
|
4916
|
-
var
|
|
5490
|
+
var import_material24 = require("@mui/material");
|
|
5491
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4917
5492
|
var SuccessDisplay = ({ data }) => {
|
|
4918
|
-
return /* @__PURE__ */ (0,
|
|
4919
|
-
/* @__PURE__ */ (0,
|
|
4920
|
-
/* @__PURE__ */ (0,
|
|
4921
|
-
/* @__PURE__ */ (0,
|
|
4922
|
-
/* @__PURE__ */ (0,
|
|
5493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_material24.Paper, { elevation: 2, sx: { p: 2, mt: 2, bgcolor: "success.light", color: "success.contrastText" }, children: [
|
|
5494
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material24.Typography, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: "\xA1Operaci\xF3n Exitosa!" }),
|
|
5495
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material24.Typography, { variant: "body2", sx: { fontSize: "0.85rem" }, children: "Detalles del resultado:" }),
|
|
5496
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material24.Box, { sx: { bgcolor: "success.dark", p: 1, borderRadius: 1, mt: 1, overflowX: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(data, null, 2) }) }),
|
|
5497
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material24.Typography, { variant: "body2", sx: { fontSize: "0.8rem", mt: 1 }, children: "Puedes revisar los detalles anteriores o cerrar este mensaje." })
|
|
4923
5498
|
] });
|
|
4924
5499
|
};
|
|
4925
5500
|
var SuccessDisplay_default = SuccessDisplay;
|
|
@@ -4933,22 +5508,22 @@ var extendResultsOk = (newComponents) => {
|
|
|
4933
5508
|
};
|
|
4934
5509
|
|
|
4935
5510
|
// src/components/ProcedureForm.tsx
|
|
4936
|
-
var
|
|
5511
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4937
5512
|
var ProcedureForm = () => {
|
|
4938
5513
|
const { procedureName } = (0, import_react_router_dom6.useParams)();
|
|
4939
5514
|
const { clientContext } = useApp();
|
|
4940
5515
|
const { callApi, loading: apiLoading, error: apiError } = useApiCall();
|
|
4941
|
-
const [validationErrors, setValidationErrors] = (0,
|
|
4942
|
-
const [successMessage, setSuccessMessage] = (0,
|
|
4943
|
-
const [executionLog, setExecutionLog] = (0,
|
|
4944
|
-
const [procedureResultData, setProcedureResultData] = (0,
|
|
4945
|
-
const procedure = (0,
|
|
5516
|
+
const [validationErrors, setValidationErrors] = (0, import_react32.useState)({});
|
|
5517
|
+
const [successMessage, setSuccessMessage] = (0, import_react32.useState)(null);
|
|
5518
|
+
const [executionLog, setExecutionLog] = (0, import_react32.useState)([]);
|
|
5519
|
+
const [procedureResultData, setProcedureResultData] = (0, import_react32.useState)(null);
|
|
5520
|
+
const procedure = (0, import_react32.useMemo)(() => {
|
|
4946
5521
|
if (procedureName && clientContext?.procedure) {
|
|
4947
5522
|
return clientContext.procedure[procedureName];
|
|
4948
5523
|
}
|
|
4949
5524
|
return void 0;
|
|
4950
5525
|
}, [procedureName, clientContext]);
|
|
4951
|
-
const [formValues, setFormValues] = (0,
|
|
5526
|
+
const [formValues, setFormValues] = (0, import_react32.useState)(() => {
|
|
4952
5527
|
if (!procedure) return {};
|
|
4953
5528
|
const initialValues = {};
|
|
4954
5529
|
procedure.parameters.forEach((param) => {
|
|
@@ -4973,7 +5548,7 @@ var ProcedureForm = () => {
|
|
|
4973
5548
|
});
|
|
4974
5549
|
return initialValues;
|
|
4975
5550
|
});
|
|
4976
|
-
|
|
5551
|
+
import_react32.default.useEffect(() => {
|
|
4977
5552
|
if (procedure) {
|
|
4978
5553
|
setValidationErrors({});
|
|
4979
5554
|
setSuccessMessage(null);
|
|
@@ -5003,11 +5578,11 @@ var ProcedureForm = () => {
|
|
|
5003
5578
|
setExecutionLog([]);
|
|
5004
5579
|
}
|
|
5005
5580
|
}, [procedure]);
|
|
5006
|
-
const addLogMessage = (0,
|
|
5581
|
+
const addLogMessage = (0, import_react32.useCallback)((message, isError = false) => {
|
|
5007
5582
|
const timestamp = (/* @__PURE__ */ new Date()).toLocaleTimeString("es-AR");
|
|
5008
5583
|
setExecutionLog((prev) => [...prev, `[${timestamp}] ${isError ? "ERROR: " : ""}${message}`]);
|
|
5009
5584
|
}, []);
|
|
5010
|
-
const handleChange = (0,
|
|
5585
|
+
const handleChange = (0, import_react32.useCallback)((e, child) => {
|
|
5011
5586
|
const { name, value } = e.target;
|
|
5012
5587
|
let newValue = value;
|
|
5013
5588
|
if (e.target.type === "checkbox") {
|
|
@@ -5129,7 +5704,7 @@ var ProcedureForm = () => {
|
|
|
5129
5704
|
addLogMessage("Ejecuci\xF3n finalizada.");
|
|
5130
5705
|
}
|
|
5131
5706
|
};
|
|
5132
|
-
const renderInputField = (0,
|
|
5707
|
+
const renderInputField = (0, import_react32.useCallback)((param) => {
|
|
5133
5708
|
const hasError = !!validationErrors[param.name];
|
|
5134
5709
|
const errorMessage = validationErrors[param.name];
|
|
5135
5710
|
const commonProps = {
|
|
@@ -5148,10 +5723,10 @@ var ProcedureForm = () => {
|
|
|
5148
5723
|
sx: { fontSize: "0.8rem" }
|
|
5149
5724
|
};
|
|
5150
5725
|
if (param.options && param.options.length > 0) {
|
|
5151
|
-
return /* @__PURE__ */ (0,
|
|
5152
|
-
/* @__PURE__ */ (0,
|
|
5153
|
-
/* @__PURE__ */ (0,
|
|
5154
|
-
|
|
5726
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material25.FormControl, { fullWidth: true, margin: "dense", size: "small", error: hasError, required: commonProps.required, children: [
|
|
5727
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.InputLabel, { id: `${param.name}-label`, sx: { fontSize: "0.8rem" }, children: param.label || param.name }),
|
|
5728
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5729
|
+
import_material25.Select,
|
|
5155
5730
|
{
|
|
5156
5731
|
labelId: `${param.name}-label`,
|
|
5157
5732
|
value: formValues[param.name] === void 0 ? "" : formValues[param.name],
|
|
@@ -5161,14 +5736,14 @@ var ProcedureForm = () => {
|
|
|
5161
5736
|
label: param.label || param.name,
|
|
5162
5737
|
disabled: apiLoading,
|
|
5163
5738
|
sx: { fontSize: "0.8rem" },
|
|
5164
|
-
renderValue: (selected) => /* @__PURE__ */ (0,
|
|
5739
|
+
renderValue: (selected) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.Typography, { sx: { fontSize: "0.8rem" }, children: selected }),
|
|
5165
5740
|
children: [
|
|
5166
|
-
(!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */ (0,
|
|
5167
|
-
param.options.map((option) => /* @__PURE__ */ (0,
|
|
5741
|
+
(!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.MenuItem, { value: "", sx: { fontSize: "0.8rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("em", { children: "Seleccione..." }) }),
|
|
5742
|
+
param.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.MenuItem, { value: option, sx: { fontSize: "0.8rem" }, children: option }, option))
|
|
5168
5743
|
]
|
|
5169
5744
|
}
|
|
5170
5745
|
),
|
|
5171
|
-
(param.description || errorMessage) && /* @__PURE__ */ (0,
|
|
5746
|
+
(param.description || errorMessage) && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
|
|
5172
5747
|
] });
|
|
5173
5748
|
}
|
|
5174
5749
|
switch (param.typeName) {
|
|
@@ -5177,19 +5752,19 @@ var ProcedureForm = () => {
|
|
|
5177
5752
|
case "tsrange":
|
|
5178
5753
|
case "time_range":
|
|
5179
5754
|
case "daterange":
|
|
5180
|
-
return /* @__PURE__ */ (0,
|
|
5755
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.TextField, { type: "text", value: formValues[param.name] || "", ...commonProps });
|
|
5181
5756
|
case "decimal":
|
|
5182
5757
|
case "double":
|
|
5183
|
-
return /* @__PURE__ */ (0,
|
|
5758
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.TextField, { type: "number", inputProps: { step: "any", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
|
|
5184
5759
|
case "integer":
|
|
5185
5760
|
case "bigint":
|
|
5186
|
-
return /* @__PURE__ */ (0,
|
|
5761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.TextField, { type: "number", inputProps: { step: "1", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
|
|
5187
5762
|
case "boolean":
|
|
5188
|
-
return /* @__PURE__ */ (0,
|
|
5189
|
-
|
|
5763
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5764
|
+
import_material25.FormControlLabel,
|
|
5190
5765
|
{
|
|
5191
|
-
control: /* @__PURE__ */ (0,
|
|
5192
|
-
|
|
5766
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5767
|
+
import_material25.Checkbox,
|
|
5193
5768
|
{
|
|
5194
5769
|
checked: !!formValues[param.name],
|
|
5195
5770
|
onChange: handleChange,
|
|
@@ -5199,21 +5774,21 @@ var ProcedureForm = () => {
|
|
|
5199
5774
|
size: "small"
|
|
5200
5775
|
}
|
|
5201
5776
|
),
|
|
5202
|
-
label: /* @__PURE__ */ (0,
|
|
5777
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.Typography, { sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "inherit" }, children: param.label || param.name }),
|
|
5203
5778
|
sx: { mt: 1, mb: 0 }
|
|
5204
5779
|
}
|
|
5205
5780
|
);
|
|
5206
5781
|
case "date":
|
|
5207
5782
|
case "timestamp":
|
|
5208
5783
|
case "time":
|
|
5209
|
-
return /* @__PURE__ */ (0,
|
|
5784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.TextField, { type: param.typeName === "date" ? "date" : param.typeName === "timestamp" ? "datetime-local" : "time", value: formValues[param.name] || "", ...commonProps, InputLabelProps: { shrink: true, sx: { fontSize: "0.8rem" } } });
|
|
5210
5785
|
case "jsonb":
|
|
5211
5786
|
case "jsona":
|
|
5212
|
-
return /* @__PURE__ */ (0,
|
|
5787
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.TextField, { multiline: true, rows: 5, value: formValues[param.name] || "", ...commonProps, InputProps: { sx: { fontSize: "0.8rem" } } });
|
|
5213
5788
|
case "bytea":
|
|
5214
|
-
return /* @__PURE__ */ (0,
|
|
5215
|
-
/* @__PURE__ */ (0,
|
|
5216
|
-
/* @__PURE__ */ (0,
|
|
5789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material25.FormControl, { fullWidth: true, margin: "dense", error: hasError, required: commonProps.required, children: [
|
|
5790
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.Typography, { variant: "body2", color: "textSecondary", component: "label", htmlFor: param.name, sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "text.secondary" }, children: param.label || param.name }),
|
|
5791
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5217
5792
|
"input",
|
|
5218
5793
|
{
|
|
5219
5794
|
type: "file",
|
|
@@ -5227,34 +5802,34 @@ var ProcedureForm = () => {
|
|
|
5227
5802
|
style: { padding: "6px 0", fontSize: "0.8rem" }
|
|
5228
5803
|
}
|
|
5229
5804
|
),
|
|
5230
|
-
(param.description || errorMessage) && /* @__PURE__ */ (0,
|
|
5805
|
+
(param.description || errorMessage) && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
|
|
5231
5806
|
] });
|
|
5232
5807
|
default:
|
|
5233
|
-
return /* @__PURE__ */ (0,
|
|
5808
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.TextField, { type: "text", value: formValues[param.name] || "", ...commonProps });
|
|
5234
5809
|
}
|
|
5235
5810
|
}, [formValues, handleChange, apiLoading, validationErrors]);
|
|
5236
|
-
const ResultDisplayContent = (0,
|
|
5811
|
+
const ResultDisplayContent = (0, import_react32.useMemo)(() => {
|
|
5237
5812
|
if (!procedureResultData || !procedure?.resultOk) return null;
|
|
5238
5813
|
const ComponentToRender = resultsOk[procedure.resultOk];
|
|
5239
5814
|
if (ComponentToRender) {
|
|
5240
|
-
return /* @__PURE__ */ (0,
|
|
5815
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ComponentToRender, { data: procedureResultData });
|
|
5241
5816
|
} else {
|
|
5242
|
-
return /* @__PURE__ */ (0,
|
|
5243
|
-
/* @__PURE__ */ (0,
|
|
5817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material25.Paper, { elevation: 2, sx: { p: 2, mt: 0, bgcolor: "warning.light" }, children: [
|
|
5818
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material25.Typography, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: [
|
|
5244
5819
|
"el componente para resolver el resultOk: '",
|
|
5245
5820
|
procedure.resultOk,
|
|
5246
5821
|
"' definido en el procedure no existe o no est\xE1 mapeado."
|
|
5247
5822
|
] }),
|
|
5248
|
-
/* @__PURE__ */ (0,
|
|
5823
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.Box, { sx: {
|
|
5249
5824
|
bgcolor: "warning.dark",
|
|
5250
5825
|
p: 1,
|
|
5251
5826
|
borderRadius: 1
|
|
5252
|
-
}, children: /* @__PURE__ */ (0,
|
|
5827
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(procedureResultData, null, 2) }) })
|
|
5253
5828
|
] });
|
|
5254
5829
|
}
|
|
5255
5830
|
}, [procedureResultData, procedure]);
|
|
5256
5831
|
if (!procedure) {
|
|
5257
|
-
return /* @__PURE__ */ (0,
|
|
5832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material25.Box, { sx: {
|
|
5258
5833
|
p: 2,
|
|
5259
5834
|
width: "100%",
|
|
5260
5835
|
boxSizing: "border-box",
|
|
@@ -5264,13 +5839,13 @@ var ProcedureForm = () => {
|
|
|
5264
5839
|
boxShadow: 3,
|
|
5265
5840
|
textAlign: "center"
|
|
5266
5841
|
}, children: [
|
|
5267
|
-
/* @__PURE__ */ (0,
|
|
5268
|
-
/* @__PURE__ */ (0,
|
|
5842
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.CircularProgress, { sx: { mb: 2 } }),
|
|
5843
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.Typography, { variant: "h6", color: "text.secondary", children: "Cargando procedimiento o no encontrado..." })
|
|
5269
5844
|
] });
|
|
5270
5845
|
}
|
|
5271
5846
|
return (
|
|
5272
5847
|
// Esta es la Box más externa que ahora controlará el scroll
|
|
5273
|
-
/* @__PURE__ */ (0,
|
|
5848
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material25.Box, { sx: {
|
|
5274
5849
|
p: 2,
|
|
5275
5850
|
ml: 1,
|
|
5276
5851
|
mt: 2,
|
|
@@ -5287,17 +5862,17 @@ var ProcedureForm = () => {
|
|
|
5287
5862
|
overflowX: "hidden"
|
|
5288
5863
|
// Oculta el scroll horizontal si no es necesario para el contenedor principal
|
|
5289
5864
|
}, children: [
|
|
5290
|
-
/* @__PURE__ */ (0,
|
|
5291
|
-
Object.values(validationErrors).some((err) => err !== null) && /* @__PURE__ */ (0,
|
|
5865
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.Typography, { variant: "h5", component: "h2", gutterBottom: true, align: "left", children: cambiarGuionesBajosPorEspacios(procedure.proceedLabel || procedure.action) }),
|
|
5866
|
+
Object.values(validationErrors).some((err) => err !== null) && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material25.Alert, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: [
|
|
5292
5867
|
"Por favor, corrige los errores en el formulario antes de enviar.",
|
|
5293
|
-
/* @__PURE__ */ (0,
|
|
5868
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("ul", { children: Object.values(validationErrors).map((err, idx) => err && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("li", { children: err }, idx)) })
|
|
5294
5869
|
] }),
|
|
5295
|
-
!Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */ (0,
|
|
5296
|
-
!Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */ (0,
|
|
5297
|
-
/* @__PURE__ */ (0,
|
|
5298
|
-
procedure.parameters.map((param) => /* @__PURE__ */ (0,
|
|
5299
|
-
/* @__PURE__ */ (0,
|
|
5300
|
-
|
|
5870
|
+
!Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.Alert, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: apiError.message }),
|
|
5871
|
+
!Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.Alert, { severity: "success", sx: { mb: 2, fontSize: "0.8rem" }, children: successMessage }),
|
|
5872
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("form", { onSubmit: handleSubmit, children: [
|
|
5873
|
+
procedure.parameters.map((param) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { children: renderInputField(param) }, param.name)),
|
|
5874
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5875
|
+
import_material25.Button,
|
|
5301
5876
|
{
|
|
5302
5877
|
type: "submit",
|
|
5303
5878
|
variant: "contained",
|
|
@@ -5305,20 +5880,20 @@ var ProcedureForm = () => {
|
|
|
5305
5880
|
disabled: apiLoading || Object.values(validationErrors).some((err) => err !== null),
|
|
5306
5881
|
sx: { mt: 2 },
|
|
5307
5882
|
size: "medium",
|
|
5308
|
-
startIcon: apiLoading ? /* @__PURE__ */ (0,
|
|
5883
|
+
startIcon: apiLoading ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.CircularProgress, { size: 20, color: "inherit" }) : null,
|
|
5309
5884
|
children: apiLoading ? "Ejecutando..." : procedure.proceedLabel || "Ejecutar"
|
|
5310
5885
|
}
|
|
5311
5886
|
)
|
|
5312
5887
|
] }),
|
|
5313
|
-
ResultDisplayContent && /* @__PURE__ */ (0,
|
|
5888
|
+
ResultDisplayContent && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material25.Box, { sx: { mt: 2 }, children: [
|
|
5314
5889
|
" ",
|
|
5315
5890
|
ResultDisplayContent
|
|
5316
5891
|
] }),
|
|
5317
|
-
executionLog.length > 0 && /* @__PURE__ */ (0,
|
|
5318
|
-
/* @__PURE__ */ (0,
|
|
5319
|
-
/* @__PURE__ */ (0,
|
|
5320
|
-
/* @__PURE__ */ (0,
|
|
5321
|
-
|
|
5892
|
+
executionLog.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material25.Box, { sx: { mt: 3 }, children: [
|
|
5893
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.Divider, { sx: { mb: 2 } }),
|
|
5894
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.Typography, { variant: "h6", gutterBottom: true, sx: { fontSize: "0.9rem" }, children: "Registro de Ejecuci\xF3n" }),
|
|
5895
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5896
|
+
import_material25.Box,
|
|
5322
5897
|
{
|
|
5323
5898
|
sx: {
|
|
5324
5899
|
bgcolor: "grey.100",
|
|
@@ -5331,8 +5906,8 @@ var ProcedureForm = () => {
|
|
|
5331
5906
|
fontSize: "0.75rem",
|
|
5332
5907
|
whiteSpace: "pre-wrap"
|
|
5333
5908
|
},
|
|
5334
|
-
children: executionLog.map((log, index) => /* @__PURE__ */ (0,
|
|
5335
|
-
|
|
5909
|
+
children: executionLog.map((log, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5910
|
+
import_material25.Typography,
|
|
5336
5911
|
{
|
|
5337
5912
|
component: "pre",
|
|
5338
5913
|
sx: {
|
|
@@ -5354,12 +5929,12 @@ var ProcedureForm_default = ProcedureForm;
|
|
|
5354
5929
|
|
|
5355
5930
|
// src/App.tsx
|
|
5356
5931
|
var import_react_redux5 = require("react-redux");
|
|
5357
|
-
var
|
|
5932
|
+
var import_react43 = require("redux-persist/integration/react");
|
|
5358
5933
|
|
|
5359
5934
|
// src/components/PrivateRoute.tsx
|
|
5360
|
-
var
|
|
5935
|
+
var import_react33 = require("react");
|
|
5361
5936
|
var import_react_router_dom7 = require("react-router-dom");
|
|
5362
|
-
var
|
|
5937
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5363
5938
|
var PrivateRoute = ({ children }) => {
|
|
5364
5939
|
const location = (0, import_react_router_dom7.useLocation)();
|
|
5365
5940
|
const dispatch = useAppDispatch();
|
|
@@ -5367,7 +5942,7 @@ var PrivateRoute = ({ children }) => {
|
|
|
5367
5942
|
const isAuthenticated = clientContextStatus === "succeeded";
|
|
5368
5943
|
const isLoadingAuth = clientContextStatus === "loading";
|
|
5369
5944
|
console.log(`[PrivateRoute] Render: Path=${location.pathname}, AuthStatus=${clientContextStatus}, IsAuthenticated=${isAuthenticated}, IsLoadingAuth=${isLoadingAuth}`);
|
|
5370
|
-
(0,
|
|
5945
|
+
(0, import_react33.useEffect)(() => {
|
|
5371
5946
|
console.log(`[PrivateRoute] Effect: Path=${location.pathname}, AuthStatus=${clientContextStatus}, IsAuthenticated=${isAuthenticated}, IsLoadingAuth=${isLoadingAuth}`);
|
|
5372
5947
|
if (!isAuthenticated && !isLoadingAuth && location.pathname !== "/login") {
|
|
5373
5948
|
const path = location.pathname + location.search + location.hash;
|
|
@@ -5383,19 +5958,19 @@ var PrivateRoute = ({ children }) => {
|
|
|
5383
5958
|
}, [isAuthenticated, isLoadingAuth, location, dispatch, clientContextStatus]);
|
|
5384
5959
|
if (isLoadingAuth) {
|
|
5385
5960
|
console.log(`[PrivateRoute] Returning loading state...`);
|
|
5386
|
-
return /* @__PURE__ */ (0,
|
|
5961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { children: "Verificando autenticaci\xF3n..." });
|
|
5387
5962
|
}
|
|
5388
5963
|
if (!isAuthenticated) {
|
|
5389
5964
|
console.log(`[PrivateRoute] User not authenticated, navigating to /login`);
|
|
5390
|
-
return /* @__PURE__ */ (0,
|
|
5965
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_router_dom7.Navigate, { to: "/login", replace: true });
|
|
5391
5966
|
}
|
|
5392
5967
|
console.log(`[PrivateRoute] User authenticated, rendering children.`);
|
|
5393
|
-
return /* @__PURE__ */ (0,
|
|
5968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children });
|
|
5394
5969
|
};
|
|
5395
5970
|
var PrivateRoute_default = PrivateRoute;
|
|
5396
5971
|
|
|
5397
5972
|
// src/components/InitialRedirectHandler.tsx
|
|
5398
|
-
var
|
|
5973
|
+
var import_react34 = require("react");
|
|
5399
5974
|
var import_react_router_dom8 = require("react-router-dom");
|
|
5400
5975
|
var InitialRedirectHandler = () => {
|
|
5401
5976
|
const location = (0, import_react_router_dom8.useLocation)();
|
|
@@ -5403,14 +5978,14 @@ var InitialRedirectHandler = () => {
|
|
|
5403
5978
|
const dispatch = useAppDispatch();
|
|
5404
5979
|
const redirectPath = useRedirectPath();
|
|
5405
5980
|
const clientContextStatus = useClientContextStatus();
|
|
5406
|
-
(0,
|
|
5981
|
+
(0, import_react34.useEffect)(() => {
|
|
5407
5982
|
dispatch(setCurrentPath(location.pathname + location.search));
|
|
5408
5983
|
}, [location, dispatch]);
|
|
5409
|
-
const navegandoRef = (0,
|
|
5410
|
-
(0,
|
|
5984
|
+
const navegandoRef = (0, import_react34.useRef)(false);
|
|
5985
|
+
(0, import_react34.useEffect)(() => {
|
|
5411
5986
|
navegandoRef.current = false;
|
|
5412
5987
|
}, [location.pathname]);
|
|
5413
|
-
(0,
|
|
5988
|
+
(0, import_react34.useEffect)(() => {
|
|
5414
5989
|
if (clientContextStatus === "succeeded") {
|
|
5415
5990
|
if (redirectPath && redirectPath !== "/login") {
|
|
5416
5991
|
console.log("Redirigiendo a la ruta guardada:", redirectPath);
|
|
@@ -5428,35 +6003,40 @@ var InitialRedirectHandler = () => {
|
|
|
5428
6003
|
var InitialRedirectHandler_default = InitialRedirectHandler;
|
|
5429
6004
|
|
|
5430
6005
|
// src/pages/GenericDataGridPage.tsx
|
|
5431
|
-
var
|
|
6006
|
+
var import_react35 = __toESM(require("react"), 1);
|
|
5432
6007
|
var import_react_router_dom9 = require("react-router-dom");
|
|
5433
|
-
var
|
|
6008
|
+
var import_material26 = require("@mui/material");
|
|
5434
6009
|
var import_Close2 = __toESM(require("@mui/icons-material/Close"), 1);
|
|
5435
|
-
var
|
|
6010
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5436
6011
|
var GenericDataGridPage = ({
|
|
5437
6012
|
initialTableName,
|
|
5438
|
-
initialFixedFields = []
|
|
6013
|
+
initialFixedFields = [],
|
|
6014
|
+
parametros: parametrosRecibidos
|
|
5439
6015
|
}) => {
|
|
5440
6016
|
const { tableName: urlTableName } = (0, import_react_router_dom9.useParams)();
|
|
5441
6017
|
const effectiveTableName = initialTableName || urlTableName;
|
|
5442
|
-
const [tabs, setTabs] = (0,
|
|
5443
|
-
const [activeTabIdx, setActiveTabIdx] = (0,
|
|
6018
|
+
const [tabs, setTabs] = (0, import_react35.useState)([]);
|
|
6019
|
+
const [activeTabIdx, setActiveTabIdx] = (0, import_react35.useState)(0);
|
|
5444
6020
|
const ffKey = JSON.stringify(initialFixedFields);
|
|
5445
6021
|
const location = (0, import_react_router_dom9.useLocation)();
|
|
5446
|
-
|
|
6022
|
+
const parametros = (0, import_react35.useMemo)(() => parametrosRecibidos ?? parametrosDeTabla(void 0, location.search), [parametrosRecibidos, location.search]);
|
|
6023
|
+
const fixedFieldsIniciales = initialFixedFields.length > 0 ? initialFixedFields : parametros.fixedFields ?? [];
|
|
6024
|
+
const parametrosKey = JSON.stringify(parametros);
|
|
6025
|
+
import_react35.default.useEffect(() => {
|
|
5447
6026
|
if (effectiveTableName) {
|
|
5448
6027
|
setTabs([{
|
|
5449
|
-
id: `main-${effectiveTableName}-${ffKey}`,
|
|
6028
|
+
id: `main-${effectiveTableName}-${ffKey}-${parametrosKey}`,
|
|
5450
6029
|
// ID único que incluye filtros
|
|
5451
|
-
label: effectiveTableName.replace(/_/g, " ").toUpperCase(),
|
|
6030
|
+
label: parametros.label ?? effectiveTableName.replace(/_/g, " ").toUpperCase(),
|
|
5452
6031
|
tableName: effectiveTableName,
|
|
5453
|
-
fixedFields:
|
|
6032
|
+
fixedFields: fixedFieldsIniciales,
|
|
6033
|
+
parametros,
|
|
5454
6034
|
ancestors: []
|
|
5455
6035
|
}]);
|
|
5456
6036
|
setActiveTabIdx(0);
|
|
5457
6037
|
}
|
|
5458
|
-
}, [effectiveTableName, ffKey, location.key]);
|
|
5459
|
-
const handleOpenDetail = (0,
|
|
6038
|
+
}, [effectiveTableName, ffKey, parametrosKey, location.key]);
|
|
6039
|
+
const handleOpenDetail = (0, import_react35.useCallback)((tableName, fixedFields, label, ancestors) => {
|
|
5460
6040
|
const tabId = `${tableName}-${JSON.stringify(fixedFields)}`;
|
|
5461
6041
|
setTabs((prevTabs) => {
|
|
5462
6042
|
const existingTabIdx = prevTabs.findIndex((t) => t.id === tabId);
|
|
@@ -5478,30 +6058,34 @@ var GenericDataGridPage = ({
|
|
|
5478
6058
|
else if (activeTabIdx === index) setActiveTabIdx(index - 1);
|
|
5479
6059
|
};
|
|
5480
6060
|
if (!effectiveTableName) {
|
|
5481
|
-
return /* @__PURE__ */ (0,
|
|
6061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material26.Box, { p: 3, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material26.Alert, { severity: "error", children: "No se especific\xF3 una tabla." }) });
|
|
5482
6062
|
}
|
|
5483
|
-
return /* @__PURE__ */ (0,
|
|
5484
|
-
/* @__PURE__ */ (0,
|
|
5485
|
-
|
|
6063
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_material26.Box, { sx: { width: "100%", height: "calc(100vh - 64px)", display: "flex", flexDirection: "column" }, children: [
|
|
6064
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material26.Box, { sx: { borderBottom: 1, borderColor: "divider", bgcolor: "background.paper" }, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material26.Tabs, { value: activeTabIdx, onChange: (_, v) => setActiveTabIdx(v), variant: "scrollable", children: tabs.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6065
|
+
import_material26.Tab,
|
|
5486
6066
|
{
|
|
5487
|
-
label: /* @__PURE__ */ (0,
|
|
5488
|
-
/* @__PURE__ */ (0,
|
|
5489
|
-
index !== 0 && /* @__PURE__ */ (0,
|
|
6067
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_material26.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
6068
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material26.Typography, { variant: "caption", sx: { fontWeight: "bold" }, children: tab.label }),
|
|
6069
|
+
index !== 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material26.IconButton, { size: "small", onClick: (e) => handleCloseTab(index, e), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_Close2.default, { fontSize: "inherit" }) })
|
|
5490
6070
|
] })
|
|
5491
6071
|
},
|
|
5492
6072
|
tab.id
|
|
5493
6073
|
)) }) }),
|
|
5494
|
-
tabs.map((tab, index) => /* @__PURE__ */ (0,
|
|
5495
|
-
|
|
6074
|
+
tabs.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6075
|
+
import_material26.Box,
|
|
5496
6076
|
{
|
|
5497
6077
|
role: "tabpanel",
|
|
5498
6078
|
hidden: activeTabIdx !== index,
|
|
5499
6079
|
sx: { flexGrow: 1, display: activeTabIdx === index ? "flex" : "none", flexDirection: "column", overflow: "hidden" },
|
|
5500
|
-
children: /* @__PURE__ */ (0,
|
|
6080
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5501
6081
|
GenericDataGrid_default,
|
|
5502
6082
|
{
|
|
5503
6083
|
tableName: tab.tableName,
|
|
5504
6084
|
fixedFields: tab.fixedFields,
|
|
6085
|
+
filterColumns: tab.parametros?.filterColumns,
|
|
6086
|
+
tableDef: tab.parametros?.tableDef,
|
|
6087
|
+
parameterFunctions: tab.parametros?.parameterFunctions,
|
|
6088
|
+
pick: tab.parametros?.pick,
|
|
5505
6089
|
onOpenDetail: handleOpenDetail,
|
|
5506
6090
|
ancestors: tab.ancestors
|
|
5507
6091
|
}
|
|
@@ -5514,32 +6098,26 @@ var GenericDataGridPage = ({
|
|
|
5514
6098
|
var GenericDataGridPage_default = GenericDataGridPage;
|
|
5515
6099
|
|
|
5516
6100
|
// src/pages/PantallaDeRuta.tsx
|
|
5517
|
-
var
|
|
6101
|
+
var import_react36 = require("react");
|
|
5518
6102
|
var import_react_router_dom10 = require("react-router-dom");
|
|
5519
|
-
var
|
|
5520
|
-
var
|
|
6103
|
+
var import_material27 = require("@mui/material");
|
|
6104
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
5521
6105
|
var PantallaDeRuta = ({ screenName }) => {
|
|
5522
6106
|
const [busqueda] = (0, import_react_router_dom10.useSearchParams)();
|
|
5523
|
-
const params = (0,
|
|
6107
|
+
const params = (0, import_react36.useMemo)(() => Object.fromEntries(busqueda.entries()), [busqueda]);
|
|
5524
6108
|
const Pantalla = wScreens[screenName];
|
|
5525
|
-
return /* @__PURE__ */ (0,
|
|
6109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material27.Box, { sx: { pt: 3, pl: 4 }, children: Pantalla ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Pantalla, { screenName, params }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FallbackWScreen, { screenName }) });
|
|
5526
6110
|
};
|
|
5527
6111
|
|
|
5528
6112
|
// src/pages/MenuTablePage.tsx
|
|
5529
|
-
var
|
|
6113
|
+
var import_react37 = require("react");
|
|
5530
6114
|
var import_react_router_dom11 = require("react-router-dom");
|
|
5531
|
-
var
|
|
5532
|
-
var
|
|
5533
|
-
function fixedFieldsDeMenu(ff) {
|
|
5534
|
-
if (!ff) return [];
|
|
5535
|
-
if (Array.isArray(ff)) {
|
|
5536
|
-
return ff.map(({ fieldName, value }) => ({ fieldName, value }));
|
|
5537
|
-
}
|
|
5538
|
-
return Object.entries(ff).map(([fieldName, value]) => ({ fieldName, value }));
|
|
5539
|
-
}
|
|
6115
|
+
var import_material28 = require("@mui/material");
|
|
6116
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
5540
6117
|
var MenuTablePage = () => {
|
|
5541
6118
|
const { menuName } = (0, import_react_router_dom11.useParams)();
|
|
5542
6119
|
const { clientContext } = useApp();
|
|
6120
|
+
const { search } = (0, import_react_router_dom11.useLocation)();
|
|
5543
6121
|
const findMenuItem = (items, nameToFind) => {
|
|
5544
6122
|
for (const item of items) {
|
|
5545
6123
|
if (item.name === nameToFind && item.menuType === "table") {
|
|
@@ -5552,51 +6130,55 @@ var MenuTablePage = () => {
|
|
|
5552
6130
|
}
|
|
5553
6131
|
return void 0;
|
|
5554
6132
|
};
|
|
5555
|
-
const { currentTableName, currentFixedFields } = (0,
|
|
6133
|
+
const { currentTableName, currentFixedFields, parametros } = (0, import_react37.useMemo)(() => {
|
|
5556
6134
|
let tableName = void 0;
|
|
5557
6135
|
let fixedFields = [];
|
|
6136
|
+
let parametros2 = {};
|
|
5558
6137
|
if (menuName && clientContext && clientContext.menu) {
|
|
5559
6138
|
const menuItem = findMenuItem(clientContext.menu, menuName);
|
|
5560
6139
|
if (menuItem) {
|
|
5561
6140
|
tableName = menuItem.table || menuItem.name;
|
|
5562
|
-
|
|
6141
|
+
parametros2 = parametrosDeTabla(menuItem, search);
|
|
6142
|
+
fixedFields = parametros2.fixedFields ?? [];
|
|
5563
6143
|
} else {
|
|
5564
6144
|
console.warn(`[${menuName}] \xCDtem de men\xFA '${menuName}' no encontrado o no es de tipo 'table' en clientContext.menu.`);
|
|
5565
6145
|
}
|
|
5566
6146
|
}
|
|
5567
6147
|
return {
|
|
5568
6148
|
currentTableName: tableName,
|
|
5569
|
-
currentFixedFields: fixedFields
|
|
6149
|
+
currentFixedFields: fixedFields,
|
|
6150
|
+
parametros: parametros2
|
|
5570
6151
|
};
|
|
5571
|
-
}, [menuName, clientContext]);
|
|
6152
|
+
}, [menuName, clientContext, search]);
|
|
5572
6153
|
if (!currentTableName) {
|
|
5573
|
-
return /* @__PURE__ */ (0,
|
|
5574
|
-
/* @__PURE__ */ (0,
|
|
5575
|
-
/* @__PURE__ */ (0,
|
|
6154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material28.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_material28.Alert, { severity: "error", children: [
|
|
6155
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material28.Typography, { variant: "h6", children: "Error: No se pudo cargar la informaci\xF3n de la tabla." }),
|
|
6156
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material28.Typography, { variant: "body1", children: "Verifique la configuraci\xF3n del men\xFA o el nombre de la tabla en la URL." })
|
|
5576
6157
|
] }) });
|
|
5577
6158
|
}
|
|
5578
|
-
return /* @__PURE__ */ (0,
|
|
6159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5579
6160
|
GenericDataGridPage_default,
|
|
5580
6161
|
{
|
|
5581
6162
|
initialTableName: currentTableName,
|
|
5582
|
-
initialFixedFields: currentFixedFields
|
|
6163
|
+
initialFixedFields: currentFixedFields,
|
|
6164
|
+
parametros
|
|
5583
6165
|
}
|
|
5584
6166
|
);
|
|
5585
6167
|
};
|
|
5586
6168
|
var MenuTablePage_default = MenuTablePage;
|
|
5587
6169
|
|
|
5588
6170
|
// src/puente/PantallaBP.tsx
|
|
5589
|
-
var
|
|
6171
|
+
var import_react39 = require("react");
|
|
5590
6172
|
var import_react_router_dom12 = require("react-router-dom");
|
|
5591
|
-
var
|
|
6173
|
+
var import_material30 = require("@mui/material");
|
|
5592
6174
|
|
|
5593
6175
|
// src/puente/clienteBP.ts
|
|
5594
6176
|
function extraerRecursos(html) {
|
|
5595
6177
|
const documento = new DOMParser().parseFromString(html, "text/html");
|
|
5596
|
-
const
|
|
6178
|
+
const referencias2 = (selector, atributo) => Array.from(documento.querySelectorAll(selector)).map((elemento) => elemento.getAttribute(atributo)).filter((ruta) => !!ruta);
|
|
5597
6179
|
return {
|
|
5598
|
-
hojasDeEstilo:
|
|
5599
|
-
scripts:
|
|
6180
|
+
hojasDeEstilo: referencias2("link[rel=stylesheet]", "href"),
|
|
6181
|
+
scripts: referencias2("script[src]", "src")
|
|
5600
6182
|
};
|
|
5601
6183
|
}
|
|
5602
6184
|
function fijarBase(urlBackend) {
|
|
@@ -5677,9 +6259,9 @@ async function cargarSinMemoria(urlBackend) {
|
|
|
5677
6259
|
}
|
|
5678
6260
|
|
|
5679
6261
|
// src/puente/ConsolaBP.tsx
|
|
5680
|
-
var
|
|
5681
|
-
var
|
|
5682
|
-
var
|
|
6262
|
+
var import_react38 = require("react");
|
|
6263
|
+
var import_material29 = require("@mui/material");
|
|
6264
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
5683
6265
|
var MARGEN_DE_REPETIDO_MS = 1e3;
|
|
5684
6266
|
function descartarRepetidos(consola, agregados, ahora) {
|
|
5685
6267
|
for (const nodo of agregados) {
|
|
@@ -5692,7 +6274,7 @@ function descartarRepetidos(consola, agregados, ahora) {
|
|
|
5692
6274
|
}
|
|
5693
6275
|
}
|
|
5694
6276
|
var ConsolaBP = () => {
|
|
5695
|
-
(0,
|
|
6277
|
+
(0, import_react38.useEffect)(() => {
|
|
5696
6278
|
const consola = document.getElementById("mini-console");
|
|
5697
6279
|
if (!consola) return;
|
|
5698
6280
|
const observador = new MutationObserver(
|
|
@@ -5701,8 +6283,8 @@ var ConsolaBP = () => {
|
|
|
5701
6283
|
observador.observe(consola, { childList: true });
|
|
5702
6284
|
return () => observador.disconnect();
|
|
5703
6285
|
}, []);
|
|
5704
|
-
return /* @__PURE__ */ (0,
|
|
5705
|
-
|
|
6286
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6287
|
+
import_material29.Box,
|
|
5706
6288
|
{
|
|
5707
6289
|
id: "mini-console",
|
|
5708
6290
|
sx: (tema) => ({
|
|
@@ -5798,7 +6380,7 @@ var habilitarPuenteBP = () => {
|
|
|
5798
6380
|
var puenteBPHabilitado = () => habilitado;
|
|
5799
6381
|
|
|
5800
6382
|
// src/puente/PantallaBP.tsx
|
|
5801
|
-
var
|
|
6383
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
5802
6384
|
function buscarItemDeMenu(items, tipo) {
|
|
5803
6385
|
for (const item of items) {
|
|
5804
6386
|
if (item.menuType === tipo) return item;
|
|
@@ -5811,12 +6393,12 @@ function buscarItemDeMenu(items, tipo) {
|
|
|
5811
6393
|
}
|
|
5812
6394
|
var PantallaBP = ({ nombre, direccion }) => {
|
|
5813
6395
|
const { clientContext } = useApp();
|
|
5814
|
-
const [cargando, setCargando] = (0,
|
|
5815
|
-
const [error, setError] = (0,
|
|
5816
|
-
const [noExiste, setNoExiste] = (0,
|
|
5817
|
-
const contenedor = (0,
|
|
6396
|
+
const [cargando, setCargando] = (0, import_react39.useState)(true);
|
|
6397
|
+
const [error, setError] = (0, import_react39.useState)(null);
|
|
6398
|
+
const [noExiste, setNoExiste] = (0, import_react39.useState)(false);
|
|
6399
|
+
const contenedor = (0, import_react39.useRef)(null);
|
|
5818
6400
|
const menu = clientContext.menu;
|
|
5819
|
-
(0,
|
|
6401
|
+
(0, import_react39.useEffect)(() => {
|
|
5820
6402
|
const elemento = contenedor.current;
|
|
5821
6403
|
if (!elemento) return;
|
|
5822
6404
|
let vigente = true;
|
|
@@ -5847,14 +6429,14 @@ var PantallaBP = ({ nombre, direccion }) => {
|
|
|
5847
6429
|
elemento.replaceChildren();
|
|
5848
6430
|
};
|
|
5849
6431
|
}, [nombre, direccion, menu]);
|
|
5850
|
-
if (noExiste) return /* @__PURE__ */ (0,
|
|
6432
|
+
if (noExiste) return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(FallbackWScreen, { screenName: nombre });
|
|
5851
6433
|
return (
|
|
5852
6434
|
// 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
|
|
5853
|
-
/* @__PURE__ */ (0,
|
|
5854
|
-
cargando && /* @__PURE__ */ (0,
|
|
5855
|
-
error && /* @__PURE__ */ (0,
|
|
5856
|
-
/* @__PURE__ */ (0,
|
|
5857
|
-
/* @__PURE__ */ (0,
|
|
6435
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_material30.Box, { sx: { position: "relative" }, children: [
|
|
6436
|
+
cargando && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_material30.CircularProgress, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
|
|
6437
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_material30.Alert, { severity: "error", sx: { m: 2 }, children: error }),
|
|
6438
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { id: "main_layout", ref: contenedor }),
|
|
6439
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ConsolaBP, {})
|
|
5858
6440
|
] })
|
|
5859
6441
|
);
|
|
5860
6442
|
};
|
|
@@ -5862,37 +6444,37 @@ var PantallaDeRespaldo = () => {
|
|
|
5862
6444
|
const { screenName = "" } = (0, import_react_router_dom12.useParams)();
|
|
5863
6445
|
const { search } = (0, import_react_router_dom12.useLocation)();
|
|
5864
6446
|
if (!puenteBPHabilitado()) {
|
|
5865
|
-
return /* @__PURE__ */ (0,
|
|
6447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_material30.Box, { sx: { p: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(FallbackWScreen, { screenName }) });
|
|
5866
6448
|
}
|
|
5867
|
-
return /* @__PURE__ */ (0,
|
|
6449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_router_dom12.Navigate, { to: rutaDePantallaBP(screenName, search), replace: true });
|
|
5868
6450
|
};
|
|
5869
6451
|
var PaginaBP = () => {
|
|
5870
6452
|
const { hash, search } = (0, import_react_router_dom12.useLocation)();
|
|
5871
6453
|
const direccion = hash || search;
|
|
5872
6454
|
const nombre = new URLSearchParams(direccion.replace(/^[#?]/, "")).get("w");
|
|
5873
|
-
if (!puenteBPHabilitado()) return /* @__PURE__ */ (0,
|
|
5874
|
-
if (!nombre) return /* @__PURE__ */ (0,
|
|
6455
|
+
if (!puenteBPHabilitado()) return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_router_dom12.Navigate, { to: "/", replace: true });
|
|
6456
|
+
if (!nombre) return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_material30.Box, { sx: { p: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_material30.Alert, { severity: "warning", children: [
|
|
5875
6457
|
"Falta la pantalla de backend-plus (",
|
|
5876
|
-
/* @__PURE__ */ (0,
|
|
6458
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("code", { children: "#w=..." }),
|
|
5877
6459
|
")."
|
|
5878
6460
|
] }) });
|
|
5879
|
-
return /* @__PURE__ */ (0,
|
|
6461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PantallaBP, { nombre, direccion }, nombre);
|
|
5880
6462
|
};
|
|
5881
6463
|
|
|
5882
6464
|
// src/puente/GrillaBP.tsx
|
|
5883
|
-
var
|
|
6465
|
+
var import_react40 = require("react");
|
|
5884
6466
|
var import_react_router_dom13 = require("react-router-dom");
|
|
5885
|
-
var
|
|
5886
|
-
var
|
|
6467
|
+
var import_material31 = require("@mui/material");
|
|
6468
|
+
var import_jsx_runtime37 = (
|
|
5887
6469
|
// 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
|
|
5888
6470
|
require("react/jsx-runtime")
|
|
5889
6471
|
);
|
|
5890
6472
|
var GrillaBP = ({ tabla, fixedFields }) => {
|
|
5891
|
-
const contenedor = (0,
|
|
5892
|
-
const [cargando, setCargando] = (0,
|
|
5893
|
-
const [error, setError] = (0,
|
|
6473
|
+
const contenedor = (0, import_react40.useRef)(null);
|
|
6474
|
+
const [cargando, setCargando] = (0, import_react40.useState)(true);
|
|
6475
|
+
const [error, setError] = (0, import_react40.useState)(null);
|
|
5894
6476
|
const clave = JSON.stringify(fixedFields ?? []);
|
|
5895
|
-
(0,
|
|
6477
|
+
(0, import_react40.useEffect)(() => {
|
|
5896
6478
|
const elemento = contenedor.current;
|
|
5897
6479
|
if (!elemento) return;
|
|
5898
6480
|
let vigente = true;
|
|
@@ -5913,20 +6495,20 @@ var GrillaBP = ({ tabla, fixedFields }) => {
|
|
|
5913
6495
|
elemento.replaceChildren();
|
|
5914
6496
|
};
|
|
5915
6497
|
}, [tabla, clave]);
|
|
5916
|
-
return /* @__PURE__ */ (0,
|
|
5917
|
-
cargando && /* @__PURE__ */ (0,
|
|
5918
|
-
error && /* @__PURE__ */ (0,
|
|
5919
|
-
/* @__PURE__ */ (0,
|
|
5920
|
-
/* @__PURE__ */ (0,
|
|
6498
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_material31.Box, { sx: { position: "relative" }, children: [
|
|
6499
|
+
cargando && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material31.CircularProgress, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
|
|
6500
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material31.Alert, { severity: "error", sx: { m: 2 }, children: error }),
|
|
6501
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { ref: contenedor }),
|
|
6502
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ConsolaBP, {})
|
|
5921
6503
|
] });
|
|
5922
6504
|
};
|
|
5923
6505
|
var PaginaGrillaBP = () => {
|
|
5924
6506
|
const { tableName = "" } = (0, import_react_router_dom13.useParams)();
|
|
5925
|
-
return /* @__PURE__ */ (0,
|
|
6507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(GrillaBP, { tabla: tableName }, tableName);
|
|
5926
6508
|
};
|
|
5927
6509
|
|
|
5928
6510
|
// src/puente/CapturaBP.tsx
|
|
5929
|
-
var
|
|
6511
|
+
var import_react41 = require("react");
|
|
5930
6512
|
var import_react_router_dom14 = require("react-router-dom");
|
|
5931
6513
|
|
|
5932
6514
|
// src/puente/capturaDeNavegacion.ts
|
|
@@ -5973,61 +6555,61 @@ function capturarNavegacionBP(urlBackend, navegar) {
|
|
|
5973
6555
|
// src/puente/CapturaBP.tsx
|
|
5974
6556
|
var CapturaBP = () => {
|
|
5975
6557
|
const navigate = (0, import_react_router_dom14.useNavigate)();
|
|
5976
|
-
(0,
|
|
6558
|
+
(0, import_react41.useEffect)(() => capturarNavegacionBP(envConfig.backendUrl, navigate), [navigate]);
|
|
5977
6559
|
return null;
|
|
5978
6560
|
};
|
|
5979
6561
|
|
|
5980
6562
|
// src/App.tsx
|
|
5981
6563
|
var import_type_store6 = __toESM(require("type-store"), 1);
|
|
5982
|
-
var
|
|
6564
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
5983
6565
|
var LocationTracker = () => {
|
|
5984
6566
|
const location = (0, import_react_router_dom15.useLocation)();
|
|
5985
6567
|
const dispatch = useAppDispatch();
|
|
5986
|
-
(0,
|
|
6568
|
+
(0, import_react42.useEffect)(() => {
|
|
5987
6569
|
dispatch(setCurrentPath(location.pathname + location.search));
|
|
5988
6570
|
}, [location, dispatch]);
|
|
5989
6571
|
return null;
|
|
5990
6572
|
};
|
|
5991
6573
|
function FrontendPlusReactRoutes({ myRoutes, myUnloggedRoutes, layout: Layout = MainLayout_default, unloggedLayout: UnloggedLayout }) {
|
|
5992
|
-
return /* @__PURE__ */ (0,
|
|
5993
|
-
/* @__PURE__ */ (0,
|
|
5994
|
-
puenteBPHabilitado() && /* @__PURE__ */ (0,
|
|
5995
|
-
/* @__PURE__ */ (0,
|
|
5996
|
-
/* @__PURE__ */ (0,
|
|
5997
|
-
/* @__PURE__ */ (0,
|
|
5998
|
-
/* @__PURE__ */ (0,
|
|
6574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
6575
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(InitialRedirectHandler_default, {}),
|
|
6576
|
+
puenteBPHabilitado() && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CapturaBP, {}),
|
|
6577
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react_router_dom15.Routes, { children: [
|
|
6578
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react_router_dom15.Route, { element: UnloggedLayout ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(UnloggedLayout, {}) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Outlet, {}), children: [
|
|
6579
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Route, { path: "/login", element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(LoginPage_default, {}) }),
|
|
6580
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Route, { path: "/logout", element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(LogoutPage_default, {}) }),
|
|
5999
6581
|
myUnloggedRoutes
|
|
6000
6582
|
] }),
|
|
6001
|
-
/* @__PURE__ */ (0,
|
|
6002
|
-
/* @__PURE__ */ (0,
|
|
6003
|
-
/* @__PURE__ */ (0,
|
|
6004
|
-
/* @__PURE__ */ (0,
|
|
6005
|
-
/* @__PURE__ */ (0,
|
|
6006
|
-
Object.keys(wScreens).map((screenName) => /* @__PURE__ */ (0,
|
|
6583
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react_router_dom15.Route, { element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PrivateRoute_default, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Layout, {}) }), children: [
|
|
6584
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Route, { path: "/", element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PantallaInicial_default, {}) }),
|
|
6585
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Route, { path: "/table/:tableName", element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(GenericDataGridPage_default, {}) }),
|
|
6586
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Route, { path: "/menu/:menuName", element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(MenuTablePage_default, {}) }),
|
|
6587
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Route, { path: "/procedures/:procedureName", element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ProcedureForm_default, {}) }),
|
|
6588
|
+
Object.keys(wScreens).map((screenName) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6007
6589
|
import_react_router_dom15.Route,
|
|
6008
6590
|
{
|
|
6009
6591
|
path: `/wScreens/${screenName}`,
|
|
6010
|
-
element: /* @__PURE__ */ (0,
|
|
6592
|
+
element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PantallaDeRuta, { screenName })
|
|
6011
6593
|
},
|
|
6012
6594
|
screenName
|
|
6013
6595
|
)),
|
|
6014
|
-
/* @__PURE__ */ (0,
|
|
6015
|
-
puenteBPHabilitado() && /* @__PURE__ */ (0,
|
|
6016
|
-
puenteBPHabilitado() && /* @__PURE__ */ (0,
|
|
6596
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Route, { path: "/wScreens-fallback/:screenName", element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PantallaDeRespaldo, {}) }),
|
|
6597
|
+
puenteBPHabilitado() && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Route, { path: "/bp/menu", element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PaginaBP, {}) }),
|
|
6598
|
+
puenteBPHabilitado() && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Route, { path: "/bp/table/:tableName", element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PaginaGrillaBP, {}) }),
|
|
6017
6599
|
myRoutes,
|
|
6018
|
-
/* @__PURE__ */ (0,
|
|
6600
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Route, { path: "*", element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { style: { marginTop: "20px", marginLeft: "10px" }, children: "404 - Recurso No Encontrado" }) })
|
|
6019
6601
|
] }),
|
|
6020
|
-
/* @__PURE__ */ (0,
|
|
6602
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Route, { path: "*", element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Navigate, { to: "/", replace: true }) })
|
|
6021
6603
|
] })
|
|
6022
6604
|
] });
|
|
6023
6605
|
}
|
|
6024
6606
|
var FrontendPlusProviders = ({ children, publicPaths }) => {
|
|
6025
|
-
return /* @__PURE__ */ (0,
|
|
6026
|
-
/* @__PURE__ */ (0,
|
|
6607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_redux5.Provider, { store, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react43.PersistGate, { loading: null, persistor, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react_router_dom15.BrowserRouter, { basename: rutaBase, children: [
|
|
6608
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(LocationTracker, {}),
|
|
6027
6609
|
" ",
|
|
6028
|
-
/* @__PURE__ */ (0,
|
|
6610
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(AppProvider, { publicPaths, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(SnackbarProvider, { children: [
|
|
6029
6611
|
children,
|
|
6030
|
-
/* @__PURE__ */ (0,
|
|
6612
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SessionExpiredMessage_default, {})
|
|
6031
6613
|
] }) })
|
|
6032
6614
|
] }) }) });
|
|
6033
6615
|
};
|
|
@@ -6041,7 +6623,7 @@ var App = ({
|
|
|
6041
6623
|
myConditions,
|
|
6042
6624
|
puenteBP
|
|
6043
6625
|
}) => {
|
|
6044
|
-
(0,
|
|
6626
|
+
(0, import_react42.useMemo)(() => {
|
|
6045
6627
|
if (myClientSides) {
|
|
6046
6628
|
extendClientSides(myClientSides);
|
|
6047
6629
|
}
|
|
@@ -6058,7 +6640,7 @@ var App = ({
|
|
|
6058
6640
|
habilitarPuenteBP();
|
|
6059
6641
|
}
|
|
6060
6642
|
}, [myClientSides, myResultsOk, myWScreens, myConditions, puenteBP]);
|
|
6061
|
-
(0,
|
|
6643
|
+
(0, import_react42.useEffect)(() => {
|
|
6062
6644
|
import_type_store6.default.messages = import_type_store6.default.i18n.messages.es;
|
|
6063
6645
|
import_type_store6.default.locale = import_type_store6.default.i18n.locale.es;
|
|
6064
6646
|
const link = document.querySelector("link[rel*='icon']") || document.createElement("link");
|
|
@@ -6067,11 +6649,11 @@ var App = ({
|
|
|
6067
6649
|
link.href = `${envConfig.backendUrl}/img/logo-128.png`;
|
|
6068
6650
|
document.getElementsByTagName("head")[0].appendChild(link);
|
|
6069
6651
|
}, []);
|
|
6070
|
-
const safePaths =
|
|
6652
|
+
const safePaths = import_react42.default.useMemo(() => {
|
|
6071
6653
|
const extracted = extractPathsFromRoutes(myUnloggedRoutes);
|
|
6072
6654
|
return ["/login", "/logout", ...extracted];
|
|
6073
6655
|
}, [myUnloggedRoutes]);
|
|
6074
|
-
return /* @__PURE__ */ (0,
|
|
6656
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(FrontendPlusProviders, { publicPaths: safePaths, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6075
6657
|
FrontendPlusReactRoutes,
|
|
6076
6658
|
{
|
|
6077
6659
|
myRoutes,
|