frontend-plus-react 0.8.0 → 0.9.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 +5 -2
- package/dist/index.cjs +1153 -967
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +14 -4
- package/dist/index.css.map +1 -1
- package/dist/index.js +1060 -874
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/components/grid/GenericDataGrid.tsx
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as useState17, useEffect as useEffect8, useCallback as useCallback12, useContext as useContext4, useMemo as useMemo10, useRef as useRef8 } from "react";
|
|
3
3
|
import { DataGrid } from "react-data-grid";
|
|
4
4
|
import "react-data-grid/lib/styles.css";
|
|
5
5
|
|
|
@@ -317,7 +317,7 @@ var useApiCallWithoutSnackbar = () => {
|
|
|
317
317
|
};
|
|
318
318
|
|
|
319
319
|
// src/components/grid/GenericDataGrid.tsx
|
|
320
|
-
import { CircularProgress as
|
|
320
|
+
import { CircularProgress as CircularProgress5, Typography as Typography11, Box as Box15, Alert as Alert3, useTheme as useTheme4, Dialog as Dialog5 } from "@mui/material";
|
|
321
321
|
|
|
322
322
|
// src/store/index.ts
|
|
323
323
|
import { configureStore, combineReducers } from "@reduxjs/toolkit";
|
|
@@ -1398,8 +1398,12 @@ function BotonDetalle({ row, rowId, detailTable, deshabilitado }) {
|
|
|
1398
1398
|
IconButton,
|
|
1399
1399
|
{
|
|
1400
1400
|
size: "small",
|
|
1401
|
+
sx: { width: 24, height: 24, p: 0 },
|
|
1401
1402
|
disabled: deshabilitado,
|
|
1402
1403
|
onClick: (e) => alternarDetalle(row, rowId, detailTable, e.ctrlKey || e.metaKey),
|
|
1404
|
+
onMouseDown: (e) => {
|
|
1405
|
+
if (e.button === 1) e.preventDefault();
|
|
1406
|
+
},
|
|
1403
1407
|
onAuxClick: (e) => {
|
|
1404
1408
|
if (e.button === 1) alternarDetalle(row, rowId, detailTable, true);
|
|
1405
1409
|
},
|
|
@@ -1581,6 +1585,112 @@ var textoParaVer = (valor) => {
|
|
|
1581
1585
|
return String(valor);
|
|
1582
1586
|
};
|
|
1583
1587
|
|
|
1588
|
+
// src/components/grid/ExampleClientSideComponent.tsx
|
|
1589
|
+
import { Box as Box3, Typography as Typography2 } from "@mui/material";
|
|
1590
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1591
|
+
var ExampleClientSideComponent = ({ row, column, fieldDefinition }) => {
|
|
1592
|
+
const value = row[column.key];
|
|
1593
|
+
return /* @__PURE__ */ jsx6(Box3, { sx: {
|
|
1594
|
+
padding: 0.5,
|
|
1595
|
+
width: "100%",
|
|
1596
|
+
height: "100%",
|
|
1597
|
+
display: "flex",
|
|
1598
|
+
alignItems: "center",
|
|
1599
|
+
backgroundColor: value === "Special" ? "lightblue" : "transparent"
|
|
1600
|
+
}, children: /* @__PURE__ */ jsx6(Typography2, { variant: "body2", sx: { fontWeight: "bold" }, children: value ? `CS: ${value}` : "N/A" }) });
|
|
1601
|
+
};
|
|
1602
|
+
var ExampleClientSideComponent_default = ExampleClientSideComponent;
|
|
1603
|
+
|
|
1604
|
+
// src/components/grid/FallbackClientSideRenderer.tsx
|
|
1605
|
+
import { Box as Box4, Typography as Typography3, Tooltip as Tooltip2 } from "@mui/material";
|
|
1606
|
+
import WarningAmberIcon2 from "@mui/icons-material/WarningAmber";
|
|
1607
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1608
|
+
var FallbackClientSideRenderer = ({ column, row, fieldDefinition }) => {
|
|
1609
|
+
const clientSideName = fieldDefinition?.clientSide || "Desconocido";
|
|
1610
|
+
return /* @__PURE__ */ jsx7(Tooltip2, { title: `Componente clientSide '${clientSideName}' no implementado. Mostrando valor por defecto.`, children: /* @__PURE__ */ jsxs5(
|
|
1611
|
+
Box4,
|
|
1612
|
+
{
|
|
1613
|
+
sx: {
|
|
1614
|
+
display: "flex",
|
|
1615
|
+
alignItems: "center",
|
|
1616
|
+
justifyContent: "space-between",
|
|
1617
|
+
// Para espaciar el valor y el icono
|
|
1618
|
+
gap: 1,
|
|
1619
|
+
// Espacio entre elementos
|
|
1620
|
+
width: "100%",
|
|
1621
|
+
height: "100%",
|
|
1622
|
+
paddingLeft: "8px",
|
|
1623
|
+
backgroundColor: "rgba(255, 193, 7, 0.1)",
|
|
1624
|
+
// Amarillo claro para advertencia
|
|
1625
|
+
border: "1px dashed rgba(255, 193, 7, 0.5)",
|
|
1626
|
+
boxSizing: "border-box",
|
|
1627
|
+
overflow: "hidden"
|
|
1628
|
+
// Evita que el contenido se desborde
|
|
1629
|
+
},
|
|
1630
|
+
children: [
|
|
1631
|
+
/* @__PURE__ */ jsx7(Typography3, { variant: "body2", noWrap: true, sx: { flexGrow: 1 }, children: clientSideName + " not found" }),
|
|
1632
|
+
/* @__PURE__ */ jsx7(
|
|
1633
|
+
WarningAmberIcon2,
|
|
1634
|
+
{
|
|
1635
|
+
sx: {
|
|
1636
|
+
fontSize: 18,
|
|
1637
|
+
color: "warning.main",
|
|
1638
|
+
marginRight: "4px"
|
|
1639
|
+
// Pequeño margen a la derecha del icono
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
)
|
|
1643
|
+
]
|
|
1644
|
+
}
|
|
1645
|
+
) });
|
|
1646
|
+
};
|
|
1647
|
+
var FallbackClientSideRenderer_default = FallbackClientSideRenderer;
|
|
1648
|
+
|
|
1649
|
+
// src/components/grid/ClientSideDisplayUrl.tsx
|
|
1650
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1651
|
+
var ClientSideDisplayUrl = ({ row, column }) => {
|
|
1652
|
+
const valor = row[column.key];
|
|
1653
|
+
if (valor === null || valor === void 0 || valor === "") return null;
|
|
1654
|
+
const url = String(valor);
|
|
1655
|
+
return /* @__PURE__ */ jsx8("a", { className: "fpr-celda", href: url, target: "_blank", rel: "noopener noreferrer", children: url });
|
|
1656
|
+
};
|
|
1657
|
+
var ClientSideDisplayUrl_default = ClientSideDisplayUrl;
|
|
1658
|
+
|
|
1659
|
+
// src/utils/columnasOcultas.ts
|
|
1660
|
+
function columnasOcultasIniciales(tableDefinition) {
|
|
1661
|
+
return Array.from(new Set(tableDefinition.hiddenColumns ?? []));
|
|
1662
|
+
}
|
|
1663
|
+
function campoDibujable(field) {
|
|
1664
|
+
return field.visible !== false;
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
// src/components/grid/clientSides.ts
|
|
1668
|
+
var clientSides = {
|
|
1669
|
+
"ExampleClientSideComponent": ExampleClientSideComponent_default,
|
|
1670
|
+
"FallbackClientSideRenderer": FallbackClientSideRenderer_default,
|
|
1671
|
+
"displayUrl": ClientSideDisplayUrl_default
|
|
1672
|
+
};
|
|
1673
|
+
var guardadosPropios = {
|
|
1674
|
+
// `newPass` de backend-plus: la clave nueva del usuario de la fila
|
|
1675
|
+
newPass: async ({ fila, primaryKey, valor, callApi }) => {
|
|
1676
|
+
const claveNueva = typeof valor === "string" ? valor.trim() : "";
|
|
1677
|
+
if (!claveNueva) return;
|
|
1678
|
+
await callApi("admin_chpass", { user: fila[primaryKey[primaryKey.length - 1]], newpass: claveNueva });
|
|
1679
|
+
}
|
|
1680
|
+
};
|
|
1681
|
+
var campoEditableEnCelda = (campo) => campo?.editable !== false && (!campo?.clientSide || campo.clientSide in guardadosPropios);
|
|
1682
|
+
var clientSidesSinImplementar = (tableDefinition) => {
|
|
1683
|
+
const deCampos = tableDefinition.fields.flatMap(
|
|
1684
|
+
(campo) => campo.clientSide && campoDibujable(campo) && !clientSides[campo.clientSide] && !guardadosPropios[campo.clientSide] ? [campo.clientSide] : []
|
|
1685
|
+
);
|
|
1686
|
+
const deTabla = tableDefinition.clientSide ? [tableDefinition.clientSide] : [];
|
|
1687
|
+
return [.../* @__PURE__ */ new Set([...deCampos, ...deTabla])];
|
|
1688
|
+
};
|
|
1689
|
+
var extendClientSides = (newRenderers) => {
|
|
1690
|
+
clientSides = { ...clientSides, ...newRenderers };
|
|
1691
|
+
console.log("clientSides extendidos:", clientSides);
|
|
1692
|
+
};
|
|
1693
|
+
|
|
1584
1694
|
// src/hooks/grid/useGridEvents.ts
|
|
1585
1695
|
var VIGENCIA_TECLA_PENDIENTE = 400;
|
|
1586
1696
|
var VIGENCIA_VALOR_PENDIENTE_F4 = 1e3;
|
|
@@ -1611,7 +1721,7 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1611
1721
|
const currentColumnIndex = currentColumns.findIndex((col) => col.key === columnKey);
|
|
1612
1722
|
const editableColumns = currentColumns.filter((col) => {
|
|
1613
1723
|
const fieldDefinition = tableDefinition2.fields.find((f) => f.name === col.key);
|
|
1614
|
-
return col.key !== "actionsColumn" && !(esColumnaPropia(col) && col.customType === "detail") && (fieldDefinition
|
|
1724
|
+
return col.key !== "actionsColumn" && !(esColumnaPropia(col) && col.customType === "detail") && campoEditableEnCelda(fieldDefinition);
|
|
1615
1725
|
});
|
|
1616
1726
|
const { key, target } = event;
|
|
1617
1727
|
const teclaAnterior = teclaAnteriorRef.current;
|
|
@@ -1742,7 +1852,7 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1742
1852
|
if (esFilaDetalle(args.row)) return;
|
|
1743
1853
|
const fieldDefinition = tableDefinition?.fields.find((f) => f.name === args.column.key);
|
|
1744
1854
|
const isFixedField = valorFijoDe(fixedFields, args.column.key) !== void 0;
|
|
1745
|
-
const isEditable = fieldDefinition
|
|
1855
|
+
const isEditable = campoEditableEnCelda(fieldDefinition) && !isFixedField;
|
|
1746
1856
|
if (isEditable) {
|
|
1747
1857
|
args.selectCell(true);
|
|
1748
1858
|
} else if (fieldDefinition && tipoDeExpander(fieldDefinition, false) !== null) {
|
|
@@ -1927,7 +2037,7 @@ import * as JSON4all2 from "json4all";
|
|
|
1927
2037
|
var cambiarGuionesBajosPorEspacios = (texto) => texto.replace(/_/g, " ");
|
|
1928
2038
|
|
|
1929
2039
|
// src/components/grid/renderers/headerCellRenderers.tsx
|
|
1930
|
-
import { Box as
|
|
2040
|
+
import { Box as Box5, IconButton as IconButton2, Tooltip as Tooltip3, Typography as Typography4 } from "@mui/material";
|
|
1931
2041
|
import SearchIcon from "@mui/icons-material/Search";
|
|
1932
2042
|
import SearchOffIcon from "@mui/icons-material/SearchOff";
|
|
1933
2043
|
import MoreVertIcon from "@mui/icons-material/MoreVert";
|
|
@@ -1985,7 +2095,7 @@ var VistaGrillaContext = createContext3({ isFilterRowVisible: false });
|
|
|
1985
2095
|
var useVistaGrilla = () => useContext3(VistaGrillaContext);
|
|
1986
2096
|
|
|
1987
2097
|
// src/components/grid/renderers/headerCellRenderers.tsx
|
|
1988
|
-
import { jsx as
|
|
2098
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1989
2099
|
var defaultColumnHeaderCellRenderer = (props, fieldDef, ocultarColumna) => {
|
|
1990
2100
|
const { column, sortDirection, priority } = props;
|
|
1991
2101
|
const isPrimaryKey = fieldDef.isPk;
|
|
@@ -1998,8 +2108,8 @@ var defaultColumnHeaderCellRenderer = (props, fieldDef, ocultarColumna) => {
|
|
|
1998
2108
|
return "#AAAAAA";
|
|
1999
2109
|
};
|
|
2000
2110
|
const sortColor = sorted ? getSortColor(sortIndex) : "transparent";
|
|
2001
|
-
return /* @__PURE__ */
|
|
2002
|
-
|
|
2111
|
+
return /* @__PURE__ */ jsxs6(
|
|
2112
|
+
Box5,
|
|
2003
2113
|
{
|
|
2004
2114
|
onClickCapture: (e) => {
|
|
2005
2115
|
if (!e.altKey || !ocultarColumna) return;
|
|
@@ -2016,8 +2126,8 @@ var defaultColumnHeaderCellRenderer = (props, fieldDef, ocultarColumna) => {
|
|
|
2016
2126
|
width: "100%"
|
|
2017
2127
|
},
|
|
2018
2128
|
children: [
|
|
2019
|
-
/* @__PURE__ */
|
|
2020
|
-
|
|
2129
|
+
/* @__PURE__ */ jsx9(
|
|
2130
|
+
Typography4,
|
|
2021
2131
|
{
|
|
2022
2132
|
variant: "body2",
|
|
2023
2133
|
sx: {
|
|
@@ -2034,7 +2144,7 @@ var defaultColumnHeaderCellRenderer = (props, fieldDef, ocultarColumna) => {
|
|
|
2034
2144
|
children: column.name
|
|
2035
2145
|
}
|
|
2036
2146
|
),
|
|
2037
|
-
sorted && /* @__PURE__ */
|
|
2147
|
+
sorted && /* @__PURE__ */ jsx9(Box5, { sx: { color: sortColor, display: "flex", alignItems: "center", ml: 0.5, fontSize: "0.7rem" }, children: sortDirection === "ASC" ? "\u25B2" : "\u25BC" })
|
|
2038
2148
|
]
|
|
2039
2149
|
}
|
|
2040
2150
|
);
|
|
@@ -2046,43 +2156,43 @@ var ActionsColumnHeaderCell = ({
|
|
|
2046
2156
|
allowInsert
|
|
2047
2157
|
}) => {
|
|
2048
2158
|
const { isFilterRowVisible } = useVistaGrilla();
|
|
2049
|
-
return /* @__PURE__ */
|
|
2050
|
-
allowInsert && /* @__PURE__ */
|
|
2159
|
+
return /* @__PURE__ */ jsxs6(Box5, { sx: { display: "flex", flexDirection: "row", alignItems: "center", justifyContent: "center", gap: 0.2 }, children: [
|
|
2160
|
+
allowInsert && /* @__PURE__ */ jsx9(
|
|
2051
2161
|
IconButton2,
|
|
2052
2162
|
{
|
|
2053
2163
|
onClick: () => handleAddRow(),
|
|
2054
2164
|
size: "small",
|
|
2055
2165
|
title: "A\xF1adir registro",
|
|
2056
2166
|
sx: { p: 0.25, color: "grey.800", "&:hover": { color: "success.main" } },
|
|
2057
|
-
children: /* @__PURE__ */
|
|
2167
|
+
children: /* @__PURE__ */ jsx9(AddIcon, { sx: { fontSize: 18 } })
|
|
2058
2168
|
}
|
|
2059
2169
|
),
|
|
2060
|
-
/* @__PURE__ */
|
|
2170
|
+
/* @__PURE__ */ jsx9(
|
|
2061
2171
|
IconButton2,
|
|
2062
2172
|
{
|
|
2063
2173
|
onClick: toggleFilterVisibility,
|
|
2064
2174
|
size: "small",
|
|
2065
2175
|
title: isFilterRowVisible ? "Ocultar filtros" : "Mostrar filtros",
|
|
2066
2176
|
sx: { p: 0.25, color: "grey.800" },
|
|
2067
|
-
children: isFilterRowVisible ? /* @__PURE__ */
|
|
2177
|
+
children: isFilterRowVisible ? /* @__PURE__ */ jsx9(SearchOffIcon, { sx: { fontSize: 18 } }) : /* @__PURE__ */ jsx9(SearchIcon, { sx: { fontSize: 18 } })
|
|
2068
2178
|
}
|
|
2069
2179
|
),
|
|
2070
|
-
/* @__PURE__ */
|
|
2180
|
+
/* @__PURE__ */ jsx9(
|
|
2071
2181
|
IconButton2,
|
|
2072
2182
|
{
|
|
2073
2183
|
onClick: (event) => handleDataGridOptions(event),
|
|
2074
2184
|
size: "small",
|
|
2075
2185
|
title: "Opciones de esta tabla",
|
|
2076
2186
|
sx: { p: 0.25, color: "grey.800" },
|
|
2077
|
-
children: /* @__PURE__ */
|
|
2187
|
+
children: /* @__PURE__ */ jsx9(MoreVertIcon, { sx: { fontSize: 20, variant: "filled", size: "small" } })
|
|
2078
2188
|
}
|
|
2079
2189
|
)
|
|
2080
2190
|
] });
|
|
2081
2191
|
};
|
|
2082
|
-
var detailColumnCellHeaderRenderer = (props, detailTable) => /* @__PURE__ */
|
|
2192
|
+
var detailColumnCellHeaderRenderer = (props, detailTable) => /* @__PURE__ */ jsx9(Tooltip3, { title: detailTable.label, children: /* @__PURE__ */ jsx9(Box5, { sx: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsx9(Typography4, { variant: "caption", sx: { fontSize: "0.75rem", fontWeight: "bold" }, children: detailTable.abr.toUpperCase() }) }) });
|
|
2083
2193
|
|
|
2084
2194
|
// src/components/grid/FilterInputRender.tsx
|
|
2085
|
-
import { InputBase as InputBase3, Box as
|
|
2195
|
+
import { InputBase as InputBase3, Box as Box6 } from "@mui/material";
|
|
2086
2196
|
import React10 from "react";
|
|
2087
2197
|
|
|
2088
2198
|
// src/components/forms/TypedField.tsx
|
|
@@ -2109,8 +2219,8 @@ import SearchIcon2 from "@mui/icons-material/Search";
|
|
|
2109
2219
|
|
|
2110
2220
|
// src/components/grid/MenuDeOpciones.tsx
|
|
2111
2221
|
import { useEffect as useEffect3, useMemo as useMemo5, useRef as useRef4, useState as useState7 } from "react";
|
|
2112
|
-
import { InputBase, List as List2, ListItemButton as ListItemButton2, Popover as Popover2, Typography as
|
|
2113
|
-
import { jsx as
|
|
2222
|
+
import { InputBase, List as List2, ListItemButton as ListItemButton2, Popover as Popover2, Typography as Typography5 } from "@mui/material";
|
|
2223
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2114
2224
|
function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar }) {
|
|
2115
2225
|
const [busqueda, setBusqueda] = useState7(busquedaInicial);
|
|
2116
2226
|
const [indice, setIndice] = useState7(0);
|
|
@@ -2134,7 +2244,7 @@ function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar
|
|
|
2134
2244
|
evento.preventDefault();
|
|
2135
2245
|
evento.stopPropagation();
|
|
2136
2246
|
};
|
|
2137
|
-
return /* @__PURE__ */
|
|
2247
|
+
return /* @__PURE__ */ jsxs7(
|
|
2138
2248
|
Popover2,
|
|
2139
2249
|
{
|
|
2140
2250
|
open: true,
|
|
@@ -2144,7 +2254,7 @@ function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar
|
|
|
2144
2254
|
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
2145
2255
|
slotProps: { paper: { sx: { minWidth: 300, maxWidth: 520 } } },
|
|
2146
2256
|
children: [
|
|
2147
|
-
/* @__PURE__ */
|
|
2257
|
+
/* @__PURE__ */ jsx10(
|
|
2148
2258
|
InputBase,
|
|
2149
2259
|
{
|
|
2150
2260
|
autoFocus: true,
|
|
@@ -2160,9 +2270,9 @@ function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar
|
|
|
2160
2270
|
inputProps: { "aria-label": "buscar" }
|
|
2161
2271
|
}
|
|
2162
2272
|
),
|
|
2163
|
-
/* @__PURE__ */
|
|
2164
|
-
visibles.length === 0 && /* @__PURE__ */
|
|
2165
|
-
visibles.map((opcion, i) => /* @__PURE__ */
|
|
2273
|
+
/* @__PURE__ */ jsxs7(List2, { dense: true, disablePadding: true, sx: { maxHeight: 320, overflowY: "auto" }, role: "listbox", children: [
|
|
2274
|
+
visibles.length === 0 && /* @__PURE__ */ jsx10(Typography5, { variant: "body2", sx: { p: 1, color: "text.secondary" }, children: "sin coincidencias" }),
|
|
2275
|
+
visibles.map((opcion, i) => /* @__PURE__ */ jsx10(
|
|
2166
2276
|
ListItemButton2,
|
|
2167
2277
|
{
|
|
2168
2278
|
ref: i === indice ? elegida : null,
|
|
@@ -2170,7 +2280,7 @@ function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar
|
|
|
2170
2280
|
role: "option",
|
|
2171
2281
|
onClick: () => onElegir(opcion.valor),
|
|
2172
2282
|
sx: { gap: 2, py: 0.25, fontSize: "0.8rem" },
|
|
2173
|
-
children: opcion.etiquetas.map((etiqueta, j) => /* @__PURE__ */
|
|
2283
|
+
children: opcion.etiquetas.map((etiqueta, j) => /* @__PURE__ */ jsx10("span", { style: { fontWeight: j === 0 ? 600 : 400, minWidth: j === 0 ? 40 : void 0 }, children: etiqueta }, j))
|
|
2174
2284
|
},
|
|
2175
2285
|
i
|
|
2176
2286
|
))
|
|
@@ -2182,8 +2292,8 @@ function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar
|
|
|
2182
2292
|
|
|
2183
2293
|
// src/components/grid/SelectorDeFecha.tsx
|
|
2184
2294
|
import { useState as useState8 } from "react";
|
|
2185
|
-
import { Button as Button2, IconButton as IconButton3, Popover as Popover3, Typography as
|
|
2186
|
-
import { jsx as
|
|
2295
|
+
import { Button as Button2, IconButton as IconButton3, Popover as Popover3, Typography as Typography6 } from "@mui/material";
|
|
2296
|
+
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2187
2297
|
var MESES = ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"];
|
|
2188
2298
|
var DIAS = ["lu", "ma", "mi", "ju", "vi", "s\xE1", "do"];
|
|
2189
2299
|
var mismaFecha = (a, b) => b !== null && a.anio === b.anio && a.mes === b.mes && a.dia === b.dia;
|
|
@@ -2216,22 +2326,22 @@ function SelectorDeFecha({ anclaje, fechaActual, admiteNulo, onElegir, onCerrar
|
|
|
2216
2326
|
evento.preventDefault();
|
|
2217
2327
|
evento.stopPropagation();
|
|
2218
2328
|
};
|
|
2219
|
-
return /* @__PURE__ */
|
|
2220
|
-
/* @__PURE__ */
|
|
2221
|
-
/* @__PURE__ */
|
|
2222
|
-
/* @__PURE__ */
|
|
2329
|
+
return /* @__PURE__ */ jsx11(Popover3, { open: true, anchorEl: anclaje, onClose: onCerrar, disableRestoreFocus: true, anchorOrigin: { vertical: "bottom", horizontal: "left" }, children: /* @__PURE__ */ jsxs8("div", { tabIndex: 0, ref: (el) => el?.focus(), onKeyDown: alApretar, style: { padding: 8, outline: "none", width: 252 }, "aria-label": "calendario", children: [
|
|
2330
|
+
/* @__PURE__ */ jsxs8("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
2331
|
+
/* @__PURE__ */ jsx11(IconButton3, { size: "small", "aria-label": "mes anterior", onClick: () => mover(0, -1), children: "\u2039" }),
|
|
2332
|
+
/* @__PURE__ */ jsxs8(Typography6, { variant: "body2", sx: { fontWeight: 600 }, children: [
|
|
2223
2333
|
MESES[cursor.mes],
|
|
2224
2334
|
" ",
|
|
2225
2335
|
cursor.anio
|
|
2226
2336
|
] }),
|
|
2227
|
-
/* @__PURE__ */
|
|
2337
|
+
/* @__PURE__ */ jsx11(IconButton3, { size: "small", "aria-label": "mes siguiente", onClick: () => mover(0, 1), children: "\u203A" })
|
|
2228
2338
|
] }),
|
|
2229
|
-
/* @__PURE__ */
|
|
2230
|
-
/* @__PURE__ */
|
|
2231
|
-
/* @__PURE__ */
|
|
2339
|
+
/* @__PURE__ */ jsxs8("table", { style: { borderCollapse: "collapse", width: "100%", textAlign: "center", fontSize: "0.8rem" }, children: [
|
|
2340
|
+
/* @__PURE__ */ jsx11("thead", { children: /* @__PURE__ */ jsx11("tr", { children: DIAS.map((d) => /* @__PURE__ */ jsx11("th", { style: { fontWeight: 400, color: "#777" }, children: d }, d)) }) }),
|
|
2341
|
+
/* @__PURE__ */ jsx11("tbody", { children: semanasDelMes(cursor.anio, cursor.mes).map((semana, i) => /* @__PURE__ */ jsx11("tr", { children: semana.map((dia) => {
|
|
2232
2342
|
const elegido = mismaFecha(dia, fechaActual);
|
|
2233
2343
|
const enCursor = mismaFecha(dia, cursor);
|
|
2234
|
-
return /* @__PURE__ */
|
|
2344
|
+
return /* @__PURE__ */ jsx11("td", { style: { padding: 1 }, children: /* @__PURE__ */ jsx11(
|
|
2235
2345
|
"button",
|
|
2236
2346
|
{
|
|
2237
2347
|
type: "button",
|
|
@@ -2251,9 +2361,9 @@ function SelectorDeFecha({ anclaje, fechaActual, admiteNulo, onElegir, onCerrar
|
|
|
2251
2361
|
) }, `${dia.mes}-${dia.dia}`);
|
|
2252
2362
|
}) }, i)) })
|
|
2253
2363
|
] }),
|
|
2254
|
-
/* @__PURE__ */
|
|
2255
|
-
/* @__PURE__ */
|
|
2256
|
-
admiteNulo && /* @__PURE__ */
|
|
2364
|
+
/* @__PURE__ */ jsxs8("div", { style: { display: "flex", justifyContent: "space-between", marginTop: 4 }, children: [
|
|
2365
|
+
/* @__PURE__ */ jsx11(Button2, { size: "small", onClick: () => onElegir(fechaATexto(fechaDeHoy)), children: "hoy" }),
|
|
2366
|
+
admiteNulo && /* @__PURE__ */ jsx11(Button2, { size: "small", onClick: () => onElegir(null), children: "vac\xEDo" })
|
|
2257
2367
|
] })
|
|
2258
2368
|
] }) });
|
|
2259
2369
|
}
|
|
@@ -2261,7 +2371,7 @@ function SelectorDeFecha({ anclaje, fechaActual, admiteNulo, onElegir, onCerrar
|
|
|
2261
2371
|
// src/components/grid/VentanaDeTexto.tsx
|
|
2262
2372
|
import { useState as useState9 } from "react";
|
|
2263
2373
|
import { Button as Button3, InputBase as InputBase2, Popover as Popover4 } from "@mui/material";
|
|
2264
|
-
import { jsx as
|
|
2374
|
+
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2265
2375
|
function VentanaDeTexto({ anclaje, texto, editable, onAceptar, onCerrar }) {
|
|
2266
2376
|
const [valor, setValor] = useState9(texto);
|
|
2267
2377
|
const alApretar = (evento) => {
|
|
@@ -2275,8 +2385,8 @@ function VentanaDeTexto({ anclaje, texto, editable, onAceptar, onCerrar }) {
|
|
|
2275
2385
|
evento.preventDefault();
|
|
2276
2386
|
evento.stopPropagation();
|
|
2277
2387
|
};
|
|
2278
|
-
return /* @__PURE__ */
|
|
2279
|
-
/* @__PURE__ */
|
|
2388
|
+
return /* @__PURE__ */ jsx12(Popover4, { open: true, anchorEl: anclaje, onClose: onCerrar, disableRestoreFocus: true, anchorOrigin: { vertical: "bottom", horizontal: "left" }, children: /* @__PURE__ */ jsxs9("div", { style: { padding: 8, minWidth: 320, maxWidth: 640 }, children: [
|
|
2389
|
+
/* @__PURE__ */ jsx12(
|
|
2280
2390
|
InputBase2,
|
|
2281
2391
|
{
|
|
2282
2392
|
autoFocus: true,
|
|
@@ -2292,15 +2402,15 @@ function VentanaDeTexto({ anclaje, texto, editable, onAceptar, onCerrar }) {
|
|
|
2292
2402
|
inputProps: { "aria-label": "contenido de la celda" }
|
|
2293
2403
|
}
|
|
2294
2404
|
),
|
|
2295
|
-
editable && /* @__PURE__ */
|
|
2296
|
-
/* @__PURE__ */
|
|
2297
|
-
/* @__PURE__ */
|
|
2405
|
+
editable && /* @__PURE__ */ jsxs9("div", { style: { display: "flex", justifyContent: "flex-end", gap: 8, marginTop: 4 }, children: [
|
|
2406
|
+
/* @__PURE__ */ jsx12(Button3, { size: "small", onClick: onCerrar, children: "cancelar" }),
|
|
2407
|
+
/* @__PURE__ */ jsx12(Button3, { size: "small", variant: "contained", onClick: () => onAceptar(valor), children: "aceptar" })
|
|
2298
2408
|
] })
|
|
2299
2409
|
] }) });
|
|
2300
2410
|
}
|
|
2301
2411
|
|
|
2302
2412
|
// src/hooks/grid/useExpander.tsx
|
|
2303
|
-
import { jsx as
|
|
2413
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
2304
2414
|
var useExpander = ({ campo, editable, fila, admiteNulo, tipos, anclaje, textoActual, valorActual, alElegirValor, alConfirmarTexto, alFallar }) => {
|
|
2305
2415
|
const [expansion, setExpansion] = useState10(null);
|
|
2306
2416
|
const abierto = React8.useRef(false);
|
|
@@ -2346,7 +2456,7 @@ var useExpander = ({ campo, editable, fila, admiteNulo, tipos, anclaje, textoAct
|
|
|
2346
2456
|
return true;
|
|
2347
2457
|
}, [tipo, abrir]);
|
|
2348
2458
|
const titulo = tipo === "fecha" ? "elegir fecha (F9)" : tipo === "texto" ? "ver el contenido completo (F9)" : "elegir un valor (F9)";
|
|
2349
|
-
const lupa = tipo === null ? null : /* @__PURE__ */
|
|
2459
|
+
const lupa = tipo === null ? null : /* @__PURE__ */ jsx13(
|
|
2350
2460
|
IconButton4,
|
|
2351
2461
|
{
|
|
2352
2462
|
size: "small",
|
|
@@ -2359,16 +2469,16 @@ var useExpander = ({ campo, editable, fila, admiteNulo, tipos, anclaje, textoAct
|
|
|
2359
2469
|
void abrir("");
|
|
2360
2470
|
},
|
|
2361
2471
|
sx: { p: 0, ml: 0.25, color: "primary.main", "&:hover": { backgroundColor: "action.hover" } },
|
|
2362
|
-
children: tipo === "fecha" ? /* @__PURE__ */
|
|
2472
|
+
children: tipo === "fecha" ? /* @__PURE__ */ jsx13(CalendarMonthIcon, { sx: { fontSize: 16 } }) : tipo === "texto" ? /* @__PURE__ */ jsx13(SearchIcon2, { sx: { fontSize: 16 } }) : /* @__PURE__ */ jsx13(ArrowDropDownIcon, { sx: { fontSize: 20 } })
|
|
2363
2473
|
}
|
|
2364
2474
|
);
|
|
2365
2475
|
const base = anclaje.current;
|
|
2366
|
-
const ventana = !expansion || !base ? null : expansion.tipo === "opciones" ? /* @__PURE__ */
|
|
2476
|
+
const ventana = !expansion || !base ? null : expansion.tipo === "opciones" ? /* @__PURE__ */ jsx13(MenuDeOpciones, { anclaje: base, opciones: expansion.opciones, busquedaInicial: expansion.busqueda, onElegir: elegirValor, onCerrar: cerrar }) : expansion.tipo === "fecha" ? /* @__PURE__ */ jsx13(SelectorDeFecha, { anclaje: base, fechaActual: fechaDeValor(valorActual), admiteNulo, onElegir: confirmarTexto, onCerrar: cerrar }) : /* @__PURE__ */ jsx13(VentanaDeTexto, { anclaje: base, texto: textoActual, editable: true, onAceptar: confirmarTexto, onCerrar: cerrar });
|
|
2367
2477
|
return { tipo, abierto, abrir, manejarTecla, lupa, ventana };
|
|
2368
2478
|
};
|
|
2369
2479
|
|
|
2370
2480
|
// src/components/forms/TypedField.tsx
|
|
2371
|
-
import { Fragment as Fragment3, jsx as
|
|
2481
|
+
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2372
2482
|
var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode = false, feedback, isMandatory = false }) => {
|
|
2373
2483
|
const theme = useTheme();
|
|
2374
2484
|
const typer = useMemo6(() => typeStore3.typerFrom(fieldDef), [fieldDef]);
|
|
@@ -2496,28 +2606,28 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2496
2606
|
}
|
|
2497
2607
|
const cellBackgroundColor2 = feedback === "error" ? theme.palette.error.light : feedback === "success" ? theme.palette.success.light : defaultBgColor;
|
|
2498
2608
|
const transitionStyle2 = "background-color 0.3s ease-in-out";
|
|
2499
|
-
return /* @__PURE__ */
|
|
2500
|
-
!isFilterMode && /* @__PURE__ */
|
|
2501
|
-
/* @__PURE__ */
|
|
2609
|
+
return /* @__PURE__ */ jsxs10(FormControl, { fullWidth: true, error: !!errorMsg && !isFilterMode, disabled: isDisabled, size: "small", margin: "dense", children: [
|
|
2610
|
+
!isFilterMode && /* @__PURE__ */ jsx14(InputLabel, { shrink: true, children: fieldDef.name }),
|
|
2611
|
+
/* @__PURE__ */ jsxs10(
|
|
2502
2612
|
Select,
|
|
2503
2613
|
{
|
|
2504
2614
|
value: boolVal,
|
|
2505
2615
|
label: !isFilterMode ? fieldDef.name : void 0,
|
|
2506
2616
|
onChange: handleBooleanChange,
|
|
2507
|
-
startAdornment: isMandatory && isEmpty && !isFilterMode ? /* @__PURE__ */
|
|
2617
|
+
startAdornment: isMandatory && isEmpty && !isFilterMode ? /* @__PURE__ */ jsx14(InputAdornment, { position: "start", sx: { color: "text.secondary", ml: 0.5 }, children: "*" }) : void 0,
|
|
2508
2618
|
displayEmpty: true,
|
|
2509
2619
|
sx: isFilterMode ? { height: 25, fontSize: "0.8rem", backgroundColor: "background.paper" } : {
|
|
2510
2620
|
backgroundColor: cellBackgroundColor2,
|
|
2511
2621
|
transition: transitionStyle2
|
|
2512
2622
|
},
|
|
2513
2623
|
children: [
|
|
2514
|
-
fieldDef.nullable !== false && /* @__PURE__ */
|
|
2515
|
-
/* @__PURE__ */
|
|
2516
|
-
/* @__PURE__ */
|
|
2624
|
+
fieldDef.nullable !== false && /* @__PURE__ */ jsx14(MenuItem, { value: "", children: /* @__PURE__ */ jsx14("em", { children: "Nulo / Sin Especificar" }) }),
|
|
2625
|
+
/* @__PURE__ */ jsx14(MenuItem, { value: "true", children: "S\xED (Verdadero)" }),
|
|
2626
|
+
/* @__PURE__ */ jsx14(MenuItem, { value: "false", children: "No (Falso)" })
|
|
2517
2627
|
]
|
|
2518
2628
|
}
|
|
2519
2629
|
),
|
|
2520
|
-
errorMsg && !isFilterMode && /* @__PURE__ */
|
|
2630
|
+
errorMsg && !isFilterMode && /* @__PURE__ */ jsx14(FormHelperText, { children: errorMsg })
|
|
2521
2631
|
] });
|
|
2522
2632
|
}
|
|
2523
2633
|
let inputType = "text";
|
|
@@ -2531,8 +2641,8 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2531
2641
|
}
|
|
2532
2642
|
const cellBackgroundColor = feedback === "error" ? theme.palette.error.light : feedback === "success" ? theme.palette.success.light : defaultTextBgColor;
|
|
2533
2643
|
const transitionStyle = "background-color 0.3s ease-in-out";
|
|
2534
|
-
return /* @__PURE__ */
|
|
2535
|
-
/* @__PURE__ */
|
|
2644
|
+
return /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
2645
|
+
/* @__PURE__ */ jsx14(
|
|
2536
2646
|
TextField,
|
|
2537
2647
|
{
|
|
2538
2648
|
fullWidth: true,
|
|
@@ -2552,7 +2662,7 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2552
2662
|
// la lupa solo al enfocar el filtro, como en backend-plus
|
|
2553
2663
|
endAdornment: enfocado || expander.abierto.current ? expander.lupa : void 0
|
|
2554
2664
|
} : isMandatory && isEmptyText ? {
|
|
2555
|
-
startAdornment: /* @__PURE__ */
|
|
2665
|
+
startAdornment: /* @__PURE__ */ jsx14(InputAdornment, { position: "start", sx: { color: "text.secondary", mr: 0.5 }, children: "*" })
|
|
2556
2666
|
} : {},
|
|
2557
2667
|
inputProps: {
|
|
2558
2668
|
style: {
|
|
@@ -2592,7 +2702,7 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2592
2702
|
};
|
|
2593
2703
|
|
|
2594
2704
|
// src/components/grid/FilterInputRender.tsx
|
|
2595
|
-
import { jsx as
|
|
2705
|
+
import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2596
2706
|
function FilterInputRenderer({
|
|
2597
2707
|
columnKey,
|
|
2598
2708
|
currentFilter,
|
|
@@ -2617,8 +2727,8 @@ function FilterInputRenderer({
|
|
|
2617
2727
|
};
|
|
2618
2728
|
return (
|
|
2619
2729
|
// como en backend-plus, el operador es un símbolo chico y el campo se queda con el resto del ancho
|
|
2620
|
-
/* @__PURE__ */
|
|
2621
|
-
/* @__PURE__ */
|
|
2730
|
+
/* @__PURE__ */ jsxs11(Box6, { sx: { mt: 0, display: "flex", alignItems: "center", gap: "2px", width: "100%" }, children: [
|
|
2731
|
+
/* @__PURE__ */ jsx15(
|
|
2622
2732
|
"select",
|
|
2623
2733
|
{
|
|
2624
2734
|
value: operator,
|
|
@@ -2637,10 +2747,10 @@ function FilterInputRenderer({
|
|
|
2637
2747
|
textAlignLast: "center",
|
|
2638
2748
|
cursor: "pointer"
|
|
2639
2749
|
},
|
|
2640
|
-
children: filterOperators.map((op) => /* @__PURE__ */
|
|
2750
|
+
children: filterOperators.map((op) => /* @__PURE__ */ jsx15("option", { value: op.value, children: op.label }, op.value))
|
|
2641
2751
|
}
|
|
2642
2752
|
),
|
|
2643
|
-
/* @__PURE__ */
|
|
2753
|
+
/* @__PURE__ */ jsx15(
|
|
2644
2754
|
TypedField,
|
|
2645
2755
|
{
|
|
2646
2756
|
fieldDef,
|
|
@@ -2652,7 +2762,7 @@ function FilterInputRenderer({
|
|
|
2652
2762
|
] })
|
|
2653
2763
|
);
|
|
2654
2764
|
}
|
|
2655
|
-
return /* @__PURE__ */
|
|
2765
|
+
return /* @__PURE__ */ jsx15(
|
|
2656
2766
|
InputBase3,
|
|
2657
2767
|
{
|
|
2658
2768
|
value: currentFilter || "",
|
|
@@ -2678,15 +2788,15 @@ function FilterInputRenderer({
|
|
|
2678
2788
|
var FilterInputRender_default = React10.memo(FilterInputRenderer);
|
|
2679
2789
|
|
|
2680
2790
|
// src/components/grid/renderers/summaryCellRenderers.tsx
|
|
2681
|
-
import { Box as
|
|
2682
|
-
import { jsx as
|
|
2791
|
+
import { Box as Box7 } from "@mui/material";
|
|
2792
|
+
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2683
2793
|
var defaultColumnSummaryCellRenderer = (props, fixedFields) => {
|
|
2684
2794
|
const { column, row } = props;
|
|
2685
2795
|
if (row.id === "filterRow") {
|
|
2686
2796
|
const { filters, setFilters } = row;
|
|
2687
2797
|
if (valorFijoDe(fixedFields, column.key)) return null;
|
|
2688
2798
|
const fieldDef = esColumnaPropia(column) && column.customType === "default" ? column.fieldDef : void 0;
|
|
2689
|
-
return /* @__PURE__ */
|
|
2799
|
+
return /* @__PURE__ */ jsx16(Box7, { sx: { position: "absolute", inset: 0, display: "flex", alignItems: "center", px: "2px" }, children: /* @__PURE__ */ jsx16(
|
|
2690
2800
|
FilterInputRender_default,
|
|
2691
2801
|
{
|
|
2692
2802
|
columnKey: column.key,
|
|
@@ -2728,7 +2838,7 @@ var defaultColumnSummaryCellRenderer = (props, fixedFields) => {
|
|
|
2728
2838
|
label = "Cant S\xED: ";
|
|
2729
2839
|
break;
|
|
2730
2840
|
}
|
|
2731
|
-
return /* @__PURE__ */
|
|
2841
|
+
return /* @__PURE__ */ jsxs12(Box7, { sx: {
|
|
2732
2842
|
px: 0,
|
|
2733
2843
|
fontWeight: "bold",
|
|
2734
2844
|
fontSize: "0.875rem",
|
|
@@ -2751,80 +2861,7 @@ import { Box as Box8, IconButton as IconButton5, Tooltip as Tooltip4, useTheme a
|
|
|
2751
2861
|
import ViewHeadlineIcon from "@mui/icons-material/ViewHeadline";
|
|
2752
2862
|
import DeleteIcon from "@mui/icons-material/Delete";
|
|
2753
2863
|
import AddIcon2 from "@mui/icons-material/Add";
|
|
2754
|
-
|
|
2755
|
-
// src/components/grid/ExampleClientSideComponent.tsx
|
|
2756
|
-
import { Box as Box6, Typography as Typography5 } from "@mui/material";
|
|
2757
|
-
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
2758
|
-
var ExampleClientSideComponent = ({ row, column, fieldDefinition }) => {
|
|
2759
|
-
const value = row[column.key];
|
|
2760
|
-
return /* @__PURE__ */ jsx14(Box6, { sx: {
|
|
2761
|
-
padding: 0.5,
|
|
2762
|
-
width: "100%",
|
|
2763
|
-
height: "100%",
|
|
2764
|
-
display: "flex",
|
|
2765
|
-
alignItems: "center",
|
|
2766
|
-
backgroundColor: value === "Special" ? "lightblue" : "transparent"
|
|
2767
|
-
}, children: /* @__PURE__ */ jsx14(Typography5, { variant: "body2", sx: { fontWeight: "bold" }, children: value ? `CS: ${value}` : "N/A" }) });
|
|
2768
|
-
};
|
|
2769
|
-
var ExampleClientSideComponent_default = ExampleClientSideComponent;
|
|
2770
|
-
|
|
2771
|
-
// src/components/grid/FallbackClientSideRenderer.tsx
|
|
2772
|
-
import { Box as Box7, Typography as Typography6, Tooltip as Tooltip3 } from "@mui/material";
|
|
2773
|
-
import WarningAmberIcon2 from "@mui/icons-material/WarningAmber";
|
|
2774
|
-
import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2775
|
-
var FallbackClientSideRenderer = ({ column, row, fieldDefinition }) => {
|
|
2776
|
-
const clientSideName = fieldDefinition?.clientSide || "Desconocido";
|
|
2777
|
-
return /* @__PURE__ */ jsx15(Tooltip3, { title: `Componente clientSide '${clientSideName}' no implementado. Mostrando valor por defecto.`, children: /* @__PURE__ */ jsxs12(
|
|
2778
|
-
Box7,
|
|
2779
|
-
{
|
|
2780
|
-
sx: {
|
|
2781
|
-
display: "flex",
|
|
2782
|
-
alignItems: "center",
|
|
2783
|
-
justifyContent: "space-between",
|
|
2784
|
-
// Para espaciar el valor y el icono
|
|
2785
|
-
gap: 1,
|
|
2786
|
-
// Espacio entre elementos
|
|
2787
|
-
width: "100%",
|
|
2788
|
-
height: "100%",
|
|
2789
|
-
paddingLeft: "8px",
|
|
2790
|
-
backgroundColor: "rgba(255, 193, 7, 0.1)",
|
|
2791
|
-
// Amarillo claro para advertencia
|
|
2792
|
-
border: "1px dashed rgba(255, 193, 7, 0.5)",
|
|
2793
|
-
boxSizing: "border-box",
|
|
2794
|
-
overflow: "hidden"
|
|
2795
|
-
// Evita que el contenido se desborde
|
|
2796
|
-
},
|
|
2797
|
-
children: [
|
|
2798
|
-
/* @__PURE__ */ jsx15(Typography6, { variant: "body2", noWrap: true, sx: { flexGrow: 1 }, children: clientSideName + " not found" }),
|
|
2799
|
-
/* @__PURE__ */ jsx15(
|
|
2800
|
-
WarningAmberIcon2,
|
|
2801
|
-
{
|
|
2802
|
-
sx: {
|
|
2803
|
-
fontSize: 18,
|
|
2804
|
-
color: "warning.main",
|
|
2805
|
-
marginRight: "4px"
|
|
2806
|
-
// Pequeño margen a la derecha del icono
|
|
2807
|
-
}
|
|
2808
|
-
}
|
|
2809
|
-
)
|
|
2810
|
-
]
|
|
2811
|
-
}
|
|
2812
|
-
) });
|
|
2813
|
-
};
|
|
2814
|
-
var FallbackClientSideRenderer_default = FallbackClientSideRenderer;
|
|
2815
|
-
|
|
2816
|
-
// src/components/grid/clientSides.ts
|
|
2817
|
-
var clientSides = {
|
|
2818
|
-
"ExampleClientSideComponent": ExampleClientSideComponent_default,
|
|
2819
|
-
"FallbackClientSideRenderer": FallbackClientSideRenderer_default
|
|
2820
|
-
};
|
|
2821
|
-
var extendClientSides = (newRenderers) => {
|
|
2822
|
-
clientSides = { ...clientSides, ...newRenderers };
|
|
2823
|
-
console.log("clientSides extendidos:", clientSides);
|
|
2824
|
-
};
|
|
2825
|
-
|
|
2826
|
-
// src/components/grid/renderers/cellRenderers.tsx
|
|
2827
|
-
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
2864
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
2828
2865
|
var CeldaDato = React11.memo(function CeldaDato2({ row, columnKey, defaultColumn }) {
|
|
2829
2866
|
const theme = useTheme2();
|
|
2830
2867
|
const { primaryKey, fixedFields, typer, isMandatory, isNumeric } = defaultColumn;
|
|
@@ -2846,7 +2883,7 @@ var CeldaDato = React11.memo(function CeldaDato2({ row, columnKey, defaultColumn
|
|
|
2846
2883
|
displayValue = "* " + displayValue;
|
|
2847
2884
|
}
|
|
2848
2885
|
const signal = displayValue === "--" ? "typed-controls-signal-no-data" : displayValue === "//" ? "typed-controls-signal-unknown-data" : "";
|
|
2849
|
-
const celda = /* @__PURE__ */
|
|
2886
|
+
const celda = /* @__PURE__ */ jsx17(
|
|
2850
2887
|
"div",
|
|
2851
2888
|
{
|
|
2852
2889
|
className: `fpr-celda ${isNumeric ? "fpr-celda-numerica" : ""} ${signal} ${row[NEW_ROW_INDICATOR] ? "new-row-cell-animation" : ""}`,
|
|
@@ -2854,30 +2891,30 @@ var CeldaDato = React11.memo(function CeldaDato2({ row, columnKey, defaultColumn
|
|
|
2854
2891
|
children: displayValue
|
|
2855
2892
|
}
|
|
2856
2893
|
);
|
|
2857
|
-
return currentCellFeedback?.message ? /* @__PURE__ */
|
|
2894
|
+
return currentCellFeedback?.message ? /* @__PURE__ */ jsx17(Tooltip4, { title: currentCellFeedback.message, children: celda }) : celda;
|
|
2858
2895
|
});
|
|
2859
2896
|
var allColumnsCellRenderer = (props) => {
|
|
2860
2897
|
const { row, column } = props;
|
|
2861
2898
|
if (!esColumnaPropia(column)) return void 0;
|
|
2862
2899
|
if (esFilaDetalle(row)) {
|
|
2863
|
-
return column.customType === "action" ? /* @__PURE__ */
|
|
2900
|
+
return column.customType === "action" ? /* @__PURE__ */ jsx17(CeldaDetalle, { fila: row }) : null;
|
|
2864
2901
|
}
|
|
2865
2902
|
switch (column.customType) {
|
|
2866
2903
|
case "default": {
|
|
2867
2904
|
const defaultColumn = column;
|
|
2868
2905
|
const { fieldDef, tableDefinition, primaryKey } = defaultColumn;
|
|
2869
|
-
if (fieldDef?.clientSide) {
|
|
2906
|
+
if (fieldDef?.clientSide && !(fieldDef.clientSide in guardadosPropios)) {
|
|
2870
2907
|
const ClientSideComponent = clientSides[fieldDef.clientSide];
|
|
2871
2908
|
if (ClientSideComponent) {
|
|
2872
|
-
return /* @__PURE__ */
|
|
2909
|
+
return /* @__PURE__ */ jsx17(ClientSideComponent, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
|
|
2873
2910
|
}
|
|
2874
|
-
return /* @__PURE__ */
|
|
2911
|
+
return /* @__PURE__ */ jsx17(FallbackClientSideRenderer_default, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
|
|
2875
2912
|
}
|
|
2876
|
-
return /* @__PURE__ */
|
|
2913
|
+
return /* @__PURE__ */ jsx17(CeldaDato, { row, columnKey: props.column.key, defaultColumn });
|
|
2877
2914
|
}
|
|
2878
2915
|
case "detail": {
|
|
2879
2916
|
const { detailTable, primaryKey } = column;
|
|
2880
|
-
return /* @__PURE__ */
|
|
2917
|
+
return /* @__PURE__ */ jsx17(
|
|
2881
2918
|
BotonDetalle,
|
|
2882
2919
|
{
|
|
2883
2920
|
row,
|
|
@@ -2912,14 +2949,14 @@ var allColumnsCellRenderer = (props) => {
|
|
|
2912
2949
|
color: "primary"
|
|
2913
2950
|
}
|
|
2914
2951
|
];
|
|
2915
|
-
return /* @__PURE__ */
|
|
2952
|
+
return /* @__PURE__ */ jsx17(Box8, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%", gap: 0.5 }, children: gridActionButtons.map((actionDef) => tableDefinition.allow[actionDef.action] ? /* @__PURE__ */ jsx17(
|
|
2916
2953
|
IconButton5,
|
|
2917
2954
|
{
|
|
2918
2955
|
size: "small",
|
|
2919
2956
|
onClick: () => actionDef.handler(row),
|
|
2920
2957
|
title: actionDef.title,
|
|
2921
2958
|
sx: { width: 22, height: 22, p: 0, color: "grey.800", "&:hover": { color: `${actionDef.color}.main` } },
|
|
2922
|
-
children: /* @__PURE__ */
|
|
2959
|
+
children: /* @__PURE__ */ jsx17(actionDef.icon, { sx: { fontSize: 18 } })
|
|
2923
2960
|
},
|
|
2924
2961
|
actionDef.action
|
|
2925
2962
|
) : null) });
|
|
@@ -2985,7 +3022,7 @@ var useTableRecordSave = () => {
|
|
|
2985
3022
|
import InputBase4 from "@mui/material/InputBase";
|
|
2986
3023
|
import { Tooltip as Tooltip5, useTheme as useTheme3 } from "@mui/material";
|
|
2987
3024
|
import typeStore4 from "type-store";
|
|
2988
|
-
import { Fragment as Fragment4, jsx as
|
|
3025
|
+
import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2989
3026
|
function findChangedValues(oldRowData, newRowData, isNewRow) {
|
|
2990
3027
|
let changes = [];
|
|
2991
3028
|
for (const key in newRowData) {
|
|
@@ -3018,6 +3055,7 @@ function InputRenderer({
|
|
|
3018
3055
|
const theme = useTheme3();
|
|
3019
3056
|
const { showSuccess, showError } = useSnackbar();
|
|
3020
3057
|
const { saveRecord } = useTableRecordSave();
|
|
3058
|
+
const { callApi } = useApiCall();
|
|
3021
3059
|
const rowId = getPrimaryKeyValues(row, primaryKey);
|
|
3022
3060
|
const cellKey = `${rowId}-${column.key}`;
|
|
3023
3061
|
const currentCellFeedback = useFeedbackCelda(cellKey);
|
|
@@ -3059,6 +3097,20 @@ function InputRenderer({
|
|
|
3059
3097
|
const oldRowData = { ...row };
|
|
3060
3098
|
const primaryKeyValuesForBackend = tableDefinition.primaryKey.map((key) => potentialUpdatedRow[key]);
|
|
3061
3099
|
const currentRowIdBeforeUpdate = getPrimaryKeyValues(oldRowData, tableDefinition.primaryKey);
|
|
3100
|
+
const guardadoPropio = fieldDefinition.clientSide ? guardadosPropios[fieldDefinition.clientSide] : void 0;
|
|
3101
|
+
if (guardadoPropio && !isNewRow) {
|
|
3102
|
+
onRowChange(row, true);
|
|
3103
|
+
const claveDeLaCelda = `${currentRowIdBeforeUpdate}-${column.key}`;
|
|
3104
|
+
try {
|
|
3105
|
+
await guardadoPropio({ fila: row, primaryKey: tableDefinition.primaryKey, valor: processedNewValue, callApi });
|
|
3106
|
+
setCellFeedbackMap((prev) => new Map(prev).set(claveDeLaCelda, { rowId: currentRowIdBeforeUpdate, columnKey: column.key, type: "success" }));
|
|
3107
|
+
} catch (err) {
|
|
3108
|
+
setCellFeedbackMap((prev) => new Map(prev).set(claveDeLaCelda, { rowId: currentRowIdBeforeUpdate, columnKey: column.key, type: "error", message: mensajeDeError(err) }));
|
|
3109
|
+
} finally {
|
|
3110
|
+
if (!closeEditor) isCommitInProgress.current = false;
|
|
3111
|
+
}
|
|
3112
|
+
return;
|
|
3113
|
+
}
|
|
3062
3114
|
onRowChange({ ...row, [column.key]: processedNewValue }, true);
|
|
3063
3115
|
if (isNewRow) {
|
|
3064
3116
|
const areAllMandatoryFieldsFilled = tableDefinition.fields.every((fieldDef) => {
|
|
@@ -3171,7 +3223,9 @@ function InputRenderer({
|
|
|
3171
3223
|
setTableData,
|
|
3172
3224
|
setLocalCellChanges,
|
|
3173
3225
|
initialRowId,
|
|
3174
|
-
typer
|
|
3226
|
+
typer,
|
|
3227
|
+
fieldDefinition,
|
|
3228
|
+
callApi
|
|
3175
3229
|
]);
|
|
3176
3230
|
const confirmarEnExpansion = useCallback10((nuevo) => {
|
|
3177
3231
|
setEditingValue(nuevo);
|
|
@@ -3226,7 +3280,7 @@ function InputRenderer({
|
|
|
3226
3280
|
}, [handleCommit, editingValue]);
|
|
3227
3281
|
const isFieldEditable = fieldDefinition?.editable !== false;
|
|
3228
3282
|
const isNumeric = isNumericType(fieldDefinition?.typeName);
|
|
3229
|
-
const editor = /* @__PURE__ */
|
|
3283
|
+
const editor = /* @__PURE__ */ jsx18(
|
|
3230
3284
|
InputBase4,
|
|
3231
3285
|
{
|
|
3232
3286
|
autoFocus: true,
|
|
@@ -3266,12 +3320,12 @@ function InputRenderer({
|
|
|
3266
3320
|
editor,
|
|
3267
3321
|
expander.ventana
|
|
3268
3322
|
] });
|
|
3269
|
-
return currentCellFeedback?.message ? /* @__PURE__ */
|
|
3323
|
+
return currentCellFeedback?.message ? /* @__PURE__ */ jsx18(Tooltip5, { title: currentCellFeedback.message, children: /* @__PURE__ */ jsx18("div", { style: { width: "100%" }, children: conMenu }) }) : conMenu;
|
|
3270
3324
|
}
|
|
3271
3325
|
var InputRenderer_default = InputRenderer;
|
|
3272
3326
|
|
|
3273
3327
|
// src/components/grid/renderers/editCellRenderers.tsx
|
|
3274
|
-
import { jsx as
|
|
3328
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
3275
3329
|
var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
3276
3330
|
const column = props.column;
|
|
3277
3331
|
if (!esColumnaPropia(column)) return void 0;
|
|
@@ -3293,7 +3347,7 @@ var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
|
3293
3347
|
if (!isFieldEditableByUI) {
|
|
3294
3348
|
return void 0;
|
|
3295
3349
|
}
|
|
3296
|
-
return /* @__PURE__ */
|
|
3350
|
+
return /* @__PURE__ */ jsx19(
|
|
3297
3351
|
InputRenderer_default,
|
|
3298
3352
|
{
|
|
3299
3353
|
...props,
|
|
@@ -3318,14 +3372,6 @@ var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
|
3318
3372
|
}
|
|
3319
3373
|
};
|
|
3320
3374
|
|
|
3321
|
-
// src/utils/columnasOcultas.ts
|
|
3322
|
-
function columnasOcultasIniciales(tableDefinition) {
|
|
3323
|
-
return Array.from(new Set(tableDefinition.hiddenColumns ?? []));
|
|
3324
|
-
}
|
|
3325
|
-
function campoDibujable(field) {
|
|
3326
|
-
return field.visible !== false;
|
|
3327
|
-
}
|
|
3328
|
-
|
|
3329
3375
|
// src/hooks/grid/useGridColumns.ts
|
|
3330
3376
|
var estimateTextWidth = (text) => text.length * 8 + 16;
|
|
3331
3377
|
var contextoDeMedida;
|
|
@@ -3401,7 +3447,7 @@ var useGridColumns = ({
|
|
|
3401
3447
|
});
|
|
3402
3448
|
const defaultColumns = fieldsToShow.map((fieldDef) => {
|
|
3403
3449
|
const isFixedField = valorFijoDe(fixedFields, fieldDef.name) !== void 0;
|
|
3404
|
-
const isFieldEditable = fieldDef
|
|
3450
|
+
const isFieldEditable = campoEditableEnCelda(fieldDef) && !isFixedField;
|
|
3405
3451
|
const colWidth = anchosCalculados.get(fieldDef.name) ?? estimateTextWidth(fieldDef.label || fieldDef.name) + 20;
|
|
3406
3452
|
const column = {
|
|
3407
3453
|
key: fieldDef.name,
|
|
@@ -3505,7 +3551,7 @@ import {
|
|
|
3505
3551
|
Divider
|
|
3506
3552
|
} from "@mui/material";
|
|
3507
3553
|
import FileUploadIcon2 from "@mui/icons-material/FileUpload";
|
|
3508
|
-
import { jsx as
|
|
3554
|
+
import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3509
3555
|
var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
3510
3556
|
const [file, setFile] = useState13(null);
|
|
3511
3557
|
const [options, setOptions] = useState13({
|
|
@@ -3529,12 +3575,12 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3529
3575
|
};
|
|
3530
3576
|
return /* @__PURE__ */ jsxs14(Dialog2, { open, onClose: loading ? void 0 : onClose, maxWidth: "sm", fullWidth: true, children: [
|
|
3531
3577
|
/* @__PURE__ */ jsxs14(DialogTitle2, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
3532
|
-
/* @__PURE__ */
|
|
3578
|
+
/* @__PURE__ */ jsx20(FileUploadIcon2, { color: "primary" }),
|
|
3533
3579
|
"Importar datos desde archivo"
|
|
3534
3580
|
] }),
|
|
3535
|
-
/* @__PURE__ */
|
|
3581
|
+
/* @__PURE__ */ jsx20(DialogContent2, { dividers: true, children: /* @__PURE__ */ jsxs14(Stack, { spacing: 3, sx: { mt: 1 }, children: [
|
|
3536
3582
|
/* @__PURE__ */ jsxs14(Box9, { children: [
|
|
3537
|
-
/* @__PURE__ */
|
|
3583
|
+
/* @__PURE__ */ jsx20(Typography7, { variant: "subtitle2", gutterBottom: true, fontWeight: "bold", children: "Seleccionar archivo" }),
|
|
3538
3584
|
/* @__PURE__ */ jsxs14(
|
|
3539
3585
|
Box9,
|
|
3540
3586
|
{
|
|
@@ -3548,7 +3594,7 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3548
3594
|
position: "relative"
|
|
3549
3595
|
},
|
|
3550
3596
|
children: [
|
|
3551
|
-
/* @__PURE__ */
|
|
3597
|
+
/* @__PURE__ */ jsx20(
|
|
3552
3598
|
"input",
|
|
3553
3599
|
{
|
|
3554
3600
|
type: "file",
|
|
@@ -3565,19 +3611,19 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3565
3611
|
}
|
|
3566
3612
|
}
|
|
3567
3613
|
),
|
|
3568
|
-
/* @__PURE__ */
|
|
3614
|
+
/* @__PURE__ */ jsx20(Typography7, { variant: "body2", color: file ? "textPrimary" : "textSecondary", children: file ? file.name : "Haz clic aqu\xED para seleccionar un archivo" })
|
|
3569
3615
|
]
|
|
3570
3616
|
}
|
|
3571
3617
|
)
|
|
3572
3618
|
] }),
|
|
3573
|
-
/* @__PURE__ */
|
|
3619
|
+
/* @__PURE__ */ jsx20(Divider, {}),
|
|
3574
3620
|
/* @__PURE__ */ jsxs14(Box9, { children: [
|
|
3575
|
-
/* @__PURE__ */
|
|
3621
|
+
/* @__PURE__ */ jsx20(Typography7, { variant: "subtitle2", gutterBottom: true, fontWeight: "bold", children: "Opciones de importaci\xF3n" }),
|
|
3576
3622
|
/* @__PURE__ */ jsxs14(Stack, { children: [
|
|
3577
|
-
/* @__PURE__ */
|
|
3623
|
+
/* @__PURE__ */ jsx20(
|
|
3578
3624
|
FormControlLabel,
|
|
3579
3625
|
{
|
|
3580
|
-
control: /* @__PURE__ */
|
|
3626
|
+
control: /* @__PURE__ */ jsx20(
|
|
3581
3627
|
Checkbox,
|
|
3582
3628
|
{
|
|
3583
3629
|
checked: options.skipUnknownFieldsAtImport,
|
|
@@ -3585,13 +3631,13 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3585
3631
|
size: "small"
|
|
3586
3632
|
}
|
|
3587
3633
|
),
|
|
3588
|
-
label: /* @__PURE__ */
|
|
3634
|
+
label: /* @__PURE__ */ jsx20(Typography7, { variant: "body2", children: "Omitir campos desconocidos al importar" })
|
|
3589
3635
|
}
|
|
3590
3636
|
),
|
|
3591
|
-
/* @__PURE__ */
|
|
3637
|
+
/* @__PURE__ */ jsx20(
|
|
3592
3638
|
FormControlLabel,
|
|
3593
3639
|
{
|
|
3594
|
-
control: /* @__PURE__ */
|
|
3640
|
+
control: /* @__PURE__ */ jsx20(
|
|
3595
3641
|
Checkbox,
|
|
3596
3642
|
{
|
|
3597
3643
|
checked: options.simplificateSpaces,
|
|
@@ -3599,13 +3645,13 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3599
3645
|
size: "small"
|
|
3600
3646
|
}
|
|
3601
3647
|
),
|
|
3602
|
-
label: /* @__PURE__ */
|
|
3648
|
+
label: /* @__PURE__ */ jsx20(Typography7, { variant: "body2", children: "Simplificar espacios" })
|
|
3603
3649
|
}
|
|
3604
3650
|
),
|
|
3605
|
-
/* @__PURE__ */
|
|
3651
|
+
/* @__PURE__ */ jsx20(
|
|
3606
3652
|
FormControlLabel,
|
|
3607
3653
|
{
|
|
3608
|
-
control: /* @__PURE__ */
|
|
3654
|
+
control: /* @__PURE__ */ jsx20(
|
|
3609
3655
|
Checkbox,
|
|
3610
3656
|
{
|
|
3611
3657
|
checked: options.replaceNewLineWithSpace,
|
|
@@ -3613,21 +3659,21 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3613
3659
|
size: "small"
|
|
3614
3660
|
}
|
|
3615
3661
|
),
|
|
3616
|
-
label: /* @__PURE__ */
|
|
3662
|
+
label: /* @__PURE__ */ jsx20(Typography7, { variant: "body2", children: "Reemplazar saltos de l\xEDnea con espacios" })
|
|
3617
3663
|
}
|
|
3618
3664
|
)
|
|
3619
3665
|
] })
|
|
3620
3666
|
] })
|
|
3621
3667
|
] }) }),
|
|
3622
3668
|
/* @__PURE__ */ jsxs14(DialogActions2, { sx: { px: 3, py: 2 }, children: [
|
|
3623
|
-
/* @__PURE__ */
|
|
3624
|
-
/* @__PURE__ */
|
|
3669
|
+
/* @__PURE__ */ jsx20(Button4, { onClick: onClose, disabled: loading, children: "Cancelar" }),
|
|
3670
|
+
/* @__PURE__ */ jsx20(
|
|
3625
3671
|
Button4,
|
|
3626
3672
|
{
|
|
3627
3673
|
onClick: handleConfirm,
|
|
3628
3674
|
variant: "contained",
|
|
3629
3675
|
disabled: !file || loading,
|
|
3630
|
-
startIcon: /* @__PURE__ */
|
|
3676
|
+
startIcon: /* @__PURE__ */ jsx20(FileUploadIcon2, {}),
|
|
3631
3677
|
children: loading ? "Procesando..." : "Confirmar Importaci\xF3n"
|
|
3632
3678
|
}
|
|
3633
3679
|
)
|
|
@@ -3656,7 +3702,7 @@ import {
|
|
|
3656
3702
|
} from "@mui/material";
|
|
3657
3703
|
import * as XLSX from "xlsx";
|
|
3658
3704
|
import typeStore5 from "type-store";
|
|
3659
|
-
import { jsx as
|
|
3705
|
+
import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3660
3706
|
var ExportDialog = ({
|
|
3661
3707
|
open,
|
|
3662
3708
|
onClose,
|
|
@@ -3802,47 +3848,47 @@ var ExportDialog = ({
|
|
|
3802
3848
|
}, 0);
|
|
3803
3849
|
};
|
|
3804
3850
|
return /* @__PURE__ */ jsxs15(Dialog3, { open, onClose, maxWidth: "xs", fullWidth: true, children: [
|
|
3805
|
-
/* @__PURE__ */
|
|
3806
|
-
/* @__PURE__ */
|
|
3807
|
-
/* @__PURE__ */
|
|
3808
|
-
/* @__PURE__ */
|
|
3851
|
+
/* @__PURE__ */ jsx21(DialogTitle3, { children: "Exportar Datos" }),
|
|
3852
|
+
/* @__PURE__ */ jsx21(DialogContent3, { children: isPreparing ? /* @__PURE__ */ jsxs15(Box10, { display: "flex", flexDirection: "column", alignItems: "center", py: 4, children: [
|
|
3853
|
+
/* @__PURE__ */ jsx21(CircularProgress2, {}),
|
|
3854
|
+
/* @__PURE__ */ jsx21(Typography8, { sx: { mt: 2 }, children: "Preparando exportaci\xF3n..." })
|
|
3809
3855
|
] }) : /* @__PURE__ */ jsxs15(Box10, { sx: { mt: 1 }, children: [
|
|
3810
3856
|
/* @__PURE__ */ jsxs15(FormControl2, { component: "fieldset", children: [
|
|
3811
|
-
/* @__PURE__ */
|
|
3857
|
+
/* @__PURE__ */ jsx21(FormLabel, { component: "legend", children: "Formato" }),
|
|
3812
3858
|
/* @__PURE__ */ jsxs15(
|
|
3813
3859
|
RadioGroup,
|
|
3814
3860
|
{
|
|
3815
3861
|
value: format,
|
|
3816
3862
|
onChange: (e) => setFormat(e.target.value),
|
|
3817
3863
|
children: [
|
|
3818
|
-
/* @__PURE__ */
|
|
3819
|
-
/* @__PURE__ */
|
|
3820
|
-
/* @__PURE__ */
|
|
3864
|
+
/* @__PURE__ */ jsx21(FormControlLabel2, { value: "xlsx", control: /* @__PURE__ */ jsx21(Radio, {}), label: "Excel (.xlsx)" }),
|
|
3865
|
+
/* @__PURE__ */ jsx21(FormControlLabel2, { value: "tab", control: /* @__PURE__ */ jsx21(Radio, {}), label: "Tabulado (.tab | )" }),
|
|
3866
|
+
/* @__PURE__ */ jsx21(FormControlLabel2, { value: "csv", control: /* @__PURE__ */ jsx21(Radio, {}), label: "CSV (.csv , )" })
|
|
3821
3867
|
]
|
|
3822
3868
|
}
|
|
3823
3869
|
)
|
|
3824
3870
|
] }),
|
|
3825
3871
|
/* @__PURE__ */ jsxs15(Box10, { sx: { mt: 3 }, children: [
|
|
3826
|
-
/* @__PURE__ */
|
|
3872
|
+
/* @__PURE__ */ jsx21(Typography8, { variant: "subtitle2", gutterBottom: true, children: "Opciones de campos:" }),
|
|
3827
3873
|
/* @__PURE__ */ jsxs15(FormGroup, { children: [
|
|
3828
|
-
/* @__PURE__ */
|
|
3874
|
+
/* @__PURE__ */ jsx21(
|
|
3829
3875
|
FormControlLabel2,
|
|
3830
3876
|
{
|
|
3831
|
-
control: /* @__PURE__ */
|
|
3877
|
+
control: /* @__PURE__ */ jsx21(Checkbox2, { checked: options.fromOtherTables, onChange: handleOptionChange, name: "fromOtherTables" }),
|
|
3832
3878
|
label: "Desde otras tablas"
|
|
3833
3879
|
}
|
|
3834
3880
|
),
|
|
3835
|
-
/* @__PURE__ */
|
|
3881
|
+
/* @__PURE__ */ jsx21(
|
|
3836
3882
|
FormControlLabel2,
|
|
3837
3883
|
{
|
|
3838
|
-
control: /* @__PURE__ */
|
|
3884
|
+
control: /* @__PURE__ */ jsx21(Checkbox2, { checked: options.readOnly, onChange: handleOptionChange, name: "readOnly" }),
|
|
3839
3885
|
label: "Solo lectura"
|
|
3840
3886
|
}
|
|
3841
3887
|
),
|
|
3842
|
-
/* @__PURE__ */
|
|
3888
|
+
/* @__PURE__ */ jsx21(
|
|
3843
3889
|
FormControlLabel2,
|
|
3844
3890
|
{
|
|
3845
|
-
control: /* @__PURE__ */
|
|
3891
|
+
control: /* @__PURE__ */ jsx21(Checkbox2, { checked: options.hiddens, onChange: handleOptionChange, name: "hiddens" }),
|
|
3846
3892
|
label: "Ocultos"
|
|
3847
3893
|
}
|
|
3848
3894
|
)
|
|
@@ -3850,27 +3896,27 @@ var ExportDialog = ({
|
|
|
3850
3896
|
] })
|
|
3851
3897
|
] }) }),
|
|
3852
3898
|
/* @__PURE__ */ jsxs15(DialogActions3, { children: [
|
|
3853
|
-
/* @__PURE__ */
|
|
3854
|
-
/* @__PURE__ */
|
|
3899
|
+
/* @__PURE__ */ jsx21(Button5, { onClick: onClose, disabled: isPreparing, children: "Cancelar" }),
|
|
3900
|
+
/* @__PURE__ */ jsx21(Button5, { onClick: handlePrepareExport, variant: "contained", disabled: isPreparing, children: "Descargar" })
|
|
3855
3901
|
] })
|
|
3856
3902
|
] });
|
|
3857
3903
|
};
|
|
3858
3904
|
|
|
3859
3905
|
// src/components/grid/DialogoDeColumnas.tsx
|
|
3860
3906
|
import { Box as Box11, Button as Button6, Dialog as Dialog4, DialogActions as DialogActions4, DialogContent as DialogContent4, DialogTitle as DialogTitle4, List as List3, ListItemButton as ListItemButton3, ListItemText as ListItemText2, Typography as Typography9 } from "@mui/material";
|
|
3861
|
-
import { jsx as
|
|
3907
|
+
import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3862
3908
|
var DialogoDeColumnas = ({ open, onClose, columnas, ocultas, alternarColumna }) => {
|
|
3863
3909
|
const lista = (titulo, nombres, idDeLista) => /* @__PURE__ */ jsxs16(Box11, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
3864
|
-
/* @__PURE__ */
|
|
3865
|
-
/* @__PURE__ */
|
|
3910
|
+
/* @__PURE__ */ jsx22(Typography9, { variant: "subtitle2", sx: { mb: 1 }, children: titulo }),
|
|
3911
|
+
/* @__PURE__ */ jsx22(List3, { dense: true, "data-testid": idDeLista, sx: { maxHeight: 360, overflow: "auto", border: 1, borderColor: "divider", borderRadius: 1 }, children: nombres.map((nombre) => /* @__PURE__ */ jsx22(ListItemButton3, { onClick: () => alternarColumna(nombre), children: /* @__PURE__ */ jsx22(ListItemText2, { primary: nombre }) }, nombre)) })
|
|
3866
3912
|
] });
|
|
3867
3913
|
return /* @__PURE__ */ jsxs16(Dialog4, { open, onClose, maxWidth: "sm", fullWidth: true, children: [
|
|
3868
|
-
/* @__PURE__ */
|
|
3869
|
-
/* @__PURE__ */
|
|
3914
|
+
/* @__PURE__ */ jsx22(DialogTitle4, { children: "Ocultar o mostrar columnas" }),
|
|
3915
|
+
/* @__PURE__ */ jsx22(DialogContent4, { children: /* @__PURE__ */ jsxs16(Box11, { sx: { display: "flex", gap: 2, pt: 1 }, children: [
|
|
3870
3916
|
lista("Columnas mostradas", columnas.filter((nombre) => !ocultas.has(nombre)), "columnas-mostradas"),
|
|
3871
3917
|
lista("Columnas ocultas", columnas.filter((nombre) => ocultas.has(nombre)), "columnas-ocultas")
|
|
3872
3918
|
] }) }),
|
|
3873
|
-
/* @__PURE__ */
|
|
3919
|
+
/* @__PURE__ */ jsx22(DialogActions4, { children: /* @__PURE__ */ jsx22(Button6, { onClick: onClose, children: "Cerrar" }) })
|
|
3874
3920
|
] });
|
|
3875
3921
|
};
|
|
3876
3922
|
|
|
@@ -3888,7 +3934,7 @@ import {
|
|
|
3888
3934
|
Typography as Typography10
|
|
3889
3935
|
} from "@mui/material";
|
|
3890
3936
|
import CloseIcon from "@mui/icons-material/Close";
|
|
3891
|
-
import { jsx as
|
|
3937
|
+
import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3892
3938
|
var SIN_OCULTAS = /* @__PURE__ */ new Set();
|
|
3893
3939
|
var VerticalEditorPage = ({
|
|
3894
3940
|
tableName,
|
|
@@ -4024,14 +4070,14 @@ var VerticalEditorPage = ({
|
|
|
4024
4070
|
" - ",
|
|
4025
4071
|
tableDefinition.title || tableName
|
|
4026
4072
|
] }),
|
|
4027
|
-
/* @__PURE__ */
|
|
4073
|
+
/* @__PURE__ */ jsx23(IconButton6, { onClick: onClose, size: "small", edge: "end", children: /* @__PURE__ */ jsx23(CloseIcon, {}) })
|
|
4028
4074
|
] }),
|
|
4029
4075
|
/* @__PURE__ */ jsxs17(DialogContent5, { dividers: true, sx: { px: 2, flexGrow: 1, py: 1 }, children: [
|
|
4030
|
-
globalError && /* @__PURE__ */
|
|
4031
|
-
/* @__PURE__ */
|
|
4076
|
+
globalError && /* @__PURE__ */ jsx23(Alert, { severity: "error", sx: { mb: 2 }, children: globalError }),
|
|
4077
|
+
/* @__PURE__ */ jsx23(Box12, { sx: { display: "flex", flexDirection: "column", gap: 0.5 }, children: tableDefinition.fields.filter((field) => campoDibujable(field) && !columnasOcultas.has(field.name)).map((field) => {
|
|
4032
4078
|
const isFixed = fixedFields?.some((ff) => ff.fieldName === field.name);
|
|
4033
4079
|
const isMandatory = field.nullable === false || tableDefinition.primaryKey.includes(field.name);
|
|
4034
|
-
return /* @__PURE__ */
|
|
4080
|
+
return /* @__PURE__ */ jsx23(Box12, { sx: { width: "100%", maxWidth: "100%" }, children: /* @__PURE__ */ jsx23(
|
|
4035
4081
|
TypedField,
|
|
4036
4082
|
{
|
|
4037
4083
|
fieldDef: field,
|
|
@@ -4047,10 +4093,10 @@ var VerticalEditorPage = ({
|
|
|
4047
4093
|
] }),
|
|
4048
4094
|
/* @__PURE__ */ jsxs17(DialogActions5, { sx: { px: 0, pb: 0, pt: 2, justifyContent: "space-between", alignItems: "center" }, children: [
|
|
4049
4095
|
/* @__PURE__ */ jsxs17(Box12, { children: [
|
|
4050
|
-
isSaving && /* @__PURE__ */
|
|
4051
|
-
/* @__PURE__ */
|
|
4096
|
+
isSaving && /* @__PURE__ */ jsx23(CircularProgress3, { size: 20, sx: { ml: 2 } }),
|
|
4097
|
+
/* @__PURE__ */ jsx23("span", { style: { marginLeft: 10, fontSize: "0.8rem", color: "#666" }, children: isSaving ? "Guardando..." : "Cambios auto-guardados" })
|
|
4052
4098
|
] }),
|
|
4053
|
-
/* @__PURE__ */
|
|
4099
|
+
/* @__PURE__ */ jsx23(Button7, { variant: "outlined", onClick: onClose, children: "Cerrar" })
|
|
4054
4100
|
] })
|
|
4055
4101
|
] });
|
|
4056
4102
|
};
|
|
@@ -4122,98 +4168,434 @@ function fusionar(base, cambios) {
|
|
|
4122
4168
|
return resultado;
|
|
4123
4169
|
}
|
|
4124
4170
|
|
|
4125
|
-
// src/
|
|
4126
|
-
var
|
|
4127
|
-
var
|
|
4128
|
-
|
|
4129
|
-
// src/components/grid/GenericDataGrid.tsx
|
|
4130
|
-
import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4131
|
-
var SUMMARY_ROW_HEIGHT = 35;
|
|
4132
|
-
var FILTER_ROW_HEIGHT = 35;
|
|
4133
|
-
var HEADER_ROW_HEIGHT = 30;
|
|
4134
|
-
var ROW_HEIGHT = 30;
|
|
4135
|
-
var MIN_BODY_HEIGHT = 260;
|
|
4136
|
-
var DURACION_FEEDBACK_EXITO = 3e3;
|
|
4137
|
-
var ALTO_TITULO_ANIDADA = 26;
|
|
4138
|
-
var ALTO_MINIMO_CUERPO_ANIDADA = 120;
|
|
4139
|
-
var HOLGURA_ANIDADA = 24;
|
|
4140
|
-
var ANCHO_MINIMO_ANIDADA = 240;
|
|
4141
|
-
var ANCHO_RESERVADO_PANTALLA = 320;
|
|
4142
|
-
var SANGRIA_DETALLE = 28 + 8 + 3;
|
|
4143
|
-
var MARGEN_INFERIOR_PAGINA = 24;
|
|
4144
|
-
var PRIMERAS_FILAS_ANIDADA = 20;
|
|
4145
|
-
var LIMITE_PRIMERAS_FILAS_ANIDADA = 30;
|
|
4146
|
-
var esColumnaPropia = (columna) => "customType" in columna;
|
|
4147
|
-
var SIN_ANCESTROS = [];
|
|
4148
|
-
var cargasEnCurso = /* @__PURE__ */ new Map();
|
|
4149
|
-
var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
4150
|
-
const theme = useTheme4();
|
|
4151
|
-
const { tableDefinition, row } = ancestor;
|
|
4152
|
-
const columns = useMemo10(() => {
|
|
4153
|
-
const filteredFields = tableDefinition.fields.filter(
|
|
4154
|
-
(field) => !fieldsToHide?.some((ff) => ff.fieldName === field.name)
|
|
4155
|
-
);
|
|
4156
|
-
return filteredFields.map((field) => {
|
|
4157
|
-
const isPrimaryKey = tableDefinition.primaryKey.includes(field.name);
|
|
4158
|
-
return {
|
|
4159
|
-
key: field.name,
|
|
4160
|
-
name: field.label || cambiarGuionesBajosPorEspacios(field.name),
|
|
4161
|
-
width: 150,
|
|
4162
|
-
editable: false,
|
|
4163
|
-
renderHeaderCell: () => /* @__PURE__ */ jsx23(Box13, { sx: { p: 0.5, height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsx23(
|
|
4164
|
-
Typography11,
|
|
4165
|
-
{
|
|
4166
|
-
variant: "caption",
|
|
4167
|
-
sx: {
|
|
4168
|
-
fontWeight: "bold",
|
|
4169
|
-
textDecoration: isPrimaryKey ? "underline" : "none",
|
|
4170
|
-
fontSize: "0.930rem"
|
|
4171
|
-
},
|
|
4172
|
-
children: field.label || cambiarGuionesBajosPorEspacios(field.name)
|
|
4173
|
-
}
|
|
4174
|
-
) }),
|
|
4175
|
-
renderCell: (props) => /* @__PURE__ */ jsx23(Box13, { sx: { px: 1, height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsx23(Typography11, { variant: "body2", sx: { fontSize: "0.875rem" }, noWrap: true, children: String(props.row[field.name] ?? "") }) })
|
|
4176
|
-
};
|
|
4177
|
-
});
|
|
4178
|
-
}, [tableDefinition, fieldsToHide]);
|
|
4179
|
-
return /* @__PURE__ */ jsxs18(Box13, { sx: {
|
|
4180
|
-
mb: 1.5,
|
|
4181
|
-
ml: index * 4,
|
|
4182
|
-
// El primer ancestro (index 0) no tiene margen, los siguientes sí
|
|
4183
|
-
border: "1px solid",
|
|
4184
|
-
borderColor: "divider",
|
|
4185
|
-
borderRadius: 1,
|
|
4186
|
-
overflow: "hidden",
|
|
4187
|
-
boxShadow: theme.shadows[1],
|
|
4188
|
-
bgcolor: "background.paper"
|
|
4189
|
-
}, children: [
|
|
4190
|
-
/* @__PURE__ */ jsx23(Box13, { sx: {
|
|
4191
|
-
bgcolor: "primary.main",
|
|
4192
|
-
color: "primary.contrastText",
|
|
4193
|
-
px: 1.5,
|
|
4194
|
-
py: 0.5,
|
|
4195
|
-
borderBottom: "1px solid",
|
|
4196
|
-
borderColor: "divider",
|
|
4197
|
-
display: "flex",
|
|
4198
|
-
alignItems: "center",
|
|
4199
|
-
fontWeight: "bold",
|
|
4200
|
-
gap: 1
|
|
4201
|
-
}, children: /* @__PURE__ */ jsx23(Typography11, { variant: "subtitle2", component: "div", children: cambiarGuionesBajosPorEspacios(ancestor.tableName) }) }),
|
|
4202
|
-
/* @__PURE__ */ jsx23(
|
|
4203
|
-
DataGrid,
|
|
4204
|
-
{
|
|
4205
|
-
className: "rdg-light",
|
|
4206
|
-
columns,
|
|
4207
|
-
rows: [row],
|
|
4208
|
-
headerRowHeight: HEADER_ROW_HEIGHT,
|
|
4209
|
-
rowHeight: ROW_HEIGHT,
|
|
4210
|
-
rowKeyGetter: () => "single-row",
|
|
4211
|
-
style: { height: 78 }
|
|
4212
|
-
}
|
|
4213
|
-
)
|
|
4214
|
-
] });
|
|
4171
|
+
// src/puente/habilitacion.ts
|
|
4172
|
+
var habilitado = false;
|
|
4173
|
+
var habilitarPuenteBP = () => {
|
|
4174
|
+
habilitado = true;
|
|
4215
4175
|
};
|
|
4216
|
-
var
|
|
4176
|
+
var puenteBPHabilitado = () => habilitado;
|
|
4177
|
+
|
|
4178
|
+
// src/puente/GrillaBP.tsx
|
|
4179
|
+
import { useEffect as useEffect7, useRef as useRef7, useState as useState16 } from "react";
|
|
4180
|
+
import { useParams } from "react-router-dom";
|
|
4181
|
+
import { Alert as Alert2, Box as Box14, CircularProgress as CircularProgress4 } from "@mui/material";
|
|
4182
|
+
|
|
4183
|
+
// src/puente/estilosBP.ts
|
|
4184
|
+
var CLASE_CONTENEDOR_BP = "fpr-bp";
|
|
4185
|
+
var cierreDeBloque = (css, abre) => {
|
|
4186
|
+
let profundidad = 0;
|
|
4187
|
+
let comilla = "";
|
|
4188
|
+
for (let i = abre; i < css.length; i++) {
|
|
4189
|
+
const c = css[i];
|
|
4190
|
+
if (comilla) {
|
|
4191
|
+
if (c === "\\") i++;
|
|
4192
|
+
else if (c === comilla) comilla = "";
|
|
4193
|
+
} else if (c === '"' || c === "'") comilla = c;
|
|
4194
|
+
else if (c === "{") profundidad++;
|
|
4195
|
+
else if (c === "}" && --profundidad === 0) return i;
|
|
4196
|
+
}
|
|
4197
|
+
return css.length - 1;
|
|
4198
|
+
};
|
|
4199
|
+
var partirPor = (lista, separador) => {
|
|
4200
|
+
const partes = [];
|
|
4201
|
+
let profundidad = 0;
|
|
4202
|
+
let comilla = "";
|
|
4203
|
+
let inicio = 0;
|
|
4204
|
+
for (let i = 0; i < lista.length; i++) {
|
|
4205
|
+
const c = lista[i];
|
|
4206
|
+
if (comilla) {
|
|
4207
|
+
if (c === "\\") i++;
|
|
4208
|
+
else if (c === comilla) comilla = "";
|
|
4209
|
+
} else if (c === '"' || c === "'") comilla = c;
|
|
4210
|
+
else if (c === "(" || c === "[") profundidad++;
|
|
4211
|
+
else if (c === ")" || c === "]") profundidad--;
|
|
4212
|
+
else if (c === separador && profundidad === 0) {
|
|
4213
|
+
partes.push(lista.slice(inicio, i));
|
|
4214
|
+
inicio = i + 1;
|
|
4215
|
+
}
|
|
4216
|
+
}
|
|
4217
|
+
partes.push(lista.slice(inicio));
|
|
4218
|
+
return partes;
|
|
4219
|
+
};
|
|
4220
|
+
var RAIZ = /^(html|body|:root)(?![\w-])/;
|
|
4221
|
+
var ATRIBUTO_DE_RAIZ = /^\[my-skin[^\]]*\]/;
|
|
4222
|
+
var MEDIDAS_DE_DOCUMENTO = /^(overflow(-[xy])?|(min-|max-)?height|position)$/i;
|
|
4223
|
+
var DE_DIALOGO = /^(div)?\.dialog-|^\[key-selected\]/;
|
|
4224
|
+
var acotarSelector = (selector) => {
|
|
4225
|
+
const limpio = selector.trim();
|
|
4226
|
+
const contenedor = `.${CLASE_CONTENEDOR_BP}`;
|
|
4227
|
+
if (DE_DIALOGO.test(limpio)) return { selector: limpio, deRaiz: false };
|
|
4228
|
+
const atributo = ATRIBUTO_DE_RAIZ.exec(limpio);
|
|
4229
|
+
if (atributo) {
|
|
4230
|
+
const resto = limpio.slice(atributo[0].length).trim();
|
|
4231
|
+
const raiz2 = RAIZ.exec(resto);
|
|
4232
|
+
if (!resto) return { selector: contenedor + atributo[0], deRaiz: true };
|
|
4233
|
+
if (raiz2) return { selector: contenedor + atributo[0] + resto.slice(raiz2[0].length), deRaiz: true };
|
|
4234
|
+
return { selector: `${contenedor}${atributo[0]} ${resto}`, deRaiz: false };
|
|
4235
|
+
}
|
|
4236
|
+
const raiz = RAIZ.exec(limpio);
|
|
4237
|
+
if (raiz) {
|
|
4238
|
+
return { selector: contenedor + limpio.slice(raiz[0].length).replace(/^\s*>?\s*body(?![\w-])/, ""), deRaiz: true };
|
|
4239
|
+
}
|
|
4240
|
+
return { selector: `${contenedor} ${limpio}`, deRaiz: false };
|
|
4241
|
+
};
|
|
4242
|
+
var sinMedidasDeDocumento = (bloque) => `{${partirPor(bloque.slice(1, -1), ";").filter((declaracion) => !MEDIDAS_DE_DOCUMENTO.test(declaracion.split(":")[0].trim())).join(";")}}`;
|
|
4243
|
+
var acotarRegla = (preludio, bloque) => {
|
|
4244
|
+
const selectores = partirPor(preludio, ",").filter((selector) => selector.trim()).map(acotarSelector);
|
|
4245
|
+
const deRaiz = selectores.filter((s) => s.deRaiz).map((s) => s.selector);
|
|
4246
|
+
const otros = selectores.filter((s) => !s.deRaiz).map((s) => s.selector);
|
|
4247
|
+
return [
|
|
4248
|
+
deRaiz.length ? `${deRaiz.join(", ")} ${sinMedidasDeDocumento(bloque)}` : "",
|
|
4249
|
+
otros.length ? `${otros.join(", ")} ${bloque}` : ""
|
|
4250
|
+
].filter(Boolean).join(" ");
|
|
4251
|
+
};
|
|
4252
|
+
var urlsAbsolutas = (css, urlHoja) => css.replace(
|
|
4253
|
+
/url\(\s*(['"]?)([^'")]+)\1\s*\)/g,
|
|
4254
|
+
(completo, comilla, ruta) => /^(data:|#)/.test(ruta) ? completo : `url(${comilla}${new URL(ruta, urlHoja).href}${comilla})`
|
|
4255
|
+
);
|
|
4256
|
+
var ARROBAS_CON_REGLAS = /^@(media|supports|layer|container|document)\b/i;
|
|
4257
|
+
var acotarReglas = (css) => {
|
|
4258
|
+
let salida = "";
|
|
4259
|
+
let i = 0;
|
|
4260
|
+
while (i < css.length) {
|
|
4261
|
+
const llave = css.indexOf("{", i);
|
|
4262
|
+
const puntoYComa = css.indexOf(";", i);
|
|
4263
|
+
if (llave === -1 && puntoYComa === -1) {
|
|
4264
|
+
salida += css.slice(i);
|
|
4265
|
+
break;
|
|
4266
|
+
}
|
|
4267
|
+
if (puntoYComa !== -1 && (llave === -1 || puntoYComa < llave) && css.slice(i).trimStart().startsWith("@")) {
|
|
4268
|
+
salida += css.slice(i, puntoYComa + 1);
|
|
4269
|
+
i = puntoYComa + 1;
|
|
4270
|
+
continue;
|
|
4271
|
+
}
|
|
4272
|
+
if (llave === -1) {
|
|
4273
|
+
salida += css.slice(i);
|
|
4274
|
+
break;
|
|
4275
|
+
}
|
|
4276
|
+
const preludio = css.slice(i, llave);
|
|
4277
|
+
const cierre = cierreDeBloque(css, llave);
|
|
4278
|
+
const bloque = css.slice(llave, cierre + 1);
|
|
4279
|
+
const encabezado = preludio.trim();
|
|
4280
|
+
if (encabezado.startsWith("@")) {
|
|
4281
|
+
salida += ARROBAS_CON_REGLAS.test(encabezado) ? `${preludio}{${acotarReglas(bloque.slice(1, -1))}}` : preludio + bloque;
|
|
4282
|
+
} else {
|
|
4283
|
+
salida += acotarRegla(preludio, bloque);
|
|
4284
|
+
}
|
|
4285
|
+
i = cierre + 1;
|
|
4286
|
+
}
|
|
4287
|
+
return salida;
|
|
4288
|
+
};
|
|
4289
|
+
var acotarEstilos = (css, urlHoja) => acotarReglas(urlsAbsolutas(css.replace(/\/\*[\s\S]*?\*\//g, ""), urlHoja));
|
|
4290
|
+
var copiarSkinAlContenedor = (dentro) => {
|
|
4291
|
+
const skin = document.body.getAttribute("my-skin");
|
|
4292
|
+
const contenedor = dentro.closest(`.${CLASE_CONTENEDOR_BP}`);
|
|
4293
|
+
if (skin && contenedor) contenedor.setAttribute("my-skin", skin);
|
|
4294
|
+
};
|
|
4295
|
+
|
|
4296
|
+
// src/puente/clienteBP.ts
|
|
4297
|
+
function extraerRecursos(html) {
|
|
4298
|
+
const documento = new DOMParser().parseFromString(html, "text/html");
|
|
4299
|
+
const referencias2 = (selector, atributo) => Array.from(documento.querySelectorAll(selector)).map((elemento) => elemento.getAttribute(atributo)).filter((ruta) => !!ruta);
|
|
4300
|
+
return {
|
|
4301
|
+
hojasDeEstilo: referencias2("link[rel=stylesheet]", "href"),
|
|
4302
|
+
scripts: referencias2("script[src]", "src")
|
|
4303
|
+
};
|
|
4304
|
+
}
|
|
4305
|
+
function fijarBase(urlBackend) {
|
|
4306
|
+
const href = new URL(urlBackend.replace(/\/*$/, "/"), window.location.href).href;
|
|
4307
|
+
let base = document.querySelector("base");
|
|
4308
|
+
if (!base) {
|
|
4309
|
+
base = document.createElement("base");
|
|
4310
|
+
document.head.prepend(base);
|
|
4311
|
+
}
|
|
4312
|
+
base.href = href;
|
|
4313
|
+
}
|
|
4314
|
+
function cargarScript(ruta) {
|
|
4315
|
+
return new Promise((resolver, rechazar) => {
|
|
4316
|
+
const script = document.createElement("script");
|
|
4317
|
+
script.async = false;
|
|
4318
|
+
script.src = ruta;
|
|
4319
|
+
script.onload = () => resolver();
|
|
4320
|
+
script.onerror = () => rechazar(new Error(`No se pudo cargar ${ruta}`));
|
|
4321
|
+
document.head.appendChild(script);
|
|
4322
|
+
});
|
|
4323
|
+
}
|
|
4324
|
+
function esperarCargaDeVentana() {
|
|
4325
|
+
if (document.readyState === "complete") return Promise.resolve();
|
|
4326
|
+
return new Promise((resolver) => window.addEventListener("load", () => resolver(), { once: true }));
|
|
4327
|
+
}
|
|
4328
|
+
async function sinEscuchasDeVentana(tipos, inyectar) {
|
|
4329
|
+
const original = window.addEventListener;
|
|
4330
|
+
const filtrada = function(tipo, escucha, opciones) {
|
|
4331
|
+
if (tipos.includes(tipo)) return;
|
|
4332
|
+
original.call(this, tipo, escucha, opciones);
|
|
4333
|
+
};
|
|
4334
|
+
window.addEventListener = filtrada;
|
|
4335
|
+
try {
|
|
4336
|
+
return await inyectar();
|
|
4337
|
+
} finally {
|
|
4338
|
+
if (window.addEventListener === filtrada) window.addEventListener = original;
|
|
4339
|
+
}
|
|
4340
|
+
}
|
|
4341
|
+
async function cargarScripts(rutas) {
|
|
4342
|
+
for (const ruta of rutas) {
|
|
4343
|
+
await cargarScript(ruta);
|
|
4344
|
+
}
|
|
4345
|
+
}
|
|
4346
|
+
var carga = null;
|
|
4347
|
+
function cargarClienteBP(urlBackend) {
|
|
4348
|
+
if (!carga) {
|
|
4349
|
+
carga = cargarSinMemoria(urlBackend).catch((error) => {
|
|
4350
|
+
carga = null;
|
|
4351
|
+
throw error;
|
|
4352
|
+
});
|
|
4353
|
+
}
|
|
4354
|
+
return carga;
|
|
4355
|
+
}
|
|
4356
|
+
async function cargarSinMemoria(urlBackend) {
|
|
4357
|
+
const destino = new URL(urlBackend, window.location.href);
|
|
4358
|
+
if (destino.origin !== window.location.origin) {
|
|
4359
|
+
throw new Error(`El cliente de backend-plus solo se puede usar desde el mismo origen que el backend (${destino.origin} no es ${window.location.origin}).`);
|
|
4360
|
+
}
|
|
4361
|
+
fijarBase(urlBackend);
|
|
4362
|
+
const respuesta = await fetch(`${destino.pathname.replace(/\/*$/, "")}/menu`, { credentials: "include" });
|
|
4363
|
+
if (!respuesta.ok || /\/login\/?$/.test(new URL(respuesta.url).pathname)) {
|
|
4364
|
+
throw new Error("No hay una sesi\xF3n iniciada en el backend.");
|
|
4365
|
+
}
|
|
4366
|
+
const recursos = extraerRecursos(await respuesta.text());
|
|
4367
|
+
await Promise.all(recursos.hojasDeEstilo.map(async (ruta) => {
|
|
4368
|
+
const url = new URL(ruta, document.baseURI).href;
|
|
4369
|
+
try {
|
|
4370
|
+
const hoja = await fetch(url, { credentials: "include" });
|
|
4371
|
+
if (!hoja.ok) throw new Error(`${hoja.status}`);
|
|
4372
|
+
const estilo = document.createElement("style");
|
|
4373
|
+
estilo.textContent = acotarEstilos(await hoja.text(), url);
|
|
4374
|
+
document.head.appendChild(estilo);
|
|
4375
|
+
} catch (err) {
|
|
4376
|
+
console.warn(`No se pudo cargar la hoja de estilo ${url}:`, err);
|
|
4377
|
+
}
|
|
4378
|
+
}));
|
|
4379
|
+
await esperarCargaDeVentana();
|
|
4380
|
+
await sinEscuchasDeVentana(["popstate"], () => cargarScripts(recursos.scripts));
|
|
4381
|
+
const myOwn = window.myOwn;
|
|
4382
|
+
if (!myOwn) throw new Error("El backend no defini\xF3 myOwn.");
|
|
4383
|
+
window.my = myOwn;
|
|
4384
|
+
await myOwn.autoSetup();
|
|
4385
|
+
return myOwn;
|
|
4386
|
+
}
|
|
4387
|
+
|
|
4388
|
+
// src/puente/ConsolaBP.tsx
|
|
4389
|
+
import { useEffect as useEffect6 } from "react";
|
|
4390
|
+
import { Box as Box13 } from "@mui/material";
|
|
4391
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
4392
|
+
var MARGEN_DE_REPETIDO_MS = 1e3;
|
|
4393
|
+
function descartarRepetidos(consola, agregados, ahora) {
|
|
4394
|
+
for (const nodo of agregados) {
|
|
4395
|
+
if (!(nodo instanceof HTMLElement)) continue;
|
|
4396
|
+
const repetido = Array.from(consola.children).find(
|
|
4397
|
+
(otro) => otro instanceof HTMLElement && otro !== nodo && otro.className === nodo.className && otro.textContent === nodo.textContent && ahora - Number(otro.dataset.instante) < MARGEN_DE_REPETIDO_MS
|
|
4398
|
+
);
|
|
4399
|
+
if (repetido) nodo.remove();
|
|
4400
|
+
else nodo.dataset.instante = String(ahora);
|
|
4401
|
+
}
|
|
4402
|
+
}
|
|
4403
|
+
var ConsolaBP = () => {
|
|
4404
|
+
useEffect6(() => {
|
|
4405
|
+
const consola = document.getElementById("mini-console");
|
|
4406
|
+
if (!consola) return;
|
|
4407
|
+
const observador = new MutationObserver(
|
|
4408
|
+
(registros) => descartarRepetidos(consola, registros.flatMap((registro) => Array.from(registro.addedNodes)), Date.now())
|
|
4409
|
+
);
|
|
4410
|
+
observador.observe(consola, { childList: true });
|
|
4411
|
+
return () => observador.disconnect();
|
|
4412
|
+
}, []);
|
|
4413
|
+
return /* @__PURE__ */ jsx24(
|
|
4414
|
+
Box13,
|
|
4415
|
+
{
|
|
4416
|
+
id: "mini-console",
|
|
4417
|
+
sx: (tema) => ({
|
|
4418
|
+
"&#mini-console": {
|
|
4419
|
+
position: "fixed",
|
|
4420
|
+
top: { xs: 64, sm: 72 },
|
|
4421
|
+
left: "auto",
|
|
4422
|
+
right: 16,
|
|
4423
|
+
bottom: "auto",
|
|
4424
|
+
float: "none",
|
|
4425
|
+
zIndex: tema.zIndex.snackbar,
|
|
4426
|
+
width: "auto",
|
|
4427
|
+
minWidth: 0,
|
|
4428
|
+
maxWidth: "min(480px, calc(100vw - 32px))",
|
|
4429
|
+
minHeight: 0,
|
|
4430
|
+
maxHeight: "none",
|
|
4431
|
+
overflow: "visible",
|
|
4432
|
+
padding: 0,
|
|
4433
|
+
border: "none",
|
|
4434
|
+
borderRadius: 0,
|
|
4435
|
+
boxShadow: "none",
|
|
4436
|
+
backgroundColor: "transparent",
|
|
4437
|
+
fontSize: "inherit",
|
|
4438
|
+
display: "flex",
|
|
4439
|
+
flexDirection: "column",
|
|
4440
|
+
gap: 1
|
|
4441
|
+
},
|
|
4442
|
+
"&#mini-console:not(:empty)": { display: "flex" },
|
|
4443
|
+
"&#mini-console:empty": { display: "none" },
|
|
4444
|
+
"& > div": {
|
|
4445
|
+
p: "6px 12px",
|
|
4446
|
+
borderRadius: 1,
|
|
4447
|
+
boxShadow: tema.shadows[3],
|
|
4448
|
+
fontSize: "0.875rem",
|
|
4449
|
+
whiteSpace: "pre-wrap",
|
|
4450
|
+
overflowWrap: "anywhere",
|
|
4451
|
+
backgroundColor: tema.palette.grey[800],
|
|
4452
|
+
color: tema.palette.common.white
|
|
4453
|
+
},
|
|
4454
|
+
"& > .status-error": {
|
|
4455
|
+
backgroundColor: tema.palette.error.main,
|
|
4456
|
+
color: tema.palette.error.contrastText
|
|
4457
|
+
}
|
|
4458
|
+
})
|
|
4459
|
+
}
|
|
4460
|
+
);
|
|
4461
|
+
};
|
|
4462
|
+
|
|
4463
|
+
// src/puente/GrillaBP.tsx
|
|
4464
|
+
import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4465
|
+
var GrillaBP = ({ tabla, fixedFields }) => {
|
|
4466
|
+
const contenedor = useRef7(null);
|
|
4467
|
+
const [cargando, setCargando] = useState16(true);
|
|
4468
|
+
const [error, setError] = useState16(null);
|
|
4469
|
+
const clave = JSON.stringify(fixedFields ?? []);
|
|
4470
|
+
useEffect7(() => {
|
|
4471
|
+
const elemento = contenedor.current;
|
|
4472
|
+
if (!elemento) return;
|
|
4473
|
+
let vigente = true;
|
|
4474
|
+
setError(null);
|
|
4475
|
+
setCargando(true);
|
|
4476
|
+
cargarClienteBP(envConfig.backendUrl).then((myOwn) => {
|
|
4477
|
+
if (!vigente) return;
|
|
4478
|
+
setCargando(false);
|
|
4479
|
+
copiarSkinAlContenedor(elemento);
|
|
4480
|
+
elemento.replaceChildren();
|
|
4481
|
+
myOwn.tableGrid(tabla, elemento, { fixedFields: JSON.parse(clave) });
|
|
4482
|
+
}).catch((err) => {
|
|
4483
|
+
if (!vigente) return;
|
|
4484
|
+
setCargando(false);
|
|
4485
|
+
setError(mensajeDeError(err));
|
|
4486
|
+
});
|
|
4487
|
+
return () => {
|
|
4488
|
+
vigente = false;
|
|
4489
|
+
elemento.replaceChildren();
|
|
4490
|
+
};
|
|
4491
|
+
}, [tabla, clave]);
|
|
4492
|
+
return (
|
|
4493
|
+
// 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
|
|
4494
|
+
/* @__PURE__ */ jsxs18(Box14, { className: CLASE_CONTENEDOR_BP, sx: { position: "relative" }, children: [
|
|
4495
|
+
cargando && /* @__PURE__ */ jsx25(CircularProgress4, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
|
|
4496
|
+
error && /* @__PURE__ */ jsx25(Alert2, { severity: "error", sx: { m: 2 }, children: error }),
|
|
4497
|
+
/* @__PURE__ */ jsx25("div", { ref: contenedor }),
|
|
4498
|
+
/* @__PURE__ */ jsx25(ConsolaBP, {})
|
|
4499
|
+
] })
|
|
4500
|
+
);
|
|
4501
|
+
};
|
|
4502
|
+
var PaginaGrillaBP = () => {
|
|
4503
|
+
const { tableName = "" } = useParams();
|
|
4504
|
+
return /* @__PURE__ */ jsx25(GrillaBP, { tabla: tableName }, tableName);
|
|
4505
|
+
};
|
|
4506
|
+
|
|
4507
|
+
// src/rutaBase.ts
|
|
4508
|
+
var baseDelBundler = import.meta.env?.BASE_URL ?? "/";
|
|
4509
|
+
var rutaBase = baseDelBundler.replace(/\/+$/, "");
|
|
4510
|
+
|
|
4511
|
+
// src/components/grid/GenericDataGrid.tsx
|
|
4512
|
+
import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4513
|
+
var SUMMARY_ROW_HEIGHT = 35;
|
|
4514
|
+
var FILTER_ROW_HEIGHT = 35;
|
|
4515
|
+
var HEADER_ROW_HEIGHT = 30;
|
|
4516
|
+
var ROW_HEIGHT = 30;
|
|
4517
|
+
var MIN_BODY_HEIGHT = 260;
|
|
4518
|
+
var DURACION_FEEDBACK_EXITO = 3e3;
|
|
4519
|
+
var ALTO_TITULO_ANIDADA = 26;
|
|
4520
|
+
var ALTO_MINIMO_CUERPO_ANIDADA = 120;
|
|
4521
|
+
var HOLGURA_ANIDADA = 24;
|
|
4522
|
+
var ANCHO_MINIMO_ANIDADA = 240;
|
|
4523
|
+
var ANCHO_RESERVADO_PANTALLA = 320;
|
|
4524
|
+
var SANGRIA_DETALLE = 28 + 8 + 3;
|
|
4525
|
+
var MARGEN_INFERIOR_PAGINA = 24;
|
|
4526
|
+
var PRIMERAS_FILAS_ANIDADA = 20;
|
|
4527
|
+
var LIMITE_PRIMERAS_FILAS_ANIDADA = 30;
|
|
4528
|
+
var esColumnaPropia = (columna) => "customType" in columna;
|
|
4529
|
+
var SIN_ANCESTROS = [];
|
|
4530
|
+
var cargasEnCurso = /* @__PURE__ */ new Map();
|
|
4531
|
+
var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
4532
|
+
const theme = useTheme4();
|
|
4533
|
+
const { tableDefinition, row } = ancestor;
|
|
4534
|
+
const columns = useMemo10(() => {
|
|
4535
|
+
const filteredFields = tableDefinition.fields.filter(
|
|
4536
|
+
(field) => !fieldsToHide?.some((ff) => ff.fieldName === field.name)
|
|
4537
|
+
);
|
|
4538
|
+
return filteredFields.map((field) => {
|
|
4539
|
+
const isPrimaryKey = tableDefinition.primaryKey.includes(field.name);
|
|
4540
|
+
return {
|
|
4541
|
+
key: field.name,
|
|
4542
|
+
name: field.label || cambiarGuionesBajosPorEspacios(field.name),
|
|
4543
|
+
width: 150,
|
|
4544
|
+
editable: false,
|
|
4545
|
+
renderHeaderCell: () => /* @__PURE__ */ jsx26(Box15, { sx: { p: 0.5, height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsx26(
|
|
4546
|
+
Typography11,
|
|
4547
|
+
{
|
|
4548
|
+
variant: "caption",
|
|
4549
|
+
sx: {
|
|
4550
|
+
fontWeight: "bold",
|
|
4551
|
+
textDecoration: isPrimaryKey ? "underline" : "none",
|
|
4552
|
+
fontSize: "0.930rem"
|
|
4553
|
+
},
|
|
4554
|
+
children: field.label || cambiarGuionesBajosPorEspacios(field.name)
|
|
4555
|
+
}
|
|
4556
|
+
) }),
|
|
4557
|
+
renderCell: (props) => /* @__PURE__ */ jsx26(Box15, { sx: { px: 1, height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsx26(Typography11, { variant: "body2", sx: { fontSize: "0.875rem" }, noWrap: true, children: String(props.row[field.name] ?? "") }) })
|
|
4558
|
+
};
|
|
4559
|
+
});
|
|
4560
|
+
}, [tableDefinition, fieldsToHide]);
|
|
4561
|
+
return /* @__PURE__ */ jsxs19(Box15, { sx: {
|
|
4562
|
+
mb: 1.5,
|
|
4563
|
+
ml: index * 4,
|
|
4564
|
+
// El primer ancestro (index 0) no tiene margen, los siguientes sí
|
|
4565
|
+
border: "1px solid",
|
|
4566
|
+
borderColor: "divider",
|
|
4567
|
+
borderRadius: 1,
|
|
4568
|
+
overflow: "hidden",
|
|
4569
|
+
boxShadow: theme.shadows[1],
|
|
4570
|
+
bgcolor: "background.paper"
|
|
4571
|
+
}, children: [
|
|
4572
|
+
/* @__PURE__ */ jsx26(Box15, { sx: {
|
|
4573
|
+
bgcolor: "primary.main",
|
|
4574
|
+
color: "primary.contrastText",
|
|
4575
|
+
px: 1.5,
|
|
4576
|
+
py: 0.5,
|
|
4577
|
+
borderBottom: "1px solid",
|
|
4578
|
+
borderColor: "divider",
|
|
4579
|
+
display: "flex",
|
|
4580
|
+
alignItems: "center",
|
|
4581
|
+
fontWeight: "bold",
|
|
4582
|
+
gap: 1
|
|
4583
|
+
}, children: /* @__PURE__ */ jsx26(Typography11, { variant: "subtitle2", component: "div", children: cambiarGuionesBajosPorEspacios(ancestor.tableName) }) }),
|
|
4584
|
+
/* @__PURE__ */ jsx26(
|
|
4585
|
+
DataGrid,
|
|
4586
|
+
{
|
|
4587
|
+
className: "rdg-light",
|
|
4588
|
+
columns,
|
|
4589
|
+
rows: [row],
|
|
4590
|
+
headerRowHeight: HEADER_ROW_HEIGHT,
|
|
4591
|
+
rowHeight: ROW_HEIGHT,
|
|
4592
|
+
rowKeyGetter: () => "single-row",
|
|
4593
|
+
style: { height: 78 }
|
|
4594
|
+
}
|
|
4595
|
+
)
|
|
4596
|
+
] });
|
|
4597
|
+
};
|
|
4598
|
+
var GenericDataGrid = ({
|
|
4217
4599
|
tableName,
|
|
4218
4600
|
fixedFields: fixedFieldsRecibidos,
|
|
4219
4601
|
filterColumns: filterColumnsRecibidos,
|
|
@@ -4240,38 +4622,38 @@ var GenericDataGrid = ({
|
|
|
4240
4622
|
// eslint-disable-line react-hooks/exhaustive-deps
|
|
4241
4623
|
);
|
|
4242
4624
|
const cacheHeredado = useContext4(CacheGrillasContext);
|
|
4243
|
-
const [cachePropio] =
|
|
4625
|
+
const [cachePropio] = useState17(() => /* @__PURE__ */ new Map());
|
|
4244
4626
|
const cache = cacheHeredado ?? cachePropio;
|
|
4245
|
-
const [guardada] =
|
|
4246
|
-
const claveCargadaRef =
|
|
4247
|
-
const [tableDefinition, setTableDefinition] =
|
|
4248
|
-
const [tableData, setTableData] =
|
|
4249
|
-
const [cargandoInicial, setCargandoInicial] =
|
|
4250
|
-
const [errorDeCarga, setErrorDeCarga] =
|
|
4251
|
-
const [anchosCalculados, setAnchosCalculados] =
|
|
4252
|
-
const [columnasOcultas, setColumnasOcultas] =
|
|
4253
|
-
const [openDialogoDeColumnas, setOpenDialogoDeColumnas] =
|
|
4627
|
+
const [guardada] = useState17(() => claveCache ? cache.get(claveCache) : void 0);
|
|
4628
|
+
const claveCargadaRef = useRef8(guardada ? `${tableName}|${claveFixedFields}|${claveParametros}` : null);
|
|
4629
|
+
const [tableDefinition, setTableDefinition] = useState17(guardada?.tableDefinition ?? null);
|
|
4630
|
+
const [tableData, setTableData] = useState17(guardada?.tableData ?? []);
|
|
4631
|
+
const [cargandoInicial, setCargandoInicial] = useState17(!guardada);
|
|
4632
|
+
const [errorDeCarga, setErrorDeCarga] = useState17(null);
|
|
4633
|
+
const [anchosCalculados, setAnchosCalculados] = useState17(() => guardada?.anchosCalculados ?? /* @__PURE__ */ new Map());
|
|
4634
|
+
const [columnasOcultas, setColumnasOcultas] = useState17(() => guardada?.columnasOcultas ?? []);
|
|
4635
|
+
const [openDialogoDeColumnas, setOpenDialogoDeColumnas] = useState17(false);
|
|
4254
4636
|
const conjuntoDeOcultas = useMemo10(() => new Set(columnasOcultas), [columnasOcultas]);
|
|
4255
4637
|
const ocultarColumna = useCallback12((columna) => setColumnasOcultas((anteriores) => anteriores.includes(columna) ? anteriores : [...anteriores, columna]), []);
|
|
4256
4638
|
const alternarColumna = useCallback12((columna) => setColumnasOcultas((anteriores) => anteriores.includes(columna) ? anteriores.filter((oculta) => oculta !== columna) : [...anteriores, columna]), []);
|
|
4257
4639
|
const abrirDialogoDeColumnas = useCallback12(() => setOpenDialogoDeColumnas(true), []);
|
|
4258
|
-
const [detallesAbiertos, setDetallesAbiertos] =
|
|
4259
|
-
const [altosDetalle, setAltosDetalle] =
|
|
4260
|
-
const [anchosDetalle, setAnchosDetalle] =
|
|
4261
|
-
const [selectedRows, setSelectedRows] =
|
|
4262
|
-
const [, setSelectedCell] =
|
|
4263
|
-
const [estadoGrilla] =
|
|
4640
|
+
const [detallesAbiertos, setDetallesAbiertos] = useState17(guardada?.detallesAbiertos ?? []);
|
|
4641
|
+
const [altosDetalle, setAltosDetalle] = useState17(() => guardada?.altosDetalle ?? /* @__PURE__ */ new Map());
|
|
4642
|
+
const [anchosDetalle, setAnchosDetalle] = useState17(() => /* @__PURE__ */ new Map());
|
|
4643
|
+
const [selectedRows, setSelectedRows] = useState17(() => /* @__PURE__ */ new Set());
|
|
4644
|
+
const [, setSelectedCell] = useState17(void 0);
|
|
4645
|
+
const [estadoGrilla] = useState17(crearEstadoGrilla);
|
|
4264
4646
|
const theme = useTheme4();
|
|
4265
|
-
const [openDataGridOptions, setOpenDataGridOptions] =
|
|
4266
|
-
const [dataGridOptionsAnchorEl, setDataGridOptionsAnchorEl] =
|
|
4267
|
-
const [exitingRowIds, setExitingRowIds] =
|
|
4647
|
+
const [openDataGridOptions, setOpenDataGridOptions] = useState17(false);
|
|
4648
|
+
const [dataGridOptionsAnchorEl, setDataGridOptionsAnchorEl] = useState17(null);
|
|
4649
|
+
const [exitingRowIds, setExitingRowIds] = useState17(/* @__PURE__ */ new Set());
|
|
4268
4650
|
const { showError } = useSnackbar();
|
|
4269
4651
|
const { username: usuario } = useClientContext();
|
|
4270
|
-
const dataGridRef =
|
|
4271
|
-
const rowAtEditStartRef =
|
|
4272
|
-
const [openImportDialog, setOpenImportDialog] =
|
|
4273
|
-
const [openExportDialog, setOpenExportDialog] =
|
|
4274
|
-
const [columnWidths, setColumnWidths] =
|
|
4652
|
+
const dataGridRef = useRef8(null);
|
|
4653
|
+
const rowAtEditStartRef = useRef8(null);
|
|
4654
|
+
const [openImportDialog, setOpenImportDialog] = useState17(false);
|
|
4655
|
+
const [openExportDialog, setOpenExportDialog] = useState17(false);
|
|
4656
|
+
const [columnWidths, setColumnWidths] = useState17(() => /* @__PURE__ */ new Map());
|
|
4275
4657
|
const { callApi, callApiUpload, loading } = useApiCall();
|
|
4276
4658
|
const primaryKey = useMemo10(() => {
|
|
4277
4659
|
if (!tableDefinition) return ["id"];
|
|
@@ -4293,7 +4675,7 @@ var GenericDataGrid = ({
|
|
|
4293
4675
|
resetView
|
|
4294
4676
|
} = useGridDataView({ tableData, tableDefinition });
|
|
4295
4677
|
const abiertos = useMemo10(() => new Set(detallesAbiertos), [detallesAbiertos]);
|
|
4296
|
-
const filasDetalleRef =
|
|
4678
|
+
const filasDetalleRef = useRef8(/* @__PURE__ */ new Map());
|
|
4297
4679
|
const filasMostradas = useMemo10(() => {
|
|
4298
4680
|
const detailTables = tableDefinition?.detailTables ?? [];
|
|
4299
4681
|
if (abiertos.size === 0 || detailTables.length === 0) return filteredRows;
|
|
@@ -4368,7 +4750,7 @@ var GenericDataGrid = ({
|
|
|
4368
4750
|
filasVisiblesMax,
|
|
4369
4751
|
conPie
|
|
4370
4752
|
});
|
|
4371
|
-
const [contenidoDeCelda, setContenidoDeCelda] =
|
|
4753
|
+
const [contenidoDeCelda, setContenidoDeCelda] = useState17(null);
|
|
4372
4754
|
const verContenido = useCallback12((anclaje, texto) => setContenidoDeCelda({ anclaje, texto }), []);
|
|
4373
4755
|
const cerrarContenidoDeCelda = useCallback12(() => {
|
|
4374
4756
|
const anclaje = contenidoDeCelda?.anclaje;
|
|
@@ -4386,8 +4768,8 @@ var GenericDataGrid = ({
|
|
|
4386
4768
|
setSortColumns,
|
|
4387
4769
|
verContenido
|
|
4388
4770
|
});
|
|
4389
|
-
const tableNameAnteriorRef =
|
|
4390
|
-
|
|
4771
|
+
const tableNameAnteriorRef = useRef8(tableName);
|
|
4772
|
+
useEffect8(() => {
|
|
4391
4773
|
if (tableNameAnteriorRef.current === tableName) return;
|
|
4392
4774
|
tableNameAnteriorRef.current = tableName;
|
|
4393
4775
|
setDetallesAbiertos([]);
|
|
@@ -4401,7 +4783,7 @@ var GenericDataGrid = ({
|
|
|
4401
4783
|
setExitingRowIds(/* @__PURE__ */ new Set());
|
|
4402
4784
|
setColumnWidths(/* @__PURE__ */ new Map());
|
|
4403
4785
|
}, [tableName, estadoGrilla, resetView]);
|
|
4404
|
-
|
|
4786
|
+
useEffect8(() => {
|
|
4405
4787
|
const claveCarga = `${tableName}|${claveFixedFields}|${claveParametros}`;
|
|
4406
4788
|
if (claveCargadaRef.current === claveCarga) {
|
|
4407
4789
|
if (guardada) setSortColumns(guardada.sortColumns);
|
|
@@ -4470,11 +4852,11 @@ var GenericDataGrid = ({
|
|
|
4470
4852
|
vigente = false;
|
|
4471
4853
|
};
|
|
4472
4854
|
}, [tableName, claveFixedFields, fixedFields, claveParametros, parametros, showError, callApi, getInitialSortColumns, setSortColumns, aplicarFiltrosIniciales, guardada]);
|
|
4473
|
-
|
|
4855
|
+
useEffect8(() => {
|
|
4474
4856
|
if (!claveCache || !tableDefinition || cargandoInicial) return;
|
|
4475
4857
|
cache.set(claveCache, { tableDefinition, tableData, anchosCalculados, columnasOcultas, sortColumns, detallesAbiertos, altosDetalle });
|
|
4476
4858
|
}, [cache, claveCache, tableDefinition, tableData, anchosCalculados, columnasOcultas, sortColumns, detallesAbiertos, altosDetalle, cargandoInicial]);
|
|
4477
|
-
|
|
4859
|
+
useEffect8(() => {
|
|
4478
4860
|
let timer = null;
|
|
4479
4861
|
const desuscribir = estadoGrilla.suscribir(() => {
|
|
4480
4862
|
const hayExitos = Array.from(estadoGrilla.obtenerFeedback().values()).some((f) => f.type === "success");
|
|
@@ -4566,8 +4948,8 @@ var GenericDataGrid = ({
|
|
|
4566
4948
|
const clave = claveDetalle(rowId, detailTable);
|
|
4567
4949
|
setDetallesAbiertos((anteriores) => anteriores.includes(clave) ? anteriores.filter((c) => c !== clave) : [...anteriores, clave]);
|
|
4568
4950
|
}, [onOpenDetail, abrirDetalleEnPestana, abrirWScreenEnPestana]);
|
|
4569
|
-
const [medidas, setMedidas] =
|
|
4570
|
-
|
|
4951
|
+
const [medidas, setMedidas] = useState17(null);
|
|
4952
|
+
useEffect8(() => {
|
|
4571
4953
|
const elemento = dataGridRef.current?.element;
|
|
4572
4954
|
if (!elemento) return;
|
|
4573
4955
|
const medir = () => setMedidas((anteriores) => {
|
|
@@ -4580,8 +4962,8 @@ var GenericDataGrid = ({
|
|
|
4580
4962
|
return () => observador.disconnect();
|
|
4581
4963
|
}, [tableDefinition, cargandoInicial]);
|
|
4582
4964
|
const anchoVisible = medidas?.ancho ?? null;
|
|
4583
|
-
const [altoDeVentana, setAltoDeVentana] =
|
|
4584
|
-
|
|
4965
|
+
const [altoDeVentana, setAltoDeVentana] = useState17(null);
|
|
4966
|
+
useEffect8(() => {
|
|
4585
4967
|
if (anidada) return;
|
|
4586
4968
|
const elemento = dataGridRef.current?.element;
|
|
4587
4969
|
if (!elemento) return;
|
|
@@ -4602,13 +4984,13 @@ var GenericDataGrid = ({
|
|
|
4602
4984
|
}, [altoMaximoDetalleEfectivo]);
|
|
4603
4985
|
const renderDetalle = useCallback12((fila) => {
|
|
4604
4986
|
const { detailTable } = fila;
|
|
4605
|
-
return /* @__PURE__ */
|
|
4987
|
+
return /* @__PURE__ */ jsx26(
|
|
4606
4988
|
"div",
|
|
4607
4989
|
{
|
|
4608
4990
|
className: "fpr-detalle",
|
|
4609
4991
|
style: { maxWidth: anchoVisible ? anchoVisible - 2 : void 0 },
|
|
4610
4992
|
onKeyDown: (e) => e.stopPropagation(),
|
|
4611
|
-
children: detailTable.table ? /* @__PURE__ */
|
|
4993
|
+
children: detailTable.table ? /* @__PURE__ */ jsx26(
|
|
4612
4994
|
GenericDataGrid,
|
|
4613
4995
|
{
|
|
4614
4996
|
tableName: detailTable.table,
|
|
@@ -4621,7 +5003,7 @@ var GenericDataGrid = ({
|
|
|
4621
5003
|
onOpenDetail,
|
|
4622
5004
|
ancestors: tableDefinition ? [...ancestors, { tableName: tableDefinition.name, row: fila.filaPadre, tableDefinition, fixedFields: fila.fixedFields }] : ancestors
|
|
4623
5005
|
}
|
|
4624
|
-
) : detailTable.wScreen ? /* @__PURE__ */
|
|
5006
|
+
) : detailTable.wScreen ? /* @__PURE__ */ jsx26(
|
|
4625
5007
|
DetalleWScreen,
|
|
4626
5008
|
{
|
|
4627
5009
|
fila,
|
|
@@ -4629,7 +5011,7 @@ var GenericDataGrid = ({
|
|
|
4629
5011
|
onAlto: (alto) => cambiarAltoDetalle(fila.clave, alto),
|
|
4630
5012
|
onAncho: (ancho) => cambiarAnchoDetalle(fila.clave, ancho)
|
|
4631
5013
|
}
|
|
4632
|
-
) : /* @__PURE__ */
|
|
5014
|
+
) : /* @__PURE__ */ jsxs19(Alert3, { severity: "warning", children: [
|
|
4633
5015
|
"El detalle '",
|
|
4634
5016
|
detailTable.abr,
|
|
4635
5017
|
"' no tiene ni tabla ni wScreen."
|
|
@@ -4639,7 +5021,7 @@ var GenericDataGrid = ({
|
|
|
4639
5021
|
}, [anchoVisible, claveCache, tableName, cambiarAltoDetalle, cambiarAnchoDetalle, altoMaximoDetalleEfectivo, onOpenDetail, tableDefinition, ancestors]);
|
|
4640
5022
|
const detallesGrilla = useMemo10(() => ({ abiertos, alternarDetalle, renderDetalle }), [abiertos, alternarDetalle, renderDetalle]);
|
|
4641
5023
|
const altoDeseado = cargandoInicial ? ALTO_INICIAL_DETALLE : gridHeight + ALTO_TITULO_ANIDADA + 8;
|
|
4642
|
-
|
|
5024
|
+
useEffect8(() => {
|
|
4643
5025
|
onAltoDeseado?.(altoDeseado);
|
|
4644
5026
|
}, [onAltoDeseado, altoDeseado]);
|
|
4645
5027
|
const rowKeyGetter = useCallback12((row) => esFilaDetalle(row) ? `detalle:${row.clave}` : getPrimaryKeyValues(row, primaryKey), [primaryKey]);
|
|
@@ -4658,7 +5040,7 @@ var GenericDataGrid = ({
|
|
|
4658
5040
|
const anchoDetalleMax = detallesAbiertos.reduce((max, clave) => Math.max(max, anchosDetalle.get(clave) ?? 0), 0);
|
|
4659
5041
|
return Math.max(ANCHO_MINIMO_ANIDADA, propio, anchoDetalleMax > 0 ? anchoDetalleMax + SANGRIA_DETALLE + (medidas?.barra ?? 0) + 2 : 0);
|
|
4660
5042
|
}, [anidada, columns, columnWidths, medidas?.barra, detallesAbiertos, anchosDetalle]);
|
|
4661
|
-
|
|
5043
|
+
useEffect8(() => {
|
|
4662
5044
|
if (anidada && anchoContenido !== void 0) onAnchoDeseado?.(anchoContenido);
|
|
4663
5045
|
}, [onAnchoDeseado, anidada, anchoContenido]);
|
|
4664
5046
|
const anchoExterior = anchoContenido === void 0 ? void 0 : anidada ? anchoContenido : anchoContenido - 2 + 32 + ancestors.length * 32;
|
|
@@ -4676,19 +5058,22 @@ var GenericDataGrid = ({
|
|
|
4676
5058
|
};
|
|
4677
5059
|
const fallBackMessage = getFallBackMessage();
|
|
4678
5060
|
if (cargandoInicial) {
|
|
4679
|
-
return /* @__PURE__ */
|
|
4680
|
-
/* @__PURE__ */
|
|
4681
|
-
/* @__PURE__ */
|
|
5061
|
+
return /* @__PURE__ */ jsxs19(Box15, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: [
|
|
5062
|
+
/* @__PURE__ */ jsx26(CircularProgress5, {}),
|
|
5063
|
+
/* @__PURE__ */ jsx26(Typography11, { variant: "h6", sx: { ml: 2 }, children: "Cargando tabla..." })
|
|
4682
5064
|
] });
|
|
4683
5065
|
}
|
|
4684
5066
|
if (errorDeCarga) {
|
|
4685
|
-
return /* @__PURE__ */
|
|
5067
|
+
return /* @__PURE__ */ jsx26(Box15, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsx26(Alert3, { severity: "error", children: errorDeCarga }) });
|
|
4686
5068
|
}
|
|
4687
5069
|
if (!tableDefinition) {
|
|
4688
|
-
return /* @__PURE__ */
|
|
5070
|
+
return /* @__PURE__ */ jsx26(Box15, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsx26(Alert3, { severity: "warning", children: "No se pudo cargar la definici\xF3n de la tabla." }) });
|
|
4689
5071
|
}
|
|
4690
|
-
|
|
4691
|
-
|
|
5072
|
+
if (puenteBPHabilitado() && clientSidesSinImplementar(tableDefinition).length > 0) {
|
|
5073
|
+
return /* @__PURE__ */ jsx26(Box15, { sx: { height: anidada ? void 0 : "100%", minHeight: 0, overflow: anidada ? void 0 : "auto", boxSizing: "border-box", p: 1 }, children: /* @__PURE__ */ jsx26(GrillaBP, { tabla: tableName, fixedFields }) });
|
|
5074
|
+
}
|
|
5075
|
+
return /* @__PURE__ */ jsx26(CacheGrillasContext.Provider, { value: cache, children: /* @__PURE__ */ jsxs19(Box15, { sx: { pt: anidada ? 0 : 2, display: "flex", flexDirection: "column", height: "100%", boxSizing: "border-box", width: anchoExterior, maxWidth: "100%" }, children: [
|
|
5076
|
+
!anidada && ancestors.length > 0 && /* @__PURE__ */ jsx26(Box15, { sx: { px: 2, pt: 0, pb: 1, display: "flex", flexDirection: "column" }, children: ancestors.map((ancestor, index) => /* @__PURE__ */ jsx26(
|
|
4692
5077
|
StaticAncestorGrid,
|
|
4693
5078
|
{
|
|
4694
5079
|
ancestor,
|
|
@@ -4697,8 +5082,8 @@ var GenericDataGrid = ({
|
|
|
4697
5082
|
},
|
|
4698
5083
|
index
|
|
4699
5084
|
)) }),
|
|
4700
|
-
/* @__PURE__ */
|
|
4701
|
-
|
|
5085
|
+
/* @__PURE__ */ jsxs19(
|
|
5086
|
+
Box15,
|
|
4702
5087
|
{
|
|
4703
5088
|
sx: {
|
|
4704
5089
|
backgroundColor: theme.palette.primary.main,
|
|
@@ -4720,17 +5105,17 @@ var GenericDataGrid = ({
|
|
|
4720
5105
|
gap: 1
|
|
4721
5106
|
},
|
|
4722
5107
|
children: [
|
|
4723
|
-
/* @__PURE__ */
|
|
5108
|
+
/* @__PURE__ */ jsxs19(Typography11, { variant: "subtitle2", component: "div", children: [
|
|
4724
5109
|
titulo ?? cambiarGuionesBajosPorEspacios(tableDefinition.title || tableDefinition.name),
|
|
4725
5110
|
" - ",
|
|
4726
5111
|
filteredRows.length === tableData.length ? `${tableData.length} registros` : `${filteredRows.length} (F)`
|
|
4727
5112
|
] }),
|
|
4728
|
-
loading && /* @__PURE__ */
|
|
5113
|
+
loading && /* @__PURE__ */ jsx26(CircularProgress5, { size: 14, color: "inherit" })
|
|
4729
5114
|
]
|
|
4730
5115
|
}
|
|
4731
5116
|
),
|
|
4732
|
-
/* @__PURE__ */
|
|
4733
|
-
|
|
5117
|
+
/* @__PURE__ */ jsxs19(
|
|
5118
|
+
Box15,
|
|
4734
5119
|
{
|
|
4735
5120
|
sx: {
|
|
4736
5121
|
// Una grilla anidada se acota con px (el alto que le dio la de arriba, o el de una wScreen): una wScreen
|
|
@@ -4748,7 +5133,7 @@ var GenericDataGrid = ({
|
|
|
4748
5133
|
pb: anidada ? 0 : 3
|
|
4749
5134
|
},
|
|
4750
5135
|
children: [
|
|
4751
|
-
/* @__PURE__ */
|
|
5136
|
+
/* @__PURE__ */ jsx26(EstadoGrillaContext.Provider, { value: estadoGrilla, children: /* @__PURE__ */ jsx26(VistaGrillaContext.Provider, { value: vistaGrilla, children: /* @__PURE__ */ jsx26(DetallesGrillaContext.Provider, { value: detallesGrilla, children: /* @__PURE__ */ jsx26(
|
|
4752
5137
|
DataGrid,
|
|
4753
5138
|
{
|
|
4754
5139
|
className: "rdg-light",
|
|
@@ -4778,8 +5163,8 @@ var GenericDataGrid = ({
|
|
|
4778
5163
|
onCellKeyDown: handleCellKeyDown
|
|
4779
5164
|
}
|
|
4780
5165
|
) }) }) }),
|
|
4781
|
-
fallBackMessage && /* @__PURE__ */
|
|
4782
|
-
|
|
5166
|
+
fallBackMessage && /* @__PURE__ */ jsx26(
|
|
5167
|
+
Box15,
|
|
4783
5168
|
{
|
|
4784
5169
|
sx: {
|
|
4785
5170
|
position: "absolute",
|
|
@@ -4795,13 +5180,13 @@ var GenericDataGrid = ({
|
|
|
4795
5180
|
zIndex: tableData.length === 0 ? 10 : 1
|
|
4796
5181
|
// Mantenemos el zIndex superior para el estado vacío total
|
|
4797
5182
|
},
|
|
4798
|
-
children: /* @__PURE__ */
|
|
5183
|
+
children: /* @__PURE__ */ jsx26(Typography11, { variant: "body2", color: "textSecondary", children: fallBackMessage })
|
|
4799
5184
|
}
|
|
4800
5185
|
)
|
|
4801
5186
|
]
|
|
4802
5187
|
}
|
|
4803
5188
|
),
|
|
4804
|
-
/* @__PURE__ */
|
|
5189
|
+
/* @__PURE__ */ jsx26(
|
|
4805
5190
|
ExportDialog,
|
|
4806
5191
|
{
|
|
4807
5192
|
open: openExportDialog,
|
|
@@ -4813,7 +5198,7 @@ var GenericDataGrid = ({
|
|
|
4813
5198
|
username: usuario || "anonymous"
|
|
4814
5199
|
}
|
|
4815
5200
|
),
|
|
4816
|
-
/* @__PURE__ */
|
|
5201
|
+
/* @__PURE__ */ jsx26(
|
|
4817
5202
|
DialogoDeColumnas,
|
|
4818
5203
|
{
|
|
4819
5204
|
open: openDialogoDeColumnas,
|
|
@@ -4823,7 +5208,7 @@ var GenericDataGrid = ({
|
|
|
4823
5208
|
alternarColumna
|
|
4824
5209
|
}
|
|
4825
5210
|
),
|
|
4826
|
-
/* @__PURE__ */
|
|
5211
|
+
/* @__PURE__ */ jsx26(
|
|
4827
5212
|
ConfirmDialog,
|
|
4828
5213
|
{
|
|
4829
5214
|
open: openConfirmDialog,
|
|
@@ -4832,7 +5217,7 @@ var GenericDataGrid = ({
|
|
|
4832
5217
|
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."
|
|
4833
5218
|
}
|
|
4834
5219
|
),
|
|
4835
|
-
/* @__PURE__ */
|
|
5220
|
+
/* @__PURE__ */ jsx26(
|
|
4836
5221
|
DataGridOptionsDialog,
|
|
4837
5222
|
{
|
|
4838
5223
|
open: openDataGridOptions,
|
|
@@ -4841,7 +5226,7 @@ var GenericDataGrid = ({
|
|
|
4841
5226
|
anchorEl: dataGridOptionsAnchorEl
|
|
4842
5227
|
}
|
|
4843
5228
|
),
|
|
4844
|
-
/* @__PURE__ */
|
|
5229
|
+
/* @__PURE__ */ jsx26(
|
|
4845
5230
|
ImportDialog,
|
|
4846
5231
|
{
|
|
4847
5232
|
open: openImportDialog,
|
|
@@ -4850,14 +5235,14 @@ var GenericDataGrid = ({
|
|
|
4850
5235
|
loading
|
|
4851
5236
|
}
|
|
4852
5237
|
),
|
|
4853
|
-
/* @__PURE__ */
|
|
5238
|
+
/* @__PURE__ */ jsx26(
|
|
4854
5239
|
Dialog5,
|
|
4855
5240
|
{
|
|
4856
5241
|
open: openVerticalEditDialog,
|
|
4857
5242
|
onClose: () => setOpenVerticalEditDialog(false),
|
|
4858
5243
|
maxWidth: "sm",
|
|
4859
5244
|
fullWidth: true,
|
|
4860
|
-
children: rowToEditVertical && /* @__PURE__ */
|
|
5245
|
+
children: rowToEditVertical && /* @__PURE__ */ jsx26(
|
|
4861
5246
|
VerticalEditorPage,
|
|
4862
5247
|
{
|
|
4863
5248
|
tableName,
|
|
@@ -4903,7 +5288,7 @@ var GenericDataGrid = ({
|
|
|
4903
5288
|
)
|
|
4904
5289
|
}
|
|
4905
5290
|
),
|
|
4906
|
-
contenidoDeCelda && /* @__PURE__ */
|
|
5291
|
+
contenidoDeCelda && /* @__PURE__ */ jsx26(VentanaDeTexto, { anclaje: contenidoDeCelda.anclaje, texto: contenidoDeCelda.texto, editable: false, onAceptar: cerrarContenidoDeCelda, onCerrar: cerrarContenidoDeCelda })
|
|
4907
5292
|
] }) });
|
|
4908
5293
|
};
|
|
4909
5294
|
var GenericDataGrid_default = GenericDataGrid;
|
|
@@ -4913,10 +5298,10 @@ import React34, { useEffect as useEffect18, useMemo as useMemo17 } from "react";
|
|
|
4913
5298
|
import { BrowserRouter, Routes, Route, useLocation as useLocation9, Navigate as Navigate4, Outlet as Outlet2 } from "react-router-dom";
|
|
4914
5299
|
|
|
4915
5300
|
// src/components/MainLayout.tsx
|
|
4916
|
-
import { useEffect as
|
|
5301
|
+
import { useEffect as useEffect11 } from "react";
|
|
4917
5302
|
import { Outlet } from "react-router-dom";
|
|
4918
5303
|
import {
|
|
4919
|
-
Box as
|
|
5304
|
+
Box as Box17,
|
|
4920
5305
|
AppBar,
|
|
4921
5306
|
Toolbar,
|
|
4922
5307
|
Typography as Typography13,
|
|
@@ -4929,7 +5314,7 @@ import {
|
|
|
4929
5314
|
} from "@mui/material";
|
|
4930
5315
|
|
|
4931
5316
|
// src/contexts/AppContext.tsx
|
|
4932
|
-
import { createContext as createContext4, useContext as useContext5, useState as
|
|
5317
|
+
import { createContext as createContext4, useContext as useContext5, useState as useState18, useEffect as useEffect9, useCallback as useCallback13, useMemo as useMemo11, useRef as useRef9 } from "react";
|
|
4933
5318
|
import { useLocation, useNavigate } from "react-router-dom";
|
|
4934
5319
|
import { useSelector as useSelector2, useDispatch as useDispatch2 } from "react-redux";
|
|
4935
5320
|
|
|
@@ -4941,7 +5326,7 @@ var marcarCierreVoluntario = (activo) => {
|
|
|
4941
5326
|
var huboCierreVoluntario = () => cierreVoluntario;
|
|
4942
5327
|
|
|
4943
5328
|
// src/contexts/AppContext.tsx
|
|
4944
|
-
import { jsx as
|
|
5329
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
4945
5330
|
var AuthContext = createContext4(void 0);
|
|
4946
5331
|
var useApp = () => {
|
|
4947
5332
|
const context = useContext5(AuthContext);
|
|
@@ -4953,11 +5338,11 @@ var useApp = () => {
|
|
|
4953
5338
|
};
|
|
4954
5339
|
var AppProvider = ({ children, publicPaths = [] }) => {
|
|
4955
5340
|
console.log("AppProvider rendered/re-rendered");
|
|
4956
|
-
const [isLoggedIn, setIsLoggedIn] =
|
|
4957
|
-
const [showSessionExpiredMessage, setShowSessionExpiredMessage] =
|
|
4958
|
-
const isRedirectingRef =
|
|
4959
|
-
const huboSesionRef =
|
|
4960
|
-
const cierreVoluntarioRef =
|
|
5341
|
+
const [isLoggedIn, setIsLoggedIn] = useState18(false);
|
|
5342
|
+
const [showSessionExpiredMessage, setShowSessionExpiredMessage] = useState18(false);
|
|
5343
|
+
const isRedirectingRef = useRef9(false);
|
|
5344
|
+
const huboSesionRef = useRef9(false);
|
|
5345
|
+
const cierreVoluntarioRef = useRef9(false);
|
|
4961
5346
|
const dispatch = useDispatch2();
|
|
4962
5347
|
const clientContext = useSelector2((state) => state.clientContext);
|
|
4963
5348
|
if (clientContext.status === "succeeded" && !cierreVoluntarioRef.current) huboSesionRef.current = true;
|
|
@@ -5025,7 +5410,7 @@ var AppProvider = ({ children, publicPaths = [] }) => {
|
|
|
5025
5410
|
}
|
|
5026
5411
|
}
|
|
5027
5412
|
}, [dispatch, clientContext.status, showSessionExpiredMessage, isCurrentPathPublic, limpiarContextoPorSesionPerdida]);
|
|
5028
|
-
|
|
5413
|
+
useEffect9(() => {
|
|
5029
5414
|
checkSession();
|
|
5030
5415
|
const intervalId = setInterval(checkSession, 15 * 1e3);
|
|
5031
5416
|
return () => {
|
|
@@ -5049,7 +5434,7 @@ var AppProvider = ({ children, publicPaths = [] }) => {
|
|
|
5049
5434
|
handleExpiredSessionRedirect,
|
|
5050
5435
|
avisarCierreVoluntario
|
|
5051
5436
|
]);
|
|
5052
|
-
return /* @__PURE__ */
|
|
5437
|
+
return /* @__PURE__ */ jsx27(AuthContext.Provider, { value: authContextValue, children });
|
|
5053
5438
|
};
|
|
5054
5439
|
|
|
5055
5440
|
// src/components/MainLayout.tsx
|
|
@@ -5060,8 +5445,8 @@ import MenuIcon from "@mui/icons-material/Menu";
|
|
|
5060
5445
|
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
5061
5446
|
|
|
5062
5447
|
// src/components/SideMenu.tsx
|
|
5063
|
-
import
|
|
5064
|
-
import { List as List4, ListItemButton as ListItemButton4, ListItemIcon as ListItemIcon2, ListItemText as ListItemText3, Divider as Divider2, Box as
|
|
5448
|
+
import React21, { useEffect as useEffect10, useMemo as useMemo12, useRef as useRef10, useState as useState19 } from "react";
|
|
5449
|
+
import { List as List4, ListItemButton as ListItemButton4, ListItemIcon as ListItemIcon2, ListItemText as ListItemText3, Divider as Divider2, Box as Box16, Typography as Typography12, Collapse, TextField as TextField2, InputAdornment as InputAdornment2, IconButton as IconButton7 } from "@mui/material";
|
|
5065
5450
|
import ExpandLess from "@mui/icons-material/ExpandLess";
|
|
5066
5451
|
import ExpandMore from "@mui/icons-material/ExpandMore";
|
|
5067
5452
|
import TableChartIcon from "@mui/icons-material/TableChart";
|
|
@@ -5074,13 +5459,6 @@ import ClearIcon from "@mui/icons-material/Clear";
|
|
|
5074
5459
|
import { useNavigate as useNavigate2, useLocation as useLocation2 } from "react-router-dom";
|
|
5075
5460
|
import { blue, orange, teal, indigo, red } from "@mui/material/colors";
|
|
5076
5461
|
|
|
5077
|
-
// src/puente/habilitacion.ts
|
|
5078
|
-
var habilitado = false;
|
|
5079
|
-
var habilitarPuenteBP = () => {
|
|
5080
|
-
habilitado = true;
|
|
5081
|
-
};
|
|
5082
|
-
var puenteBPHabilitado = () => habilitado;
|
|
5083
|
-
|
|
5084
5462
|
// src/utils/menuInicial.ts
|
|
5085
5463
|
function rutaDeTablaDeMenu(camino) {
|
|
5086
5464
|
return `/menu/${camino.map(encodeURIComponent).join("/")}`;
|
|
@@ -5161,22 +5539,22 @@ function buscarEnMenu(hojas, consulta) {
|
|
|
5161
5539
|
}
|
|
5162
5540
|
|
|
5163
5541
|
// src/components/SideMenu.tsx
|
|
5164
|
-
import { Fragment as Fragment5, jsx as
|
|
5542
|
+
import { Fragment as Fragment5, jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
5165
5543
|
var CLAVE_RECIENTES = "fpr.menu.recientes";
|
|
5166
5544
|
var MAXIMO_RECIENTES = 4;
|
|
5167
5545
|
var getIcon = (item, destacado = false) => {
|
|
5168
5546
|
switch (item.menuType) {
|
|
5169
5547
|
case "table":
|
|
5170
|
-
return /* @__PURE__ */
|
|
5548
|
+
return /* @__PURE__ */ jsx28(TableChartIcon, { sx: destacado ? { color: blue[700] } : void 0 });
|
|
5171
5549
|
case "proc":
|
|
5172
|
-
return /* @__PURE__ */
|
|
5550
|
+
return /* @__PURE__ */ jsx28(DnsIcon, { sx: destacado ? { color: teal[700] } : void 0 });
|
|
5173
5551
|
case "menu":
|
|
5174
|
-
return /* @__PURE__ */
|
|
5552
|
+
return /* @__PURE__ */ jsx28(FolderIcon, { sx: destacado ? { color: orange[800] } : void 0 });
|
|
5175
5553
|
default:
|
|
5176
5554
|
if (wScreens[item.menuType] !== void 0 || puenteBPHabilitado()) {
|
|
5177
|
-
return /* @__PURE__ */
|
|
5555
|
+
return /* @__PURE__ */ jsx28(DesktopWindowsIcon, { sx: destacado ? { color: indigo[500] } : void 0 });
|
|
5178
5556
|
}
|
|
5179
|
-
return /* @__PURE__ */
|
|
5557
|
+
return /* @__PURE__ */ jsx28(WarningAmberIcon3, { sx: destacado ? { color: red[500] } : void 0 });
|
|
5180
5558
|
}
|
|
5181
5559
|
};
|
|
5182
5560
|
var estaSeleccionado = (item, grupos, currentPath, hash = "") => {
|
|
@@ -5226,28 +5604,28 @@ var MenuListItem = ({ item, level, grupos = [], hermanos = [], onMenuItemClick }
|
|
|
5226
5604
|
}
|
|
5227
5605
|
};
|
|
5228
5606
|
const isSelected = estaSeleccionado(item, grupos, location.pathname, location.hash);
|
|
5229
|
-
const itemRef =
|
|
5230
|
-
|
|
5607
|
+
const itemRef = React21.useRef(null);
|
|
5608
|
+
useEffect10(() => {
|
|
5231
5609
|
if (isSelected && itemRef.current) {
|
|
5232
5610
|
itemRef.current.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
5233
5611
|
}
|
|
5234
5612
|
}, [isSelected]);
|
|
5235
5613
|
const contenido = item.menuType === "menu" ? item.menuContent : [];
|
|
5236
|
-
return /* @__PURE__ */
|
|
5237
|
-
/* @__PURE__ */
|
|
5614
|
+
return /* @__PURE__ */ jsxs20("div", { ref: itemRef, children: [
|
|
5615
|
+
/* @__PURE__ */ jsxs20(
|
|
5238
5616
|
ListItemButton4,
|
|
5239
5617
|
{
|
|
5240
5618
|
onClick: handleClick,
|
|
5241
5619
|
sx: { pl: level * 2 },
|
|
5242
5620
|
selected: isSelected,
|
|
5243
5621
|
children: [
|
|
5244
|
-
/* @__PURE__ */
|
|
5245
|
-
/* @__PURE__ */
|
|
5246
|
-
item.menuType === "menu" ? open ? /* @__PURE__ */
|
|
5622
|
+
/* @__PURE__ */ jsx28(ListItemIcon2, { sx: { minWidth: "38px" }, children: getIcon(item, isSelected || open) }),
|
|
5623
|
+
/* @__PURE__ */ jsx28(ListItemText3, { primary: etiquetaDeItem(item) }),
|
|
5624
|
+
item.menuType === "menu" ? open ? /* @__PURE__ */ jsx28(ExpandLess, {}) : /* @__PURE__ */ jsx28(ExpandMore, {}) : null
|
|
5247
5625
|
]
|
|
5248
5626
|
}
|
|
5249
5627
|
),
|
|
5250
|
-
item.menuType === "menu" && /* @__PURE__ */
|
|
5628
|
+
item.menuType === "menu" && /* @__PURE__ */ jsx28(Collapse, { in: open, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ jsx28(List4, { component: "div", disablePadding: true, children: contenido.map((subItem) => /* @__PURE__ */ jsx28(
|
|
5251
5629
|
MenuListItem,
|
|
5252
5630
|
{
|
|
5253
5631
|
item: subItem,
|
|
@@ -5261,13 +5639,13 @@ var MenuListItem = ({ item, level, grupos = [], hermanos = [], onMenuItemClick }
|
|
|
5261
5639
|
] });
|
|
5262
5640
|
};
|
|
5263
5641
|
var ItemPlano = ({ hoja, seleccionado, traerALaVista = false, onElegir }) => {
|
|
5264
|
-
const boton =
|
|
5265
|
-
|
|
5642
|
+
const boton = useRef10(null);
|
|
5643
|
+
useEffect10(() => {
|
|
5266
5644
|
if (traerALaVista && seleccionado) boton.current?.scrollIntoView({ block: "nearest" });
|
|
5267
5645
|
}, [traerALaVista, seleccionado]);
|
|
5268
|
-
return /* @__PURE__ */
|
|
5269
|
-
/* @__PURE__ */
|
|
5270
|
-
/* @__PURE__ */
|
|
5646
|
+
return /* @__PURE__ */ jsxs20(ListItemButton4, { dense: true, selected: seleccionado, onClick: () => onElegir(hoja), ref: boton, children: [
|
|
5647
|
+
/* @__PURE__ */ jsx28(ListItemIcon2, { sx: { minWidth: "38px" }, children: getIcon(hoja.item, seleccionado) }),
|
|
5648
|
+
/* @__PURE__ */ jsx28(
|
|
5271
5649
|
ListItemText3,
|
|
5272
5650
|
{
|
|
5273
5651
|
primary: etiquetaDeItem(hoja.item),
|
|
@@ -5282,14 +5660,14 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5282
5660
|
const navigate = useNavigate2();
|
|
5283
5661
|
const location = useLocation2();
|
|
5284
5662
|
const dispatch = useAppDispatch();
|
|
5285
|
-
const [consulta, setConsulta] =
|
|
5286
|
-
const [indice, setIndice] =
|
|
5287
|
-
const [recientes, setRecientes] =
|
|
5288
|
-
const campoDeBusqueda =
|
|
5663
|
+
const [consulta, setConsulta] = useState19("");
|
|
5664
|
+
const [indice, setIndice] = useState19(0);
|
|
5665
|
+
const [recientes, setRecientes] = useState19(leerRecientes);
|
|
5666
|
+
const campoDeBusqueda = useRef10(null);
|
|
5289
5667
|
const menu = clientContext?.menu;
|
|
5290
5668
|
const hojas = useMemo12(() => hojasDeMenu(menu ?? []), [menu]);
|
|
5291
5669
|
const resultados = useMemo12(() => buscarEnMenu(hojas, consulta), [hojas, consulta]);
|
|
5292
|
-
|
|
5670
|
+
useEffect10(() => {
|
|
5293
5671
|
const alApretar = (evento) => {
|
|
5294
5672
|
if ((evento.ctrlKey || evento.metaKey) && !evento.altKey && !evento.shiftKey && evento.key.toLowerCase() === "k") {
|
|
5295
5673
|
evento.preventDefault();
|
|
@@ -5303,7 +5681,7 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5303
5681
|
window.addEventListener("keydown", alApretar);
|
|
5304
5682
|
return () => window.removeEventListener("keydown", alApretar);
|
|
5305
5683
|
}, [dispatch]);
|
|
5306
|
-
|
|
5684
|
+
useEffect10(() => {
|
|
5307
5685
|
const actual = hojas.find((hoja) => estaSeleccionado(hoja.item, hoja.grupos, location.pathname, location.hash));
|
|
5308
5686
|
if (!actual) return;
|
|
5309
5687
|
dispatch(abrirCamino(actual.grupos.map((_, i) => claveDeMenu(actual.grupos.slice(0, i + 1)))));
|
|
@@ -5315,7 +5693,7 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5315
5693
|
});
|
|
5316
5694
|
}, [location.pathname, location.hash, hojas, dispatch]);
|
|
5317
5695
|
if (!menu) {
|
|
5318
|
-
return /* @__PURE__ */
|
|
5696
|
+
return /* @__PURE__ */ jsx28(Box16, { sx: { p: 2, textAlign: "center" }, children: /* @__PURE__ */ jsx28(Typography12, { variant: "body2", color: "text.secondary", children: "Cargando men\xFA..." }) });
|
|
5319
5697
|
}
|
|
5320
5698
|
const elegir = (hoja) => {
|
|
5321
5699
|
navigate(rutaDeItemDeMenu(hoja.item, hoja.grupos));
|
|
@@ -5340,8 +5718,8 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5340
5718
|
}
|
|
5341
5719
|
};
|
|
5342
5720
|
const hojasRecientes = recientes.map((clave) => hojas.find((hoja) => hoja.clave === clave)).filter((hoja) => hoja !== void 0);
|
|
5343
|
-
return /* @__PURE__ */
|
|
5344
|
-
/* @__PURE__ */
|
|
5721
|
+
return /* @__PURE__ */ jsxs20(Box16, { sx: { width: "100%", flex: 1, minHeight: 0, display: "flex", flexDirection: "column" }, children: [
|
|
5722
|
+
/* @__PURE__ */ jsx28(Box16, { sx: { px: 1.5, py: 1, flexShrink: 0 }, children: /* @__PURE__ */ jsx28(
|
|
5345
5723
|
TextField2,
|
|
5346
5724
|
{
|
|
5347
5725
|
inputRef: campoDeBusqueda,
|
|
@@ -5357,19 +5735,19 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5357
5735
|
autoComplete: "off",
|
|
5358
5736
|
sx: { "& .MuiInputBase-input": { fontSize: "0.8rem" } },
|
|
5359
5737
|
InputProps: {
|
|
5360
|
-
startAdornment: /* @__PURE__ */
|
|
5361
|
-
endAdornment: consulta !== "" ? /* @__PURE__ */
|
|
5738
|
+
startAdornment: /* @__PURE__ */ jsx28(InputAdornment2, { position: "start", children: /* @__PURE__ */ jsx28(SearchIcon3, { fontSize: "small" }) }),
|
|
5739
|
+
endAdornment: consulta !== "" ? /* @__PURE__ */ jsx28(InputAdornment2, { position: "end", children: /* @__PURE__ */ jsx28(IconButton7, { size: "small", "aria-label": "borrar b\xFAsqueda", edge: "end", onClick: () => {
|
|
5362
5740
|
setConsulta("");
|
|
5363
5741
|
campoDeBusqueda.current?.focus();
|
|
5364
|
-
}, children: /* @__PURE__ */
|
|
5742
|
+
}, children: /* @__PURE__ */ jsx28(ClearIcon, { fontSize: "small" }) }) }) : void 0
|
|
5365
5743
|
}
|
|
5366
5744
|
}
|
|
5367
5745
|
) }),
|
|
5368
|
-
/* @__PURE__ */
|
|
5369
|
-
/* @__PURE__ */
|
|
5370
|
-
hojasRecientes.length > 0 && /* @__PURE__ */
|
|
5371
|
-
/* @__PURE__ */
|
|
5372
|
-
/* @__PURE__ */
|
|
5746
|
+
/* @__PURE__ */ jsx28(Divider2, {}),
|
|
5747
|
+
/* @__PURE__ */ jsx28(Box16, { sx: { flex: 1, minHeight: 0, overflowY: "auto" }, children: consulta.trim() !== "" ? resultados.length === 0 ? /* @__PURE__ */ jsx28(Box16, { sx: { p: 2, textAlign: "center" }, children: /* @__PURE__ */ jsx28(Typography12, { variant: "body2", color: "text.secondary", children: "Sin resultados" }) }) : /* @__PURE__ */ jsx28(List4, { children: resultados.map((hoja, i) => /* @__PURE__ */ jsx28(ItemPlano, { hoja, seleccionado: i === indice, traerALaVista: true, onElegir: elegir }, hoja.clave)) }) : /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
5748
|
+
hojasRecientes.length > 0 && /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
5749
|
+
/* @__PURE__ */ jsx28(Typography12, { variant: "overline", color: "text.secondary", sx: { display: "block", px: 2, pt: 1, lineHeight: 2 }, children: "Recientes" }),
|
|
5750
|
+
/* @__PURE__ */ jsx28(List4, { disablePadding: true, children: hojasRecientes.map((hoja) => /* @__PURE__ */ jsx28(
|
|
5373
5751
|
ItemPlano,
|
|
5374
5752
|
{
|
|
5375
5753
|
hoja,
|
|
@@ -5378,9 +5756,9 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5378
5756
|
},
|
|
5379
5757
|
hoja.clave
|
|
5380
5758
|
)) }),
|
|
5381
|
-
/* @__PURE__ */
|
|
5759
|
+
/* @__PURE__ */ jsx28(Divider2, {})
|
|
5382
5760
|
] }),
|
|
5383
|
-
/* @__PURE__ */
|
|
5761
|
+
/* @__PURE__ */ jsx28(List4, { children: menu.map((menuItem) => /* @__PURE__ */ jsx28(
|
|
5384
5762
|
MenuListItem,
|
|
5385
5763
|
{
|
|
5386
5764
|
item: menuItem,
|
|
@@ -5426,7 +5804,7 @@ var useLogout = () => {
|
|
|
5426
5804
|
var useLogout_default = useLogout;
|
|
5427
5805
|
|
|
5428
5806
|
// src/components/MainLayout.tsx
|
|
5429
|
-
import { jsx as
|
|
5807
|
+
import { jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5430
5808
|
var drawerWidth = 240;
|
|
5431
5809
|
var MainLayout = () => {
|
|
5432
5810
|
const { clientContext } = useApp();
|
|
@@ -5436,7 +5814,7 @@ var MainLayout = () => {
|
|
|
5436
5814
|
const dispatch = useAppDispatch();
|
|
5437
5815
|
const theme = useTheme5();
|
|
5438
5816
|
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
|
5439
|
-
|
|
5817
|
+
useEffect11(() => {
|
|
5440
5818
|
if (isMobile && isDrawerOpen) {
|
|
5441
5819
|
dispatch(setDrawerOpen(false));
|
|
5442
5820
|
}
|
|
@@ -5450,11 +5828,11 @@ var MainLayout = () => {
|
|
|
5450
5828
|
}
|
|
5451
5829
|
};
|
|
5452
5830
|
if (!clientContext) {
|
|
5453
|
-
return /* @__PURE__ */
|
|
5831
|
+
return /* @__PURE__ */ jsx29(Box17, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ jsx29(Typography13, { children: "Cargando dise\xF1o de la aplicaci\xF3n..." }) });
|
|
5454
5832
|
}
|
|
5455
|
-
return /* @__PURE__ */
|
|
5456
|
-
/* @__PURE__ */
|
|
5457
|
-
/* @__PURE__ */
|
|
5833
|
+
return /* @__PURE__ */ jsxs21(Box17, { sx: { display: "flex", height: "100vh" }, children: [
|
|
5834
|
+
/* @__PURE__ */ jsx29(CssBaseline, {}),
|
|
5835
|
+
/* @__PURE__ */ jsx29(
|
|
5458
5836
|
AppBar,
|
|
5459
5837
|
{
|
|
5460
5838
|
position: "fixed",
|
|
@@ -5473,8 +5851,8 @@ var MainLayout = () => {
|
|
|
5473
5851
|
})
|
|
5474
5852
|
}
|
|
5475
5853
|
},
|
|
5476
|
-
children: /* @__PURE__ */
|
|
5477
|
-
/* @__PURE__ */
|
|
5854
|
+
children: /* @__PURE__ */ jsxs21(Toolbar, { children: [
|
|
5855
|
+
/* @__PURE__ */ jsx29(
|
|
5478
5856
|
IconButton8,
|
|
5479
5857
|
{
|
|
5480
5858
|
color: "inherit",
|
|
@@ -5484,10 +5862,10 @@ var MainLayout = () => {
|
|
|
5484
5862
|
sx: {
|
|
5485
5863
|
marginRight: 2
|
|
5486
5864
|
},
|
|
5487
|
-
children: isDrawerOpen ? /* @__PURE__ */
|
|
5865
|
+
children: isDrawerOpen ? /* @__PURE__ */ jsx29(ChevronLeftIcon, {}) : /* @__PURE__ */ jsx29(MenuIcon, {})
|
|
5488
5866
|
}
|
|
5489
5867
|
),
|
|
5490
|
-
!isDrawerOpen && /* @__PURE__ */
|
|
5868
|
+
!isDrawerOpen && /* @__PURE__ */ jsx29(
|
|
5491
5869
|
"img",
|
|
5492
5870
|
{
|
|
5493
5871
|
src: `${envConfig.backendUrl}/img/logo-128.png`,
|
|
@@ -5495,22 +5873,22 @@ var MainLayout = () => {
|
|
|
5495
5873
|
style: { height: "32px", marginRight: "12px", objectFit: "contain" }
|
|
5496
5874
|
}
|
|
5497
5875
|
),
|
|
5498
|
-
/* @__PURE__ */
|
|
5499
|
-
/* @__PURE__ */
|
|
5500
|
-
/* @__PURE__ */
|
|
5501
|
-
/* @__PURE__ */
|
|
5876
|
+
/* @__PURE__ */ jsx29(Typography13, { variant: "h6", noWrap: true, component: "div", sx: { flexGrow: 1 }, children: isDrawerOpen ? "" : clientContext.config.title }),
|
|
5877
|
+
/* @__PURE__ */ jsx29(Typography13, { variant: "subtitle1", component: "div", sx: { mr: 2 }, children: clientContext.username }),
|
|
5878
|
+
/* @__PURE__ */ jsx29(IconButton8, { color: "inherit", title: "Cambiar contrase\xF1a", "aria-label": "cambiar contrase\xF1a", onClick: () => navigate("/chpass"), sx: { mr: 1 }, children: /* @__PURE__ */ jsx29(VpnKeyIcon, {}) }),
|
|
5879
|
+
/* @__PURE__ */ jsx29(
|
|
5502
5880
|
Button8,
|
|
5503
5881
|
{
|
|
5504
5882
|
color: "inherit",
|
|
5505
5883
|
onClick: logout,
|
|
5506
|
-
startIcon: /* @__PURE__ */
|
|
5884
|
+
startIcon: /* @__PURE__ */ jsx29(LogoutIcon, {}),
|
|
5507
5885
|
children: "Salir"
|
|
5508
5886
|
}
|
|
5509
5887
|
)
|
|
5510
5888
|
] })
|
|
5511
5889
|
}
|
|
5512
5890
|
),
|
|
5513
|
-
/* @__PURE__ */
|
|
5891
|
+
/* @__PURE__ */ jsxs21(
|
|
5514
5892
|
Drawer,
|
|
5515
5893
|
{
|
|
5516
5894
|
variant: "persistent",
|
|
@@ -5528,7 +5906,7 @@ var MainLayout = () => {
|
|
|
5528
5906
|
}
|
|
5529
5907
|
},
|
|
5530
5908
|
children: [
|
|
5531
|
-
/* @__PURE__ */
|
|
5909
|
+
/* @__PURE__ */ jsxs21(
|
|
5532
5910
|
Toolbar,
|
|
5533
5911
|
{
|
|
5534
5912
|
sx: {
|
|
@@ -5543,7 +5921,7 @@ var MainLayout = () => {
|
|
|
5543
5921
|
gap: 1.5
|
|
5544
5922
|
},
|
|
5545
5923
|
children: [
|
|
5546
|
-
/* @__PURE__ */
|
|
5924
|
+
/* @__PURE__ */ jsx29(
|
|
5547
5925
|
"img",
|
|
5548
5926
|
{
|
|
5549
5927
|
src: `${envConfig.backendUrl}/img/logo-128.png`,
|
|
@@ -5551,16 +5929,16 @@ var MainLayout = () => {
|
|
|
5551
5929
|
style: { height: "32px", objectFit: "contain" }
|
|
5552
5930
|
}
|
|
5553
5931
|
),
|
|
5554
|
-
/* @__PURE__ */
|
|
5932
|
+
/* @__PURE__ */ jsx29(Typography13, { variant: "h6", sx: { fontWeight: "bold" }, children: clientContext.config.title })
|
|
5555
5933
|
]
|
|
5556
5934
|
}
|
|
5557
5935
|
),
|
|
5558
|
-
/* @__PURE__ */
|
|
5936
|
+
/* @__PURE__ */ jsx29(SideMenu_default, { onMenuItemClick: handleDrawerCloseMobile })
|
|
5559
5937
|
]
|
|
5560
5938
|
}
|
|
5561
5939
|
),
|
|
5562
|
-
/* @__PURE__ */
|
|
5563
|
-
|
|
5940
|
+
/* @__PURE__ */ jsxs21(
|
|
5941
|
+
Box17,
|
|
5564
5942
|
{
|
|
5565
5943
|
component: "main",
|
|
5566
5944
|
sx: {
|
|
@@ -5586,8 +5964,8 @@ var MainLayout = () => {
|
|
|
5586
5964
|
width: isDrawerOpen ? `calc(100% - ${drawerWidth}px)` : "100%"
|
|
5587
5965
|
},
|
|
5588
5966
|
children: [
|
|
5589
|
-
/* @__PURE__ */
|
|
5590
|
-
/* @__PURE__ */
|
|
5967
|
+
/* @__PURE__ */ jsx29(Toolbar, {}),
|
|
5968
|
+
/* @__PURE__ */ jsx29(Box17, { sx: { flex: 1, minHeight: 0, overflowY: "auto", display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ jsx29(Outlet, {}) })
|
|
5591
5969
|
]
|
|
5592
5970
|
}
|
|
5593
5971
|
)
|
|
@@ -5596,8 +5974,8 @@ var MainLayout = () => {
|
|
|
5596
5974
|
var MainLayout_default = MainLayout;
|
|
5597
5975
|
|
|
5598
5976
|
// src/components/SessionExpiredMessage.tsx
|
|
5599
|
-
import { Box as
|
|
5600
|
-
import { jsx as
|
|
5977
|
+
import { Box as Box18, Typography as Typography14, Button as Button9, Modal } from "@mui/material";
|
|
5978
|
+
import { jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5601
5979
|
var style = {
|
|
5602
5980
|
position: "absolute",
|
|
5603
5981
|
top: "50%",
|
|
@@ -5616,7 +5994,7 @@ var SessionExpiredMessage = () => {
|
|
|
5616
5994
|
const handleClose = () => {
|
|
5617
5995
|
handleExpiredSessionRedirect();
|
|
5618
5996
|
};
|
|
5619
|
-
return /* @__PURE__ */
|
|
5997
|
+
return /* @__PURE__ */ jsx30(
|
|
5620
5998
|
Modal,
|
|
5621
5999
|
{
|
|
5622
6000
|
open: showSessionExpiredMessage,
|
|
@@ -5636,10 +6014,10 @@ var SessionExpiredMessage = () => {
|
|
|
5636
6014
|
}
|
|
5637
6015
|
}
|
|
5638
6016
|
},
|
|
5639
|
-
children: /* @__PURE__ */
|
|
5640
|
-
/* @__PURE__ */
|
|
5641
|
-
/* @__PURE__ */
|
|
5642
|
-
/* @__PURE__ */
|
|
6017
|
+
children: /* @__PURE__ */ jsxs22(Box18, { sx: style, children: [
|
|
6018
|
+
/* @__PURE__ */ jsx30(Typography14, { id: "session-expired-modal-title", variant: "h6", component: "h2", gutterBottom: true, children: "\xA1Sesi\xF3n Expirada!" }),
|
|
6019
|
+
/* @__PURE__ */ jsx30(Typography14, { 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." }),
|
|
6020
|
+
/* @__PURE__ */ jsx30(Button9, { variant: "contained", color: "primary", onClick: handleClose, children: "Ir al Login" })
|
|
5643
6021
|
] })
|
|
5644
6022
|
}
|
|
5645
6023
|
);
|
|
@@ -5648,24 +6026,24 @@ var SessionExpiredMessage_default = SessionExpiredMessage;
|
|
|
5648
6026
|
|
|
5649
6027
|
// src/pages/PantallaInicial.tsx
|
|
5650
6028
|
import { Navigate } from "react-router-dom";
|
|
5651
|
-
import { jsx as
|
|
6029
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
5652
6030
|
var PantallaInicial = () => {
|
|
5653
6031
|
const { clientContext } = useApp();
|
|
5654
6032
|
const item = clientContext.menu ? itemInicial(clientContext.menu) : void 0;
|
|
5655
|
-
return item && clientContext.menu ? /* @__PURE__ */
|
|
6033
|
+
return item && clientContext.menu ? /* @__PURE__ */ jsx31(Navigate, { to: rutaDeItemDeMenu(item, gruposDeItem(clientContext.menu, item)), replace: true }) : null;
|
|
5656
6034
|
};
|
|
5657
6035
|
var PantallaInicial_default = PantallaInicial;
|
|
5658
6036
|
|
|
5659
6037
|
// src/pages/LogoutPage.tsx
|
|
5660
|
-
import { useEffect as
|
|
5661
|
-
import { Box as
|
|
5662
|
-
import { jsx as
|
|
6038
|
+
import { useEffect as useEffect12 } from "react";
|
|
6039
|
+
import { Box as Box19, Typography as Typography15, CircularProgress as CircularProgress6 } from "@mui/material";
|
|
6040
|
+
import { jsx as jsx32, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5663
6041
|
var LogoutPage = () => {
|
|
5664
6042
|
const logout = useLogout_default();
|
|
5665
|
-
|
|
6043
|
+
useEffect12(() => {
|
|
5666
6044
|
logout();
|
|
5667
6045
|
}, [logout]);
|
|
5668
|
-
return /* @__PURE__ */
|
|
6046
|
+
return /* @__PURE__ */ jsxs23(Box19, { sx: {
|
|
5669
6047
|
display: "flex",
|
|
5670
6048
|
flexDirection: "column",
|
|
5671
6049
|
justifyContent: "center",
|
|
@@ -5673,15 +6051,15 @@ var LogoutPage = () => {
|
|
|
5673
6051
|
height: "100vh",
|
|
5674
6052
|
textAlign: "center"
|
|
5675
6053
|
}, children: [
|
|
5676
|
-
/* @__PURE__ */
|
|
5677
|
-
/* @__PURE__ */
|
|
6054
|
+
/* @__PURE__ */ jsx32(CircularProgress6, { size: 60 }),
|
|
6055
|
+
/* @__PURE__ */ jsx32(Typography15, { variant: "h6", sx: { mt: 2 }, children: "Cerrando sesi\xF3n..." })
|
|
5678
6056
|
] });
|
|
5679
6057
|
};
|
|
5680
6058
|
var LogoutPage_default = LogoutPage;
|
|
5681
6059
|
|
|
5682
6060
|
// src/pages/LoginPage.tsx
|
|
5683
|
-
import { useState as
|
|
5684
|
-
import { Button as Button10, TextField as TextField3, Typography as Typography16, Alert as
|
|
6061
|
+
import { useState as useState20 } from "react";
|
|
6062
|
+
import { Button as Button10, TextField as TextField3, Typography as Typography16, Alert as Alert4, AlertTitle, Box as Box20, CircularProgress as CircularProgress7, Link } from "@mui/material";
|
|
5685
6063
|
import { useLocation as useLocation3 } from "react-router-dom";
|
|
5686
6064
|
|
|
5687
6065
|
// src/pages/configuracionLogin.ts
|
|
@@ -5697,7 +6075,7 @@ import { useForm, Controller } from "react-hook-form";
|
|
|
5697
6075
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
5698
6076
|
import * as z from "zod";
|
|
5699
6077
|
import { useDispatch as useDispatch4 } from "react-redux";
|
|
5700
|
-
import { Fragment as Fragment6, jsx as
|
|
6078
|
+
import { Fragment as Fragment6, jsx as jsx33, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5701
6079
|
var loginSchema = z.object({
|
|
5702
6080
|
username: z.string().min(1, "El usuario es requerido"),
|
|
5703
6081
|
// Añadir validación básica
|
|
@@ -5705,8 +6083,8 @@ var loginSchema = z.object({
|
|
|
5705
6083
|
// Añadir validación básica
|
|
5706
6084
|
});
|
|
5707
6085
|
var LoginPage = () => {
|
|
5708
|
-
const [loginError, setLoginError] =
|
|
5709
|
-
const [isSubmitting, setIsSubmitting] =
|
|
6086
|
+
const [loginError, setLoginError] = useState20(null);
|
|
6087
|
+
const [isSubmitting, setIsSubmitting] = useState20(false);
|
|
5710
6088
|
const estadoDeLaRuta = useLocation3().state;
|
|
5711
6089
|
const claveCambiada = typeof estadoDeLaRuta === "object" && estadoDeLaRuta !== null && "claveCambiada" in estadoDeLaRuta && estadoDeLaRuta.claveCambiada === true;
|
|
5712
6090
|
const rutaDeRecuperarClave2 = rutaParaRecuperarClave();
|
|
@@ -5755,16 +6133,16 @@ var LoginPage = () => {
|
|
|
5755
6133
|
setIsSubmitting(false);
|
|
5756
6134
|
}
|
|
5757
6135
|
};
|
|
5758
|
-
return /* @__PURE__ */
|
|
5759
|
-
|
|
6136
|
+
return /* @__PURE__ */ jsx33(
|
|
6137
|
+
Box20,
|
|
5760
6138
|
{
|
|
5761
6139
|
display: "flex",
|
|
5762
6140
|
alignItems: "center",
|
|
5763
6141
|
justifyContent: "center",
|
|
5764
6142
|
minHeight: "100vh",
|
|
5765
6143
|
bgcolor: "#f5f5f5",
|
|
5766
|
-
children: /* @__PURE__ */
|
|
5767
|
-
|
|
6144
|
+
children: /* @__PURE__ */ jsxs24(
|
|
6145
|
+
Box20,
|
|
5768
6146
|
{
|
|
5769
6147
|
width: "100%",
|
|
5770
6148
|
maxWidth: "400px",
|
|
@@ -5773,7 +6151,7 @@ var LoginPage = () => {
|
|
|
5773
6151
|
borderRadius: 8,
|
|
5774
6152
|
boxShadow: 3,
|
|
5775
6153
|
children: [
|
|
5776
|
-
/* @__PURE__ */
|
|
6154
|
+
/* @__PURE__ */ jsx33(Box20, { sx: { display: "flex", justifyContent: "center", mb: 3 }, children: /* @__PURE__ */ jsx33(
|
|
5777
6155
|
"img",
|
|
5778
6156
|
{
|
|
5779
6157
|
src: `${envConfig.backendUrl}/img/login-logo-icon.png`,
|
|
@@ -5781,8 +6159,8 @@ var LoginPage = () => {
|
|
|
5781
6159
|
style: { height: "192px", maxWidth: "100%", objectFit: "contain" }
|
|
5782
6160
|
}
|
|
5783
6161
|
) }),
|
|
5784
|
-
/* @__PURE__ */
|
|
5785
|
-
/* @__PURE__ */
|
|
6162
|
+
/* @__PURE__ */ jsx33(Typography16, { variant: "h5", align: "center", gutterBottom: true, sx: { fontWeight: "bold", color: "primary.main" }, children: "Iniciar Sesi\xF3n" }),
|
|
6163
|
+
/* @__PURE__ */ jsxs24(
|
|
5786
6164
|
"form",
|
|
5787
6165
|
{
|
|
5788
6166
|
onSubmit: handleSubmit(onSubmit),
|
|
@@ -5794,14 +6172,14 @@ var LoginPage = () => {
|
|
|
5794
6172
|
if (!isSubmitting) void handleSubmit(onSubmit)();
|
|
5795
6173
|
},
|
|
5796
6174
|
children: [
|
|
5797
|
-
/* @__PURE__ */
|
|
5798
|
-
/* @__PURE__ */
|
|
5799
|
-
/* @__PURE__ */
|
|
6175
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
6176
|
+
/* @__PURE__ */ jsx33("label", { htmlFor: "username", children: /* @__PURE__ */ jsx33(Typography16, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Usuario" }) }),
|
|
6177
|
+
/* @__PURE__ */ jsx33(
|
|
5800
6178
|
Controller,
|
|
5801
6179
|
{
|
|
5802
6180
|
name: "username",
|
|
5803
6181
|
control,
|
|
5804
|
-
render: ({ field }) => /* @__PURE__ */
|
|
6182
|
+
render: ({ field }) => /* @__PURE__ */ jsx33(
|
|
5805
6183
|
TextField3,
|
|
5806
6184
|
{
|
|
5807
6185
|
...field,
|
|
@@ -5819,14 +6197,14 @@ var LoginPage = () => {
|
|
|
5819
6197
|
}
|
|
5820
6198
|
)
|
|
5821
6199
|
] }),
|
|
5822
|
-
/* @__PURE__ */
|
|
5823
|
-
/* @__PURE__ */
|
|
5824
|
-
/* @__PURE__ */
|
|
6200
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
6201
|
+
/* @__PURE__ */ jsx33("label", { htmlFor: "password", children: /* @__PURE__ */ jsx33(Typography16, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Contrase\xF1a" }) }),
|
|
6202
|
+
/* @__PURE__ */ jsx33(
|
|
5825
6203
|
Controller,
|
|
5826
6204
|
{
|
|
5827
6205
|
name: "password",
|
|
5828
6206
|
control,
|
|
5829
|
-
render: ({ field }) => /* @__PURE__ */
|
|
6207
|
+
render: ({ field }) => /* @__PURE__ */ jsx33(
|
|
5830
6208
|
TextField3,
|
|
5831
6209
|
{
|
|
5832
6210
|
...field,
|
|
@@ -5844,18 +6222,18 @@ var LoginPage = () => {
|
|
|
5844
6222
|
}
|
|
5845
6223
|
)
|
|
5846
6224
|
] }),
|
|
5847
|
-
/* @__PURE__ */
|
|
5848
|
-
/* @__PURE__ */
|
|
6225
|
+
/* @__PURE__ */ jsx33(Button10, { type: "submit", fullWidth: true, variant: "contained", color: "primary", disabled: isSubmitting, sx: { mt: 2 }, children: isSubmitting ? /* @__PURE__ */ jsxs24(Fragment6, { children: [
|
|
6226
|
+
/* @__PURE__ */ jsx33(CircularProgress7, { size: 20, sx: { mr: 1 } }),
|
|
5849
6227
|
"Iniciando sesi\xF3n..."
|
|
5850
6228
|
] }) : "Iniciar Sesi\xF3n" })
|
|
5851
6229
|
]
|
|
5852
6230
|
}
|
|
5853
6231
|
),
|
|
5854
|
-
rutaDeRecuperarClave2 && /* @__PURE__ */
|
|
5855
|
-
claveCambiada && !loginError && /* @__PURE__ */
|
|
5856
|
-
loginError && /* @__PURE__ */
|
|
6232
|
+
rutaDeRecuperarClave2 && /* @__PURE__ */ jsx33(Box20, { sx: { mt: 2, textAlign: "center" }, children: /* @__PURE__ */ jsx33(Link, { href: `${envConfig.backendUrl}${rutaDeRecuperarClave2}`, variant: "body2", underline: "hover", children: "Me olvid\xE9 la clave / es mi primer ingreso" }) }),
|
|
6233
|
+
claveCambiada && !loginError && /* @__PURE__ */ jsx33(Alert4, { severity: "success", sx: { mt: 2 }, children: "La contrase\xF1a se cambi\xF3. Ingres\xE1 con la clave nueva." }),
|
|
6234
|
+
loginError && /* @__PURE__ */ jsxs24(Alert4, { severity: "error", sx: { mt: 2, maxHeight: "200px" }, children: [
|
|
5857
6235
|
" ",
|
|
5858
|
-
/* @__PURE__ */
|
|
6236
|
+
/* @__PURE__ */ jsx33(AlertTitle, { children: "Error" }),
|
|
5859
6237
|
loginError
|
|
5860
6238
|
] })
|
|
5861
6239
|
]
|
|
@@ -5867,8 +6245,8 @@ var LoginPage = () => {
|
|
|
5867
6245
|
var LoginPage_default = LoginPage;
|
|
5868
6246
|
|
|
5869
6247
|
// src/components/ProcedureForm.tsx
|
|
5870
|
-
import
|
|
5871
|
-
import { useParams } from "react-router-dom";
|
|
6248
|
+
import React25, { useState as useState21, useCallback as useCallback15, useMemo as useMemo13 } from "react";
|
|
6249
|
+
import { useParams as useParams2 } from "react-router-dom";
|
|
5872
6250
|
import {
|
|
5873
6251
|
TextField as TextField4,
|
|
5874
6252
|
Button as Button11,
|
|
@@ -5880,22 +6258,22 @@ import {
|
|
|
5880
6258
|
FormControlLabel as FormControlLabel3,
|
|
5881
6259
|
FormHelperText as FormHelperText2,
|
|
5882
6260
|
Typography as Typography18,
|
|
5883
|
-
Box as
|
|
5884
|
-
CircularProgress as
|
|
5885
|
-
Alert as
|
|
6261
|
+
Box as Box22,
|
|
6262
|
+
CircularProgress as CircularProgress8,
|
|
6263
|
+
Alert as Alert5,
|
|
5886
6264
|
Divider as Divider3,
|
|
5887
6265
|
Paper as Paper4
|
|
5888
6266
|
} from "@mui/material";
|
|
5889
6267
|
|
|
5890
6268
|
// src/pages/procedure-results/SuccessDisplay.tsx
|
|
5891
|
-
import { Box as
|
|
5892
|
-
import { jsx as
|
|
6269
|
+
import { Box as Box21, Typography as Typography17, Paper as Paper3 } from "@mui/material";
|
|
6270
|
+
import { jsx as jsx34, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5893
6271
|
var SuccessDisplay = ({ data }) => {
|
|
5894
|
-
return /* @__PURE__ */
|
|
5895
|
-
/* @__PURE__ */
|
|
5896
|
-
/* @__PURE__ */
|
|
5897
|
-
/* @__PURE__ */
|
|
5898
|
-
/* @__PURE__ */
|
|
6272
|
+
return /* @__PURE__ */ jsxs25(Paper3, { elevation: 2, sx: { p: 2, mt: 2, bgcolor: "success.light", color: "success.contrastText" }, children: [
|
|
6273
|
+
/* @__PURE__ */ jsx34(Typography17, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: "\xA1Operaci\xF3n Exitosa!" }),
|
|
6274
|
+
/* @__PURE__ */ jsx34(Typography17, { variant: "body2", sx: { fontSize: "0.85rem" }, children: "Detalles del resultado:" }),
|
|
6275
|
+
/* @__PURE__ */ jsx34(Box21, { sx: { bgcolor: "success.dark", p: 1, borderRadius: 1, mt: 1, overflowX: "auto" }, children: /* @__PURE__ */ jsx34("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(data, null, 2) }) }),
|
|
6276
|
+
/* @__PURE__ */ jsx34(Typography17, { variant: "body2", sx: { fontSize: "0.8rem", mt: 1 }, children: "Puedes revisar los detalles anteriores o cerrar este mensaje." })
|
|
5899
6277
|
] });
|
|
5900
6278
|
};
|
|
5901
6279
|
var SuccessDisplay_default = SuccessDisplay;
|
|
@@ -5909,22 +6287,22 @@ var extendResultsOk = (newComponents) => {
|
|
|
5909
6287
|
};
|
|
5910
6288
|
|
|
5911
6289
|
// src/components/ProcedureForm.tsx
|
|
5912
|
-
import { jsx as
|
|
6290
|
+
import { jsx as jsx35, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5913
6291
|
var ProcedureForm = () => {
|
|
5914
|
-
const { procedureName } =
|
|
6292
|
+
const { procedureName } = useParams2();
|
|
5915
6293
|
const { clientContext } = useApp();
|
|
5916
6294
|
const { callApi, loading: apiLoading, error: apiError } = useApiCall();
|
|
5917
|
-
const [validationErrors, setValidationErrors] =
|
|
5918
|
-
const [successMessage, setSuccessMessage] =
|
|
5919
|
-
const [executionLog, setExecutionLog] =
|
|
5920
|
-
const [procedureResultData, setProcedureResultData] =
|
|
6295
|
+
const [validationErrors, setValidationErrors] = useState21({});
|
|
6296
|
+
const [successMessage, setSuccessMessage] = useState21(null);
|
|
6297
|
+
const [executionLog, setExecutionLog] = useState21([]);
|
|
6298
|
+
const [procedureResultData, setProcedureResultData] = useState21(null);
|
|
5921
6299
|
const procedure = useMemo13(() => {
|
|
5922
6300
|
if (procedureName && clientContext?.procedure) {
|
|
5923
6301
|
return clientContext.procedure[procedureName];
|
|
5924
6302
|
}
|
|
5925
6303
|
return void 0;
|
|
5926
6304
|
}, [procedureName, clientContext]);
|
|
5927
|
-
const [formValues, setFormValues] =
|
|
6305
|
+
const [formValues, setFormValues] = useState21(() => {
|
|
5928
6306
|
if (!procedure) return {};
|
|
5929
6307
|
const initialValues = {};
|
|
5930
6308
|
procedure.parameters.forEach((param) => {
|
|
@@ -5949,7 +6327,7 @@ var ProcedureForm = () => {
|
|
|
5949
6327
|
});
|
|
5950
6328
|
return initialValues;
|
|
5951
6329
|
});
|
|
5952
|
-
|
|
6330
|
+
React25.useEffect(() => {
|
|
5953
6331
|
if (procedure) {
|
|
5954
6332
|
setValidationErrors({});
|
|
5955
6333
|
setSuccessMessage(null);
|
|
@@ -6124,9 +6502,9 @@ var ProcedureForm = () => {
|
|
|
6124
6502
|
sx: { fontSize: "0.8rem" }
|
|
6125
6503
|
};
|
|
6126
6504
|
if (param.options && param.options.length > 0) {
|
|
6127
|
-
return /* @__PURE__ */
|
|
6128
|
-
/* @__PURE__ */
|
|
6129
|
-
/* @__PURE__ */
|
|
6505
|
+
return /* @__PURE__ */ jsxs26(FormControl3, { fullWidth: true, margin: "dense", size: "small", error: hasError, required: commonProps.required, children: [
|
|
6506
|
+
/* @__PURE__ */ jsx35(InputLabel2, { id: `${param.name}-label`, sx: { fontSize: "0.8rem" }, children: param.label || param.name }),
|
|
6507
|
+
/* @__PURE__ */ jsxs26(
|
|
6130
6508
|
Select2,
|
|
6131
6509
|
{
|
|
6132
6510
|
labelId: `${param.name}-label`,
|
|
@@ -6137,14 +6515,14 @@ var ProcedureForm = () => {
|
|
|
6137
6515
|
label: param.label || param.name,
|
|
6138
6516
|
disabled: apiLoading,
|
|
6139
6517
|
sx: { fontSize: "0.8rem" },
|
|
6140
|
-
renderValue: (selected) => /* @__PURE__ */
|
|
6518
|
+
renderValue: (selected) => /* @__PURE__ */ jsx35(Typography18, { sx: { fontSize: "0.8rem" }, children: selected }),
|
|
6141
6519
|
children: [
|
|
6142
|
-
(!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */
|
|
6143
|
-
param.options.map((option) => /* @__PURE__ */
|
|
6520
|
+
(!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */ jsx35(MenuItem2, { value: "", sx: { fontSize: "0.8rem" }, children: /* @__PURE__ */ jsx35("em", { children: "Seleccione..." }) }),
|
|
6521
|
+
param.options.map((option) => /* @__PURE__ */ jsx35(MenuItem2, { value: option, sx: { fontSize: "0.8rem" }, children: option }, option))
|
|
6144
6522
|
]
|
|
6145
6523
|
}
|
|
6146
6524
|
),
|
|
6147
|
-
(param.description || errorMessage) && /* @__PURE__ */
|
|
6525
|
+
(param.description || errorMessage) && /* @__PURE__ */ jsx35(FormHelperText2, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
|
|
6148
6526
|
] });
|
|
6149
6527
|
}
|
|
6150
6528
|
switch (param.typeName) {
|
|
@@ -6153,18 +6531,18 @@ var ProcedureForm = () => {
|
|
|
6153
6531
|
case "tsrange":
|
|
6154
6532
|
case "time_range":
|
|
6155
6533
|
case "daterange":
|
|
6156
|
-
return /* @__PURE__ */
|
|
6534
|
+
return /* @__PURE__ */ jsx35(TextField4, { type: "text", value: formValues[param.name] || "", ...commonProps });
|
|
6157
6535
|
case "decimal":
|
|
6158
6536
|
case "double":
|
|
6159
|
-
return /* @__PURE__ */
|
|
6537
|
+
return /* @__PURE__ */ jsx35(TextField4, { type: "number", inputProps: { step: "any", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
|
|
6160
6538
|
case "integer":
|
|
6161
6539
|
case "bigint":
|
|
6162
|
-
return /* @__PURE__ */
|
|
6540
|
+
return /* @__PURE__ */ jsx35(TextField4, { type: "number", inputProps: { step: "1", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
|
|
6163
6541
|
case "boolean":
|
|
6164
|
-
return /* @__PURE__ */
|
|
6542
|
+
return /* @__PURE__ */ jsx35(
|
|
6165
6543
|
FormControlLabel3,
|
|
6166
6544
|
{
|
|
6167
|
-
control: /* @__PURE__ */
|
|
6545
|
+
control: /* @__PURE__ */ jsx35(
|
|
6168
6546
|
Checkbox3,
|
|
6169
6547
|
{
|
|
6170
6548
|
checked: !!formValues[param.name],
|
|
@@ -6175,21 +6553,21 @@ var ProcedureForm = () => {
|
|
|
6175
6553
|
size: "small"
|
|
6176
6554
|
}
|
|
6177
6555
|
),
|
|
6178
|
-
label: /* @__PURE__ */
|
|
6556
|
+
label: /* @__PURE__ */ jsx35(Typography18, { sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "inherit" }, children: param.label || param.name }),
|
|
6179
6557
|
sx: { mt: 1, mb: 0 }
|
|
6180
6558
|
}
|
|
6181
6559
|
);
|
|
6182
6560
|
case "date":
|
|
6183
6561
|
case "timestamp":
|
|
6184
6562
|
case "time":
|
|
6185
|
-
return /* @__PURE__ */
|
|
6563
|
+
return /* @__PURE__ */ jsx35(TextField4, { type: param.typeName === "date" ? "date" : param.typeName === "timestamp" ? "datetime-local" : "time", value: formValues[param.name] || "", ...commonProps, InputLabelProps: { shrink: true, sx: { fontSize: "0.8rem" } } });
|
|
6186
6564
|
case "jsonb":
|
|
6187
6565
|
case "jsona":
|
|
6188
|
-
return /* @__PURE__ */
|
|
6566
|
+
return /* @__PURE__ */ jsx35(TextField4, { multiline: true, rows: 5, value: formValues[param.name] || "", ...commonProps, InputProps: { sx: { fontSize: "0.8rem" } } });
|
|
6189
6567
|
case "bytea":
|
|
6190
|
-
return /* @__PURE__ */
|
|
6191
|
-
/* @__PURE__ */
|
|
6192
|
-
/* @__PURE__ */
|
|
6568
|
+
return /* @__PURE__ */ jsxs26(FormControl3, { fullWidth: true, margin: "dense", error: hasError, required: commonProps.required, children: [
|
|
6569
|
+
/* @__PURE__ */ jsx35(Typography18, { variant: "body2", color: "textSecondary", component: "label", htmlFor: param.name, sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "text.secondary" }, children: param.label || param.name }),
|
|
6570
|
+
/* @__PURE__ */ jsx35(
|
|
6193
6571
|
"input",
|
|
6194
6572
|
{
|
|
6195
6573
|
type: "file",
|
|
@@ -6203,34 +6581,34 @@ var ProcedureForm = () => {
|
|
|
6203
6581
|
style: { padding: "6px 0", fontSize: "0.8rem" }
|
|
6204
6582
|
}
|
|
6205
6583
|
),
|
|
6206
|
-
(param.description || errorMessage) && /* @__PURE__ */
|
|
6584
|
+
(param.description || errorMessage) && /* @__PURE__ */ jsx35(FormHelperText2, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
|
|
6207
6585
|
] });
|
|
6208
6586
|
default:
|
|
6209
|
-
return /* @__PURE__ */
|
|
6587
|
+
return /* @__PURE__ */ jsx35(TextField4, { type: "text", value: formValues[param.name] || "", ...commonProps });
|
|
6210
6588
|
}
|
|
6211
6589
|
}, [formValues, handleChange, apiLoading, validationErrors]);
|
|
6212
6590
|
const ResultDisplayContent = useMemo13(() => {
|
|
6213
6591
|
if (!procedureResultData || !procedure?.resultOk) return null;
|
|
6214
6592
|
const ComponentToRender = resultsOk[procedure.resultOk];
|
|
6215
6593
|
if (ComponentToRender) {
|
|
6216
|
-
return /* @__PURE__ */
|
|
6594
|
+
return /* @__PURE__ */ jsx35(ComponentToRender, { data: procedureResultData });
|
|
6217
6595
|
} else {
|
|
6218
|
-
return /* @__PURE__ */
|
|
6219
|
-
/* @__PURE__ */
|
|
6596
|
+
return /* @__PURE__ */ jsxs26(Paper4, { elevation: 2, sx: { p: 2, mt: 0, bgcolor: "warning.light" }, children: [
|
|
6597
|
+
/* @__PURE__ */ jsxs26(Typography18, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: [
|
|
6220
6598
|
"el componente para resolver el resultOk: '",
|
|
6221
6599
|
procedure.resultOk,
|
|
6222
6600
|
"' definido en el procedure no existe o no est\xE1 mapeado."
|
|
6223
6601
|
] }),
|
|
6224
|
-
/* @__PURE__ */
|
|
6602
|
+
/* @__PURE__ */ jsx35(Box22, { sx: {
|
|
6225
6603
|
bgcolor: "warning.dark",
|
|
6226
6604
|
p: 1,
|
|
6227
6605
|
borderRadius: 1
|
|
6228
|
-
}, children: /* @__PURE__ */
|
|
6606
|
+
}, children: /* @__PURE__ */ jsx35("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(procedureResultData, null, 2) }) })
|
|
6229
6607
|
] });
|
|
6230
6608
|
}
|
|
6231
6609
|
}, [procedureResultData, procedure]);
|
|
6232
6610
|
if (!procedure) {
|
|
6233
|
-
return /* @__PURE__ */
|
|
6611
|
+
return /* @__PURE__ */ jsxs26(Box22, { sx: {
|
|
6234
6612
|
p: 2,
|
|
6235
6613
|
width: "100%",
|
|
6236
6614
|
boxSizing: "border-box",
|
|
@@ -6240,13 +6618,13 @@ var ProcedureForm = () => {
|
|
|
6240
6618
|
boxShadow: 3,
|
|
6241
6619
|
textAlign: "center"
|
|
6242
6620
|
}, children: [
|
|
6243
|
-
/* @__PURE__ */
|
|
6244
|
-
/* @__PURE__ */
|
|
6621
|
+
/* @__PURE__ */ jsx35(CircularProgress8, { sx: { mb: 2 } }),
|
|
6622
|
+
/* @__PURE__ */ jsx35(Typography18, { variant: "h6", color: "text.secondary", children: "Cargando procedimiento o no encontrado..." })
|
|
6245
6623
|
] });
|
|
6246
6624
|
}
|
|
6247
6625
|
return (
|
|
6248
6626
|
// Esta es la Box más externa que ahora controlará el scroll
|
|
6249
|
-
/* @__PURE__ */
|
|
6627
|
+
/* @__PURE__ */ jsxs26(Box22, { sx: {
|
|
6250
6628
|
p: 2,
|
|
6251
6629
|
ml: 1,
|
|
6252
6630
|
mt: 2,
|
|
@@ -6263,16 +6641,16 @@ var ProcedureForm = () => {
|
|
|
6263
6641
|
overflowX: "hidden"
|
|
6264
6642
|
// Oculta el scroll horizontal si no es necesario para el contenedor principal
|
|
6265
6643
|
}, children: [
|
|
6266
|
-
/* @__PURE__ */
|
|
6267
|
-
Object.values(validationErrors).some((err) => err !== null) && /* @__PURE__ */
|
|
6644
|
+
/* @__PURE__ */ jsx35(Typography18, { variant: "h5", component: "h2", gutterBottom: true, align: "left", children: cambiarGuionesBajosPorEspacios(procedure.proceedLabel || procedure.action) }),
|
|
6645
|
+
Object.values(validationErrors).some((err) => err !== null) && /* @__PURE__ */ jsxs26(Alert5, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: [
|
|
6268
6646
|
"Por favor, corrige los errores en el formulario antes de enviar.",
|
|
6269
|
-
/* @__PURE__ */
|
|
6647
|
+
/* @__PURE__ */ jsx35("ul", { children: Object.values(validationErrors).map((err, idx) => err && /* @__PURE__ */ jsx35("li", { children: err }, idx)) })
|
|
6270
6648
|
] }),
|
|
6271
|
-
!Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */
|
|
6272
|
-
!Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */
|
|
6273
|
-
/* @__PURE__ */
|
|
6274
|
-
procedure.parameters.map((param) => /* @__PURE__ */
|
|
6275
|
-
/* @__PURE__ */
|
|
6649
|
+
!Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */ jsx35(Alert5, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: apiError.message }),
|
|
6650
|
+
!Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */ jsx35(Alert5, { severity: "success", sx: { mb: 2, fontSize: "0.8rem" }, children: successMessage }),
|
|
6651
|
+
/* @__PURE__ */ jsxs26("form", { onSubmit: handleSubmit, children: [
|
|
6652
|
+
procedure.parameters.map((param) => /* @__PURE__ */ jsx35("div", { children: renderInputField(param) }, param.name)),
|
|
6653
|
+
/* @__PURE__ */ jsx35(
|
|
6276
6654
|
Button11,
|
|
6277
6655
|
{
|
|
6278
6656
|
type: "submit",
|
|
@@ -6281,20 +6659,20 @@ var ProcedureForm = () => {
|
|
|
6281
6659
|
disabled: apiLoading || Object.values(validationErrors).some((err) => err !== null),
|
|
6282
6660
|
sx: { mt: 2 },
|
|
6283
6661
|
size: "medium",
|
|
6284
|
-
startIcon: apiLoading ? /* @__PURE__ */
|
|
6662
|
+
startIcon: apiLoading ? /* @__PURE__ */ jsx35(CircularProgress8, { size: 20, color: "inherit" }) : null,
|
|
6285
6663
|
children: apiLoading ? "Ejecutando..." : procedure.proceedLabel || "Ejecutar"
|
|
6286
6664
|
}
|
|
6287
6665
|
)
|
|
6288
6666
|
] }),
|
|
6289
|
-
ResultDisplayContent && /* @__PURE__ */
|
|
6667
|
+
ResultDisplayContent && /* @__PURE__ */ jsxs26(Box22, { sx: { mt: 2 }, children: [
|
|
6290
6668
|
" ",
|
|
6291
6669
|
ResultDisplayContent
|
|
6292
6670
|
] }),
|
|
6293
|
-
executionLog.length > 0 && /* @__PURE__ */
|
|
6294
|
-
/* @__PURE__ */
|
|
6295
|
-
/* @__PURE__ */
|
|
6296
|
-
/* @__PURE__ */
|
|
6297
|
-
|
|
6671
|
+
executionLog.length > 0 && /* @__PURE__ */ jsxs26(Box22, { sx: { mt: 3 }, children: [
|
|
6672
|
+
/* @__PURE__ */ jsx35(Divider3, { sx: { mb: 2 } }),
|
|
6673
|
+
/* @__PURE__ */ jsx35(Typography18, { variant: "h6", gutterBottom: true, sx: { fontSize: "0.9rem" }, children: "Registro de Ejecuci\xF3n" }),
|
|
6674
|
+
/* @__PURE__ */ jsx35(
|
|
6675
|
+
Box22,
|
|
6298
6676
|
{
|
|
6299
6677
|
sx: {
|
|
6300
6678
|
bgcolor: "grey.100",
|
|
@@ -6307,7 +6685,7 @@ var ProcedureForm = () => {
|
|
|
6307
6685
|
fontSize: "0.75rem",
|
|
6308
6686
|
whiteSpace: "pre-wrap"
|
|
6309
6687
|
},
|
|
6310
|
-
children: executionLog.map((log, index) => /* @__PURE__ */
|
|
6688
|
+
children: executionLog.map((log, index) => /* @__PURE__ */ jsx35(
|
|
6311
6689
|
Typography18,
|
|
6312
6690
|
{
|
|
6313
6691
|
component: "pre",
|
|
@@ -6333,9 +6711,9 @@ import { Provider } from "react-redux";
|
|
|
6333
6711
|
import { PersistGate } from "redux-persist/integration/react";
|
|
6334
6712
|
|
|
6335
6713
|
// src/components/PrivateRoute.tsx
|
|
6336
|
-
import { useEffect as
|
|
6714
|
+
import { useEffect as useEffect13 } from "react";
|
|
6337
6715
|
import { Navigate as Navigate2, useLocation as useLocation4 } from "react-router-dom";
|
|
6338
|
-
import { Fragment as Fragment7, jsx as
|
|
6716
|
+
import { Fragment as Fragment7, jsx as jsx36 } from "react/jsx-runtime";
|
|
6339
6717
|
var PrivateRoute = ({ children }) => {
|
|
6340
6718
|
const location = useLocation4();
|
|
6341
6719
|
const dispatch = useAppDispatch();
|
|
@@ -6343,7 +6721,7 @@ var PrivateRoute = ({ children }) => {
|
|
|
6343
6721
|
const isAuthenticated = clientContextStatus === "succeeded";
|
|
6344
6722
|
const isLoadingAuth = clientContextStatus === "loading";
|
|
6345
6723
|
console.log(`[PrivateRoute] Render: Path=${location.pathname}, AuthStatus=${clientContextStatus}, IsAuthenticated=${isAuthenticated}, IsLoadingAuth=${isLoadingAuth}`);
|
|
6346
|
-
|
|
6724
|
+
useEffect13(() => {
|
|
6347
6725
|
console.log(`[PrivateRoute] Effect: Path=${location.pathname}, AuthStatus=${clientContextStatus}, IsAuthenticated=${isAuthenticated}, IsLoadingAuth=${isLoadingAuth}`);
|
|
6348
6726
|
if (!isAuthenticated && !isLoadingAuth && location.pathname !== "/login" && !huboCierreVoluntario()) {
|
|
6349
6727
|
const path = location.pathname + location.search + location.hash;
|
|
@@ -6359,19 +6737,19 @@ var PrivateRoute = ({ children }) => {
|
|
|
6359
6737
|
}, [isAuthenticated, isLoadingAuth, location, dispatch, clientContextStatus]);
|
|
6360
6738
|
if (isLoadingAuth) {
|
|
6361
6739
|
console.log(`[PrivateRoute] Returning loading state...`);
|
|
6362
|
-
return /* @__PURE__ */
|
|
6740
|
+
return /* @__PURE__ */ jsx36("p", { children: "Verificando autenticaci\xF3n..." });
|
|
6363
6741
|
}
|
|
6364
6742
|
if (!isAuthenticated) {
|
|
6365
6743
|
console.log(`[PrivateRoute] User not authenticated, navigating to /login`);
|
|
6366
|
-
return /* @__PURE__ */
|
|
6744
|
+
return /* @__PURE__ */ jsx36(Navigate2, { to: "/login", replace: true });
|
|
6367
6745
|
}
|
|
6368
6746
|
console.log(`[PrivateRoute] User authenticated, rendering children.`);
|
|
6369
|
-
return /* @__PURE__ */
|
|
6747
|
+
return /* @__PURE__ */ jsx36(Fragment7, { children });
|
|
6370
6748
|
};
|
|
6371
6749
|
var PrivateRoute_default = PrivateRoute;
|
|
6372
6750
|
|
|
6373
6751
|
// src/components/InitialRedirectHandler.tsx
|
|
6374
|
-
import { useEffect as
|
|
6752
|
+
import { useEffect as useEffect14, useRef as useRef11 } from "react";
|
|
6375
6753
|
import { useLocation as useLocation5, useNavigate as useNavigate5 } from "react-router-dom";
|
|
6376
6754
|
var InitialRedirectHandler = () => {
|
|
6377
6755
|
const location = useLocation5();
|
|
@@ -6381,14 +6759,14 @@ var InitialRedirectHandler = () => {
|
|
|
6381
6759
|
const clientContextStatus = useClientContextStatus();
|
|
6382
6760
|
const username = useAppSelector((state) => state.clientContext.username);
|
|
6383
6761
|
const redirectUsername = useAppSelector((state) => state.router.redirectUsername);
|
|
6384
|
-
|
|
6762
|
+
useEffect14(() => {
|
|
6385
6763
|
dispatch(setCurrentPath(location.pathname + location.search));
|
|
6386
6764
|
}, [location, dispatch]);
|
|
6387
|
-
const navegandoRef =
|
|
6388
|
-
|
|
6765
|
+
const navegandoRef = useRef11(false);
|
|
6766
|
+
useEffect14(() => {
|
|
6389
6767
|
navegandoRef.current = false;
|
|
6390
6768
|
}, [location.pathname]);
|
|
6391
|
-
|
|
6769
|
+
useEffect14(() => {
|
|
6392
6770
|
if (clientContextStatus === "succeeded") {
|
|
6393
6771
|
if (redirectPath && redirectPath !== "/login" && redirectUsername && redirectUsername !== username) {
|
|
6394
6772
|
dispatch(setRedirectPath(null));
|
|
@@ -6408,26 +6786,26 @@ var InitialRedirectHandler = () => {
|
|
|
6408
6786
|
var InitialRedirectHandler_default = InitialRedirectHandler;
|
|
6409
6787
|
|
|
6410
6788
|
// src/pages/GenericDataGridPage.tsx
|
|
6411
|
-
import
|
|
6412
|
-
import { useParams as
|
|
6413
|
-
import { Box as
|
|
6789
|
+
import React28, { useState as useState22, useCallback as useCallback16, useMemo as useMemo14 } from "react";
|
|
6790
|
+
import { useParams as useParams3, useLocation as useLocation6 } from "react-router-dom";
|
|
6791
|
+
import { Box as Box23, Alert as Alert6, Typography as Typography19, Tabs, Tab, IconButton as IconButton9 } from "@mui/material";
|
|
6414
6792
|
import CloseIcon2 from "@mui/icons-material/Close";
|
|
6415
|
-
import { jsx as
|
|
6793
|
+
import { jsx as jsx37, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6416
6794
|
var GenericDataGridPage = ({
|
|
6417
6795
|
initialTableName,
|
|
6418
6796
|
initialFixedFields = [],
|
|
6419
6797
|
parametros: parametrosRecibidos
|
|
6420
6798
|
}) => {
|
|
6421
|
-
const { tableName: urlTableName } =
|
|
6799
|
+
const { tableName: urlTableName } = useParams3();
|
|
6422
6800
|
const effectiveTableName = initialTableName || urlTableName;
|
|
6423
|
-
const [tabs, setTabs] =
|
|
6424
|
-
const [activeTabIdx, setActiveTabIdx] =
|
|
6801
|
+
const [tabs, setTabs] = useState22([]);
|
|
6802
|
+
const [activeTabIdx, setActiveTabIdx] = useState22(0);
|
|
6425
6803
|
const ffKey = JSON.stringify(initialFixedFields);
|
|
6426
6804
|
const location = useLocation6();
|
|
6427
6805
|
const parametros = useMemo14(() => parametrosRecibidos ?? parametrosDeTabla(void 0, location.search), [parametrosRecibidos, location.search]);
|
|
6428
6806
|
const fixedFieldsIniciales = initialFixedFields.length > 0 ? initialFixedFields : parametros.fixedFields ?? [];
|
|
6429
6807
|
const parametrosKey = JSON.stringify(parametros);
|
|
6430
|
-
|
|
6808
|
+
React28.useEffect(() => {
|
|
6431
6809
|
if (effectiveTableName) {
|
|
6432
6810
|
setTabs([{
|
|
6433
6811
|
id: `main-${effectiveTableName}-${ffKey}-${parametrosKey}`,
|
|
@@ -6463,26 +6841,26 @@ var GenericDataGridPage = ({
|
|
|
6463
6841
|
else if (activeTabIdx === index) setActiveTabIdx(index - 1);
|
|
6464
6842
|
};
|
|
6465
6843
|
if (!effectiveTableName) {
|
|
6466
|
-
return /* @__PURE__ */
|
|
6844
|
+
return /* @__PURE__ */ jsx37(Box23, { p: 3, children: /* @__PURE__ */ jsx37(Alert6, { severity: "error", children: "No se especific\xF3 una tabla." }) });
|
|
6467
6845
|
}
|
|
6468
|
-
return /* @__PURE__ */
|
|
6469
|
-
/* @__PURE__ */
|
|
6846
|
+
return /* @__PURE__ */ jsxs27(Box23, { sx: { width: "100%", height: "calc(100vh - 64px)", display: "flex", flexDirection: "column" }, children: [
|
|
6847
|
+
/* @__PURE__ */ jsx37(Box23, { sx: { borderBottom: 1, borderColor: "divider", bgcolor: "background.paper" }, children: /* @__PURE__ */ jsx37(Tabs, { value: activeTabIdx, onChange: (_, v) => setActiveTabIdx(v), variant: "scrollable", children: tabs.map((tab, index) => /* @__PURE__ */ jsx37(
|
|
6470
6848
|
Tab,
|
|
6471
6849
|
{
|
|
6472
|
-
label: /* @__PURE__ */
|
|
6473
|
-
/* @__PURE__ */
|
|
6474
|
-
index !== 0 && /* @__PURE__ */
|
|
6850
|
+
label: /* @__PURE__ */ jsxs27(Box23, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
6851
|
+
/* @__PURE__ */ jsx37(Typography19, { variant: "caption", sx: { fontWeight: "bold" }, children: tab.label }),
|
|
6852
|
+
index !== 0 && /* @__PURE__ */ jsx37(IconButton9, { size: "small", onClick: (e) => handleCloseTab(index, e), children: /* @__PURE__ */ jsx37(CloseIcon2, { fontSize: "inherit" }) })
|
|
6475
6853
|
] })
|
|
6476
6854
|
},
|
|
6477
6855
|
tab.id
|
|
6478
6856
|
)) }) }),
|
|
6479
|
-
tabs.map((tab, index) => /* @__PURE__ */
|
|
6480
|
-
|
|
6857
|
+
tabs.map((tab, index) => /* @__PURE__ */ jsx37(
|
|
6858
|
+
Box23,
|
|
6481
6859
|
{
|
|
6482
6860
|
role: "tabpanel",
|
|
6483
6861
|
hidden: activeTabIdx !== index,
|
|
6484
6862
|
sx: { flexGrow: 1, display: activeTabIdx === index ? "flex" : "none", flexDirection: "column", overflow: "hidden" },
|
|
6485
|
-
children: /* @__PURE__ */
|
|
6863
|
+
children: /* @__PURE__ */ jsx37(
|
|
6486
6864
|
GenericDataGrid_default,
|
|
6487
6865
|
{
|
|
6488
6866
|
tableName: tab.tableName,
|
|
@@ -6505,22 +6883,22 @@ var GenericDataGridPage_default = GenericDataGridPage;
|
|
|
6505
6883
|
// src/pages/PantallaDeRuta.tsx
|
|
6506
6884
|
import { useMemo as useMemo15 } from "react";
|
|
6507
6885
|
import { useSearchParams } from "react-router-dom";
|
|
6508
|
-
import { Box as
|
|
6509
|
-
import { jsx as
|
|
6886
|
+
import { Box as Box24 } from "@mui/material";
|
|
6887
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
6510
6888
|
var PantallaDeRuta = ({ screenName }) => {
|
|
6511
6889
|
const [busqueda] = useSearchParams();
|
|
6512
6890
|
const params = useMemo15(() => Object.fromEntries(busqueda.entries()), [busqueda]);
|
|
6513
6891
|
const Pantalla = wScreens[screenName];
|
|
6514
|
-
return /* @__PURE__ */
|
|
6892
|
+
return /* @__PURE__ */ jsx38(Box24, { sx: { pt: 3, pl: 4 }, children: Pantalla ? /* @__PURE__ */ jsx38(Pantalla, { screenName, params }) : /* @__PURE__ */ jsx38(FallbackWScreen, { screenName }) });
|
|
6515
6893
|
};
|
|
6516
6894
|
|
|
6517
6895
|
// src/pages/MenuTablePage.tsx
|
|
6518
6896
|
import { useMemo as useMemo16 } from "react";
|
|
6519
|
-
import { useLocation as useLocation7, useParams as
|
|
6520
|
-
import { Box as
|
|
6521
|
-
import { jsx as
|
|
6897
|
+
import { useLocation as useLocation7, useParams as useParams4 } from "react-router-dom";
|
|
6898
|
+
import { Box as Box25, Alert as Alert7, Typography as Typography20 } from "@mui/material";
|
|
6899
|
+
import { jsx as jsx39, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6522
6900
|
var MenuTablePage = () => {
|
|
6523
|
-
const { "*": menuName } =
|
|
6901
|
+
const { "*": menuName } = useParams4();
|
|
6524
6902
|
const { clientContext } = useApp();
|
|
6525
6903
|
const { search } = useLocation7();
|
|
6526
6904
|
const { currentTableName, currentFixedFields, parametros } = useMemo16(() => {
|
|
@@ -6544,12 +6922,12 @@ var MenuTablePage = () => {
|
|
|
6544
6922
|
};
|
|
6545
6923
|
}, [menuName, clientContext, search]);
|
|
6546
6924
|
if (!currentTableName) {
|
|
6547
|
-
return /* @__PURE__ */
|
|
6548
|
-
/* @__PURE__ */
|
|
6549
|
-
/* @__PURE__ */
|
|
6925
|
+
return /* @__PURE__ */ jsx39(Box25, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsxs28(Alert7, { severity: "error", children: [
|
|
6926
|
+
/* @__PURE__ */ jsx39(Typography20, { variant: "h6", children: "Error: No se pudo cargar la informaci\xF3n de la tabla." }),
|
|
6927
|
+
/* @__PURE__ */ jsx39(Typography20, { variant: "body1", children: "Verifique la configuraci\xF3n del men\xFA o el nombre de la tabla en la URL." })
|
|
6550
6928
|
] }) });
|
|
6551
6929
|
}
|
|
6552
|
-
return /* @__PURE__ */
|
|
6930
|
+
return /* @__PURE__ */ jsx39(
|
|
6553
6931
|
GenericDataGridPage_default,
|
|
6554
6932
|
{
|
|
6555
6933
|
initialTableName: currentTableName,
|
|
@@ -6561,170 +6939,9 @@ var MenuTablePage = () => {
|
|
|
6561
6939
|
var MenuTablePage_default = MenuTablePage;
|
|
6562
6940
|
|
|
6563
6941
|
// src/puente/PantallaBP.tsx
|
|
6564
|
-
import { useEffect as
|
|
6565
|
-
import { Navigate as Navigate3, useLocation as useLocation8, useParams as
|
|
6566
|
-
import { Alert as
|
|
6567
|
-
|
|
6568
|
-
// src/puente/clienteBP.ts
|
|
6569
|
-
function extraerRecursos(html) {
|
|
6570
|
-
const documento = new DOMParser().parseFromString(html, "text/html");
|
|
6571
|
-
const referencias2 = (selector, atributo) => Array.from(documento.querySelectorAll(selector)).map((elemento) => elemento.getAttribute(atributo)).filter((ruta) => !!ruta);
|
|
6572
|
-
return {
|
|
6573
|
-
hojasDeEstilo: referencias2("link[rel=stylesheet]", "href"),
|
|
6574
|
-
scripts: referencias2("script[src]", "src")
|
|
6575
|
-
};
|
|
6576
|
-
}
|
|
6577
|
-
function fijarBase(urlBackend) {
|
|
6578
|
-
const href = new URL(urlBackend.replace(/\/*$/, "/"), window.location.href).href;
|
|
6579
|
-
let base = document.querySelector("base");
|
|
6580
|
-
if (!base) {
|
|
6581
|
-
base = document.createElement("base");
|
|
6582
|
-
document.head.prepend(base);
|
|
6583
|
-
}
|
|
6584
|
-
base.href = href;
|
|
6585
|
-
}
|
|
6586
|
-
function cargarScript(ruta) {
|
|
6587
|
-
return new Promise((resolver, rechazar) => {
|
|
6588
|
-
const script = document.createElement("script");
|
|
6589
|
-
script.async = false;
|
|
6590
|
-
script.src = ruta;
|
|
6591
|
-
script.onload = () => resolver();
|
|
6592
|
-
script.onerror = () => rechazar(new Error(`No se pudo cargar ${ruta}`));
|
|
6593
|
-
document.head.appendChild(script);
|
|
6594
|
-
});
|
|
6595
|
-
}
|
|
6596
|
-
function esperarCargaDeVentana() {
|
|
6597
|
-
if (document.readyState === "complete") return Promise.resolve();
|
|
6598
|
-
return new Promise((resolver) => window.addEventListener("load", () => resolver(), { once: true }));
|
|
6599
|
-
}
|
|
6600
|
-
async function sinEscuchasDeVentana(tipos, inyectar) {
|
|
6601
|
-
const original = window.addEventListener;
|
|
6602
|
-
const filtrada = function(tipo, escucha, opciones) {
|
|
6603
|
-
if (tipos.includes(tipo)) return;
|
|
6604
|
-
original.call(this, tipo, escucha, opciones);
|
|
6605
|
-
};
|
|
6606
|
-
window.addEventListener = filtrada;
|
|
6607
|
-
try {
|
|
6608
|
-
return await inyectar();
|
|
6609
|
-
} finally {
|
|
6610
|
-
if (window.addEventListener === filtrada) window.addEventListener = original;
|
|
6611
|
-
}
|
|
6612
|
-
}
|
|
6613
|
-
async function cargarScripts(rutas) {
|
|
6614
|
-
for (const ruta of rutas) {
|
|
6615
|
-
await cargarScript(ruta);
|
|
6616
|
-
}
|
|
6617
|
-
}
|
|
6618
|
-
var carga = null;
|
|
6619
|
-
function cargarClienteBP(urlBackend) {
|
|
6620
|
-
if (!carga) {
|
|
6621
|
-
carga = cargarSinMemoria(urlBackend).catch((error) => {
|
|
6622
|
-
carga = null;
|
|
6623
|
-
throw error;
|
|
6624
|
-
});
|
|
6625
|
-
}
|
|
6626
|
-
return carga;
|
|
6627
|
-
}
|
|
6628
|
-
async function cargarSinMemoria(urlBackend) {
|
|
6629
|
-
const destino = new URL(urlBackend, window.location.href);
|
|
6630
|
-
if (destino.origin !== window.location.origin) {
|
|
6631
|
-
throw new Error(`El cliente de backend-plus solo se puede usar desde el mismo origen que el backend (${destino.origin} no es ${window.location.origin}).`);
|
|
6632
|
-
}
|
|
6633
|
-
fijarBase(urlBackend);
|
|
6634
|
-
const respuesta = await fetch(`${destino.pathname.replace(/\/*$/, "")}/menu`, { credentials: "include" });
|
|
6635
|
-
if (!respuesta.ok || /\/login\/?$/.test(new URL(respuesta.url).pathname)) {
|
|
6636
|
-
throw new Error("No hay una sesi\xF3n iniciada en el backend.");
|
|
6637
|
-
}
|
|
6638
|
-
const recursos = extraerRecursos(await respuesta.text());
|
|
6639
|
-
recursos.hojasDeEstilo.forEach((ruta) => {
|
|
6640
|
-
const enlace = document.createElement("link");
|
|
6641
|
-
enlace.rel = "stylesheet";
|
|
6642
|
-
enlace.href = ruta;
|
|
6643
|
-
document.head.appendChild(enlace);
|
|
6644
|
-
});
|
|
6645
|
-
await esperarCargaDeVentana();
|
|
6646
|
-
await sinEscuchasDeVentana(["popstate"], () => cargarScripts(recursos.scripts));
|
|
6647
|
-
const myOwn = window.myOwn;
|
|
6648
|
-
if (!myOwn) throw new Error("El backend no defini\xF3 myOwn.");
|
|
6649
|
-
window.my = myOwn;
|
|
6650
|
-
await myOwn.autoSetup();
|
|
6651
|
-
return myOwn;
|
|
6652
|
-
}
|
|
6653
|
-
|
|
6654
|
-
// src/puente/ConsolaBP.tsx
|
|
6655
|
-
import { useEffect as useEffect14 } from "react";
|
|
6656
|
-
import { Box as Box24 } from "@mui/material";
|
|
6657
|
-
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
6658
|
-
var MARGEN_DE_REPETIDO_MS = 1e3;
|
|
6659
|
-
function descartarRepetidos(consola, agregados, ahora) {
|
|
6660
|
-
for (const nodo of agregados) {
|
|
6661
|
-
if (!(nodo instanceof HTMLElement)) continue;
|
|
6662
|
-
const repetido = Array.from(consola.children).find(
|
|
6663
|
-
(otro) => otro instanceof HTMLElement && otro !== nodo && otro.className === nodo.className && otro.textContent === nodo.textContent && ahora - Number(otro.dataset.instante) < MARGEN_DE_REPETIDO_MS
|
|
6664
|
-
);
|
|
6665
|
-
if (repetido) nodo.remove();
|
|
6666
|
-
else nodo.dataset.instante = String(ahora);
|
|
6667
|
-
}
|
|
6668
|
-
}
|
|
6669
|
-
var ConsolaBP = () => {
|
|
6670
|
-
useEffect14(() => {
|
|
6671
|
-
const consola = document.getElementById("mini-console");
|
|
6672
|
-
if (!consola) return;
|
|
6673
|
-
const observador = new MutationObserver(
|
|
6674
|
-
(registros) => descartarRepetidos(consola, registros.flatMap((registro) => Array.from(registro.addedNodes)), Date.now())
|
|
6675
|
-
);
|
|
6676
|
-
observador.observe(consola, { childList: true });
|
|
6677
|
-
return () => observador.disconnect();
|
|
6678
|
-
}, []);
|
|
6679
|
-
return /* @__PURE__ */ jsx37(
|
|
6680
|
-
Box24,
|
|
6681
|
-
{
|
|
6682
|
-
id: "mini-console",
|
|
6683
|
-
sx: (tema) => ({
|
|
6684
|
-
"&#mini-console": {
|
|
6685
|
-
position: "fixed",
|
|
6686
|
-
top: { xs: 64, sm: 72 },
|
|
6687
|
-
left: "auto",
|
|
6688
|
-
right: 16,
|
|
6689
|
-
bottom: "auto",
|
|
6690
|
-
float: "none",
|
|
6691
|
-
zIndex: tema.zIndex.snackbar,
|
|
6692
|
-
width: "auto",
|
|
6693
|
-
minWidth: 0,
|
|
6694
|
-
maxWidth: "min(480px, calc(100vw - 32px))",
|
|
6695
|
-
minHeight: 0,
|
|
6696
|
-
maxHeight: "none",
|
|
6697
|
-
overflow: "visible",
|
|
6698
|
-
padding: 0,
|
|
6699
|
-
border: "none",
|
|
6700
|
-
borderRadius: 0,
|
|
6701
|
-
boxShadow: "none",
|
|
6702
|
-
backgroundColor: "transparent",
|
|
6703
|
-
fontSize: "inherit",
|
|
6704
|
-
display: "flex",
|
|
6705
|
-
flexDirection: "column",
|
|
6706
|
-
gap: 1
|
|
6707
|
-
},
|
|
6708
|
-
"&#mini-console:not(:empty)": { display: "flex" },
|
|
6709
|
-
"&#mini-console:empty": { display: "none" },
|
|
6710
|
-
"& > div": {
|
|
6711
|
-
p: "6px 12px",
|
|
6712
|
-
borderRadius: 1,
|
|
6713
|
-
boxShadow: tema.shadows[3],
|
|
6714
|
-
fontSize: "0.875rem",
|
|
6715
|
-
whiteSpace: "pre-wrap",
|
|
6716
|
-
overflowWrap: "anywhere",
|
|
6717
|
-
backgroundColor: tema.palette.grey[800],
|
|
6718
|
-
color: tema.palette.common.white
|
|
6719
|
-
},
|
|
6720
|
-
"& > .status-error": {
|
|
6721
|
-
backgroundColor: tema.palette.error.main,
|
|
6722
|
-
color: tema.palette.error.contrastText
|
|
6723
|
-
}
|
|
6724
|
-
})
|
|
6725
|
-
}
|
|
6726
|
-
);
|
|
6727
|
-
};
|
|
6942
|
+
import { useEffect as useEffect16, useRef as useRef12, useState as useState23 } from "react";
|
|
6943
|
+
import { Navigate as Navigate3, useLocation as useLocation8, useParams as useParams5 } from "react-router-dom";
|
|
6944
|
+
import { Alert as Alert8, Box as Box26, CircularProgress as CircularProgress9 } from "@mui/material";
|
|
6728
6945
|
|
|
6729
6946
|
// src/puente/pantallaDeBP.ts
|
|
6730
6947
|
var RUTA_PANTALLA_BP = "/bp/menu";
|
|
@@ -6744,6 +6961,12 @@ function rutaDeEnlaceBP(href, baseDelDocumento, urlBackend) {
|
|
|
6744
6961
|
const nombre = new URLSearchParams(texto).get("w");
|
|
6745
6962
|
return nombre ? rutaDePantallaBP(nombre, texto) : null;
|
|
6746
6963
|
}
|
|
6964
|
+
function rutaDeHashDeBP(href, baseDelDocumento) {
|
|
6965
|
+
const enlace = new URL(href, baseDelDocumento);
|
|
6966
|
+
if (enlace.origin !== new URL(baseDelDocumento).origin) return null;
|
|
6967
|
+
const nombre = new URLSearchParams(enlace.hash.slice(1)).get("w");
|
|
6968
|
+
return nombre ? rutaDePantallaBP(nombre, enlace.hash) : null;
|
|
6969
|
+
}
|
|
6747
6970
|
function resolverPantallaBP(myOwn, nombre, contenedor) {
|
|
6748
6971
|
const registrada = myOwn.wScreens[nombre];
|
|
6749
6972
|
if (!registrada) return null;
|
|
@@ -6766,7 +6989,7 @@ function resolverPantallaBP(myOwn, nombre, contenedor) {
|
|
|
6766
6989
|
}
|
|
6767
6990
|
|
|
6768
6991
|
// src/puente/PantallaBP.tsx
|
|
6769
|
-
import { jsx as
|
|
6992
|
+
import { jsx as jsx40, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6770
6993
|
function buscarItemDeMenu(items, tipo) {
|
|
6771
6994
|
for (const item of items) {
|
|
6772
6995
|
if (item.menuType === tipo) return item;
|
|
@@ -6779,12 +7002,12 @@ function buscarItemDeMenu(items, tipo) {
|
|
|
6779
7002
|
}
|
|
6780
7003
|
var PantallaBP = ({ nombre, direccion }) => {
|
|
6781
7004
|
const { clientContext } = useApp();
|
|
6782
|
-
const [cargando, setCargando] =
|
|
6783
|
-
const [error, setError] =
|
|
6784
|
-
const [noExiste, setNoExiste] =
|
|
6785
|
-
const contenedor =
|
|
7005
|
+
const [cargando, setCargando] = useState23(true);
|
|
7006
|
+
const [error, setError] = useState23(null);
|
|
7007
|
+
const [noExiste, setNoExiste] = useState23(false);
|
|
7008
|
+
const contenedor = useRef12(null);
|
|
6786
7009
|
const menu = clientContext.menu;
|
|
6787
|
-
|
|
7010
|
+
useEffect16(() => {
|
|
6788
7011
|
const elemento = contenedor.current;
|
|
6789
7012
|
if (!elemento) return;
|
|
6790
7013
|
let vigente = true;
|
|
@@ -6794,6 +7017,7 @@ var PantallaBP = ({ nombre, direccion }) => {
|
|
|
6794
7017
|
cargarClienteBP(envConfig.backendUrl).then((myOwn) => {
|
|
6795
7018
|
if (!vigente) return;
|
|
6796
7019
|
setCargando(false);
|
|
7020
|
+
copiarSkinAlContenedor(elemento);
|
|
6797
7021
|
const pantalla = resolverPantallaBP(myOwn, nombre, elemento);
|
|
6798
7022
|
if (!pantalla) {
|
|
6799
7023
|
setNoExiste(true);
|
|
@@ -6815,82 +7039,36 @@ var PantallaBP = ({ nombre, direccion }) => {
|
|
|
6815
7039
|
elemento.replaceChildren();
|
|
6816
7040
|
};
|
|
6817
7041
|
}, [nombre, direccion, menu]);
|
|
6818
|
-
if (noExiste) return /* @__PURE__ */
|
|
7042
|
+
if (noExiste) return /* @__PURE__ */ jsx40(FallbackWScreen, { screenName: nombre });
|
|
6819
7043
|
return (
|
|
6820
7044
|
// 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
|
|
6821
|
-
/* @__PURE__ */
|
|
6822
|
-
cargando && /* @__PURE__ */
|
|
6823
|
-
error && /* @__PURE__ */
|
|
6824
|
-
/* @__PURE__ */
|
|
6825
|
-
/* @__PURE__ */
|
|
7045
|
+
/* @__PURE__ */ jsxs29(Box26, { className: CLASE_CONTENEDOR_BP, sx: { position: "relative" }, children: [
|
|
7046
|
+
cargando && /* @__PURE__ */ jsx40(CircularProgress9, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
|
|
7047
|
+
error && /* @__PURE__ */ jsx40(Alert8, { severity: "error", sx: { m: 2 }, children: error }),
|
|
7048
|
+
/* @__PURE__ */ jsx40("div", { id: "main_layout", ref: contenedor }),
|
|
7049
|
+
/* @__PURE__ */ jsx40(ConsolaBP, {})
|
|
6826
7050
|
] })
|
|
6827
7051
|
);
|
|
6828
7052
|
};
|
|
6829
7053
|
var PantallaDeRespaldo = () => {
|
|
6830
|
-
const { screenName = "" } =
|
|
7054
|
+
const { screenName = "" } = useParams5();
|
|
6831
7055
|
const { search } = useLocation8();
|
|
6832
7056
|
if (!puenteBPHabilitado()) {
|
|
6833
|
-
return /* @__PURE__ */
|
|
7057
|
+
return /* @__PURE__ */ jsx40(Box26, { sx: { p: 3 }, children: /* @__PURE__ */ jsx40(FallbackWScreen, { screenName }) });
|
|
6834
7058
|
}
|
|
6835
|
-
return /* @__PURE__ */
|
|
7059
|
+
return /* @__PURE__ */ jsx40(Navigate3, { to: rutaDePantallaBP(screenName, search), replace: true });
|
|
6836
7060
|
};
|
|
6837
7061
|
var PaginaBP = () => {
|
|
6838
7062
|
const { hash, search } = useLocation8();
|
|
6839
7063
|
const direccion = hash || search;
|
|
6840
7064
|
const nombre = new URLSearchParams(direccion.replace(/^[#?]/, "")).get("w");
|
|
6841
|
-
if (!puenteBPHabilitado()) return /* @__PURE__ */
|
|
6842
|
-
if (!nombre) return /* @__PURE__ */
|
|
7065
|
+
if (!puenteBPHabilitado()) return /* @__PURE__ */ jsx40(Navigate3, { to: "/", replace: true });
|
|
7066
|
+
if (!nombre) return /* @__PURE__ */ jsx40(Box26, { sx: { p: 3 }, children: /* @__PURE__ */ jsxs29(Alert8, { severity: "warning", children: [
|
|
6843
7067
|
"Falta la pantalla de backend-plus (",
|
|
6844
|
-
/* @__PURE__ */
|
|
7068
|
+
/* @__PURE__ */ jsx40("code", { children: "#w=..." }),
|
|
6845
7069
|
")."
|
|
6846
7070
|
] }) });
|
|
6847
|
-
return /* @__PURE__ */
|
|
6848
|
-
};
|
|
6849
|
-
|
|
6850
|
-
// src/puente/GrillaBP.tsx
|
|
6851
|
-
import { useEffect as useEffect16, useRef as useRef12, useState as useState23 } from "react";
|
|
6852
|
-
import { useParams as useParams5 } from "react-router-dom";
|
|
6853
|
-
import { Alert as Alert8, Box as Box26, CircularProgress as CircularProgress9 } from "@mui/material";
|
|
6854
|
-
import { jsx as jsx39, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6855
|
-
var GrillaBP = ({ tabla, fixedFields }) => {
|
|
6856
|
-
const contenedor = useRef12(null);
|
|
6857
|
-
const [cargando, setCargando] = useState23(true);
|
|
6858
|
-
const [error, setError] = useState23(null);
|
|
6859
|
-
const clave = JSON.stringify(fixedFields ?? []);
|
|
6860
|
-
useEffect16(() => {
|
|
6861
|
-
const elemento = contenedor.current;
|
|
6862
|
-
if (!elemento) return;
|
|
6863
|
-
let vigente = true;
|
|
6864
|
-
setError(null);
|
|
6865
|
-
setCargando(true);
|
|
6866
|
-
cargarClienteBP(envConfig.backendUrl).then((myOwn) => {
|
|
6867
|
-
if (!vigente) return;
|
|
6868
|
-
setCargando(false);
|
|
6869
|
-
elemento.replaceChildren();
|
|
6870
|
-
myOwn.tableGrid(tabla, elemento, { fixedFields: JSON.parse(clave) });
|
|
6871
|
-
}).catch((err) => {
|
|
6872
|
-
if (!vigente) return;
|
|
6873
|
-
setCargando(false);
|
|
6874
|
-
setError(mensajeDeError(err));
|
|
6875
|
-
});
|
|
6876
|
-
return () => {
|
|
6877
|
-
vigente = false;
|
|
6878
|
-
elemento.replaceChildren();
|
|
6879
|
-
};
|
|
6880
|
-
}, [tabla, clave]);
|
|
6881
|
-
return (
|
|
6882
|
-
// 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
|
|
6883
|
-
/* @__PURE__ */ jsxs29(Box26, { sx: { position: "relative" }, children: [
|
|
6884
|
-
cargando && /* @__PURE__ */ jsx39(CircularProgress9, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
|
|
6885
|
-
error && /* @__PURE__ */ jsx39(Alert8, { severity: "error", sx: { m: 2 }, children: error }),
|
|
6886
|
-
/* @__PURE__ */ jsx39("div", { ref: contenedor }),
|
|
6887
|
-
/* @__PURE__ */ jsx39(ConsolaBP, {})
|
|
6888
|
-
] })
|
|
6889
|
-
);
|
|
6890
|
-
};
|
|
6891
|
-
var PaginaGrillaBP = () => {
|
|
6892
|
-
const { tableName = "" } = useParams5();
|
|
6893
|
-
return /* @__PURE__ */ jsx39(GrillaBP, { tabla: tableName }, tableName);
|
|
7071
|
+
return /* @__PURE__ */ jsx40(PantallaBP, { nombre, direccion }, nombre);
|
|
6894
7072
|
};
|
|
6895
7073
|
|
|
6896
7074
|
// src/puente/CapturaBP.tsx
|
|
@@ -6931,8 +7109,16 @@ function capturarNavegacionBP(urlBackend, navegar) {
|
|
|
6931
7109
|
reemplazarOriginal.call(history, estado, titulo, ruta === null ? url : rutaBase + ruta);
|
|
6932
7110
|
};
|
|
6933
7111
|
history.replaceState = reemplazar;
|
|
7112
|
+
const abrirOriginal = window.open;
|
|
7113
|
+
const abrir = (url, destino, caracteristicas) => {
|
|
7114
|
+
const direccion = url === void 0 || url === null ? null : String(url);
|
|
7115
|
+
const ruta = direccion === null ? null : rutaDeEnlaceBP(direccion, document.baseURI, urlBackend) ?? rutaDeHashDeBP(direccion, document.baseURI);
|
|
7116
|
+
return abrirOriginal.call(window, ruta === null ? url : window.location.origin + rutaBase + ruta, destino, caracteristicas);
|
|
7117
|
+
};
|
|
7118
|
+
window.open = abrir;
|
|
6934
7119
|
return () => {
|
|
6935
7120
|
if (history.replaceState === reemplazar) history.replaceState = reemplazarOriginal;
|
|
7121
|
+
if (window.open === abrir) window.open = abrirOriginal;
|
|
6936
7122
|
document.removeEventListener("click", alHacerClick, true);
|
|
6937
7123
|
navegacion?.removeEventListener("navigate", alNavegar);
|
|
6938
7124
|
};
|
|
@@ -6960,7 +7146,7 @@ function resultadoDeCambioDeClave(urlFinal, html) {
|
|
|
6960
7146
|
}
|
|
6961
7147
|
|
|
6962
7148
|
// src/pages/CambiarClavePage.tsx
|
|
6963
|
-
import { jsx as
|
|
7149
|
+
import { jsx as jsx41, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
6964
7150
|
var CambiarClavePage = () => {
|
|
6965
7151
|
const { clientContext, setIsLoggedIn, avisarCierreVoluntario } = useApp();
|
|
6966
7152
|
const dispatch = useDispatch5();
|
|
@@ -7001,10 +7187,10 @@ var CambiarClavePage = () => {
|
|
|
7001
7187
|
setEnviando(false);
|
|
7002
7188
|
}
|
|
7003
7189
|
};
|
|
7004
|
-
return /* @__PURE__ */
|
|
7005
|
-
/* @__PURE__ */
|
|
7006
|
-
/* @__PURE__ */
|
|
7007
|
-
/* @__PURE__ */
|
|
7190
|
+
return /* @__PURE__ */ jsx41(Box27, { sx: { p: 3, display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ jsxs30(Box27, { component: "form", onSubmit: enviar, sx: { width: "100%", maxWidth: 420 }, children: [
|
|
7191
|
+
/* @__PURE__ */ jsx41(Typography21, { variant: "h5", gutterBottom: true, children: "Cambiar contrase\xF1a" }),
|
|
7192
|
+
/* @__PURE__ */ jsx41(TextField5, { label: "Usuario", value: clientContext?.username ?? "", fullWidth: true, margin: "normal", disabled: true, autoComplete: "username" }),
|
|
7193
|
+
/* @__PURE__ */ jsx41(
|
|
7008
7194
|
TextField5,
|
|
7009
7195
|
{
|
|
7010
7196
|
label: "Contrase\xF1a actual",
|
|
@@ -7019,7 +7205,7 @@ var CambiarClavePage = () => {
|
|
|
7019
7205
|
disabled: enviando
|
|
7020
7206
|
}
|
|
7021
7207
|
),
|
|
7022
|
-
/* @__PURE__ */
|
|
7208
|
+
/* @__PURE__ */ jsx41(
|
|
7023
7209
|
TextField5,
|
|
7024
7210
|
{
|
|
7025
7211
|
label: "Contrase\xF1a nueva",
|
|
@@ -7033,7 +7219,7 @@ var CambiarClavePage = () => {
|
|
|
7033
7219
|
disabled: enviando
|
|
7034
7220
|
}
|
|
7035
7221
|
),
|
|
7036
|
-
/* @__PURE__ */
|
|
7222
|
+
/* @__PURE__ */ jsx41(
|
|
7037
7223
|
TextField5,
|
|
7038
7224
|
{
|
|
7039
7225
|
label: "Repetir contrase\xF1a nueva",
|
|
@@ -7047,19 +7233,19 @@ var CambiarClavePage = () => {
|
|
|
7047
7233
|
disabled: enviando
|
|
7048
7234
|
}
|
|
7049
7235
|
),
|
|
7050
|
-
error && /* @__PURE__ */
|
|
7236
|
+
error && /* @__PURE__ */ jsx41(Alert9, { severity: "error", sx: { mt: 1, whiteSpace: "pre-line" }, children: error }),
|
|
7051
7237
|
/* @__PURE__ */ jsxs30(Box27, { sx: { display: "flex", gap: 1, justifyContent: "flex-end", mt: 2 }, children: [
|
|
7052
|
-
/* @__PURE__ */
|
|
7053
|
-
/* @__PURE__ */
|
|
7238
|
+
/* @__PURE__ */ jsx41(Button12, { onClick: () => navigate(-1), disabled: enviando, children: "Cancelar" }),
|
|
7239
|
+
/* @__PURE__ */ jsx41(Button12, { type: "submit", variant: "contained", disabled: enviando, children: enviando ? /* @__PURE__ */ jsx41(CircularProgress10, { size: 20 }) : "Cambiar contrase\xF1a" })
|
|
7054
7240
|
] }),
|
|
7055
|
-
/* @__PURE__ */
|
|
7241
|
+
/* @__PURE__ */ jsx41(Typography21, { variant: "caption", color: "text.secondary", sx: { display: "block", mt: 2 }, children: "Al cambiarla se cierra la sesi\xF3n: hay que ingresar de nuevo con la clave nueva." })
|
|
7056
7242
|
] }) });
|
|
7057
7243
|
};
|
|
7058
7244
|
var CambiarClavePage_default = CambiarClavePage;
|
|
7059
7245
|
|
|
7060
7246
|
// src/App.tsx
|
|
7061
7247
|
import typeStore6 from "type-store";
|
|
7062
|
-
import { Fragment as Fragment8, jsx as
|
|
7248
|
+
import { Fragment as Fragment8, jsx as jsx42, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
7063
7249
|
var LocationTracker = () => {
|
|
7064
7250
|
const location = useLocation9();
|
|
7065
7251
|
const dispatch = useAppDispatch();
|
|
@@ -7070,45 +7256,45 @@ var LocationTracker = () => {
|
|
|
7070
7256
|
};
|
|
7071
7257
|
function FrontendPlusReactRoutes({ myRoutes, myUnloggedRoutes, layout: Layout = MainLayout_default, unloggedLayout: UnloggedLayout }) {
|
|
7072
7258
|
return /* @__PURE__ */ jsxs31(Fragment8, { children: [
|
|
7073
|
-
/* @__PURE__ */
|
|
7074
|
-
puenteBPHabilitado() && /* @__PURE__ */
|
|
7259
|
+
/* @__PURE__ */ jsx42(InitialRedirectHandler_default, {}),
|
|
7260
|
+
puenteBPHabilitado() && /* @__PURE__ */ jsx42(CapturaBP, {}),
|
|
7075
7261
|
/* @__PURE__ */ jsxs31(Routes, { children: [
|
|
7076
|
-
/* @__PURE__ */ jsxs31(Route, { element: UnloggedLayout ? /* @__PURE__ */
|
|
7077
|
-
/* @__PURE__ */
|
|
7078
|
-
/* @__PURE__ */
|
|
7262
|
+
/* @__PURE__ */ jsxs31(Route, { element: UnloggedLayout ? /* @__PURE__ */ jsx42(UnloggedLayout, {}) : /* @__PURE__ */ jsx42(Outlet2, {}), children: [
|
|
7263
|
+
/* @__PURE__ */ jsx42(Route, { path: "/login", element: /* @__PURE__ */ jsx42(LoginPage_default, {}) }),
|
|
7264
|
+
/* @__PURE__ */ jsx42(Route, { path: "/logout", element: /* @__PURE__ */ jsx42(LogoutPage_default, {}) }),
|
|
7079
7265
|
myUnloggedRoutes
|
|
7080
7266
|
] }),
|
|
7081
|
-
/* @__PURE__ */ jsxs31(Route, { element: /* @__PURE__ */
|
|
7082
|
-
/* @__PURE__ */
|
|
7083
|
-
/* @__PURE__ */
|
|
7084
|
-
/* @__PURE__ */
|
|
7085
|
-
/* @__PURE__ */
|
|
7086
|
-
/* @__PURE__ */
|
|
7087
|
-
Object.keys(wScreens).map((screenName) => /* @__PURE__ */
|
|
7267
|
+
/* @__PURE__ */ jsxs31(Route, { element: /* @__PURE__ */ jsx42(PrivateRoute_default, { children: /* @__PURE__ */ jsx42(Layout, {}) }), children: [
|
|
7268
|
+
/* @__PURE__ */ jsx42(Route, { path: "/", element: /* @__PURE__ */ jsx42(PantallaInicial_default, {}) }),
|
|
7269
|
+
/* @__PURE__ */ jsx42(Route, { path: "/table/:tableName", element: /* @__PURE__ */ jsx42(GenericDataGridPage_default, {}) }),
|
|
7270
|
+
/* @__PURE__ */ jsx42(Route, { path: "/menu/*", element: /* @__PURE__ */ jsx42(MenuTablePage_default, {}) }),
|
|
7271
|
+
/* @__PURE__ */ jsx42(Route, { path: "/procedures/:procedureName", element: /* @__PURE__ */ jsx42(ProcedureForm_default, {}) }),
|
|
7272
|
+
/* @__PURE__ */ jsx42(Route, { path: "/chpass", element: /* @__PURE__ */ jsx42(CambiarClavePage_default, {}) }),
|
|
7273
|
+
Object.keys(wScreens).map((screenName) => /* @__PURE__ */ jsx42(
|
|
7088
7274
|
Route,
|
|
7089
7275
|
{
|
|
7090
7276
|
path: `/wScreens/${screenName}`,
|
|
7091
|
-
element: /* @__PURE__ */
|
|
7277
|
+
element: /* @__PURE__ */ jsx42(PantallaDeRuta, { screenName })
|
|
7092
7278
|
},
|
|
7093
7279
|
screenName
|
|
7094
7280
|
)),
|
|
7095
|
-
/* @__PURE__ */
|
|
7096
|
-
puenteBPHabilitado() && /* @__PURE__ */
|
|
7097
|
-
puenteBPHabilitado() && /* @__PURE__ */
|
|
7281
|
+
/* @__PURE__ */ jsx42(Route, { path: "/wScreens-fallback/:screenName", element: /* @__PURE__ */ jsx42(PantallaDeRespaldo, {}) }),
|
|
7282
|
+
puenteBPHabilitado() && /* @__PURE__ */ jsx42(Route, { path: "/bp/menu", element: /* @__PURE__ */ jsx42(PaginaBP, {}) }),
|
|
7283
|
+
puenteBPHabilitado() && /* @__PURE__ */ jsx42(Route, { path: "/bp/table/:tableName", element: /* @__PURE__ */ jsx42(PaginaGrillaBP, {}) }),
|
|
7098
7284
|
myRoutes,
|
|
7099
|
-
/* @__PURE__ */
|
|
7285
|
+
/* @__PURE__ */ jsx42(Route, { path: "*", element: /* @__PURE__ */ jsx42("div", { style: { marginTop: "20px", marginLeft: "10px" }, children: "404 - Recurso No Encontrado" }) })
|
|
7100
7286
|
] }),
|
|
7101
|
-
/* @__PURE__ */
|
|
7287
|
+
/* @__PURE__ */ jsx42(Route, { path: "*", element: /* @__PURE__ */ jsx42(Navigate4, { to: "/", replace: true }) })
|
|
7102
7288
|
] })
|
|
7103
7289
|
] });
|
|
7104
7290
|
}
|
|
7105
7291
|
var FrontendPlusProviders = ({ children, publicPaths }) => {
|
|
7106
|
-
return /* @__PURE__ */
|
|
7107
|
-
/* @__PURE__ */
|
|
7292
|
+
return /* @__PURE__ */ jsx42(Provider, { store, children: /* @__PURE__ */ jsx42(PersistGate, { loading: null, persistor, children: /* @__PURE__ */ jsxs31(BrowserRouter, { basename: rutaBase, children: [
|
|
7293
|
+
/* @__PURE__ */ jsx42(LocationTracker, {}),
|
|
7108
7294
|
" ",
|
|
7109
|
-
/* @__PURE__ */
|
|
7295
|
+
/* @__PURE__ */ jsx42(AppProvider, { publicPaths, children: /* @__PURE__ */ jsxs31(SnackbarProvider, { children: [
|
|
7110
7296
|
children,
|
|
7111
|
-
/* @__PURE__ */
|
|
7297
|
+
/* @__PURE__ */ jsx42(SessionExpiredMessage_default, {})
|
|
7112
7298
|
] }) })
|
|
7113
7299
|
] }) }) });
|
|
7114
7300
|
};
|
|
@@ -7154,7 +7340,7 @@ var App = ({
|
|
|
7154
7340
|
const extracted = extractPathsFromRoutes(myUnloggedRoutes);
|
|
7155
7341
|
return ["/login", "/logout", ...extracted];
|
|
7156
7342
|
}, [myUnloggedRoutes]);
|
|
7157
|
-
return /* @__PURE__ */
|
|
7343
|
+
return /* @__PURE__ */ jsx42(FrontendPlusProviders, { publicPaths: safePaths, children: /* @__PURE__ */ jsx42(
|
|
7158
7344
|
FrontendPlusReactRoutes,
|
|
7159
7345
|
{
|
|
7160
7346
|
myRoutes,
|