frontend-plus-react 0.4.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +27 -0
- package/README.md +8 -0
- package/dist/index.cjs +1356 -734
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -2
- package/dist/index.d.ts +21 -2
- package/dist/index.js +1320 -698
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -59,7 +59,7 @@ __export(src_exports, {
|
|
|
59
59
|
module.exports = __toCommonJS(src_exports);
|
|
60
60
|
|
|
61
61
|
// src/components/grid/GenericDataGrid.tsx
|
|
62
|
-
var
|
|
62
|
+
var import_react26 = require("react");
|
|
63
63
|
var import_react_data_grid = require("react-data-grid");
|
|
64
64
|
var import_styles = require("react-data-grid/lib/styles.css");
|
|
65
65
|
|
|
@@ -378,7 +378,7 @@ var useApiCallWithoutSnackbar = () => {
|
|
|
378
378
|
};
|
|
379
379
|
|
|
380
380
|
// src/components/grid/GenericDataGrid.tsx
|
|
381
|
-
var
|
|
381
|
+
var import_material18 = require("@mui/material");
|
|
382
382
|
|
|
383
383
|
// src/store/index.ts
|
|
384
384
|
var import_toolkit4 = require("@reduxjs/toolkit");
|
|
@@ -1089,6 +1089,16 @@ var getBestTypedValue = (valor, typer) => {
|
|
|
1089
1089
|
}
|
|
1090
1090
|
return BestControls.text.getTypedValue(value, typer);
|
|
1091
1091
|
};
|
|
1092
|
+
var tiparEntrada = (valor, typer) => {
|
|
1093
|
+
const entrada = typeof valor === "string" && valor.trim() === "" && typer.typeName !== "text" ? "" : valor;
|
|
1094
|
+
const tipado = getBestTypedValue(entrada, typer);
|
|
1095
|
+
if (tipado === null && typeof entrada === "string" && entrada !== "") {
|
|
1096
|
+
throw new Error(`\xAB${valor}\xBB no es un valor v\xE1lido para este campo (${typer.typeName})`);
|
|
1097
|
+
}
|
|
1098
|
+
return tipado;
|
|
1099
|
+
};
|
|
1100
|
+
var caracterRechazado = (caracter, typer) => caracter.length === 1 && typer.rejectedChar(caracter);
|
|
1101
|
+
var textoPegadoRechazado = (texto, typer) => Array.from(texto).some((caracter) => typer.rejectedChar(caracter));
|
|
1092
1102
|
|
|
1093
1103
|
// src/hooks/grid/useGridDataView.ts
|
|
1094
1104
|
var MAXIMO_FILAS_EDICION_PUNTUAL = 3;
|
|
@@ -1130,6 +1140,22 @@ var useGridDataView = ({ tableData, tableDefinition }) => {
|
|
|
1130
1140
|
return !prev;
|
|
1131
1141
|
});
|
|
1132
1142
|
}, []);
|
|
1143
|
+
const aplicarFiltrosIniciales = (0, import_react6.useCallback)((condiciones2, definicion) => {
|
|
1144
|
+
const iniciales = {};
|
|
1145
|
+
condiciones2.forEach(({ column, operator, value }) => {
|
|
1146
|
+
const fieldDef = definicion.fields.find((f) => f.name === column);
|
|
1147
|
+
let texto = value === null || value === void 0 ? "" : String(value);
|
|
1148
|
+
if (fieldDef && value !== null && value !== void 0) {
|
|
1149
|
+
try {
|
|
1150
|
+
texto = import_type_store2.default.typerFrom(fieldDef).toLocalString(value);
|
|
1151
|
+
} catch (e) {
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
iniciales[column] = { operator, value: texto };
|
|
1155
|
+
});
|
|
1156
|
+
setFilters(iniciales);
|
|
1157
|
+
setIsFilterRowVisible(true);
|
|
1158
|
+
}, []);
|
|
1133
1159
|
const vistaAnteriorRef = (0, import_react6.useRef)(null);
|
|
1134
1160
|
const filteredRows = (0, import_react6.useMemo)(() => {
|
|
1135
1161
|
const anterior = vistaAnteriorRef.current;
|
|
@@ -1287,6 +1313,7 @@ var useGridDataView = ({ tableData, tableDefinition }) => {
|
|
|
1287
1313
|
setFilters,
|
|
1288
1314
|
isFilterRowVisible,
|
|
1289
1315
|
toggleFilterVisibility,
|
|
1316
|
+
aplicarFiltrosIniciales,
|
|
1290
1317
|
// Data
|
|
1291
1318
|
filteredRows,
|
|
1292
1319
|
summaryData,
|
|
@@ -1436,10 +1463,155 @@ function CeldaDetalle({ fila }) {
|
|
|
1436
1463
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: renderDetalle(fila) });
|
|
1437
1464
|
}
|
|
1438
1465
|
|
|
1466
|
+
// src/hooks/grid/teclasDeCelda.ts
|
|
1467
|
+
function direccionDeSalida(tecla, cursor, teclaAnterior) {
|
|
1468
|
+
if (tecla.ctrlKey || tecla.altKey || tecla.metaKey) return null;
|
|
1469
|
+
const conShift = !!tecla.shiftKey;
|
|
1470
|
+
switch (tecla.key) {
|
|
1471
|
+
case "Enter":
|
|
1472
|
+
return conShift ? null : "siguiente";
|
|
1473
|
+
case "Tab":
|
|
1474
|
+
return conShift ? "anterior" : "siguiente";
|
|
1475
|
+
case "ArrowUp":
|
|
1476
|
+
return conShift ? null : "arriba";
|
|
1477
|
+
case "ArrowDown":
|
|
1478
|
+
return conShift ? null : "abajo";
|
|
1479
|
+
case "ArrowLeft":
|
|
1480
|
+
return !conShift && (cursor.vacio || cursor.alPrincipio) ? "izquierda" : null;
|
|
1481
|
+
case "ArrowRight":
|
|
1482
|
+
return !conShift && (cursor.vacio || teclaAnterior === "ArrowRight" && cursor.alFinal) ? "derecha" : null;
|
|
1483
|
+
default:
|
|
1484
|
+
return null;
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
function posicionDelCursor(elemento) {
|
|
1488
|
+
if (elemento instanceof HTMLInputElement || elemento instanceof HTMLTextAreaElement) {
|
|
1489
|
+
const fin = elemento.selectionEnd ?? elemento.value.length;
|
|
1490
|
+
return { vacio: elemento.value === "", alPrincipio: fin === 0, alFinal: fin === elemento.value.length };
|
|
1491
|
+
}
|
|
1492
|
+
return { vacio: true, alPrincipio: true, alFinal: true };
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
// src/utils/fixedFields.ts
|
|
1496
|
+
function fijaElValor(fixedField) {
|
|
1497
|
+
return !fixedField.range && fixedField.until === void 0;
|
|
1498
|
+
}
|
|
1499
|
+
function valorFijoDe(fixedFields, columna) {
|
|
1500
|
+
return fixedFields?.find((f) => f.fieldName === columna && fijaElValor(f));
|
|
1501
|
+
}
|
|
1502
|
+
function columnaOcultaPorFixedField(fixedFields, columna) {
|
|
1503
|
+
const fijo = valorFijoDe(fixedFields, columna);
|
|
1504
|
+
return fijo !== void 0 && !fijo.show;
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
// src/utils/referencias.ts
|
|
1508
|
+
var esParDeCampos = (par) => typeof par === "object" && par !== null && "source" in par && "target" in par && typeof par.source === "string" && typeof par.target === "string";
|
|
1509
|
+
var esCampoConReferencia = (campo) => typeof campo.references === "string" && campo.references !== "" && (!("referencesFields" in campo) || campo.referencesFields === void 0 || Array.isArray(campo.referencesFields) && campo.referencesFields.every(esParDeCampos)) && !("skipReferenceLookup" in campo && campo.skipReferenceLookup);
|
|
1510
|
+
var camposDeNombre = (definicion) => {
|
|
1511
|
+
const comoTextos = (campos) => Array.isArray(campos) ? campos.filter((c) => typeof c === "string") : [];
|
|
1512
|
+
if (definicion.lookupFields && definicion.lookupFields.length > 0) return definicion.lookupFields;
|
|
1513
|
+
return "nameFields" in definicion ? comoTextos(definicion.nameFields) : [];
|
|
1514
|
+
};
|
|
1515
|
+
var campoDeActivo = (definicion) => "activeRecords" in definicion && typeof definicion.activeRecords === "object" && definicion.activeRecords !== null && "fieldName" in definicion.activeRecords && typeof definicion.activeRecords.fieldName === "string" ? definicion.activeRecords.fieldName : null;
|
|
1516
|
+
var comoTexto = (valor) => valor === null || valor === void 0 ? "" : String(valor);
|
|
1517
|
+
var opcionesDeReferencia = (campo, definicionReferenciada, filasReferenciadas, filaActual, admiteNulo) => {
|
|
1518
|
+
const pares = campo.referencesFields ?? [];
|
|
1519
|
+
const columnaDelValor = pares.length > 0 ? pares[pares.length - 1].target : definicionReferenciada.primaryKey[definicionReferenciada.primaryKey.length - 1];
|
|
1520
|
+
const anteriores = pares.slice(0, -1);
|
|
1521
|
+
const activo = campoDeActivo(definicionReferenciada);
|
|
1522
|
+
const nombres = camposDeNombre(definicionReferenciada);
|
|
1523
|
+
const columnasDeEtiqueta = nombres.length > 0 ? [...definicionReferenciada.primaryKey, ...nombres] : definicionReferenciada.primaryKey;
|
|
1524
|
+
const opciones = filasReferenciadas.filter((fila) => (activo === null || !!fila[activo]) && (filaActual === null || anteriores.every((par) => comoTexto(fila[par.target]) === comoTexto(filaActual[par.source])))).map((fila) => {
|
|
1525
|
+
const etiquetas = columnasDeEtiqueta.map((columna) => comoTexto(fila[columna]));
|
|
1526
|
+
return { valor: fila[columnaDelValor], etiquetas, texto: `${etiquetas.join(", ")}; ${definicionReferenciada.primaryKey.join(", ")}` };
|
|
1527
|
+
});
|
|
1528
|
+
const ordenar = new Intl.Collator("es", { numeric: true, sensitivity: "base" });
|
|
1529
|
+
opciones.sort((a, b) => ordenar.compare(a.texto, b.texto));
|
|
1530
|
+
if (admiteNulo) opciones.push({ valor: null, etiquetas: ["", "(vac\xEDo)"], texto: "" });
|
|
1531
|
+
return opciones;
|
|
1532
|
+
};
|
|
1533
|
+
var filtrarOpciones = (opciones, busqueda) => {
|
|
1534
|
+
const simplificar = (texto) => texto.normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase();
|
|
1535
|
+
const palabras = simplificar(busqueda).split(/\s+/).filter((p) => p !== "");
|
|
1536
|
+
if (palabras.length === 0) return opciones;
|
|
1537
|
+
return opciones.filter((opcion) => opcion.valor === null || palabras.every((p) => simplificar(opcion.etiquetas.join(" ")).includes(p)));
|
|
1538
|
+
};
|
|
1539
|
+
var VIGENCIA_DE_REFERENCIA_MS = 2 * 60 * 1e3;
|
|
1540
|
+
var referencias = /* @__PURE__ */ new Map();
|
|
1541
|
+
var cargarReferencia = (tabla) => {
|
|
1542
|
+
const guardada = referencias.get(tabla);
|
|
1543
|
+
if (guardada && Date.now() - guardada.cuando < VIGENCIA_DE_REFERENCIA_MS) return guardada.cargada;
|
|
1544
|
+
const cargada = (async () => {
|
|
1545
|
+
const [definicion, filas] = await Promise.all([
|
|
1546
|
+
executeBackendProcedure("table_structure", { table: tabla }),
|
|
1547
|
+
executeBackendProcedure("table_data", { table: tabla, fixedFields: [] })
|
|
1548
|
+
]);
|
|
1549
|
+
return { definicion: requerido(definicion, `la estructura de '${tabla}'`), filas: requerido(filas, `los datos de '${tabla}'`) };
|
|
1550
|
+
})();
|
|
1551
|
+
referencias.set(tabla, { cargada, cuando: Date.now() });
|
|
1552
|
+
cargada.catch(() => {
|
|
1553
|
+
if (referencias.get(tabla)?.cargada === cargada) referencias.delete(tabla);
|
|
1554
|
+
});
|
|
1555
|
+
return cargada;
|
|
1556
|
+
};
|
|
1557
|
+
|
|
1558
|
+
// src/utils/expanders.ts
|
|
1559
|
+
var tipoDeExpander = (campo, editable) => {
|
|
1560
|
+
if (campo.typeName === "jsonb" && !editable) return "json";
|
|
1561
|
+
if (editable) {
|
|
1562
|
+
if (esCampoConReferencia(campo)) return "referencia";
|
|
1563
|
+
if (campo.typeName === "boolean") return "booleano";
|
|
1564
|
+
if (campo.options && campo.options.length > 0) return "opciones";
|
|
1565
|
+
if (campo.typeName === "date") return "fecha";
|
|
1566
|
+
}
|
|
1567
|
+
return campo.clientSide ? null : "texto";
|
|
1568
|
+
};
|
|
1569
|
+
var SI_NO_VACIO = { si: "S\xED", no: "No", vacio: "(vac\xEDo)" };
|
|
1570
|
+
var opcionesDeBooleano = (admiteNulo) => {
|
|
1571
|
+
const opciones = [
|
|
1572
|
+
{ valor: true, etiquetas: [SI_NO_VACIO.si], texto: SI_NO_VACIO.si },
|
|
1573
|
+
{ valor: false, etiquetas: [SI_NO_VACIO.no], texto: SI_NO_VACIO.no }
|
|
1574
|
+
];
|
|
1575
|
+
if (admiteNulo) opciones.push({ valor: null, etiquetas: ["", SI_NO_VACIO.vacio], texto: "" });
|
|
1576
|
+
return opciones;
|
|
1577
|
+
};
|
|
1578
|
+
var opcionesDeEnumerado = (opciones, admiteNulo) => {
|
|
1579
|
+
const resultado = opciones.map((opcion) => typeof opcion === "string" ? { valor: opcion, etiquetas: [opcion], texto: opcion } : { valor: opcion.option, etiquetas: [String(opcion.option), opcion.label], texto: `${opcion.option} ${opcion.label}` });
|
|
1580
|
+
if (admiteNulo) resultado.push({ valor: null, etiquetas: ["", SI_NO_VACIO.vacio], texto: "" });
|
|
1581
|
+
return resultado;
|
|
1582
|
+
};
|
|
1583
|
+
var fechaDeValor = (valor) => {
|
|
1584
|
+
if (valor instanceof Date && !isNaN(valor.getTime())) return { anio: valor.getFullYear(), mes: valor.getMonth(), dia: valor.getDate() };
|
|
1585
|
+
if (typeof valor === "string") {
|
|
1586
|
+
const partes = /^(\d{4})-(\d{2})-(\d{2})/.exec(valor);
|
|
1587
|
+
if (partes) return { anio: Number(partes[1]), mes: Number(partes[2]) - 1, dia: Number(partes[3]) };
|
|
1588
|
+
}
|
|
1589
|
+
return null;
|
|
1590
|
+
};
|
|
1591
|
+
var fechaATexto = ({ anio, mes, dia }) => `${String(anio).padStart(4, "0")}-${String(mes + 1).padStart(2, "0")}-${String(dia).padStart(2, "0")}`;
|
|
1592
|
+
var semanasDelMes = (anio, mes) => {
|
|
1593
|
+
const primero = new Date(anio, mes, 1);
|
|
1594
|
+
const desfase = (primero.getDay() + 6) % 7;
|
|
1595
|
+
const diasDelMes = new Date(anio, mes + 1, 0).getDate();
|
|
1596
|
+
const semanas = [];
|
|
1597
|
+
for (let celda = 0; celda < Math.ceil((desfase + diasDelMes) / 7) * 7; celda++) {
|
|
1598
|
+
const fecha = new Date(anio, mes, 1 - desfase + celda);
|
|
1599
|
+
const dia = { anio: fecha.getFullYear(), mes: fecha.getMonth(), dia: fecha.getDate(), delMesMostrado: fecha.getMonth() === mes };
|
|
1600
|
+
if (celda % 7 === 0) semanas.push([]);
|
|
1601
|
+
semanas[semanas.length - 1].push(dia);
|
|
1602
|
+
}
|
|
1603
|
+
return semanas;
|
|
1604
|
+
};
|
|
1605
|
+
var textoParaVer = (valor) => {
|
|
1606
|
+
if (valor === null || valor === void 0) return "";
|
|
1607
|
+
if (typeof valor === "object" && !(valor instanceof Date)) return JSON.stringify(valor, null, 2);
|
|
1608
|
+
return String(valor);
|
|
1609
|
+
};
|
|
1610
|
+
|
|
1439
1611
|
// src/hooks/grid/useGridEvents.ts
|
|
1440
1612
|
var VIGENCIA_TECLA_PENDIENTE = 400;
|
|
1441
1613
|
var VIGENCIA_VALOR_PENDIENTE_F4 = 1e3;
|
|
1442
|
-
var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fixedFields, setSelectedCell, setTableData, setSortColumns }) => {
|
|
1614
|
+
var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fixedFields, setSelectedCell, setTableData, setSortColumns, verContenido }) => {
|
|
1443
1615
|
const filteredRowsRef = (0, import_react8.useRef)(filteredRows);
|
|
1444
1616
|
filteredRowsRef.current = filteredRows;
|
|
1445
1617
|
const tableDefinitionRef = (0, import_react8.useRef)(tableDefinition);
|
|
@@ -1447,6 +1619,7 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1447
1619
|
const valoresF4Pendientes = (0, import_react8.useRef)(/* @__PURE__ */ new Map());
|
|
1448
1620
|
const teclasPendientes = (0, import_react8.useRef)([]);
|
|
1449
1621
|
const editorActivo = (0, import_react8.useRef)(null);
|
|
1622
|
+
const teclaAnteriorRef = (0, import_react8.useRef)(null);
|
|
1450
1623
|
const registrarEditor = (0, import_react8.useCallback)((procesar) => {
|
|
1451
1624
|
editorActivo.current = procesar;
|
|
1452
1625
|
const cola = teclasPendientes.current;
|
|
@@ -1457,7 +1630,8 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1457
1630
|
if (editorActivo.current === procesar) editorActivo.current = null;
|
|
1458
1631
|
};
|
|
1459
1632
|
}, []);
|
|
1460
|
-
const handleKeyPressInEditor = (0, import_react8.useCallback)((rowIndex, columnKey, event, currentColumns, handleCommit) => {
|
|
1633
|
+
const handleKeyPressInEditor = (0, import_react8.useCallback)((rowIndex, columnKey, event, currentColumns, handleCommit, valorActual) => {
|
|
1634
|
+
let resuelta = false;
|
|
1461
1635
|
const tableDefinition2 = tableDefinitionRef.current;
|
|
1462
1636
|
const filteredRows2 = filteredRowsRef.current;
|
|
1463
1637
|
if (dataGridRef.current && tableDefinition2) {
|
|
@@ -1467,7 +1641,9 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1467
1641
|
return col.key !== "actionsColumn" && !(esColumnaPropia(col) && col.customType === "detail") && (fieldDefinition?.editable !== false && !fieldDefinition?.clientSide);
|
|
1468
1642
|
});
|
|
1469
1643
|
const { key, target } = event;
|
|
1470
|
-
const
|
|
1644
|
+
const teclaAnterior = teclaAnteriorRef.current;
|
|
1645
|
+
teclaAnteriorRef.current = key;
|
|
1646
|
+
const direccion = direccionDeSalida(event, posicionDelCursor(target), teclaAnterior);
|
|
1471
1647
|
if (currentColumnIndex !== -1 && editableColumns.length > 0) {
|
|
1472
1648
|
const editableColumnKeys = editableColumns.map((col) => col.key);
|
|
1473
1649
|
let currentEditableColumnIndex = editableColumnKeys.indexOf(columnKey);
|
|
@@ -1491,57 +1667,42 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1491
1667
|
const nextColumnIndex = currentColumns.findIndex((col) => col.key === nextColumnKey);
|
|
1492
1668
|
return { rowIdx: nextRowIndex, idx: nextColumnIndex };
|
|
1493
1669
|
};
|
|
1494
|
-
const
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
const
|
|
1502
|
-
return { rowIdx:
|
|
1670
|
+
const indiceDeColumna = (indiceEditable) => currentColumns.findIndex((col) => col.key === editableColumnKeys[indiceEditable]);
|
|
1671
|
+
const calcularColumnaAnteriorConSalto = () => {
|
|
1672
|
+
if (currentEditableColumnIndex > 0) return { rowIdx: rowIndex, idx: indiceDeColumna(currentEditableColumnIndex - 1) };
|
|
1673
|
+
const filaAnterior = filaDeDatos(rowIndex, -1);
|
|
1674
|
+
return filaAnterior === -1 ? null : { rowIdx: filaAnterior, idx: indiceDeColumna(editableColumnKeys.length - 1) };
|
|
1675
|
+
};
|
|
1676
|
+
const calcularColumnaVecina = (paso) => {
|
|
1677
|
+
const vecina = currentEditableColumnIndex + paso;
|
|
1678
|
+
return vecina < 0 || vecina >= editableColumnKeys.length ? null : { rowIdx: rowIndex, idx: indiceDeColumna(vecina) };
|
|
1679
|
+
};
|
|
1680
|
+
const calcularFilaVecina = (paso) => {
|
|
1681
|
+
const vecina = filaDeDatos(rowIndex, paso);
|
|
1682
|
+
return vecina === -1 ? null : { rowIdx: vecina, idx: currentColumnIndex };
|
|
1503
1683
|
};
|
|
1504
1684
|
const calcularFilaSiguiente = () => {
|
|
1505
1685
|
const nextRowIndex = filaDeDatos(rowIndex, 1);
|
|
1506
1686
|
return { rowIdx: nextRowIndex === -1 ? rowIndex : nextRowIndex, idx: currentColumnIndex };
|
|
1507
1687
|
};
|
|
1508
|
-
const calcularFilaAnterior = () => {
|
|
1509
|
-
const nextRowIndex = filaDeDatos(rowIndex, -1);
|
|
1510
|
-
return { rowIdx: nextRowIndex === -1 ? rowIndex : nextRowIndex, idx: currentColumnIndex };
|
|
1511
|
-
};
|
|
1512
1688
|
if (currentEditableColumnIndex !== -1) {
|
|
1513
1689
|
switch (true) {
|
|
1514
|
-
case
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
}
|
|
1528
|
-
case key === "ArrowLeft": {
|
|
1529
|
-
if (input && typeof input.selectionStart === "number") {
|
|
1530
|
-
const cursorPosition = input.selectionStart;
|
|
1531
|
-
if (cursorPosition === 0) {
|
|
1532
|
-
hacerFoco(calcularColumnaAnterior());
|
|
1533
|
-
}
|
|
1690
|
+
case direccion !== null: {
|
|
1691
|
+
resuelta = true;
|
|
1692
|
+
const destino = {
|
|
1693
|
+
siguiente: calcularColumnaSiguiente,
|
|
1694
|
+
anterior: calcularColumnaAnteriorConSalto,
|
|
1695
|
+
izquierda: () => calcularColumnaVecina(-1),
|
|
1696
|
+
derecha: () => calcularColumnaVecina(1),
|
|
1697
|
+
arriba: () => calcularFilaVecina(-1),
|
|
1698
|
+
abajo: () => calcularFilaVecina(1)
|
|
1699
|
+
}[direccion]();
|
|
1700
|
+
if (destino) {
|
|
1701
|
+
void handleCommit(valorActual, true, true);
|
|
1702
|
+
hacerFoco(destino);
|
|
1534
1703
|
}
|
|
1535
1704
|
break;
|
|
1536
1705
|
}
|
|
1537
|
-
case key === "ArrowUp": {
|
|
1538
|
-
hacerFoco(calcularFilaAnterior());
|
|
1539
|
-
break;
|
|
1540
|
-
}
|
|
1541
|
-
case key === "ArrowDown": {
|
|
1542
|
-
hacerFoco(calcularFilaSiguiente());
|
|
1543
|
-
break;
|
|
1544
|
-
}
|
|
1545
1706
|
case key === "F4": {
|
|
1546
1707
|
const { rowIdx, idx } = calcularFilaSiguiente();
|
|
1547
1708
|
const indiceAnterior = filaDeDatos(rowIndex, -1);
|
|
@@ -1562,8 +1723,26 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1562
1723
|
}
|
|
1563
1724
|
}
|
|
1564
1725
|
}
|
|
1726
|
+
return resuelta;
|
|
1565
1727
|
}, [dataGridRef]);
|
|
1566
1728
|
const handleCellKeyDown = (0, import_react8.useCallback)((args, event) => {
|
|
1729
|
+
const esExpander = event.key === "F9" && !event.shiftKey && !event.ctrlKey && !event.altKey || event.key === "ArrowDown" && event.altKey && !event.shiftKey && !event.ctrlKey;
|
|
1730
|
+
if (esExpander && !(event.target instanceof HTMLInputElement) && !esFilaDetalle(args.row)) {
|
|
1731
|
+
const campo = tableDefinitionRef.current?.fields.find((f) => f.name === args.column.key);
|
|
1732
|
+
const editable = typeof args.column.editable === "function" ? args.column.editable(args.row) : args.column.editable === true;
|
|
1733
|
+
const tipo = campo ? tipoDeExpander(campo, editable) : null;
|
|
1734
|
+
if (campo && editable && tipo !== null) {
|
|
1735
|
+
teclasPendientes.current.push({ key: "F9", cuando: Date.now() });
|
|
1736
|
+
dataGridRef.current?.selectCell({ rowIdx: args.rowIdx, idx: args.column.idx }, { enableEditor: true, shouldFocusCell: true });
|
|
1737
|
+
event.preventGridDefault();
|
|
1738
|
+
return;
|
|
1739
|
+
}
|
|
1740
|
+
if (campo && !editable && (tipo === "json" || tipo === "texto") && verContenido && event.target instanceof HTMLElement) {
|
|
1741
|
+
verContenido(event.target, textoParaVer(args.row[campo.name]));
|
|
1742
|
+
event.preventGridDefault();
|
|
1743
|
+
return;
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1567
1746
|
if (event.key === "F4" && !(event.target instanceof HTMLInputElement) && !esFilaDetalle(args.row)) {
|
|
1568
1747
|
const fieldDefinition = tableDefinitionRef.current?.fields.find((f) => f.name === args.column.key);
|
|
1569
1748
|
if (fieldDefinition && fieldDefinition.editable !== false && !fieldDefinition.clientSide) {
|
|
@@ -1576,7 +1755,7 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1576
1755
|
if (["Enter", "Tab", "ArrowDown", "ArrowUp", "ArrowRight", "ArrowLeft"].includes(event.key)) {
|
|
1577
1756
|
event.preventGridDefault();
|
|
1578
1757
|
}
|
|
1579
|
-
}, []);
|
|
1758
|
+
}, [dataGridRef, verContenido]);
|
|
1580
1759
|
const handleCellMouseDown = (0, import_react8.useCallback)((_args, event) => {
|
|
1581
1760
|
event.preventGridDefault();
|
|
1582
1761
|
}, []);
|
|
@@ -1589,10 +1768,12 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1589
1768
|
const handleCellClick = (0, import_react8.useCallback)((args, _event) => {
|
|
1590
1769
|
if (esFilaDetalle(args.row)) return;
|
|
1591
1770
|
const fieldDefinition = tableDefinition?.fields.find((f) => f.name === args.column.key);
|
|
1592
|
-
const isFixedField = fixedFields
|
|
1771
|
+
const isFixedField = valorFijoDe(fixedFields, args.column.key) !== void 0;
|
|
1593
1772
|
const isEditable = fieldDefinition?.editable !== false && !isFixedField;
|
|
1594
1773
|
if (isEditable) {
|
|
1595
1774
|
args.selectCell(true);
|
|
1775
|
+
} else if (fieldDefinition && tipoDeExpander(fieldDefinition, false) !== null) {
|
|
1776
|
+
args.selectCell(false);
|
|
1596
1777
|
}
|
|
1597
1778
|
}, [tableDefinition, fixedFields]);
|
|
1598
1779
|
const handleRowsChange = (0, import_react8.useCallback)((updatedRows, data) => {
|
|
@@ -1765,7 +1946,7 @@ var useGridMenu = ({
|
|
|
1765
1946
|
};
|
|
1766
1947
|
|
|
1767
1948
|
// src/hooks/grid/useGridColumns.ts
|
|
1768
|
-
var
|
|
1949
|
+
var import_react22 = __toESM(require("react"), 1);
|
|
1769
1950
|
|
|
1770
1951
|
// src/utils/functions.tsx
|
|
1771
1952
|
var JSON4all2 = __toESM(require("json4all"), 1);
|
|
@@ -1923,20 +2104,289 @@ var ActionsColumnHeaderCell = ({
|
|
|
1923
2104
|
var detailColumnCellHeaderRenderer = (props, detailTable) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_material4.Tooltip, { title: detailTable.label, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_material4.Typography, { variant: "caption", sx: { fontSize: "0.75rem", fontWeight: "bold" }, children: detailTable.abr.toUpperCase() }) });
|
|
1924
2105
|
|
|
1925
2106
|
// src/components/grid/FilterInputRender.tsx
|
|
1926
|
-
var
|
|
1927
|
-
var
|
|
2107
|
+
var import_material9 = require("@mui/material");
|
|
2108
|
+
var import_react18 = __toESM(require("react"), 1);
|
|
1928
2109
|
|
|
1929
2110
|
// src/components/forms/TypedField.tsx
|
|
2111
|
+
var import_react16 = require("react");
|
|
2112
|
+
var import_material8 = require("@mui/material");
|
|
2113
|
+
var import_type_store3 = __toESM(require("type-store"), 1);
|
|
2114
|
+
var import_react17 = require("react");
|
|
2115
|
+
|
|
2116
|
+
// src/hooks/grid/useExpander.tsx
|
|
2117
|
+
var import_react15 = __toESM(require("react"), 1);
|
|
2118
|
+
var import_IconButton = __toESM(require("@mui/material/IconButton"), 1);
|
|
2119
|
+
var import_ArrowDropDown = __toESM(require("@mui/icons-material/ArrowDropDown"), 1);
|
|
2120
|
+
var import_CalendarMonth = __toESM(require("@mui/icons-material/CalendarMonth"), 1);
|
|
2121
|
+
var import_Search2 = __toESM(require("@mui/icons-material/Search"), 1);
|
|
2122
|
+
|
|
2123
|
+
// src/components/grid/MenuDeOpciones.tsx
|
|
1930
2124
|
var import_react12 = require("react");
|
|
1931
2125
|
var import_material5 = require("@mui/material");
|
|
1932
|
-
var import_type_store3 = __toESM(require("type-store"), 1);
|
|
1933
|
-
var import_react13 = require("react");
|
|
1934
2126
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
2127
|
+
function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar }) {
|
|
2128
|
+
const [busqueda, setBusqueda] = (0, import_react12.useState)(busquedaInicial);
|
|
2129
|
+
const [indice, setIndice] = (0, import_react12.useState)(0);
|
|
2130
|
+
const visibles = (0, import_react12.useMemo)(() => filtrarOpciones(opciones, busqueda), [opciones, busqueda]);
|
|
2131
|
+
const elegida = (0, import_react12.useRef)(null);
|
|
2132
|
+
(0, import_react12.useEffect)(() => {
|
|
2133
|
+
elegida.current?.scrollIntoView({ block: "nearest" });
|
|
2134
|
+
}, [indice, visibles]);
|
|
2135
|
+
const alApretar = (evento) => {
|
|
2136
|
+
if (evento.key === "ArrowDown") {
|
|
2137
|
+
setIndice((i) => Math.min(i + 1, visibles.length - 1));
|
|
2138
|
+
} else if (evento.key === "ArrowUp") {
|
|
2139
|
+
setIndice((i) => Math.max(i - 1, 0));
|
|
2140
|
+
} else if (evento.key === "Enter") {
|
|
2141
|
+
if (visibles[indice]) onElegir(visibles[indice].valor);
|
|
2142
|
+
} else if (evento.key === "F9" || evento.key === "Escape") {
|
|
2143
|
+
onCerrar();
|
|
2144
|
+
} else {
|
|
2145
|
+
return;
|
|
2146
|
+
}
|
|
2147
|
+
evento.preventDefault();
|
|
2148
|
+
evento.stopPropagation();
|
|
2149
|
+
};
|
|
2150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
2151
|
+
import_material5.Popover,
|
|
2152
|
+
{
|
|
2153
|
+
open: true,
|
|
2154
|
+
anchorEl: anclaje,
|
|
2155
|
+
onClose: onCerrar,
|
|
2156
|
+
disableRestoreFocus: true,
|
|
2157
|
+
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
2158
|
+
slotProps: { paper: { sx: { minWidth: 300, maxWidth: 520 } } },
|
|
2159
|
+
children: [
|
|
2160
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2161
|
+
import_material5.InputBase,
|
|
2162
|
+
{
|
|
2163
|
+
autoFocus: true,
|
|
2164
|
+
fullWidth: true,
|
|
2165
|
+
value: busqueda,
|
|
2166
|
+
onChange: (e) => {
|
|
2167
|
+
setBusqueda(e.target.value);
|
|
2168
|
+
setIndice(0);
|
|
2169
|
+
},
|
|
2170
|
+
onKeyDown: alApretar,
|
|
2171
|
+
placeholder: "buscar",
|
|
2172
|
+
sx: { px: 1, py: 0.5, fontSize: "0.8rem", borderBottom: "1px solid #ccc" },
|
|
2173
|
+
inputProps: { "aria-label": "buscar" }
|
|
2174
|
+
}
|
|
2175
|
+
),
|
|
2176
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_material5.List, { dense: true, disablePadding: true, sx: { maxHeight: 320, overflowY: "auto" }, role: "listbox", children: [
|
|
2177
|
+
visibles.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_material5.Typography, { variant: "body2", sx: { p: 1, color: "text.secondary" }, children: "sin coincidencias" }),
|
|
2178
|
+
visibles.map((opcion, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2179
|
+
import_material5.ListItemButton,
|
|
2180
|
+
{
|
|
2181
|
+
ref: i === indice ? elegida : null,
|
|
2182
|
+
selected: i === indice,
|
|
2183
|
+
role: "option",
|
|
2184
|
+
onClick: () => onElegir(opcion.valor),
|
|
2185
|
+
sx: { gap: 2, py: 0.25, fontSize: "0.8rem" },
|
|
2186
|
+
children: opcion.etiquetas.map((etiqueta, j) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { fontWeight: j === 0 ? 600 : 400, minWidth: j === 0 ? 40 : void 0 }, children: etiqueta }, j))
|
|
2187
|
+
},
|
|
2188
|
+
i
|
|
2189
|
+
))
|
|
2190
|
+
] })
|
|
2191
|
+
]
|
|
2192
|
+
}
|
|
2193
|
+
);
|
|
2194
|
+
}
|
|
2195
|
+
|
|
2196
|
+
// src/components/grid/SelectorDeFecha.tsx
|
|
2197
|
+
var import_react13 = require("react");
|
|
2198
|
+
var import_material6 = require("@mui/material");
|
|
2199
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2200
|
+
var MESES = ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"];
|
|
2201
|
+
var DIAS = ["lu", "ma", "mi", "ju", "vi", "s\xE1", "do"];
|
|
2202
|
+
var mismaFecha = (a, b) => b !== null && a.anio === b.anio && a.mes === b.mes && a.dia === b.dia;
|
|
2203
|
+
var MOVIMIENTOS = {
|
|
2204
|
+
ArrowLeft: [-1, 0],
|
|
2205
|
+
ArrowRight: [1, 0],
|
|
2206
|
+
ArrowUp: [-7, 0],
|
|
2207
|
+
ArrowDown: [7, 0],
|
|
2208
|
+
PageUp: [0, -1],
|
|
2209
|
+
PageDown: [0, 1]
|
|
2210
|
+
};
|
|
2211
|
+
function SelectorDeFecha({ anclaje, fechaActual, admiteNulo, onElegir, onCerrar }) {
|
|
2212
|
+
const hoy = /* @__PURE__ */ new Date();
|
|
2213
|
+
const fechaDeHoy = { anio: hoy.getFullYear(), mes: hoy.getMonth(), dia: hoy.getDate() };
|
|
2214
|
+
const [cursor, setCursor] = (0, import_react13.useState)(fechaActual ?? fechaDeHoy);
|
|
2215
|
+
const mover = (dias, meses) => {
|
|
2216
|
+
const nueva = new Date(cursor.anio, cursor.mes + meses, cursor.dia + dias);
|
|
2217
|
+
setCursor({ anio: nueva.getFullYear(), mes: nueva.getMonth(), dia: nueva.getDate() });
|
|
2218
|
+
};
|
|
2219
|
+
const alApretar = (evento) => {
|
|
2220
|
+
if (evento.key in MOVIMIENTOS) {
|
|
2221
|
+
mover(...MOVIMIENTOS[evento.key]);
|
|
2222
|
+
} else if (evento.key === "Enter") {
|
|
2223
|
+
onElegir(fechaATexto(cursor));
|
|
2224
|
+
} else if (evento.key === "F9" || evento.key === "Escape") {
|
|
2225
|
+
onCerrar();
|
|
2226
|
+
} else {
|
|
2227
|
+
return;
|
|
2228
|
+
}
|
|
2229
|
+
evento.preventDefault();
|
|
2230
|
+
evento.stopPropagation();
|
|
2231
|
+
};
|
|
2232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.Popover, { open: true, anchorEl: anclaje, onClose: onCerrar, disableRestoreFocus: true, anchorOrigin: { vertical: "bottom", horizontal: "left" }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { tabIndex: 0, ref: (el) => el?.focus(), onKeyDown: alApretar, style: { padding: 8, outline: "none", width: 252 }, "aria-label": "calendario", children: [
|
|
2233
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
2234
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.IconButton, { size: "small", "aria-label": "mes anterior", onClick: () => mover(0, -1), children: "\u2039" }),
|
|
2235
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_material6.Typography, { variant: "body2", sx: { fontWeight: 600 }, children: [
|
|
2236
|
+
MESES[cursor.mes],
|
|
2237
|
+
" ",
|
|
2238
|
+
cursor.anio
|
|
2239
|
+
] }),
|
|
2240
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.IconButton, { size: "small", "aria-label": "mes siguiente", onClick: () => mover(0, 1), children: "\u203A" })
|
|
2241
|
+
] }),
|
|
2242
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("table", { style: { borderCollapse: "collapse", width: "100%", textAlign: "center", fontSize: "0.8rem" }, children: [
|
|
2243
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("tr", { children: DIAS.map((d) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("th", { style: { fontWeight: 400, color: "#777" }, children: d }, d)) }) }),
|
|
2244
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("tbody", { children: semanasDelMes(cursor.anio, cursor.mes).map((semana, i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("tr", { children: semana.map((dia) => {
|
|
2245
|
+
const elegido = mismaFecha(dia, fechaActual);
|
|
2246
|
+
const enCursor = mismaFecha(dia, cursor);
|
|
2247
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("td", { style: { padding: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2248
|
+
"button",
|
|
2249
|
+
{
|
|
2250
|
+
type: "button",
|
|
2251
|
+
tabIndex: -1,
|
|
2252
|
+
onClick: () => onElegir(fechaATexto(dia)),
|
|
2253
|
+
style: {
|
|
2254
|
+
width: 32,
|
|
2255
|
+
height: 26,
|
|
2256
|
+
border: enCursor ? "1px solid #1976d2" : "1px solid transparent",
|
|
2257
|
+
borderRadius: 4,
|
|
2258
|
+
cursor: "pointer",
|
|
2259
|
+
background: elegido ? "#1976d2" : "transparent",
|
|
2260
|
+
color: elegido ? "#fff" : dia.delMesMostrado ? "#000" : "#aaa"
|
|
2261
|
+
},
|
|
2262
|
+
children: dia.dia
|
|
2263
|
+
}
|
|
2264
|
+
) }, `${dia.mes}-${dia.dia}`);
|
|
2265
|
+
}) }, i)) })
|
|
2266
|
+
] }),
|
|
2267
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", marginTop: 4 }, children: [
|
|
2268
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.Button, { size: "small", onClick: () => onElegir(fechaATexto(fechaDeHoy)), children: "hoy" }),
|
|
2269
|
+
admiteNulo && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.Button, { size: "small", onClick: () => onElegir(null), children: "vac\xEDo" })
|
|
2270
|
+
] })
|
|
2271
|
+
] }) });
|
|
2272
|
+
}
|
|
2273
|
+
|
|
2274
|
+
// src/components/grid/VentanaDeTexto.tsx
|
|
2275
|
+
var import_react14 = require("react");
|
|
2276
|
+
var import_material7 = require("@mui/material");
|
|
2277
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2278
|
+
function VentanaDeTexto({ anclaje, texto, editable, onAceptar, onCerrar }) {
|
|
2279
|
+
const [valor, setValor] = (0, import_react14.useState)(texto);
|
|
2280
|
+
const alApretar = (evento) => {
|
|
2281
|
+
if (evento.key === "Escape" || evento.key === "F9") {
|
|
2282
|
+
onCerrar();
|
|
2283
|
+
} else if (evento.key === "Enter" && evento.ctrlKey && editable) {
|
|
2284
|
+
onAceptar(valor);
|
|
2285
|
+
} else {
|
|
2286
|
+
return;
|
|
2287
|
+
}
|
|
2288
|
+
evento.preventDefault();
|
|
2289
|
+
evento.stopPropagation();
|
|
2290
|
+
};
|
|
2291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material7.Popover, { open: true, anchorEl: anclaje, onClose: onCerrar, disableRestoreFocus: true, anchorOrigin: { vertical: "bottom", horizontal: "left" }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { padding: 8, minWidth: 320, maxWidth: 640 }, children: [
|
|
2292
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2293
|
+
import_material7.InputBase,
|
|
2294
|
+
{
|
|
2295
|
+
autoFocus: true,
|
|
2296
|
+
multiline: true,
|
|
2297
|
+
fullWidth: true,
|
|
2298
|
+
readOnly: !editable,
|
|
2299
|
+
value: valor,
|
|
2300
|
+
onChange: (e) => setValor(e.target.value),
|
|
2301
|
+
onKeyDown: alApretar,
|
|
2302
|
+
minRows: 2,
|
|
2303
|
+
maxRows: 16,
|
|
2304
|
+
sx: { fontFamily: "monospace", fontSize: "0.8rem", border: "1px solid #ccc", borderRadius: "4px", p: 0.5 },
|
|
2305
|
+
inputProps: { "aria-label": "contenido de la celda" }
|
|
2306
|
+
}
|
|
2307
|
+
),
|
|
2308
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { display: "flex", justifyContent: "flex-end", gap: 8, marginTop: 4 }, children: [
|
|
2309
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material7.Button, { size: "small", onClick: onCerrar, children: "cancelar" }),
|
|
2310
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material7.Button, { size: "small", variant: "contained", onClick: () => onAceptar(valor), children: "aceptar" })
|
|
2311
|
+
] })
|
|
2312
|
+
] }) });
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2315
|
+
// src/hooks/grid/useExpander.tsx
|
|
2316
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2317
|
+
var useExpander = ({ campo, editable, fila, admiteNulo, tipos, anclaje, textoActual, valorActual, alElegirValor, alConfirmarTexto, alFallar }) => {
|
|
2318
|
+
const [expansion, setExpansion] = (0, import_react15.useState)(null);
|
|
2319
|
+
const abierto = import_react15.default.useRef(false);
|
|
2320
|
+
const tipoDelCampo = tipoDeExpander(campo, editable);
|
|
2321
|
+
const tipo = tipoDelCampo === null || tipoDelCampo === "json" || tipos && !tipos.includes(tipoDelCampo) ? null : tipoDelCampo;
|
|
2322
|
+
const abrir = (0, import_react15.useCallback)(async (busqueda) => {
|
|
2323
|
+
if (tipo === null || abierto.current) return;
|
|
2324
|
+
abierto.current = true;
|
|
2325
|
+
try {
|
|
2326
|
+
if (tipo === "referencia" && esCampoConReferencia(campo)) {
|
|
2327
|
+
const { definicion, filas } = await cargarReferencia(campo.references);
|
|
2328
|
+
setExpansion({ tipo: "opciones", opciones: opcionesDeReferencia(campo, definicion, filas, fila, admiteNulo), busqueda });
|
|
2329
|
+
} else if (tipo === "booleano") {
|
|
2330
|
+
setExpansion({ tipo: "opciones", opciones: opcionesDeBooleano(admiteNulo), busqueda });
|
|
2331
|
+
} else if (tipo === "opciones") {
|
|
2332
|
+
setExpansion({ tipo: "opciones", opciones: opcionesDeEnumerado(campo.options ?? [], admiteNulo), busqueda });
|
|
2333
|
+
} else {
|
|
2334
|
+
setExpansion({ tipo: tipo === "fecha" ? "fecha" : "texto" });
|
|
2335
|
+
}
|
|
2336
|
+
} catch (err) {
|
|
2337
|
+
abierto.current = false;
|
|
2338
|
+
alFallar(mensajeDeError(err));
|
|
2339
|
+
}
|
|
2340
|
+
}, [tipo, campo, fila, admiteNulo, alFallar]);
|
|
2341
|
+
const cerrar = (0, import_react15.useCallback)(() => {
|
|
2342
|
+
abierto.current = false;
|
|
2343
|
+
setExpansion(null);
|
|
2344
|
+
setTimeout(() => anclaje.current?.focus(), 0);
|
|
2345
|
+
}, [anclaje]);
|
|
2346
|
+
const elegirValor = (0, import_react15.useCallback)((valor) => {
|
|
2347
|
+
cerrar();
|
|
2348
|
+
alElegirValor(valor);
|
|
2349
|
+
}, [cerrar, alElegirValor]);
|
|
2350
|
+
const confirmarTexto = (0, import_react15.useCallback)((texto) => {
|
|
2351
|
+
cerrar();
|
|
2352
|
+
alConfirmarTexto(texto);
|
|
2353
|
+
}, [cerrar, alConfirmarTexto]);
|
|
2354
|
+
const manejarTecla = (0, import_react15.useCallback)((event) => {
|
|
2355
|
+
const esExpander = event.key === "F9" && !event.shiftKey && !event.ctrlKey && !event.altKey || event.key === "ArrowDown" && event.altKey && !event.shiftKey && !event.ctrlKey;
|
|
2356
|
+
if (tipo === null || !esExpander) return false;
|
|
2357
|
+
event.preventDefault();
|
|
2358
|
+
void abrir("");
|
|
2359
|
+
return true;
|
|
2360
|
+
}, [tipo, abrir]);
|
|
2361
|
+
const titulo = tipo === "fecha" ? "elegir fecha (F9)" : tipo === "texto" ? "ver el contenido completo (F9)" : "elegir un valor (F9)";
|
|
2362
|
+
const lupa = tipo === null ? null : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2363
|
+
import_IconButton.default,
|
|
2364
|
+
{
|
|
2365
|
+
size: "small",
|
|
2366
|
+
tabIndex: -1,
|
|
2367
|
+
"aria-label": titulo.replace(" (F9)", ""),
|
|
2368
|
+
title: titulo,
|
|
2369
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
2370
|
+
onClick: (e) => {
|
|
2371
|
+
e.stopPropagation();
|
|
2372
|
+
void abrir("");
|
|
2373
|
+
},
|
|
2374
|
+
sx: { p: 0, ml: 0.25, color: "primary.main", "&:hover": { backgroundColor: "action.hover" } },
|
|
2375
|
+
children: tipo === "fecha" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_CalendarMonth.default, { sx: { fontSize: 16 } }) : tipo === "texto" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_Search2.default, { sx: { fontSize: 16 } }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_ArrowDropDown.default, { sx: { fontSize: 20 } })
|
|
2376
|
+
}
|
|
2377
|
+
);
|
|
2378
|
+
const base = anclaje.current;
|
|
2379
|
+
const ventana = !expansion || !base ? null : expansion.tipo === "opciones" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MenuDeOpciones, { anclaje: base, opciones: expansion.opciones, busquedaInicial: expansion.busqueda, onElegir: elegirValor, onCerrar: cerrar }) : expansion.tipo === "fecha" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SelectorDeFecha, { anclaje: base, fechaActual: fechaDeValor(valorActual), admiteNulo, onElegir: confirmarTexto, onCerrar: cerrar }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(VentanaDeTexto, { anclaje: base, texto: textoActual, editable: true, onAceptar: confirmarTexto, onCerrar: cerrar });
|
|
2380
|
+
return { tipo, abierto, abrir, manejarTecla, lupa, ventana };
|
|
2381
|
+
};
|
|
2382
|
+
|
|
2383
|
+
// src/components/forms/TypedField.tsx
|
|
2384
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1935
2385
|
var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode = false, feedback, isMandatory = false }) => {
|
|
1936
|
-
const theme = (0,
|
|
1937
|
-
const typer = (0,
|
|
1938
|
-
const isBoolean = fieldDef.typeName === "boolean";
|
|
1939
|
-
const [localString, setLocalString] = (0,
|
|
2386
|
+
const theme = (0, import_material8.useTheme)();
|
|
2387
|
+
const typer = (0, import_react16.useMemo)(() => import_type_store3.default.typerFrom(fieldDef), [fieldDef]);
|
|
2388
|
+
const isBoolean = fieldDef.typeName === "boolean" && !isFilterMode;
|
|
2389
|
+
const [localString, setLocalString] = (0, import_react16.useState)(() => {
|
|
1940
2390
|
if (isBoolean) return "";
|
|
1941
2391
|
if (isFilterMode) return value !== null && value !== void 0 ? String(value) : "";
|
|
1942
2392
|
try {
|
|
@@ -1945,10 +2395,10 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
1945
2395
|
return value === null || value === void 0 ? "" : String(value);
|
|
1946
2396
|
}
|
|
1947
2397
|
});
|
|
1948
|
-
const [errorMsg, setErrorMsg] = (0,
|
|
1949
|
-
const lastValueRef = (0,
|
|
1950
|
-
const lastCommittedStringRef = (0,
|
|
1951
|
-
(0,
|
|
2398
|
+
const [errorMsg, setErrorMsg] = (0, import_react16.useState)(null);
|
|
2399
|
+
const lastValueRef = (0, import_react17.useRef)(value);
|
|
2400
|
+
const lastCommittedStringRef = (0, import_react17.useRef)(localString);
|
|
2401
|
+
(0, import_react16.useEffect)(() => {
|
|
1952
2402
|
if (!isBoolean) {
|
|
1953
2403
|
if (value !== lastValueRef.current) {
|
|
1954
2404
|
lastValueRef.current = value;
|
|
@@ -1965,7 +2415,27 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
1965
2415
|
}
|
|
1966
2416
|
}
|
|
1967
2417
|
}, [value, typer, isBoolean, isFilterMode]);
|
|
1968
|
-
const
|
|
2418
|
+
const entradaRef = (0, import_react17.useRef)(null);
|
|
2419
|
+
const [enfocado, setEnfocado] = (0, import_react16.useState)(false);
|
|
2420
|
+
const escribirEnFiltro = (0, import_react16.useCallback)((texto) => {
|
|
2421
|
+
setLocalString(texto);
|
|
2422
|
+
lastValueRef.current = texto;
|
|
2423
|
+
onChange(fieldDef.name, texto, true);
|
|
2424
|
+
}, [onChange, fieldDef.name]);
|
|
2425
|
+
const expander = useExpander({
|
|
2426
|
+
campo: fieldDef,
|
|
2427
|
+
editable: true,
|
|
2428
|
+
fila: null,
|
|
2429
|
+
admiteNulo: false,
|
|
2430
|
+
tipos: isFilterMode ? ["referencia", "booleano", "opciones", "fecha"] : [],
|
|
2431
|
+
anclaje: entradaRef,
|
|
2432
|
+
textoActual: localString,
|
|
2433
|
+
valorActual: localString,
|
|
2434
|
+
alElegirValor: (valor) => escribirEnFiltro(valor === null || valor === void 0 ? "" : typeof valor === "boolean" ? typer.toLocalString(valor) : String(valor)),
|
|
2435
|
+
alConfirmarTexto: (texto) => escribirEnFiltro(texto ?? ""),
|
|
2436
|
+
alFallar: (mensaje) => setErrorMsg(mensaje)
|
|
2437
|
+
});
|
|
2438
|
+
const handleTextChange = (0, import_react16.useCallback)((e) => {
|
|
1969
2439
|
const newValueString = e.target.value;
|
|
1970
2440
|
setLocalString(newValueString);
|
|
1971
2441
|
let parsedValue = null;
|
|
@@ -1986,7 +2456,7 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
1986
2456
|
lastValueRef.current = parsedValue;
|
|
1987
2457
|
onChange(fieldDef.name, parsedValue, isValid);
|
|
1988
2458
|
}, [typer, onChange, fieldDef.name, isFilterMode]);
|
|
1989
|
-
const handleTextCommit = (0,
|
|
2459
|
+
const handleTextCommit = (0, import_react16.useCallback)(() => {
|
|
1990
2460
|
if (!onCommit) return;
|
|
1991
2461
|
if (localString === lastCommittedStringRef.current) return;
|
|
1992
2462
|
lastCommittedStringRef.current = localString;
|
|
@@ -2004,13 +2474,14 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2004
2474
|
}
|
|
2005
2475
|
onCommit(fieldDef.name, parsedValue, isValid);
|
|
2006
2476
|
}, [onCommit, fieldDef.name, localString, isFilterMode, typer]);
|
|
2007
|
-
const handleTextKeyDown = (0,
|
|
2477
|
+
const handleTextKeyDown = (0, import_react16.useCallback)((e) => {
|
|
2478
|
+
if (expander.manejarTecla(e)) return;
|
|
2008
2479
|
if (e.key === "Enter") {
|
|
2009
2480
|
e.preventDefault();
|
|
2010
2481
|
handleTextCommit();
|
|
2011
2482
|
}
|
|
2012
|
-
}, [handleTextCommit]);
|
|
2013
|
-
const handleBooleanChange = (0,
|
|
2483
|
+
}, [handleTextCommit, expander]);
|
|
2484
|
+
const handleBooleanChange = (0, import_react16.useCallback)((e) => {
|
|
2014
2485
|
const val = e.target.value;
|
|
2015
2486
|
let finalValue = null;
|
|
2016
2487
|
if (val === "true") finalValue = true;
|
|
@@ -2038,28 +2509,28 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2038
2509
|
}
|
|
2039
2510
|
const cellBackgroundColor2 = feedback === "error" ? theme.palette.error.light : feedback === "success" ? theme.palette.success.light : defaultBgColor;
|
|
2040
2511
|
const transitionStyle2 = "background-color 0.3s ease-in-out";
|
|
2041
|
-
return /* @__PURE__ */ (0,
|
|
2042
|
-
!isFilterMode && /* @__PURE__ */ (0,
|
|
2043
|
-
/* @__PURE__ */ (0,
|
|
2044
|
-
|
|
2512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_material8.FormControl, { fullWidth: true, error: !!errorMsg && !isFilterMode, disabled: isDisabled, size: "small", margin: "dense", children: [
|
|
2513
|
+
!isFilterMode && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material8.InputLabel, { shrink: true, children: fieldDef.name }),
|
|
2514
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
2515
|
+
import_material8.Select,
|
|
2045
2516
|
{
|
|
2046
2517
|
value: boolVal,
|
|
2047
2518
|
label: !isFilterMode ? fieldDef.name : void 0,
|
|
2048
2519
|
onChange: handleBooleanChange,
|
|
2049
|
-
startAdornment: isMandatory && isEmpty && !isFilterMode ? /* @__PURE__ */ (0,
|
|
2520
|
+
startAdornment: isMandatory && isEmpty && !isFilterMode ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material8.InputAdornment, { position: "start", sx: { color: "text.secondary", ml: 0.5 }, children: "*" }) : void 0,
|
|
2050
2521
|
displayEmpty: true,
|
|
2051
2522
|
sx: isFilterMode ? { height: 25, fontSize: "0.8rem", backgroundColor: "background.paper" } : {
|
|
2052
2523
|
backgroundColor: cellBackgroundColor2,
|
|
2053
2524
|
transition: transitionStyle2
|
|
2054
2525
|
},
|
|
2055
2526
|
children: [
|
|
2056
|
-
fieldDef.nullable !== false && /* @__PURE__ */ (0,
|
|
2057
|
-
/* @__PURE__ */ (0,
|
|
2058
|
-
/* @__PURE__ */ (0,
|
|
2527
|
+
fieldDef.nullable !== false && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material8.MenuItem, { value: "", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("em", { children: "Nulo / Sin Especificar" }) }),
|
|
2528
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material8.MenuItem, { value: "true", children: "S\xED (Verdadero)" }),
|
|
2529
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material8.MenuItem, { value: "false", children: "No (Falso)" })
|
|
2059
2530
|
]
|
|
2060
2531
|
}
|
|
2061
2532
|
),
|
|
2062
|
-
errorMsg && !isFilterMode && /* @__PURE__ */ (0,
|
|
2533
|
+
errorMsg && !isFilterMode && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material8.FormHelperText, { children: errorMsg })
|
|
2063
2534
|
] });
|
|
2064
2535
|
}
|
|
2065
2536
|
let inputType = "text";
|
|
@@ -2073,54 +2544,65 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2073
2544
|
}
|
|
2074
2545
|
const cellBackgroundColor = feedback === "error" ? theme.palette.error.light : feedback === "success" ? theme.palette.success.light : defaultTextBgColor;
|
|
2075
2546
|
const transitionStyle = "background-color 0.3s ease-in-out";
|
|
2076
|
-
return /* @__PURE__ */ (0,
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
minWidth: 50,
|
|
2104
|
-
fontSize: "0.8rem",
|
|
2105
|
-
padding: "0px"
|
|
2106
|
-
}
|
|
2107
|
-
} : {
|
|
2108
|
-
"& .MuiOutlinedInput-root": {
|
|
2109
|
-
backgroundColor: cellBackgroundColor,
|
|
2110
|
-
transition: transitionStyle
|
|
2547
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
2548
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2549
|
+
import_material8.TextField,
|
|
2550
|
+
{
|
|
2551
|
+
fullWidth: true,
|
|
2552
|
+
inputRef: entradaRef,
|
|
2553
|
+
type: inputType,
|
|
2554
|
+
label: isFilterMode ? void 0 : fieldDef.name,
|
|
2555
|
+
variant: "outlined",
|
|
2556
|
+
size: "small",
|
|
2557
|
+
margin: isFilterMode ? "none" : "dense",
|
|
2558
|
+
value: localString,
|
|
2559
|
+
onChange: handleTextChange,
|
|
2560
|
+
disabled: isDisabled,
|
|
2561
|
+
error: !!errorMsg && !isFilterMode,
|
|
2562
|
+
helperText: !isFilterMode ? errorMsg || (isMandatory ? "Obligatorio" : "") : void 0,
|
|
2563
|
+
InputLabelProps: !isFilterMode ? { shrink: true } : void 0,
|
|
2564
|
+
InputProps: isFilterMode ? {
|
|
2565
|
+
// la lupa solo al enfocar el filtro, como en backend-plus
|
|
2566
|
+
endAdornment: enfocado || expander.abierto.current ? expander.lupa : void 0
|
|
2567
|
+
} : isMandatory && isEmptyText ? {
|
|
2568
|
+
startAdornment: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material8.InputAdornment, { position: "start", sx: { color: "text.secondary", mr: 0.5 }, children: "*" })
|
|
2569
|
+
} : {},
|
|
2570
|
+
inputProps: {
|
|
2571
|
+
style: {
|
|
2572
|
+
textAlign: isNumericType(fieldDef.typeName) ? "right" : "left"
|
|
2573
|
+
}
|
|
2111
2574
|
},
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2575
|
+
sx: isFilterMode ? {
|
|
2576
|
+
"& .MuiOutlinedInput-root": {
|
|
2577
|
+
backgroundColor: "background.paper",
|
|
2578
|
+
height: FILTER_ROW_HEIGHT - 5,
|
|
2579
|
+
minWidth: 50,
|
|
2580
|
+
fontSize: "0.8rem",
|
|
2581
|
+
padding: "0px"
|
|
2582
|
+
}
|
|
2583
|
+
} : {
|
|
2584
|
+
"& .MuiOutlinedInput-root": {
|
|
2585
|
+
backgroundColor: cellBackgroundColor,
|
|
2586
|
+
transition: transitionStyle
|
|
2587
|
+
},
|
|
2588
|
+
"& .MuiOutlinedInput-input": {
|
|
2589
|
+
padding: "6px 12px"
|
|
2590
|
+
}
|
|
2591
|
+
},
|
|
2592
|
+
onFocus: () => setEnfocado(true),
|
|
2593
|
+
onBlur: () => {
|
|
2594
|
+
setEnfocado(false);
|
|
2595
|
+
handleTextCommit();
|
|
2596
|
+
},
|
|
2597
|
+
onKeyDown: handleTextKeyDown
|
|
2598
|
+
}
|
|
2599
|
+
),
|
|
2600
|
+
expander.ventana
|
|
2601
|
+
] });
|
|
2120
2602
|
};
|
|
2121
2603
|
|
|
2122
2604
|
// src/components/grid/FilterInputRender.tsx
|
|
2123
|
-
var
|
|
2605
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2124
2606
|
function FilterInputRenderer({
|
|
2125
2607
|
columnKey,
|
|
2126
2608
|
currentFilter,
|
|
@@ -2143,8 +2625,8 @@ function FilterInputRenderer({
|
|
|
2143
2625
|
[columnKey]: { operator: newOp, value: formattedVal }
|
|
2144
2626
|
}));
|
|
2145
2627
|
};
|
|
2146
|
-
return /* @__PURE__ */ (0,
|
|
2147
|
-
/* @__PURE__ */ (0,
|
|
2628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_material9.Box, { sx: { mt: 0, display: "flex", alignItems: "center", gap: 0.5, pr: 1 }, children: [
|
|
2629
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2148
2630
|
"select",
|
|
2149
2631
|
{
|
|
2150
2632
|
value: operator,
|
|
@@ -2160,10 +2642,10 @@ function FilterInputRenderer({
|
|
|
2160
2642
|
textAlign: "center",
|
|
2161
2643
|
cursor: "pointer"
|
|
2162
2644
|
},
|
|
2163
|
-
children: filterOperators.map((op) => /* @__PURE__ */ (0,
|
|
2645
|
+
children: filterOperators.map((op) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: op.value, children: op.label }, op.value))
|
|
2164
2646
|
}
|
|
2165
2647
|
),
|
|
2166
|
-
/* @__PURE__ */ (0,
|
|
2648
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2167
2649
|
TypedField,
|
|
2168
2650
|
{
|
|
2169
2651
|
fieldDef,
|
|
@@ -2174,8 +2656,8 @@ function FilterInputRenderer({
|
|
|
2174
2656
|
)
|
|
2175
2657
|
] });
|
|
2176
2658
|
}
|
|
2177
|
-
return /* @__PURE__ */ (0,
|
|
2178
|
-
|
|
2659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2660
|
+
import_material9.InputBase,
|
|
2179
2661
|
{
|
|
2180
2662
|
value: currentFilter || "",
|
|
2181
2663
|
onChange: (e) => setFilters((prev) => ({
|
|
@@ -2197,19 +2679,18 @@ function FilterInputRenderer({
|
|
|
2197
2679
|
}
|
|
2198
2680
|
);
|
|
2199
2681
|
}
|
|
2200
|
-
var FilterInputRender_default =
|
|
2682
|
+
var FilterInputRender_default = import_react18.default.memo(FilterInputRenderer);
|
|
2201
2683
|
|
|
2202
2684
|
// src/components/grid/renderers/summaryCellRenderers.tsx
|
|
2203
|
-
var
|
|
2204
|
-
var
|
|
2685
|
+
var import_material10 = require("@mui/material");
|
|
2686
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2205
2687
|
var defaultColumnSummaryCellRenderer = (props, fixedFields) => {
|
|
2206
2688
|
const { column, row } = props;
|
|
2207
2689
|
if (row.id === "filterRow") {
|
|
2208
2690
|
const { filters, setFilters } = row;
|
|
2209
|
-
|
|
2210
|
-
if (fixedFieldEntry && fixedFieldEntry.until === void 0) return null;
|
|
2691
|
+
if (valorFijoDe(fixedFields, column.key)) return null;
|
|
2211
2692
|
const fieldDef = esColumnaPropia(column) && column.customType === "default" ? column.fieldDef : void 0;
|
|
2212
|
-
return /* @__PURE__ */ (0,
|
|
2693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_material10.Box, { sx: { width: "100%", height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2213
2694
|
FilterInputRender_default,
|
|
2214
2695
|
{
|
|
2215
2696
|
columnKey: column.key,
|
|
@@ -2251,7 +2732,7 @@ var defaultColumnSummaryCellRenderer = (props, fixedFields) => {
|
|
|
2251
2732
|
label = "Cant S\xED: ";
|
|
2252
2733
|
break;
|
|
2253
2734
|
}
|
|
2254
|
-
return /* @__PURE__ */ (0,
|
|
2735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_material10.Box, { sx: {
|
|
2255
2736
|
px: 0,
|
|
2256
2737
|
fontWeight: "bold",
|
|
2257
2738
|
fontSize: "0.875rem",
|
|
@@ -2269,36 +2750,36 @@ var actionsColumnSummaryCellRenderer = (_props) => null;
|
|
|
2269
2750
|
var detailColumnCellSummaryRenderer = (_props) => null;
|
|
2270
2751
|
|
|
2271
2752
|
// src/components/grid/renderers/cellRenderers.tsx
|
|
2272
|
-
var
|
|
2273
|
-
var
|
|
2753
|
+
var import_react19 = __toESM(require("react"), 1);
|
|
2754
|
+
var import_material13 = require("@mui/material");
|
|
2274
2755
|
var import_ViewHeadline = __toESM(require("@mui/icons-material/ViewHeadline"), 1);
|
|
2275
2756
|
var import_Delete = __toESM(require("@mui/icons-material/Delete"), 1);
|
|
2276
2757
|
var import_Add2 = __toESM(require("@mui/icons-material/Add"), 1);
|
|
2277
2758
|
|
|
2278
2759
|
// src/components/grid/ExampleClientSideComponent.tsx
|
|
2279
|
-
var
|
|
2280
|
-
var
|
|
2760
|
+
var import_material11 = require("@mui/material");
|
|
2761
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2281
2762
|
var ExampleClientSideComponent = ({ row, column, fieldDefinition }) => {
|
|
2282
2763
|
const value = row[column.key];
|
|
2283
|
-
return /* @__PURE__ */ (0,
|
|
2764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material11.Box, { sx: {
|
|
2284
2765
|
padding: 0.5,
|
|
2285
2766
|
width: "100%",
|
|
2286
2767
|
height: "100%",
|
|
2287
2768
|
display: "flex",
|
|
2288
2769
|
alignItems: "center",
|
|
2289
2770
|
backgroundColor: value === "Special" ? "lightblue" : "transparent"
|
|
2290
|
-
}, children: /* @__PURE__ */ (0,
|
|
2771
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material11.Typography, { variant: "body2", sx: { fontWeight: "bold" }, children: value ? `CS: ${value}` : "N/A" }) });
|
|
2291
2772
|
};
|
|
2292
2773
|
var ExampleClientSideComponent_default = ExampleClientSideComponent;
|
|
2293
2774
|
|
|
2294
2775
|
// src/components/grid/FallbackClientSideRenderer.tsx
|
|
2295
|
-
var
|
|
2776
|
+
var import_material12 = require("@mui/material");
|
|
2296
2777
|
var import_WarningAmber2 = __toESM(require("@mui/icons-material/WarningAmber"), 1);
|
|
2297
|
-
var
|
|
2778
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2298
2779
|
var FallbackClientSideRenderer = ({ column, row, fieldDefinition }) => {
|
|
2299
2780
|
const clientSideName = fieldDefinition?.clientSide || "Desconocido";
|
|
2300
|
-
return /* @__PURE__ */ (0,
|
|
2301
|
-
|
|
2781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material12.Tooltip, { title: `Componente clientSide '${clientSideName}' no implementado. Mostrando valor por defecto.`, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2782
|
+
import_material12.Box,
|
|
2302
2783
|
{
|
|
2303
2784
|
sx: {
|
|
2304
2785
|
display: "flex",
|
|
@@ -2318,8 +2799,8 @@ var FallbackClientSideRenderer = ({ column, row, fieldDefinition }) => {
|
|
|
2318
2799
|
// Evita que el contenido se desborde
|
|
2319
2800
|
},
|
|
2320
2801
|
children: [
|
|
2321
|
-
/* @__PURE__ */ (0,
|
|
2322
|
-
/* @__PURE__ */ (0,
|
|
2802
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material12.Typography, { variant: "body2", noWrap: true, sx: { flexGrow: 1 }, children: clientSideName + " not found" }),
|
|
2803
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2323
2804
|
import_WarningAmber2.default,
|
|
2324
2805
|
{
|
|
2325
2806
|
sx: {
|
|
@@ -2347,9 +2828,9 @@ var extendClientSides = (newRenderers) => {
|
|
|
2347
2828
|
};
|
|
2348
2829
|
|
|
2349
2830
|
// src/components/grid/renderers/cellRenderers.tsx
|
|
2350
|
-
var
|
|
2351
|
-
var CeldaDato =
|
|
2352
|
-
const theme = (0,
|
|
2831
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2832
|
+
var CeldaDato = import_react19.default.memo(function CeldaDato2({ row, columnKey, defaultColumn }) {
|
|
2833
|
+
const theme = (0, import_material13.useTheme)();
|
|
2353
2834
|
const { primaryKey, fixedFields, typer, isMandatory, isNumeric } = defaultColumn;
|
|
2354
2835
|
const rowId = getPrimaryKeyValues(row, primaryKey);
|
|
2355
2836
|
const currentCellFeedback = useFeedbackCelda(`${rowId}-${columnKey}`);
|
|
@@ -2359,7 +2840,7 @@ var CeldaDato = import_react15.default.memo(function CeldaDato2({ row, columnKey
|
|
|
2359
2840
|
let cellBackgroundColor = "transparent";
|
|
2360
2841
|
if (currentCellFeedback) {
|
|
2361
2842
|
cellBackgroundColor = currentCellFeedback.type === "error" ? theme.palette.error.light : theme.palette.success.light;
|
|
2362
|
-
} else if (fixedFields
|
|
2843
|
+
} else if (valorFijoDe(fixedFields, columnKey)) {
|
|
2363
2844
|
cellBackgroundColor = theme.palette.action.selected;
|
|
2364
2845
|
} else if (isMandatory && !hasValue || pendiente) {
|
|
2365
2846
|
cellBackgroundColor = "#e3f2fd";
|
|
@@ -2369,7 +2850,7 @@ var CeldaDato = import_react15.default.memo(function CeldaDato2({ row, columnKey
|
|
|
2369
2850
|
displayValue = "* " + displayValue;
|
|
2370
2851
|
}
|
|
2371
2852
|
const signal = displayValue === "--" ? "typed-controls-signal-no-data" : displayValue === "//" ? "typed-controls-signal-unknown-data" : "";
|
|
2372
|
-
const celda = /* @__PURE__ */ (0,
|
|
2853
|
+
const celda = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2373
2854
|
"div",
|
|
2374
2855
|
{
|
|
2375
2856
|
className: `fpr-celda ${isNumeric ? "fpr-celda-numerica" : ""} ${signal} ${row[NEW_ROW_INDICATOR] ? "new-row-cell-animation" : ""}`,
|
|
@@ -2377,13 +2858,13 @@ var CeldaDato = import_react15.default.memo(function CeldaDato2({ row, columnKey
|
|
|
2377
2858
|
children: displayValue
|
|
2378
2859
|
}
|
|
2379
2860
|
);
|
|
2380
|
-
return currentCellFeedback?.message ? /* @__PURE__ */ (0,
|
|
2861
|
+
return currentCellFeedback?.message ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material13.Tooltip, { title: currentCellFeedback.message, children: celda }) : celda;
|
|
2381
2862
|
});
|
|
2382
2863
|
var allColumnsCellRenderer = (props) => {
|
|
2383
2864
|
const { row, column } = props;
|
|
2384
2865
|
if (!esColumnaPropia(column)) return void 0;
|
|
2385
2866
|
if (esFilaDetalle(row)) {
|
|
2386
|
-
return column.customType === "action" ? /* @__PURE__ */ (0,
|
|
2867
|
+
return column.customType === "action" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CeldaDetalle, { fila: row }) : null;
|
|
2387
2868
|
}
|
|
2388
2869
|
switch (column.customType) {
|
|
2389
2870
|
case "default": {
|
|
@@ -2392,15 +2873,15 @@ var allColumnsCellRenderer = (props) => {
|
|
|
2392
2873
|
if (fieldDef?.clientSide) {
|
|
2393
2874
|
const ClientSideComponent = clientSides[fieldDef.clientSide];
|
|
2394
2875
|
if (ClientSideComponent) {
|
|
2395
|
-
return /* @__PURE__ */ (0,
|
|
2876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ClientSideComponent, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
|
|
2396
2877
|
}
|
|
2397
|
-
return /* @__PURE__ */ (0,
|
|
2878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(FallbackClientSideRenderer_default, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
|
|
2398
2879
|
}
|
|
2399
|
-
return /* @__PURE__ */ (0,
|
|
2880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CeldaDato, { row, columnKey: props.column.key, defaultColumn });
|
|
2400
2881
|
}
|
|
2401
2882
|
case "detail": {
|
|
2402
2883
|
const { detailTable, primaryKey } = column;
|
|
2403
|
-
return /* @__PURE__ */ (0,
|
|
2884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2404
2885
|
BotonDetalle,
|
|
2405
2886
|
{
|
|
2406
2887
|
row,
|
|
@@ -2435,8 +2916,8 @@ var allColumnsCellRenderer = (props) => {
|
|
|
2435
2916
|
color: "primary"
|
|
2436
2917
|
}
|
|
2437
2918
|
];
|
|
2438
|
-
return /* @__PURE__ */ (0,
|
|
2439
|
-
|
|
2919
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material13.Box, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%", gap: 0.5 }, children: gridActionButtons.map((actionDef) => tableDefinition.allow[actionDef.action] ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2920
|
+
import_material13.Button,
|
|
2440
2921
|
{
|
|
2441
2922
|
variant: "outlined",
|
|
2442
2923
|
color: actionDef.color,
|
|
@@ -2444,7 +2925,7 @@ var allColumnsCellRenderer = (props) => {
|
|
|
2444
2925
|
onClick: () => actionDef.handler(row),
|
|
2445
2926
|
title: actionDef.title,
|
|
2446
2927
|
sx: { width: 22, minWidth: 22, height: 22, "& .MuiButton-startIcon": { m: 0 } },
|
|
2447
|
-
children: /* @__PURE__ */ (0,
|
|
2928
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(actionDef.icon, { sx: { fontSize: 18 } })
|
|
2448
2929
|
},
|
|
2449
2930
|
actionDef.action
|
|
2450
2931
|
) : null) });
|
|
@@ -2455,14 +2936,13 @@ var allColumnsCellRenderer = (props) => {
|
|
|
2455
2936
|
};
|
|
2456
2937
|
|
|
2457
2938
|
// src/components/grid/InputRenderer.tsx
|
|
2458
|
-
var
|
|
2939
|
+
var import_react21 = __toESM(require("react"), 1);
|
|
2459
2940
|
|
|
2460
2941
|
// src/hooks/useTableRecordSave.ts
|
|
2461
|
-
var
|
|
2942
|
+
var import_react20 = require("react");
|
|
2462
2943
|
var useTableRecordSave = () => {
|
|
2463
2944
|
const { callApi, loading, error } = useApiCall();
|
|
2464
|
-
const saveRecord = (0,
|
|
2465
|
-
tableName,
|
|
2945
|
+
const saveRecord = (0, import_react20.useCallback)(async ({
|
|
2466
2946
|
tableDefinition,
|
|
2467
2947
|
isNewRow,
|
|
2468
2948
|
formData,
|
|
@@ -2491,13 +2971,12 @@ var useTableRecordSave = () => {
|
|
|
2491
2971
|
}
|
|
2492
2972
|
});
|
|
2493
2973
|
}
|
|
2494
|
-
tableDefinition.primaryKey.forEach((pkField) => {
|
|
2495
|
-
rowToSend[pkField] = formData[pkField];
|
|
2496
|
-
});
|
|
2497
2974
|
}
|
|
2498
2975
|
const primaryKeyValuesForBackend = isNewRow ? [] : tableDefinition.primaryKey.map((key) => initialData[key]);
|
|
2499
2976
|
const response = await callApi("table_record_save", {
|
|
2500
|
-
|
|
2977
|
+
// como backend-plus (`depot.def.name`): el servidor busca la definición por este nombre. Una definición que guarda en
|
|
2978
|
+
// otra tabla (`tableName`, con campos de `table`) no existe con el nombre de la física: ahí faltarían sus campos
|
|
2979
|
+
table: tableDefinition.name,
|
|
2501
2980
|
primaryKeyValues: primaryKeyValuesForBackend,
|
|
2502
2981
|
newRow: rowToSend,
|
|
2503
2982
|
oldRow: isNewRow ? {} : initialData,
|
|
@@ -2510,9 +2989,9 @@ var useTableRecordSave = () => {
|
|
|
2510
2989
|
|
|
2511
2990
|
// src/components/grid/InputRenderer.tsx
|
|
2512
2991
|
var import_InputBase = __toESM(require("@mui/material/InputBase"), 1);
|
|
2513
|
-
var
|
|
2992
|
+
var import_material14 = require("@mui/material");
|
|
2514
2993
|
var import_type_store4 = __toESM(require("type-store"), 1);
|
|
2515
|
-
var
|
|
2994
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2516
2995
|
function findChangedValues(oldRowData, newRowData, isNewRow) {
|
|
2517
2996
|
let changes = [];
|
|
2518
2997
|
for (const key in newRowData) {
|
|
@@ -2538,13 +3017,13 @@ function InputRenderer({
|
|
|
2538
3017
|
const setCellFeedbackMap = estadoGrilla.setFeedback;
|
|
2539
3018
|
const setLocalCellChanges = estadoGrilla.setCambiosLocales;
|
|
2540
3019
|
const fieldDefinition = requerido(tableDefinition.fields.find((f) => f.name === column.key), `el campo '${column.key}'`);
|
|
2541
|
-
const typer = (0,
|
|
2542
|
-
const [editingValue, setEditingValue] = (0,
|
|
2543
|
-
const isCommitInProgress =
|
|
2544
|
-
const
|
|
3020
|
+
const typer = (0, import_react21.useMemo)(() => import_type_store4.default.typerFrom(fieldDefinition), [fieldDefinition]);
|
|
3021
|
+
const [editingValue, setEditingValue] = (0, import_react21.useState)(() => row[column.key] !== null ? isNumericType(fieldDefinition?.typeName) ? row[column.key] : typer.toLocalString(row[column.key]) : null);
|
|
3022
|
+
const isCommitInProgress = import_react21.default.useRef(false);
|
|
3023
|
+
const entradaRef = import_react21.default.useRef(null);
|
|
3024
|
+
const theme = (0, import_material14.useTheme)();
|
|
2545
3025
|
const { showSuccess, showError } = useSnackbar();
|
|
2546
3026
|
const { saveRecord } = useTableRecordSave();
|
|
2547
|
-
const tableName = tableDefinition.tableName;
|
|
2548
3027
|
const rowId = getPrimaryKeyValues(row, primaryKey);
|
|
2549
3028
|
const cellKey = `${rowId}-${column.key}`;
|
|
2550
3029
|
const currentCellFeedback = useFeedbackCelda(cellKey);
|
|
@@ -2556,16 +3035,18 @@ function InputRenderer({
|
|
|
2556
3035
|
cellBackgroundColor = currentCellFeedback.type === "error" ? theme.palette.error.light : theme.palette.success.light;
|
|
2557
3036
|
cellBorderColor = currentCellFeedback.type === "error" ? theme.palette.error.main : theme.palette.success.main;
|
|
2558
3037
|
}
|
|
2559
|
-
const initialRowId = (0,
|
|
2560
|
-
const handleCommit = (0,
|
|
3038
|
+
const initialRowId = (0, import_react21.useMemo)(() => getPrimaryKeyValues(row, primaryKey), [row, primaryKey]);
|
|
3039
|
+
const handleCommit = (0, import_react21.useCallback)(async (currentValue, closeEditor, focusNextCell) => {
|
|
2561
3040
|
if (isCommitInProgress.current) return;
|
|
2562
3041
|
isCommitInProgress.current = true;
|
|
2563
3042
|
let processedNewValue;
|
|
2564
3043
|
try {
|
|
2565
|
-
processedNewValue =
|
|
3044
|
+
processedNewValue = tiparEntrada(currentValue, typer);
|
|
2566
3045
|
typer.validateTypedData(processedNewValue);
|
|
2567
3046
|
} catch (err) {
|
|
2568
3047
|
showError(mensajeDeError(err));
|
|
3048
|
+
const claveDeLaCelda = `${getPrimaryKeyValues(row, tableDefinition.primaryKey)}-${column.key}`;
|
|
3049
|
+
setCellFeedbackMap((prev) => new Map(prev).set(claveDeLaCelda, { rowId: getPrimaryKeyValues(row, tableDefinition.primaryKey), columnKey: column.key, type: "error", message: mensajeDeError(err) }));
|
|
2569
3050
|
isCommitInProgress.current = false;
|
|
2570
3051
|
return;
|
|
2571
3052
|
}
|
|
@@ -2622,7 +3103,6 @@ function InputRenderer({
|
|
|
2622
3103
|
}
|
|
2623
3104
|
try {
|
|
2624
3105
|
const response = await saveRecord({
|
|
2625
|
-
tableName,
|
|
2626
3106
|
tableDefinition,
|
|
2627
3107
|
isNewRow,
|
|
2628
3108
|
formData: potentialUpdatedRow,
|
|
@@ -2688,7 +3168,6 @@ function InputRenderer({
|
|
|
2688
3168
|
column,
|
|
2689
3169
|
row,
|
|
2690
3170
|
onRowChange,
|
|
2691
|
-
tableName,
|
|
2692
3171
|
tableDefinition.primaryKey,
|
|
2693
3172
|
tableDefinition.fields,
|
|
2694
3173
|
showSuccess,
|
|
@@ -2700,42 +3179,75 @@ function InputRenderer({
|
|
|
2700
3179
|
initialRowId,
|
|
2701
3180
|
typer
|
|
2702
3181
|
]);
|
|
2703
|
-
const
|
|
3182
|
+
const confirmarEnExpansion = (0, import_react21.useCallback)((nuevo) => {
|
|
3183
|
+
setEditingValue(nuevo);
|
|
3184
|
+
void handleCommit(nuevo, true, false);
|
|
3185
|
+
}, [handleCommit]);
|
|
3186
|
+
const elegirOpcion = (0, import_react21.useCallback)((valor) => {
|
|
3187
|
+
confirmarEnExpansion(valor === null || valor === void 0 ? null : typeof valor === "boolean" || isNumericType(fieldDefinition.typeName) ? valor : typer.toLocalString(valor));
|
|
3188
|
+
}, [fieldDefinition.typeName, typer, confirmarEnExpansion]);
|
|
3189
|
+
const expander = useExpander({
|
|
3190
|
+
campo: fieldDefinition,
|
|
3191
|
+
editable: fieldDefinition.editable !== false,
|
|
3192
|
+
fila: row,
|
|
3193
|
+
admiteNulo: fieldDefinition.nullable !== false,
|
|
3194
|
+
anclaje: entradaRef,
|
|
3195
|
+
textoActual: editingValue === null || editingValue === void 0 ? "" : String(editingValue),
|
|
3196
|
+
valorActual: row[column.key],
|
|
3197
|
+
alElegirValor: elegirOpcion,
|
|
3198
|
+
alConfirmarTexto: confirmarEnExpansion,
|
|
3199
|
+
alFallar: showError
|
|
3200
|
+
});
|
|
3201
|
+
const handleKeyDown = (0, import_react21.useCallback)(async (event) => {
|
|
3202
|
+
if (expander.manejarTecla(event)) return;
|
|
3203
|
+
if (event.key.length === 1 && !event.ctrlKey && !event.altKey && !event.metaKey && caracterRechazado(event.key, typer)) {
|
|
3204
|
+
event.preventDefault();
|
|
3205
|
+
if (expander.tipo === "referencia") void expander.abrir(event.key);
|
|
3206
|
+
return;
|
|
3207
|
+
}
|
|
2704
3208
|
if (event.key === "F4") {
|
|
2705
3209
|
event.preventDefault();
|
|
2706
3210
|
if (onKeyPress) {
|
|
2707
|
-
onKeyPress(rowIdx, column.key, event, handleCommit);
|
|
3211
|
+
onKeyPress(rowIdx, column.key, event, handleCommit, editingValue);
|
|
2708
3212
|
}
|
|
2709
3213
|
return;
|
|
2710
3214
|
}
|
|
2711
|
-
if (
|
|
2712
|
-
|
|
2713
|
-
if (onKeyPress) {
|
|
2714
|
-
onKeyPress(rowIdx, column.key, event, handleCommit);
|
|
2715
|
-
}
|
|
3215
|
+
if (onKeyPress?.(rowIdx, column.key, event, handleCommit, editingValue)) {
|
|
3216
|
+
event.preventDefault();
|
|
2716
3217
|
}
|
|
2717
|
-
}, [handleCommit, editingValue, column.key, rowIdx, onKeyPress]);
|
|
2718
|
-
const procesarTecla =
|
|
3218
|
+
}, [handleCommit, editingValue, column.key, rowIdx, onKeyPress, expander, typer]);
|
|
3219
|
+
const procesarTecla = import_react21.default.useRef(() => {
|
|
2719
3220
|
});
|
|
2720
3221
|
procesarTecla.current = (key) => {
|
|
2721
|
-
if (key === "
|
|
2722
|
-
|
|
3222
|
+
if (key === "F9") {
|
|
3223
|
+
void expander.abrir("");
|
|
3224
|
+
} else if (key === "F4" && onKeyPress) {
|
|
3225
|
+
onKeyPress(rowIdx, column.key, { key, target: document.activeElement ?? document.body }, handleCommit, editingValue);
|
|
2723
3226
|
}
|
|
2724
3227
|
};
|
|
2725
|
-
(0,
|
|
2726
|
-
const handleBlur = (0,
|
|
3228
|
+
(0, import_react21.useEffect)(() => registrarEditor?.((key) => procesarTecla.current(key)), []);
|
|
3229
|
+
const handleBlur = (0, import_react21.useCallback)(() => {
|
|
3230
|
+
if (expander.abierto.current) return;
|
|
2727
3231
|
handleCommit(editingValue, true, false);
|
|
2728
3232
|
}, [handleCommit, editingValue]);
|
|
2729
3233
|
const isFieldEditable = fieldDefinition?.editable !== false;
|
|
2730
3234
|
const isNumeric = isNumericType(fieldDefinition?.typeName);
|
|
2731
|
-
const editor = /* @__PURE__ */ (0,
|
|
3235
|
+
const editor = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2732
3236
|
import_InputBase.default,
|
|
2733
3237
|
{
|
|
2734
3238
|
autoFocus: true,
|
|
2735
3239
|
value: editingValue,
|
|
2736
3240
|
onChange: (e) => setEditingValue(e.target.value),
|
|
2737
3241
|
onKeyDown: handleKeyDown,
|
|
3242
|
+
onPaste: (e) => {
|
|
3243
|
+
const pegado = e.clipboardData.getData("text");
|
|
3244
|
+
if (textoPegadoRechazado(pegado, typer)) {
|
|
3245
|
+
e.preventDefault();
|
|
3246
|
+
showError(`\xAB${pegado}\xBB no es un valor v\xE1lido para este campo (${typer.typeName})`);
|
|
3247
|
+
}
|
|
3248
|
+
},
|
|
2738
3249
|
onBlur: handleBlur,
|
|
3250
|
+
inputRef: entradaRef,
|
|
2739
3251
|
placeholder: isMandatory ? "*" : "",
|
|
2740
3252
|
className: editingValue === "--" ? "typed-controls-signal-no-data" : editingValue === "//" ? "typed-controls-signal-unknown-data" : "",
|
|
2741
3253
|
sx: {
|
|
@@ -2752,15 +3264,20 @@ function InputRenderer({
|
|
|
2752
3264
|
}
|
|
2753
3265
|
},
|
|
2754
3266
|
onClick: (e) => e.stopPropagation(),
|
|
2755
|
-
disabled: !isFieldEditable
|
|
3267
|
+
disabled: !isFieldEditable,
|
|
3268
|
+
endAdornment: expander.lupa
|
|
2756
3269
|
}
|
|
2757
3270
|
);
|
|
2758
|
-
|
|
3271
|
+
const conMenu = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
3272
|
+
editor,
|
|
3273
|
+
expander.ventana
|
|
3274
|
+
] });
|
|
3275
|
+
return currentCellFeedback?.message ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material14.Tooltip, { title: currentCellFeedback.message, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { width: "100%" }, children: conMenu }) }) : conMenu;
|
|
2759
3276
|
}
|
|
2760
3277
|
var InputRenderer_default = InputRenderer;
|
|
2761
3278
|
|
|
2762
3279
|
// src/components/grid/renderers/editCellRenderers.tsx
|
|
2763
|
-
var
|
|
3280
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2764
3281
|
var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
2765
3282
|
const column = props.column;
|
|
2766
3283
|
if (!esColumnaPropia(column)) return void 0;
|
|
@@ -2777,17 +3294,17 @@ var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
|
2777
3294
|
} = defaultColumn;
|
|
2778
3295
|
if (column.editable) {
|
|
2779
3296
|
const fieldDefinition = tableDefinition.fields.find((f) => f.name === column.key);
|
|
2780
|
-
const isFixedField = fixedFields
|
|
3297
|
+
const isFixedField = valorFijoDe(fixedFields, column.key) !== void 0;
|
|
2781
3298
|
const isFieldEditableByUI = fieldDefinition?.editable !== false && !isFixedField;
|
|
2782
3299
|
if (!isFieldEditableByUI) {
|
|
2783
3300
|
return void 0;
|
|
2784
3301
|
}
|
|
2785
|
-
return /* @__PURE__ */ (0,
|
|
3302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2786
3303
|
InputRenderer_default,
|
|
2787
3304
|
{
|
|
2788
3305
|
...props,
|
|
2789
3306
|
tableDefinition,
|
|
2790
|
-
onKeyPress: (rowIndex, columnKey, event, handleCommit) => handleKeyPressInEditor(rowIndex, columnKey, event, allColumns, handleCommit),
|
|
3307
|
+
onKeyPress: (rowIndex, columnKey, event, handleCommit, valorActual) => handleKeyPressInEditor(rowIndex, columnKey, event, allColumns, handleCommit, valorActual),
|
|
2791
3308
|
registrarEditor,
|
|
2792
3309
|
setTableData,
|
|
2793
3310
|
primaryKey
|
|
@@ -2813,6 +3330,10 @@ var calcularAnchosDeColumnas = (tableDefinition, filas) => {
|
|
|
2813
3330
|
const anchos = /* @__PURE__ */ new Map();
|
|
2814
3331
|
const muestra = filas.slice(0, 50);
|
|
2815
3332
|
tableDefinition.fields.forEach((fieldDef) => {
|
|
3333
|
+
if (typeof fieldDef.width === "number" && fieldDef.width > 0) {
|
|
3334
|
+
anchos.set(fieldDef.name, fieldDef.width);
|
|
3335
|
+
return;
|
|
3336
|
+
}
|
|
2816
3337
|
const headerLabel = fieldDef.label || fieldDef.name;
|
|
2817
3338
|
const type = fieldDef.typeName?.toLowerCase() || "";
|
|
2818
3339
|
let typeMinWidth = 60;
|
|
@@ -2850,14 +3371,13 @@ var useGridColumns = ({
|
|
|
2850
3371
|
toggleFilterVisibility,
|
|
2851
3372
|
abrirOpcionesDeGrilla
|
|
2852
3373
|
}) => {
|
|
2853
|
-
const columns = (0,
|
|
3374
|
+
const columns = (0, import_react22.useMemo)(() => {
|
|
2854
3375
|
if (!tableDefinition) return [];
|
|
2855
3376
|
const fieldsToShow = tableDefinition.fields.filter((field) => {
|
|
2856
|
-
|
|
2857
|
-
return !isFixedField && field.visible !== false;
|
|
3377
|
+
return !columnaOcultaPorFixedField(fixedFields, field.name) && field.visible !== false;
|
|
2858
3378
|
});
|
|
2859
3379
|
const defaultColumns = fieldsToShow.map((fieldDef) => {
|
|
2860
|
-
const isFixedField = fixedFields
|
|
3380
|
+
const isFixedField = valorFijoDe(fixedFields, fieldDef.name) !== void 0;
|
|
2861
3381
|
const isFieldEditable = fieldDef.editable !== false && !isFixedField;
|
|
2862
3382
|
const colWidth = anchosCalculados.get(fieldDef.name) ?? estimateTextWidth(fieldDef.label || fieldDef.name) + 20;
|
|
2863
3383
|
const column = {
|
|
@@ -2902,7 +3422,7 @@ var useGridColumns = ({
|
|
|
2902
3422
|
editable: false,
|
|
2903
3423
|
resizable: false,
|
|
2904
3424
|
sortable: false,
|
|
2905
|
-
renderHeaderCell: () =>
|
|
3425
|
+
renderHeaderCell: () => import_react22.default.createElement(ActionsColumnHeaderCell, {
|
|
2906
3426
|
toggleFilterVisibility,
|
|
2907
3427
|
handleDataGridOptions: (e) => abrirOpcionesDeGrilla(e.currentTarget),
|
|
2908
3428
|
handleAddRow,
|
|
@@ -2936,7 +3456,9 @@ var useGridColumns = ({
|
|
|
2936
3456
|
return allColumns.map((col) => ({
|
|
2937
3457
|
...col,
|
|
2938
3458
|
colSpan: col.customType === "action" ? colSpanDetalle : col.colSpan,
|
|
2939
|
-
|
|
3459
|
+
// el editor guarda por su cuenta (Enter, Tab, flechas y, al perder el foco, el clic afuera): con commitOnOutsideClick react-data-grid
|
|
3460
|
+
// lo cierra sin guardar y los menús (F9), que son un modal, cuentan como «afuera»
|
|
3461
|
+
editorOptions: { closeOnExternalRowChange: false, commitOnOutsideClick: false },
|
|
2940
3462
|
renderEditCell: (props) => allColumnsEditCellRenderer(props, allColumns),
|
|
2941
3463
|
renderCell: (props) => allColumnsCellRenderer(props)
|
|
2942
3464
|
}));
|
|
@@ -2945,13 +3467,13 @@ var useGridColumns = ({
|
|
|
2945
3467
|
};
|
|
2946
3468
|
|
|
2947
3469
|
// src/components/grid/ImportDialog.tsx
|
|
2948
|
-
var
|
|
2949
|
-
var
|
|
3470
|
+
var import_react23 = require("react");
|
|
3471
|
+
var import_material15 = require("@mui/material");
|
|
2950
3472
|
var import_FileUpload2 = __toESM(require("@mui/icons-material/FileUpload"), 1);
|
|
2951
|
-
var
|
|
3473
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2952
3474
|
var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
2953
|
-
const [file, setFile] = (0,
|
|
2954
|
-
const [options, setOptions] = (0,
|
|
3475
|
+
const [file, setFile] = (0, import_react23.useState)(null);
|
|
3476
|
+
const [options, setOptions] = (0, import_react23.useState)({
|
|
2955
3477
|
skipUnknownFieldsAtImport: false,
|
|
2956
3478
|
simplificateSpaces: true,
|
|
2957
3479
|
replaceNewLineWithSpace: true
|
|
@@ -2970,16 +3492,16 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
2970
3492
|
onClose();
|
|
2971
3493
|
}
|
|
2972
3494
|
};
|
|
2973
|
-
return /* @__PURE__ */ (0,
|
|
2974
|
-
/* @__PURE__ */ (0,
|
|
2975
|
-
/* @__PURE__ */ (0,
|
|
3495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material15.Dialog, { open, onClose: loading ? void 0 : onClose, maxWidth: "sm", fullWidth: true, children: [
|
|
3496
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material15.DialogTitle, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
3497
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_FileUpload2.default, { color: "primary" }),
|
|
2976
3498
|
"Importar datos desde archivo"
|
|
2977
3499
|
] }),
|
|
2978
|
-
/* @__PURE__ */ (0,
|
|
2979
|
-
/* @__PURE__ */ (0,
|
|
2980
|
-
/* @__PURE__ */ (0,
|
|
2981
|
-
/* @__PURE__ */ (0,
|
|
2982
|
-
|
|
3500
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material15.DialogContent, { dividers: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material15.Stack, { spacing: 3, sx: { mt: 1 }, children: [
|
|
3501
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material15.Box, { children: [
|
|
3502
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material15.Typography, { variant: "subtitle2", gutterBottom: true, fontWeight: "bold", children: "Seleccionar archivo" }),
|
|
3503
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
3504
|
+
import_material15.Box,
|
|
2983
3505
|
{
|
|
2984
3506
|
sx: {
|
|
2985
3507
|
border: "1px dashed",
|
|
@@ -2991,7 +3513,7 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
2991
3513
|
position: "relative"
|
|
2992
3514
|
},
|
|
2993
3515
|
children: [
|
|
2994
|
-
/* @__PURE__ */ (0,
|
|
3516
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2995
3517
|
"input",
|
|
2996
3518
|
{
|
|
2997
3519
|
type: "file",
|
|
@@ -3008,69 +3530,69 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3008
3530
|
}
|
|
3009
3531
|
}
|
|
3010
3532
|
),
|
|
3011
|
-
/* @__PURE__ */ (0,
|
|
3533
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material15.Typography, { variant: "body2", color: file ? "textPrimary" : "textSecondary", children: file ? file.name : "Haz clic aqu\xED para seleccionar un archivo" })
|
|
3012
3534
|
]
|
|
3013
3535
|
}
|
|
3014
3536
|
)
|
|
3015
3537
|
] }),
|
|
3016
|
-
/* @__PURE__ */ (0,
|
|
3017
|
-
/* @__PURE__ */ (0,
|
|
3018
|
-
/* @__PURE__ */ (0,
|
|
3019
|
-
/* @__PURE__ */ (0,
|
|
3020
|
-
/* @__PURE__ */ (0,
|
|
3021
|
-
|
|
3538
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material15.Divider, {}),
|
|
3539
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material15.Box, { children: [
|
|
3540
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material15.Typography, { variant: "subtitle2", gutterBottom: true, fontWeight: "bold", children: "Opciones de importaci\xF3n" }),
|
|
3541
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material15.Stack, { children: [
|
|
3542
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3543
|
+
import_material15.FormControlLabel,
|
|
3022
3544
|
{
|
|
3023
|
-
control: /* @__PURE__ */ (0,
|
|
3024
|
-
|
|
3545
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3546
|
+
import_material15.Checkbox,
|
|
3025
3547
|
{
|
|
3026
3548
|
checked: options.skipUnknownFieldsAtImport,
|
|
3027
3549
|
onChange: handleOptionChange("skipUnknownFieldsAtImport"),
|
|
3028
3550
|
size: "small"
|
|
3029
3551
|
}
|
|
3030
3552
|
),
|
|
3031
|
-
label: /* @__PURE__ */ (0,
|
|
3553
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material15.Typography, { variant: "body2", children: "Omitir campos desconocidos al importar" })
|
|
3032
3554
|
}
|
|
3033
3555
|
),
|
|
3034
|
-
/* @__PURE__ */ (0,
|
|
3035
|
-
|
|
3556
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3557
|
+
import_material15.FormControlLabel,
|
|
3036
3558
|
{
|
|
3037
|
-
control: /* @__PURE__ */ (0,
|
|
3038
|
-
|
|
3559
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3560
|
+
import_material15.Checkbox,
|
|
3039
3561
|
{
|
|
3040
3562
|
checked: options.simplificateSpaces,
|
|
3041
3563
|
onChange: handleOptionChange("simplificateSpaces"),
|
|
3042
3564
|
size: "small"
|
|
3043
3565
|
}
|
|
3044
3566
|
),
|
|
3045
|
-
label: /* @__PURE__ */ (0,
|
|
3567
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material15.Typography, { variant: "body2", children: "Simplificar espacios" })
|
|
3046
3568
|
}
|
|
3047
3569
|
),
|
|
3048
|
-
/* @__PURE__ */ (0,
|
|
3049
|
-
|
|
3570
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3571
|
+
import_material15.FormControlLabel,
|
|
3050
3572
|
{
|
|
3051
|
-
control: /* @__PURE__ */ (0,
|
|
3052
|
-
|
|
3573
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3574
|
+
import_material15.Checkbox,
|
|
3053
3575
|
{
|
|
3054
3576
|
checked: options.replaceNewLineWithSpace,
|
|
3055
3577
|
onChange: handleOptionChange("replaceNewLineWithSpace"),
|
|
3056
3578
|
size: "small"
|
|
3057
3579
|
}
|
|
3058
3580
|
),
|
|
3059
|
-
label: /* @__PURE__ */ (0,
|
|
3581
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material15.Typography, { variant: "body2", children: "Reemplazar saltos de l\xEDnea con espacios" })
|
|
3060
3582
|
}
|
|
3061
3583
|
)
|
|
3062
3584
|
] })
|
|
3063
3585
|
] })
|
|
3064
3586
|
] }) }),
|
|
3065
|
-
/* @__PURE__ */ (0,
|
|
3066
|
-
/* @__PURE__ */ (0,
|
|
3067
|
-
/* @__PURE__ */ (0,
|
|
3068
|
-
|
|
3587
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material15.DialogActions, { sx: { px: 3, py: 2 }, children: [
|
|
3588
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material15.Button, { onClick: onClose, disabled: loading, children: "Cancelar" }),
|
|
3589
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3590
|
+
import_material15.Button,
|
|
3069
3591
|
{
|
|
3070
3592
|
onClick: handleConfirm,
|
|
3071
3593
|
variant: "contained",
|
|
3072
3594
|
disabled: !file || loading,
|
|
3073
|
-
startIcon: /* @__PURE__ */ (0,
|
|
3595
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_FileUpload2.default, {}),
|
|
3074
3596
|
children: loading ? "Procesando..." : "Confirmar Importaci\xF3n"
|
|
3075
3597
|
}
|
|
3076
3598
|
)
|
|
@@ -3079,11 +3601,11 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3079
3601
|
};
|
|
3080
3602
|
|
|
3081
3603
|
// src/components/grid/ExportDialog.tsx
|
|
3082
|
-
var
|
|
3083
|
-
var
|
|
3604
|
+
var import_react24 = require("react");
|
|
3605
|
+
var import_material16 = require("@mui/material");
|
|
3084
3606
|
var XLSX = __toESM(require("xlsx"), 1);
|
|
3085
3607
|
var import_type_store5 = __toESM(require("type-store"), 1);
|
|
3086
|
-
var
|
|
3608
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3087
3609
|
var ExportDialog = ({
|
|
3088
3610
|
open,
|
|
3089
3611
|
onClose,
|
|
@@ -3092,13 +3614,13 @@ var ExportDialog = ({
|
|
|
3092
3614
|
filteredRows,
|
|
3093
3615
|
username = "anonymous"
|
|
3094
3616
|
}) => {
|
|
3095
|
-
const [format, setFormat] = (0,
|
|
3096
|
-
const [options, setOptions] = (0,
|
|
3617
|
+
const [format, setFormat] = (0, import_react24.useState)("xlsx");
|
|
3618
|
+
const [options, setOptions] = (0, import_react24.useState)({
|
|
3097
3619
|
fromOtherTables: true,
|
|
3098
3620
|
readOnly: true,
|
|
3099
3621
|
hiddens: false
|
|
3100
3622
|
});
|
|
3101
|
-
const [isPreparing, setIsPreparing] = (0,
|
|
3623
|
+
const [isPreparing, setIsPreparing] = (0, import_react24.useState)(false);
|
|
3102
3624
|
const handleOptionChange = (event) => {
|
|
3103
3625
|
setOptions({
|
|
3104
3626
|
...options,
|
|
@@ -3228,66 +3750,66 @@ var ExportDialog = ({
|
|
|
3228
3750
|
URL.revokeObjectURL(url);
|
|
3229
3751
|
}, 0);
|
|
3230
3752
|
};
|
|
3231
|
-
return /* @__PURE__ */ (0,
|
|
3232
|
-
/* @__PURE__ */ (0,
|
|
3233
|
-
/* @__PURE__ */ (0,
|
|
3234
|
-
/* @__PURE__ */ (0,
|
|
3235
|
-
/* @__PURE__ */ (0,
|
|
3236
|
-
] }) : /* @__PURE__ */ (0,
|
|
3237
|
-
/* @__PURE__ */ (0,
|
|
3238
|
-
/* @__PURE__ */ (0,
|
|
3239
|
-
/* @__PURE__ */ (0,
|
|
3240
|
-
|
|
3753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material16.Dialog, { open, onClose, maxWidth: "xs", fullWidth: true, children: [
|
|
3754
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.DialogTitle, { children: "Exportar Datos" }),
|
|
3755
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.DialogContent, { children: isPreparing ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material16.Box, { display: "flex", flexDirection: "column", alignItems: "center", py: 4, children: [
|
|
3756
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.CircularProgress, {}),
|
|
3757
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Typography, { sx: { mt: 2 }, children: "Preparando exportaci\xF3n..." })
|
|
3758
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material16.Box, { sx: { mt: 1 }, children: [
|
|
3759
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material16.FormControl, { component: "fieldset", children: [
|
|
3760
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.FormLabel, { component: "legend", children: "Formato" }),
|
|
3761
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3762
|
+
import_material16.RadioGroup,
|
|
3241
3763
|
{
|
|
3242
3764
|
value: format,
|
|
3243
3765
|
onChange: (e) => setFormat(e.target.value),
|
|
3244
3766
|
children: [
|
|
3245
|
-
/* @__PURE__ */ (0,
|
|
3246
|
-
/* @__PURE__ */ (0,
|
|
3247
|
-
/* @__PURE__ */ (0,
|
|
3767
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.FormControlLabel, { value: "xlsx", control: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Radio, {}), label: "Excel (.xlsx)" }),
|
|
3768
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.FormControlLabel, { value: "tab", control: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Radio, {}), label: "Tabulado (.tab | )" }),
|
|
3769
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.FormControlLabel, { value: "csv", control: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Radio, {}), label: "CSV (.csv , )" })
|
|
3248
3770
|
]
|
|
3249
3771
|
}
|
|
3250
3772
|
)
|
|
3251
3773
|
] }),
|
|
3252
|
-
/* @__PURE__ */ (0,
|
|
3253
|
-
/* @__PURE__ */ (0,
|
|
3254
|
-
/* @__PURE__ */ (0,
|
|
3255
|
-
/* @__PURE__ */ (0,
|
|
3256
|
-
|
|
3774
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material16.Box, { sx: { mt: 3 }, children: [
|
|
3775
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Typography, { variant: "subtitle2", gutterBottom: true, children: "Opciones de campos:" }),
|
|
3776
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material16.FormGroup, { children: [
|
|
3777
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3778
|
+
import_material16.FormControlLabel,
|
|
3257
3779
|
{
|
|
3258
|
-
control: /* @__PURE__ */ (0,
|
|
3780
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Checkbox, { checked: options.fromOtherTables, onChange: handleOptionChange, name: "fromOtherTables" }),
|
|
3259
3781
|
label: "Desde otras tablas"
|
|
3260
3782
|
}
|
|
3261
3783
|
),
|
|
3262
|
-
/* @__PURE__ */ (0,
|
|
3263
|
-
|
|
3784
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3785
|
+
import_material16.FormControlLabel,
|
|
3264
3786
|
{
|
|
3265
|
-
control: /* @__PURE__ */ (0,
|
|
3787
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Checkbox, { checked: options.readOnly, onChange: handleOptionChange, name: "readOnly" }),
|
|
3266
3788
|
label: "Solo lectura"
|
|
3267
3789
|
}
|
|
3268
3790
|
),
|
|
3269
|
-
/* @__PURE__ */ (0,
|
|
3270
|
-
|
|
3791
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3792
|
+
import_material16.FormControlLabel,
|
|
3271
3793
|
{
|
|
3272
|
-
control: /* @__PURE__ */ (0,
|
|
3794
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Checkbox, { checked: options.hiddens, onChange: handleOptionChange, name: "hiddens" }),
|
|
3273
3795
|
label: "Ocultos"
|
|
3274
3796
|
}
|
|
3275
3797
|
)
|
|
3276
3798
|
] })
|
|
3277
3799
|
] })
|
|
3278
3800
|
] }) }),
|
|
3279
|
-
/* @__PURE__ */ (0,
|
|
3280
|
-
/* @__PURE__ */ (0,
|
|
3281
|
-
/* @__PURE__ */ (0,
|
|
3801
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material16.DialogActions, { children: [
|
|
3802
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Button, { onClick: onClose, disabled: isPreparing, children: "Cancelar" }),
|
|
3803
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Button, { onClick: handlePrepareExport, variant: "contained", disabled: isPreparing, children: "Descargar" })
|
|
3282
3804
|
] })
|
|
3283
3805
|
] });
|
|
3284
3806
|
};
|
|
3285
3807
|
|
|
3286
3808
|
// src/pages/VerticalEditorPage.tsx
|
|
3287
|
-
var
|
|
3288
|
-
var
|
|
3809
|
+
var import_react25 = require("react");
|
|
3810
|
+
var import_material17 = require("@mui/material");
|
|
3289
3811
|
var import_Close = __toESM(require("@mui/icons-material/Close"), 1);
|
|
3290
|
-
var
|
|
3812
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3291
3813
|
var VerticalEditorPage = ({
|
|
3292
3814
|
tableName,
|
|
3293
3815
|
tableDefinition,
|
|
@@ -3298,20 +3820,20 @@ var VerticalEditorPage = ({
|
|
|
3298
3820
|
onClose
|
|
3299
3821
|
}) => {
|
|
3300
3822
|
const { saveRecord } = useTableRecordSave();
|
|
3301
|
-
const [internalIsNewRow, setInternalIsNewRow] = (0,
|
|
3302
|
-
const [formData, setFormData] = (0,
|
|
3303
|
-
const [lastSavedData, setLastSavedData] = (0,
|
|
3304
|
-
const [validityMap, setValidityMap] = (0,
|
|
3305
|
-
const [globalError, setGlobalError] = (0,
|
|
3306
|
-
const [isSaving, setIsSaving] = (0,
|
|
3307
|
-
const [fieldFeedback, setFieldFeedback] = (0,
|
|
3308
|
-
const feedbackTimersRef = (0,
|
|
3309
|
-
const handleFieldChange = (0,
|
|
3823
|
+
const [internalIsNewRow, setInternalIsNewRow] = (0, import_react25.useState)(isNewRow);
|
|
3824
|
+
const [formData, setFormData] = (0, import_react25.useState)(initialData);
|
|
3825
|
+
const [lastSavedData, setLastSavedData] = (0, import_react25.useState)(initialData);
|
|
3826
|
+
const [validityMap, setValidityMap] = (0, import_react25.useState)({});
|
|
3827
|
+
const [globalError, setGlobalError] = (0, import_react25.useState)(null);
|
|
3828
|
+
const [isSaving, setIsSaving] = (0, import_react25.useState)(false);
|
|
3829
|
+
const [fieldFeedback, setFieldFeedback] = (0, import_react25.useState)({});
|
|
3830
|
+
const feedbackTimersRef = (0, import_react25.useRef)({});
|
|
3831
|
+
const handleFieldChange = (0, import_react25.useCallback)((fieldName, newValue, isValid) => {
|
|
3310
3832
|
setFormData((prev) => ({ ...prev, [fieldName]: newValue }));
|
|
3311
3833
|
setValidityMap((prev) => ({ ...prev, [fieldName]: isValid }));
|
|
3312
3834
|
setGlobalError(null);
|
|
3313
3835
|
}, []);
|
|
3314
|
-
const isFormValid = (0,
|
|
3836
|
+
const isFormValid = (0, import_react25.useMemo)(() => {
|
|
3315
3837
|
for (const key in validityMap) {
|
|
3316
3838
|
if (validityMap[key] === false) return false;
|
|
3317
3839
|
}
|
|
@@ -3324,7 +3846,7 @@ var VerticalEditorPage = ({
|
|
|
3324
3846
|
}
|
|
3325
3847
|
return true;
|
|
3326
3848
|
}, [formData, validityMap, tableDefinition.fields]);
|
|
3327
|
-
const handleCommit = (0,
|
|
3849
|
+
const handleCommit = (0, import_react25.useCallback)(async (fieldName, newValue, isValid) => {
|
|
3328
3850
|
if (!isValid) return;
|
|
3329
3851
|
if (sameValue(newValue, lastSavedData[fieldName])) {
|
|
3330
3852
|
return;
|
|
@@ -3346,7 +3868,6 @@ var VerticalEditorPage = ({
|
|
|
3346
3868
|
setGlobalError(null);
|
|
3347
3869
|
try {
|
|
3348
3870
|
const response = await saveRecord({
|
|
3349
|
-
tableName,
|
|
3350
3871
|
tableDefinition,
|
|
3351
3872
|
isNewRow: internalIsNewRow,
|
|
3352
3873
|
formData: potentialUpdatedRow,
|
|
@@ -3415,21 +3936,21 @@ var VerticalEditorPage = ({
|
|
|
3415
3936
|
tableDefinition,
|
|
3416
3937
|
onSaveSuccess
|
|
3417
3938
|
]);
|
|
3418
|
-
return /* @__PURE__ */ (0,
|
|
3419
|
-
/* @__PURE__ */ (0,
|
|
3420
|
-
/* @__PURE__ */ (0,
|
|
3939
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.Box, { sx: { p: 2, display: "flex", flexDirection: "column", height: "100%" }, children: [
|
|
3940
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.DialogTitle, { sx: { px: 0, pt: 0, display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
3941
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.Typography, { component: "div", variant: "h6", children: [
|
|
3421
3942
|
isNewRow ? "Nuevo Registro" : "Editar Registro",
|
|
3422
3943
|
" - ",
|
|
3423
3944
|
tableDefinition.title || tableName
|
|
3424
3945
|
] }),
|
|
3425
|
-
/* @__PURE__ */ (0,
|
|
3946
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.IconButton, { onClick: onClose, size: "small", edge: "end", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_Close.default, {}) })
|
|
3426
3947
|
] }),
|
|
3427
|
-
/* @__PURE__ */ (0,
|
|
3428
|
-
globalError && /* @__PURE__ */ (0,
|
|
3429
|
-
/* @__PURE__ */ (0,
|
|
3948
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.DialogContent, { dividers: true, sx: { px: 2, flexGrow: 1, py: 1 }, children: [
|
|
3949
|
+
globalError && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Alert, { severity: "error", sx: { mb: 2 }, children: globalError }),
|
|
3950
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Box, { sx: { display: "flex", flexDirection: "column", gap: 0.5 }, children: tableDefinition.fields.map((field) => {
|
|
3430
3951
|
const isFixed = fixedFields?.some((ff) => ff.fieldName === field.name);
|
|
3431
3952
|
const isMandatory = field.nullable === false || tableDefinition.primaryKey.includes(field.name);
|
|
3432
|
-
return /* @__PURE__ */ (0,
|
|
3953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Box, { sx: { width: "100%", maxWidth: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3433
3954
|
TypedField,
|
|
3434
3955
|
{
|
|
3435
3956
|
fieldDef: field,
|
|
@@ -3443,23 +3964,90 @@ var VerticalEditorPage = ({
|
|
|
3443
3964
|
) }, field.name);
|
|
3444
3965
|
}) })
|
|
3445
3966
|
] }),
|
|
3446
|
-
/* @__PURE__ */ (0,
|
|
3447
|
-
/* @__PURE__ */ (0,
|
|
3448
|
-
isSaving && /* @__PURE__ */ (0,
|
|
3449
|
-
/* @__PURE__ */ (0,
|
|
3967
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.DialogActions, { sx: { px: 0, pb: 0, pt: 2, justifyContent: "space-between", alignItems: "center" }, children: [
|
|
3968
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.Box, { children: [
|
|
3969
|
+
isSaving && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.CircularProgress, { size: 20, sx: { ml: 2 } }),
|
|
3970
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { marginLeft: 10, fontSize: "0.8rem", color: "#666" }, children: isSaving ? "Guardando..." : "Cambios auto-guardados" })
|
|
3450
3971
|
] }),
|
|
3451
|
-
/* @__PURE__ */ (0,
|
|
3972
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Button, { variant: "outlined", onClick: onClose, children: "Cerrar" })
|
|
3452
3973
|
] })
|
|
3453
3974
|
] });
|
|
3454
3975
|
};
|
|
3455
3976
|
|
|
3977
|
+
// src/utils/parametrosDeTabla.ts
|
|
3978
|
+
var import_json4all2 = __toESM(require("json4all"), 1);
|
|
3979
|
+
function esRegistro(valor) {
|
|
3980
|
+
return typeof valor === "object" && valor !== null && !Array.isArray(valor) && !(valor instanceof Date);
|
|
3981
|
+
}
|
|
3982
|
+
var CODIFICADOS = ["ff", "fc", "td", "pf"];
|
|
3983
|
+
function parametrosDeDireccion(direccion) {
|
|
3984
|
+
const resultado = {};
|
|
3985
|
+
direccion.split("&").forEach((par) => {
|
|
3986
|
+
const sinMarca = par.replace(/^[#?]/, "");
|
|
3987
|
+
const igual = sinMarca.indexOf("=");
|
|
3988
|
+
if (igual === -1) return;
|
|
3989
|
+
const nombre = sinMarca.slice(0, igual);
|
|
3990
|
+
try {
|
|
3991
|
+
const texto = decodeURIComponent(sinMarca.slice(igual + 1));
|
|
3992
|
+
resultado[nombre] = CODIFICADOS.includes(nombre) ? import_json4all2.default.parse(texto) : texto;
|
|
3993
|
+
} catch (err) {
|
|
3994
|
+
console.warn(`No se pudo interpretar el par\xE1metro '${nombre}' de la direcci\xF3n:`, err);
|
|
3995
|
+
}
|
|
3996
|
+
});
|
|
3997
|
+
return resultado;
|
|
3998
|
+
}
|
|
3999
|
+
function aFixedFields(valor) {
|
|
4000
|
+
if (Array.isArray(valor)) {
|
|
4001
|
+
return valor.flatMap((par) => {
|
|
4002
|
+
if (!esRegistro(par) || typeof par.fieldName !== "string") return [];
|
|
4003
|
+
const fixedField = { fieldName: par.fieldName, value: par.value };
|
|
4004
|
+
if (par.until !== void 0) fixedField.until = par.until;
|
|
4005
|
+
if (typeof par.range === "boolean") fixedField.range = par.range;
|
|
4006
|
+
if (typeof par.show === "boolean") fixedField.show = par.show;
|
|
4007
|
+
return [fixedField];
|
|
4008
|
+
});
|
|
4009
|
+
}
|
|
4010
|
+
if (esRegistro(valor)) return Object.entries(valor).map(([fieldName, value]) => ({ fieldName, value }));
|
|
4011
|
+
return [];
|
|
4012
|
+
}
|
|
4013
|
+
function aFiltrosIniciales(valor) {
|
|
4014
|
+
if (!Array.isArray(valor) || valor.length === 0) return [];
|
|
4015
|
+
const filas = Array.isArray(valor[0]) ? valor : [valor];
|
|
4016
|
+
return filas.map((fila) => Array.isArray(fila) ? fila.flatMap((condicion) => {
|
|
4017
|
+
if (!esRegistro(condicion) || typeof condicion.operator !== "string") return [];
|
|
4018
|
+
const columna = condicion.column ?? condicion.fieldName;
|
|
4019
|
+
return typeof columna === "string" ? [{ column: columna, operator: condicion.operator, value: condicion.value }] : [];
|
|
4020
|
+
}) : []).filter((fila) => fila.length > 0);
|
|
4021
|
+
}
|
|
4022
|
+
function parametrosDeTabla(item, direccion) {
|
|
4023
|
+
const origen = { ...item, ...parametrosDeDireccion(direccion) };
|
|
4024
|
+
const parametros = {};
|
|
4025
|
+
const fixedFields = aFixedFields(origen.ff ?? origen.fixedFields);
|
|
4026
|
+
if (fixedFields.length > 0) parametros.fixedFields = fixedFields;
|
|
4027
|
+
const filterColumns = aFiltrosIniciales(origen.fc);
|
|
4028
|
+
if (filterColumns.length > 0) parametros.filterColumns = filterColumns;
|
|
4029
|
+
if (esRegistro(origen.td)) parametros.tableDef = origen.td;
|
|
4030
|
+
if (esRegistro(origen.pf)) parametros.parameterFunctions = origen.pf;
|
|
4031
|
+
if (typeof origen.pick === "string") parametros.pick = origen.pick;
|
|
4032
|
+
if (typeof origen.label === "string") parametros.label = origen.label;
|
|
4033
|
+
return parametros;
|
|
4034
|
+
}
|
|
4035
|
+
function fusionar(base, cambios) {
|
|
4036
|
+
const resultado = { ...base };
|
|
4037
|
+
for (const [clave, valor] of Object.entries(cambios)) {
|
|
4038
|
+
const actual = Reflect.get(resultado, clave);
|
|
4039
|
+
Reflect.set(resultado, clave, esRegistro(actual) && esRegistro(valor) ? fusionar(actual, valor) : valor);
|
|
4040
|
+
}
|
|
4041
|
+
return resultado;
|
|
4042
|
+
}
|
|
4043
|
+
|
|
3456
4044
|
// src/rutaBase.ts
|
|
3457
4045
|
var import_meta2 = {};
|
|
3458
4046
|
var baseDelBundler = import_meta2.env?.BASE_URL ?? "/";
|
|
3459
4047
|
var rutaBase = baseDelBundler.replace(/\/+$/, "");
|
|
3460
4048
|
|
|
3461
4049
|
// src/components/grid/GenericDataGrid.tsx
|
|
3462
|
-
var
|
|
4050
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3463
4051
|
var SUMMARY_ROW_HEIGHT = 35;
|
|
3464
4052
|
var FILTER_ROW_HEIGHT = 35;
|
|
3465
4053
|
var HEADER_ROW_HEIGHT = 30;
|
|
@@ -3478,9 +4066,9 @@ var esColumnaPropia = (columna) => "customType" in columna;
|
|
|
3478
4066
|
var SIN_ANCESTROS = [];
|
|
3479
4067
|
var cargasEnCurso = /* @__PURE__ */ new Map();
|
|
3480
4068
|
var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
3481
|
-
const theme = (0,
|
|
4069
|
+
const theme = (0, import_material18.useTheme)();
|
|
3482
4070
|
const { tableDefinition, row } = ancestor;
|
|
3483
|
-
const columns = (0,
|
|
4071
|
+
const columns = (0, import_react26.useMemo)(() => {
|
|
3484
4072
|
const filteredFields = tableDefinition.fields.filter(
|
|
3485
4073
|
(field) => !fieldsToHide?.some((ff) => ff.fieldName === field.name)
|
|
3486
4074
|
);
|
|
@@ -3491,8 +4079,8 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
3491
4079
|
name: field.label || cambiarGuionesBajosPorEspacios(field.name),
|
|
3492
4080
|
width: 150,
|
|
3493
4081
|
editable: false,
|
|
3494
|
-
renderHeaderCell: () => /* @__PURE__ */ (0,
|
|
3495
|
-
|
|
4082
|
+
renderHeaderCell: () => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Box, { sx: { p: 0.5, height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4083
|
+
import_material18.Typography,
|
|
3496
4084
|
{
|
|
3497
4085
|
variant: "caption",
|
|
3498
4086
|
sx: {
|
|
@@ -3503,11 +4091,11 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
3503
4091
|
children: field.label || cambiarGuionesBajosPorEspacios(field.name)
|
|
3504
4092
|
}
|
|
3505
4093
|
) }),
|
|
3506
|
-
renderCell: (props) => /* @__PURE__ */ (0,
|
|
4094
|
+
renderCell: (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Box, { sx: { px: 1, height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Typography, { variant: "body2", sx: { fontSize: "0.875rem" }, noWrap: true, children: String(props.row[field.name] ?? "") }) })
|
|
3507
4095
|
};
|
|
3508
4096
|
});
|
|
3509
4097
|
}, [tableDefinition, fieldsToHide]);
|
|
3510
|
-
return /* @__PURE__ */ (0,
|
|
4098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: {
|
|
3511
4099
|
mb: 1.5,
|
|
3512
4100
|
ml: index * 4,
|
|
3513
4101
|
// El primer ancestro (index 0) no tiene margen, los siguientes sí
|
|
@@ -3518,7 +4106,7 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
3518
4106
|
boxShadow: theme.shadows[1],
|
|
3519
4107
|
bgcolor: "background.paper"
|
|
3520
4108
|
}, children: [
|
|
3521
|
-
/* @__PURE__ */ (0,
|
|
4109
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Box, { sx: {
|
|
3522
4110
|
bgcolor: "primary.main",
|
|
3523
4111
|
color: "primary.contrastText",
|
|
3524
4112
|
px: 1.5,
|
|
@@ -3529,8 +4117,8 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
3529
4117
|
alignItems: "center",
|
|
3530
4118
|
fontWeight: "bold",
|
|
3531
4119
|
gap: 1
|
|
3532
|
-
}, children: /* @__PURE__ */ (0,
|
|
3533
|
-
/* @__PURE__ */ (0,
|
|
4120
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Typography, { variant: "subtitle2", component: "div", children: cambiarGuionesBajosPorEspacios(ancestor.tableName) }) }),
|
|
4121
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3534
4122
|
import_react_data_grid.DataGrid,
|
|
3535
4123
|
{
|
|
3536
4124
|
className: "rdg-light",
|
|
@@ -3547,6 +4135,10 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
3547
4135
|
var GenericDataGrid = ({
|
|
3548
4136
|
tableName,
|
|
3549
4137
|
fixedFields: fixedFieldsRecibidos,
|
|
4138
|
+
filterColumns: filterColumnsRecibidos,
|
|
4139
|
+
tableDef: tableDefRecibido,
|
|
4140
|
+
parameterFunctions: parameterFunctionsRecibido,
|
|
4141
|
+
pick: pickRecibido,
|
|
3550
4142
|
gridStyles,
|
|
3551
4143
|
onOpenDetail,
|
|
3552
4144
|
ancestors = SIN_ANCESTROS,
|
|
@@ -3559,36 +4151,42 @@ var GenericDataGrid = ({
|
|
|
3559
4151
|
altoMaximoDetalle
|
|
3560
4152
|
}) => {
|
|
3561
4153
|
const claveFixedFields = JSON.stringify(fixedFieldsRecibidos ?? null);
|
|
3562
|
-
const fixedFields = (0,
|
|
3563
|
-
const
|
|
3564
|
-
const
|
|
4154
|
+
const fixedFields = (0, import_react26.useMemo)(() => fixedFieldsRecibidos, [claveFixedFields]);
|
|
4155
|
+
const claveParametros = JSON.stringify([filterColumnsRecibidos ?? null, tableDefRecibido ?? null, parameterFunctionsRecibido ?? null, pickRecibido ?? null]);
|
|
4156
|
+
const parametros = (0, import_react26.useMemo)(
|
|
4157
|
+
() => ({ filterColumns: filterColumnsRecibidos, tableDef: tableDefRecibido, parameterFunctions: parameterFunctionsRecibido, pick: pickRecibido }),
|
|
4158
|
+
[claveParametros]
|
|
4159
|
+
// eslint-disable-line react-hooks/exhaustive-deps
|
|
4160
|
+
);
|
|
4161
|
+
const cacheHeredado = (0, import_react26.useContext)(CacheGrillasContext);
|
|
4162
|
+
const [cachePropio] = (0, import_react26.useState)(() => /* @__PURE__ */ new Map());
|
|
3565
4163
|
const cache = cacheHeredado ?? cachePropio;
|
|
3566
|
-
const [guardada] = (0,
|
|
3567
|
-
const claveCargadaRef = (0,
|
|
3568
|
-
const [tableDefinition, setTableDefinition] = (0,
|
|
3569
|
-
const [tableData, setTableData] = (0,
|
|
3570
|
-
const [cargandoInicial, setCargandoInicial] = (0,
|
|
3571
|
-
const [errorDeCarga, setErrorDeCarga] = (0,
|
|
3572
|
-
const [anchosCalculados, setAnchosCalculados] = (0,
|
|
3573
|
-
const [detallesAbiertos, setDetallesAbiertos] = (0,
|
|
3574
|
-
const [altosDetalle, setAltosDetalle] = (0,
|
|
3575
|
-
const [anchosDetalle, setAnchosDetalle] = (0,
|
|
3576
|
-
const [selectedRows, setSelectedRows] = (0,
|
|
3577
|
-
const [, setSelectedCell] = (0,
|
|
3578
|
-
const [estadoGrilla] = (0,
|
|
3579
|
-
const theme = (0,
|
|
3580
|
-
const [openDataGridOptions, setOpenDataGridOptions] = (0,
|
|
3581
|
-
const [dataGridOptionsAnchorEl, setDataGridOptionsAnchorEl] = (0,
|
|
3582
|
-
const [exitingRowIds, setExitingRowIds] = (0,
|
|
4164
|
+
const [guardada] = (0, import_react26.useState)(() => claveCache ? cache.get(claveCache) : void 0);
|
|
4165
|
+
const claveCargadaRef = (0, import_react26.useRef)(guardada ? `${tableName}|${claveFixedFields}|${claveParametros}` : null);
|
|
4166
|
+
const [tableDefinition, setTableDefinition] = (0, import_react26.useState)(guardada?.tableDefinition ?? null);
|
|
4167
|
+
const [tableData, setTableData] = (0, import_react26.useState)(guardada?.tableData ?? []);
|
|
4168
|
+
const [cargandoInicial, setCargandoInicial] = (0, import_react26.useState)(!guardada);
|
|
4169
|
+
const [errorDeCarga, setErrorDeCarga] = (0, import_react26.useState)(null);
|
|
4170
|
+
const [anchosCalculados, setAnchosCalculados] = (0, import_react26.useState)(() => guardada?.anchosCalculados ?? /* @__PURE__ */ new Map());
|
|
4171
|
+
const [detallesAbiertos, setDetallesAbiertos] = (0, import_react26.useState)(guardada?.detallesAbiertos ?? []);
|
|
4172
|
+
const [altosDetalle, setAltosDetalle] = (0, import_react26.useState)(() => guardada?.altosDetalle ?? /* @__PURE__ */ new Map());
|
|
4173
|
+
const [anchosDetalle, setAnchosDetalle] = (0, import_react26.useState)(() => /* @__PURE__ */ new Map());
|
|
4174
|
+
const [selectedRows, setSelectedRows] = (0, import_react26.useState)(() => /* @__PURE__ */ new Set());
|
|
4175
|
+
const [, setSelectedCell] = (0, import_react26.useState)(void 0);
|
|
4176
|
+
const [estadoGrilla] = (0, import_react26.useState)(crearEstadoGrilla);
|
|
4177
|
+
const theme = (0, import_material18.useTheme)();
|
|
4178
|
+
const [openDataGridOptions, setOpenDataGridOptions] = (0, import_react26.useState)(false);
|
|
4179
|
+
const [dataGridOptionsAnchorEl, setDataGridOptionsAnchorEl] = (0, import_react26.useState)(null);
|
|
4180
|
+
const [exitingRowIds, setExitingRowIds] = (0, import_react26.useState)(/* @__PURE__ */ new Set());
|
|
3583
4181
|
const { showError } = useSnackbar();
|
|
3584
4182
|
const { username: usuario } = useClientContext();
|
|
3585
|
-
const dataGridRef = (0,
|
|
3586
|
-
const rowAtEditStartRef = (0,
|
|
3587
|
-
const [openImportDialog, setOpenImportDialog] = (0,
|
|
3588
|
-
const [openExportDialog, setOpenExportDialog] = (0,
|
|
3589
|
-
const [columnWidths, setColumnWidths] = (0,
|
|
4183
|
+
const dataGridRef = (0, import_react26.useRef)(null);
|
|
4184
|
+
const rowAtEditStartRef = (0, import_react26.useRef)(null);
|
|
4185
|
+
const [openImportDialog, setOpenImportDialog] = (0, import_react26.useState)(false);
|
|
4186
|
+
const [openExportDialog, setOpenExportDialog] = (0, import_react26.useState)(false);
|
|
4187
|
+
const [columnWidths, setColumnWidths] = (0, import_react26.useState)(() => /* @__PURE__ */ new Map());
|
|
3590
4188
|
const { callApi, callApiUpload, loading } = useApiCall();
|
|
3591
|
-
const primaryKey = (0,
|
|
4189
|
+
const primaryKey = (0, import_react26.useMemo)(() => {
|
|
3592
4190
|
if (!tableDefinition) return ["id"];
|
|
3593
4191
|
return tableDefinition.primaryKey && tableDefinition.primaryKey.length > 0 ? tableDefinition.primaryKey : ["id"];
|
|
3594
4192
|
}, [tableDefinition]);
|
|
@@ -3602,13 +4200,14 @@ var GenericDataGrid = ({
|
|
|
3602
4200
|
setFilters,
|
|
3603
4201
|
isFilterRowVisible,
|
|
3604
4202
|
toggleFilterVisibility,
|
|
4203
|
+
aplicarFiltrosIniciales,
|
|
3605
4204
|
filteredRows,
|
|
3606
4205
|
summaryData,
|
|
3607
4206
|
resetView
|
|
3608
4207
|
} = useGridDataView({ tableData, tableDefinition });
|
|
3609
|
-
const abiertos = (0,
|
|
3610
|
-
const filasDetalleRef = (0,
|
|
3611
|
-
const filasMostradas = (0,
|
|
4208
|
+
const abiertos = (0, import_react26.useMemo)(() => new Set(detallesAbiertos), [detallesAbiertos]);
|
|
4209
|
+
const filasDetalleRef = (0, import_react26.useRef)(/* @__PURE__ */ new Map());
|
|
4210
|
+
const filasMostradas = (0, import_react26.useMemo)(() => {
|
|
3612
4211
|
const detailTables = tableDefinition?.detailTables ?? [];
|
|
3613
4212
|
if (abiertos.size === 0 || detailTables.length === 0) return filteredRows;
|
|
3614
4213
|
const anteriores = filasDetalleRef.current;
|
|
@@ -3635,8 +4234,8 @@ var GenericDataGrid = ({
|
|
|
3635
4234
|
filasDetalleRef.current = nuevas;
|
|
3636
4235
|
return filas;
|
|
3637
4236
|
}, [filteredRows, abiertos, tableDefinition, primaryKey]);
|
|
3638
|
-
const altoDeDetalle = (0,
|
|
3639
|
-
const altoDetalles = (0,
|
|
4237
|
+
const altoDeDetalle = (0, import_react26.useCallback)((clave) => altosDetalle.get(clave) ?? ALTO_INICIAL_DETALLE, [altosDetalle]);
|
|
4238
|
+
const altoDetalles = (0, import_react26.useMemo)(
|
|
3640
4239
|
() => filasMostradas.reduce((total, row) => esFilaDetalle(row) ? total + altoDeDetalle(row.clave) : total, 0),
|
|
3641
4240
|
[filasMostradas, altoDeDetalle]
|
|
3642
4241
|
);
|
|
@@ -3682,6 +4281,13 @@ var GenericDataGrid = ({
|
|
|
3682
4281
|
filasVisiblesMax,
|
|
3683
4282
|
conPie
|
|
3684
4283
|
});
|
|
4284
|
+
const [contenidoDeCelda, setContenidoDeCelda] = (0, import_react26.useState)(null);
|
|
4285
|
+
const verContenido = (0, import_react26.useCallback)((anclaje, texto) => setContenidoDeCelda({ anclaje, texto }), []);
|
|
4286
|
+
const cerrarContenidoDeCelda = (0, import_react26.useCallback)(() => {
|
|
4287
|
+
const anclaje = contenidoDeCelda?.anclaje;
|
|
4288
|
+
setContenidoDeCelda(null);
|
|
4289
|
+
setTimeout(() => anclaje?.focus(), 0);
|
|
4290
|
+
}, [contenidoDeCelda]);
|
|
3685
4291
|
const { handleCellDoubleClick, handleCellClick, handleCellKeyDown, handleCellMouseDown, handleKeyPressInEditor, registrarEditor, handleSelectedCellChange, handleRowsChange } = useGridEvents({
|
|
3686
4292
|
dataGridRef,
|
|
3687
4293
|
filteredRows: filasMostradas,
|
|
@@ -3690,10 +4296,11 @@ var GenericDataGrid = ({
|
|
|
3690
4296
|
tableDefinition,
|
|
3691
4297
|
setSelectedCell,
|
|
3692
4298
|
setTableData,
|
|
3693
|
-
setSortColumns
|
|
4299
|
+
setSortColumns,
|
|
4300
|
+
verContenido
|
|
3694
4301
|
});
|
|
3695
|
-
const tableNameAnteriorRef = (0,
|
|
3696
|
-
(0,
|
|
4302
|
+
const tableNameAnteriorRef = (0, import_react26.useRef)(tableName);
|
|
4303
|
+
(0, import_react26.useEffect)(() => {
|
|
3697
4304
|
if (tableNameAnteriorRef.current === tableName) return;
|
|
3698
4305
|
tableNameAnteriorRef.current = tableName;
|
|
3699
4306
|
setDetallesAbiertos([]);
|
|
@@ -3707,8 +4314,8 @@ var GenericDataGrid = ({
|
|
|
3707
4314
|
setExitingRowIds(/* @__PURE__ */ new Set());
|
|
3708
4315
|
setColumnWidths(/* @__PURE__ */ new Map());
|
|
3709
4316
|
}, [tableName, estadoGrilla, resetView]);
|
|
3710
|
-
(0,
|
|
3711
|
-
const claveCarga = `${tableName}|${claveFixedFields}`;
|
|
4317
|
+
(0, import_react26.useEffect)(() => {
|
|
4318
|
+
const claveCarga = `${tableName}|${claveFixedFields}|${claveParametros}`;
|
|
3712
4319
|
if (claveCargadaRef.current === claveCarga) {
|
|
3713
4320
|
if (guardada) setSortColumns(guardada.sortColumns);
|
|
3714
4321
|
return;
|
|
@@ -3718,7 +4325,7 @@ var GenericDataGrid = ({
|
|
|
3718
4325
|
setCargandoInicial(true);
|
|
3719
4326
|
setErrorDeCarga(null);
|
|
3720
4327
|
try {
|
|
3721
|
-
const clavePedido = `${tableName}|${claveFixedFields}`;
|
|
4328
|
+
const clavePedido = `${tableName}|${claveFixedFields}|${JSON.stringify([parametros.parameterFunctions ?? null, parametros.pick ?? null])}`;
|
|
3722
4329
|
let pedido = cargasEnCurso.get(clavePedido);
|
|
3723
4330
|
if (!pedido) {
|
|
3724
4331
|
const nuevo = (async () => {
|
|
@@ -3732,7 +4339,10 @@ var GenericDataGrid = ({
|
|
|
3732
4339
|
const data2 = requerido(
|
|
3733
4340
|
await callApi("table_data", {
|
|
3734
4341
|
table: tableName,
|
|
3735
|
-
fixedFields: validFixedFields ?? []
|
|
4342
|
+
fixedFields: validFixedFields ?? [],
|
|
4343
|
+
// como backend-plus (TableConnector.getData); solo si vienen, para no cambiarle el pedido a quien no los usa
|
|
4344
|
+
...parametros.parameterFunctions ? { paramfun: parametros.parameterFunctions } : {},
|
|
4345
|
+
...parametros.pick !== void 0 ? { pick: parametros.pick } : {}
|
|
3736
4346
|
}, { isCritical: true }),
|
|
3737
4347
|
`los datos de '${tableName}'`
|
|
3738
4348
|
);
|
|
@@ -3745,13 +4355,17 @@ var GenericDataGrid = ({
|
|
|
3745
4355
|
nuevo.then(sacar, sacar);
|
|
3746
4356
|
pedido = nuevo;
|
|
3747
4357
|
}
|
|
3748
|
-
const { definition, data } = await pedido;
|
|
4358
|
+
const { definition: definicionDelServidor, data } = await pedido;
|
|
3749
4359
|
if (!vigente) return;
|
|
3750
4360
|
claveCargadaRef.current = claveCarga;
|
|
4361
|
+
const definition = parametros.tableDef ? fusionar(definicionDelServidor, parametros.tableDef) : definicionDelServidor;
|
|
3751
4362
|
setTableDefinition(definition);
|
|
3752
4363
|
setSortColumns(getInitialSortColumns(definition));
|
|
3753
4364
|
setAnchosCalculados(calcularAnchosDeColumnas(definition, data));
|
|
3754
4365
|
setTableData(data);
|
|
4366
|
+
const filasDeFiltros = parametros.filterColumns ?? aFiltrosIniciales(definition.filterColumns);
|
|
4367
|
+
if (filasDeFiltros.length > 1) console.warn(`'${tableName}': varias filas de filtros (alternativas) todav\xEDa no est\xE1n soportadas; se aplica la primera`);
|
|
4368
|
+
if (filasDeFiltros.length > 0) aplicarFiltrosIniciales(filasDeFiltros[0], definition);
|
|
3755
4369
|
} catch (err) {
|
|
3756
4370
|
if (!vigente) return;
|
|
3757
4371
|
setTableDefinition(null);
|
|
@@ -3767,12 +4381,12 @@ var GenericDataGrid = ({
|
|
|
3767
4381
|
return () => {
|
|
3768
4382
|
vigente = false;
|
|
3769
4383
|
};
|
|
3770
|
-
}, [tableName, claveFixedFields, fixedFields, showError, callApi, getInitialSortColumns, setSortColumns, guardada]);
|
|
3771
|
-
(0,
|
|
4384
|
+
}, [tableName, claveFixedFields, fixedFields, claveParametros, parametros, showError, callApi, getInitialSortColumns, setSortColumns, aplicarFiltrosIniciales, guardada]);
|
|
4385
|
+
(0, import_react26.useEffect)(() => {
|
|
3772
4386
|
if (!claveCache || !tableDefinition || cargandoInicial) return;
|
|
3773
4387
|
cache.set(claveCache, { tableDefinition, tableData, anchosCalculados, sortColumns, detallesAbiertos, altosDetalle });
|
|
3774
4388
|
}, [cache, claveCache, tableDefinition, tableData, anchosCalculados, sortColumns, detallesAbiertos, altosDetalle, cargandoInicial]);
|
|
3775
|
-
(0,
|
|
4389
|
+
(0, import_react26.useEffect)(() => {
|
|
3776
4390
|
let timer = null;
|
|
3777
4391
|
const desuscribir = estadoGrilla.suscribir(() => {
|
|
3778
4392
|
const hayExitos = Array.from(estadoGrilla.obtenerFeedback().values()).some((f) => f.type === "success");
|
|
@@ -3797,11 +4411,11 @@ var GenericDataGrid = ({
|
|
|
3797
4411
|
if (timer) clearTimeout(timer);
|
|
3798
4412
|
};
|
|
3799
4413
|
}, [estadoGrilla]);
|
|
3800
|
-
const resetSortingDeLaTabla = (0,
|
|
4414
|
+
const resetSortingDeLaTabla = (0, import_react26.useCallback)(() => {
|
|
3801
4415
|
if (tableDefinition) resetSorting(tableDefinition);
|
|
3802
4416
|
}, [tableDefinition, resetSorting]);
|
|
3803
|
-
const abrirImportacion = (0,
|
|
3804
|
-
const abrirExportacion = (0,
|
|
4417
|
+
const abrirImportacion = (0, import_react26.useCallback)(() => setOpenImportDialog(true), []);
|
|
4418
|
+
const abrirExportacion = (0, import_react26.useCallback)(() => setOpenExportDialog(true), []);
|
|
3805
4419
|
const { menuOptions } = useGridMenu({
|
|
3806
4420
|
tableDefinition,
|
|
3807
4421
|
tableName,
|
|
@@ -3812,11 +4426,11 @@ var GenericDataGrid = ({
|
|
|
3812
4426
|
triggerImport: abrirImportacion,
|
|
3813
4427
|
triggerExport: abrirExportacion
|
|
3814
4428
|
});
|
|
3815
|
-
const abrirOpcionesDeGrilla = (0,
|
|
4429
|
+
const abrirOpcionesDeGrilla = (0, import_react26.useCallback)((anchorEl) => {
|
|
3816
4430
|
setDataGridOptionsAnchorEl(anchorEl);
|
|
3817
4431
|
setOpenDataGridOptions(true);
|
|
3818
4432
|
}, []);
|
|
3819
|
-
const editarEnFicha = (0,
|
|
4433
|
+
const editarEnFicha = (0, import_react26.useCallback)((row) => {
|
|
3820
4434
|
rowAtEditStartRef.current = { ...row };
|
|
3821
4435
|
handleVerticalEditRow(row);
|
|
3822
4436
|
}, [handleVerticalEditRow]);
|
|
@@ -3834,7 +4448,7 @@ var GenericDataGrid = ({
|
|
|
3834
4448
|
toggleFilterVisibility,
|
|
3835
4449
|
abrirOpcionesDeGrilla
|
|
3836
4450
|
});
|
|
3837
|
-
const abrirDetalleEnPestana = (0,
|
|
4451
|
+
const abrirDetalleEnPestana = (0, import_react26.useCallback)((row, detailTable) => {
|
|
3838
4452
|
if (!onOpenDetail || !tableDefinition || !detailTable.table) return;
|
|
3839
4453
|
const porCampo = /* @__PURE__ */ new Map();
|
|
3840
4454
|
[...fixedFields ?? [], ...calcularFixedFieldsDetalle(detailTable, row)].forEach((ff) => porCampo.set(ff.fieldName, ff));
|
|
@@ -3844,12 +4458,12 @@ var GenericDataGrid = ({
|
|
|
3844
4458
|
const newAncestors = [...ancestors, { tableName: tableDefinition.name, row, tableDefinition, fixedFields: allFixedFields }];
|
|
3845
4459
|
onOpenDetail(detailTable.table, allFixedFields, label, newAncestors);
|
|
3846
4460
|
}, [onOpenDetail, tableDefinition, fixedFields, ancestors]);
|
|
3847
|
-
const abrirWScreenEnPestana = (0,
|
|
3848
|
-
const
|
|
3849
|
-
calcularFixedFieldsDetalle(detailTable, row).forEach((ff) =>
|
|
3850
|
-
window.open(`${window.location.origin}${rutaBase}/wScreens/${detailTable.wScreen}?${
|
|
4461
|
+
const abrirWScreenEnPestana = (0, import_react26.useCallback)((row, detailTable) => {
|
|
4462
|
+
const parametros2 = new URLSearchParams();
|
|
4463
|
+
calcularFixedFieldsDetalle(detailTable, row).forEach((ff) => parametros2.set(ff.fieldName, String(ff.value)));
|
|
4464
|
+
window.open(`${window.location.origin}${rutaBase}/wScreens/${detailTable.wScreen}?${parametros2}`, "_blank");
|
|
3851
4465
|
}, []);
|
|
3852
|
-
const alternarDetalle = (0,
|
|
4466
|
+
const alternarDetalle = (0, import_react26.useCallback)((row, rowId, detailTable, enOtraPestana) => {
|
|
3853
4467
|
if (enOtraPestana && detailTable.wScreen) {
|
|
3854
4468
|
abrirWScreenEnPestana(row, detailTable);
|
|
3855
4469
|
return;
|
|
@@ -3861,8 +4475,8 @@ var GenericDataGrid = ({
|
|
|
3861
4475
|
const clave = claveDetalle(rowId, detailTable);
|
|
3862
4476
|
setDetallesAbiertos((anteriores) => anteriores.includes(clave) ? anteriores.filter((c) => c !== clave) : [...anteriores, clave]);
|
|
3863
4477
|
}, [onOpenDetail, abrirDetalleEnPestana, abrirWScreenEnPestana]);
|
|
3864
|
-
const [medidas, setMedidas] = (0,
|
|
3865
|
-
(0,
|
|
4478
|
+
const [medidas, setMedidas] = (0, import_react26.useState)(null);
|
|
4479
|
+
(0, import_react26.useEffect)(() => {
|
|
3866
4480
|
const elemento = dataGridRef.current?.element;
|
|
3867
4481
|
if (!elemento) return;
|
|
3868
4482
|
const medir = () => setMedidas((anteriores) => {
|
|
@@ -3875,8 +4489,8 @@ var GenericDataGrid = ({
|
|
|
3875
4489
|
return () => observador.disconnect();
|
|
3876
4490
|
}, [tableDefinition, cargandoInicial]);
|
|
3877
4491
|
const anchoVisible = medidas?.ancho ?? null;
|
|
3878
|
-
const [altoDeVentana, setAltoDeVentana] = (0,
|
|
3879
|
-
(0,
|
|
4492
|
+
const [altoDeVentana, setAltoDeVentana] = (0, import_react26.useState)(null);
|
|
4493
|
+
(0, import_react26.useEffect)(() => {
|
|
3880
4494
|
if (anidada) return;
|
|
3881
4495
|
const elemento = dataGridRef.current?.element;
|
|
3882
4496
|
if (!elemento) return;
|
|
@@ -3885,25 +4499,25 @@ var GenericDataGrid = ({
|
|
|
3885
4499
|
window.addEventListener("resize", calcular);
|
|
3886
4500
|
return () => window.removeEventListener("resize", calcular);
|
|
3887
4501
|
}, [anidada, tableDefinition, cargandoInicial]);
|
|
3888
|
-
const altoDeContexto = (0,
|
|
4502
|
+
const altoDeContexto = (0, import_react26.useContext)(AltoDisponibleContext);
|
|
3889
4503
|
const altoDeEstaGrilla = anidada ? altoDisponible ?? (altoDeContexto === void 0 ? void 0 : altoDeContexto - ALTO_TITULO_ANIDADA) : altoDeVentana ?? void 0;
|
|
3890
4504
|
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,
|
|
4505
|
+
const cambiarAnchoDetalle = (0, import_react26.useCallback)((clave, ancho) => {
|
|
3892
4506
|
setAnchosDetalle((anteriores) => anteriores.get(clave) === ancho ? anteriores : new Map(anteriores).set(clave, ancho));
|
|
3893
4507
|
}, []);
|
|
3894
|
-
const cambiarAltoDetalle = (0,
|
|
4508
|
+
const cambiarAltoDetalle = (0, import_react26.useCallback)((clave, altoDeseado2) => {
|
|
3895
4509
|
const alto = Math.min(Math.max(Math.round(altoDeseado2), ALTO_MINIMO_DETALLE), altoMaximoDetalleEfectivo ?? Infinity);
|
|
3896
4510
|
setAltosDetalle((anteriores) => anteriores.get(clave) === alto ? anteriores : new Map(anteriores).set(clave, alto));
|
|
3897
4511
|
}, [altoMaximoDetalleEfectivo]);
|
|
3898
|
-
const renderDetalle = (0,
|
|
4512
|
+
const renderDetalle = (0, import_react26.useCallback)((fila) => {
|
|
3899
4513
|
const { detailTable } = fila;
|
|
3900
|
-
return /* @__PURE__ */ (0,
|
|
4514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3901
4515
|
"div",
|
|
3902
4516
|
{
|
|
3903
4517
|
className: "fpr-detalle",
|
|
3904
4518
|
style: { maxWidth: anchoVisible ? anchoVisible - 2 : void 0 },
|
|
3905
4519
|
onKeyDown: (e) => e.stopPropagation(),
|
|
3906
|
-
children: detailTable.table ? /* @__PURE__ */ (0,
|
|
4520
|
+
children: detailTable.table ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3907
4521
|
GenericDataGrid,
|
|
3908
4522
|
{
|
|
3909
4523
|
tableName: detailTable.table,
|
|
@@ -3916,7 +4530,7 @@ var GenericDataGrid = ({
|
|
|
3916
4530
|
onOpenDetail,
|
|
3917
4531
|
ancestors: tableDefinition ? [...ancestors, { tableName: tableDefinition.name, row: fila.filaPadre, tableDefinition, fixedFields: fila.fixedFields }] : ancestors
|
|
3918
4532
|
}
|
|
3919
|
-
) : detailTable.wScreen ? /* @__PURE__ */ (0,
|
|
4533
|
+
) : detailTable.wScreen ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3920
4534
|
DetalleWScreen,
|
|
3921
4535
|
{
|
|
3922
4536
|
fila,
|
|
@@ -3924,7 +4538,7 @@ var GenericDataGrid = ({
|
|
|
3924
4538
|
onAlto: (alto) => cambiarAltoDetalle(fila.clave, alto),
|
|
3925
4539
|
onAncho: (ancho) => cambiarAnchoDetalle(fila.clave, ancho)
|
|
3926
4540
|
}
|
|
3927
|
-
) : /* @__PURE__ */ (0,
|
|
4541
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Alert, { severity: "warning", children: [
|
|
3928
4542
|
"El detalle '",
|
|
3929
4543
|
detailTable.abr,
|
|
3930
4544
|
"' no tiene ni tabla ni wScreen."
|
|
@@ -3932,18 +4546,18 @@ var GenericDataGrid = ({
|
|
|
3932
4546
|
}
|
|
3933
4547
|
);
|
|
3934
4548
|
}, [anchoVisible, claveCache, tableName, cambiarAltoDetalle, cambiarAnchoDetalle, altoMaximoDetalleEfectivo, onOpenDetail, tableDefinition, ancestors]);
|
|
3935
|
-
const detallesGrilla = (0,
|
|
4549
|
+
const detallesGrilla = (0, import_react26.useMemo)(() => ({ abiertos, alternarDetalle, renderDetalle }), [abiertos, alternarDetalle, renderDetalle]);
|
|
3936
4550
|
const altoDeseado = cargandoInicial ? ALTO_INICIAL_DETALLE : gridHeight + ALTO_TITULO_ANIDADA + 8;
|
|
3937
|
-
(0,
|
|
4551
|
+
(0, import_react26.useEffect)(() => {
|
|
3938
4552
|
onAltoDeseado?.(altoDeseado);
|
|
3939
4553
|
}, [onAltoDeseado, altoDeseado]);
|
|
3940
|
-
const rowKeyGetter = (0,
|
|
3941
|
-
const rowHeight = (0,
|
|
3942
|
-
const rowClass = (0,
|
|
4554
|
+
const rowKeyGetter = (0, import_react26.useCallback)((row) => esFilaDetalle(row) ? `detalle:${row.clave}` : getPrimaryKeyValues(row, primaryKey), [primaryKey]);
|
|
4555
|
+
const rowHeight = (0, import_react26.useCallback)((row) => esFilaDetalle(row) ? altoDeDetalle(row.clave) : ROW_HEIGHT, [altoDeDetalle]);
|
|
4556
|
+
const rowClass = (0, import_react26.useCallback)(
|
|
3943
4557
|
(row) => esFilaDetalle(row) ? "fpr-fila-detalle" : exitingRowIds.has(getPrimaryKeyValues(row, primaryKey)) ? "fpr-fila-saliendo" : void 0,
|
|
3944
4558
|
[exitingRowIds, primaryKey]
|
|
3945
4559
|
);
|
|
3946
|
-
const anchoContenido = (0,
|
|
4560
|
+
const anchoContenido = (0, import_react26.useMemo)(() => {
|
|
3947
4561
|
if (!anidada || columns.length === 0) return void 0;
|
|
3948
4562
|
const sumaColumnas = columns.reduce((total, col) => {
|
|
3949
4563
|
const medido = columnWidths.get(col.key)?.width;
|
|
@@ -3953,12 +4567,12 @@ var GenericDataGrid = ({
|
|
|
3953
4567
|
const anchoDetalleMax = detallesAbiertos.reduce((max, clave) => Math.max(max, anchosDetalle.get(clave) ?? 0), 0);
|
|
3954
4568
|
return Math.max(ANCHO_MINIMO_ANIDADA, propio, anchoDetalleMax > 0 ? anchoDetalleMax + SANGRIA_DETALLE + (medidas?.barra ?? 0) + 2 : 0);
|
|
3955
4569
|
}, [anidada, columns, columnWidths, medidas?.barra, detallesAbiertos, anchosDetalle]);
|
|
3956
|
-
(0,
|
|
4570
|
+
(0, import_react26.useEffect)(() => {
|
|
3957
4571
|
if (anchoContenido !== void 0) onAnchoDeseado?.(anchoContenido);
|
|
3958
4572
|
}, [onAnchoDeseado, anchoContenido]);
|
|
3959
|
-
const estiloGrilla = (0,
|
|
3960
|
-
const bottomSummaryRows = (0,
|
|
3961
|
-
const vistaGrilla = (0,
|
|
4573
|
+
const estiloGrilla = (0, import_react26.useMemo)(() => ({ height: "100%", width: "100%", boxSizing: "border-box", ...gridStyles }), [gridStyles]);
|
|
4574
|
+
const bottomSummaryRows = (0, import_react26.useMemo)(() => conPie ? [bottomSummaryRow] : [], [conPie, bottomSummaryRow]);
|
|
4575
|
+
const vistaGrilla = (0, import_react26.useMemo)(() => ({ isFilterRowVisible }), [isFilterRowVisible]);
|
|
3962
4576
|
const getFallBackMessage = () => {
|
|
3963
4577
|
if (tableData.length === 0) {
|
|
3964
4578
|
return "No hay filas para mostrar";
|
|
@@ -3970,19 +4584,19 @@ var GenericDataGrid = ({
|
|
|
3970
4584
|
};
|
|
3971
4585
|
const fallBackMessage = getFallBackMessage();
|
|
3972
4586
|
if (cargandoInicial) {
|
|
3973
|
-
return /* @__PURE__ */ (0,
|
|
3974
|
-
/* @__PURE__ */ (0,
|
|
3975
|
-
/* @__PURE__ */ (0,
|
|
4587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: [
|
|
4588
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.CircularProgress, {}),
|
|
4589
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Typography, { variant: "h6", sx: { ml: 2 }, children: "Cargando tabla..." })
|
|
3976
4590
|
] });
|
|
3977
4591
|
}
|
|
3978
4592
|
if (errorDeCarga) {
|
|
3979
|
-
return /* @__PURE__ */ (0,
|
|
4593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Alert, { severity: "error", children: errorDeCarga }) });
|
|
3980
4594
|
}
|
|
3981
4595
|
if (!tableDefinition) {
|
|
3982
|
-
return /* @__PURE__ */ (0,
|
|
4596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Alert, { severity: "warning", children: "No se pudo cargar la definici\xF3n de la tabla." }) });
|
|
3983
4597
|
}
|
|
3984
|
-
return /* @__PURE__ */ (0,
|
|
3985
|
-
!anidada && ancestors.length > 0 && /* @__PURE__ */ (0,
|
|
4598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CacheGrillasContext.Provider, { value: cache, children: /* @__PURE__ */ (0, import_jsx_runtime22.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: [
|
|
4599
|
+
!anidada && ancestors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Box, { sx: { px: 2, pt: 0, pb: 1, display: "flex", flexDirection: "column" }, children: ancestors.map((ancestor, index) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3986
4600
|
StaticAncestorGrid,
|
|
3987
4601
|
{
|
|
3988
4602
|
ancestor,
|
|
@@ -3991,8 +4605,8 @@ var GenericDataGrid = ({
|
|
|
3991
4605
|
},
|
|
3992
4606
|
index
|
|
3993
4607
|
)) }),
|
|
3994
|
-
/* @__PURE__ */ (0,
|
|
3995
|
-
|
|
4608
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
4609
|
+
import_material18.Box,
|
|
3996
4610
|
{
|
|
3997
4611
|
sx: {
|
|
3998
4612
|
backgroundColor: theme.palette.primary.main,
|
|
@@ -4014,17 +4628,17 @@ var GenericDataGrid = ({
|
|
|
4014
4628
|
gap: 1
|
|
4015
4629
|
},
|
|
4016
4630
|
children: [
|
|
4017
|
-
/* @__PURE__ */ (0,
|
|
4631
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Typography, { variant: "subtitle2", component: "div", children: [
|
|
4018
4632
|
titulo ?? cambiarGuionesBajosPorEspacios(tableDefinition.title || tableDefinition.name),
|
|
4019
4633
|
" - ",
|
|
4020
4634
|
filteredRows.length === tableData.length ? `${tableData.length} registros` : `${filteredRows.length} (F)`
|
|
4021
4635
|
] }),
|
|
4022
|
-
loading && /* @__PURE__ */ (0,
|
|
4636
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.CircularProgress, { size: 14, color: "inherit" })
|
|
4023
4637
|
]
|
|
4024
4638
|
}
|
|
4025
4639
|
),
|
|
4026
|
-
/* @__PURE__ */ (0,
|
|
4027
|
-
|
|
4640
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
4641
|
+
import_material18.Box,
|
|
4028
4642
|
{
|
|
4029
4643
|
sx: {
|
|
4030
4644
|
// Una grilla anidada se acota con px (el alto que le dio la de arriba, o el de una wScreen): una wScreen
|
|
@@ -4042,7 +4656,7 @@ var GenericDataGrid = ({
|
|
|
4042
4656
|
pb: anidada ? 0 : 3
|
|
4043
4657
|
},
|
|
4044
4658
|
children: [
|
|
4045
|
-
/* @__PURE__ */ (0,
|
|
4659
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EstadoGrillaContext.Provider, { value: estadoGrilla, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(VistaGrillaContext.Provider, { value: vistaGrilla, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DetallesGrillaContext.Provider, { value: detallesGrilla, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4046
4660
|
import_react_data_grid.DataGrid,
|
|
4047
4661
|
{
|
|
4048
4662
|
className: "rdg-light",
|
|
@@ -4072,8 +4686,8 @@ var GenericDataGrid = ({
|
|
|
4072
4686
|
onCellKeyDown: handleCellKeyDown
|
|
4073
4687
|
}
|
|
4074
4688
|
) }) }) }),
|
|
4075
|
-
fallBackMessage && /* @__PURE__ */ (0,
|
|
4076
|
-
|
|
4689
|
+
fallBackMessage && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4690
|
+
import_material18.Box,
|
|
4077
4691
|
{
|
|
4078
4692
|
sx: {
|
|
4079
4693
|
position: "absolute",
|
|
@@ -4089,13 +4703,13 @@ var GenericDataGrid = ({
|
|
|
4089
4703
|
zIndex: tableData.length === 0 ? 10 : 1
|
|
4090
4704
|
// Mantenemos el zIndex superior para el estado vacío total
|
|
4091
4705
|
},
|
|
4092
|
-
children: /* @__PURE__ */ (0,
|
|
4706
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Typography, { variant: "body2", color: "textSecondary", children: fallBackMessage })
|
|
4093
4707
|
}
|
|
4094
4708
|
)
|
|
4095
4709
|
]
|
|
4096
4710
|
}
|
|
4097
4711
|
),
|
|
4098
|
-
/* @__PURE__ */ (0,
|
|
4712
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4099
4713
|
ExportDialog,
|
|
4100
4714
|
{
|
|
4101
4715
|
open: openExportDialog,
|
|
@@ -4106,7 +4720,7 @@ var GenericDataGrid = ({
|
|
|
4106
4720
|
username: usuario || "anonymous"
|
|
4107
4721
|
}
|
|
4108
4722
|
),
|
|
4109
|
-
/* @__PURE__ */ (0,
|
|
4723
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4110
4724
|
ConfirmDialog,
|
|
4111
4725
|
{
|
|
4112
4726
|
open: openConfirmDialog,
|
|
@@ -4115,7 +4729,7 @@ var GenericDataGrid = ({
|
|
|
4115
4729
|
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
4730
|
}
|
|
4117
4731
|
),
|
|
4118
|
-
/* @__PURE__ */ (0,
|
|
4732
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4119
4733
|
DataGridOptionsDialog,
|
|
4120
4734
|
{
|
|
4121
4735
|
open: openDataGridOptions,
|
|
@@ -4124,7 +4738,7 @@ var GenericDataGrid = ({
|
|
|
4124
4738
|
anchorEl: dataGridOptionsAnchorEl
|
|
4125
4739
|
}
|
|
4126
4740
|
),
|
|
4127
|
-
/* @__PURE__ */ (0,
|
|
4741
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4128
4742
|
ImportDialog,
|
|
4129
4743
|
{
|
|
4130
4744
|
open: openImportDialog,
|
|
@@ -4133,14 +4747,14 @@ var GenericDataGrid = ({
|
|
|
4133
4747
|
loading
|
|
4134
4748
|
}
|
|
4135
4749
|
),
|
|
4136
|
-
/* @__PURE__ */ (0,
|
|
4137
|
-
|
|
4750
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4751
|
+
import_material18.Dialog,
|
|
4138
4752
|
{
|
|
4139
4753
|
open: openVerticalEditDialog,
|
|
4140
4754
|
onClose: () => setOpenVerticalEditDialog(false),
|
|
4141
4755
|
maxWidth: "sm",
|
|
4142
4756
|
fullWidth: true,
|
|
4143
|
-
children: rowToEditVertical && /* @__PURE__ */ (0,
|
|
4757
|
+
children: rowToEditVertical && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4144
4758
|
VerticalEditorPage,
|
|
4145
4759
|
{
|
|
4146
4760
|
tableName,
|
|
@@ -4184,28 +4798,29 @@ var GenericDataGrid = ({
|
|
|
4184
4798
|
}
|
|
4185
4799
|
)
|
|
4186
4800
|
}
|
|
4187
|
-
)
|
|
4801
|
+
),
|
|
4802
|
+
contenidoDeCelda && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(VentanaDeTexto, { anclaje: contenidoDeCelda.anclaje, texto: contenidoDeCelda.texto, editable: false, onAceptar: cerrarContenidoDeCelda, onCerrar: cerrarContenidoDeCelda })
|
|
4188
4803
|
] }) });
|
|
4189
4804
|
};
|
|
4190
4805
|
var GenericDataGrid_default = GenericDataGrid;
|
|
4191
4806
|
|
|
4192
4807
|
// src/App.tsx
|
|
4193
|
-
var
|
|
4808
|
+
var import_react43 = __toESM(require("react"), 1);
|
|
4194
4809
|
var import_react_router_dom15 = require("react-router-dom");
|
|
4195
4810
|
|
|
4196
4811
|
// src/components/MainLayout.tsx
|
|
4197
|
-
var
|
|
4812
|
+
var import_react30 = require("react");
|
|
4198
4813
|
var import_react_router_dom4 = require("react-router-dom");
|
|
4199
|
-
var
|
|
4814
|
+
var import_material20 = require("@mui/material");
|
|
4200
4815
|
|
|
4201
4816
|
// src/contexts/AppContext.tsx
|
|
4202
|
-
var
|
|
4817
|
+
var import_react27 = require("react");
|
|
4203
4818
|
var import_react_router_dom = require("react-router-dom");
|
|
4204
4819
|
var import_react_redux2 = require("react-redux");
|
|
4205
|
-
var
|
|
4206
|
-
var AuthContext = (0,
|
|
4820
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4821
|
+
var AuthContext = (0, import_react27.createContext)(void 0);
|
|
4207
4822
|
var useApp = () => {
|
|
4208
|
-
const context = (0,
|
|
4823
|
+
const context = (0, import_react27.useContext)(AuthContext);
|
|
4209
4824
|
if (!context) {
|
|
4210
4825
|
throw new Error("useApp must be used within an AppProvider");
|
|
4211
4826
|
}
|
|
@@ -4214,15 +4829,15 @@ var useApp = () => {
|
|
|
4214
4829
|
};
|
|
4215
4830
|
var AppProvider = ({ children, publicPaths = [] }) => {
|
|
4216
4831
|
console.log("AppProvider rendered/re-rendered");
|
|
4217
|
-
const [isLoggedIn, setIsLoggedIn] = (0,
|
|
4218
|
-
const [showSessionExpiredMessage, setShowSessionExpiredMessage] = (0,
|
|
4219
|
-
const isRedirectingRef = (0,
|
|
4220
|
-
const huboSesionRef = (0,
|
|
4832
|
+
const [isLoggedIn, setIsLoggedIn] = (0, import_react27.useState)(false);
|
|
4833
|
+
const [showSessionExpiredMessage, setShowSessionExpiredMessage] = (0, import_react27.useState)(false);
|
|
4834
|
+
const isRedirectingRef = (0, import_react27.useRef)(false);
|
|
4835
|
+
const huboSesionRef = (0, import_react27.useRef)(false);
|
|
4221
4836
|
const dispatch = (0, import_react_redux2.useDispatch)();
|
|
4222
4837
|
const clientContext = (0, import_react_redux2.useSelector)((state) => state.clientContext);
|
|
4223
4838
|
if (clientContext.status === "succeeded") huboSesionRef.current = true;
|
|
4224
4839
|
const navigate = (0, import_react_router_dom.useNavigate)();
|
|
4225
|
-
const handleExpiredSessionRedirect = (0,
|
|
4840
|
+
const handleExpiredSessionRedirect = (0, import_react27.useCallback)(() => {
|
|
4226
4841
|
isRedirectingRef.current = true;
|
|
4227
4842
|
setShowSessionExpiredMessage(false);
|
|
4228
4843
|
setIsLoggedIn(false);
|
|
@@ -4232,11 +4847,11 @@ var AppProvider = ({ children, publicPaths = [] }) => {
|
|
|
4232
4847
|
}, 2e3);
|
|
4233
4848
|
}, [navigate]);
|
|
4234
4849
|
const location = (0, import_react_router_dom.useLocation)();
|
|
4235
|
-
const isCurrentPathPublic = (0,
|
|
4850
|
+
const isCurrentPathPublic = (0, import_react27.useCallback)(() => {
|
|
4236
4851
|
const current = location.pathname;
|
|
4237
4852
|
return publicPaths.some((path) => current === path || current.startsWith(`${path}/`));
|
|
4238
4853
|
}, [location.pathname, publicPaths]);
|
|
4239
|
-
const checkSession = (0,
|
|
4854
|
+
const checkSession = (0, import_react27.useCallback)(async () => {
|
|
4240
4855
|
if (isRedirectingRef.current) return;
|
|
4241
4856
|
try {
|
|
4242
4857
|
const response = await fetchApi("/keep-alive.json", { method: "GET" });
|
|
@@ -4274,14 +4889,14 @@ var AppProvider = ({ children, publicPaths = [] }) => {
|
|
|
4274
4889
|
}
|
|
4275
4890
|
}
|
|
4276
4891
|
}, [dispatch, clientContext.status, showSessionExpiredMessage, isCurrentPathPublic]);
|
|
4277
|
-
(0,
|
|
4892
|
+
(0, import_react27.useEffect)(() => {
|
|
4278
4893
|
checkSession();
|
|
4279
4894
|
const intervalId = setInterval(checkSession, 15 * 1e3);
|
|
4280
4895
|
return () => {
|
|
4281
4896
|
clearInterval(intervalId);
|
|
4282
4897
|
};
|
|
4283
4898
|
}, [checkSession]);
|
|
4284
|
-
const authContextValue = (0,
|
|
4899
|
+
const authContextValue = (0, import_react27.useMemo)(() => ({
|
|
4285
4900
|
isLoggedIn,
|
|
4286
4901
|
setIsLoggedIn,
|
|
4287
4902
|
checkSession,
|
|
@@ -4296,7 +4911,7 @@ var AppProvider = ({ children, publicPaths = [] }) => {
|
|
|
4296
4911
|
setShowSessionExpiredMessage,
|
|
4297
4912
|
handleExpiredSessionRedirect
|
|
4298
4913
|
]);
|
|
4299
|
-
return /* @__PURE__ */ (0,
|
|
4914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AuthContext.Provider, { value: authContextValue, children });
|
|
4300
4915
|
};
|
|
4301
4916
|
|
|
4302
4917
|
// src/components/MainLayout.tsx
|
|
@@ -4305,8 +4920,8 @@ var import_Menu = __toESM(require("@mui/icons-material/Menu"), 1);
|
|
|
4305
4920
|
var import_ChevronLeft = __toESM(require("@mui/icons-material/ChevronLeft"), 1);
|
|
4306
4921
|
|
|
4307
4922
|
// src/components/SideMenu.tsx
|
|
4308
|
-
var
|
|
4309
|
-
var
|
|
4923
|
+
var import_react28 = __toESM(require("react"), 1);
|
|
4924
|
+
var import_material19 = require("@mui/material");
|
|
4310
4925
|
var import_ExpandLess = __toESM(require("@mui/icons-material/ExpandLess"), 1);
|
|
4311
4926
|
var import_ExpandMore = __toESM(require("@mui/icons-material/ExpandMore"), 1);
|
|
4312
4927
|
var import_TableChart = __toESM(require("@mui/icons-material/TableChart"), 1);
|
|
@@ -4339,7 +4954,7 @@ function itemInicial(menu) {
|
|
|
4339
4954
|
}
|
|
4340
4955
|
|
|
4341
4956
|
// src/components/SideMenu.tsx
|
|
4342
|
-
var
|
|
4957
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4343
4958
|
var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
4344
4959
|
const navigate = (0, import_react_router_dom2.useNavigate)();
|
|
4345
4960
|
const location = (0, import_react_router_dom2.useLocation)();
|
|
@@ -4358,17 +4973,17 @@ var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
|
4358
4973
|
const getIcon = (item2) => {
|
|
4359
4974
|
switch (item2.menuType) {
|
|
4360
4975
|
case "table":
|
|
4361
|
-
return /* @__PURE__ */ (0,
|
|
4976
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_TableChart.default, { sx: { color: import_colors.blue[700] } });
|
|
4362
4977
|
case "proc":
|
|
4363
|
-
return /* @__PURE__ */ (0,
|
|
4978
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_Dns.default, { sx: { color: import_colors.teal[700] } });
|
|
4364
4979
|
case "menu":
|
|
4365
|
-
return /* @__PURE__ */ (0,
|
|
4980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_Folder.default, { sx: { color: import_colors.orange[800] } });
|
|
4366
4981
|
default:
|
|
4367
4982
|
const WScreenComponent = wScreens[item2.menuType];
|
|
4368
4983
|
if (WScreenComponent !== void 0) {
|
|
4369
|
-
return /* @__PURE__ */ (0,
|
|
4984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_DesktopWindows.default, { sx: { color: import_colors.grey[700] } });
|
|
4370
4985
|
}
|
|
4371
|
-
return /* @__PURE__ */ (0,
|
|
4986
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_WarningAmber3.default, { sx: { color: import_colors.red[500] } });
|
|
4372
4987
|
}
|
|
4373
4988
|
};
|
|
4374
4989
|
const currentPath = location.pathname;
|
|
@@ -4382,27 +4997,27 @@ var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
|
4382
4997
|
} else if (item.menuType !== "menu") {
|
|
4383
4998
|
isSelected = currentPath.startsWith(`/wScreens/${item.menuType}`) || currentPath.startsWith(`/wScreens-fallback/${item.menuType}`);
|
|
4384
4999
|
}
|
|
4385
|
-
const itemRef =
|
|
4386
|
-
(0,
|
|
5000
|
+
const itemRef = import_react28.default.useRef(null);
|
|
5001
|
+
(0, import_react28.useEffect)(() => {
|
|
4387
5002
|
if (isSelected && itemRef.current) {
|
|
4388
5003
|
itemRef.current.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
4389
5004
|
}
|
|
4390
5005
|
}, [isSelected]);
|
|
4391
|
-
return /* @__PURE__ */ (0,
|
|
4392
|
-
/* @__PURE__ */ (0,
|
|
4393
|
-
|
|
5006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { ref: itemRef, children: [
|
|
5007
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
5008
|
+
import_material19.ListItemButton,
|
|
4394
5009
|
{
|
|
4395
5010
|
onClick: handleClick,
|
|
4396
5011
|
sx: { pl: level * 2 },
|
|
4397
5012
|
selected: isSelected,
|
|
4398
5013
|
children: [
|
|
4399
|
-
/* @__PURE__ */ (0,
|
|
4400
|
-
/* @__PURE__ */ (0,
|
|
4401
|
-
item.menuType === "menu" ? open ? /* @__PURE__ */ (0,
|
|
5014
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.ListItemIcon, { sx: { minWidth: "38px" }, children: getIcon(item) }),
|
|
5015
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.ListItemText, { primary: item.label || item.name }),
|
|
5016
|
+
item.menuType === "menu" ? open ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_ExpandLess.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_ExpandMore.default, {}) : null
|
|
4402
5017
|
]
|
|
4403
5018
|
}
|
|
4404
5019
|
),
|
|
4405
|
-
item.menuType === "menu" && /* @__PURE__ */ (0,
|
|
5020
|
+
item.menuType === "menu" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.Collapse, { in: open, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.List, { component: "div", disablePadding: true, children: item.menuContent.map((subItem) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4406
5021
|
MenuListItem,
|
|
4407
5022
|
{
|
|
4408
5023
|
item: subItem,
|
|
@@ -4426,9 +5041,9 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
4426
5041
|
dispatch(setAllSubMenusOpen(!isMostlyOpen));
|
|
4427
5042
|
};
|
|
4428
5043
|
if (!clientContext || !clientContext.menu) {
|
|
4429
|
-
return /* @__PURE__ */ (0,
|
|
5044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.Box, { sx: { p: 2, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.Typography, { variant: "body2", color: "text.secondary", children: "Cargando men\xFA..." }) });
|
|
4430
5045
|
}
|
|
4431
|
-
(0,
|
|
5046
|
+
(0, import_react28.useEffect)(() => {
|
|
4432
5047
|
if (!clientContext?.menu) return;
|
|
4433
5048
|
const expandParents = (items, targetPath, parentNames = []) => {
|
|
4434
5049
|
const pathParts = targetPath.split("/");
|
|
@@ -4457,13 +5072,13 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
4457
5072
|
};
|
|
4458
5073
|
expandParents(clientContext.menu, location.pathname);
|
|
4459
5074
|
}, [location.pathname, clientContext, dispatch]);
|
|
4460
|
-
return /* @__PURE__ */ (0,
|
|
4461
|
-
clientContext.menu.some((item) => item.menuType === "menu") && /* @__PURE__ */ (0,
|
|
4462
|
-
/* @__PURE__ */ (0,
|
|
4463
|
-
/* @__PURE__ */ (0,
|
|
5075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material19.Box, { sx: { width: "100%", flexShrink: 0 }, children: [
|
|
5076
|
+
clientContext.menu.some((item) => item.menuType === "menu") && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.ListItem, { disablePadding: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material19.ListItemButton, { onClick: handleToggleAllSubMenus, children: [
|
|
5077
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.ListItemIcon, { sx: { minWidth: "38px" }, children: isMostlyOpen ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_UnfoldLess.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_UnfoldMore.default, {}) }),
|
|
5078
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.ListItemText, { primary: isMostlyOpen ? "colapsar " : "expandir" })
|
|
4464
5079
|
] }) }),
|
|
4465
|
-
/* @__PURE__ */ (0,
|
|
4466
|
-
/* @__PURE__ */ (0,
|
|
5080
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.Divider, {}),
|
|
5081
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.List, { children: clientContext.menu.map((menuItem) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4467
5082
|
MenuListItem,
|
|
4468
5083
|
{
|
|
4469
5084
|
item: menuItem,
|
|
@@ -4477,14 +5092,14 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
4477
5092
|
var SideMenu_default = SideMenu;
|
|
4478
5093
|
|
|
4479
5094
|
// src/hooks/useLogout.tsx
|
|
4480
|
-
var
|
|
5095
|
+
var import_react29 = require("react");
|
|
4481
5096
|
var import_react_router_dom3 = require("react-router-dom");
|
|
4482
5097
|
var import_react_redux3 = require("react-redux");
|
|
4483
5098
|
var useLogout = () => {
|
|
4484
5099
|
const { setIsLoggedIn } = useApp();
|
|
4485
5100
|
const dispatch = (0, import_react_redux3.useDispatch)();
|
|
4486
5101
|
const navigate = (0, import_react_router_dom3.useNavigate)();
|
|
4487
|
-
const logout = (0,
|
|
5102
|
+
const logout = (0, import_react29.useCallback)(async () => {
|
|
4488
5103
|
try {
|
|
4489
5104
|
const response = await fetchApi("/logout", { method: "GET" });
|
|
4490
5105
|
if (response.status === 401 || response.ok) {
|
|
@@ -4505,16 +5120,16 @@ var useLogout = () => {
|
|
|
4505
5120
|
var useLogout_default = useLogout;
|
|
4506
5121
|
|
|
4507
5122
|
// src/components/MainLayout.tsx
|
|
4508
|
-
var
|
|
5123
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4509
5124
|
var drawerWidth = 240;
|
|
4510
5125
|
var MainLayout = () => {
|
|
4511
5126
|
const { clientContext } = useApp();
|
|
4512
5127
|
const logout = useLogout_default();
|
|
4513
5128
|
const isDrawerOpen = useIsDrawerOpen();
|
|
4514
5129
|
const dispatch = useAppDispatch();
|
|
4515
|
-
const theme = (0,
|
|
4516
|
-
const isMobile = (0,
|
|
4517
|
-
(0,
|
|
5130
|
+
const theme = (0, import_material20.useTheme)();
|
|
5131
|
+
const isMobile = (0, import_material20.useMediaQuery)(theme.breakpoints.down("sm"));
|
|
5132
|
+
(0, import_react30.useEffect)(() => {
|
|
4518
5133
|
if (isMobile && isDrawerOpen) {
|
|
4519
5134
|
dispatch(setDrawerOpen(false));
|
|
4520
5135
|
}
|
|
@@ -4528,12 +5143,12 @@ var MainLayout = () => {
|
|
|
4528
5143
|
}
|
|
4529
5144
|
};
|
|
4530
5145
|
if (!clientContext) {
|
|
4531
|
-
return /* @__PURE__ */ (0,
|
|
5146
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Box, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Typography, { children: "Cargando dise\xF1o de la aplicaci\xF3n..." }) });
|
|
4532
5147
|
}
|
|
4533
|
-
return /* @__PURE__ */ (0,
|
|
4534
|
-
/* @__PURE__ */ (0,
|
|
4535
|
-
/* @__PURE__ */ (0,
|
|
4536
|
-
|
|
5148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material20.Box, { sx: { display: "flex", height: "100vh" }, children: [
|
|
5149
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.CssBaseline, {}),
|
|
5150
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5151
|
+
import_material20.AppBar,
|
|
4537
5152
|
{
|
|
4538
5153
|
position: "fixed",
|
|
4539
5154
|
sx: {
|
|
@@ -4551,9 +5166,9 @@ var MainLayout = () => {
|
|
|
4551
5166
|
})
|
|
4552
5167
|
}
|
|
4553
5168
|
},
|
|
4554
|
-
children: /* @__PURE__ */ (0,
|
|
4555
|
-
/* @__PURE__ */ (0,
|
|
4556
|
-
|
|
5169
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material20.Toolbar, { children: [
|
|
5170
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5171
|
+
import_material20.IconButton,
|
|
4557
5172
|
{
|
|
4558
5173
|
color: "inherit",
|
|
4559
5174
|
"aria-label": "open drawer",
|
|
@@ -4562,10 +5177,10 @@ var MainLayout = () => {
|
|
|
4562
5177
|
sx: {
|
|
4563
5178
|
marginRight: 2
|
|
4564
5179
|
},
|
|
4565
|
-
children: isDrawerOpen ? /* @__PURE__ */ (0,
|
|
5180
|
+
children: isDrawerOpen ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_ChevronLeft.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_Menu.default, {})
|
|
4566
5181
|
}
|
|
4567
5182
|
),
|
|
4568
|
-
!isDrawerOpen && /* @__PURE__ */ (0,
|
|
5183
|
+
!isDrawerOpen && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4569
5184
|
"img",
|
|
4570
5185
|
{
|
|
4571
5186
|
src: `${envConfig.backendUrl}/img/logo-128.png`,
|
|
@@ -4573,22 +5188,22 @@ var MainLayout = () => {
|
|
|
4573
5188
|
style: { height: "32px", marginRight: "12px", objectFit: "contain" }
|
|
4574
5189
|
}
|
|
4575
5190
|
),
|
|
4576
|
-
/* @__PURE__ */ (0,
|
|
4577
|
-
/* @__PURE__ */ (0,
|
|
4578
|
-
/* @__PURE__ */ (0,
|
|
4579
|
-
|
|
5191
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Typography, { variant: "h6", noWrap: true, component: "div", sx: { flexGrow: 1 }, children: isDrawerOpen ? "" : clientContext.config.title }),
|
|
5192
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Typography, { variant: "subtitle1", component: "div", sx: { mr: 2 }, children: clientContext.username }),
|
|
5193
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5194
|
+
import_material20.Button,
|
|
4580
5195
|
{
|
|
4581
5196
|
color: "inherit",
|
|
4582
5197
|
onClick: logout,
|
|
4583
|
-
startIcon: /* @__PURE__ */ (0,
|
|
5198
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_Logout.default, {}),
|
|
4584
5199
|
children: "Salir"
|
|
4585
5200
|
}
|
|
4586
5201
|
)
|
|
4587
5202
|
] })
|
|
4588
5203
|
}
|
|
4589
5204
|
),
|
|
4590
|
-
/* @__PURE__ */ (0,
|
|
4591
|
-
|
|
5205
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
5206
|
+
import_material20.Drawer,
|
|
4592
5207
|
{
|
|
4593
5208
|
variant: "persistent",
|
|
4594
5209
|
anchor: "left",
|
|
@@ -4604,8 +5219,8 @@ var MainLayout = () => {
|
|
|
4604
5219
|
}
|
|
4605
5220
|
},
|
|
4606
5221
|
children: [
|
|
4607
|
-
/* @__PURE__ */ (0,
|
|
4608
|
-
|
|
5222
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
5223
|
+
import_material20.Toolbar,
|
|
4609
5224
|
{
|
|
4610
5225
|
sx: {
|
|
4611
5226
|
display: "flex",
|
|
@@ -4617,7 +5232,7 @@ var MainLayout = () => {
|
|
|
4617
5232
|
gap: 1.5
|
|
4618
5233
|
},
|
|
4619
5234
|
children: [
|
|
4620
|
-
/* @__PURE__ */ (0,
|
|
5235
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4621
5236
|
"img",
|
|
4622
5237
|
{
|
|
4623
5238
|
src: `${envConfig.backendUrl}/img/logo-128.png`,
|
|
@@ -4625,16 +5240,16 @@ var MainLayout = () => {
|
|
|
4625
5240
|
style: { height: "32px", objectFit: "contain" }
|
|
4626
5241
|
}
|
|
4627
5242
|
),
|
|
4628
|
-
/* @__PURE__ */ (0,
|
|
5243
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Typography, { variant: "h6", sx: { fontWeight: "bold" }, children: clientContext.config.title })
|
|
4629
5244
|
]
|
|
4630
5245
|
}
|
|
4631
5246
|
),
|
|
4632
|
-
/* @__PURE__ */ (0,
|
|
5247
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SideMenu_default, { onMenuItemClick: handleDrawerCloseMobile })
|
|
4633
5248
|
]
|
|
4634
5249
|
}
|
|
4635
5250
|
),
|
|
4636
|
-
/* @__PURE__ */ (0,
|
|
4637
|
-
|
|
5251
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
5252
|
+
import_material20.Box,
|
|
4638
5253
|
{
|
|
4639
5254
|
component: "main",
|
|
4640
5255
|
sx: {
|
|
@@ -4660,8 +5275,8 @@ var MainLayout = () => {
|
|
|
4660
5275
|
width: isDrawerOpen ? `calc(100% - ${drawerWidth}px)` : "100%"
|
|
4661
5276
|
},
|
|
4662
5277
|
children: [
|
|
4663
|
-
/* @__PURE__ */ (0,
|
|
4664
|
-
/* @__PURE__ */ (0,
|
|
5278
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Toolbar, {}),
|
|
5279
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Box, { sx: { flex: 1, minHeight: 0, overflowY: "auto", display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_router_dom4.Outlet, {}) })
|
|
4665
5280
|
]
|
|
4666
5281
|
}
|
|
4667
5282
|
)
|
|
@@ -4670,8 +5285,8 @@ var MainLayout = () => {
|
|
|
4670
5285
|
var MainLayout_default = MainLayout;
|
|
4671
5286
|
|
|
4672
5287
|
// src/components/SessionExpiredMessage.tsx
|
|
4673
|
-
var
|
|
4674
|
-
var
|
|
5288
|
+
var import_material21 = require("@mui/material");
|
|
5289
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4675
5290
|
var style = {
|
|
4676
5291
|
position: "absolute",
|
|
4677
5292
|
top: "50%",
|
|
@@ -4690,8 +5305,8 @@ var SessionExpiredMessage = () => {
|
|
|
4690
5305
|
const handleClose = () => {
|
|
4691
5306
|
handleExpiredSessionRedirect();
|
|
4692
5307
|
};
|
|
4693
|
-
return /* @__PURE__ */ (0,
|
|
4694
|
-
|
|
5308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5309
|
+
import_material21.Modal,
|
|
4695
5310
|
{
|
|
4696
5311
|
open: showSessionExpiredMessage,
|
|
4697
5312
|
onClose: () => {
|
|
@@ -4710,10 +5325,10 @@ var SessionExpiredMessage = () => {
|
|
|
4710
5325
|
}
|
|
4711
5326
|
}
|
|
4712
5327
|
},
|
|
4713
|
-
children: /* @__PURE__ */ (0,
|
|
4714
|
-
/* @__PURE__ */ (0,
|
|
4715
|
-
/* @__PURE__ */ (0,
|
|
4716
|
-
/* @__PURE__ */ (0,
|
|
5328
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_material21.Box, { sx: style, children: [
|
|
5329
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Typography, { id: "session-expired-modal-title", variant: "h6", component: "h2", gutterBottom: true, children: "\xA1Sesi\xF3n Expirada!" }),
|
|
5330
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.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." }),
|
|
5331
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Button, { variant: "contained", color: "primary", onClick: handleClose, children: "Ir al Login" })
|
|
4717
5332
|
] })
|
|
4718
5333
|
}
|
|
4719
5334
|
);
|
|
@@ -4722,24 +5337,24 @@ var SessionExpiredMessage_default = SessionExpiredMessage;
|
|
|
4722
5337
|
|
|
4723
5338
|
// src/pages/PantallaInicial.tsx
|
|
4724
5339
|
var import_react_router_dom5 = require("react-router-dom");
|
|
4725
|
-
var
|
|
5340
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4726
5341
|
var PantallaInicial = () => {
|
|
4727
5342
|
const { clientContext } = useApp();
|
|
4728
5343
|
const item = clientContext.menu ? itemInicial(clientContext.menu) : void 0;
|
|
4729
|
-
return item ? /* @__PURE__ */ (0,
|
|
5344
|
+
return item ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_router_dom5.Navigate, { to: rutaDeItemDeMenu(item), replace: true }) : null;
|
|
4730
5345
|
};
|
|
4731
5346
|
var PantallaInicial_default = PantallaInicial;
|
|
4732
5347
|
|
|
4733
5348
|
// src/pages/LogoutPage.tsx
|
|
4734
|
-
var
|
|
4735
|
-
var
|
|
4736
|
-
var
|
|
5349
|
+
var import_react31 = require("react");
|
|
5350
|
+
var import_material22 = require("@mui/material");
|
|
5351
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4737
5352
|
var LogoutPage = () => {
|
|
4738
5353
|
const logout = useLogout_default();
|
|
4739
|
-
(0,
|
|
5354
|
+
(0, import_react31.useEffect)(() => {
|
|
4740
5355
|
logout();
|
|
4741
5356
|
}, [logout]);
|
|
4742
|
-
return /* @__PURE__ */ (0,
|
|
5357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_material22.Box, { sx: {
|
|
4743
5358
|
display: "flex",
|
|
4744
5359
|
flexDirection: "column",
|
|
4745
5360
|
justifyContent: "center",
|
|
@@ -4747,20 +5362,20 @@ var LogoutPage = () => {
|
|
|
4747
5362
|
height: "100vh",
|
|
4748
5363
|
textAlign: "center"
|
|
4749
5364
|
}, children: [
|
|
4750
|
-
/* @__PURE__ */ (0,
|
|
4751
|
-
/* @__PURE__ */ (0,
|
|
5365
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.CircularProgress, { size: 60 }),
|
|
5366
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.Typography, { variant: "h6", sx: { mt: 2 }, children: "Cerrando sesi\xF3n..." })
|
|
4752
5367
|
] });
|
|
4753
5368
|
};
|
|
4754
5369
|
var LogoutPage_default = LogoutPage;
|
|
4755
5370
|
|
|
4756
5371
|
// src/pages/LoginPage.tsx
|
|
4757
|
-
var
|
|
4758
|
-
var
|
|
5372
|
+
var import_react32 = require("react");
|
|
5373
|
+
var import_material23 = require("@mui/material");
|
|
4759
5374
|
var import_react_hook_form = require("react-hook-form");
|
|
4760
5375
|
var import_zod = require("@hookform/resolvers/zod");
|
|
4761
5376
|
var z = __toESM(require("zod"), 1);
|
|
4762
5377
|
var import_react_redux4 = require("react-redux");
|
|
4763
|
-
var
|
|
5378
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4764
5379
|
var loginSchema = z.object({
|
|
4765
5380
|
username: z.string().min(1, "El usuario es requerido"),
|
|
4766
5381
|
// Añadir validación básica
|
|
@@ -4768,8 +5383,8 @@ var loginSchema = z.object({
|
|
|
4768
5383
|
// Añadir validación básica
|
|
4769
5384
|
});
|
|
4770
5385
|
var LoginPage = () => {
|
|
4771
|
-
const [loginError, setLoginError] = (0,
|
|
4772
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
5386
|
+
const [loginError, setLoginError] = (0, import_react32.useState)(null);
|
|
5387
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react32.useState)(false);
|
|
4773
5388
|
const { setIsLoggedIn, checkSession } = useApp();
|
|
4774
5389
|
const dispatch = (0, import_react_redux4.useDispatch)();
|
|
4775
5390
|
const {
|
|
@@ -4814,16 +5429,16 @@ var LoginPage = () => {
|
|
|
4814
5429
|
setIsSubmitting(false);
|
|
4815
5430
|
}
|
|
4816
5431
|
};
|
|
4817
|
-
return /* @__PURE__ */ (0,
|
|
4818
|
-
|
|
5432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5433
|
+
import_material23.Box,
|
|
4819
5434
|
{
|
|
4820
5435
|
display: "flex",
|
|
4821
5436
|
alignItems: "center",
|
|
4822
5437
|
justifyContent: "center",
|
|
4823
5438
|
minHeight: "100vh",
|
|
4824
5439
|
bgcolor: "#f5f5f5",
|
|
4825
|
-
children: /* @__PURE__ */ (0,
|
|
4826
|
-
|
|
5440
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5441
|
+
import_material23.Box,
|
|
4827
5442
|
{
|
|
4828
5443
|
width: "100%",
|
|
4829
5444
|
maxWidth: "400px",
|
|
@@ -4832,7 +5447,7 @@ var LoginPage = () => {
|
|
|
4832
5447
|
borderRadius: 8,
|
|
4833
5448
|
boxShadow: 3,
|
|
4834
5449
|
children: [
|
|
4835
|
-
/* @__PURE__ */ (0,
|
|
5450
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Box, { sx: { display: "flex", justifyContent: "center", mb: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4836
5451
|
"img",
|
|
4837
5452
|
{
|
|
4838
5453
|
src: `${envConfig.backendUrl}/img/login-logo-icon.png`,
|
|
@@ -4840,17 +5455,17 @@ var LoginPage = () => {
|
|
|
4840
5455
|
style: { height: "192px", maxWidth: "100%", objectFit: "contain" }
|
|
4841
5456
|
}
|
|
4842
5457
|
) }),
|
|
4843
|
-
/* @__PURE__ */ (0,
|
|
4844
|
-
/* @__PURE__ */ (0,
|
|
4845
|
-
/* @__PURE__ */ (0,
|
|
4846
|
-
/* @__PURE__ */ (0,
|
|
4847
|
-
/* @__PURE__ */ (0,
|
|
5458
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Typography, { variant: "h5", align: "center", gutterBottom: true, sx: { fontWeight: "bold", color: "primary.main" }, children: "Iniciar Sesi\xF3n" }),
|
|
5459
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("form", { onSubmit: handleSubmit(onSubmit), className: "space-y-4", children: [
|
|
5460
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { children: [
|
|
5461
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("label", { htmlFor: "username", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Typography, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Usuario" }) }),
|
|
5462
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4848
5463
|
import_react_hook_form.Controller,
|
|
4849
5464
|
{
|
|
4850
5465
|
name: "username",
|
|
4851
5466
|
control,
|
|
4852
|
-
render: ({ field }) => /* @__PURE__ */ (0,
|
|
4853
|
-
|
|
5467
|
+
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5468
|
+
import_material23.TextField,
|
|
4854
5469
|
{
|
|
4855
5470
|
...field,
|
|
4856
5471
|
type: "text",
|
|
@@ -4865,15 +5480,15 @@ var LoginPage = () => {
|
|
|
4865
5480
|
}
|
|
4866
5481
|
)
|
|
4867
5482
|
] }),
|
|
4868
|
-
/* @__PURE__ */ (0,
|
|
4869
|
-
/* @__PURE__ */ (0,
|
|
4870
|
-
/* @__PURE__ */ (0,
|
|
5483
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { children: [
|
|
5484
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("label", { htmlFor: "password", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Typography, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Contrase\xF1a" }) }),
|
|
5485
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4871
5486
|
import_react_hook_form.Controller,
|
|
4872
5487
|
{
|
|
4873
5488
|
name: "password",
|
|
4874
5489
|
control,
|
|
4875
|
-
render: ({ field }) => /* @__PURE__ */ (0,
|
|
4876
|
-
|
|
5490
|
+
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5491
|
+
import_material23.TextField,
|
|
4877
5492
|
{
|
|
4878
5493
|
...field,
|
|
4879
5494
|
type: "password",
|
|
@@ -4888,14 +5503,14 @@ var LoginPage = () => {
|
|
|
4888
5503
|
}
|
|
4889
5504
|
)
|
|
4890
5505
|
] }),
|
|
4891
|
-
/* @__PURE__ */ (0,
|
|
4892
|
-
/* @__PURE__ */ (0,
|
|
5506
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Button, { type: "submit", fullWidth: true, variant: "contained", color: "primary", disabled: isSubmitting, sx: { mt: 2 }, children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
5507
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.CircularProgress, { size: 20, sx: { mr: 1 } }),
|
|
4893
5508
|
"Iniciando sesi\xF3n..."
|
|
4894
5509
|
] }) : "Iniciar Sesi\xF3n" })
|
|
4895
5510
|
] }),
|
|
4896
|
-
loginError && /* @__PURE__ */ (0,
|
|
5511
|
+
loginError && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_material23.Alert, { severity: "error", sx: { mt: 2, maxHeight: "200px" }, children: [
|
|
4897
5512
|
" ",
|
|
4898
|
-
/* @__PURE__ */ (0,
|
|
5513
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.AlertTitle, { children: "Error" }),
|
|
4899
5514
|
loginError
|
|
4900
5515
|
] })
|
|
4901
5516
|
]
|
|
@@ -4907,19 +5522,19 @@ var LoginPage = () => {
|
|
|
4907
5522
|
var LoginPage_default = LoginPage;
|
|
4908
5523
|
|
|
4909
5524
|
// src/components/ProcedureForm.tsx
|
|
4910
|
-
var
|
|
5525
|
+
var import_react33 = __toESM(require("react"), 1);
|
|
4911
5526
|
var import_react_router_dom6 = require("react-router-dom");
|
|
4912
|
-
var
|
|
5527
|
+
var import_material25 = require("@mui/material");
|
|
4913
5528
|
|
|
4914
5529
|
// src/pages/procedure-results/SuccessDisplay.tsx
|
|
4915
|
-
var
|
|
4916
|
-
var
|
|
5530
|
+
var import_material24 = require("@mui/material");
|
|
5531
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4917
5532
|
var SuccessDisplay = ({ data }) => {
|
|
4918
|
-
return /* @__PURE__ */ (0,
|
|
4919
|
-
/* @__PURE__ */ (0,
|
|
4920
|
-
/* @__PURE__ */ (0,
|
|
4921
|
-
/* @__PURE__ */ (0,
|
|
4922
|
-
/* @__PURE__ */ (0,
|
|
5533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material24.Paper, { elevation: 2, sx: { p: 2, mt: 2, bgcolor: "success.light", color: "success.contrastText" }, children: [
|
|
5534
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material24.Typography, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: "\xA1Operaci\xF3n Exitosa!" }),
|
|
5535
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material24.Typography, { variant: "body2", sx: { fontSize: "0.85rem" }, children: "Detalles del resultado:" }),
|
|
5536
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material24.Box, { sx: { bgcolor: "success.dark", p: 1, borderRadius: 1, mt: 1, overflowX: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(data, null, 2) }) }),
|
|
5537
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material24.Typography, { variant: "body2", sx: { fontSize: "0.8rem", mt: 1 }, children: "Puedes revisar los detalles anteriores o cerrar este mensaje." })
|
|
4923
5538
|
] });
|
|
4924
5539
|
};
|
|
4925
5540
|
var SuccessDisplay_default = SuccessDisplay;
|
|
@@ -4933,22 +5548,22 @@ var extendResultsOk = (newComponents) => {
|
|
|
4933
5548
|
};
|
|
4934
5549
|
|
|
4935
5550
|
// src/components/ProcedureForm.tsx
|
|
4936
|
-
var
|
|
5551
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4937
5552
|
var ProcedureForm = () => {
|
|
4938
5553
|
const { procedureName } = (0, import_react_router_dom6.useParams)();
|
|
4939
5554
|
const { clientContext } = useApp();
|
|
4940
5555
|
const { callApi, loading: apiLoading, error: apiError } = useApiCall();
|
|
4941
|
-
const [validationErrors, setValidationErrors] = (0,
|
|
4942
|
-
const [successMessage, setSuccessMessage] = (0,
|
|
4943
|
-
const [executionLog, setExecutionLog] = (0,
|
|
4944
|
-
const [procedureResultData, setProcedureResultData] = (0,
|
|
4945
|
-
const procedure = (0,
|
|
5556
|
+
const [validationErrors, setValidationErrors] = (0, import_react33.useState)({});
|
|
5557
|
+
const [successMessage, setSuccessMessage] = (0, import_react33.useState)(null);
|
|
5558
|
+
const [executionLog, setExecutionLog] = (0, import_react33.useState)([]);
|
|
5559
|
+
const [procedureResultData, setProcedureResultData] = (0, import_react33.useState)(null);
|
|
5560
|
+
const procedure = (0, import_react33.useMemo)(() => {
|
|
4946
5561
|
if (procedureName && clientContext?.procedure) {
|
|
4947
5562
|
return clientContext.procedure[procedureName];
|
|
4948
5563
|
}
|
|
4949
5564
|
return void 0;
|
|
4950
5565
|
}, [procedureName, clientContext]);
|
|
4951
|
-
const [formValues, setFormValues] = (0,
|
|
5566
|
+
const [formValues, setFormValues] = (0, import_react33.useState)(() => {
|
|
4952
5567
|
if (!procedure) return {};
|
|
4953
5568
|
const initialValues = {};
|
|
4954
5569
|
procedure.parameters.forEach((param) => {
|
|
@@ -4973,7 +5588,7 @@ var ProcedureForm = () => {
|
|
|
4973
5588
|
});
|
|
4974
5589
|
return initialValues;
|
|
4975
5590
|
});
|
|
4976
|
-
|
|
5591
|
+
import_react33.default.useEffect(() => {
|
|
4977
5592
|
if (procedure) {
|
|
4978
5593
|
setValidationErrors({});
|
|
4979
5594
|
setSuccessMessage(null);
|
|
@@ -5003,11 +5618,11 @@ var ProcedureForm = () => {
|
|
|
5003
5618
|
setExecutionLog([]);
|
|
5004
5619
|
}
|
|
5005
5620
|
}, [procedure]);
|
|
5006
|
-
const addLogMessage = (0,
|
|
5621
|
+
const addLogMessage = (0, import_react33.useCallback)((message, isError = false) => {
|
|
5007
5622
|
const timestamp = (/* @__PURE__ */ new Date()).toLocaleTimeString("es-AR");
|
|
5008
5623
|
setExecutionLog((prev) => [...prev, `[${timestamp}] ${isError ? "ERROR: " : ""}${message}`]);
|
|
5009
5624
|
}, []);
|
|
5010
|
-
const handleChange = (0,
|
|
5625
|
+
const handleChange = (0, import_react33.useCallback)((e, child) => {
|
|
5011
5626
|
const { name, value } = e.target;
|
|
5012
5627
|
let newValue = value;
|
|
5013
5628
|
if (e.target.type === "checkbox") {
|
|
@@ -5129,7 +5744,7 @@ var ProcedureForm = () => {
|
|
|
5129
5744
|
addLogMessage("Ejecuci\xF3n finalizada.");
|
|
5130
5745
|
}
|
|
5131
5746
|
};
|
|
5132
|
-
const renderInputField = (0,
|
|
5747
|
+
const renderInputField = (0, import_react33.useCallback)((param) => {
|
|
5133
5748
|
const hasError = !!validationErrors[param.name];
|
|
5134
5749
|
const errorMessage = validationErrors[param.name];
|
|
5135
5750
|
const commonProps = {
|
|
@@ -5148,10 +5763,10 @@ var ProcedureForm = () => {
|
|
|
5148
5763
|
sx: { fontSize: "0.8rem" }
|
|
5149
5764
|
};
|
|
5150
5765
|
if (param.options && param.options.length > 0) {
|
|
5151
|
-
return /* @__PURE__ */ (0,
|
|
5152
|
-
/* @__PURE__ */ (0,
|
|
5153
|
-
/* @__PURE__ */ (0,
|
|
5154
|
-
|
|
5766
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_material25.FormControl, { fullWidth: true, margin: "dense", size: "small", error: hasError, required: commonProps.required, children: [
|
|
5767
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.InputLabel, { id: `${param.name}-label`, sx: { fontSize: "0.8rem" }, children: param.label || param.name }),
|
|
5768
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
5769
|
+
import_material25.Select,
|
|
5155
5770
|
{
|
|
5156
5771
|
labelId: `${param.name}-label`,
|
|
5157
5772
|
value: formValues[param.name] === void 0 ? "" : formValues[param.name],
|
|
@@ -5161,14 +5776,14 @@ var ProcedureForm = () => {
|
|
|
5161
5776
|
label: param.label || param.name,
|
|
5162
5777
|
disabled: apiLoading,
|
|
5163
5778
|
sx: { fontSize: "0.8rem" },
|
|
5164
|
-
renderValue: (selected) => /* @__PURE__ */ (0,
|
|
5779
|
+
renderValue: (selected) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Typography, { sx: { fontSize: "0.8rem" }, children: selected }),
|
|
5165
5780
|
children: [
|
|
5166
|
-
(!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */ (0,
|
|
5167
|
-
param.options.map((option) => /* @__PURE__ */ (0,
|
|
5781
|
+
(!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.MenuItem, { value: "", sx: { fontSize: "0.8rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("em", { children: "Seleccione..." }) }),
|
|
5782
|
+
param.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.MenuItem, { value: option, sx: { fontSize: "0.8rem" }, children: option }, option))
|
|
5168
5783
|
]
|
|
5169
5784
|
}
|
|
5170
5785
|
),
|
|
5171
|
-
(param.description || errorMessage) && /* @__PURE__ */ (0,
|
|
5786
|
+
(param.description || errorMessage) && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
|
|
5172
5787
|
] });
|
|
5173
5788
|
}
|
|
5174
5789
|
switch (param.typeName) {
|
|
@@ -5177,19 +5792,19 @@ var ProcedureForm = () => {
|
|
|
5177
5792
|
case "tsrange":
|
|
5178
5793
|
case "time_range":
|
|
5179
5794
|
case "daterange":
|
|
5180
|
-
return /* @__PURE__ */ (0,
|
|
5795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.TextField, { type: "text", value: formValues[param.name] || "", ...commonProps });
|
|
5181
5796
|
case "decimal":
|
|
5182
5797
|
case "double":
|
|
5183
|
-
return /* @__PURE__ */ (0,
|
|
5798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.TextField, { type: "number", inputProps: { step: "any", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
|
|
5184
5799
|
case "integer":
|
|
5185
5800
|
case "bigint":
|
|
5186
|
-
return /* @__PURE__ */ (0,
|
|
5801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.TextField, { type: "number", inputProps: { step: "1", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
|
|
5187
5802
|
case "boolean":
|
|
5188
|
-
return /* @__PURE__ */ (0,
|
|
5189
|
-
|
|
5803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5804
|
+
import_material25.FormControlLabel,
|
|
5190
5805
|
{
|
|
5191
|
-
control: /* @__PURE__ */ (0,
|
|
5192
|
-
|
|
5806
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5807
|
+
import_material25.Checkbox,
|
|
5193
5808
|
{
|
|
5194
5809
|
checked: !!formValues[param.name],
|
|
5195
5810
|
onChange: handleChange,
|
|
@@ -5199,21 +5814,21 @@ var ProcedureForm = () => {
|
|
|
5199
5814
|
size: "small"
|
|
5200
5815
|
}
|
|
5201
5816
|
),
|
|
5202
|
-
label: /* @__PURE__ */ (0,
|
|
5817
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Typography, { sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "inherit" }, children: param.label || param.name }),
|
|
5203
5818
|
sx: { mt: 1, mb: 0 }
|
|
5204
5819
|
}
|
|
5205
5820
|
);
|
|
5206
5821
|
case "date":
|
|
5207
5822
|
case "timestamp":
|
|
5208
5823
|
case "time":
|
|
5209
|
-
return /* @__PURE__ */ (0,
|
|
5824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.TextField, { type: param.typeName === "date" ? "date" : param.typeName === "timestamp" ? "datetime-local" : "time", value: formValues[param.name] || "", ...commonProps, InputLabelProps: { shrink: true, sx: { fontSize: "0.8rem" } } });
|
|
5210
5825
|
case "jsonb":
|
|
5211
5826
|
case "jsona":
|
|
5212
|
-
return /* @__PURE__ */ (0,
|
|
5827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.TextField, { multiline: true, rows: 5, value: formValues[param.name] || "", ...commonProps, InputProps: { sx: { fontSize: "0.8rem" } } });
|
|
5213
5828
|
case "bytea":
|
|
5214
|
-
return /* @__PURE__ */ (0,
|
|
5215
|
-
/* @__PURE__ */ (0,
|
|
5216
|
-
/* @__PURE__ */ (0,
|
|
5829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_material25.FormControl, { fullWidth: true, margin: "dense", error: hasError, required: commonProps.required, children: [
|
|
5830
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.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 }),
|
|
5831
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5217
5832
|
"input",
|
|
5218
5833
|
{
|
|
5219
5834
|
type: "file",
|
|
@@ -5227,34 +5842,34 @@ var ProcedureForm = () => {
|
|
|
5227
5842
|
style: { padding: "6px 0", fontSize: "0.8rem" }
|
|
5228
5843
|
}
|
|
5229
5844
|
),
|
|
5230
|
-
(param.description || errorMessage) && /* @__PURE__ */ (0,
|
|
5845
|
+
(param.description || errorMessage) && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
|
|
5231
5846
|
] });
|
|
5232
5847
|
default:
|
|
5233
|
-
return /* @__PURE__ */ (0,
|
|
5848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.TextField, { type: "text", value: formValues[param.name] || "", ...commonProps });
|
|
5234
5849
|
}
|
|
5235
5850
|
}, [formValues, handleChange, apiLoading, validationErrors]);
|
|
5236
|
-
const ResultDisplayContent = (0,
|
|
5851
|
+
const ResultDisplayContent = (0, import_react33.useMemo)(() => {
|
|
5237
5852
|
if (!procedureResultData || !procedure?.resultOk) return null;
|
|
5238
5853
|
const ComponentToRender = resultsOk[procedure.resultOk];
|
|
5239
5854
|
if (ComponentToRender) {
|
|
5240
|
-
return /* @__PURE__ */ (0,
|
|
5855
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ComponentToRender, { data: procedureResultData });
|
|
5241
5856
|
} else {
|
|
5242
|
-
return /* @__PURE__ */ (0,
|
|
5243
|
-
/* @__PURE__ */ (0,
|
|
5857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_material25.Paper, { elevation: 2, sx: { p: 2, mt: 0, bgcolor: "warning.light" }, children: [
|
|
5858
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_material25.Typography, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: [
|
|
5244
5859
|
"el componente para resolver el resultOk: '",
|
|
5245
5860
|
procedure.resultOk,
|
|
5246
5861
|
"' definido en el procedure no existe o no est\xE1 mapeado."
|
|
5247
5862
|
] }),
|
|
5248
|
-
/* @__PURE__ */ (0,
|
|
5863
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Box, { sx: {
|
|
5249
5864
|
bgcolor: "warning.dark",
|
|
5250
5865
|
p: 1,
|
|
5251
5866
|
borderRadius: 1
|
|
5252
|
-
}, children: /* @__PURE__ */ (0,
|
|
5867
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(procedureResultData, null, 2) }) })
|
|
5253
5868
|
] });
|
|
5254
5869
|
}
|
|
5255
5870
|
}, [procedureResultData, procedure]);
|
|
5256
5871
|
if (!procedure) {
|
|
5257
|
-
return /* @__PURE__ */ (0,
|
|
5872
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_material25.Box, { sx: {
|
|
5258
5873
|
p: 2,
|
|
5259
5874
|
width: "100%",
|
|
5260
5875
|
boxSizing: "border-box",
|
|
@@ -5264,13 +5879,13 @@ var ProcedureForm = () => {
|
|
|
5264
5879
|
boxShadow: 3,
|
|
5265
5880
|
textAlign: "center"
|
|
5266
5881
|
}, children: [
|
|
5267
|
-
/* @__PURE__ */ (0,
|
|
5268
|
-
/* @__PURE__ */ (0,
|
|
5882
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.CircularProgress, { sx: { mb: 2 } }),
|
|
5883
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Typography, { variant: "h6", color: "text.secondary", children: "Cargando procedimiento o no encontrado..." })
|
|
5269
5884
|
] });
|
|
5270
5885
|
}
|
|
5271
5886
|
return (
|
|
5272
5887
|
// Esta es la Box más externa que ahora controlará el scroll
|
|
5273
|
-
/* @__PURE__ */ (0,
|
|
5888
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_material25.Box, { sx: {
|
|
5274
5889
|
p: 2,
|
|
5275
5890
|
ml: 1,
|
|
5276
5891
|
mt: 2,
|
|
@@ -5287,17 +5902,17 @@ var ProcedureForm = () => {
|
|
|
5287
5902
|
overflowX: "hidden"
|
|
5288
5903
|
// Oculta el scroll horizontal si no es necesario para el contenedor principal
|
|
5289
5904
|
}, children: [
|
|
5290
|
-
/* @__PURE__ */ (0,
|
|
5291
|
-
Object.values(validationErrors).some((err) => err !== null) && /* @__PURE__ */ (0,
|
|
5905
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Typography, { variant: "h5", component: "h2", gutterBottom: true, align: "left", children: cambiarGuionesBajosPorEspacios(procedure.proceedLabel || procedure.action) }),
|
|
5906
|
+
Object.values(validationErrors).some((err) => err !== null) && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_material25.Alert, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: [
|
|
5292
5907
|
"Por favor, corrige los errores en el formulario antes de enviar.",
|
|
5293
|
-
/* @__PURE__ */ (0,
|
|
5908
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("ul", { children: Object.values(validationErrors).map((err, idx) => err && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("li", { children: err }, idx)) })
|
|
5294
5909
|
] }),
|
|
5295
|
-
!Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */ (0,
|
|
5296
|
-
!Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */ (0,
|
|
5297
|
-
/* @__PURE__ */ (0,
|
|
5298
|
-
procedure.parameters.map((param) => /* @__PURE__ */ (0,
|
|
5299
|
-
/* @__PURE__ */ (0,
|
|
5300
|
-
|
|
5910
|
+
!Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Alert, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: apiError.message }),
|
|
5911
|
+
!Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Alert, { severity: "success", sx: { mb: 2, fontSize: "0.8rem" }, children: successMessage }),
|
|
5912
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("form", { onSubmit: handleSubmit, children: [
|
|
5913
|
+
procedure.parameters.map((param) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children: renderInputField(param) }, param.name)),
|
|
5914
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5915
|
+
import_material25.Button,
|
|
5301
5916
|
{
|
|
5302
5917
|
type: "submit",
|
|
5303
5918
|
variant: "contained",
|
|
@@ -5305,20 +5920,20 @@ var ProcedureForm = () => {
|
|
|
5305
5920
|
disabled: apiLoading || Object.values(validationErrors).some((err) => err !== null),
|
|
5306
5921
|
sx: { mt: 2 },
|
|
5307
5922
|
size: "medium",
|
|
5308
|
-
startIcon: apiLoading ? /* @__PURE__ */ (0,
|
|
5923
|
+
startIcon: apiLoading ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.CircularProgress, { size: 20, color: "inherit" }) : null,
|
|
5309
5924
|
children: apiLoading ? "Ejecutando..." : procedure.proceedLabel || "Ejecutar"
|
|
5310
5925
|
}
|
|
5311
5926
|
)
|
|
5312
5927
|
] }),
|
|
5313
|
-
ResultDisplayContent && /* @__PURE__ */ (0,
|
|
5928
|
+
ResultDisplayContent && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_material25.Box, { sx: { mt: 2 }, children: [
|
|
5314
5929
|
" ",
|
|
5315
5930
|
ResultDisplayContent
|
|
5316
5931
|
] }),
|
|
5317
|
-
executionLog.length > 0 && /* @__PURE__ */ (0,
|
|
5318
|
-
/* @__PURE__ */ (0,
|
|
5319
|
-
/* @__PURE__ */ (0,
|
|
5320
|
-
/* @__PURE__ */ (0,
|
|
5321
|
-
|
|
5932
|
+
executionLog.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_material25.Box, { sx: { mt: 3 }, children: [
|
|
5933
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Divider, { sx: { mb: 2 } }),
|
|
5934
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Typography, { variant: "h6", gutterBottom: true, sx: { fontSize: "0.9rem" }, children: "Registro de Ejecuci\xF3n" }),
|
|
5935
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5936
|
+
import_material25.Box,
|
|
5322
5937
|
{
|
|
5323
5938
|
sx: {
|
|
5324
5939
|
bgcolor: "grey.100",
|
|
@@ -5331,8 +5946,8 @@ var ProcedureForm = () => {
|
|
|
5331
5946
|
fontSize: "0.75rem",
|
|
5332
5947
|
whiteSpace: "pre-wrap"
|
|
5333
5948
|
},
|
|
5334
|
-
children: executionLog.map((log, index) => /* @__PURE__ */ (0,
|
|
5335
|
-
|
|
5949
|
+
children: executionLog.map((log, index) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5950
|
+
import_material25.Typography,
|
|
5336
5951
|
{
|
|
5337
5952
|
component: "pre",
|
|
5338
5953
|
sx: {
|
|
@@ -5354,12 +5969,12 @@ var ProcedureForm_default = ProcedureForm;
|
|
|
5354
5969
|
|
|
5355
5970
|
// src/App.tsx
|
|
5356
5971
|
var import_react_redux5 = require("react-redux");
|
|
5357
|
-
var
|
|
5972
|
+
var import_react44 = require("redux-persist/integration/react");
|
|
5358
5973
|
|
|
5359
5974
|
// src/components/PrivateRoute.tsx
|
|
5360
|
-
var
|
|
5975
|
+
var import_react34 = require("react");
|
|
5361
5976
|
var import_react_router_dom7 = require("react-router-dom");
|
|
5362
|
-
var
|
|
5977
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5363
5978
|
var PrivateRoute = ({ children }) => {
|
|
5364
5979
|
const location = (0, import_react_router_dom7.useLocation)();
|
|
5365
5980
|
const dispatch = useAppDispatch();
|
|
@@ -5367,7 +5982,7 @@ var PrivateRoute = ({ children }) => {
|
|
|
5367
5982
|
const isAuthenticated = clientContextStatus === "succeeded";
|
|
5368
5983
|
const isLoadingAuth = clientContextStatus === "loading";
|
|
5369
5984
|
console.log(`[PrivateRoute] Render: Path=${location.pathname}, AuthStatus=${clientContextStatus}, IsAuthenticated=${isAuthenticated}, IsLoadingAuth=${isLoadingAuth}`);
|
|
5370
|
-
(0,
|
|
5985
|
+
(0, import_react34.useEffect)(() => {
|
|
5371
5986
|
console.log(`[PrivateRoute] Effect: Path=${location.pathname}, AuthStatus=${clientContextStatus}, IsAuthenticated=${isAuthenticated}, IsLoadingAuth=${isLoadingAuth}`);
|
|
5372
5987
|
if (!isAuthenticated && !isLoadingAuth && location.pathname !== "/login") {
|
|
5373
5988
|
const path = location.pathname + location.search + location.hash;
|
|
@@ -5383,19 +5998,19 @@ var PrivateRoute = ({ children }) => {
|
|
|
5383
5998
|
}, [isAuthenticated, isLoadingAuth, location, dispatch, clientContextStatus]);
|
|
5384
5999
|
if (isLoadingAuth) {
|
|
5385
6000
|
console.log(`[PrivateRoute] Returning loading state...`);
|
|
5386
|
-
return /* @__PURE__ */ (0,
|
|
6001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { children: "Verificando autenticaci\xF3n..." });
|
|
5387
6002
|
}
|
|
5388
6003
|
if (!isAuthenticated) {
|
|
5389
6004
|
console.log(`[PrivateRoute] User not authenticated, navigating to /login`);
|
|
5390
|
-
return /* @__PURE__ */ (0,
|
|
6005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_router_dom7.Navigate, { to: "/login", replace: true });
|
|
5391
6006
|
}
|
|
5392
6007
|
console.log(`[PrivateRoute] User authenticated, rendering children.`);
|
|
5393
|
-
return /* @__PURE__ */ (0,
|
|
6008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children });
|
|
5394
6009
|
};
|
|
5395
6010
|
var PrivateRoute_default = PrivateRoute;
|
|
5396
6011
|
|
|
5397
6012
|
// src/components/InitialRedirectHandler.tsx
|
|
5398
|
-
var
|
|
6013
|
+
var import_react35 = require("react");
|
|
5399
6014
|
var import_react_router_dom8 = require("react-router-dom");
|
|
5400
6015
|
var InitialRedirectHandler = () => {
|
|
5401
6016
|
const location = (0, import_react_router_dom8.useLocation)();
|
|
@@ -5403,14 +6018,14 @@ var InitialRedirectHandler = () => {
|
|
|
5403
6018
|
const dispatch = useAppDispatch();
|
|
5404
6019
|
const redirectPath = useRedirectPath();
|
|
5405
6020
|
const clientContextStatus = useClientContextStatus();
|
|
5406
|
-
(0,
|
|
6021
|
+
(0, import_react35.useEffect)(() => {
|
|
5407
6022
|
dispatch(setCurrentPath(location.pathname + location.search));
|
|
5408
6023
|
}, [location, dispatch]);
|
|
5409
|
-
const navegandoRef = (0,
|
|
5410
|
-
(0,
|
|
6024
|
+
const navegandoRef = (0, import_react35.useRef)(false);
|
|
6025
|
+
(0, import_react35.useEffect)(() => {
|
|
5411
6026
|
navegandoRef.current = false;
|
|
5412
6027
|
}, [location.pathname]);
|
|
5413
|
-
(0,
|
|
6028
|
+
(0, import_react35.useEffect)(() => {
|
|
5414
6029
|
if (clientContextStatus === "succeeded") {
|
|
5415
6030
|
if (redirectPath && redirectPath !== "/login") {
|
|
5416
6031
|
console.log("Redirigiendo a la ruta guardada:", redirectPath);
|
|
@@ -5428,35 +6043,40 @@ var InitialRedirectHandler = () => {
|
|
|
5428
6043
|
var InitialRedirectHandler_default = InitialRedirectHandler;
|
|
5429
6044
|
|
|
5430
6045
|
// src/pages/GenericDataGridPage.tsx
|
|
5431
|
-
var
|
|
6046
|
+
var import_react36 = __toESM(require("react"), 1);
|
|
5432
6047
|
var import_react_router_dom9 = require("react-router-dom");
|
|
5433
|
-
var
|
|
6048
|
+
var import_material26 = require("@mui/material");
|
|
5434
6049
|
var import_Close2 = __toESM(require("@mui/icons-material/Close"), 1);
|
|
5435
|
-
var
|
|
6050
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
5436
6051
|
var GenericDataGridPage = ({
|
|
5437
6052
|
initialTableName,
|
|
5438
|
-
initialFixedFields = []
|
|
6053
|
+
initialFixedFields = [],
|
|
6054
|
+
parametros: parametrosRecibidos
|
|
5439
6055
|
}) => {
|
|
5440
6056
|
const { tableName: urlTableName } = (0, import_react_router_dom9.useParams)();
|
|
5441
6057
|
const effectiveTableName = initialTableName || urlTableName;
|
|
5442
|
-
const [tabs, setTabs] = (0,
|
|
5443
|
-
const [activeTabIdx, setActiveTabIdx] = (0,
|
|
6058
|
+
const [tabs, setTabs] = (0, import_react36.useState)([]);
|
|
6059
|
+
const [activeTabIdx, setActiveTabIdx] = (0, import_react36.useState)(0);
|
|
5444
6060
|
const ffKey = JSON.stringify(initialFixedFields);
|
|
5445
6061
|
const location = (0, import_react_router_dom9.useLocation)();
|
|
5446
|
-
|
|
6062
|
+
const parametros = (0, import_react36.useMemo)(() => parametrosRecibidos ?? parametrosDeTabla(void 0, location.search), [parametrosRecibidos, location.search]);
|
|
6063
|
+
const fixedFieldsIniciales = initialFixedFields.length > 0 ? initialFixedFields : parametros.fixedFields ?? [];
|
|
6064
|
+
const parametrosKey = JSON.stringify(parametros);
|
|
6065
|
+
import_react36.default.useEffect(() => {
|
|
5447
6066
|
if (effectiveTableName) {
|
|
5448
6067
|
setTabs([{
|
|
5449
|
-
id: `main-${effectiveTableName}-${ffKey}`,
|
|
6068
|
+
id: `main-${effectiveTableName}-${ffKey}-${parametrosKey}`,
|
|
5450
6069
|
// ID único que incluye filtros
|
|
5451
|
-
label: effectiveTableName.replace(/_/g, " ").toUpperCase(),
|
|
6070
|
+
label: parametros.label ?? effectiveTableName.replace(/_/g, " ").toUpperCase(),
|
|
5452
6071
|
tableName: effectiveTableName,
|
|
5453
|
-
fixedFields:
|
|
6072
|
+
fixedFields: fixedFieldsIniciales,
|
|
6073
|
+
parametros,
|
|
5454
6074
|
ancestors: []
|
|
5455
6075
|
}]);
|
|
5456
6076
|
setActiveTabIdx(0);
|
|
5457
6077
|
}
|
|
5458
|
-
}, [effectiveTableName, ffKey, location.key]);
|
|
5459
|
-
const handleOpenDetail = (0,
|
|
6078
|
+
}, [effectiveTableName, ffKey, parametrosKey, location.key]);
|
|
6079
|
+
const handleOpenDetail = (0, import_react36.useCallback)((tableName, fixedFields, label, ancestors) => {
|
|
5460
6080
|
const tabId = `${tableName}-${JSON.stringify(fixedFields)}`;
|
|
5461
6081
|
setTabs((prevTabs) => {
|
|
5462
6082
|
const existingTabIdx = prevTabs.findIndex((t) => t.id === tabId);
|
|
@@ -5478,30 +6098,34 @@ var GenericDataGridPage = ({
|
|
|
5478
6098
|
else if (activeTabIdx === index) setActiveTabIdx(index - 1);
|
|
5479
6099
|
};
|
|
5480
6100
|
if (!effectiveTableName) {
|
|
5481
|
-
return /* @__PURE__ */ (0,
|
|
6101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material26.Box, { p: 3, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material26.Alert, { severity: "error", children: "No se especific\xF3 una tabla." }) });
|
|
5482
6102
|
}
|
|
5483
|
-
return /* @__PURE__ */ (0,
|
|
5484
|
-
/* @__PURE__ */ (0,
|
|
5485
|
-
|
|
6103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_material26.Box, { sx: { width: "100%", height: "calc(100vh - 64px)", display: "flex", flexDirection: "column" }, children: [
|
|
6104
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material26.Box, { sx: { borderBottom: 1, borderColor: "divider", bgcolor: "background.paper" }, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material26.Tabs, { value: activeTabIdx, onChange: (_, v) => setActiveTabIdx(v), variant: "scrollable", children: tabs.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6105
|
+
import_material26.Tab,
|
|
5486
6106
|
{
|
|
5487
|
-
label: /* @__PURE__ */ (0,
|
|
5488
|
-
/* @__PURE__ */ (0,
|
|
5489
|
-
index !== 0 && /* @__PURE__ */ (0,
|
|
6107
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_material26.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
6108
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material26.Typography, { variant: "caption", sx: { fontWeight: "bold" }, children: tab.label }),
|
|
6109
|
+
index !== 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material26.IconButton, { size: "small", onClick: (e) => handleCloseTab(index, e), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_Close2.default, { fontSize: "inherit" }) })
|
|
5490
6110
|
] })
|
|
5491
6111
|
},
|
|
5492
6112
|
tab.id
|
|
5493
6113
|
)) }) }),
|
|
5494
|
-
tabs.map((tab, index) => /* @__PURE__ */ (0,
|
|
5495
|
-
|
|
6114
|
+
tabs.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6115
|
+
import_material26.Box,
|
|
5496
6116
|
{
|
|
5497
6117
|
role: "tabpanel",
|
|
5498
6118
|
hidden: activeTabIdx !== index,
|
|
5499
6119
|
sx: { flexGrow: 1, display: activeTabIdx === index ? "flex" : "none", flexDirection: "column", overflow: "hidden" },
|
|
5500
|
-
children: /* @__PURE__ */ (0,
|
|
6120
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5501
6121
|
GenericDataGrid_default,
|
|
5502
6122
|
{
|
|
5503
6123
|
tableName: tab.tableName,
|
|
5504
6124
|
fixedFields: tab.fixedFields,
|
|
6125
|
+
filterColumns: tab.parametros?.filterColumns,
|
|
6126
|
+
tableDef: tab.parametros?.tableDef,
|
|
6127
|
+
parameterFunctions: tab.parametros?.parameterFunctions,
|
|
6128
|
+
pick: tab.parametros?.pick,
|
|
5505
6129
|
onOpenDetail: handleOpenDetail,
|
|
5506
6130
|
ancestors: tab.ancestors
|
|
5507
6131
|
}
|
|
@@ -5514,32 +6138,26 @@ var GenericDataGridPage = ({
|
|
|
5514
6138
|
var GenericDataGridPage_default = GenericDataGridPage;
|
|
5515
6139
|
|
|
5516
6140
|
// src/pages/PantallaDeRuta.tsx
|
|
5517
|
-
var
|
|
6141
|
+
var import_react37 = require("react");
|
|
5518
6142
|
var import_react_router_dom10 = require("react-router-dom");
|
|
5519
|
-
var
|
|
5520
|
-
var
|
|
6143
|
+
var import_material27 = require("@mui/material");
|
|
6144
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
5521
6145
|
var PantallaDeRuta = ({ screenName }) => {
|
|
5522
6146
|
const [busqueda] = (0, import_react_router_dom10.useSearchParams)();
|
|
5523
|
-
const params = (0,
|
|
6147
|
+
const params = (0, import_react37.useMemo)(() => Object.fromEntries(busqueda.entries()), [busqueda]);
|
|
5524
6148
|
const Pantalla = wScreens[screenName];
|
|
5525
|
-
return /* @__PURE__ */ (0,
|
|
6149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material27.Box, { sx: { pt: 3, pl: 4 }, children: Pantalla ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Pantalla, { screenName, params }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(FallbackWScreen, { screenName }) });
|
|
5526
6150
|
};
|
|
5527
6151
|
|
|
5528
6152
|
// src/pages/MenuTablePage.tsx
|
|
5529
|
-
var
|
|
6153
|
+
var import_react38 = require("react");
|
|
5530
6154
|
var import_react_router_dom11 = require("react-router-dom");
|
|
5531
|
-
var
|
|
5532
|
-
var
|
|
5533
|
-
function fixedFieldsDeMenu(ff) {
|
|
5534
|
-
if (!ff) return [];
|
|
5535
|
-
if (Array.isArray(ff)) {
|
|
5536
|
-
return ff.map(({ fieldName, value }) => ({ fieldName, value }));
|
|
5537
|
-
}
|
|
5538
|
-
return Object.entries(ff).map(([fieldName, value]) => ({ fieldName, value }));
|
|
5539
|
-
}
|
|
6155
|
+
var import_material28 = require("@mui/material");
|
|
6156
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
5540
6157
|
var MenuTablePage = () => {
|
|
5541
6158
|
const { menuName } = (0, import_react_router_dom11.useParams)();
|
|
5542
6159
|
const { clientContext } = useApp();
|
|
6160
|
+
const { search } = (0, import_react_router_dom11.useLocation)();
|
|
5543
6161
|
const findMenuItem = (items, nameToFind) => {
|
|
5544
6162
|
for (const item of items) {
|
|
5545
6163
|
if (item.name === nameToFind && item.menuType === "table") {
|
|
@@ -5552,51 +6170,55 @@ var MenuTablePage = () => {
|
|
|
5552
6170
|
}
|
|
5553
6171
|
return void 0;
|
|
5554
6172
|
};
|
|
5555
|
-
const { currentTableName, currentFixedFields } = (0,
|
|
6173
|
+
const { currentTableName, currentFixedFields, parametros } = (0, import_react38.useMemo)(() => {
|
|
5556
6174
|
let tableName = void 0;
|
|
5557
6175
|
let fixedFields = [];
|
|
6176
|
+
let parametros2 = {};
|
|
5558
6177
|
if (menuName && clientContext && clientContext.menu) {
|
|
5559
6178
|
const menuItem = findMenuItem(clientContext.menu, menuName);
|
|
5560
6179
|
if (menuItem) {
|
|
5561
6180
|
tableName = menuItem.table || menuItem.name;
|
|
5562
|
-
|
|
6181
|
+
parametros2 = parametrosDeTabla(menuItem, search);
|
|
6182
|
+
fixedFields = parametros2.fixedFields ?? [];
|
|
5563
6183
|
} else {
|
|
5564
6184
|
console.warn(`[${menuName}] \xCDtem de men\xFA '${menuName}' no encontrado o no es de tipo 'table' en clientContext.menu.`);
|
|
5565
6185
|
}
|
|
5566
6186
|
}
|
|
5567
6187
|
return {
|
|
5568
6188
|
currentTableName: tableName,
|
|
5569
|
-
currentFixedFields: fixedFields
|
|
6189
|
+
currentFixedFields: fixedFields,
|
|
6190
|
+
parametros: parametros2
|
|
5570
6191
|
};
|
|
5571
|
-
}, [menuName, clientContext]);
|
|
6192
|
+
}, [menuName, clientContext, search]);
|
|
5572
6193
|
if (!currentTableName) {
|
|
5573
|
-
return /* @__PURE__ */ (0,
|
|
5574
|
-
/* @__PURE__ */ (0,
|
|
5575
|
-
/* @__PURE__ */ (0,
|
|
6194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_material28.Alert, { severity: "error", children: [
|
|
6195
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.Typography, { variant: "h6", children: "Error: No se pudo cargar la informaci\xF3n de la tabla." }),
|
|
6196
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.Typography, { variant: "body1", children: "Verifique la configuraci\xF3n del men\xFA o el nombre de la tabla en la URL." })
|
|
5576
6197
|
] }) });
|
|
5577
6198
|
}
|
|
5578
|
-
return /* @__PURE__ */ (0,
|
|
6199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5579
6200
|
GenericDataGridPage_default,
|
|
5580
6201
|
{
|
|
5581
6202
|
initialTableName: currentTableName,
|
|
5582
|
-
initialFixedFields: currentFixedFields
|
|
6203
|
+
initialFixedFields: currentFixedFields,
|
|
6204
|
+
parametros
|
|
5583
6205
|
}
|
|
5584
6206
|
);
|
|
5585
6207
|
};
|
|
5586
6208
|
var MenuTablePage_default = MenuTablePage;
|
|
5587
6209
|
|
|
5588
6210
|
// src/puente/PantallaBP.tsx
|
|
5589
|
-
var
|
|
6211
|
+
var import_react40 = require("react");
|
|
5590
6212
|
var import_react_router_dom12 = require("react-router-dom");
|
|
5591
|
-
var
|
|
6213
|
+
var import_material30 = require("@mui/material");
|
|
5592
6214
|
|
|
5593
6215
|
// src/puente/clienteBP.ts
|
|
5594
6216
|
function extraerRecursos(html) {
|
|
5595
6217
|
const documento = new DOMParser().parseFromString(html, "text/html");
|
|
5596
|
-
const
|
|
6218
|
+
const referencias2 = (selector, atributo) => Array.from(documento.querySelectorAll(selector)).map((elemento) => elemento.getAttribute(atributo)).filter((ruta) => !!ruta);
|
|
5597
6219
|
return {
|
|
5598
|
-
hojasDeEstilo:
|
|
5599
|
-
scripts:
|
|
6220
|
+
hojasDeEstilo: referencias2("link[rel=stylesheet]", "href"),
|
|
6221
|
+
scripts: referencias2("script[src]", "src")
|
|
5600
6222
|
};
|
|
5601
6223
|
}
|
|
5602
6224
|
function fijarBase(urlBackend) {
|
|
@@ -5677,9 +6299,9 @@ async function cargarSinMemoria(urlBackend) {
|
|
|
5677
6299
|
}
|
|
5678
6300
|
|
|
5679
6301
|
// src/puente/ConsolaBP.tsx
|
|
5680
|
-
var
|
|
5681
|
-
var
|
|
5682
|
-
var
|
|
6302
|
+
var import_react39 = require("react");
|
|
6303
|
+
var import_material29 = require("@mui/material");
|
|
6304
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
5683
6305
|
var MARGEN_DE_REPETIDO_MS = 1e3;
|
|
5684
6306
|
function descartarRepetidos(consola, agregados, ahora) {
|
|
5685
6307
|
for (const nodo of agregados) {
|
|
@@ -5692,7 +6314,7 @@ function descartarRepetidos(consola, agregados, ahora) {
|
|
|
5692
6314
|
}
|
|
5693
6315
|
}
|
|
5694
6316
|
var ConsolaBP = () => {
|
|
5695
|
-
(0,
|
|
6317
|
+
(0, import_react39.useEffect)(() => {
|
|
5696
6318
|
const consola = document.getElementById("mini-console");
|
|
5697
6319
|
if (!consola) return;
|
|
5698
6320
|
const observador = new MutationObserver(
|
|
@@ -5701,8 +6323,8 @@ var ConsolaBP = () => {
|
|
|
5701
6323
|
observador.observe(consola, { childList: true });
|
|
5702
6324
|
return () => observador.disconnect();
|
|
5703
6325
|
}, []);
|
|
5704
|
-
return /* @__PURE__ */ (0,
|
|
5705
|
-
|
|
6326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
6327
|
+
import_material29.Box,
|
|
5706
6328
|
{
|
|
5707
6329
|
id: "mini-console",
|
|
5708
6330
|
sx: (tema) => ({
|
|
@@ -5798,7 +6420,7 @@ var habilitarPuenteBP = () => {
|
|
|
5798
6420
|
var puenteBPHabilitado = () => habilitado;
|
|
5799
6421
|
|
|
5800
6422
|
// src/puente/PantallaBP.tsx
|
|
5801
|
-
var
|
|
6423
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
5802
6424
|
function buscarItemDeMenu(items, tipo) {
|
|
5803
6425
|
for (const item of items) {
|
|
5804
6426
|
if (item.menuType === tipo) return item;
|
|
@@ -5811,12 +6433,12 @@ function buscarItemDeMenu(items, tipo) {
|
|
|
5811
6433
|
}
|
|
5812
6434
|
var PantallaBP = ({ nombre, direccion }) => {
|
|
5813
6435
|
const { clientContext } = useApp();
|
|
5814
|
-
const [cargando, setCargando] = (0,
|
|
5815
|
-
const [error, setError] = (0,
|
|
5816
|
-
const [noExiste, setNoExiste] = (0,
|
|
5817
|
-
const contenedor = (0,
|
|
6436
|
+
const [cargando, setCargando] = (0, import_react40.useState)(true);
|
|
6437
|
+
const [error, setError] = (0, import_react40.useState)(null);
|
|
6438
|
+
const [noExiste, setNoExiste] = (0, import_react40.useState)(false);
|
|
6439
|
+
const contenedor = (0, import_react40.useRef)(null);
|
|
5818
6440
|
const menu = clientContext.menu;
|
|
5819
|
-
(0,
|
|
6441
|
+
(0, import_react40.useEffect)(() => {
|
|
5820
6442
|
const elemento = contenedor.current;
|
|
5821
6443
|
if (!elemento) return;
|
|
5822
6444
|
let vigente = true;
|
|
@@ -5847,14 +6469,14 @@ var PantallaBP = ({ nombre, direccion }) => {
|
|
|
5847
6469
|
elemento.replaceChildren();
|
|
5848
6470
|
};
|
|
5849
6471
|
}, [nombre, direccion, menu]);
|
|
5850
|
-
if (noExiste) return /* @__PURE__ */ (0,
|
|
6472
|
+
if (noExiste) return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(FallbackWScreen, { screenName: nombre });
|
|
5851
6473
|
return (
|
|
5852
6474
|
// el indicador de carga flota: si ocupara lugar, el contenido de backend-plus empezaría más abajo mientras carga y subiría al terminar
|
|
5853
|
-
/* @__PURE__ */ (0,
|
|
5854
|
-
cargando && /* @__PURE__ */ (0,
|
|
5855
|
-
error && /* @__PURE__ */ (0,
|
|
5856
|
-
/* @__PURE__ */ (0,
|
|
5857
|
-
/* @__PURE__ */ (0,
|
|
6475
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_material30.Box, { sx: { position: "relative" }, children: [
|
|
6476
|
+
cargando && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material30.CircularProgress, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
|
|
6477
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material30.Alert, { severity: "error", sx: { m: 2 }, children: error }),
|
|
6478
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { id: "main_layout", ref: contenedor }),
|
|
6479
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ConsolaBP, {})
|
|
5858
6480
|
] })
|
|
5859
6481
|
);
|
|
5860
6482
|
};
|
|
@@ -5862,37 +6484,37 @@ var PantallaDeRespaldo = () => {
|
|
|
5862
6484
|
const { screenName = "" } = (0, import_react_router_dom12.useParams)();
|
|
5863
6485
|
const { search } = (0, import_react_router_dom12.useLocation)();
|
|
5864
6486
|
if (!puenteBPHabilitado()) {
|
|
5865
|
-
return /* @__PURE__ */ (0,
|
|
6487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material30.Box, { sx: { p: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(FallbackWScreen, { screenName }) });
|
|
5866
6488
|
}
|
|
5867
|
-
return /* @__PURE__ */ (0,
|
|
6489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_router_dom12.Navigate, { to: rutaDePantallaBP(screenName, search), replace: true });
|
|
5868
6490
|
};
|
|
5869
6491
|
var PaginaBP = () => {
|
|
5870
6492
|
const { hash, search } = (0, import_react_router_dom12.useLocation)();
|
|
5871
6493
|
const direccion = hash || search;
|
|
5872
6494
|
const nombre = new URLSearchParams(direccion.replace(/^[#?]/, "")).get("w");
|
|
5873
|
-
if (!puenteBPHabilitado()) return /* @__PURE__ */ (0,
|
|
5874
|
-
if (!nombre) return /* @__PURE__ */ (0,
|
|
6495
|
+
if (!puenteBPHabilitado()) return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_router_dom12.Navigate, { to: "/", replace: true });
|
|
6496
|
+
if (!nombre) return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material30.Box, { sx: { p: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_material30.Alert, { severity: "warning", children: [
|
|
5875
6497
|
"Falta la pantalla de backend-plus (",
|
|
5876
|
-
/* @__PURE__ */ (0,
|
|
6498
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("code", { children: "#w=..." }),
|
|
5877
6499
|
")."
|
|
5878
6500
|
] }) });
|
|
5879
|
-
return /* @__PURE__ */ (0,
|
|
6501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PantallaBP, { nombre, direccion }, nombre);
|
|
5880
6502
|
};
|
|
5881
6503
|
|
|
5882
6504
|
// src/puente/GrillaBP.tsx
|
|
5883
|
-
var
|
|
6505
|
+
var import_react41 = require("react");
|
|
5884
6506
|
var import_react_router_dom13 = require("react-router-dom");
|
|
5885
|
-
var
|
|
5886
|
-
var
|
|
6507
|
+
var import_material31 = require("@mui/material");
|
|
6508
|
+
var import_jsx_runtime38 = (
|
|
5887
6509
|
// el indicador de carga flota: si ocupara lugar, el contenido de backend-plus empezaría más abajo mientras carga y subiría al terminar
|
|
5888
6510
|
require("react/jsx-runtime")
|
|
5889
6511
|
);
|
|
5890
6512
|
var GrillaBP = ({ tabla, fixedFields }) => {
|
|
5891
|
-
const contenedor = (0,
|
|
5892
|
-
const [cargando, setCargando] = (0,
|
|
5893
|
-
const [error, setError] = (0,
|
|
6513
|
+
const contenedor = (0, import_react41.useRef)(null);
|
|
6514
|
+
const [cargando, setCargando] = (0, import_react41.useState)(true);
|
|
6515
|
+
const [error, setError] = (0, import_react41.useState)(null);
|
|
5894
6516
|
const clave = JSON.stringify(fixedFields ?? []);
|
|
5895
|
-
(0,
|
|
6517
|
+
(0, import_react41.useEffect)(() => {
|
|
5896
6518
|
const elemento = contenedor.current;
|
|
5897
6519
|
if (!elemento) return;
|
|
5898
6520
|
let vigente = true;
|
|
@@ -5913,20 +6535,20 @@ var GrillaBP = ({ tabla, fixedFields }) => {
|
|
|
5913
6535
|
elemento.replaceChildren();
|
|
5914
6536
|
};
|
|
5915
6537
|
}, [tabla, clave]);
|
|
5916
|
-
return /* @__PURE__ */ (0,
|
|
5917
|
-
cargando && /* @__PURE__ */ (0,
|
|
5918
|
-
error && /* @__PURE__ */ (0,
|
|
5919
|
-
/* @__PURE__ */ (0,
|
|
5920
|
-
/* @__PURE__ */ (0,
|
|
6538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material31.Box, { sx: { position: "relative" }, children: [
|
|
6539
|
+
cargando && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material31.CircularProgress, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
|
|
6540
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material31.Alert, { severity: "error", sx: { m: 2 }, children: error }),
|
|
6541
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { ref: contenedor }),
|
|
6542
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ConsolaBP, {})
|
|
5921
6543
|
] });
|
|
5922
6544
|
};
|
|
5923
6545
|
var PaginaGrillaBP = () => {
|
|
5924
6546
|
const { tableName = "" } = (0, import_react_router_dom13.useParams)();
|
|
5925
|
-
return /* @__PURE__ */ (0,
|
|
6547
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(GrillaBP, { tabla: tableName }, tableName);
|
|
5926
6548
|
};
|
|
5927
6549
|
|
|
5928
6550
|
// src/puente/CapturaBP.tsx
|
|
5929
|
-
var
|
|
6551
|
+
var import_react42 = require("react");
|
|
5930
6552
|
var import_react_router_dom14 = require("react-router-dom");
|
|
5931
6553
|
|
|
5932
6554
|
// src/puente/capturaDeNavegacion.ts
|
|
@@ -5973,61 +6595,61 @@ function capturarNavegacionBP(urlBackend, navegar) {
|
|
|
5973
6595
|
// src/puente/CapturaBP.tsx
|
|
5974
6596
|
var CapturaBP = () => {
|
|
5975
6597
|
const navigate = (0, import_react_router_dom14.useNavigate)();
|
|
5976
|
-
(0,
|
|
6598
|
+
(0, import_react42.useEffect)(() => capturarNavegacionBP(envConfig.backendUrl, navigate), [navigate]);
|
|
5977
6599
|
return null;
|
|
5978
6600
|
};
|
|
5979
6601
|
|
|
5980
6602
|
// src/App.tsx
|
|
5981
6603
|
var import_type_store6 = __toESM(require("type-store"), 1);
|
|
5982
|
-
var
|
|
6604
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
5983
6605
|
var LocationTracker = () => {
|
|
5984
6606
|
const location = (0, import_react_router_dom15.useLocation)();
|
|
5985
6607
|
const dispatch = useAppDispatch();
|
|
5986
|
-
(0,
|
|
6608
|
+
(0, import_react43.useEffect)(() => {
|
|
5987
6609
|
dispatch(setCurrentPath(location.pathname + location.search));
|
|
5988
6610
|
}, [location, dispatch]);
|
|
5989
6611
|
return null;
|
|
5990
6612
|
};
|
|
5991
6613
|
function FrontendPlusReactRoutes({ myRoutes, myUnloggedRoutes, layout: Layout = MainLayout_default, unloggedLayout: UnloggedLayout }) {
|
|
5992
|
-
return /* @__PURE__ */ (0,
|
|
5993
|
-
/* @__PURE__ */ (0,
|
|
5994
|
-
puenteBPHabilitado() && /* @__PURE__ */ (0,
|
|
5995
|
-
/* @__PURE__ */ (0,
|
|
5996
|
-
/* @__PURE__ */ (0,
|
|
5997
|
-
/* @__PURE__ */ (0,
|
|
5998
|
-
/* @__PURE__ */ (0,
|
|
6614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
6615
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(InitialRedirectHandler_default, {}),
|
|
6616
|
+
puenteBPHabilitado() && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CapturaBP, {}),
|
|
6617
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_react_router_dom15.Routes, { children: [
|
|
6618
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_react_router_dom15.Route, { element: UnloggedLayout ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(UnloggedLayout, {}) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Outlet, {}), children: [
|
|
6619
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Route, { path: "/login", element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(LoginPage_default, {}) }),
|
|
6620
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Route, { path: "/logout", element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(LogoutPage_default, {}) }),
|
|
5999
6621
|
myUnloggedRoutes
|
|
6000
6622
|
] }),
|
|
6001
|
-
/* @__PURE__ */ (0,
|
|
6002
|
-
/* @__PURE__ */ (0,
|
|
6003
|
-
/* @__PURE__ */ (0,
|
|
6004
|
-
/* @__PURE__ */ (0,
|
|
6005
|
-
/* @__PURE__ */ (0,
|
|
6006
|
-
Object.keys(wScreens).map((screenName) => /* @__PURE__ */ (0,
|
|
6623
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_react_router_dom15.Route, { element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PrivateRoute_default, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Layout, {}) }), children: [
|
|
6624
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Route, { path: "/", element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PantallaInicial_default, {}) }),
|
|
6625
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Route, { path: "/table/:tableName", element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(GenericDataGridPage_default, {}) }),
|
|
6626
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Route, { path: "/menu/:menuName", element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MenuTablePage_default, {}) }),
|
|
6627
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Route, { path: "/procedures/:procedureName", element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ProcedureForm_default, {}) }),
|
|
6628
|
+
Object.keys(wScreens).map((screenName) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6007
6629
|
import_react_router_dom15.Route,
|
|
6008
6630
|
{
|
|
6009
6631
|
path: `/wScreens/${screenName}`,
|
|
6010
|
-
element: /* @__PURE__ */ (0,
|
|
6632
|
+
element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PantallaDeRuta, { screenName })
|
|
6011
6633
|
},
|
|
6012
6634
|
screenName
|
|
6013
6635
|
)),
|
|
6014
|
-
/* @__PURE__ */ (0,
|
|
6015
|
-
puenteBPHabilitado() && /* @__PURE__ */ (0,
|
|
6016
|
-
puenteBPHabilitado() && /* @__PURE__ */ (0,
|
|
6636
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Route, { path: "/wScreens-fallback/:screenName", element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PantallaDeRespaldo, {}) }),
|
|
6637
|
+
puenteBPHabilitado() && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Route, { path: "/bp/menu", element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PaginaBP, {}) }),
|
|
6638
|
+
puenteBPHabilitado() && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Route, { path: "/bp/table/:tableName", element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PaginaGrillaBP, {}) }),
|
|
6017
6639
|
myRoutes,
|
|
6018
|
-
/* @__PURE__ */ (0,
|
|
6640
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Route, { path: "*", element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { style: { marginTop: "20px", marginLeft: "10px" }, children: "404 - Recurso No Encontrado" }) })
|
|
6019
6641
|
] }),
|
|
6020
|
-
/* @__PURE__ */ (0,
|
|
6642
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Route, { path: "*", element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Navigate, { to: "/", replace: true }) })
|
|
6021
6643
|
] })
|
|
6022
6644
|
] });
|
|
6023
6645
|
}
|
|
6024
6646
|
var FrontendPlusProviders = ({ children, publicPaths }) => {
|
|
6025
|
-
return /* @__PURE__ */ (0,
|
|
6026
|
-
/* @__PURE__ */ (0,
|
|
6647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_redux5.Provider, { store, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react44.PersistGate, { loading: null, persistor, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_react_router_dom15.BrowserRouter, { basename: rutaBase, children: [
|
|
6648
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(LocationTracker, {}),
|
|
6027
6649
|
" ",
|
|
6028
|
-
/* @__PURE__ */ (0,
|
|
6650
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AppProvider, { publicPaths, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(SnackbarProvider, { children: [
|
|
6029
6651
|
children,
|
|
6030
|
-
/* @__PURE__ */ (0,
|
|
6652
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SessionExpiredMessage_default, {})
|
|
6031
6653
|
] }) })
|
|
6032
6654
|
] }) }) });
|
|
6033
6655
|
};
|
|
@@ -6041,7 +6663,7 @@ var App = ({
|
|
|
6041
6663
|
myConditions,
|
|
6042
6664
|
puenteBP
|
|
6043
6665
|
}) => {
|
|
6044
|
-
(0,
|
|
6666
|
+
(0, import_react43.useMemo)(() => {
|
|
6045
6667
|
if (myClientSides) {
|
|
6046
6668
|
extendClientSides(myClientSides);
|
|
6047
6669
|
}
|
|
@@ -6058,7 +6680,7 @@ var App = ({
|
|
|
6058
6680
|
habilitarPuenteBP();
|
|
6059
6681
|
}
|
|
6060
6682
|
}, [myClientSides, myResultsOk, myWScreens, myConditions, puenteBP]);
|
|
6061
|
-
(0,
|
|
6683
|
+
(0, import_react43.useEffect)(() => {
|
|
6062
6684
|
import_type_store6.default.messages = import_type_store6.default.i18n.messages.es;
|
|
6063
6685
|
import_type_store6.default.locale = import_type_store6.default.i18n.locale.es;
|
|
6064
6686
|
const link = document.querySelector("link[rel*='icon']") || document.createElement("link");
|
|
@@ -6067,11 +6689,11 @@ var App = ({
|
|
|
6067
6689
|
link.href = `${envConfig.backendUrl}/img/logo-128.png`;
|
|
6068
6690
|
document.getElementsByTagName("head")[0].appendChild(link);
|
|
6069
6691
|
}, []);
|
|
6070
|
-
const safePaths =
|
|
6692
|
+
const safePaths = import_react43.default.useMemo(() => {
|
|
6071
6693
|
const extracted = extractPathsFromRoutes(myUnloggedRoutes);
|
|
6072
6694
|
return ["/login", "/logout", ...extracted];
|
|
6073
6695
|
}, [myUnloggedRoutes]);
|
|
6074
|
-
return /* @__PURE__ */ (0,
|
|
6696
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(FrontendPlusProviders, { publicPaths: safePaths, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6075
6697
|
FrontendPlusReactRoutes,
|
|
6076
6698
|
{
|
|
6077
6699
|
myRoutes,
|