frontend-plus-react 0.4.1 → 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/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 import_react22 = require("react");
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 import_material15 = require("@mui/material");
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 input = target;
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 calcularColumnaAnterior = () => {
1495
- let nextEditableColumnIndex = currentEditableColumnIndex - 1;
1496
- let nextRowIndex = rowIndex;
1497
- if (nextEditableColumnIndex <= 0) {
1498
- nextEditableColumnIndex = 0;
1499
- }
1500
- const nextColumnKey = editableColumnKeys[nextEditableColumnIndex];
1501
- const nextColumnIndex = currentColumns.findIndex((col) => col.key === nextColumnKey);
1502
- return { rowIdx: nextRowIndex, idx: nextColumnIndex };
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 ["Enter", "Tab"].includes(key): {
1515
- hacerFoco(calcularColumnaSiguiente());
1516
- break;
1517
- }
1518
- case key === "ArrowRight": {
1519
- if (input && typeof input.selectionStart === "number") {
1520
- const cursorPosition = input.selectionStart;
1521
- const inputValueLength = input.value?.length || 0;
1522
- if (cursorPosition === inputValueLength) {
1523
- hacerFoco(calcularColumnaSiguiente());
1524
- }
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);
1525
1703
  }
1526
1704
  break;
1527
1705
  }
1528
- case key === "ArrowLeft": {
1529
- if (input && typeof input.selectionStart === "number") {
1530
- const cursorPosition = input.selectionStart;
1531
- if (cursorPosition === 0) {
1532
- hacerFoco(calcularColumnaAnterior());
1533
- }
1534
- }
1535
- break;
1536
- }
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?.some((f) => f.fieldName === args.column.key);
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 import_react18 = __toESM(require("react"), 1);
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
- const fixedFieldEntry = fixedFields?.find((f) => f.fieldName === column.key);
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?.some((f) => f.fieldName === columnKey)) {
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 import_react17 = __toESM(require("react"), 1);
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
- table: tableName,
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, import_react17.useMemo)(() => import_type_store4.default.typerFrom(fieldDefinition), [fieldDefinition]);
2542
- const [editingValue, setEditingValue] = (0, import_react17.useState)(() => row[column.key] !== null ? isNumericType(fieldDefinition?.typeName) ? row[column.key] : typer.toLocalString(row[column.key]) : null);
2543
- const isCommitInProgress = import_react17.default.useRef(false);
2544
- const theme = (0, import_material11.useTheme)();
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, import_react17.useMemo)(() => getPrimaryKeyValues(row, primaryKey), [row, primaryKey]);
2560
- const handleCommit = (0, import_react17.useCallback)(async (currentValue, closeEditor, focusNextCell) => {
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 = getBestTypedValue(currentValue, typer);
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 handleKeyDown = (0, import_react17.useCallback)(async (event) => {
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 (["Enter", "Tab", "ArrowDown", "ArrowUp", "ArrowRight", "ArrowLeft"].includes(event.key)) {
2712
- void handleCommit(editingValue, true, true);
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 = import_react17.default.useRef(() => {
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 === "F4" && onKeyPress) {
2722
- onKeyPress(rowIdx, column.key, { key, target: document.activeElement ?? document.body }, handleCommit);
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, import_react17.useEffect)(() => registrarEditor?.((key) => procesarTecla.current(key)), []);
2726
- const handleBlur = (0, import_react17.useCallback)(() => {
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, import_jsx_runtime13.jsx)(
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
- return currentCellFeedback?.message ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_material11.Tooltip, { title: currentCellFeedback.message, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { width: "100%" }, children: editor }) }) : editor;
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 import_jsx_runtime14 = require("react/jsx-runtime");
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?.some((f) => f.fieldName === column.key);
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, import_jsx_runtime14.jsx)(
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, import_react18.useMemo)(() => {
3334
+ const columns = (0, import_react21.useMemo)(() => {
2854
3335
  if (!tableDefinition) return [];
2855
3336
  const fieldsToShow = tableDefinition.fields.filter((field) => {
2856
- const isFixedField = fixedFields?.some((f) => f.fieldName === field.name);
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?.some((f) => f.fieldName === fieldDef.name);
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: () => import_react18.default.createElement(ActionsColumnHeaderCell, {
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
- editorOptions: { closeOnExternalRowChange: false },
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 import_react19 = require("react");
2949
- var import_material12 = require("@mui/material");
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 import_jsx_runtime15 = require("react/jsx-runtime");
3433
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2952
3434
  var ImportDialog = ({ open, onClose, onImport, loading }) => {
2953
- const [file, setFile] = (0, import_react19.useState)(null);
2954
- const [options, setOptions] = (0, import_react19.useState)({
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, import_jsx_runtime15.jsxs)(import_material12.Dialog, { open, onClose: loading ? void 0 : onClose, maxWidth: "sm", fullWidth: true, children: [
2974
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_material12.DialogTitle, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
2975
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_FileUpload2.default, { color: "primary" }),
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, import_jsx_runtime15.jsx)(import_material12.DialogContent, { dividers: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_material12.Stack, { spacing: 3, sx: { mt: 1 }, children: [
2979
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_material12.Box, { children: [
2980
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material12.Typography, { variant: "subtitle2", gutterBottom: true, fontWeight: "bold", children: "Seleccionar archivo" }),
2981
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2982
- import_material12.Box,
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, import_jsx_runtime15.jsx)(
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, import_jsx_runtime15.jsx)(import_material12.Typography, { variant: "body2", color: file ? "textPrimary" : "textSecondary", children: file ? file.name : "Haz clic aqu\xED para seleccionar un archivo" })
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, import_jsx_runtime15.jsx)(import_material12.Divider, {}),
3017
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_material12.Box, { children: [
3018
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material12.Typography, { variant: "subtitle2", gutterBottom: true, fontWeight: "bold", children: "Opciones de importaci\xF3n" }),
3019
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_material12.Stack, { children: [
3020
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3021
- import_material12.FormControlLabel,
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, import_jsx_runtime15.jsx)(
3024
- import_material12.Checkbox,
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, import_jsx_runtime15.jsx)(import_material12.Typography, { variant: "body2", children: "Omitir campos desconocidos al importar" })
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, import_jsx_runtime15.jsx)(
3035
- import_material12.FormControlLabel,
3516
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3517
+ import_material15.FormControlLabel,
3036
3518
  {
3037
- control: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3038
- import_material12.Checkbox,
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, import_jsx_runtime15.jsx)(import_material12.Typography, { variant: "body2", children: "Simplificar espacios" })
3527
+ label: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.Typography, { variant: "body2", children: "Simplificar espacios" })
3046
3528
  }
3047
3529
  ),
3048
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3049
- import_material12.FormControlLabel,
3530
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3531
+ import_material15.FormControlLabel,
3050
3532
  {
3051
- control: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3052
- import_material12.Checkbox,
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, import_jsx_runtime15.jsx)(import_material12.Typography, { variant: "body2", children: "Reemplazar saltos de l\xEDnea con espacios" })
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, import_jsx_runtime15.jsxs)(import_material12.DialogActions, { sx: { px: 3, py: 2 }, children: [
3066
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material12.Button, { onClick: onClose, disabled: loading, children: "Cancelar" }),
3067
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3068
- import_material12.Button,
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, import_jsx_runtime15.jsx)(import_FileUpload2.default, {}),
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 import_react20 = require("react");
3083
- var import_material13 = require("@mui/material");
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 import_jsx_runtime16 = require("react/jsx-runtime");
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, import_react20.useState)("xlsx");
3096
- const [options, setOptions] = (0, import_react20.useState)({
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, import_react20.useState)(false);
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, import_jsx_runtime16.jsxs)(import_material13.Dialog, { open, onClose, maxWidth: "xs", fullWidth: true, children: [
3232
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material13.DialogTitle, { children: "Exportar Datos" }),
3233
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material13.DialogContent, { children: isPreparing ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_material13.Box, { display: "flex", flexDirection: "column", alignItems: "center", py: 4, children: [
3234
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material13.CircularProgress, {}),
3235
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material13.Typography, { sx: { mt: 2 }, children: "Preparando exportaci\xF3n..." })
3236
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_material13.Box, { sx: { mt: 1 }, children: [
3237
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_material13.FormControl, { component: "fieldset", children: [
3238
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material13.FormLabel, { component: "legend", children: "Formato" }),
3239
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3240
- import_material13.RadioGroup,
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, import_jsx_runtime16.jsx)(import_material13.FormControlLabel, { value: "xlsx", control: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material13.Radio, {}), label: "Excel (.xlsx)" }),
3246
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material13.FormControlLabel, { value: "tab", control: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material13.Radio, {}), label: "Tabulado (.tab | )" }),
3247
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material13.FormControlLabel, { value: "csv", control: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material13.Radio, {}), label: "CSV (.csv , )" })
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, import_jsx_runtime16.jsxs)(import_material13.Box, { sx: { mt: 3 }, children: [
3253
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material13.Typography, { variant: "subtitle2", gutterBottom: true, children: "Opciones de campos:" }),
3254
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_material13.FormGroup, { children: [
3255
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3256
- import_material13.FormControlLabel,
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, import_jsx_runtime16.jsx)(import_material13.Checkbox, { checked: options.fromOtherTables, onChange: handleOptionChange, name: "fromOtherTables" }),
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, import_jsx_runtime16.jsx)(
3263
- import_material13.FormControlLabel,
3744
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3745
+ import_material16.FormControlLabel,
3264
3746
  {
3265
- control: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material13.Checkbox, { checked: options.readOnly, onChange: handleOptionChange, name: "readOnly" }),
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, import_jsx_runtime16.jsx)(
3270
- import_material13.FormControlLabel,
3751
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3752
+ import_material16.FormControlLabel,
3271
3753
  {
3272
- control: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material13.Checkbox, { checked: options.hiddens, onChange: handleOptionChange, name: "hiddens" }),
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, import_jsx_runtime16.jsxs)(import_material13.DialogActions, { children: [
3280
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material13.Button, { onClick: onClose, disabled: isPreparing, children: "Cancelar" }),
3281
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material13.Button, { onClick: handlePrepareExport, variant: "contained", disabled: isPreparing, children: "Descargar" })
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 import_react21 = require("react");
3288
- var import_material14 = require("@mui/material");
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 import_jsx_runtime17 = require("react/jsx-runtime");
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, import_react21.useState)(isNewRow);
3302
- const [formData, setFormData] = (0, import_react21.useState)(initialData);
3303
- const [lastSavedData, setLastSavedData] = (0, import_react21.useState)(initialData);
3304
- const [validityMap, setValidityMap] = (0, import_react21.useState)({});
3305
- const [globalError, setGlobalError] = (0, import_react21.useState)(null);
3306
- const [isSaving, setIsSaving] = (0, import_react21.useState)(false);
3307
- const [fieldFeedback, setFieldFeedback] = (0, import_react21.useState)({});
3308
- const feedbackTimersRef = (0, import_react21.useRef)({});
3309
- const handleFieldChange = (0, import_react21.useCallback)((fieldName, newValue, isValid) => {
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, import_react21.useMemo)(() => {
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, import_react21.useCallback)(async (fieldName, newValue, isValid) => {
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, import_jsx_runtime17.jsxs)(import_material14.Box, { sx: { p: 2, display: "flex", flexDirection: "column", height: "100%" }, children: [
3419
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_material14.DialogTitle, { sx: { px: 0, pt: 0, display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
3420
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_material14.Typography, { component: "div", variant: "h6", children: [
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, import_jsx_runtime17.jsx)(import_material14.IconButton, { onClick: onClose, size: "small", edge: "end", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_Close.default, {}) })
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, import_jsx_runtime17.jsxs)(import_material14.DialogContent, { dividers: true, sx: { px: 2, flexGrow: 1, py: 1 }, children: [
3428
- globalError && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material14.Alert, { severity: "error", sx: { mb: 2 }, children: globalError }),
3429
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material14.Box, { sx: { display: "flex", flexDirection: "column", gap: 0.5 }, children: tableDefinition.fields.map((field) => {
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, import_jsx_runtime17.jsx)(import_material14.Box, { sx: { width: "100%", maxWidth: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
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, import_jsx_runtime17.jsxs)(import_material14.DialogActions, { sx: { px: 0, pb: 0, pt: 2, justifyContent: "space-between", alignItems: "center" }, children: [
3447
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_material14.Box, { children: [
3448
- isSaving && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material14.CircularProgress, { size: 20, sx: { ml: 2 } }),
3449
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: { marginLeft: 10, fontSize: "0.8rem", color: "#666" }, children: isSaving ? "Guardando..." : "Cambios auto-guardados" })
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, import_jsx_runtime17.jsx)(import_material14.Button, { variant: "outlined", onClick: onClose, children: "Cerrar" })
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 import_jsx_runtime18 = require("react/jsx-runtime");
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, import_material15.useTheme)();
4029
+ const theme = (0, import_material18.useTheme)();
3482
4030
  const { tableDefinition, row } = ancestor;
3483
- const columns = (0, import_react22.useMemo)(() => {
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, import_jsx_runtime18.jsx)(import_material15.Box, { sx: { p: 0.5, height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3495
- import_material15.Typography,
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, import_jsx_runtime18.jsx)(import_material15.Box, { sx: { px: 1, height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.Typography, { variant: "body2", sx: { fontSize: "0.875rem" }, noWrap: true, children: String(props.row[field.name] ?? "") }) })
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, import_jsx_runtime18.jsxs)(import_material15.Box, { sx: {
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, import_jsx_runtime18.jsx)(import_material15.Box, { sx: {
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, import_jsx_runtime18.jsx)(import_material15.Typography, { variant: "subtitle2", component: "div", children: cambiarGuionesBajosPorEspacios(ancestor.tableName) }) }),
3533
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
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, import_react22.useMemo)(() => fixedFieldsRecibidos, [claveFixedFields]);
3563
- const cacheHeredado = (0, import_react22.useContext)(CacheGrillasContext);
3564
- const [cachePropio] = (0, import_react22.useState)(() => /* @__PURE__ */ new Map());
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, import_react22.useState)(() => claveCache ? cache.get(claveCache) : void 0);
3567
- const claveCargadaRef = (0, import_react22.useRef)(guardada ? `${tableName}|${claveFixedFields}` : null);
3568
- const [tableDefinition, setTableDefinition] = (0, import_react22.useState)(guardada?.tableDefinition ?? null);
3569
- const [tableData, setTableData] = (0, import_react22.useState)(guardada?.tableData ?? []);
3570
- const [cargandoInicial, setCargandoInicial] = (0, import_react22.useState)(!guardada);
3571
- const [errorDeCarga, setErrorDeCarga] = (0, import_react22.useState)(null);
3572
- const [anchosCalculados, setAnchosCalculados] = (0, import_react22.useState)(() => guardada?.anchosCalculados ?? /* @__PURE__ */ new Map());
3573
- const [detallesAbiertos, setDetallesAbiertos] = (0, import_react22.useState)(guardada?.detallesAbiertos ?? []);
3574
- const [altosDetalle, setAltosDetalle] = (0, import_react22.useState)(() => guardada?.altosDetalle ?? /* @__PURE__ */ new Map());
3575
- const [anchosDetalle, setAnchosDetalle] = (0, import_react22.useState)(() => /* @__PURE__ */ new Map());
3576
- const [selectedRows, setSelectedRows] = (0, import_react22.useState)(() => /* @__PURE__ */ new Set());
3577
- const [, setSelectedCell] = (0, import_react22.useState)(void 0);
3578
- const [estadoGrilla] = (0, import_react22.useState)(crearEstadoGrilla);
3579
- const theme = (0, import_material15.useTheme)();
3580
- const [openDataGridOptions, setOpenDataGridOptions] = (0, import_react22.useState)(false);
3581
- const [dataGridOptionsAnchorEl, setDataGridOptionsAnchorEl] = (0, import_react22.useState)(null);
3582
- const [exitingRowIds, setExitingRowIds] = (0, import_react22.useState)(/* @__PURE__ */ new Set());
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, import_react22.useRef)(null);
3586
- const rowAtEditStartRef = (0, import_react22.useRef)(null);
3587
- const [openImportDialog, setOpenImportDialog] = (0, import_react22.useState)(false);
3588
- const [openExportDialog, setOpenExportDialog] = (0, import_react22.useState)(false);
3589
- const [columnWidths, setColumnWidths] = (0, import_react22.useState)(() => /* @__PURE__ */ new Map());
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, import_react22.useMemo)(() => {
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, import_react22.useMemo)(() => new Set(detallesAbiertos), [detallesAbiertos]);
3610
- const filasDetalleRef = (0, import_react22.useRef)(/* @__PURE__ */ new Map());
3611
- const filasMostradas = (0, import_react22.useMemo)(() => {
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, import_react22.useCallback)((clave) => altosDetalle.get(clave) ?? ALTO_INICIAL_DETALLE, [altosDetalle]);
3639
- const altoDetalles = (0, import_react22.useMemo)(
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, import_react22.useRef)(tableName);
3696
- (0, import_react22.useEffect)(() => {
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, import_react22.useEffect)(() => {
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, import_react22.useEffect)(() => {
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, import_react22.useEffect)(() => {
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, import_react22.useCallback)(() => {
4374
+ const resetSortingDeLaTabla = (0, import_react25.useCallback)(() => {
3801
4375
  if (tableDefinition) resetSorting(tableDefinition);
3802
4376
  }, [tableDefinition, resetSorting]);
3803
- const abrirImportacion = (0, import_react22.useCallback)(() => setOpenImportDialog(true), []);
3804
- const abrirExportacion = (0, import_react22.useCallback)(() => setOpenExportDialog(true), []);
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, import_react22.useCallback)((anchorEl) => {
4389
+ const abrirOpcionesDeGrilla = (0, import_react25.useCallback)((anchorEl) => {
3816
4390
  setDataGridOptionsAnchorEl(anchorEl);
3817
4391
  setOpenDataGridOptions(true);
3818
4392
  }, []);
3819
- const editarEnFicha = (0, import_react22.useCallback)((row) => {
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, import_react22.useCallback)((row, detailTable) => {
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, import_react22.useCallback)((row, detailTable) => {
3848
- const parametros = new URLSearchParams();
3849
- calcularFixedFieldsDetalle(detailTable, row).forEach((ff) => parametros.set(ff.fieldName, String(ff.value)));
3850
- window.open(`${window.location.origin}${rutaBase}/wScreens/${detailTable.wScreen}?${parametros}`, "_blank");
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, import_react22.useCallback)((row, rowId, detailTable, enOtraPestana) => {
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, import_react22.useState)(null);
3865
- (0, import_react22.useEffect)(() => {
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, import_react22.useState)(null);
3879
- (0, import_react22.useEffect)(() => {
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, import_react22.useContext)(AltoDisponibleContext);
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, import_react22.useCallback)((clave, ancho) => {
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, import_react22.useCallback)((clave, altoDeseado2) => {
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, import_react22.useCallback)((fila) => {
4472
+ const renderDetalle = (0, import_react25.useCallback)((fila) => {
3899
4473
  const { detailTable } = fila;
3900
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
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, import_jsx_runtime18.jsx)(
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, import_jsx_runtime18.jsx)(
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, import_jsx_runtime18.jsxs)(import_material15.Alert, { severity: "warning", children: [
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, import_react22.useMemo)(() => ({ abiertos, alternarDetalle, renderDetalle }), [abiertos, alternarDetalle, renderDetalle]);
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, import_react22.useEffect)(() => {
4511
+ (0, import_react25.useEffect)(() => {
3938
4512
  onAltoDeseado?.(altoDeseado);
3939
4513
  }, [onAltoDeseado, altoDeseado]);
3940
- const rowKeyGetter = (0, import_react22.useCallback)((row) => esFilaDetalle(row) ? `detalle:${row.clave}` : getPrimaryKeyValues(row, primaryKey), [primaryKey]);
3941
- const rowHeight = (0, import_react22.useCallback)((row) => esFilaDetalle(row) ? altoDeDetalle(row.clave) : ROW_HEIGHT, [altoDeDetalle]);
3942
- const rowClass = (0, import_react22.useCallback)(
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, import_react22.useMemo)(() => {
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, import_react22.useEffect)(() => {
4530
+ (0, import_react25.useEffect)(() => {
3957
4531
  if (anchoContenido !== void 0) onAnchoDeseado?.(anchoContenido);
3958
4532
  }, [onAnchoDeseado, anchoContenido]);
3959
- const estiloGrilla = (0, import_react22.useMemo)(() => ({ height: "100%", width: "100%", boxSizing: "border-box", ...gridStyles }), [gridStyles]);
3960
- const bottomSummaryRows = (0, import_react22.useMemo)(() => conPie ? [bottomSummaryRow] : [], [conPie, bottomSummaryRow]);
3961
- const vistaGrilla = (0, import_react22.useMemo)(() => ({ isFilterRowVisible }), [isFilterRowVisible]);
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, import_jsx_runtime18.jsxs)(import_material15.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: [
3974
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.CircularProgress, {}),
3975
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.Typography, { variant: "h6", sx: { ml: 2 }, children: "Cargando tabla..." })
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, import_jsx_runtime18.jsx)(import_material15.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.Alert, { severity: "error", children: errorDeCarga }) });
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, import_jsx_runtime18.jsx)(import_material15.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.Alert, { severity: "warning", children: "No se pudo cargar la definici\xF3n de la tabla." }) });
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, import_jsx_runtime18.jsx)(CacheGrillasContext.Provider, { value: cache, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material15.Box, { sx: { pt: anidada ? 0 : 2, display: "flex", flexDirection: "column", height: "100%", boxSizing: "border-box", width: anchoContenido ?? void 0, maxWidth: "100%" }, children: [
3985
- !anidada && ancestors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.Box, { sx: { px: 2, pt: 0, pb: 1, display: "flex", flexDirection: "column" }, children: ancestors.map((ancestor, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
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, import_jsx_runtime18.jsxs)(
3995
- import_material15.Box,
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, import_jsx_runtime18.jsxs)(import_material15.Typography, { variant: "subtitle2", component: "div", children: [
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, import_jsx_runtime18.jsx)(import_material15.CircularProgress, { size: 14, color: "inherit" })
4596
+ loading && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.CircularProgress, { size: 14, color: "inherit" })
4023
4597
  ]
4024
4598
  }
4025
4599
  ),
4026
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
4027
- import_material15.Box,
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, import_jsx_runtime18.jsx)(EstadoGrillaContext.Provider, { value: estadoGrilla, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(VistaGrillaContext.Provider, { value: vistaGrilla, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DetallesGrillaContext.Provider, { value: detallesGrilla, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
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, import_jsx_runtime18.jsx)(
4076
- import_material15.Box,
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, import_jsx_runtime18.jsx)(import_material15.Typography, { variant: "body2", color: "textSecondary", children: fallBackMessage })
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, import_jsx_runtime18.jsx)(
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, import_jsx_runtime18.jsx)(
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, import_jsx_runtime18.jsx)(
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, import_jsx_runtime18.jsx)(
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, import_jsx_runtime18.jsx)(
4137
- import_material15.Dialog,
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, import_jsx_runtime18.jsx)(
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 import_react38 = __toESM(require("react"), 1);
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 import_react26 = require("react");
4772
+ var import_react29 = require("react");
4198
4773
  var import_react_router_dom4 = require("react-router-dom");
4199
- var import_material17 = require("@mui/material");
4774
+ var import_material20 = require("@mui/material");
4200
4775
 
4201
4776
  // src/contexts/AppContext.tsx
4202
- var import_react23 = require("react");
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 import_jsx_runtime19 = require("react/jsx-runtime");
4206
- var AuthContext = (0, import_react23.createContext)(void 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, import_react23.useContext)(AuthContext);
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, import_react23.useState)(false);
4218
- const [showSessionExpiredMessage, setShowSessionExpiredMessage] = (0, import_react23.useState)(false);
4219
- const isRedirectingRef = (0, import_react23.useRef)(false);
4220
- const huboSesionRef = (0, import_react23.useRef)(false);
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, import_react23.useCallback)(() => {
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, import_react23.useCallback)(() => {
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, import_react23.useCallback)(async () => {
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, import_react23.useEffect)(() => {
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, import_react23.useMemo)(() => ({
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, import_jsx_runtime19.jsx)(AuthContext.Provider, { value: authContextValue, children });
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 import_react24 = __toESM(require("react"), 1);
4309
- var import_material16 = require("@mui/material");
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 import_jsx_runtime20 = require("react/jsx-runtime");
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, import_jsx_runtime20.jsx)(import_TableChart.default, { sx: { color: import_colors.blue[700] } });
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, import_jsx_runtime20.jsx)(import_Dns.default, { sx: { color: import_colors.teal[700] } });
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, import_jsx_runtime20.jsx)(import_Folder.default, { sx: { color: import_colors.orange[800] } });
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, import_jsx_runtime20.jsx)(import_DesktopWindows.default, { sx: { color: import_colors.grey[700] } });
4944
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_DesktopWindows.default, { sx: { color: import_colors.grey[700] } });
4370
4945
  }
4371
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_WarningAmber3.default, { sx: { color: import_colors.red[500] } });
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 = import_react24.default.useRef(null);
4386
- (0, import_react24.useEffect)(() => {
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, import_jsx_runtime20.jsxs)("div", { ref: itemRef, children: [
4392
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
4393
- import_material16.ListItemButton,
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, import_jsx_runtime20.jsx)(import_material16.ListItemIcon, { sx: { minWidth: "38px" }, children: getIcon(item) }),
4400
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.ListItemText, { primary: item.label || item.name }),
4401
- item.menuType === "menu" ? open ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_ExpandLess.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_ExpandMore.default, {}) : null
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, import_jsx_runtime20.jsx)(import_material16.Collapse, { in: open, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.List, { component: "div", disablePadding: true, children: item.menuContent.map((subItem) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
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, import_jsx_runtime20.jsx)(import_material16.Box, { sx: { p: 2, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Typography, { variant: "body2", color: "text.secondary", children: "Cargando men\xFA..." }) });
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, import_react24.useEffect)(() => {
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, import_jsx_runtime20.jsxs)(import_material16.Box, { sx: { width: "100%", flexShrink: 0 }, children: [
4461
- clientContext.menu.some((item) => item.menuType === "menu") && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.ListItem, { disablePadding: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material16.ListItemButton, { onClick: handleToggleAllSubMenus, children: [
4462
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.ListItemIcon, { sx: { minWidth: "38px" }, children: isMostlyOpen ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_UnfoldLess.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_UnfoldMore.default, {}) }),
4463
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.ListItemText, { primary: isMostlyOpen ? "colapsar " : "expandir" })
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, import_jsx_runtime20.jsx)(import_material16.Divider, {}),
4466
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.List, { children: clientContext.menu.map((menuItem) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
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 import_react25 = require("react");
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, import_react25.useCallback)(async () => {
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 import_jsx_runtime21 = require("react/jsx-runtime");
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, import_material17.useTheme)();
4516
- const isMobile = (0, import_material17.useMediaQuery)(theme.breakpoints.down("sm"));
4517
- (0, import_react26.useEffect)(() => {
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, import_jsx_runtime21.jsx)(import_material17.Box, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Typography, { children: "Cargando dise\xF1o de la aplicaci\xF3n..." }) });
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, import_jsx_runtime21.jsxs)(import_material17.Box, { sx: { display: "flex", height: "100vh" }, children: [
4534
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.CssBaseline, {}),
4535
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4536
- import_material17.AppBar,
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, import_jsx_runtime21.jsxs)(import_material17.Toolbar, { children: [
4555
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4556
- import_material17.IconButton,
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, import_jsx_runtime21.jsx)(import_ChevronLeft.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_Menu.default, {})
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, import_jsx_runtime21.jsx)(
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, import_jsx_runtime21.jsx)(import_material17.Typography, { variant: "h6", noWrap: true, component: "div", sx: { flexGrow: 1 }, children: isDrawerOpen ? "" : clientContext.config.title }),
4577
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Typography, { variant: "subtitle1", component: "div", sx: { mr: 2 }, children: clientContext.username }),
4578
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4579
- import_material17.Button,
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, import_jsx_runtime21.jsx)(import_Logout.default, {}),
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, import_jsx_runtime21.jsxs)(
4591
- import_material17.Drawer,
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, import_jsx_runtime21.jsxs)(
4608
- import_material17.Toolbar,
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, import_jsx_runtime21.jsx)(
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, import_jsx_runtime21.jsx)(import_material17.Typography, { variant: "h6", sx: { fontWeight: "bold" }, children: clientContext.config.title })
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, import_jsx_runtime21.jsx)(SideMenu_default, { onMenuItemClick: handleDrawerCloseMobile })
5207
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SideMenu_default, { onMenuItemClick: handleDrawerCloseMobile })
4633
5208
  ]
4634
5209
  }
4635
5210
  ),
4636
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
4637
- import_material17.Box,
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, import_jsx_runtime21.jsx)(import_material17.Toolbar, {}),
4664
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Box, { sx: { flex: 1, minHeight: 0, overflowY: "auto", display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_router_dom4.Outlet, {}) })
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 import_material18 = require("@mui/material");
4674
- var import_jsx_runtime22 = require("react/jsx-runtime");
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, import_jsx_runtime22.jsx)(
4694
- import_material18.Modal,
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, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: style, children: [
4714
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Typography, { id: "session-expired-modal-title", variant: "h6", component: "h2", gutterBottom: true, children: "\xA1Sesi\xF3n Expirada!" }),
4715
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.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." }),
4716
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Button, { variant: "contained", color: "primary", onClick: handleClose, children: "Ir al Login" })
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 import_jsx_runtime23 = require("react/jsx-runtime");
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, import_jsx_runtime23.jsx)(import_react_router_dom5.Navigate, { to: rutaDeItemDeMenu(item), replace: true }) : null;
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 import_react27 = require("react");
4735
- var import_material19 = require("@mui/material");
4736
- var import_jsx_runtime24 = require("react/jsx-runtime");
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, import_react27.useEffect)(() => {
5314
+ (0, import_react30.useEffect)(() => {
4740
5315
  logout();
4741
5316
  }, [logout]);
4742
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material19.Box, { sx: {
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,21 +5322,20 @@ var LogoutPage = () => {
4747
5322
  height: "100vh",
4748
5323
  textAlign: "center"
4749
5324
  }, children: [
4750
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.CircularProgress, { size: 60 }),
4751
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.Typography, { variant: "h6", sx: { mt: 2 }, children: "Cerrando sesi\xF3n..." })
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 import_react28 = require("react");
4758
- var import_material20 = require("@mui/material");
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
- var import_react_router_dom6 = require("react-router-dom");
4763
5337
  var import_react_redux4 = require("react-redux");
4764
- var import_jsx_runtime25 = require("react/jsx-runtime");
5338
+ var import_jsx_runtime28 = require("react/jsx-runtime");
4765
5339
  var loginSchema = z.object({
4766
5340
  username: z.string().min(1, "El usuario es requerido"),
4767
5341
  // Añadir validación básica
@@ -4769,9 +5343,8 @@ var loginSchema = z.object({
4769
5343
  // Añadir validación básica
4770
5344
  });
4771
5345
  var LoginPage = () => {
4772
- const navigate = (0, import_react_router_dom6.useNavigate)();
4773
- const [loginError, setLoginError] = (0, import_react28.useState)(null);
4774
- const [isSubmitting, setIsSubmitting] = (0, import_react28.useState)(false);
5346
+ const [loginError, setLoginError] = (0, import_react31.useState)(null);
5347
+ const [isSubmitting, setIsSubmitting] = (0, import_react31.useState)(false);
4775
5348
  const { setIsLoggedIn, checkSession } = useApp();
4776
5349
  const dispatch = (0, import_react_redux4.useDispatch)();
4777
5350
  const {
@@ -4807,7 +5380,6 @@ var LoginPage = () => {
4807
5380
  setIsLoggedIn(true);
4808
5381
  await dispatch(fetchClientContext()).unwrap();
4809
5382
  console.log("Login exitoso y clientContext cargado.");
4810
- navigate("/");
4811
5383
  reset();
4812
5384
  } catch (error) {
4813
5385
  console.error("Error al iniciar sesi\xF3n:", error);
@@ -4817,16 +5389,16 @@ var LoginPage = () => {
4817
5389
  setIsSubmitting(false);
4818
5390
  }
4819
5391
  };
4820
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4821
- import_material20.Box,
5392
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5393
+ import_material23.Box,
4822
5394
  {
4823
5395
  display: "flex",
4824
5396
  alignItems: "center",
4825
5397
  justifyContent: "center",
4826
5398
  minHeight: "100vh",
4827
5399
  bgcolor: "#f5f5f5",
4828
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
4829
- import_material20.Box,
5400
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
5401
+ import_material23.Box,
4830
5402
  {
4831
5403
  width: "100%",
4832
5404
  maxWidth: "400px",
@@ -4835,7 +5407,7 @@ var LoginPage = () => {
4835
5407
  borderRadius: 8,
4836
5408
  boxShadow: 3,
4837
5409
  children: [
4838
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Box, { sx: { display: "flex", justifyContent: "center", mb: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5410
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material23.Box, { sx: { display: "flex", justifyContent: "center", mb: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4839
5411
  "img",
4840
5412
  {
4841
5413
  src: `${envConfig.backendUrl}/img/login-logo-icon.png`,
@@ -4843,17 +5415,17 @@ var LoginPage = () => {
4843
5415
  style: { height: "192px", maxWidth: "100%", objectFit: "contain" }
4844
5416
  }
4845
5417
  ) }),
4846
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Typography, { variant: "h5", align: "center", gutterBottom: true, sx: { fontWeight: "bold", color: "primary.main" }, children: "Iniciar Sesi\xF3n" }),
4847
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("form", { onSubmit: handleSubmit(onSubmit), className: "space-y-4", children: [
4848
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { children: [
4849
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("label", { htmlFor: "username", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Typography, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Usuario" }) }),
4850
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
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)(
4851
5423
  import_react_hook_form.Controller,
4852
5424
  {
4853
5425
  name: "username",
4854
5426
  control,
4855
- render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4856
- import_material20.TextField,
5427
+ render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5428
+ import_material23.TextField,
4857
5429
  {
4858
5430
  ...field,
4859
5431
  type: "text",
@@ -4868,15 +5440,15 @@ var LoginPage = () => {
4868
5440
  }
4869
5441
  )
4870
5442
  ] }),
4871
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { children: [
4872
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("label", { htmlFor: "password", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Typography, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Contrase\xF1a" }) }),
4873
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
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)(
4874
5446
  import_react_hook_form.Controller,
4875
5447
  {
4876
5448
  name: "password",
4877
5449
  control,
4878
- render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4879
- import_material20.TextField,
5450
+ render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5451
+ import_material23.TextField,
4880
5452
  {
4881
5453
  ...field,
4882
5454
  type: "password",
@@ -4891,14 +5463,14 @@ var LoginPage = () => {
4891
5463
  }
4892
5464
  )
4893
5465
  ] }),
4894
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Button, { type: "submit", fullWidth: true, variant: "contained", color: "primary", disabled: isSubmitting, sx: { mt: 2 }, children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
4895
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.CircularProgress, { size: 20, sx: { mr: 1 } }),
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 } }),
4896
5468
  "Iniciando sesi\xF3n..."
4897
5469
  ] }) : "Iniciar Sesi\xF3n" })
4898
5470
  ] }),
4899
- loginError && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material20.Alert, { severity: "error", sx: { mt: 2, maxHeight: "200px" }, children: [
5471
+ loginError && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_material23.Alert, { severity: "error", sx: { mt: 2, maxHeight: "200px" }, children: [
4900
5472
  " ",
4901
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.AlertTitle, { children: "Error" }),
5473
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material23.AlertTitle, { children: "Error" }),
4902
5474
  loginError
4903
5475
  ] })
4904
5476
  ]
@@ -4910,19 +5482,19 @@ var LoginPage = () => {
4910
5482
  var LoginPage_default = LoginPage;
4911
5483
 
4912
5484
  // src/components/ProcedureForm.tsx
4913
- var import_react29 = __toESM(require("react"), 1);
4914
- var import_react_router_dom7 = require("react-router-dom");
4915
- var import_material22 = require("@mui/material");
5485
+ var import_react32 = __toESM(require("react"), 1);
5486
+ var import_react_router_dom6 = require("react-router-dom");
5487
+ var import_material25 = require("@mui/material");
4916
5488
 
4917
5489
  // src/pages/procedure-results/SuccessDisplay.tsx
4918
- var import_material21 = require("@mui/material");
4919
- var import_jsx_runtime26 = require("react/jsx-runtime");
5490
+ var import_material24 = require("@mui/material");
5491
+ var import_jsx_runtime29 = require("react/jsx-runtime");
4920
5492
  var SuccessDisplay = ({ data }) => {
4921
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_material21.Paper, { elevation: 2, sx: { p: 2, mt: 2, bgcolor: "success.light", color: "success.contrastText" }, children: [
4922
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Typography, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: "\xA1Operaci\xF3n Exitosa!" }),
4923
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Typography, { variant: "body2", sx: { fontSize: "0.85rem" }, children: "Detalles del resultado:" }),
4924
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Box, { sx: { bgcolor: "success.dark", p: 1, borderRadius: 1, mt: 1, overflowX: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(data, null, 2) }) }),
4925
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Typography, { variant: "body2", sx: { fontSize: "0.8rem", mt: 1 }, children: "Puedes revisar los detalles anteriores o cerrar este mensaje." })
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." })
4926
5498
  ] });
4927
5499
  };
4928
5500
  var SuccessDisplay_default = SuccessDisplay;
@@ -4936,22 +5508,22 @@ var extendResultsOk = (newComponents) => {
4936
5508
  };
4937
5509
 
4938
5510
  // src/components/ProcedureForm.tsx
4939
- var import_jsx_runtime27 = require("react/jsx-runtime");
5511
+ var import_jsx_runtime30 = require("react/jsx-runtime");
4940
5512
  var ProcedureForm = () => {
4941
- const { procedureName } = (0, import_react_router_dom7.useParams)();
5513
+ const { procedureName } = (0, import_react_router_dom6.useParams)();
4942
5514
  const { clientContext } = useApp();
4943
5515
  const { callApi, loading: apiLoading, error: apiError } = useApiCall();
4944
- const [validationErrors, setValidationErrors] = (0, import_react29.useState)({});
4945
- const [successMessage, setSuccessMessage] = (0, import_react29.useState)(null);
4946
- const [executionLog, setExecutionLog] = (0, import_react29.useState)([]);
4947
- const [procedureResultData, setProcedureResultData] = (0, import_react29.useState)(null);
4948
- const procedure = (0, import_react29.useMemo)(() => {
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)(() => {
4949
5521
  if (procedureName && clientContext?.procedure) {
4950
5522
  return clientContext.procedure[procedureName];
4951
5523
  }
4952
5524
  return void 0;
4953
5525
  }, [procedureName, clientContext]);
4954
- const [formValues, setFormValues] = (0, import_react29.useState)(() => {
5526
+ const [formValues, setFormValues] = (0, import_react32.useState)(() => {
4955
5527
  if (!procedure) return {};
4956
5528
  const initialValues = {};
4957
5529
  procedure.parameters.forEach((param) => {
@@ -4976,7 +5548,7 @@ var ProcedureForm = () => {
4976
5548
  });
4977
5549
  return initialValues;
4978
5550
  });
4979
- import_react29.default.useEffect(() => {
5551
+ import_react32.default.useEffect(() => {
4980
5552
  if (procedure) {
4981
5553
  setValidationErrors({});
4982
5554
  setSuccessMessage(null);
@@ -5006,11 +5578,11 @@ var ProcedureForm = () => {
5006
5578
  setExecutionLog([]);
5007
5579
  }
5008
5580
  }, [procedure]);
5009
- const addLogMessage = (0, import_react29.useCallback)((message, isError = false) => {
5581
+ const addLogMessage = (0, import_react32.useCallback)((message, isError = false) => {
5010
5582
  const timestamp = (/* @__PURE__ */ new Date()).toLocaleTimeString("es-AR");
5011
5583
  setExecutionLog((prev) => [...prev, `[${timestamp}] ${isError ? "ERROR: " : ""}${message}`]);
5012
5584
  }, []);
5013
- const handleChange = (0, import_react29.useCallback)((e, child) => {
5585
+ const handleChange = (0, import_react32.useCallback)((e, child) => {
5014
5586
  const { name, value } = e.target;
5015
5587
  let newValue = value;
5016
5588
  if (e.target.type === "checkbox") {
@@ -5132,7 +5704,7 @@ var ProcedureForm = () => {
5132
5704
  addLogMessage("Ejecuci\xF3n finalizada.");
5133
5705
  }
5134
5706
  };
5135
- const renderInputField = (0, import_react29.useCallback)((param) => {
5707
+ const renderInputField = (0, import_react32.useCallback)((param) => {
5136
5708
  const hasError = !!validationErrors[param.name];
5137
5709
  const errorMessage = validationErrors[param.name];
5138
5710
  const commonProps = {
@@ -5151,10 +5723,10 @@ var ProcedureForm = () => {
5151
5723
  sx: { fontSize: "0.8rem" }
5152
5724
  };
5153
5725
  if (param.options && param.options.length > 0) {
5154
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material22.FormControl, { fullWidth: true, margin: "dense", size: "small", error: hasError, required: commonProps.required, children: [
5155
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.InputLabel, { id: `${param.name}-label`, sx: { fontSize: "0.8rem" }, children: param.label || param.name }),
5156
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
5157
- import_material22.Select,
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,
5158
5730
  {
5159
5731
  labelId: `${param.name}-label`,
5160
5732
  value: formValues[param.name] === void 0 ? "" : formValues[param.name],
@@ -5164,14 +5736,14 @@ var ProcedureForm = () => {
5164
5736
  label: param.label || param.name,
5165
5737
  disabled: apiLoading,
5166
5738
  sx: { fontSize: "0.8rem" },
5167
- renderValue: (selected) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.Typography, { sx: { fontSize: "0.8rem" }, children: selected }),
5739
+ renderValue: (selected) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.Typography, { sx: { fontSize: "0.8rem" }, children: selected }),
5168
5740
  children: [
5169
- (!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.MenuItem, { value: "", sx: { fontSize: "0.8rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("em", { children: "Seleccione..." }) }),
5170
- param.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.MenuItem, { value: option, sx: { fontSize: "0.8rem" }, children: option }, option))
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))
5171
5743
  ]
5172
5744
  }
5173
5745
  ),
5174
- (param.description || errorMessage) && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
5746
+ (param.description || errorMessage) && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
5175
5747
  ] });
5176
5748
  }
5177
5749
  switch (param.typeName) {
@@ -5180,19 +5752,19 @@ var ProcedureForm = () => {
5180
5752
  case "tsrange":
5181
5753
  case "time_range":
5182
5754
  case "daterange":
5183
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.TextField, { type: "text", value: formValues[param.name] || "", ...commonProps });
5755
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.TextField, { type: "text", value: formValues[param.name] || "", ...commonProps });
5184
5756
  case "decimal":
5185
5757
  case "double":
5186
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.TextField, { type: "number", inputProps: { step: "any", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
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 });
5187
5759
  case "integer":
5188
5760
  case "bigint":
5189
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.TextField, { type: "number", inputProps: { step: "1", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
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 });
5190
5762
  case "boolean":
5191
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5192
- import_material22.FormControlLabel,
5763
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5764
+ import_material25.FormControlLabel,
5193
5765
  {
5194
- control: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5195
- import_material22.Checkbox,
5766
+ control: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5767
+ import_material25.Checkbox,
5196
5768
  {
5197
5769
  checked: !!formValues[param.name],
5198
5770
  onChange: handleChange,
@@ -5202,21 +5774,21 @@ var ProcedureForm = () => {
5202
5774
  size: "small"
5203
5775
  }
5204
5776
  ),
5205
- label: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.Typography, { sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "inherit" }, children: param.label || param.name }),
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 }),
5206
5778
  sx: { mt: 1, mb: 0 }
5207
5779
  }
5208
5780
  );
5209
5781
  case "date":
5210
5782
  case "timestamp":
5211
5783
  case "time":
5212
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.TextField, { type: param.typeName === "date" ? "date" : param.typeName === "timestamp" ? "datetime-local" : "time", value: formValues[param.name] || "", ...commonProps, InputLabelProps: { shrink: true, sx: { fontSize: "0.8rem" } } });
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" } } });
5213
5785
  case "jsonb":
5214
5786
  case "jsona":
5215
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.TextField, { multiline: true, rows: 5, value: formValues[param.name] || "", ...commonProps, InputProps: { sx: { fontSize: "0.8rem" } } });
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" } } });
5216
5788
  case "bytea":
5217
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material22.FormControl, { fullWidth: true, margin: "dense", error: hasError, required: commonProps.required, children: [
5218
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.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 }),
5219
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
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)(
5220
5792
  "input",
5221
5793
  {
5222
5794
  type: "file",
@@ -5230,34 +5802,34 @@ var ProcedureForm = () => {
5230
5802
  style: { padding: "6px 0", fontSize: "0.8rem" }
5231
5803
  }
5232
5804
  ),
5233
- (param.description || errorMessage) && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
5805
+ (param.description || errorMessage) && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
5234
5806
  ] });
5235
5807
  default:
5236
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.TextField, { type: "text", value: formValues[param.name] || "", ...commonProps });
5808
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.TextField, { type: "text", value: formValues[param.name] || "", ...commonProps });
5237
5809
  }
5238
5810
  }, [formValues, handleChange, apiLoading, validationErrors]);
5239
- const ResultDisplayContent = (0, import_react29.useMemo)(() => {
5811
+ const ResultDisplayContent = (0, import_react32.useMemo)(() => {
5240
5812
  if (!procedureResultData || !procedure?.resultOk) return null;
5241
5813
  const ComponentToRender = resultsOk[procedure.resultOk];
5242
5814
  if (ComponentToRender) {
5243
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ComponentToRender, { data: procedureResultData });
5815
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ComponentToRender, { data: procedureResultData });
5244
5816
  } else {
5245
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material22.Paper, { elevation: 2, sx: { p: 2, mt: 0, bgcolor: "warning.light" }, children: [
5246
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material22.Typography, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: [
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: [
5247
5819
  "el componente para resolver el resultOk: '",
5248
5820
  procedure.resultOk,
5249
5821
  "' definido en el procedure no existe o no est\xE1 mapeado."
5250
5822
  ] }),
5251
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.Box, { sx: {
5823
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.Box, { sx: {
5252
5824
  bgcolor: "warning.dark",
5253
5825
  p: 1,
5254
5826
  borderRadius: 1
5255
- }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(procedureResultData, null, 2) }) })
5827
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(procedureResultData, null, 2) }) })
5256
5828
  ] });
5257
5829
  }
5258
5830
  }, [procedureResultData, procedure]);
5259
5831
  if (!procedure) {
5260
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material22.Box, { sx: {
5832
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material25.Box, { sx: {
5261
5833
  p: 2,
5262
5834
  width: "100%",
5263
5835
  boxSizing: "border-box",
@@ -5267,13 +5839,13 @@ var ProcedureForm = () => {
5267
5839
  boxShadow: 3,
5268
5840
  textAlign: "center"
5269
5841
  }, children: [
5270
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.CircularProgress, { sx: { mb: 2 } }),
5271
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.Typography, { variant: "h6", color: "text.secondary", children: "Cargando procedimiento o no encontrado..." })
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..." })
5272
5844
  ] });
5273
5845
  }
5274
5846
  return (
5275
5847
  // Esta es la Box más externa que ahora controlará el scroll
5276
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material22.Box, { sx: {
5848
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material25.Box, { sx: {
5277
5849
  p: 2,
5278
5850
  ml: 1,
5279
5851
  mt: 2,
@@ -5290,17 +5862,17 @@ var ProcedureForm = () => {
5290
5862
  overflowX: "hidden"
5291
5863
  // Oculta el scroll horizontal si no es necesario para el contenedor principal
5292
5864
  }, children: [
5293
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.Typography, { variant: "h5", component: "h2", gutterBottom: true, align: "left", children: cambiarGuionesBajosPorEspacios(procedure.proceedLabel || procedure.action) }),
5294
- Object.values(validationErrors).some((err) => err !== null) && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material22.Alert, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: [
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: [
5295
5867
  "Por favor, corrige los errores en el formulario antes de enviar.",
5296
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("ul", { children: Object.values(validationErrors).map((err, idx) => err && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("li", { children: err }, idx)) })
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)) })
5297
5869
  ] }),
5298
- !Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.Alert, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: apiError.message }),
5299
- !Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.Alert, { severity: "success", sx: { mb: 2, fontSize: "0.8rem" }, children: successMessage }),
5300
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("form", { onSubmit: handleSubmit, children: [
5301
- procedure.parameters.map((param) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { children: renderInputField(param) }, param.name)),
5302
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5303
- import_material22.Button,
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,
5304
5876
  {
5305
5877
  type: "submit",
5306
5878
  variant: "contained",
@@ -5308,20 +5880,20 @@ var ProcedureForm = () => {
5308
5880
  disabled: apiLoading || Object.values(validationErrors).some((err) => err !== null),
5309
5881
  sx: { mt: 2 },
5310
5882
  size: "medium",
5311
- startIcon: apiLoading ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.CircularProgress, { size: 20, color: "inherit" }) : null,
5883
+ startIcon: apiLoading ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.CircularProgress, { size: 20, color: "inherit" }) : null,
5312
5884
  children: apiLoading ? "Ejecutando..." : procedure.proceedLabel || "Ejecutar"
5313
5885
  }
5314
5886
  )
5315
5887
  ] }),
5316
- ResultDisplayContent && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material22.Box, { sx: { mt: 2 }, children: [
5888
+ ResultDisplayContent && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material25.Box, { sx: { mt: 2 }, children: [
5317
5889
  " ",
5318
5890
  ResultDisplayContent
5319
5891
  ] }),
5320
- executionLog.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material22.Box, { sx: { mt: 3 }, children: [
5321
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.Divider, { sx: { mb: 2 } }),
5322
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.Typography, { variant: "h6", gutterBottom: true, sx: { fontSize: "0.9rem" }, children: "Registro de Ejecuci\xF3n" }),
5323
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5324
- import_material22.Box,
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,
5325
5897
  {
5326
5898
  sx: {
5327
5899
  bgcolor: "grey.100",
@@ -5334,8 +5906,8 @@ var ProcedureForm = () => {
5334
5906
  fontSize: "0.75rem",
5335
5907
  whiteSpace: "pre-wrap"
5336
5908
  },
5337
- children: executionLog.map((log, index) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5338
- import_material22.Typography,
5909
+ children: executionLog.map((log, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5910
+ import_material25.Typography,
5339
5911
  {
5340
5912
  component: "pre",
5341
5913
  sx: {
@@ -5357,20 +5929,20 @@ var ProcedureForm_default = ProcedureForm;
5357
5929
 
5358
5930
  // src/App.tsx
5359
5931
  var import_react_redux5 = require("react-redux");
5360
- var import_react39 = require("redux-persist/integration/react");
5932
+ var import_react43 = require("redux-persist/integration/react");
5361
5933
 
5362
5934
  // src/components/PrivateRoute.tsx
5363
- var import_react30 = require("react");
5364
- var import_react_router_dom8 = require("react-router-dom");
5365
- var import_jsx_runtime28 = require("react/jsx-runtime");
5935
+ var import_react33 = require("react");
5936
+ var import_react_router_dom7 = require("react-router-dom");
5937
+ var import_jsx_runtime31 = require("react/jsx-runtime");
5366
5938
  var PrivateRoute = ({ children }) => {
5367
- const location = (0, import_react_router_dom8.useLocation)();
5939
+ const location = (0, import_react_router_dom7.useLocation)();
5368
5940
  const dispatch = useAppDispatch();
5369
5941
  const clientContextStatus = useClientContextStatus();
5370
5942
  const isAuthenticated = clientContextStatus === "succeeded";
5371
5943
  const isLoadingAuth = clientContextStatus === "loading";
5372
5944
  console.log(`[PrivateRoute] Render: Path=${location.pathname}, AuthStatus=${clientContextStatus}, IsAuthenticated=${isAuthenticated}, IsLoadingAuth=${isLoadingAuth}`);
5373
- (0, import_react30.useEffect)(() => {
5945
+ (0, import_react33.useEffect)(() => {
5374
5946
  console.log(`[PrivateRoute] Effect: Path=${location.pathname}, AuthStatus=${clientContextStatus}, IsAuthenticated=${isAuthenticated}, IsLoadingAuth=${isLoadingAuth}`);
5375
5947
  if (!isAuthenticated && !isLoadingAuth && location.pathname !== "/login") {
5376
5948
  const path = location.pathname + location.search + location.hash;
@@ -5386,34 +5958,34 @@ var PrivateRoute = ({ children }) => {
5386
5958
  }, [isAuthenticated, isLoadingAuth, location, dispatch, clientContextStatus]);
5387
5959
  if (isLoadingAuth) {
5388
5960
  console.log(`[PrivateRoute] Returning loading state...`);
5389
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { children: "Verificando autenticaci\xF3n..." });
5961
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { children: "Verificando autenticaci\xF3n..." });
5390
5962
  }
5391
5963
  if (!isAuthenticated) {
5392
5964
  console.log(`[PrivateRoute] User not authenticated, navigating to /login`);
5393
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_router_dom8.Navigate, { to: "/login", replace: true });
5965
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_router_dom7.Navigate, { to: "/login", replace: true });
5394
5966
  }
5395
5967
  console.log(`[PrivateRoute] User authenticated, rendering children.`);
5396
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment, { children });
5968
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children });
5397
5969
  };
5398
5970
  var PrivateRoute_default = PrivateRoute;
5399
5971
 
5400
5972
  // src/components/InitialRedirectHandler.tsx
5401
- var import_react31 = require("react");
5402
- var import_react_router_dom9 = require("react-router-dom");
5973
+ var import_react34 = require("react");
5974
+ var import_react_router_dom8 = require("react-router-dom");
5403
5975
  var InitialRedirectHandler = () => {
5404
- const location = (0, import_react_router_dom9.useLocation)();
5405
- const navigate = (0, import_react_router_dom9.useNavigate)();
5976
+ const location = (0, import_react_router_dom8.useLocation)();
5977
+ const navigate = (0, import_react_router_dom8.useNavigate)();
5406
5978
  const dispatch = useAppDispatch();
5407
5979
  const redirectPath = useRedirectPath();
5408
5980
  const clientContextStatus = useClientContextStatus();
5409
- (0, import_react31.useEffect)(() => {
5981
+ (0, import_react34.useEffect)(() => {
5410
5982
  dispatch(setCurrentPath(location.pathname + location.search));
5411
5983
  }, [location, dispatch]);
5412
- const navegandoRef = (0, import_react31.useRef)(false);
5413
- (0, import_react31.useEffect)(() => {
5984
+ const navegandoRef = (0, import_react34.useRef)(false);
5985
+ (0, import_react34.useEffect)(() => {
5414
5986
  navegandoRef.current = false;
5415
5987
  }, [location.pathname]);
5416
- (0, import_react31.useEffect)(() => {
5988
+ (0, import_react34.useEffect)(() => {
5417
5989
  if (clientContextStatus === "succeeded") {
5418
5990
  if (redirectPath && redirectPath !== "/login") {
5419
5991
  console.log("Redirigiendo a la ruta guardada:", redirectPath);
@@ -5431,35 +6003,40 @@ var InitialRedirectHandler = () => {
5431
6003
  var InitialRedirectHandler_default = InitialRedirectHandler;
5432
6004
 
5433
6005
  // src/pages/GenericDataGridPage.tsx
5434
- var import_react32 = __toESM(require("react"), 1);
5435
- var import_react_router_dom10 = require("react-router-dom");
5436
- var import_material23 = require("@mui/material");
6006
+ var import_react35 = __toESM(require("react"), 1);
6007
+ var import_react_router_dom9 = require("react-router-dom");
6008
+ var import_material26 = require("@mui/material");
5437
6009
  var import_Close2 = __toESM(require("@mui/icons-material/Close"), 1);
5438
- var import_jsx_runtime29 = require("react/jsx-runtime");
6010
+ var import_jsx_runtime32 = require("react/jsx-runtime");
5439
6011
  var GenericDataGridPage = ({
5440
6012
  initialTableName,
5441
- initialFixedFields = []
6013
+ initialFixedFields = [],
6014
+ parametros: parametrosRecibidos
5442
6015
  }) => {
5443
- const { tableName: urlTableName } = (0, import_react_router_dom10.useParams)();
6016
+ const { tableName: urlTableName } = (0, import_react_router_dom9.useParams)();
5444
6017
  const effectiveTableName = initialTableName || urlTableName;
5445
- const [tabs, setTabs] = (0, import_react32.useState)([]);
5446
- const [activeTabIdx, setActiveTabIdx] = (0, import_react32.useState)(0);
6018
+ const [tabs, setTabs] = (0, import_react35.useState)([]);
6019
+ const [activeTabIdx, setActiveTabIdx] = (0, import_react35.useState)(0);
5447
6020
  const ffKey = JSON.stringify(initialFixedFields);
5448
- const location = (0, import_react_router_dom10.useLocation)();
5449
- import_react32.default.useEffect(() => {
6021
+ const location = (0, import_react_router_dom9.useLocation)();
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(() => {
5450
6026
  if (effectiveTableName) {
5451
6027
  setTabs([{
5452
- id: `main-${effectiveTableName}-${ffKey}`,
6028
+ id: `main-${effectiveTableName}-${ffKey}-${parametrosKey}`,
5453
6029
  // ID único que incluye filtros
5454
- label: effectiveTableName.replace(/_/g, " ").toUpperCase(),
6030
+ label: parametros.label ?? effectiveTableName.replace(/_/g, " ").toUpperCase(),
5455
6031
  tableName: effectiveTableName,
5456
- fixedFields: initialFixedFields,
6032
+ fixedFields: fixedFieldsIniciales,
6033
+ parametros,
5457
6034
  ancestors: []
5458
6035
  }]);
5459
6036
  setActiveTabIdx(0);
5460
6037
  }
5461
- }, [effectiveTableName, ffKey, location.key]);
5462
- const handleOpenDetail = (0, import_react32.useCallback)((tableName, fixedFields, label, ancestors) => {
6038
+ }, [effectiveTableName, ffKey, parametrosKey, location.key]);
6039
+ const handleOpenDetail = (0, import_react35.useCallback)((tableName, fixedFields, label, ancestors) => {
5463
6040
  const tabId = `${tableName}-${JSON.stringify(fixedFields)}`;
5464
6041
  setTabs((prevTabs) => {
5465
6042
  const existingTabIdx = prevTabs.findIndex((t) => t.id === tabId);
@@ -5481,30 +6058,34 @@ var GenericDataGridPage = ({
5481
6058
  else if (activeTabIdx === index) setActiveTabIdx(index - 1);
5482
6059
  };
5483
6060
  if (!effectiveTableName) {
5484
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Box, { p: 3, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Alert, { severity: "error", children: "No se especific\xF3 una tabla." }) });
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." }) });
5485
6062
  }
5486
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_material23.Box, { sx: { width: "100%", height: "calc(100vh - 64px)", display: "flex", flexDirection: "column" }, children: [
5487
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Box, { sx: { borderBottom: 1, borderColor: "divider", bgcolor: "background.paper" }, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Tabs, { value: activeTabIdx, onChange: (_, v) => setActiveTabIdx(v), variant: "scrollable", children: tabs.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5488
- import_material23.Tab,
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,
5489
6066
  {
5490
- label: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_material23.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
5491
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Typography, { variant: "caption", sx: { fontWeight: "bold" }, children: tab.label }),
5492
- index !== 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.IconButton, { size: "small", onClick: (e) => handleCloseTab(index, e), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_Close2.default, { fontSize: "inherit" }) })
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" }) })
5493
6070
  ] })
5494
6071
  },
5495
6072
  tab.id
5496
6073
  )) }) }),
5497
- tabs.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5498
- import_material23.Box,
6074
+ tabs.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6075
+ import_material26.Box,
5499
6076
  {
5500
6077
  role: "tabpanel",
5501
6078
  hidden: activeTabIdx !== index,
5502
6079
  sx: { flexGrow: 1, display: activeTabIdx === index ? "flex" : "none", flexDirection: "column", overflow: "hidden" },
5503
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
6080
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5504
6081
  GenericDataGrid_default,
5505
6082
  {
5506
6083
  tableName: tab.tableName,
5507
6084
  fixedFields: tab.fixedFields,
6085
+ filterColumns: tab.parametros?.filterColumns,
6086
+ tableDef: tab.parametros?.tableDef,
6087
+ parameterFunctions: tab.parametros?.parameterFunctions,
6088
+ pick: tab.parametros?.pick,
5508
6089
  onOpenDetail: handleOpenDetail,
5509
6090
  ancestors: tab.ancestors
5510
6091
  }
@@ -5517,32 +6098,26 @@ var GenericDataGridPage = ({
5517
6098
  var GenericDataGridPage_default = GenericDataGridPage;
5518
6099
 
5519
6100
  // src/pages/PantallaDeRuta.tsx
5520
- var import_react33 = require("react");
5521
- var import_react_router_dom11 = require("react-router-dom");
5522
- var import_material24 = require("@mui/material");
5523
- var import_jsx_runtime30 = require("react/jsx-runtime");
6101
+ var import_react36 = require("react");
6102
+ var import_react_router_dom10 = require("react-router-dom");
6103
+ var import_material27 = require("@mui/material");
6104
+ var import_jsx_runtime33 = require("react/jsx-runtime");
5524
6105
  var PantallaDeRuta = ({ screenName }) => {
5525
- const [busqueda] = (0, import_react_router_dom11.useSearchParams)();
5526
- const params = (0, import_react33.useMemo)(() => Object.fromEntries(busqueda.entries()), [busqueda]);
6106
+ const [busqueda] = (0, import_react_router_dom10.useSearchParams)();
6107
+ const params = (0, import_react36.useMemo)(() => Object.fromEntries(busqueda.entries()), [busqueda]);
5527
6108
  const Pantalla = wScreens[screenName];
5528
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material24.Box, { sx: { pt: 3, pl: 4 }, children: Pantalla ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Pantalla, { screenName, params }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FallbackWScreen, { screenName }) });
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 }) });
5529
6110
  };
5530
6111
 
5531
6112
  // src/pages/MenuTablePage.tsx
5532
- var import_react34 = require("react");
5533
- var import_react_router_dom12 = require("react-router-dom");
5534
- var import_material25 = require("@mui/material");
5535
- var import_jsx_runtime31 = require("react/jsx-runtime");
5536
- function fixedFieldsDeMenu(ff) {
5537
- if (!ff) return [];
5538
- if (Array.isArray(ff)) {
5539
- return ff.map(({ fieldName, value }) => ({ fieldName, value }));
5540
- }
5541
- return Object.entries(ff).map(([fieldName, value]) => ({ fieldName, value }));
5542
- }
6113
+ var import_react37 = require("react");
6114
+ var import_react_router_dom11 = require("react-router-dom");
6115
+ var import_material28 = require("@mui/material");
6116
+ var import_jsx_runtime34 = require("react/jsx-runtime");
5543
6117
  var MenuTablePage = () => {
5544
- const { menuName } = (0, import_react_router_dom12.useParams)();
6118
+ const { menuName } = (0, import_react_router_dom11.useParams)();
5545
6119
  const { clientContext } = useApp();
6120
+ const { search } = (0, import_react_router_dom11.useLocation)();
5546
6121
  const findMenuItem = (items, nameToFind) => {
5547
6122
  for (const item of items) {
5548
6123
  if (item.name === nameToFind && item.menuType === "table") {
@@ -5555,51 +6130,55 @@ var MenuTablePage = () => {
5555
6130
  }
5556
6131
  return void 0;
5557
6132
  };
5558
- const { currentTableName, currentFixedFields } = (0, import_react34.useMemo)(() => {
6133
+ const { currentTableName, currentFixedFields, parametros } = (0, import_react37.useMemo)(() => {
5559
6134
  let tableName = void 0;
5560
6135
  let fixedFields = [];
6136
+ let parametros2 = {};
5561
6137
  if (menuName && clientContext && clientContext.menu) {
5562
6138
  const menuItem = findMenuItem(clientContext.menu, menuName);
5563
6139
  if (menuItem) {
5564
6140
  tableName = menuItem.table || menuItem.name;
5565
- fixedFields = fixedFieldsDeMenu(menuItem.ff);
6141
+ parametros2 = parametrosDeTabla(menuItem, search);
6142
+ fixedFields = parametros2.fixedFields ?? [];
5566
6143
  } else {
5567
6144
  console.warn(`[${menuName}] \xCDtem de men\xFA '${menuName}' no encontrado o no es de tipo 'table' en clientContext.menu.`);
5568
6145
  }
5569
6146
  }
5570
6147
  return {
5571
6148
  currentTableName: tableName,
5572
- currentFixedFields: fixedFields
6149
+ currentFixedFields: fixedFields,
6150
+ parametros: parametros2
5573
6151
  };
5574
- }, [menuName, clientContext]);
6152
+ }, [menuName, clientContext, search]);
5575
6153
  if (!currentTableName) {
5576
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_material25.Alert, { severity: "error", children: [
5577
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Typography, { variant: "h6", children: "Error: No se pudo cargar la informaci\xF3n de la tabla." }),
5578
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Typography, { variant: "body1", children: "Verifique la configuraci\xF3n del men\xFA o el nombre de la tabla en la URL." })
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." })
5579
6157
  ] }) });
5580
6158
  }
5581
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6159
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
5582
6160
  GenericDataGridPage_default,
5583
6161
  {
5584
6162
  initialTableName: currentTableName,
5585
- initialFixedFields: currentFixedFields
6163
+ initialFixedFields: currentFixedFields,
6164
+ parametros
5586
6165
  }
5587
6166
  );
5588
6167
  };
5589
6168
  var MenuTablePage_default = MenuTablePage;
5590
6169
 
5591
6170
  // src/puente/PantallaBP.tsx
5592
- var import_react36 = require("react");
5593
- var import_react_router_dom13 = require("react-router-dom");
5594
- var import_material27 = require("@mui/material");
6171
+ var import_react39 = require("react");
6172
+ var import_react_router_dom12 = require("react-router-dom");
6173
+ var import_material30 = require("@mui/material");
5595
6174
 
5596
6175
  // src/puente/clienteBP.ts
5597
6176
  function extraerRecursos(html) {
5598
6177
  const documento = new DOMParser().parseFromString(html, "text/html");
5599
- const referencias = (selector, atributo) => Array.from(documento.querySelectorAll(selector)).map((elemento) => elemento.getAttribute(atributo)).filter((ruta) => !!ruta);
6178
+ const referencias2 = (selector, atributo) => Array.from(documento.querySelectorAll(selector)).map((elemento) => elemento.getAttribute(atributo)).filter((ruta) => !!ruta);
5600
6179
  return {
5601
- hojasDeEstilo: referencias("link[rel=stylesheet]", "href"),
5602
- scripts: referencias("script[src]", "src")
6180
+ hojasDeEstilo: referencias2("link[rel=stylesheet]", "href"),
6181
+ scripts: referencias2("script[src]", "src")
5603
6182
  };
5604
6183
  }
5605
6184
  function fijarBase(urlBackend) {
@@ -5625,6 +6204,24 @@ function esperarCargaDeVentana() {
5625
6204
  if (document.readyState === "complete") return Promise.resolve();
5626
6205
  return new Promise((resolver) => window.addEventListener("load", () => resolver(), { once: true }));
5627
6206
  }
6207
+ async function sinEscuchasDeVentana(tipos, inyectar) {
6208
+ const original = window.addEventListener;
6209
+ const filtrada = function(tipo, escucha, opciones) {
6210
+ if (tipos.includes(tipo)) return;
6211
+ original.call(this, tipo, escucha, opciones);
6212
+ };
6213
+ window.addEventListener = filtrada;
6214
+ try {
6215
+ return await inyectar();
6216
+ } finally {
6217
+ if (window.addEventListener === filtrada) window.addEventListener = original;
6218
+ }
6219
+ }
6220
+ async function cargarScripts(rutas) {
6221
+ for (const ruta of rutas) {
6222
+ await cargarScript(ruta);
6223
+ }
6224
+ }
5628
6225
  var carga = null;
5629
6226
  function cargarClienteBP(urlBackend) {
5630
6227
  if (!carga) {
@@ -5653,9 +6250,7 @@ async function cargarSinMemoria(urlBackend) {
5653
6250
  document.head.appendChild(enlace);
5654
6251
  });
5655
6252
  await esperarCargaDeVentana();
5656
- for (const ruta of recursos.scripts) {
5657
- await cargarScript(ruta);
5658
- }
6253
+ await sinEscuchasDeVentana(["popstate"], () => cargarScripts(recursos.scripts));
5659
6254
  const myOwn = window.myOwn;
5660
6255
  if (!myOwn) throw new Error("El backend no defini\xF3 myOwn.");
5661
6256
  window.my = myOwn;
@@ -5664,9 +6259,9 @@ async function cargarSinMemoria(urlBackend) {
5664
6259
  }
5665
6260
 
5666
6261
  // src/puente/ConsolaBP.tsx
5667
- var import_react35 = require("react");
5668
- var import_material26 = require("@mui/material");
5669
- var import_jsx_runtime32 = require("react/jsx-runtime");
6262
+ var import_react38 = require("react");
6263
+ var import_material29 = require("@mui/material");
6264
+ var import_jsx_runtime35 = require("react/jsx-runtime");
5670
6265
  var MARGEN_DE_REPETIDO_MS = 1e3;
5671
6266
  function descartarRepetidos(consola, agregados, ahora) {
5672
6267
  for (const nodo of agregados) {
@@ -5679,7 +6274,7 @@ function descartarRepetidos(consola, agregados, ahora) {
5679
6274
  }
5680
6275
  }
5681
6276
  var ConsolaBP = () => {
5682
- (0, import_react35.useEffect)(() => {
6277
+ (0, import_react38.useEffect)(() => {
5683
6278
  const consola = document.getElementById("mini-console");
5684
6279
  if (!consola) return;
5685
6280
  const observador = new MutationObserver(
@@ -5688,8 +6283,8 @@ var ConsolaBP = () => {
5688
6283
  observador.observe(consola, { childList: true });
5689
6284
  return () => observador.disconnect();
5690
6285
  }, []);
5691
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5692
- import_material26.Box,
6286
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6287
+ import_material29.Box,
5693
6288
  {
5694
6289
  id: "mini-console",
5695
6290
  sx: (tema) => ({
@@ -5777,47 +6372,6 @@ function resolverPantallaBP(myOwn, nombre, contenedor) {
5777
6372
  return null;
5778
6373
  }
5779
6374
 
5780
- // src/puente/capturaDeNavegacion.ts
5781
- function apiDeNavegacion() {
5782
- const api = Reflect.get(window, "navigation");
5783
- return typeof api === "object" && api !== null && "addEventListener" in api && typeof api.addEventListener === "function" ? api : null;
5784
- }
5785
- function capturarNavegacionBP(urlBackend, navegar) {
5786
- const alHacerClick = (evento) => {
5787
- if (evento.defaultPrevented || evento.button !== 0 || evento.ctrlKey || evento.metaKey || evento.shiftKey) return;
5788
- const enlace = evento.target instanceof Element ? evento.target.closest("a[href]") : null;
5789
- if (!enlace || enlace.hasAttribute("download") || (enlace.getAttribute("target") ?? "_self") !== "_self") return;
5790
- const ruta = rutaDeEnlaceBP(enlace.getAttribute("href") ?? "", document.baseURI, urlBackend);
5791
- if (ruta) {
5792
- evento.preventDefault();
5793
- evento.stopPropagation();
5794
- navegar(ruta);
5795
- }
5796
- };
5797
- document.addEventListener("click", alHacerClick, true);
5798
- const navegacion = apiDeNavegacion();
5799
- const alNavegar = (evento) => {
5800
- if (!evento.cancelable || evento.destination.sameDocument || evento.downloadRequest !== null) return;
5801
- const ruta = rutaDeEnlaceBP(evento.destination.url, document.baseURI, urlBackend);
5802
- if (ruta) {
5803
- evento.preventDefault();
5804
- navegar(ruta);
5805
- }
5806
- };
5807
- navegacion?.addEventListener("navigate", alNavegar);
5808
- const reemplazarOriginal = history.replaceState;
5809
- const reemplazar = (estado, titulo, url) => {
5810
- const ruta = url === void 0 || url === null ? null : rutaDeEnlaceBP(String(url), document.baseURI, urlBackend);
5811
- reemplazarOriginal.call(history, estado, titulo, ruta === null ? url : rutaBase + ruta);
5812
- };
5813
- history.replaceState = reemplazar;
5814
- return () => {
5815
- if (history.replaceState === reemplazar) history.replaceState = reemplazarOriginal;
5816
- document.removeEventListener("click", alHacerClick, true);
5817
- navegacion?.removeEventListener("navigate", alNavegar);
5818
- };
5819
- }
5820
-
5821
6375
  // src/puente/habilitacion.ts
5822
6376
  var habilitado = false;
5823
6377
  var habilitarPuenteBP = () => {
@@ -5826,7 +6380,7 @@ var habilitarPuenteBP = () => {
5826
6380
  var puenteBPHabilitado = () => habilitado;
5827
6381
 
5828
6382
  // src/puente/PantallaBP.tsx
5829
- var import_jsx_runtime33 = require("react/jsx-runtime");
6383
+ var import_jsx_runtime36 = require("react/jsx-runtime");
5830
6384
  function buscarItemDeMenu(items, tipo) {
5831
6385
  for (const item of items) {
5832
6386
  if (item.menuType === tipo) return item;
@@ -5838,21 +6392,19 @@ function buscarItemDeMenu(items, tipo) {
5838
6392
  return void 0;
5839
6393
  }
5840
6394
  var PantallaBP = ({ nombre, direccion }) => {
5841
- const navigate = (0, import_react_router_dom13.useNavigate)();
5842
6395
  const { clientContext } = useApp();
5843
- const [cargando, setCargando] = (0, import_react36.useState)(true);
5844
- const [error, setError] = (0, import_react36.useState)(null);
5845
- const [noExiste, setNoExiste] = (0, import_react36.useState)(false);
5846
- const contenedor = (0, import_react36.useRef)(null);
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);
5847
6400
  const menu = clientContext.menu;
5848
- (0, import_react36.useEffect)(() => {
6401
+ (0, import_react39.useEffect)(() => {
5849
6402
  const elemento = contenedor.current;
5850
6403
  if (!elemento) return;
5851
6404
  let vigente = true;
5852
6405
  setError(null);
5853
6406
  setNoExiste(false);
5854
6407
  setCargando(true);
5855
- const dejarDeCapturar = capturarNavegacionBP(envConfig.backendUrl, navigate);
5856
6408
  cargarClienteBP(envConfig.backendUrl).then((myOwn) => {
5857
6409
  if (!vigente) return;
5858
6410
  setCargando(false);
@@ -5874,56 +6426,55 @@ var PantallaBP = ({ nombre, direccion }) => {
5874
6426
  });
5875
6427
  return () => {
5876
6428
  vigente = false;
5877
- dejarDeCapturar();
5878
6429
  elemento.replaceChildren();
5879
6430
  };
5880
- }, [nombre, direccion, menu, navigate]);
5881
- if (noExiste) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FallbackWScreen, { screenName: nombre });
6431
+ }, [nombre, direccion, menu]);
6432
+ if (noExiste) return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(FallbackWScreen, { screenName: nombre });
5882
6433
  return (
5883
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
5884
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_material27.Box, { sx: { position: "relative" }, children: [
5885
- cargando && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material27.CircularProgress, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
5886
- error && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material27.Alert, { severity: "error", sx: { m: 2 }, children: error }),
5887
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { id: "main_layout", ref: contenedor }),
5888
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ConsolaBP, {})
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, {})
5889
6440
  ] })
5890
6441
  );
5891
6442
  };
5892
6443
  var PantallaDeRespaldo = () => {
5893
- const { screenName = "" } = (0, import_react_router_dom13.useParams)();
5894
- const { search } = (0, import_react_router_dom13.useLocation)();
6444
+ const { screenName = "" } = (0, import_react_router_dom12.useParams)();
6445
+ const { search } = (0, import_react_router_dom12.useLocation)();
5895
6446
  if (!puenteBPHabilitado()) {
5896
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material27.Box, { sx: { p: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FallbackWScreen, { screenName }) });
6447
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_material30.Box, { sx: { p: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(FallbackWScreen, { screenName }) });
5897
6448
  }
5898
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_router_dom13.Navigate, { to: rutaDePantallaBP(screenName, search), replace: true });
6449
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_router_dom12.Navigate, { to: rutaDePantallaBP(screenName, search), replace: true });
5899
6450
  };
5900
6451
  var PaginaBP = () => {
5901
- const { hash, search } = (0, import_react_router_dom13.useLocation)();
6452
+ const { hash, search } = (0, import_react_router_dom12.useLocation)();
5902
6453
  const direccion = hash || search;
5903
6454
  const nombre = new URLSearchParams(direccion.replace(/^[#?]/, "")).get("w");
5904
- if (!puenteBPHabilitado()) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_router_dom13.Navigate, { to: "/", replace: true });
5905
- if (!nombre) return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material27.Box, { sx: { p: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_material27.Alert, { severity: "warning", children: [
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: [
5906
6457
  "Falta la pantalla de backend-plus (",
5907
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("code", { children: "#w=..." }),
6458
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("code", { children: "#w=..." }),
5908
6459
  ")."
5909
6460
  ] }) });
5910
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PantallaBP, { nombre, direccion }, nombre);
6461
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PantallaBP, { nombre, direccion }, nombre);
5911
6462
  };
5912
6463
 
5913
6464
  // src/puente/GrillaBP.tsx
5914
- var import_react37 = require("react");
5915
- var import_react_router_dom14 = require("react-router-dom");
5916
- var import_material28 = require("@mui/material");
5917
- var import_jsx_runtime34 = (
6465
+ var import_react40 = require("react");
6466
+ var import_react_router_dom13 = require("react-router-dom");
6467
+ var import_material31 = require("@mui/material");
6468
+ var import_jsx_runtime37 = (
5918
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
5919
6470
  require("react/jsx-runtime")
5920
6471
  );
5921
6472
  var GrillaBP = ({ tabla, fixedFields }) => {
5922
- const contenedor = (0, import_react37.useRef)(null);
5923
- const [cargando, setCargando] = (0, import_react37.useState)(true);
5924
- const [error, setError] = (0, import_react37.useState)(null);
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);
5925
6476
  const clave = JSON.stringify(fixedFields ?? []);
5926
- (0, import_react37.useEffect)(() => {
6477
+ (0, import_react40.useEffect)(() => {
5927
6478
  const elemento = contenedor.current;
5928
6479
  if (!elemento) return;
5929
6480
  let vigente = true;
@@ -5944,68 +6495,121 @@ var GrillaBP = ({ tabla, fixedFields }) => {
5944
6495
  elemento.replaceChildren();
5945
6496
  };
5946
6497
  }, [tabla, clave]);
5947
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_material28.Box, { sx: { position: "relative" }, children: [
5948
- cargando && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material28.CircularProgress, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
5949
- error && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material28.Alert, { severity: "error", sx: { m: 2 }, children: error }),
5950
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { ref: contenedor }),
5951
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ConsolaBP, {})
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, {})
5952
6503
  ] });
5953
6504
  };
5954
6505
  var PaginaGrillaBP = () => {
5955
- const { tableName = "" } = (0, import_react_router_dom14.useParams)();
5956
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(GrillaBP, { tabla: tableName }, tableName);
6506
+ const { tableName = "" } = (0, import_react_router_dom13.useParams)();
6507
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(GrillaBP, { tabla: tableName }, tableName);
6508
+ };
6509
+
6510
+ // src/puente/CapturaBP.tsx
6511
+ var import_react41 = require("react");
6512
+ var import_react_router_dom14 = require("react-router-dom");
6513
+
6514
+ // src/puente/capturaDeNavegacion.ts
6515
+ function apiDeNavegacion() {
6516
+ const api = Reflect.get(window, "navigation");
6517
+ return typeof api === "object" && api !== null && "addEventListener" in api && typeof api.addEventListener === "function" ? api : null;
6518
+ }
6519
+ function capturarNavegacionBP(urlBackend, navegar) {
6520
+ const alHacerClick = (evento) => {
6521
+ if (evento.defaultPrevented || evento.button !== 0 || evento.ctrlKey || evento.metaKey || evento.shiftKey) return;
6522
+ const enlace = evento.target instanceof Element ? evento.target.closest("a[href]") : null;
6523
+ if (!enlace || enlace.hasAttribute("download") || (enlace.getAttribute("target") ?? "_self") !== "_self") return;
6524
+ const ruta = rutaDeEnlaceBP(enlace.getAttribute("href") ?? "", document.baseURI, urlBackend);
6525
+ if (ruta) {
6526
+ evento.preventDefault();
6527
+ evento.stopPropagation();
6528
+ navegar(ruta);
6529
+ }
6530
+ };
6531
+ document.addEventListener("click", alHacerClick, true);
6532
+ const navegacion = apiDeNavegacion();
6533
+ const alNavegar = (evento) => {
6534
+ if (!evento.cancelable || evento.destination.sameDocument || evento.downloadRequest !== null) return;
6535
+ const ruta = rutaDeEnlaceBP(evento.destination.url, document.baseURI, urlBackend);
6536
+ if (ruta) {
6537
+ evento.preventDefault();
6538
+ navegar(ruta);
6539
+ }
6540
+ };
6541
+ navegacion?.addEventListener("navigate", alNavegar);
6542
+ const reemplazarOriginal = history.replaceState;
6543
+ const reemplazar = (estado, titulo, url) => {
6544
+ const ruta = url === void 0 || url === null ? null : rutaDeEnlaceBP(String(url), document.baseURI, urlBackend);
6545
+ reemplazarOriginal.call(history, estado, titulo, ruta === null ? url : rutaBase + ruta);
6546
+ };
6547
+ history.replaceState = reemplazar;
6548
+ return () => {
6549
+ if (history.replaceState === reemplazar) history.replaceState = reemplazarOriginal;
6550
+ document.removeEventListener("click", alHacerClick, true);
6551
+ navegacion?.removeEventListener("navigate", alNavegar);
6552
+ };
6553
+ }
6554
+
6555
+ // src/puente/CapturaBP.tsx
6556
+ var CapturaBP = () => {
6557
+ const navigate = (0, import_react_router_dom14.useNavigate)();
6558
+ (0, import_react41.useEffect)(() => capturarNavegacionBP(envConfig.backendUrl, navigate), [navigate]);
6559
+ return null;
5957
6560
  };
5958
6561
 
5959
6562
  // src/App.tsx
5960
6563
  var import_type_store6 = __toESM(require("type-store"), 1);
5961
- var import_jsx_runtime35 = require("react/jsx-runtime");
6564
+ var import_jsx_runtime38 = require("react/jsx-runtime");
5962
6565
  var LocationTracker = () => {
5963
6566
  const location = (0, import_react_router_dom15.useLocation)();
5964
6567
  const dispatch = useAppDispatch();
5965
- (0, import_react38.useEffect)(() => {
6568
+ (0, import_react42.useEffect)(() => {
5966
6569
  dispatch(setCurrentPath(location.pathname + location.search));
5967
6570
  }, [location, dispatch]);
5968
6571
  return null;
5969
6572
  };
5970
6573
  function FrontendPlusReactRoutes({ myRoutes, myUnloggedRoutes, layout: Layout = MainLayout_default, unloggedLayout: UnloggedLayout }) {
5971
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
5972
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(InitialRedirectHandler_default, {}),
5973
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react_router_dom15.Routes, { children: [
5974
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react_router_dom15.Route, { element: UnloggedLayout ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(UnloggedLayout, {}) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Outlet, {}), children: [
5975
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Route, { path: "/login", element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(LoginPage_default, {}) }),
5976
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Route, { path: "/logout", element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(LogoutPage_default, {}) }),
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, {}) }),
5977
6581
  myUnloggedRoutes
5978
6582
  ] }),
5979
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react_router_dom15.Route, { element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PrivateRoute_default, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Layout, {}) }), children: [
5980
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Route, { path: "/", element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PantallaInicial_default, {}) }),
5981
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Route, { path: "/table/:tableName", element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(GenericDataGridPage_default, {}) }),
5982
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Route, { path: "/menu/:menuName", element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(MenuTablePage_default, {}) }),
5983
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Route, { path: "/procedures/:procedureName", element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ProcedureForm_default, {}) }),
5984
- Object.keys(wScreens).map((screenName) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
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)(
5985
6589
  import_react_router_dom15.Route,
5986
6590
  {
5987
6591
  path: `/wScreens/${screenName}`,
5988
- element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PantallaDeRuta, { screenName })
6592
+ element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PantallaDeRuta, { screenName })
5989
6593
  },
5990
6594
  screenName
5991
6595
  )),
5992
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Route, { path: "/wScreens-fallback/:screenName", element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PantallaDeRespaldo, {}) }),
5993
- puenteBPHabilitado() && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Route, { path: "/bp/menu", element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PaginaBP, {}) }),
5994
- puenteBPHabilitado() && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Route, { path: "/bp/table/:tableName", element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PaginaGrillaBP, {}) }),
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, {}) }),
5995
6599
  myRoutes,
5996
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Route, { path: "*", element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { style: { marginTop: "20px", marginLeft: "10px" }, children: "404 - Recurso No Encontrado" }) })
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" }) })
5997
6601
  ] }),
5998
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Route, { path: "*", element: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_router_dom15.Navigate, { to: "/", replace: true }) })
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 }) })
5999
6603
  ] })
6000
6604
  ] });
6001
6605
  }
6002
6606
  var FrontendPlusProviders = ({ children, publicPaths }) => {
6003
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_redux5.Provider, { store, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react39.PersistGate, { loading: null, persistor, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react_router_dom15.BrowserRouter, { basename: rutaBase, children: [
6004
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(LocationTracker, {}),
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, {}),
6005
6609
  " ",
6006
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(AppProvider, { publicPaths, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(SnackbarProvider, { children: [
6610
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(AppProvider, { publicPaths, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(SnackbarProvider, { children: [
6007
6611
  children,
6008
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SessionExpiredMessage_default, {})
6612
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SessionExpiredMessage_default, {})
6009
6613
  ] }) })
6010
6614
  ] }) }) });
6011
6615
  };
@@ -6019,7 +6623,7 @@ var App = ({
6019
6623
  myConditions,
6020
6624
  puenteBP
6021
6625
  }) => {
6022
- (0, import_react38.useMemo)(() => {
6626
+ (0, import_react42.useMemo)(() => {
6023
6627
  if (myClientSides) {
6024
6628
  extendClientSides(myClientSides);
6025
6629
  }
@@ -6036,7 +6640,7 @@ var App = ({
6036
6640
  habilitarPuenteBP();
6037
6641
  }
6038
6642
  }, [myClientSides, myResultsOk, myWScreens, myConditions, puenteBP]);
6039
- (0, import_react38.useEffect)(() => {
6643
+ (0, import_react42.useEffect)(() => {
6040
6644
  import_type_store6.default.messages = import_type_store6.default.i18n.messages.es;
6041
6645
  import_type_store6.default.locale = import_type_store6.default.i18n.locale.es;
6042
6646
  const link = document.querySelector("link[rel*='icon']") || document.createElement("link");
@@ -6045,11 +6649,11 @@ var App = ({
6045
6649
  link.href = `${envConfig.backendUrl}/img/logo-128.png`;
6046
6650
  document.getElementsByTagName("head")[0].appendChild(link);
6047
6651
  }, []);
6048
- const safePaths = import_react38.default.useMemo(() => {
6652
+ const safePaths = import_react42.default.useMemo(() => {
6049
6653
  const extracted = extractPathsFromRoutes(myUnloggedRoutes);
6050
6654
  return ["/login", "/logout", ...extracted];
6051
6655
  }, [myUnloggedRoutes]);
6052
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(FrontendPlusProviders, { publicPaths: safePaths, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6656
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(FrontendPlusProviders, { publicPaths: safePaths, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6053
6657
  FrontendPlusReactRoutes,
6054
6658
  {
6055
6659
  myRoutes,