frontend-plus-react 0.8.1 → 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 +3 -1
- package/dist/index.cjs +1150 -968
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1057 -875
- 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";
|
|
@@ -1585,6 +1585,112 @@ var textoParaVer = (valor) => {
|
|
|
1585
1585
|
return String(valor);
|
|
1586
1586
|
};
|
|
1587
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
|
+
|
|
1588
1694
|
// src/hooks/grid/useGridEvents.ts
|
|
1589
1695
|
var VIGENCIA_TECLA_PENDIENTE = 400;
|
|
1590
1696
|
var VIGENCIA_VALOR_PENDIENTE_F4 = 1e3;
|
|
@@ -1615,7 +1721,7 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1615
1721
|
const currentColumnIndex = currentColumns.findIndex((col) => col.key === columnKey);
|
|
1616
1722
|
const editableColumns = currentColumns.filter((col) => {
|
|
1617
1723
|
const fieldDefinition = tableDefinition2.fields.find((f) => f.name === col.key);
|
|
1618
|
-
return col.key !== "actionsColumn" && !(esColumnaPropia(col) && col.customType === "detail") && (fieldDefinition
|
|
1724
|
+
return col.key !== "actionsColumn" && !(esColumnaPropia(col) && col.customType === "detail") && campoEditableEnCelda(fieldDefinition);
|
|
1619
1725
|
});
|
|
1620
1726
|
const { key, target } = event;
|
|
1621
1727
|
const teclaAnterior = teclaAnteriorRef.current;
|
|
@@ -1746,7 +1852,7 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1746
1852
|
if (esFilaDetalle(args.row)) return;
|
|
1747
1853
|
const fieldDefinition = tableDefinition?.fields.find((f) => f.name === args.column.key);
|
|
1748
1854
|
const isFixedField = valorFijoDe(fixedFields, args.column.key) !== void 0;
|
|
1749
|
-
const isEditable = fieldDefinition
|
|
1855
|
+
const isEditable = campoEditableEnCelda(fieldDefinition) && !isFixedField;
|
|
1750
1856
|
if (isEditable) {
|
|
1751
1857
|
args.selectCell(true);
|
|
1752
1858
|
} else if (fieldDefinition && tipoDeExpander(fieldDefinition, false) !== null) {
|
|
@@ -1931,7 +2037,7 @@ import * as JSON4all2 from "json4all";
|
|
|
1931
2037
|
var cambiarGuionesBajosPorEspacios = (texto) => texto.replace(/_/g, " ");
|
|
1932
2038
|
|
|
1933
2039
|
// src/components/grid/renderers/headerCellRenderers.tsx
|
|
1934
|
-
import { Box as
|
|
2040
|
+
import { Box as Box5, IconButton as IconButton2, Tooltip as Tooltip3, Typography as Typography4 } from "@mui/material";
|
|
1935
2041
|
import SearchIcon from "@mui/icons-material/Search";
|
|
1936
2042
|
import SearchOffIcon from "@mui/icons-material/SearchOff";
|
|
1937
2043
|
import MoreVertIcon from "@mui/icons-material/MoreVert";
|
|
@@ -1989,7 +2095,7 @@ var VistaGrillaContext = createContext3({ isFilterRowVisible: false });
|
|
|
1989
2095
|
var useVistaGrilla = () => useContext3(VistaGrillaContext);
|
|
1990
2096
|
|
|
1991
2097
|
// src/components/grid/renderers/headerCellRenderers.tsx
|
|
1992
|
-
import { jsx as
|
|
2098
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1993
2099
|
var defaultColumnHeaderCellRenderer = (props, fieldDef, ocultarColumna) => {
|
|
1994
2100
|
const { column, sortDirection, priority } = props;
|
|
1995
2101
|
const isPrimaryKey = fieldDef.isPk;
|
|
@@ -2002,8 +2108,8 @@ var defaultColumnHeaderCellRenderer = (props, fieldDef, ocultarColumna) => {
|
|
|
2002
2108
|
return "#AAAAAA";
|
|
2003
2109
|
};
|
|
2004
2110
|
const sortColor = sorted ? getSortColor(sortIndex) : "transparent";
|
|
2005
|
-
return /* @__PURE__ */
|
|
2006
|
-
|
|
2111
|
+
return /* @__PURE__ */ jsxs6(
|
|
2112
|
+
Box5,
|
|
2007
2113
|
{
|
|
2008
2114
|
onClickCapture: (e) => {
|
|
2009
2115
|
if (!e.altKey || !ocultarColumna) return;
|
|
@@ -2020,8 +2126,8 @@ var defaultColumnHeaderCellRenderer = (props, fieldDef, ocultarColumna) => {
|
|
|
2020
2126
|
width: "100%"
|
|
2021
2127
|
},
|
|
2022
2128
|
children: [
|
|
2023
|
-
/* @__PURE__ */
|
|
2024
|
-
|
|
2129
|
+
/* @__PURE__ */ jsx9(
|
|
2130
|
+
Typography4,
|
|
2025
2131
|
{
|
|
2026
2132
|
variant: "body2",
|
|
2027
2133
|
sx: {
|
|
@@ -2038,7 +2144,7 @@ var defaultColumnHeaderCellRenderer = (props, fieldDef, ocultarColumna) => {
|
|
|
2038
2144
|
children: column.name
|
|
2039
2145
|
}
|
|
2040
2146
|
),
|
|
2041
|
-
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" })
|
|
2042
2148
|
]
|
|
2043
2149
|
}
|
|
2044
2150
|
);
|
|
@@ -2050,43 +2156,43 @@ var ActionsColumnHeaderCell = ({
|
|
|
2050
2156
|
allowInsert
|
|
2051
2157
|
}) => {
|
|
2052
2158
|
const { isFilterRowVisible } = useVistaGrilla();
|
|
2053
|
-
return /* @__PURE__ */
|
|
2054
|
-
allowInsert && /* @__PURE__ */
|
|
2159
|
+
return /* @__PURE__ */ jsxs6(Box5, { sx: { display: "flex", flexDirection: "row", alignItems: "center", justifyContent: "center", gap: 0.2 }, children: [
|
|
2160
|
+
allowInsert && /* @__PURE__ */ jsx9(
|
|
2055
2161
|
IconButton2,
|
|
2056
2162
|
{
|
|
2057
2163
|
onClick: () => handleAddRow(),
|
|
2058
2164
|
size: "small",
|
|
2059
2165
|
title: "A\xF1adir registro",
|
|
2060
2166
|
sx: { p: 0.25, color: "grey.800", "&:hover": { color: "success.main" } },
|
|
2061
|
-
children: /* @__PURE__ */
|
|
2167
|
+
children: /* @__PURE__ */ jsx9(AddIcon, { sx: { fontSize: 18 } })
|
|
2062
2168
|
}
|
|
2063
2169
|
),
|
|
2064
|
-
/* @__PURE__ */
|
|
2170
|
+
/* @__PURE__ */ jsx9(
|
|
2065
2171
|
IconButton2,
|
|
2066
2172
|
{
|
|
2067
2173
|
onClick: toggleFilterVisibility,
|
|
2068
2174
|
size: "small",
|
|
2069
2175
|
title: isFilterRowVisible ? "Ocultar filtros" : "Mostrar filtros",
|
|
2070
2176
|
sx: { p: 0.25, color: "grey.800" },
|
|
2071
|
-
children: isFilterRowVisible ? /* @__PURE__ */
|
|
2177
|
+
children: isFilterRowVisible ? /* @__PURE__ */ jsx9(SearchOffIcon, { sx: { fontSize: 18 } }) : /* @__PURE__ */ jsx9(SearchIcon, { sx: { fontSize: 18 } })
|
|
2072
2178
|
}
|
|
2073
2179
|
),
|
|
2074
|
-
/* @__PURE__ */
|
|
2180
|
+
/* @__PURE__ */ jsx9(
|
|
2075
2181
|
IconButton2,
|
|
2076
2182
|
{
|
|
2077
2183
|
onClick: (event) => handleDataGridOptions(event),
|
|
2078
2184
|
size: "small",
|
|
2079
2185
|
title: "Opciones de esta tabla",
|
|
2080
2186
|
sx: { p: 0.25, color: "grey.800" },
|
|
2081
|
-
children: /* @__PURE__ */
|
|
2187
|
+
children: /* @__PURE__ */ jsx9(MoreVertIcon, { sx: { fontSize: 20, variant: "filled", size: "small" } })
|
|
2082
2188
|
}
|
|
2083
2189
|
)
|
|
2084
2190
|
] });
|
|
2085
2191
|
};
|
|
2086
|
-
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() }) }) });
|
|
2087
2193
|
|
|
2088
2194
|
// src/components/grid/FilterInputRender.tsx
|
|
2089
|
-
import { InputBase as InputBase3, Box as
|
|
2195
|
+
import { InputBase as InputBase3, Box as Box6 } from "@mui/material";
|
|
2090
2196
|
import React10 from "react";
|
|
2091
2197
|
|
|
2092
2198
|
// src/components/forms/TypedField.tsx
|
|
@@ -2113,8 +2219,8 @@ import SearchIcon2 from "@mui/icons-material/Search";
|
|
|
2113
2219
|
|
|
2114
2220
|
// src/components/grid/MenuDeOpciones.tsx
|
|
2115
2221
|
import { useEffect as useEffect3, useMemo as useMemo5, useRef as useRef4, useState as useState7 } from "react";
|
|
2116
|
-
import { InputBase, List as List2, ListItemButton as ListItemButton2, Popover as Popover2, Typography as
|
|
2117
|
-
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";
|
|
2118
2224
|
function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar }) {
|
|
2119
2225
|
const [busqueda, setBusqueda] = useState7(busquedaInicial);
|
|
2120
2226
|
const [indice, setIndice] = useState7(0);
|
|
@@ -2138,7 +2244,7 @@ function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar
|
|
|
2138
2244
|
evento.preventDefault();
|
|
2139
2245
|
evento.stopPropagation();
|
|
2140
2246
|
};
|
|
2141
|
-
return /* @__PURE__ */
|
|
2247
|
+
return /* @__PURE__ */ jsxs7(
|
|
2142
2248
|
Popover2,
|
|
2143
2249
|
{
|
|
2144
2250
|
open: true,
|
|
@@ -2148,7 +2254,7 @@ function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar
|
|
|
2148
2254
|
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
2149
2255
|
slotProps: { paper: { sx: { minWidth: 300, maxWidth: 520 } } },
|
|
2150
2256
|
children: [
|
|
2151
|
-
/* @__PURE__ */
|
|
2257
|
+
/* @__PURE__ */ jsx10(
|
|
2152
2258
|
InputBase,
|
|
2153
2259
|
{
|
|
2154
2260
|
autoFocus: true,
|
|
@@ -2164,9 +2270,9 @@ function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar
|
|
|
2164
2270
|
inputProps: { "aria-label": "buscar" }
|
|
2165
2271
|
}
|
|
2166
2272
|
),
|
|
2167
|
-
/* @__PURE__ */
|
|
2168
|
-
visibles.length === 0 && /* @__PURE__ */
|
|
2169
|
-
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(
|
|
2170
2276
|
ListItemButton2,
|
|
2171
2277
|
{
|
|
2172
2278
|
ref: i === indice ? elegida : null,
|
|
@@ -2174,7 +2280,7 @@ function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar
|
|
|
2174
2280
|
role: "option",
|
|
2175
2281
|
onClick: () => onElegir(opcion.valor),
|
|
2176
2282
|
sx: { gap: 2, py: 0.25, fontSize: "0.8rem" },
|
|
2177
|
-
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))
|
|
2178
2284
|
},
|
|
2179
2285
|
i
|
|
2180
2286
|
))
|
|
@@ -2186,8 +2292,8 @@ function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar
|
|
|
2186
2292
|
|
|
2187
2293
|
// src/components/grid/SelectorDeFecha.tsx
|
|
2188
2294
|
import { useState as useState8 } from "react";
|
|
2189
|
-
import { Button as Button2, IconButton as IconButton3, Popover as Popover3, Typography as
|
|
2190
|
-
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";
|
|
2191
2297
|
var MESES = ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"];
|
|
2192
2298
|
var DIAS = ["lu", "ma", "mi", "ju", "vi", "s\xE1", "do"];
|
|
2193
2299
|
var mismaFecha = (a, b) => b !== null && a.anio === b.anio && a.mes === b.mes && a.dia === b.dia;
|
|
@@ -2220,22 +2326,22 @@ function SelectorDeFecha({ anclaje, fechaActual, admiteNulo, onElegir, onCerrar
|
|
|
2220
2326
|
evento.preventDefault();
|
|
2221
2327
|
evento.stopPropagation();
|
|
2222
2328
|
};
|
|
2223
|
-
return /* @__PURE__ */
|
|
2224
|
-
/* @__PURE__ */
|
|
2225
|
-
/* @__PURE__ */
|
|
2226
|
-
/* @__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: [
|
|
2227
2333
|
MESES[cursor.mes],
|
|
2228
2334
|
" ",
|
|
2229
2335
|
cursor.anio
|
|
2230
2336
|
] }),
|
|
2231
|
-
/* @__PURE__ */
|
|
2337
|
+
/* @__PURE__ */ jsx11(IconButton3, { size: "small", "aria-label": "mes siguiente", onClick: () => mover(0, 1), children: "\u203A" })
|
|
2232
2338
|
] }),
|
|
2233
|
-
/* @__PURE__ */
|
|
2234
|
-
/* @__PURE__ */
|
|
2235
|
-
/* @__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) => {
|
|
2236
2342
|
const elegido = mismaFecha(dia, fechaActual);
|
|
2237
2343
|
const enCursor = mismaFecha(dia, cursor);
|
|
2238
|
-
return /* @__PURE__ */
|
|
2344
|
+
return /* @__PURE__ */ jsx11("td", { style: { padding: 1 }, children: /* @__PURE__ */ jsx11(
|
|
2239
2345
|
"button",
|
|
2240
2346
|
{
|
|
2241
2347
|
type: "button",
|
|
@@ -2255,9 +2361,9 @@ function SelectorDeFecha({ anclaje, fechaActual, admiteNulo, onElegir, onCerrar
|
|
|
2255
2361
|
) }, `${dia.mes}-${dia.dia}`);
|
|
2256
2362
|
}) }, i)) })
|
|
2257
2363
|
] }),
|
|
2258
|
-
/* @__PURE__ */
|
|
2259
|
-
/* @__PURE__ */
|
|
2260
|
-
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" })
|
|
2261
2367
|
] })
|
|
2262
2368
|
] }) });
|
|
2263
2369
|
}
|
|
@@ -2265,7 +2371,7 @@ function SelectorDeFecha({ anclaje, fechaActual, admiteNulo, onElegir, onCerrar
|
|
|
2265
2371
|
// src/components/grid/VentanaDeTexto.tsx
|
|
2266
2372
|
import { useState as useState9 } from "react";
|
|
2267
2373
|
import { Button as Button3, InputBase as InputBase2, Popover as Popover4 } from "@mui/material";
|
|
2268
|
-
import { jsx as
|
|
2374
|
+
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2269
2375
|
function VentanaDeTexto({ anclaje, texto, editable, onAceptar, onCerrar }) {
|
|
2270
2376
|
const [valor, setValor] = useState9(texto);
|
|
2271
2377
|
const alApretar = (evento) => {
|
|
@@ -2279,8 +2385,8 @@ function VentanaDeTexto({ anclaje, texto, editable, onAceptar, onCerrar }) {
|
|
|
2279
2385
|
evento.preventDefault();
|
|
2280
2386
|
evento.stopPropagation();
|
|
2281
2387
|
};
|
|
2282
|
-
return /* @__PURE__ */
|
|
2283
|
-
/* @__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(
|
|
2284
2390
|
InputBase2,
|
|
2285
2391
|
{
|
|
2286
2392
|
autoFocus: true,
|
|
@@ -2296,15 +2402,15 @@ function VentanaDeTexto({ anclaje, texto, editable, onAceptar, onCerrar }) {
|
|
|
2296
2402
|
inputProps: { "aria-label": "contenido de la celda" }
|
|
2297
2403
|
}
|
|
2298
2404
|
),
|
|
2299
|
-
editable && /* @__PURE__ */
|
|
2300
|
-
/* @__PURE__ */
|
|
2301
|
-
/* @__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" })
|
|
2302
2408
|
] })
|
|
2303
2409
|
] }) });
|
|
2304
2410
|
}
|
|
2305
2411
|
|
|
2306
2412
|
// src/hooks/grid/useExpander.tsx
|
|
2307
|
-
import { jsx as
|
|
2413
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
2308
2414
|
var useExpander = ({ campo, editable, fila, admiteNulo, tipos, anclaje, textoActual, valorActual, alElegirValor, alConfirmarTexto, alFallar }) => {
|
|
2309
2415
|
const [expansion, setExpansion] = useState10(null);
|
|
2310
2416
|
const abierto = React8.useRef(false);
|
|
@@ -2350,7 +2456,7 @@ var useExpander = ({ campo, editable, fila, admiteNulo, tipos, anclaje, textoAct
|
|
|
2350
2456
|
return true;
|
|
2351
2457
|
}, [tipo, abrir]);
|
|
2352
2458
|
const titulo = tipo === "fecha" ? "elegir fecha (F9)" : tipo === "texto" ? "ver el contenido completo (F9)" : "elegir un valor (F9)";
|
|
2353
|
-
const lupa = tipo === null ? null : /* @__PURE__ */
|
|
2459
|
+
const lupa = tipo === null ? null : /* @__PURE__ */ jsx13(
|
|
2354
2460
|
IconButton4,
|
|
2355
2461
|
{
|
|
2356
2462
|
size: "small",
|
|
@@ -2363,16 +2469,16 @@ var useExpander = ({ campo, editable, fila, admiteNulo, tipos, anclaje, textoAct
|
|
|
2363
2469
|
void abrir("");
|
|
2364
2470
|
},
|
|
2365
2471
|
sx: { p: 0, ml: 0.25, color: "primary.main", "&:hover": { backgroundColor: "action.hover" } },
|
|
2366
|
-
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 } })
|
|
2367
2473
|
}
|
|
2368
2474
|
);
|
|
2369
2475
|
const base = anclaje.current;
|
|
2370
|
-
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 });
|
|
2371
2477
|
return { tipo, abierto, abrir, manejarTecla, lupa, ventana };
|
|
2372
2478
|
};
|
|
2373
2479
|
|
|
2374
2480
|
// src/components/forms/TypedField.tsx
|
|
2375
|
-
import { Fragment as Fragment3, jsx as
|
|
2481
|
+
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2376
2482
|
var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode = false, feedback, isMandatory = false }) => {
|
|
2377
2483
|
const theme = useTheme();
|
|
2378
2484
|
const typer = useMemo6(() => typeStore3.typerFrom(fieldDef), [fieldDef]);
|
|
@@ -2500,28 +2606,28 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2500
2606
|
}
|
|
2501
2607
|
const cellBackgroundColor2 = feedback === "error" ? theme.palette.error.light : feedback === "success" ? theme.palette.success.light : defaultBgColor;
|
|
2502
2608
|
const transitionStyle2 = "background-color 0.3s ease-in-out";
|
|
2503
|
-
return /* @__PURE__ */
|
|
2504
|
-
!isFilterMode && /* @__PURE__ */
|
|
2505
|
-
/* @__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(
|
|
2506
2612
|
Select,
|
|
2507
2613
|
{
|
|
2508
2614
|
value: boolVal,
|
|
2509
2615
|
label: !isFilterMode ? fieldDef.name : void 0,
|
|
2510
2616
|
onChange: handleBooleanChange,
|
|
2511
|
-
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,
|
|
2512
2618
|
displayEmpty: true,
|
|
2513
2619
|
sx: isFilterMode ? { height: 25, fontSize: "0.8rem", backgroundColor: "background.paper" } : {
|
|
2514
2620
|
backgroundColor: cellBackgroundColor2,
|
|
2515
2621
|
transition: transitionStyle2
|
|
2516
2622
|
},
|
|
2517
2623
|
children: [
|
|
2518
|
-
fieldDef.nullable !== false && /* @__PURE__ */
|
|
2519
|
-
/* @__PURE__ */
|
|
2520
|
-
/* @__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)" })
|
|
2521
2627
|
]
|
|
2522
2628
|
}
|
|
2523
2629
|
),
|
|
2524
|
-
errorMsg && !isFilterMode && /* @__PURE__ */
|
|
2630
|
+
errorMsg && !isFilterMode && /* @__PURE__ */ jsx14(FormHelperText, { children: errorMsg })
|
|
2525
2631
|
] });
|
|
2526
2632
|
}
|
|
2527
2633
|
let inputType = "text";
|
|
@@ -2535,8 +2641,8 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2535
2641
|
}
|
|
2536
2642
|
const cellBackgroundColor = feedback === "error" ? theme.palette.error.light : feedback === "success" ? theme.palette.success.light : defaultTextBgColor;
|
|
2537
2643
|
const transitionStyle = "background-color 0.3s ease-in-out";
|
|
2538
|
-
return /* @__PURE__ */
|
|
2539
|
-
/* @__PURE__ */
|
|
2644
|
+
return /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
2645
|
+
/* @__PURE__ */ jsx14(
|
|
2540
2646
|
TextField,
|
|
2541
2647
|
{
|
|
2542
2648
|
fullWidth: true,
|
|
@@ -2556,7 +2662,7 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2556
2662
|
// la lupa solo al enfocar el filtro, como en backend-plus
|
|
2557
2663
|
endAdornment: enfocado || expander.abierto.current ? expander.lupa : void 0
|
|
2558
2664
|
} : isMandatory && isEmptyText ? {
|
|
2559
|
-
startAdornment: /* @__PURE__ */
|
|
2665
|
+
startAdornment: /* @__PURE__ */ jsx14(InputAdornment, { position: "start", sx: { color: "text.secondary", mr: 0.5 }, children: "*" })
|
|
2560
2666
|
} : {},
|
|
2561
2667
|
inputProps: {
|
|
2562
2668
|
style: {
|
|
@@ -2596,7 +2702,7 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2596
2702
|
};
|
|
2597
2703
|
|
|
2598
2704
|
// src/components/grid/FilterInputRender.tsx
|
|
2599
|
-
import { jsx as
|
|
2705
|
+
import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2600
2706
|
function FilterInputRenderer({
|
|
2601
2707
|
columnKey,
|
|
2602
2708
|
currentFilter,
|
|
@@ -2621,8 +2727,8 @@ function FilterInputRenderer({
|
|
|
2621
2727
|
};
|
|
2622
2728
|
return (
|
|
2623
2729
|
// como en backend-plus, el operador es un símbolo chico y el campo se queda con el resto del ancho
|
|
2624
|
-
/* @__PURE__ */
|
|
2625
|
-
/* @__PURE__ */
|
|
2730
|
+
/* @__PURE__ */ jsxs11(Box6, { sx: { mt: 0, display: "flex", alignItems: "center", gap: "2px", width: "100%" }, children: [
|
|
2731
|
+
/* @__PURE__ */ jsx15(
|
|
2626
2732
|
"select",
|
|
2627
2733
|
{
|
|
2628
2734
|
value: operator,
|
|
@@ -2641,10 +2747,10 @@ function FilterInputRenderer({
|
|
|
2641
2747
|
textAlignLast: "center",
|
|
2642
2748
|
cursor: "pointer"
|
|
2643
2749
|
},
|
|
2644
|
-
children: filterOperators.map((op) => /* @__PURE__ */
|
|
2750
|
+
children: filterOperators.map((op) => /* @__PURE__ */ jsx15("option", { value: op.value, children: op.label }, op.value))
|
|
2645
2751
|
}
|
|
2646
2752
|
),
|
|
2647
|
-
/* @__PURE__ */
|
|
2753
|
+
/* @__PURE__ */ jsx15(
|
|
2648
2754
|
TypedField,
|
|
2649
2755
|
{
|
|
2650
2756
|
fieldDef,
|
|
@@ -2656,7 +2762,7 @@ function FilterInputRenderer({
|
|
|
2656
2762
|
] })
|
|
2657
2763
|
);
|
|
2658
2764
|
}
|
|
2659
|
-
return /* @__PURE__ */
|
|
2765
|
+
return /* @__PURE__ */ jsx15(
|
|
2660
2766
|
InputBase3,
|
|
2661
2767
|
{
|
|
2662
2768
|
value: currentFilter || "",
|
|
@@ -2682,15 +2788,15 @@ function FilterInputRenderer({
|
|
|
2682
2788
|
var FilterInputRender_default = React10.memo(FilterInputRenderer);
|
|
2683
2789
|
|
|
2684
2790
|
// src/components/grid/renderers/summaryCellRenderers.tsx
|
|
2685
|
-
import { Box as
|
|
2686
|
-
import { jsx as
|
|
2791
|
+
import { Box as Box7 } from "@mui/material";
|
|
2792
|
+
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2687
2793
|
var defaultColumnSummaryCellRenderer = (props, fixedFields) => {
|
|
2688
2794
|
const { column, row } = props;
|
|
2689
2795
|
if (row.id === "filterRow") {
|
|
2690
2796
|
const { filters, setFilters } = row;
|
|
2691
2797
|
if (valorFijoDe(fixedFields, column.key)) return null;
|
|
2692
2798
|
const fieldDef = esColumnaPropia(column) && column.customType === "default" ? column.fieldDef : void 0;
|
|
2693
|
-
return /* @__PURE__ */
|
|
2799
|
+
return /* @__PURE__ */ jsx16(Box7, { sx: { position: "absolute", inset: 0, display: "flex", alignItems: "center", px: "2px" }, children: /* @__PURE__ */ jsx16(
|
|
2694
2800
|
FilterInputRender_default,
|
|
2695
2801
|
{
|
|
2696
2802
|
columnKey: column.key,
|
|
@@ -2732,7 +2838,7 @@ var defaultColumnSummaryCellRenderer = (props, fixedFields) => {
|
|
|
2732
2838
|
label = "Cant S\xED: ";
|
|
2733
2839
|
break;
|
|
2734
2840
|
}
|
|
2735
|
-
return /* @__PURE__ */
|
|
2841
|
+
return /* @__PURE__ */ jsxs12(Box7, { sx: {
|
|
2736
2842
|
px: 0,
|
|
2737
2843
|
fontWeight: "bold",
|
|
2738
2844
|
fontSize: "0.875rem",
|
|
@@ -2755,80 +2861,7 @@ import { Box as Box8, IconButton as IconButton5, Tooltip as Tooltip4, useTheme a
|
|
|
2755
2861
|
import ViewHeadlineIcon from "@mui/icons-material/ViewHeadline";
|
|
2756
2862
|
import DeleteIcon from "@mui/icons-material/Delete";
|
|
2757
2863
|
import AddIcon2 from "@mui/icons-material/Add";
|
|
2758
|
-
|
|
2759
|
-
// src/components/grid/ExampleClientSideComponent.tsx
|
|
2760
|
-
import { Box as Box6, Typography as Typography5 } from "@mui/material";
|
|
2761
|
-
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
2762
|
-
var ExampleClientSideComponent = ({ row, column, fieldDefinition }) => {
|
|
2763
|
-
const value = row[column.key];
|
|
2764
|
-
return /* @__PURE__ */ jsx14(Box6, { sx: {
|
|
2765
|
-
padding: 0.5,
|
|
2766
|
-
width: "100%",
|
|
2767
|
-
height: "100%",
|
|
2768
|
-
display: "flex",
|
|
2769
|
-
alignItems: "center",
|
|
2770
|
-
backgroundColor: value === "Special" ? "lightblue" : "transparent"
|
|
2771
|
-
}, children: /* @__PURE__ */ jsx14(Typography5, { variant: "body2", sx: { fontWeight: "bold" }, children: value ? `CS: ${value}` : "N/A" }) });
|
|
2772
|
-
};
|
|
2773
|
-
var ExampleClientSideComponent_default = ExampleClientSideComponent;
|
|
2774
|
-
|
|
2775
|
-
// src/components/grid/FallbackClientSideRenderer.tsx
|
|
2776
|
-
import { Box as Box7, Typography as Typography6, Tooltip as Tooltip3 } from "@mui/material";
|
|
2777
|
-
import WarningAmberIcon2 from "@mui/icons-material/WarningAmber";
|
|
2778
|
-
import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2779
|
-
var FallbackClientSideRenderer = ({ column, row, fieldDefinition }) => {
|
|
2780
|
-
const clientSideName = fieldDefinition?.clientSide || "Desconocido";
|
|
2781
|
-
return /* @__PURE__ */ jsx15(Tooltip3, { title: `Componente clientSide '${clientSideName}' no implementado. Mostrando valor por defecto.`, children: /* @__PURE__ */ jsxs12(
|
|
2782
|
-
Box7,
|
|
2783
|
-
{
|
|
2784
|
-
sx: {
|
|
2785
|
-
display: "flex",
|
|
2786
|
-
alignItems: "center",
|
|
2787
|
-
justifyContent: "space-between",
|
|
2788
|
-
// Para espaciar el valor y el icono
|
|
2789
|
-
gap: 1,
|
|
2790
|
-
// Espacio entre elementos
|
|
2791
|
-
width: "100%",
|
|
2792
|
-
height: "100%",
|
|
2793
|
-
paddingLeft: "8px",
|
|
2794
|
-
backgroundColor: "rgba(255, 193, 7, 0.1)",
|
|
2795
|
-
// Amarillo claro para advertencia
|
|
2796
|
-
border: "1px dashed rgba(255, 193, 7, 0.5)",
|
|
2797
|
-
boxSizing: "border-box",
|
|
2798
|
-
overflow: "hidden"
|
|
2799
|
-
// Evita que el contenido se desborde
|
|
2800
|
-
},
|
|
2801
|
-
children: [
|
|
2802
|
-
/* @__PURE__ */ jsx15(Typography6, { variant: "body2", noWrap: true, sx: { flexGrow: 1 }, children: clientSideName + " not found" }),
|
|
2803
|
-
/* @__PURE__ */ jsx15(
|
|
2804
|
-
WarningAmberIcon2,
|
|
2805
|
-
{
|
|
2806
|
-
sx: {
|
|
2807
|
-
fontSize: 18,
|
|
2808
|
-
color: "warning.main",
|
|
2809
|
-
marginRight: "4px"
|
|
2810
|
-
// Pequeño margen a la derecha del icono
|
|
2811
|
-
}
|
|
2812
|
-
}
|
|
2813
|
-
)
|
|
2814
|
-
]
|
|
2815
|
-
}
|
|
2816
|
-
) });
|
|
2817
|
-
};
|
|
2818
|
-
var FallbackClientSideRenderer_default = FallbackClientSideRenderer;
|
|
2819
|
-
|
|
2820
|
-
// src/components/grid/clientSides.ts
|
|
2821
|
-
var clientSides = {
|
|
2822
|
-
"ExampleClientSideComponent": ExampleClientSideComponent_default,
|
|
2823
|
-
"FallbackClientSideRenderer": FallbackClientSideRenderer_default
|
|
2824
|
-
};
|
|
2825
|
-
var extendClientSides = (newRenderers) => {
|
|
2826
|
-
clientSides = { ...clientSides, ...newRenderers };
|
|
2827
|
-
console.log("clientSides extendidos:", clientSides);
|
|
2828
|
-
};
|
|
2829
|
-
|
|
2830
|
-
// src/components/grid/renderers/cellRenderers.tsx
|
|
2831
|
-
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
2864
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
2832
2865
|
var CeldaDato = React11.memo(function CeldaDato2({ row, columnKey, defaultColumn }) {
|
|
2833
2866
|
const theme = useTheme2();
|
|
2834
2867
|
const { primaryKey, fixedFields, typer, isMandatory, isNumeric } = defaultColumn;
|
|
@@ -2850,7 +2883,7 @@ var CeldaDato = React11.memo(function CeldaDato2({ row, columnKey, defaultColumn
|
|
|
2850
2883
|
displayValue = "* " + displayValue;
|
|
2851
2884
|
}
|
|
2852
2885
|
const signal = displayValue === "--" ? "typed-controls-signal-no-data" : displayValue === "//" ? "typed-controls-signal-unknown-data" : "";
|
|
2853
|
-
const celda = /* @__PURE__ */
|
|
2886
|
+
const celda = /* @__PURE__ */ jsx17(
|
|
2854
2887
|
"div",
|
|
2855
2888
|
{
|
|
2856
2889
|
className: `fpr-celda ${isNumeric ? "fpr-celda-numerica" : ""} ${signal} ${row[NEW_ROW_INDICATOR] ? "new-row-cell-animation" : ""}`,
|
|
@@ -2858,30 +2891,30 @@ var CeldaDato = React11.memo(function CeldaDato2({ row, columnKey, defaultColumn
|
|
|
2858
2891
|
children: displayValue
|
|
2859
2892
|
}
|
|
2860
2893
|
);
|
|
2861
|
-
return currentCellFeedback?.message ? /* @__PURE__ */
|
|
2894
|
+
return currentCellFeedback?.message ? /* @__PURE__ */ jsx17(Tooltip4, { title: currentCellFeedback.message, children: celda }) : celda;
|
|
2862
2895
|
});
|
|
2863
2896
|
var allColumnsCellRenderer = (props) => {
|
|
2864
2897
|
const { row, column } = props;
|
|
2865
2898
|
if (!esColumnaPropia(column)) return void 0;
|
|
2866
2899
|
if (esFilaDetalle(row)) {
|
|
2867
|
-
return column.customType === "action" ? /* @__PURE__ */
|
|
2900
|
+
return column.customType === "action" ? /* @__PURE__ */ jsx17(CeldaDetalle, { fila: row }) : null;
|
|
2868
2901
|
}
|
|
2869
2902
|
switch (column.customType) {
|
|
2870
2903
|
case "default": {
|
|
2871
2904
|
const defaultColumn = column;
|
|
2872
2905
|
const { fieldDef, tableDefinition, primaryKey } = defaultColumn;
|
|
2873
|
-
if (fieldDef?.clientSide) {
|
|
2906
|
+
if (fieldDef?.clientSide && !(fieldDef.clientSide in guardadosPropios)) {
|
|
2874
2907
|
const ClientSideComponent = clientSides[fieldDef.clientSide];
|
|
2875
2908
|
if (ClientSideComponent) {
|
|
2876
|
-
return /* @__PURE__ */
|
|
2909
|
+
return /* @__PURE__ */ jsx17(ClientSideComponent, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
|
|
2877
2910
|
}
|
|
2878
|
-
return /* @__PURE__ */
|
|
2911
|
+
return /* @__PURE__ */ jsx17(FallbackClientSideRenderer_default, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
|
|
2879
2912
|
}
|
|
2880
|
-
return /* @__PURE__ */
|
|
2913
|
+
return /* @__PURE__ */ jsx17(CeldaDato, { row, columnKey: props.column.key, defaultColumn });
|
|
2881
2914
|
}
|
|
2882
2915
|
case "detail": {
|
|
2883
2916
|
const { detailTable, primaryKey } = column;
|
|
2884
|
-
return /* @__PURE__ */
|
|
2917
|
+
return /* @__PURE__ */ jsx17(
|
|
2885
2918
|
BotonDetalle,
|
|
2886
2919
|
{
|
|
2887
2920
|
row,
|
|
@@ -2916,14 +2949,14 @@ var allColumnsCellRenderer = (props) => {
|
|
|
2916
2949
|
color: "primary"
|
|
2917
2950
|
}
|
|
2918
2951
|
];
|
|
2919
|
-
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(
|
|
2920
2953
|
IconButton5,
|
|
2921
2954
|
{
|
|
2922
2955
|
size: "small",
|
|
2923
2956
|
onClick: () => actionDef.handler(row),
|
|
2924
2957
|
title: actionDef.title,
|
|
2925
2958
|
sx: { width: 22, height: 22, p: 0, color: "grey.800", "&:hover": { color: `${actionDef.color}.main` } },
|
|
2926
|
-
children: /* @__PURE__ */
|
|
2959
|
+
children: /* @__PURE__ */ jsx17(actionDef.icon, { sx: { fontSize: 18 } })
|
|
2927
2960
|
},
|
|
2928
2961
|
actionDef.action
|
|
2929
2962
|
) : null) });
|
|
@@ -2989,7 +3022,7 @@ var useTableRecordSave = () => {
|
|
|
2989
3022
|
import InputBase4 from "@mui/material/InputBase";
|
|
2990
3023
|
import { Tooltip as Tooltip5, useTheme as useTheme3 } from "@mui/material";
|
|
2991
3024
|
import typeStore4 from "type-store";
|
|
2992
|
-
import { Fragment as Fragment4, jsx as
|
|
3025
|
+
import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2993
3026
|
function findChangedValues(oldRowData, newRowData, isNewRow) {
|
|
2994
3027
|
let changes = [];
|
|
2995
3028
|
for (const key in newRowData) {
|
|
@@ -3022,6 +3055,7 @@ function InputRenderer({
|
|
|
3022
3055
|
const theme = useTheme3();
|
|
3023
3056
|
const { showSuccess, showError } = useSnackbar();
|
|
3024
3057
|
const { saveRecord } = useTableRecordSave();
|
|
3058
|
+
const { callApi } = useApiCall();
|
|
3025
3059
|
const rowId = getPrimaryKeyValues(row, primaryKey);
|
|
3026
3060
|
const cellKey = `${rowId}-${column.key}`;
|
|
3027
3061
|
const currentCellFeedback = useFeedbackCelda(cellKey);
|
|
@@ -3063,6 +3097,20 @@ function InputRenderer({
|
|
|
3063
3097
|
const oldRowData = { ...row };
|
|
3064
3098
|
const primaryKeyValuesForBackend = tableDefinition.primaryKey.map((key) => potentialUpdatedRow[key]);
|
|
3065
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
|
+
}
|
|
3066
3114
|
onRowChange({ ...row, [column.key]: processedNewValue }, true);
|
|
3067
3115
|
if (isNewRow) {
|
|
3068
3116
|
const areAllMandatoryFieldsFilled = tableDefinition.fields.every((fieldDef) => {
|
|
@@ -3175,7 +3223,9 @@ function InputRenderer({
|
|
|
3175
3223
|
setTableData,
|
|
3176
3224
|
setLocalCellChanges,
|
|
3177
3225
|
initialRowId,
|
|
3178
|
-
typer
|
|
3226
|
+
typer,
|
|
3227
|
+
fieldDefinition,
|
|
3228
|
+
callApi
|
|
3179
3229
|
]);
|
|
3180
3230
|
const confirmarEnExpansion = useCallback10((nuevo) => {
|
|
3181
3231
|
setEditingValue(nuevo);
|
|
@@ -3230,7 +3280,7 @@ function InputRenderer({
|
|
|
3230
3280
|
}, [handleCommit, editingValue]);
|
|
3231
3281
|
const isFieldEditable = fieldDefinition?.editable !== false;
|
|
3232
3282
|
const isNumeric = isNumericType(fieldDefinition?.typeName);
|
|
3233
|
-
const editor = /* @__PURE__ */
|
|
3283
|
+
const editor = /* @__PURE__ */ jsx18(
|
|
3234
3284
|
InputBase4,
|
|
3235
3285
|
{
|
|
3236
3286
|
autoFocus: true,
|
|
@@ -3270,12 +3320,12 @@ function InputRenderer({
|
|
|
3270
3320
|
editor,
|
|
3271
3321
|
expander.ventana
|
|
3272
3322
|
] });
|
|
3273
|
-
return currentCellFeedback?.message ? /* @__PURE__ */
|
|
3323
|
+
return currentCellFeedback?.message ? /* @__PURE__ */ jsx18(Tooltip5, { title: currentCellFeedback.message, children: /* @__PURE__ */ jsx18("div", { style: { width: "100%" }, children: conMenu }) }) : conMenu;
|
|
3274
3324
|
}
|
|
3275
3325
|
var InputRenderer_default = InputRenderer;
|
|
3276
3326
|
|
|
3277
3327
|
// src/components/grid/renderers/editCellRenderers.tsx
|
|
3278
|
-
import { jsx as
|
|
3328
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
3279
3329
|
var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
3280
3330
|
const column = props.column;
|
|
3281
3331
|
if (!esColumnaPropia(column)) return void 0;
|
|
@@ -3297,7 +3347,7 @@ var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
|
3297
3347
|
if (!isFieldEditableByUI) {
|
|
3298
3348
|
return void 0;
|
|
3299
3349
|
}
|
|
3300
|
-
return /* @__PURE__ */
|
|
3350
|
+
return /* @__PURE__ */ jsx19(
|
|
3301
3351
|
InputRenderer_default,
|
|
3302
3352
|
{
|
|
3303
3353
|
...props,
|
|
@@ -3322,14 +3372,6 @@ var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
|
3322
3372
|
}
|
|
3323
3373
|
};
|
|
3324
3374
|
|
|
3325
|
-
// src/utils/columnasOcultas.ts
|
|
3326
|
-
function columnasOcultasIniciales(tableDefinition) {
|
|
3327
|
-
return Array.from(new Set(tableDefinition.hiddenColumns ?? []));
|
|
3328
|
-
}
|
|
3329
|
-
function campoDibujable(field) {
|
|
3330
|
-
return field.visible !== false;
|
|
3331
|
-
}
|
|
3332
|
-
|
|
3333
3375
|
// src/hooks/grid/useGridColumns.ts
|
|
3334
3376
|
var estimateTextWidth = (text) => text.length * 8 + 16;
|
|
3335
3377
|
var contextoDeMedida;
|
|
@@ -3405,7 +3447,7 @@ var useGridColumns = ({
|
|
|
3405
3447
|
});
|
|
3406
3448
|
const defaultColumns = fieldsToShow.map((fieldDef) => {
|
|
3407
3449
|
const isFixedField = valorFijoDe(fixedFields, fieldDef.name) !== void 0;
|
|
3408
|
-
const isFieldEditable = fieldDef
|
|
3450
|
+
const isFieldEditable = campoEditableEnCelda(fieldDef) && !isFixedField;
|
|
3409
3451
|
const colWidth = anchosCalculados.get(fieldDef.name) ?? estimateTextWidth(fieldDef.label || fieldDef.name) + 20;
|
|
3410
3452
|
const column = {
|
|
3411
3453
|
key: fieldDef.name,
|
|
@@ -3509,7 +3551,7 @@ import {
|
|
|
3509
3551
|
Divider
|
|
3510
3552
|
} from "@mui/material";
|
|
3511
3553
|
import FileUploadIcon2 from "@mui/icons-material/FileUpload";
|
|
3512
|
-
import { jsx as
|
|
3554
|
+
import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3513
3555
|
var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
3514
3556
|
const [file, setFile] = useState13(null);
|
|
3515
3557
|
const [options, setOptions] = useState13({
|
|
@@ -3533,12 +3575,12 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3533
3575
|
};
|
|
3534
3576
|
return /* @__PURE__ */ jsxs14(Dialog2, { open, onClose: loading ? void 0 : onClose, maxWidth: "sm", fullWidth: true, children: [
|
|
3535
3577
|
/* @__PURE__ */ jsxs14(DialogTitle2, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
3536
|
-
/* @__PURE__ */
|
|
3578
|
+
/* @__PURE__ */ jsx20(FileUploadIcon2, { color: "primary" }),
|
|
3537
3579
|
"Importar datos desde archivo"
|
|
3538
3580
|
] }),
|
|
3539
|
-
/* @__PURE__ */
|
|
3581
|
+
/* @__PURE__ */ jsx20(DialogContent2, { dividers: true, children: /* @__PURE__ */ jsxs14(Stack, { spacing: 3, sx: { mt: 1 }, children: [
|
|
3540
3582
|
/* @__PURE__ */ jsxs14(Box9, { children: [
|
|
3541
|
-
/* @__PURE__ */
|
|
3583
|
+
/* @__PURE__ */ jsx20(Typography7, { variant: "subtitle2", gutterBottom: true, fontWeight: "bold", children: "Seleccionar archivo" }),
|
|
3542
3584
|
/* @__PURE__ */ jsxs14(
|
|
3543
3585
|
Box9,
|
|
3544
3586
|
{
|
|
@@ -3552,7 +3594,7 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3552
3594
|
position: "relative"
|
|
3553
3595
|
},
|
|
3554
3596
|
children: [
|
|
3555
|
-
/* @__PURE__ */
|
|
3597
|
+
/* @__PURE__ */ jsx20(
|
|
3556
3598
|
"input",
|
|
3557
3599
|
{
|
|
3558
3600
|
type: "file",
|
|
@@ -3569,19 +3611,19 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3569
3611
|
}
|
|
3570
3612
|
}
|
|
3571
3613
|
),
|
|
3572
|
-
/* @__PURE__ */
|
|
3614
|
+
/* @__PURE__ */ jsx20(Typography7, { variant: "body2", color: file ? "textPrimary" : "textSecondary", children: file ? file.name : "Haz clic aqu\xED para seleccionar un archivo" })
|
|
3573
3615
|
]
|
|
3574
3616
|
}
|
|
3575
3617
|
)
|
|
3576
3618
|
] }),
|
|
3577
|
-
/* @__PURE__ */
|
|
3619
|
+
/* @__PURE__ */ jsx20(Divider, {}),
|
|
3578
3620
|
/* @__PURE__ */ jsxs14(Box9, { children: [
|
|
3579
|
-
/* @__PURE__ */
|
|
3621
|
+
/* @__PURE__ */ jsx20(Typography7, { variant: "subtitle2", gutterBottom: true, fontWeight: "bold", children: "Opciones de importaci\xF3n" }),
|
|
3580
3622
|
/* @__PURE__ */ jsxs14(Stack, { children: [
|
|
3581
|
-
/* @__PURE__ */
|
|
3623
|
+
/* @__PURE__ */ jsx20(
|
|
3582
3624
|
FormControlLabel,
|
|
3583
3625
|
{
|
|
3584
|
-
control: /* @__PURE__ */
|
|
3626
|
+
control: /* @__PURE__ */ jsx20(
|
|
3585
3627
|
Checkbox,
|
|
3586
3628
|
{
|
|
3587
3629
|
checked: options.skipUnknownFieldsAtImport,
|
|
@@ -3589,13 +3631,13 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3589
3631
|
size: "small"
|
|
3590
3632
|
}
|
|
3591
3633
|
),
|
|
3592
|
-
label: /* @__PURE__ */
|
|
3634
|
+
label: /* @__PURE__ */ jsx20(Typography7, { variant: "body2", children: "Omitir campos desconocidos al importar" })
|
|
3593
3635
|
}
|
|
3594
3636
|
),
|
|
3595
|
-
/* @__PURE__ */
|
|
3637
|
+
/* @__PURE__ */ jsx20(
|
|
3596
3638
|
FormControlLabel,
|
|
3597
3639
|
{
|
|
3598
|
-
control: /* @__PURE__ */
|
|
3640
|
+
control: /* @__PURE__ */ jsx20(
|
|
3599
3641
|
Checkbox,
|
|
3600
3642
|
{
|
|
3601
3643
|
checked: options.simplificateSpaces,
|
|
@@ -3603,13 +3645,13 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3603
3645
|
size: "small"
|
|
3604
3646
|
}
|
|
3605
3647
|
),
|
|
3606
|
-
label: /* @__PURE__ */
|
|
3648
|
+
label: /* @__PURE__ */ jsx20(Typography7, { variant: "body2", children: "Simplificar espacios" })
|
|
3607
3649
|
}
|
|
3608
3650
|
),
|
|
3609
|
-
/* @__PURE__ */
|
|
3651
|
+
/* @__PURE__ */ jsx20(
|
|
3610
3652
|
FormControlLabel,
|
|
3611
3653
|
{
|
|
3612
|
-
control: /* @__PURE__ */
|
|
3654
|
+
control: /* @__PURE__ */ jsx20(
|
|
3613
3655
|
Checkbox,
|
|
3614
3656
|
{
|
|
3615
3657
|
checked: options.replaceNewLineWithSpace,
|
|
@@ -3617,21 +3659,21 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3617
3659
|
size: "small"
|
|
3618
3660
|
}
|
|
3619
3661
|
),
|
|
3620
|
-
label: /* @__PURE__ */
|
|
3662
|
+
label: /* @__PURE__ */ jsx20(Typography7, { variant: "body2", children: "Reemplazar saltos de l\xEDnea con espacios" })
|
|
3621
3663
|
}
|
|
3622
3664
|
)
|
|
3623
3665
|
] })
|
|
3624
3666
|
] })
|
|
3625
3667
|
] }) }),
|
|
3626
3668
|
/* @__PURE__ */ jsxs14(DialogActions2, { sx: { px: 3, py: 2 }, children: [
|
|
3627
|
-
/* @__PURE__ */
|
|
3628
|
-
/* @__PURE__ */
|
|
3669
|
+
/* @__PURE__ */ jsx20(Button4, { onClick: onClose, disabled: loading, children: "Cancelar" }),
|
|
3670
|
+
/* @__PURE__ */ jsx20(
|
|
3629
3671
|
Button4,
|
|
3630
3672
|
{
|
|
3631
3673
|
onClick: handleConfirm,
|
|
3632
3674
|
variant: "contained",
|
|
3633
3675
|
disabled: !file || loading,
|
|
3634
|
-
startIcon: /* @__PURE__ */
|
|
3676
|
+
startIcon: /* @__PURE__ */ jsx20(FileUploadIcon2, {}),
|
|
3635
3677
|
children: loading ? "Procesando..." : "Confirmar Importaci\xF3n"
|
|
3636
3678
|
}
|
|
3637
3679
|
)
|
|
@@ -3660,7 +3702,7 @@ import {
|
|
|
3660
3702
|
} from "@mui/material";
|
|
3661
3703
|
import * as XLSX from "xlsx";
|
|
3662
3704
|
import typeStore5 from "type-store";
|
|
3663
|
-
import { jsx as
|
|
3705
|
+
import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3664
3706
|
var ExportDialog = ({
|
|
3665
3707
|
open,
|
|
3666
3708
|
onClose,
|
|
@@ -3806,47 +3848,47 @@ var ExportDialog = ({
|
|
|
3806
3848
|
}, 0);
|
|
3807
3849
|
};
|
|
3808
3850
|
return /* @__PURE__ */ jsxs15(Dialog3, { open, onClose, maxWidth: "xs", fullWidth: true, children: [
|
|
3809
|
-
/* @__PURE__ */
|
|
3810
|
-
/* @__PURE__ */
|
|
3811
|
-
/* @__PURE__ */
|
|
3812
|
-
/* @__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..." })
|
|
3813
3855
|
] }) : /* @__PURE__ */ jsxs15(Box10, { sx: { mt: 1 }, children: [
|
|
3814
3856
|
/* @__PURE__ */ jsxs15(FormControl2, { component: "fieldset", children: [
|
|
3815
|
-
/* @__PURE__ */
|
|
3857
|
+
/* @__PURE__ */ jsx21(FormLabel, { component: "legend", children: "Formato" }),
|
|
3816
3858
|
/* @__PURE__ */ jsxs15(
|
|
3817
3859
|
RadioGroup,
|
|
3818
3860
|
{
|
|
3819
3861
|
value: format,
|
|
3820
3862
|
onChange: (e) => setFormat(e.target.value),
|
|
3821
3863
|
children: [
|
|
3822
|
-
/* @__PURE__ */
|
|
3823
|
-
/* @__PURE__ */
|
|
3824
|
-
/* @__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 , )" })
|
|
3825
3867
|
]
|
|
3826
3868
|
}
|
|
3827
3869
|
)
|
|
3828
3870
|
] }),
|
|
3829
3871
|
/* @__PURE__ */ jsxs15(Box10, { sx: { mt: 3 }, children: [
|
|
3830
|
-
/* @__PURE__ */
|
|
3872
|
+
/* @__PURE__ */ jsx21(Typography8, { variant: "subtitle2", gutterBottom: true, children: "Opciones de campos:" }),
|
|
3831
3873
|
/* @__PURE__ */ jsxs15(FormGroup, { children: [
|
|
3832
|
-
/* @__PURE__ */
|
|
3874
|
+
/* @__PURE__ */ jsx21(
|
|
3833
3875
|
FormControlLabel2,
|
|
3834
3876
|
{
|
|
3835
|
-
control: /* @__PURE__ */
|
|
3877
|
+
control: /* @__PURE__ */ jsx21(Checkbox2, { checked: options.fromOtherTables, onChange: handleOptionChange, name: "fromOtherTables" }),
|
|
3836
3878
|
label: "Desde otras tablas"
|
|
3837
3879
|
}
|
|
3838
3880
|
),
|
|
3839
|
-
/* @__PURE__ */
|
|
3881
|
+
/* @__PURE__ */ jsx21(
|
|
3840
3882
|
FormControlLabel2,
|
|
3841
3883
|
{
|
|
3842
|
-
control: /* @__PURE__ */
|
|
3884
|
+
control: /* @__PURE__ */ jsx21(Checkbox2, { checked: options.readOnly, onChange: handleOptionChange, name: "readOnly" }),
|
|
3843
3885
|
label: "Solo lectura"
|
|
3844
3886
|
}
|
|
3845
3887
|
),
|
|
3846
|
-
/* @__PURE__ */
|
|
3888
|
+
/* @__PURE__ */ jsx21(
|
|
3847
3889
|
FormControlLabel2,
|
|
3848
3890
|
{
|
|
3849
|
-
control: /* @__PURE__ */
|
|
3891
|
+
control: /* @__PURE__ */ jsx21(Checkbox2, { checked: options.hiddens, onChange: handleOptionChange, name: "hiddens" }),
|
|
3850
3892
|
label: "Ocultos"
|
|
3851
3893
|
}
|
|
3852
3894
|
)
|
|
@@ -3854,27 +3896,27 @@ var ExportDialog = ({
|
|
|
3854
3896
|
] })
|
|
3855
3897
|
] }) }),
|
|
3856
3898
|
/* @__PURE__ */ jsxs15(DialogActions3, { children: [
|
|
3857
|
-
/* @__PURE__ */
|
|
3858
|
-
/* @__PURE__ */
|
|
3899
|
+
/* @__PURE__ */ jsx21(Button5, { onClick: onClose, disabled: isPreparing, children: "Cancelar" }),
|
|
3900
|
+
/* @__PURE__ */ jsx21(Button5, { onClick: handlePrepareExport, variant: "contained", disabled: isPreparing, children: "Descargar" })
|
|
3859
3901
|
] })
|
|
3860
3902
|
] });
|
|
3861
3903
|
};
|
|
3862
3904
|
|
|
3863
3905
|
// src/components/grid/DialogoDeColumnas.tsx
|
|
3864
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";
|
|
3865
|
-
import { jsx as
|
|
3907
|
+
import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3866
3908
|
var DialogoDeColumnas = ({ open, onClose, columnas, ocultas, alternarColumna }) => {
|
|
3867
3909
|
const lista = (titulo, nombres, idDeLista) => /* @__PURE__ */ jsxs16(Box11, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
3868
|
-
/* @__PURE__ */
|
|
3869
|
-
/* @__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)) })
|
|
3870
3912
|
] });
|
|
3871
3913
|
return /* @__PURE__ */ jsxs16(Dialog4, { open, onClose, maxWidth: "sm", fullWidth: true, children: [
|
|
3872
|
-
/* @__PURE__ */
|
|
3873
|
-
/* @__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: [
|
|
3874
3916
|
lista("Columnas mostradas", columnas.filter((nombre) => !ocultas.has(nombre)), "columnas-mostradas"),
|
|
3875
3917
|
lista("Columnas ocultas", columnas.filter((nombre) => ocultas.has(nombre)), "columnas-ocultas")
|
|
3876
3918
|
] }) }),
|
|
3877
|
-
/* @__PURE__ */
|
|
3919
|
+
/* @__PURE__ */ jsx22(DialogActions4, { children: /* @__PURE__ */ jsx22(Button6, { onClick: onClose, children: "Cerrar" }) })
|
|
3878
3920
|
] });
|
|
3879
3921
|
};
|
|
3880
3922
|
|
|
@@ -3892,7 +3934,7 @@ import {
|
|
|
3892
3934
|
Typography as Typography10
|
|
3893
3935
|
} from "@mui/material";
|
|
3894
3936
|
import CloseIcon from "@mui/icons-material/Close";
|
|
3895
|
-
import { jsx as
|
|
3937
|
+
import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3896
3938
|
var SIN_OCULTAS = /* @__PURE__ */ new Set();
|
|
3897
3939
|
var VerticalEditorPage = ({
|
|
3898
3940
|
tableName,
|
|
@@ -4028,14 +4070,14 @@ var VerticalEditorPage = ({
|
|
|
4028
4070
|
" - ",
|
|
4029
4071
|
tableDefinition.title || tableName
|
|
4030
4072
|
] }),
|
|
4031
|
-
/* @__PURE__ */
|
|
4073
|
+
/* @__PURE__ */ jsx23(IconButton6, { onClick: onClose, size: "small", edge: "end", children: /* @__PURE__ */ jsx23(CloseIcon, {}) })
|
|
4032
4074
|
] }),
|
|
4033
4075
|
/* @__PURE__ */ jsxs17(DialogContent5, { dividers: true, sx: { px: 2, flexGrow: 1, py: 1 }, children: [
|
|
4034
|
-
globalError && /* @__PURE__ */
|
|
4035
|
-
/* @__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) => {
|
|
4036
4078
|
const isFixed = fixedFields?.some((ff) => ff.fieldName === field.name);
|
|
4037
4079
|
const isMandatory = field.nullable === false || tableDefinition.primaryKey.includes(field.name);
|
|
4038
|
-
return /* @__PURE__ */
|
|
4080
|
+
return /* @__PURE__ */ jsx23(Box12, { sx: { width: "100%", maxWidth: "100%" }, children: /* @__PURE__ */ jsx23(
|
|
4039
4081
|
TypedField,
|
|
4040
4082
|
{
|
|
4041
4083
|
fieldDef: field,
|
|
@@ -4051,10 +4093,10 @@ var VerticalEditorPage = ({
|
|
|
4051
4093
|
] }),
|
|
4052
4094
|
/* @__PURE__ */ jsxs17(DialogActions5, { sx: { px: 0, pb: 0, pt: 2, justifyContent: "space-between", alignItems: "center" }, children: [
|
|
4053
4095
|
/* @__PURE__ */ jsxs17(Box12, { children: [
|
|
4054
|
-
isSaving && /* @__PURE__ */
|
|
4055
|
-
/* @__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" })
|
|
4056
4098
|
] }),
|
|
4057
|
-
/* @__PURE__ */
|
|
4099
|
+
/* @__PURE__ */ jsx23(Button7, { variant: "outlined", onClick: onClose, children: "Cerrar" })
|
|
4058
4100
|
] })
|
|
4059
4101
|
] });
|
|
4060
4102
|
};
|
|
@@ -4126,99 +4168,435 @@ function fusionar(base, cambios) {
|
|
|
4126
4168
|
return resultado;
|
|
4127
4169
|
}
|
|
4128
4170
|
|
|
4129
|
-
// src/
|
|
4130
|
-
var
|
|
4131
|
-
var
|
|
4132
|
-
|
|
4133
|
-
// src/components/grid/GenericDataGrid.tsx
|
|
4134
|
-
import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4135
|
-
var SUMMARY_ROW_HEIGHT = 35;
|
|
4136
|
-
var FILTER_ROW_HEIGHT = 35;
|
|
4137
|
-
var HEADER_ROW_HEIGHT = 30;
|
|
4138
|
-
var ROW_HEIGHT = 30;
|
|
4139
|
-
var MIN_BODY_HEIGHT = 260;
|
|
4140
|
-
var DURACION_FEEDBACK_EXITO = 3e3;
|
|
4141
|
-
var ALTO_TITULO_ANIDADA = 26;
|
|
4142
|
-
var ALTO_MINIMO_CUERPO_ANIDADA = 120;
|
|
4143
|
-
var HOLGURA_ANIDADA = 24;
|
|
4144
|
-
var ANCHO_MINIMO_ANIDADA = 240;
|
|
4145
|
-
var ANCHO_RESERVADO_PANTALLA = 320;
|
|
4146
|
-
var SANGRIA_DETALLE = 28 + 8 + 3;
|
|
4147
|
-
var MARGEN_INFERIOR_PAGINA = 24;
|
|
4148
|
-
var PRIMERAS_FILAS_ANIDADA = 20;
|
|
4149
|
-
var LIMITE_PRIMERAS_FILAS_ANIDADA = 30;
|
|
4150
|
-
var esColumnaPropia = (columna) => "customType" in columna;
|
|
4151
|
-
var SIN_ANCESTROS = [];
|
|
4152
|
-
var cargasEnCurso = /* @__PURE__ */ new Map();
|
|
4153
|
-
var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
4154
|
-
const theme = useTheme4();
|
|
4155
|
-
const { tableDefinition, row } = ancestor;
|
|
4156
|
-
const columns = useMemo10(() => {
|
|
4157
|
-
const filteredFields = tableDefinition.fields.filter(
|
|
4158
|
-
(field) => !fieldsToHide?.some((ff) => ff.fieldName === field.name)
|
|
4159
|
-
);
|
|
4160
|
-
return filteredFields.map((field) => {
|
|
4161
|
-
const isPrimaryKey = tableDefinition.primaryKey.includes(field.name);
|
|
4162
|
-
return {
|
|
4163
|
-
key: field.name,
|
|
4164
|
-
name: field.label || cambiarGuionesBajosPorEspacios(field.name),
|
|
4165
|
-
width: 150,
|
|
4166
|
-
editable: false,
|
|
4167
|
-
renderHeaderCell: () => /* @__PURE__ */ jsx23(Box13, { sx: { p: 0.5, height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsx23(
|
|
4168
|
-
Typography11,
|
|
4169
|
-
{
|
|
4170
|
-
variant: "caption",
|
|
4171
|
-
sx: {
|
|
4172
|
-
fontWeight: "bold",
|
|
4173
|
-
textDecoration: isPrimaryKey ? "underline" : "none",
|
|
4174
|
-
fontSize: "0.930rem"
|
|
4175
|
-
},
|
|
4176
|
-
children: field.label || cambiarGuionesBajosPorEspacios(field.name)
|
|
4177
|
-
}
|
|
4178
|
-
) }),
|
|
4179
|
-
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] ?? "") }) })
|
|
4180
|
-
};
|
|
4181
|
-
});
|
|
4182
|
-
}, [tableDefinition, fieldsToHide]);
|
|
4183
|
-
return /* @__PURE__ */ jsxs18(Box13, { sx: {
|
|
4184
|
-
mb: 1.5,
|
|
4185
|
-
ml: index * 4,
|
|
4186
|
-
// El primer ancestro (index 0) no tiene margen, los siguientes sí
|
|
4187
|
-
border: "1px solid",
|
|
4188
|
-
borderColor: "divider",
|
|
4189
|
-
borderRadius: 1,
|
|
4190
|
-
overflow: "hidden",
|
|
4191
|
-
boxShadow: theme.shadows[1],
|
|
4192
|
-
bgcolor: "background.paper"
|
|
4193
|
-
}, children: [
|
|
4194
|
-
/* @__PURE__ */ jsx23(Box13, { sx: {
|
|
4195
|
-
bgcolor: "primary.main",
|
|
4196
|
-
color: "primary.contrastText",
|
|
4197
|
-
px: 1.5,
|
|
4198
|
-
py: 0.5,
|
|
4199
|
-
borderBottom: "1px solid",
|
|
4200
|
-
borderColor: "divider",
|
|
4201
|
-
display: "flex",
|
|
4202
|
-
alignItems: "center",
|
|
4203
|
-
fontWeight: "bold",
|
|
4204
|
-
gap: 1
|
|
4205
|
-
}, children: /* @__PURE__ */ jsx23(Typography11, { variant: "subtitle2", component: "div", children: cambiarGuionesBajosPorEspacios(ancestor.tableName) }) }),
|
|
4206
|
-
/* @__PURE__ */ jsx23(
|
|
4207
|
-
DataGrid,
|
|
4208
|
-
{
|
|
4209
|
-
className: "rdg-light",
|
|
4210
|
-
columns,
|
|
4211
|
-
rows: [row],
|
|
4212
|
-
headerRowHeight: HEADER_ROW_HEIGHT,
|
|
4213
|
-
rowHeight: ROW_HEIGHT,
|
|
4214
|
-
rowKeyGetter: () => "single-row",
|
|
4215
|
-
style: { height: 78 }
|
|
4216
|
-
}
|
|
4217
|
-
)
|
|
4218
|
-
] });
|
|
4171
|
+
// src/puente/habilitacion.ts
|
|
4172
|
+
var habilitado = false;
|
|
4173
|
+
var habilitarPuenteBP = () => {
|
|
4174
|
+
habilitado = true;
|
|
4219
4175
|
};
|
|
4220
|
-
var
|
|
4221
|
-
|
|
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 = ({
|
|
4599
|
+
tableName,
|
|
4222
4600
|
fixedFields: fixedFieldsRecibidos,
|
|
4223
4601
|
filterColumns: filterColumnsRecibidos,
|
|
4224
4602
|
tableDef: tableDefRecibido,
|
|
@@ -4244,38 +4622,38 @@ var GenericDataGrid = ({
|
|
|
4244
4622
|
// eslint-disable-line react-hooks/exhaustive-deps
|
|
4245
4623
|
);
|
|
4246
4624
|
const cacheHeredado = useContext4(CacheGrillasContext);
|
|
4247
|
-
const [cachePropio] =
|
|
4625
|
+
const [cachePropio] = useState17(() => /* @__PURE__ */ new Map());
|
|
4248
4626
|
const cache = cacheHeredado ?? cachePropio;
|
|
4249
|
-
const [guardada] =
|
|
4250
|
-
const claveCargadaRef =
|
|
4251
|
-
const [tableDefinition, setTableDefinition] =
|
|
4252
|
-
const [tableData, setTableData] =
|
|
4253
|
-
const [cargandoInicial, setCargandoInicial] =
|
|
4254
|
-
const [errorDeCarga, setErrorDeCarga] =
|
|
4255
|
-
const [anchosCalculados, setAnchosCalculados] =
|
|
4256
|
-
const [columnasOcultas, setColumnasOcultas] =
|
|
4257
|
-
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);
|
|
4258
4636
|
const conjuntoDeOcultas = useMemo10(() => new Set(columnasOcultas), [columnasOcultas]);
|
|
4259
4637
|
const ocultarColumna = useCallback12((columna) => setColumnasOcultas((anteriores) => anteriores.includes(columna) ? anteriores : [...anteriores, columna]), []);
|
|
4260
4638
|
const alternarColumna = useCallback12((columna) => setColumnasOcultas((anteriores) => anteriores.includes(columna) ? anteriores.filter((oculta) => oculta !== columna) : [...anteriores, columna]), []);
|
|
4261
4639
|
const abrirDialogoDeColumnas = useCallback12(() => setOpenDialogoDeColumnas(true), []);
|
|
4262
|
-
const [detallesAbiertos, setDetallesAbiertos] =
|
|
4263
|
-
const [altosDetalle, setAltosDetalle] =
|
|
4264
|
-
const [anchosDetalle, setAnchosDetalle] =
|
|
4265
|
-
const [selectedRows, setSelectedRows] =
|
|
4266
|
-
const [, setSelectedCell] =
|
|
4267
|
-
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);
|
|
4268
4646
|
const theme = useTheme4();
|
|
4269
|
-
const [openDataGridOptions, setOpenDataGridOptions] =
|
|
4270
|
-
const [dataGridOptionsAnchorEl, setDataGridOptionsAnchorEl] =
|
|
4271
|
-
const [exitingRowIds, setExitingRowIds] =
|
|
4647
|
+
const [openDataGridOptions, setOpenDataGridOptions] = useState17(false);
|
|
4648
|
+
const [dataGridOptionsAnchorEl, setDataGridOptionsAnchorEl] = useState17(null);
|
|
4649
|
+
const [exitingRowIds, setExitingRowIds] = useState17(/* @__PURE__ */ new Set());
|
|
4272
4650
|
const { showError } = useSnackbar();
|
|
4273
4651
|
const { username: usuario } = useClientContext();
|
|
4274
|
-
const dataGridRef =
|
|
4275
|
-
const rowAtEditStartRef =
|
|
4276
|
-
const [openImportDialog, setOpenImportDialog] =
|
|
4277
|
-
const [openExportDialog, setOpenExportDialog] =
|
|
4278
|
-
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());
|
|
4279
4657
|
const { callApi, callApiUpload, loading } = useApiCall();
|
|
4280
4658
|
const primaryKey = useMemo10(() => {
|
|
4281
4659
|
if (!tableDefinition) return ["id"];
|
|
@@ -4297,7 +4675,7 @@ var GenericDataGrid = ({
|
|
|
4297
4675
|
resetView
|
|
4298
4676
|
} = useGridDataView({ tableData, tableDefinition });
|
|
4299
4677
|
const abiertos = useMemo10(() => new Set(detallesAbiertos), [detallesAbiertos]);
|
|
4300
|
-
const filasDetalleRef =
|
|
4678
|
+
const filasDetalleRef = useRef8(/* @__PURE__ */ new Map());
|
|
4301
4679
|
const filasMostradas = useMemo10(() => {
|
|
4302
4680
|
const detailTables = tableDefinition?.detailTables ?? [];
|
|
4303
4681
|
if (abiertos.size === 0 || detailTables.length === 0) return filteredRows;
|
|
@@ -4372,7 +4750,7 @@ var GenericDataGrid = ({
|
|
|
4372
4750
|
filasVisiblesMax,
|
|
4373
4751
|
conPie
|
|
4374
4752
|
});
|
|
4375
|
-
const [contenidoDeCelda, setContenidoDeCelda] =
|
|
4753
|
+
const [contenidoDeCelda, setContenidoDeCelda] = useState17(null);
|
|
4376
4754
|
const verContenido = useCallback12((anclaje, texto) => setContenidoDeCelda({ anclaje, texto }), []);
|
|
4377
4755
|
const cerrarContenidoDeCelda = useCallback12(() => {
|
|
4378
4756
|
const anclaje = contenidoDeCelda?.anclaje;
|
|
@@ -4390,8 +4768,8 @@ var GenericDataGrid = ({
|
|
|
4390
4768
|
setSortColumns,
|
|
4391
4769
|
verContenido
|
|
4392
4770
|
});
|
|
4393
|
-
const tableNameAnteriorRef =
|
|
4394
|
-
|
|
4771
|
+
const tableNameAnteriorRef = useRef8(tableName);
|
|
4772
|
+
useEffect8(() => {
|
|
4395
4773
|
if (tableNameAnteriorRef.current === tableName) return;
|
|
4396
4774
|
tableNameAnteriorRef.current = tableName;
|
|
4397
4775
|
setDetallesAbiertos([]);
|
|
@@ -4405,7 +4783,7 @@ var GenericDataGrid = ({
|
|
|
4405
4783
|
setExitingRowIds(/* @__PURE__ */ new Set());
|
|
4406
4784
|
setColumnWidths(/* @__PURE__ */ new Map());
|
|
4407
4785
|
}, [tableName, estadoGrilla, resetView]);
|
|
4408
|
-
|
|
4786
|
+
useEffect8(() => {
|
|
4409
4787
|
const claveCarga = `${tableName}|${claveFixedFields}|${claveParametros}`;
|
|
4410
4788
|
if (claveCargadaRef.current === claveCarga) {
|
|
4411
4789
|
if (guardada) setSortColumns(guardada.sortColumns);
|
|
@@ -4474,11 +4852,11 @@ var GenericDataGrid = ({
|
|
|
4474
4852
|
vigente = false;
|
|
4475
4853
|
};
|
|
4476
4854
|
}, [tableName, claveFixedFields, fixedFields, claveParametros, parametros, showError, callApi, getInitialSortColumns, setSortColumns, aplicarFiltrosIniciales, guardada]);
|
|
4477
|
-
|
|
4855
|
+
useEffect8(() => {
|
|
4478
4856
|
if (!claveCache || !tableDefinition || cargandoInicial) return;
|
|
4479
4857
|
cache.set(claveCache, { tableDefinition, tableData, anchosCalculados, columnasOcultas, sortColumns, detallesAbiertos, altosDetalle });
|
|
4480
4858
|
}, [cache, claveCache, tableDefinition, tableData, anchosCalculados, columnasOcultas, sortColumns, detallesAbiertos, altosDetalle, cargandoInicial]);
|
|
4481
|
-
|
|
4859
|
+
useEffect8(() => {
|
|
4482
4860
|
let timer = null;
|
|
4483
4861
|
const desuscribir = estadoGrilla.suscribir(() => {
|
|
4484
4862
|
const hayExitos = Array.from(estadoGrilla.obtenerFeedback().values()).some((f) => f.type === "success");
|
|
@@ -4570,8 +4948,8 @@ var GenericDataGrid = ({
|
|
|
4570
4948
|
const clave = claveDetalle(rowId, detailTable);
|
|
4571
4949
|
setDetallesAbiertos((anteriores) => anteriores.includes(clave) ? anteriores.filter((c) => c !== clave) : [...anteriores, clave]);
|
|
4572
4950
|
}, [onOpenDetail, abrirDetalleEnPestana, abrirWScreenEnPestana]);
|
|
4573
|
-
const [medidas, setMedidas] =
|
|
4574
|
-
|
|
4951
|
+
const [medidas, setMedidas] = useState17(null);
|
|
4952
|
+
useEffect8(() => {
|
|
4575
4953
|
const elemento = dataGridRef.current?.element;
|
|
4576
4954
|
if (!elemento) return;
|
|
4577
4955
|
const medir = () => setMedidas((anteriores) => {
|
|
@@ -4584,8 +4962,8 @@ var GenericDataGrid = ({
|
|
|
4584
4962
|
return () => observador.disconnect();
|
|
4585
4963
|
}, [tableDefinition, cargandoInicial]);
|
|
4586
4964
|
const anchoVisible = medidas?.ancho ?? null;
|
|
4587
|
-
const [altoDeVentana, setAltoDeVentana] =
|
|
4588
|
-
|
|
4965
|
+
const [altoDeVentana, setAltoDeVentana] = useState17(null);
|
|
4966
|
+
useEffect8(() => {
|
|
4589
4967
|
if (anidada) return;
|
|
4590
4968
|
const elemento = dataGridRef.current?.element;
|
|
4591
4969
|
if (!elemento) return;
|
|
@@ -4606,13 +4984,13 @@ var GenericDataGrid = ({
|
|
|
4606
4984
|
}, [altoMaximoDetalleEfectivo]);
|
|
4607
4985
|
const renderDetalle = useCallback12((fila) => {
|
|
4608
4986
|
const { detailTable } = fila;
|
|
4609
|
-
return /* @__PURE__ */
|
|
4987
|
+
return /* @__PURE__ */ jsx26(
|
|
4610
4988
|
"div",
|
|
4611
4989
|
{
|
|
4612
4990
|
className: "fpr-detalle",
|
|
4613
4991
|
style: { maxWidth: anchoVisible ? anchoVisible - 2 : void 0 },
|
|
4614
4992
|
onKeyDown: (e) => e.stopPropagation(),
|
|
4615
|
-
children: detailTable.table ? /* @__PURE__ */
|
|
4993
|
+
children: detailTable.table ? /* @__PURE__ */ jsx26(
|
|
4616
4994
|
GenericDataGrid,
|
|
4617
4995
|
{
|
|
4618
4996
|
tableName: detailTable.table,
|
|
@@ -4625,7 +5003,7 @@ var GenericDataGrid = ({
|
|
|
4625
5003
|
onOpenDetail,
|
|
4626
5004
|
ancestors: tableDefinition ? [...ancestors, { tableName: tableDefinition.name, row: fila.filaPadre, tableDefinition, fixedFields: fila.fixedFields }] : ancestors
|
|
4627
5005
|
}
|
|
4628
|
-
) : detailTable.wScreen ? /* @__PURE__ */
|
|
5006
|
+
) : detailTable.wScreen ? /* @__PURE__ */ jsx26(
|
|
4629
5007
|
DetalleWScreen,
|
|
4630
5008
|
{
|
|
4631
5009
|
fila,
|
|
@@ -4633,7 +5011,7 @@ var GenericDataGrid = ({
|
|
|
4633
5011
|
onAlto: (alto) => cambiarAltoDetalle(fila.clave, alto),
|
|
4634
5012
|
onAncho: (ancho) => cambiarAnchoDetalle(fila.clave, ancho)
|
|
4635
5013
|
}
|
|
4636
|
-
) : /* @__PURE__ */
|
|
5014
|
+
) : /* @__PURE__ */ jsxs19(Alert3, { severity: "warning", children: [
|
|
4637
5015
|
"El detalle '",
|
|
4638
5016
|
detailTable.abr,
|
|
4639
5017
|
"' no tiene ni tabla ni wScreen."
|
|
@@ -4643,7 +5021,7 @@ var GenericDataGrid = ({
|
|
|
4643
5021
|
}, [anchoVisible, claveCache, tableName, cambiarAltoDetalle, cambiarAnchoDetalle, altoMaximoDetalleEfectivo, onOpenDetail, tableDefinition, ancestors]);
|
|
4644
5022
|
const detallesGrilla = useMemo10(() => ({ abiertos, alternarDetalle, renderDetalle }), [abiertos, alternarDetalle, renderDetalle]);
|
|
4645
5023
|
const altoDeseado = cargandoInicial ? ALTO_INICIAL_DETALLE : gridHeight + ALTO_TITULO_ANIDADA + 8;
|
|
4646
|
-
|
|
5024
|
+
useEffect8(() => {
|
|
4647
5025
|
onAltoDeseado?.(altoDeseado);
|
|
4648
5026
|
}, [onAltoDeseado, altoDeseado]);
|
|
4649
5027
|
const rowKeyGetter = useCallback12((row) => esFilaDetalle(row) ? `detalle:${row.clave}` : getPrimaryKeyValues(row, primaryKey), [primaryKey]);
|
|
@@ -4662,7 +5040,7 @@ var GenericDataGrid = ({
|
|
|
4662
5040
|
const anchoDetalleMax = detallesAbiertos.reduce((max, clave) => Math.max(max, anchosDetalle.get(clave) ?? 0), 0);
|
|
4663
5041
|
return Math.max(ANCHO_MINIMO_ANIDADA, propio, anchoDetalleMax > 0 ? anchoDetalleMax + SANGRIA_DETALLE + (medidas?.barra ?? 0) + 2 : 0);
|
|
4664
5042
|
}, [anidada, columns, columnWidths, medidas?.barra, detallesAbiertos, anchosDetalle]);
|
|
4665
|
-
|
|
5043
|
+
useEffect8(() => {
|
|
4666
5044
|
if (anidada && anchoContenido !== void 0) onAnchoDeseado?.(anchoContenido);
|
|
4667
5045
|
}, [onAnchoDeseado, anidada, anchoContenido]);
|
|
4668
5046
|
const anchoExterior = anchoContenido === void 0 ? void 0 : anidada ? anchoContenido : anchoContenido - 2 + 32 + ancestors.length * 32;
|
|
@@ -4680,19 +5058,22 @@ var GenericDataGrid = ({
|
|
|
4680
5058
|
};
|
|
4681
5059
|
const fallBackMessage = getFallBackMessage();
|
|
4682
5060
|
if (cargandoInicial) {
|
|
4683
|
-
return /* @__PURE__ */
|
|
4684
|
-
/* @__PURE__ */
|
|
4685
|
-
/* @__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..." })
|
|
4686
5064
|
] });
|
|
4687
5065
|
}
|
|
4688
5066
|
if (errorDeCarga) {
|
|
4689
|
-
return /* @__PURE__ */
|
|
5067
|
+
return /* @__PURE__ */ jsx26(Box15, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsx26(Alert3, { severity: "error", children: errorDeCarga }) });
|
|
4690
5068
|
}
|
|
4691
5069
|
if (!tableDefinition) {
|
|
4692
|
-
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." }) });
|
|
4693
5071
|
}
|
|
4694
|
-
|
|
4695
|
-
|
|
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(
|
|
4696
5077
|
StaticAncestorGrid,
|
|
4697
5078
|
{
|
|
4698
5079
|
ancestor,
|
|
@@ -4701,8 +5082,8 @@ var GenericDataGrid = ({
|
|
|
4701
5082
|
},
|
|
4702
5083
|
index
|
|
4703
5084
|
)) }),
|
|
4704
|
-
/* @__PURE__ */
|
|
4705
|
-
|
|
5085
|
+
/* @__PURE__ */ jsxs19(
|
|
5086
|
+
Box15,
|
|
4706
5087
|
{
|
|
4707
5088
|
sx: {
|
|
4708
5089
|
backgroundColor: theme.palette.primary.main,
|
|
@@ -4724,17 +5105,17 @@ var GenericDataGrid = ({
|
|
|
4724
5105
|
gap: 1
|
|
4725
5106
|
},
|
|
4726
5107
|
children: [
|
|
4727
|
-
/* @__PURE__ */
|
|
5108
|
+
/* @__PURE__ */ jsxs19(Typography11, { variant: "subtitle2", component: "div", children: [
|
|
4728
5109
|
titulo ?? cambiarGuionesBajosPorEspacios(tableDefinition.title || tableDefinition.name),
|
|
4729
5110
|
" - ",
|
|
4730
5111
|
filteredRows.length === tableData.length ? `${tableData.length} registros` : `${filteredRows.length} (F)`
|
|
4731
5112
|
] }),
|
|
4732
|
-
loading && /* @__PURE__ */
|
|
5113
|
+
loading && /* @__PURE__ */ jsx26(CircularProgress5, { size: 14, color: "inherit" })
|
|
4733
5114
|
]
|
|
4734
5115
|
}
|
|
4735
5116
|
),
|
|
4736
|
-
/* @__PURE__ */
|
|
4737
|
-
|
|
5117
|
+
/* @__PURE__ */ jsxs19(
|
|
5118
|
+
Box15,
|
|
4738
5119
|
{
|
|
4739
5120
|
sx: {
|
|
4740
5121
|
// Una grilla anidada se acota con px (el alto que le dio la de arriba, o el de una wScreen): una wScreen
|
|
@@ -4752,7 +5133,7 @@ var GenericDataGrid = ({
|
|
|
4752
5133
|
pb: anidada ? 0 : 3
|
|
4753
5134
|
},
|
|
4754
5135
|
children: [
|
|
4755
|
-
/* @__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(
|
|
4756
5137
|
DataGrid,
|
|
4757
5138
|
{
|
|
4758
5139
|
className: "rdg-light",
|
|
@@ -4782,8 +5163,8 @@ var GenericDataGrid = ({
|
|
|
4782
5163
|
onCellKeyDown: handleCellKeyDown
|
|
4783
5164
|
}
|
|
4784
5165
|
) }) }) }),
|
|
4785
|
-
fallBackMessage && /* @__PURE__ */
|
|
4786
|
-
|
|
5166
|
+
fallBackMessage && /* @__PURE__ */ jsx26(
|
|
5167
|
+
Box15,
|
|
4787
5168
|
{
|
|
4788
5169
|
sx: {
|
|
4789
5170
|
position: "absolute",
|
|
@@ -4799,13 +5180,13 @@ var GenericDataGrid = ({
|
|
|
4799
5180
|
zIndex: tableData.length === 0 ? 10 : 1
|
|
4800
5181
|
// Mantenemos el zIndex superior para el estado vacío total
|
|
4801
5182
|
},
|
|
4802
|
-
children: /* @__PURE__ */
|
|
5183
|
+
children: /* @__PURE__ */ jsx26(Typography11, { variant: "body2", color: "textSecondary", children: fallBackMessage })
|
|
4803
5184
|
}
|
|
4804
5185
|
)
|
|
4805
5186
|
]
|
|
4806
5187
|
}
|
|
4807
5188
|
),
|
|
4808
|
-
/* @__PURE__ */
|
|
5189
|
+
/* @__PURE__ */ jsx26(
|
|
4809
5190
|
ExportDialog,
|
|
4810
5191
|
{
|
|
4811
5192
|
open: openExportDialog,
|
|
@@ -4817,7 +5198,7 @@ var GenericDataGrid = ({
|
|
|
4817
5198
|
username: usuario || "anonymous"
|
|
4818
5199
|
}
|
|
4819
5200
|
),
|
|
4820
|
-
/* @__PURE__ */
|
|
5201
|
+
/* @__PURE__ */ jsx26(
|
|
4821
5202
|
DialogoDeColumnas,
|
|
4822
5203
|
{
|
|
4823
5204
|
open: openDialogoDeColumnas,
|
|
@@ -4827,7 +5208,7 @@ var GenericDataGrid = ({
|
|
|
4827
5208
|
alternarColumna
|
|
4828
5209
|
}
|
|
4829
5210
|
),
|
|
4830
|
-
/* @__PURE__ */
|
|
5211
|
+
/* @__PURE__ */ jsx26(
|
|
4831
5212
|
ConfirmDialog,
|
|
4832
5213
|
{
|
|
4833
5214
|
open: openConfirmDialog,
|
|
@@ -4836,7 +5217,7 @@ var GenericDataGrid = ({
|
|
|
4836
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."
|
|
4837
5218
|
}
|
|
4838
5219
|
),
|
|
4839
|
-
/* @__PURE__ */
|
|
5220
|
+
/* @__PURE__ */ jsx26(
|
|
4840
5221
|
DataGridOptionsDialog,
|
|
4841
5222
|
{
|
|
4842
5223
|
open: openDataGridOptions,
|
|
@@ -4845,7 +5226,7 @@ var GenericDataGrid = ({
|
|
|
4845
5226
|
anchorEl: dataGridOptionsAnchorEl
|
|
4846
5227
|
}
|
|
4847
5228
|
),
|
|
4848
|
-
/* @__PURE__ */
|
|
5229
|
+
/* @__PURE__ */ jsx26(
|
|
4849
5230
|
ImportDialog,
|
|
4850
5231
|
{
|
|
4851
5232
|
open: openImportDialog,
|
|
@@ -4854,14 +5235,14 @@ var GenericDataGrid = ({
|
|
|
4854
5235
|
loading
|
|
4855
5236
|
}
|
|
4856
5237
|
),
|
|
4857
|
-
/* @__PURE__ */
|
|
5238
|
+
/* @__PURE__ */ jsx26(
|
|
4858
5239
|
Dialog5,
|
|
4859
5240
|
{
|
|
4860
5241
|
open: openVerticalEditDialog,
|
|
4861
5242
|
onClose: () => setOpenVerticalEditDialog(false),
|
|
4862
5243
|
maxWidth: "sm",
|
|
4863
5244
|
fullWidth: true,
|
|
4864
|
-
children: rowToEditVertical && /* @__PURE__ */
|
|
5245
|
+
children: rowToEditVertical && /* @__PURE__ */ jsx26(
|
|
4865
5246
|
VerticalEditorPage,
|
|
4866
5247
|
{
|
|
4867
5248
|
tableName,
|
|
@@ -4907,7 +5288,7 @@ var GenericDataGrid = ({
|
|
|
4907
5288
|
)
|
|
4908
5289
|
}
|
|
4909
5290
|
),
|
|
4910
|
-
contenidoDeCelda && /* @__PURE__ */
|
|
5291
|
+
contenidoDeCelda && /* @__PURE__ */ jsx26(VentanaDeTexto, { anclaje: contenidoDeCelda.anclaje, texto: contenidoDeCelda.texto, editable: false, onAceptar: cerrarContenidoDeCelda, onCerrar: cerrarContenidoDeCelda })
|
|
4911
5292
|
] }) });
|
|
4912
5293
|
};
|
|
4913
5294
|
var GenericDataGrid_default = GenericDataGrid;
|
|
@@ -4917,10 +5298,10 @@ import React34, { useEffect as useEffect18, useMemo as useMemo17 } from "react";
|
|
|
4917
5298
|
import { BrowserRouter, Routes, Route, useLocation as useLocation9, Navigate as Navigate4, Outlet as Outlet2 } from "react-router-dom";
|
|
4918
5299
|
|
|
4919
5300
|
// src/components/MainLayout.tsx
|
|
4920
|
-
import { useEffect as
|
|
5301
|
+
import { useEffect as useEffect11 } from "react";
|
|
4921
5302
|
import { Outlet } from "react-router-dom";
|
|
4922
5303
|
import {
|
|
4923
|
-
Box as
|
|
5304
|
+
Box as Box17,
|
|
4924
5305
|
AppBar,
|
|
4925
5306
|
Toolbar,
|
|
4926
5307
|
Typography as Typography13,
|
|
@@ -4933,7 +5314,7 @@ import {
|
|
|
4933
5314
|
} from "@mui/material";
|
|
4934
5315
|
|
|
4935
5316
|
// src/contexts/AppContext.tsx
|
|
4936
|
-
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";
|
|
4937
5318
|
import { useLocation, useNavigate } from "react-router-dom";
|
|
4938
5319
|
import { useSelector as useSelector2, useDispatch as useDispatch2 } from "react-redux";
|
|
4939
5320
|
|
|
@@ -4945,7 +5326,7 @@ var marcarCierreVoluntario = (activo) => {
|
|
|
4945
5326
|
var huboCierreVoluntario = () => cierreVoluntario;
|
|
4946
5327
|
|
|
4947
5328
|
// src/contexts/AppContext.tsx
|
|
4948
|
-
import { jsx as
|
|
5329
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
4949
5330
|
var AuthContext = createContext4(void 0);
|
|
4950
5331
|
var useApp = () => {
|
|
4951
5332
|
const context = useContext5(AuthContext);
|
|
@@ -4957,11 +5338,11 @@ var useApp = () => {
|
|
|
4957
5338
|
};
|
|
4958
5339
|
var AppProvider = ({ children, publicPaths = [] }) => {
|
|
4959
5340
|
console.log("AppProvider rendered/re-rendered");
|
|
4960
|
-
const [isLoggedIn, setIsLoggedIn] =
|
|
4961
|
-
const [showSessionExpiredMessage, setShowSessionExpiredMessage] =
|
|
4962
|
-
const isRedirectingRef =
|
|
4963
|
-
const huboSesionRef =
|
|
4964
|
-
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);
|
|
4965
5346
|
const dispatch = useDispatch2();
|
|
4966
5347
|
const clientContext = useSelector2((state) => state.clientContext);
|
|
4967
5348
|
if (clientContext.status === "succeeded" && !cierreVoluntarioRef.current) huboSesionRef.current = true;
|
|
@@ -5029,7 +5410,7 @@ var AppProvider = ({ children, publicPaths = [] }) => {
|
|
|
5029
5410
|
}
|
|
5030
5411
|
}
|
|
5031
5412
|
}, [dispatch, clientContext.status, showSessionExpiredMessage, isCurrentPathPublic, limpiarContextoPorSesionPerdida]);
|
|
5032
|
-
|
|
5413
|
+
useEffect9(() => {
|
|
5033
5414
|
checkSession();
|
|
5034
5415
|
const intervalId = setInterval(checkSession, 15 * 1e3);
|
|
5035
5416
|
return () => {
|
|
@@ -5053,7 +5434,7 @@ var AppProvider = ({ children, publicPaths = [] }) => {
|
|
|
5053
5434
|
handleExpiredSessionRedirect,
|
|
5054
5435
|
avisarCierreVoluntario
|
|
5055
5436
|
]);
|
|
5056
|
-
return /* @__PURE__ */
|
|
5437
|
+
return /* @__PURE__ */ jsx27(AuthContext.Provider, { value: authContextValue, children });
|
|
5057
5438
|
};
|
|
5058
5439
|
|
|
5059
5440
|
// src/components/MainLayout.tsx
|
|
@@ -5064,8 +5445,8 @@ import MenuIcon from "@mui/icons-material/Menu";
|
|
|
5064
5445
|
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
5065
5446
|
|
|
5066
5447
|
// src/components/SideMenu.tsx
|
|
5067
|
-
import
|
|
5068
|
-
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";
|
|
5069
5450
|
import ExpandLess from "@mui/icons-material/ExpandLess";
|
|
5070
5451
|
import ExpandMore from "@mui/icons-material/ExpandMore";
|
|
5071
5452
|
import TableChartIcon from "@mui/icons-material/TableChart";
|
|
@@ -5078,13 +5459,6 @@ import ClearIcon from "@mui/icons-material/Clear";
|
|
|
5078
5459
|
import { useNavigate as useNavigate2, useLocation as useLocation2 } from "react-router-dom";
|
|
5079
5460
|
import { blue, orange, teal, indigo, red } from "@mui/material/colors";
|
|
5080
5461
|
|
|
5081
|
-
// src/puente/habilitacion.ts
|
|
5082
|
-
var habilitado = false;
|
|
5083
|
-
var habilitarPuenteBP = () => {
|
|
5084
|
-
habilitado = true;
|
|
5085
|
-
};
|
|
5086
|
-
var puenteBPHabilitado = () => habilitado;
|
|
5087
|
-
|
|
5088
5462
|
// src/utils/menuInicial.ts
|
|
5089
5463
|
function rutaDeTablaDeMenu(camino) {
|
|
5090
5464
|
return `/menu/${camino.map(encodeURIComponent).join("/")}`;
|
|
@@ -5165,22 +5539,22 @@ function buscarEnMenu(hojas, consulta) {
|
|
|
5165
5539
|
}
|
|
5166
5540
|
|
|
5167
5541
|
// src/components/SideMenu.tsx
|
|
5168
|
-
import { Fragment as Fragment5, jsx as
|
|
5542
|
+
import { Fragment as Fragment5, jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
5169
5543
|
var CLAVE_RECIENTES = "fpr.menu.recientes";
|
|
5170
5544
|
var MAXIMO_RECIENTES = 4;
|
|
5171
5545
|
var getIcon = (item, destacado = false) => {
|
|
5172
5546
|
switch (item.menuType) {
|
|
5173
5547
|
case "table":
|
|
5174
|
-
return /* @__PURE__ */
|
|
5548
|
+
return /* @__PURE__ */ jsx28(TableChartIcon, { sx: destacado ? { color: blue[700] } : void 0 });
|
|
5175
5549
|
case "proc":
|
|
5176
|
-
return /* @__PURE__ */
|
|
5550
|
+
return /* @__PURE__ */ jsx28(DnsIcon, { sx: destacado ? { color: teal[700] } : void 0 });
|
|
5177
5551
|
case "menu":
|
|
5178
|
-
return /* @__PURE__ */
|
|
5552
|
+
return /* @__PURE__ */ jsx28(FolderIcon, { sx: destacado ? { color: orange[800] } : void 0 });
|
|
5179
5553
|
default:
|
|
5180
5554
|
if (wScreens[item.menuType] !== void 0 || puenteBPHabilitado()) {
|
|
5181
|
-
return /* @__PURE__ */
|
|
5555
|
+
return /* @__PURE__ */ jsx28(DesktopWindowsIcon, { sx: destacado ? { color: indigo[500] } : void 0 });
|
|
5182
5556
|
}
|
|
5183
|
-
return /* @__PURE__ */
|
|
5557
|
+
return /* @__PURE__ */ jsx28(WarningAmberIcon3, { sx: destacado ? { color: red[500] } : void 0 });
|
|
5184
5558
|
}
|
|
5185
5559
|
};
|
|
5186
5560
|
var estaSeleccionado = (item, grupos, currentPath, hash = "") => {
|
|
@@ -5230,28 +5604,28 @@ var MenuListItem = ({ item, level, grupos = [], hermanos = [], onMenuItemClick }
|
|
|
5230
5604
|
}
|
|
5231
5605
|
};
|
|
5232
5606
|
const isSelected = estaSeleccionado(item, grupos, location.pathname, location.hash);
|
|
5233
|
-
const itemRef =
|
|
5234
|
-
|
|
5607
|
+
const itemRef = React21.useRef(null);
|
|
5608
|
+
useEffect10(() => {
|
|
5235
5609
|
if (isSelected && itemRef.current) {
|
|
5236
5610
|
itemRef.current.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
5237
5611
|
}
|
|
5238
5612
|
}, [isSelected]);
|
|
5239
5613
|
const contenido = item.menuType === "menu" ? item.menuContent : [];
|
|
5240
|
-
return /* @__PURE__ */
|
|
5241
|
-
/* @__PURE__ */
|
|
5614
|
+
return /* @__PURE__ */ jsxs20("div", { ref: itemRef, children: [
|
|
5615
|
+
/* @__PURE__ */ jsxs20(
|
|
5242
5616
|
ListItemButton4,
|
|
5243
5617
|
{
|
|
5244
5618
|
onClick: handleClick,
|
|
5245
5619
|
sx: { pl: level * 2 },
|
|
5246
5620
|
selected: isSelected,
|
|
5247
5621
|
children: [
|
|
5248
|
-
/* @__PURE__ */
|
|
5249
|
-
/* @__PURE__ */
|
|
5250
|
-
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
|
|
5251
5625
|
]
|
|
5252
5626
|
}
|
|
5253
5627
|
),
|
|
5254
|
-
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(
|
|
5255
5629
|
MenuListItem,
|
|
5256
5630
|
{
|
|
5257
5631
|
item: subItem,
|
|
@@ -5265,13 +5639,13 @@ var MenuListItem = ({ item, level, grupos = [], hermanos = [], onMenuItemClick }
|
|
|
5265
5639
|
] });
|
|
5266
5640
|
};
|
|
5267
5641
|
var ItemPlano = ({ hoja, seleccionado, traerALaVista = false, onElegir }) => {
|
|
5268
|
-
const boton =
|
|
5269
|
-
|
|
5642
|
+
const boton = useRef10(null);
|
|
5643
|
+
useEffect10(() => {
|
|
5270
5644
|
if (traerALaVista && seleccionado) boton.current?.scrollIntoView({ block: "nearest" });
|
|
5271
5645
|
}, [traerALaVista, seleccionado]);
|
|
5272
|
-
return /* @__PURE__ */
|
|
5273
|
-
/* @__PURE__ */
|
|
5274
|
-
/* @__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(
|
|
5275
5649
|
ListItemText3,
|
|
5276
5650
|
{
|
|
5277
5651
|
primary: etiquetaDeItem(hoja.item),
|
|
@@ -5286,14 +5660,14 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5286
5660
|
const navigate = useNavigate2();
|
|
5287
5661
|
const location = useLocation2();
|
|
5288
5662
|
const dispatch = useAppDispatch();
|
|
5289
|
-
const [consulta, setConsulta] =
|
|
5290
|
-
const [indice, setIndice] =
|
|
5291
|
-
const [recientes, setRecientes] =
|
|
5292
|
-
const campoDeBusqueda =
|
|
5663
|
+
const [consulta, setConsulta] = useState19("");
|
|
5664
|
+
const [indice, setIndice] = useState19(0);
|
|
5665
|
+
const [recientes, setRecientes] = useState19(leerRecientes);
|
|
5666
|
+
const campoDeBusqueda = useRef10(null);
|
|
5293
5667
|
const menu = clientContext?.menu;
|
|
5294
5668
|
const hojas = useMemo12(() => hojasDeMenu(menu ?? []), [menu]);
|
|
5295
5669
|
const resultados = useMemo12(() => buscarEnMenu(hojas, consulta), [hojas, consulta]);
|
|
5296
|
-
|
|
5670
|
+
useEffect10(() => {
|
|
5297
5671
|
const alApretar = (evento) => {
|
|
5298
5672
|
if ((evento.ctrlKey || evento.metaKey) && !evento.altKey && !evento.shiftKey && evento.key.toLowerCase() === "k") {
|
|
5299
5673
|
evento.preventDefault();
|
|
@@ -5307,7 +5681,7 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5307
5681
|
window.addEventListener("keydown", alApretar);
|
|
5308
5682
|
return () => window.removeEventListener("keydown", alApretar);
|
|
5309
5683
|
}, [dispatch]);
|
|
5310
|
-
|
|
5684
|
+
useEffect10(() => {
|
|
5311
5685
|
const actual = hojas.find((hoja) => estaSeleccionado(hoja.item, hoja.grupos, location.pathname, location.hash));
|
|
5312
5686
|
if (!actual) return;
|
|
5313
5687
|
dispatch(abrirCamino(actual.grupos.map((_, i) => claveDeMenu(actual.grupos.slice(0, i + 1)))));
|
|
@@ -5319,7 +5693,7 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5319
5693
|
});
|
|
5320
5694
|
}, [location.pathname, location.hash, hojas, dispatch]);
|
|
5321
5695
|
if (!menu) {
|
|
5322
|
-
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..." }) });
|
|
5323
5697
|
}
|
|
5324
5698
|
const elegir = (hoja) => {
|
|
5325
5699
|
navigate(rutaDeItemDeMenu(hoja.item, hoja.grupos));
|
|
@@ -5344,8 +5718,8 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5344
5718
|
}
|
|
5345
5719
|
};
|
|
5346
5720
|
const hojasRecientes = recientes.map((clave) => hojas.find((hoja) => hoja.clave === clave)).filter((hoja) => hoja !== void 0);
|
|
5347
|
-
return /* @__PURE__ */
|
|
5348
|
-
/* @__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(
|
|
5349
5723
|
TextField2,
|
|
5350
5724
|
{
|
|
5351
5725
|
inputRef: campoDeBusqueda,
|
|
@@ -5361,19 +5735,19 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5361
5735
|
autoComplete: "off",
|
|
5362
5736
|
sx: { "& .MuiInputBase-input": { fontSize: "0.8rem" } },
|
|
5363
5737
|
InputProps: {
|
|
5364
|
-
startAdornment: /* @__PURE__ */
|
|
5365
|
-
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: () => {
|
|
5366
5740
|
setConsulta("");
|
|
5367
5741
|
campoDeBusqueda.current?.focus();
|
|
5368
|
-
}, children: /* @__PURE__ */
|
|
5742
|
+
}, children: /* @__PURE__ */ jsx28(ClearIcon, { fontSize: "small" }) }) }) : void 0
|
|
5369
5743
|
}
|
|
5370
5744
|
}
|
|
5371
5745
|
) }),
|
|
5372
|
-
/* @__PURE__ */
|
|
5373
|
-
/* @__PURE__ */
|
|
5374
|
-
hojasRecientes.length > 0 && /* @__PURE__ */
|
|
5375
|
-
/* @__PURE__ */
|
|
5376
|
-
/* @__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(
|
|
5377
5751
|
ItemPlano,
|
|
5378
5752
|
{
|
|
5379
5753
|
hoja,
|
|
@@ -5382,9 +5756,9 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5382
5756
|
},
|
|
5383
5757
|
hoja.clave
|
|
5384
5758
|
)) }),
|
|
5385
|
-
/* @__PURE__ */
|
|
5759
|
+
/* @__PURE__ */ jsx28(Divider2, {})
|
|
5386
5760
|
] }),
|
|
5387
|
-
/* @__PURE__ */
|
|
5761
|
+
/* @__PURE__ */ jsx28(List4, { children: menu.map((menuItem) => /* @__PURE__ */ jsx28(
|
|
5388
5762
|
MenuListItem,
|
|
5389
5763
|
{
|
|
5390
5764
|
item: menuItem,
|
|
@@ -5430,7 +5804,7 @@ var useLogout = () => {
|
|
|
5430
5804
|
var useLogout_default = useLogout;
|
|
5431
5805
|
|
|
5432
5806
|
// src/components/MainLayout.tsx
|
|
5433
|
-
import { jsx as
|
|
5807
|
+
import { jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5434
5808
|
var drawerWidth = 240;
|
|
5435
5809
|
var MainLayout = () => {
|
|
5436
5810
|
const { clientContext } = useApp();
|
|
@@ -5440,7 +5814,7 @@ var MainLayout = () => {
|
|
|
5440
5814
|
const dispatch = useAppDispatch();
|
|
5441
5815
|
const theme = useTheme5();
|
|
5442
5816
|
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
|
5443
|
-
|
|
5817
|
+
useEffect11(() => {
|
|
5444
5818
|
if (isMobile && isDrawerOpen) {
|
|
5445
5819
|
dispatch(setDrawerOpen(false));
|
|
5446
5820
|
}
|
|
@@ -5454,11 +5828,11 @@ var MainLayout = () => {
|
|
|
5454
5828
|
}
|
|
5455
5829
|
};
|
|
5456
5830
|
if (!clientContext) {
|
|
5457
|
-
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..." }) });
|
|
5458
5832
|
}
|
|
5459
|
-
return /* @__PURE__ */
|
|
5460
|
-
/* @__PURE__ */
|
|
5461
|
-
/* @__PURE__ */
|
|
5833
|
+
return /* @__PURE__ */ jsxs21(Box17, { sx: { display: "flex", height: "100vh" }, children: [
|
|
5834
|
+
/* @__PURE__ */ jsx29(CssBaseline, {}),
|
|
5835
|
+
/* @__PURE__ */ jsx29(
|
|
5462
5836
|
AppBar,
|
|
5463
5837
|
{
|
|
5464
5838
|
position: "fixed",
|
|
@@ -5477,8 +5851,8 @@ var MainLayout = () => {
|
|
|
5477
5851
|
})
|
|
5478
5852
|
}
|
|
5479
5853
|
},
|
|
5480
|
-
children: /* @__PURE__ */
|
|
5481
|
-
/* @__PURE__ */
|
|
5854
|
+
children: /* @__PURE__ */ jsxs21(Toolbar, { children: [
|
|
5855
|
+
/* @__PURE__ */ jsx29(
|
|
5482
5856
|
IconButton8,
|
|
5483
5857
|
{
|
|
5484
5858
|
color: "inherit",
|
|
@@ -5488,10 +5862,10 @@ var MainLayout = () => {
|
|
|
5488
5862
|
sx: {
|
|
5489
5863
|
marginRight: 2
|
|
5490
5864
|
},
|
|
5491
|
-
children: isDrawerOpen ? /* @__PURE__ */
|
|
5865
|
+
children: isDrawerOpen ? /* @__PURE__ */ jsx29(ChevronLeftIcon, {}) : /* @__PURE__ */ jsx29(MenuIcon, {})
|
|
5492
5866
|
}
|
|
5493
5867
|
),
|
|
5494
|
-
!isDrawerOpen && /* @__PURE__ */
|
|
5868
|
+
!isDrawerOpen && /* @__PURE__ */ jsx29(
|
|
5495
5869
|
"img",
|
|
5496
5870
|
{
|
|
5497
5871
|
src: `${envConfig.backendUrl}/img/logo-128.png`,
|
|
@@ -5499,22 +5873,22 @@ var MainLayout = () => {
|
|
|
5499
5873
|
style: { height: "32px", marginRight: "12px", objectFit: "contain" }
|
|
5500
5874
|
}
|
|
5501
5875
|
),
|
|
5502
|
-
/* @__PURE__ */
|
|
5503
|
-
/* @__PURE__ */
|
|
5504
|
-
/* @__PURE__ */
|
|
5505
|
-
/* @__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(
|
|
5506
5880
|
Button8,
|
|
5507
5881
|
{
|
|
5508
5882
|
color: "inherit",
|
|
5509
5883
|
onClick: logout,
|
|
5510
|
-
startIcon: /* @__PURE__ */
|
|
5884
|
+
startIcon: /* @__PURE__ */ jsx29(LogoutIcon, {}),
|
|
5511
5885
|
children: "Salir"
|
|
5512
5886
|
}
|
|
5513
5887
|
)
|
|
5514
5888
|
] })
|
|
5515
5889
|
}
|
|
5516
5890
|
),
|
|
5517
|
-
/* @__PURE__ */
|
|
5891
|
+
/* @__PURE__ */ jsxs21(
|
|
5518
5892
|
Drawer,
|
|
5519
5893
|
{
|
|
5520
5894
|
variant: "persistent",
|
|
@@ -5532,7 +5906,7 @@ var MainLayout = () => {
|
|
|
5532
5906
|
}
|
|
5533
5907
|
},
|
|
5534
5908
|
children: [
|
|
5535
|
-
/* @__PURE__ */
|
|
5909
|
+
/* @__PURE__ */ jsxs21(
|
|
5536
5910
|
Toolbar,
|
|
5537
5911
|
{
|
|
5538
5912
|
sx: {
|
|
@@ -5547,7 +5921,7 @@ var MainLayout = () => {
|
|
|
5547
5921
|
gap: 1.5
|
|
5548
5922
|
},
|
|
5549
5923
|
children: [
|
|
5550
|
-
/* @__PURE__ */
|
|
5924
|
+
/* @__PURE__ */ jsx29(
|
|
5551
5925
|
"img",
|
|
5552
5926
|
{
|
|
5553
5927
|
src: `${envConfig.backendUrl}/img/logo-128.png`,
|
|
@@ -5555,16 +5929,16 @@ var MainLayout = () => {
|
|
|
5555
5929
|
style: { height: "32px", objectFit: "contain" }
|
|
5556
5930
|
}
|
|
5557
5931
|
),
|
|
5558
|
-
/* @__PURE__ */
|
|
5932
|
+
/* @__PURE__ */ jsx29(Typography13, { variant: "h6", sx: { fontWeight: "bold" }, children: clientContext.config.title })
|
|
5559
5933
|
]
|
|
5560
5934
|
}
|
|
5561
5935
|
),
|
|
5562
|
-
/* @__PURE__ */
|
|
5936
|
+
/* @__PURE__ */ jsx29(SideMenu_default, { onMenuItemClick: handleDrawerCloseMobile })
|
|
5563
5937
|
]
|
|
5564
5938
|
}
|
|
5565
5939
|
),
|
|
5566
|
-
/* @__PURE__ */
|
|
5567
|
-
|
|
5940
|
+
/* @__PURE__ */ jsxs21(
|
|
5941
|
+
Box17,
|
|
5568
5942
|
{
|
|
5569
5943
|
component: "main",
|
|
5570
5944
|
sx: {
|
|
@@ -5590,8 +5964,8 @@ var MainLayout = () => {
|
|
|
5590
5964
|
width: isDrawerOpen ? `calc(100% - ${drawerWidth}px)` : "100%"
|
|
5591
5965
|
},
|
|
5592
5966
|
children: [
|
|
5593
|
-
/* @__PURE__ */
|
|
5594
|
-
/* @__PURE__ */
|
|
5967
|
+
/* @__PURE__ */ jsx29(Toolbar, {}),
|
|
5968
|
+
/* @__PURE__ */ jsx29(Box17, { sx: { flex: 1, minHeight: 0, overflowY: "auto", display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ jsx29(Outlet, {}) })
|
|
5595
5969
|
]
|
|
5596
5970
|
}
|
|
5597
5971
|
)
|
|
@@ -5600,8 +5974,8 @@ var MainLayout = () => {
|
|
|
5600
5974
|
var MainLayout_default = MainLayout;
|
|
5601
5975
|
|
|
5602
5976
|
// src/components/SessionExpiredMessage.tsx
|
|
5603
|
-
import { Box as
|
|
5604
|
-
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";
|
|
5605
5979
|
var style = {
|
|
5606
5980
|
position: "absolute",
|
|
5607
5981
|
top: "50%",
|
|
@@ -5620,7 +5994,7 @@ var SessionExpiredMessage = () => {
|
|
|
5620
5994
|
const handleClose = () => {
|
|
5621
5995
|
handleExpiredSessionRedirect();
|
|
5622
5996
|
};
|
|
5623
|
-
return /* @__PURE__ */
|
|
5997
|
+
return /* @__PURE__ */ jsx30(
|
|
5624
5998
|
Modal,
|
|
5625
5999
|
{
|
|
5626
6000
|
open: showSessionExpiredMessage,
|
|
@@ -5640,10 +6014,10 @@ var SessionExpiredMessage = () => {
|
|
|
5640
6014
|
}
|
|
5641
6015
|
}
|
|
5642
6016
|
},
|
|
5643
|
-
children: /* @__PURE__ */
|
|
5644
|
-
/* @__PURE__ */
|
|
5645
|
-
/* @__PURE__ */
|
|
5646
|
-
/* @__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" })
|
|
5647
6021
|
] })
|
|
5648
6022
|
}
|
|
5649
6023
|
);
|
|
@@ -5652,24 +6026,24 @@ var SessionExpiredMessage_default = SessionExpiredMessage;
|
|
|
5652
6026
|
|
|
5653
6027
|
// src/pages/PantallaInicial.tsx
|
|
5654
6028
|
import { Navigate } from "react-router-dom";
|
|
5655
|
-
import { jsx as
|
|
6029
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
5656
6030
|
var PantallaInicial = () => {
|
|
5657
6031
|
const { clientContext } = useApp();
|
|
5658
6032
|
const item = clientContext.menu ? itemInicial(clientContext.menu) : void 0;
|
|
5659
|
-
return item && clientContext.menu ? /* @__PURE__ */
|
|
6033
|
+
return item && clientContext.menu ? /* @__PURE__ */ jsx31(Navigate, { to: rutaDeItemDeMenu(item, gruposDeItem(clientContext.menu, item)), replace: true }) : null;
|
|
5660
6034
|
};
|
|
5661
6035
|
var PantallaInicial_default = PantallaInicial;
|
|
5662
6036
|
|
|
5663
6037
|
// src/pages/LogoutPage.tsx
|
|
5664
|
-
import { useEffect as
|
|
5665
|
-
import { Box as
|
|
5666
|
-
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";
|
|
5667
6041
|
var LogoutPage = () => {
|
|
5668
6042
|
const logout = useLogout_default();
|
|
5669
|
-
|
|
6043
|
+
useEffect12(() => {
|
|
5670
6044
|
logout();
|
|
5671
6045
|
}, [logout]);
|
|
5672
|
-
return /* @__PURE__ */
|
|
6046
|
+
return /* @__PURE__ */ jsxs23(Box19, { sx: {
|
|
5673
6047
|
display: "flex",
|
|
5674
6048
|
flexDirection: "column",
|
|
5675
6049
|
justifyContent: "center",
|
|
@@ -5677,15 +6051,15 @@ var LogoutPage = () => {
|
|
|
5677
6051
|
height: "100vh",
|
|
5678
6052
|
textAlign: "center"
|
|
5679
6053
|
}, children: [
|
|
5680
|
-
/* @__PURE__ */
|
|
5681
|
-
/* @__PURE__ */
|
|
6054
|
+
/* @__PURE__ */ jsx32(CircularProgress6, { size: 60 }),
|
|
6055
|
+
/* @__PURE__ */ jsx32(Typography15, { variant: "h6", sx: { mt: 2 }, children: "Cerrando sesi\xF3n..." })
|
|
5682
6056
|
] });
|
|
5683
6057
|
};
|
|
5684
6058
|
var LogoutPage_default = LogoutPage;
|
|
5685
6059
|
|
|
5686
6060
|
// src/pages/LoginPage.tsx
|
|
5687
|
-
import { useState as
|
|
5688
|
-
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";
|
|
5689
6063
|
import { useLocation as useLocation3 } from "react-router-dom";
|
|
5690
6064
|
|
|
5691
6065
|
// src/pages/configuracionLogin.ts
|
|
@@ -5701,7 +6075,7 @@ import { useForm, Controller } from "react-hook-form";
|
|
|
5701
6075
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
5702
6076
|
import * as z from "zod";
|
|
5703
6077
|
import { useDispatch as useDispatch4 } from "react-redux";
|
|
5704
|
-
import { Fragment as Fragment6, jsx as
|
|
6078
|
+
import { Fragment as Fragment6, jsx as jsx33, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5705
6079
|
var loginSchema = z.object({
|
|
5706
6080
|
username: z.string().min(1, "El usuario es requerido"),
|
|
5707
6081
|
// Añadir validación básica
|
|
@@ -5709,8 +6083,8 @@ var loginSchema = z.object({
|
|
|
5709
6083
|
// Añadir validación básica
|
|
5710
6084
|
});
|
|
5711
6085
|
var LoginPage = () => {
|
|
5712
|
-
const [loginError, setLoginError] =
|
|
5713
|
-
const [isSubmitting, setIsSubmitting] =
|
|
6086
|
+
const [loginError, setLoginError] = useState20(null);
|
|
6087
|
+
const [isSubmitting, setIsSubmitting] = useState20(false);
|
|
5714
6088
|
const estadoDeLaRuta = useLocation3().state;
|
|
5715
6089
|
const claveCambiada = typeof estadoDeLaRuta === "object" && estadoDeLaRuta !== null && "claveCambiada" in estadoDeLaRuta && estadoDeLaRuta.claveCambiada === true;
|
|
5716
6090
|
const rutaDeRecuperarClave2 = rutaParaRecuperarClave();
|
|
@@ -5759,16 +6133,16 @@ var LoginPage = () => {
|
|
|
5759
6133
|
setIsSubmitting(false);
|
|
5760
6134
|
}
|
|
5761
6135
|
};
|
|
5762
|
-
return /* @__PURE__ */
|
|
5763
|
-
|
|
6136
|
+
return /* @__PURE__ */ jsx33(
|
|
6137
|
+
Box20,
|
|
5764
6138
|
{
|
|
5765
6139
|
display: "flex",
|
|
5766
6140
|
alignItems: "center",
|
|
5767
6141
|
justifyContent: "center",
|
|
5768
6142
|
minHeight: "100vh",
|
|
5769
6143
|
bgcolor: "#f5f5f5",
|
|
5770
|
-
children: /* @__PURE__ */
|
|
5771
|
-
|
|
6144
|
+
children: /* @__PURE__ */ jsxs24(
|
|
6145
|
+
Box20,
|
|
5772
6146
|
{
|
|
5773
6147
|
width: "100%",
|
|
5774
6148
|
maxWidth: "400px",
|
|
@@ -5777,7 +6151,7 @@ var LoginPage = () => {
|
|
|
5777
6151
|
borderRadius: 8,
|
|
5778
6152
|
boxShadow: 3,
|
|
5779
6153
|
children: [
|
|
5780
|
-
/* @__PURE__ */
|
|
6154
|
+
/* @__PURE__ */ jsx33(Box20, { sx: { display: "flex", justifyContent: "center", mb: 3 }, children: /* @__PURE__ */ jsx33(
|
|
5781
6155
|
"img",
|
|
5782
6156
|
{
|
|
5783
6157
|
src: `${envConfig.backendUrl}/img/login-logo-icon.png`,
|
|
@@ -5785,8 +6159,8 @@ var LoginPage = () => {
|
|
|
5785
6159
|
style: { height: "192px", maxWidth: "100%", objectFit: "contain" }
|
|
5786
6160
|
}
|
|
5787
6161
|
) }),
|
|
5788
|
-
/* @__PURE__ */
|
|
5789
|
-
/* @__PURE__ */
|
|
6162
|
+
/* @__PURE__ */ jsx33(Typography16, { variant: "h5", align: "center", gutterBottom: true, sx: { fontWeight: "bold", color: "primary.main" }, children: "Iniciar Sesi\xF3n" }),
|
|
6163
|
+
/* @__PURE__ */ jsxs24(
|
|
5790
6164
|
"form",
|
|
5791
6165
|
{
|
|
5792
6166
|
onSubmit: handleSubmit(onSubmit),
|
|
@@ -5798,14 +6172,14 @@ var LoginPage = () => {
|
|
|
5798
6172
|
if (!isSubmitting) void handleSubmit(onSubmit)();
|
|
5799
6173
|
},
|
|
5800
6174
|
children: [
|
|
5801
|
-
/* @__PURE__ */
|
|
5802
|
-
/* @__PURE__ */
|
|
5803
|
-
/* @__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(
|
|
5804
6178
|
Controller,
|
|
5805
6179
|
{
|
|
5806
6180
|
name: "username",
|
|
5807
6181
|
control,
|
|
5808
|
-
render: ({ field }) => /* @__PURE__ */
|
|
6182
|
+
render: ({ field }) => /* @__PURE__ */ jsx33(
|
|
5809
6183
|
TextField3,
|
|
5810
6184
|
{
|
|
5811
6185
|
...field,
|
|
@@ -5823,14 +6197,14 @@ var LoginPage = () => {
|
|
|
5823
6197
|
}
|
|
5824
6198
|
)
|
|
5825
6199
|
] }),
|
|
5826
|
-
/* @__PURE__ */
|
|
5827
|
-
/* @__PURE__ */
|
|
5828
|
-
/* @__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(
|
|
5829
6203
|
Controller,
|
|
5830
6204
|
{
|
|
5831
6205
|
name: "password",
|
|
5832
6206
|
control,
|
|
5833
|
-
render: ({ field }) => /* @__PURE__ */
|
|
6207
|
+
render: ({ field }) => /* @__PURE__ */ jsx33(
|
|
5834
6208
|
TextField3,
|
|
5835
6209
|
{
|
|
5836
6210
|
...field,
|
|
@@ -5848,18 +6222,18 @@ var LoginPage = () => {
|
|
|
5848
6222
|
}
|
|
5849
6223
|
)
|
|
5850
6224
|
] }),
|
|
5851
|
-
/* @__PURE__ */
|
|
5852
|
-
/* @__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 } }),
|
|
5853
6227
|
"Iniciando sesi\xF3n..."
|
|
5854
6228
|
] }) : "Iniciar Sesi\xF3n" })
|
|
5855
6229
|
]
|
|
5856
6230
|
}
|
|
5857
6231
|
),
|
|
5858
|
-
rutaDeRecuperarClave2 && /* @__PURE__ */
|
|
5859
|
-
claveCambiada && !loginError && /* @__PURE__ */
|
|
5860
|
-
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: [
|
|
5861
6235
|
" ",
|
|
5862
|
-
/* @__PURE__ */
|
|
6236
|
+
/* @__PURE__ */ jsx33(AlertTitle, { children: "Error" }),
|
|
5863
6237
|
loginError
|
|
5864
6238
|
] })
|
|
5865
6239
|
]
|
|
@@ -5871,8 +6245,8 @@ var LoginPage = () => {
|
|
|
5871
6245
|
var LoginPage_default = LoginPage;
|
|
5872
6246
|
|
|
5873
6247
|
// src/components/ProcedureForm.tsx
|
|
5874
|
-
import
|
|
5875
|
-
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";
|
|
5876
6250
|
import {
|
|
5877
6251
|
TextField as TextField4,
|
|
5878
6252
|
Button as Button11,
|
|
@@ -5884,22 +6258,22 @@ import {
|
|
|
5884
6258
|
FormControlLabel as FormControlLabel3,
|
|
5885
6259
|
FormHelperText as FormHelperText2,
|
|
5886
6260
|
Typography as Typography18,
|
|
5887
|
-
Box as
|
|
5888
|
-
CircularProgress as
|
|
5889
|
-
Alert as
|
|
6261
|
+
Box as Box22,
|
|
6262
|
+
CircularProgress as CircularProgress8,
|
|
6263
|
+
Alert as Alert5,
|
|
5890
6264
|
Divider as Divider3,
|
|
5891
6265
|
Paper as Paper4
|
|
5892
6266
|
} from "@mui/material";
|
|
5893
6267
|
|
|
5894
6268
|
// src/pages/procedure-results/SuccessDisplay.tsx
|
|
5895
|
-
import { Box as
|
|
5896
|
-
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";
|
|
5897
6271
|
var SuccessDisplay = ({ data }) => {
|
|
5898
|
-
return /* @__PURE__ */
|
|
5899
|
-
/* @__PURE__ */
|
|
5900
|
-
/* @__PURE__ */
|
|
5901
|
-
/* @__PURE__ */
|
|
5902
|
-
/* @__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." })
|
|
5903
6277
|
] });
|
|
5904
6278
|
};
|
|
5905
6279
|
var SuccessDisplay_default = SuccessDisplay;
|
|
@@ -5913,22 +6287,22 @@ var extendResultsOk = (newComponents) => {
|
|
|
5913
6287
|
};
|
|
5914
6288
|
|
|
5915
6289
|
// src/components/ProcedureForm.tsx
|
|
5916
|
-
import { jsx as
|
|
6290
|
+
import { jsx as jsx35, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5917
6291
|
var ProcedureForm = () => {
|
|
5918
|
-
const { procedureName } =
|
|
6292
|
+
const { procedureName } = useParams2();
|
|
5919
6293
|
const { clientContext } = useApp();
|
|
5920
6294
|
const { callApi, loading: apiLoading, error: apiError } = useApiCall();
|
|
5921
|
-
const [validationErrors, setValidationErrors] =
|
|
5922
|
-
const [successMessage, setSuccessMessage] =
|
|
5923
|
-
const [executionLog, setExecutionLog] =
|
|
5924
|
-
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);
|
|
5925
6299
|
const procedure = useMemo13(() => {
|
|
5926
6300
|
if (procedureName && clientContext?.procedure) {
|
|
5927
6301
|
return clientContext.procedure[procedureName];
|
|
5928
6302
|
}
|
|
5929
6303
|
return void 0;
|
|
5930
6304
|
}, [procedureName, clientContext]);
|
|
5931
|
-
const [formValues, setFormValues] =
|
|
6305
|
+
const [formValues, setFormValues] = useState21(() => {
|
|
5932
6306
|
if (!procedure) return {};
|
|
5933
6307
|
const initialValues = {};
|
|
5934
6308
|
procedure.parameters.forEach((param) => {
|
|
@@ -5953,7 +6327,7 @@ var ProcedureForm = () => {
|
|
|
5953
6327
|
});
|
|
5954
6328
|
return initialValues;
|
|
5955
6329
|
});
|
|
5956
|
-
|
|
6330
|
+
React25.useEffect(() => {
|
|
5957
6331
|
if (procedure) {
|
|
5958
6332
|
setValidationErrors({});
|
|
5959
6333
|
setSuccessMessage(null);
|
|
@@ -6128,9 +6502,9 @@ var ProcedureForm = () => {
|
|
|
6128
6502
|
sx: { fontSize: "0.8rem" }
|
|
6129
6503
|
};
|
|
6130
6504
|
if (param.options && param.options.length > 0) {
|
|
6131
|
-
return /* @__PURE__ */
|
|
6132
|
-
/* @__PURE__ */
|
|
6133
|
-
/* @__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(
|
|
6134
6508
|
Select2,
|
|
6135
6509
|
{
|
|
6136
6510
|
labelId: `${param.name}-label`,
|
|
@@ -6141,14 +6515,14 @@ var ProcedureForm = () => {
|
|
|
6141
6515
|
label: param.label || param.name,
|
|
6142
6516
|
disabled: apiLoading,
|
|
6143
6517
|
sx: { fontSize: "0.8rem" },
|
|
6144
|
-
renderValue: (selected) => /* @__PURE__ */
|
|
6518
|
+
renderValue: (selected) => /* @__PURE__ */ jsx35(Typography18, { sx: { fontSize: "0.8rem" }, children: selected }),
|
|
6145
6519
|
children: [
|
|
6146
|
-
(!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */
|
|
6147
|
-
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))
|
|
6148
6522
|
]
|
|
6149
6523
|
}
|
|
6150
6524
|
),
|
|
6151
|
-
(param.description || errorMessage) && /* @__PURE__ */
|
|
6525
|
+
(param.description || errorMessage) && /* @__PURE__ */ jsx35(FormHelperText2, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
|
|
6152
6526
|
] });
|
|
6153
6527
|
}
|
|
6154
6528
|
switch (param.typeName) {
|
|
@@ -6157,18 +6531,18 @@ var ProcedureForm = () => {
|
|
|
6157
6531
|
case "tsrange":
|
|
6158
6532
|
case "time_range":
|
|
6159
6533
|
case "daterange":
|
|
6160
|
-
return /* @__PURE__ */
|
|
6534
|
+
return /* @__PURE__ */ jsx35(TextField4, { type: "text", value: formValues[param.name] || "", ...commonProps });
|
|
6161
6535
|
case "decimal":
|
|
6162
6536
|
case "double":
|
|
6163
|
-
return /* @__PURE__ */
|
|
6537
|
+
return /* @__PURE__ */ jsx35(TextField4, { type: "number", inputProps: { step: "any", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
|
|
6164
6538
|
case "integer":
|
|
6165
6539
|
case "bigint":
|
|
6166
|
-
return /* @__PURE__ */
|
|
6540
|
+
return /* @__PURE__ */ jsx35(TextField4, { type: "number", inputProps: { step: "1", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
|
|
6167
6541
|
case "boolean":
|
|
6168
|
-
return /* @__PURE__ */
|
|
6542
|
+
return /* @__PURE__ */ jsx35(
|
|
6169
6543
|
FormControlLabel3,
|
|
6170
6544
|
{
|
|
6171
|
-
control: /* @__PURE__ */
|
|
6545
|
+
control: /* @__PURE__ */ jsx35(
|
|
6172
6546
|
Checkbox3,
|
|
6173
6547
|
{
|
|
6174
6548
|
checked: !!formValues[param.name],
|
|
@@ -6179,21 +6553,21 @@ var ProcedureForm = () => {
|
|
|
6179
6553
|
size: "small"
|
|
6180
6554
|
}
|
|
6181
6555
|
),
|
|
6182
|
-
label: /* @__PURE__ */
|
|
6556
|
+
label: /* @__PURE__ */ jsx35(Typography18, { sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "inherit" }, children: param.label || param.name }),
|
|
6183
6557
|
sx: { mt: 1, mb: 0 }
|
|
6184
6558
|
}
|
|
6185
6559
|
);
|
|
6186
6560
|
case "date":
|
|
6187
6561
|
case "timestamp":
|
|
6188
6562
|
case "time":
|
|
6189
|
-
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" } } });
|
|
6190
6564
|
case "jsonb":
|
|
6191
6565
|
case "jsona":
|
|
6192
|
-
return /* @__PURE__ */
|
|
6566
|
+
return /* @__PURE__ */ jsx35(TextField4, { multiline: true, rows: 5, value: formValues[param.name] || "", ...commonProps, InputProps: { sx: { fontSize: "0.8rem" } } });
|
|
6193
6567
|
case "bytea":
|
|
6194
|
-
return /* @__PURE__ */
|
|
6195
|
-
/* @__PURE__ */
|
|
6196
|
-
/* @__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(
|
|
6197
6571
|
"input",
|
|
6198
6572
|
{
|
|
6199
6573
|
type: "file",
|
|
@@ -6207,34 +6581,34 @@ var ProcedureForm = () => {
|
|
|
6207
6581
|
style: { padding: "6px 0", fontSize: "0.8rem" }
|
|
6208
6582
|
}
|
|
6209
6583
|
),
|
|
6210
|
-
(param.description || errorMessage) && /* @__PURE__ */
|
|
6584
|
+
(param.description || errorMessage) && /* @__PURE__ */ jsx35(FormHelperText2, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
|
|
6211
6585
|
] });
|
|
6212
6586
|
default:
|
|
6213
|
-
return /* @__PURE__ */
|
|
6587
|
+
return /* @__PURE__ */ jsx35(TextField4, { type: "text", value: formValues[param.name] || "", ...commonProps });
|
|
6214
6588
|
}
|
|
6215
6589
|
}, [formValues, handleChange, apiLoading, validationErrors]);
|
|
6216
6590
|
const ResultDisplayContent = useMemo13(() => {
|
|
6217
6591
|
if (!procedureResultData || !procedure?.resultOk) return null;
|
|
6218
6592
|
const ComponentToRender = resultsOk[procedure.resultOk];
|
|
6219
6593
|
if (ComponentToRender) {
|
|
6220
|
-
return /* @__PURE__ */
|
|
6594
|
+
return /* @__PURE__ */ jsx35(ComponentToRender, { data: procedureResultData });
|
|
6221
6595
|
} else {
|
|
6222
|
-
return /* @__PURE__ */
|
|
6223
|
-
/* @__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: [
|
|
6224
6598
|
"el componente para resolver el resultOk: '",
|
|
6225
6599
|
procedure.resultOk,
|
|
6226
6600
|
"' definido en el procedure no existe o no est\xE1 mapeado."
|
|
6227
6601
|
] }),
|
|
6228
|
-
/* @__PURE__ */
|
|
6602
|
+
/* @__PURE__ */ jsx35(Box22, { sx: {
|
|
6229
6603
|
bgcolor: "warning.dark",
|
|
6230
6604
|
p: 1,
|
|
6231
6605
|
borderRadius: 1
|
|
6232
|
-
}, children: /* @__PURE__ */
|
|
6606
|
+
}, children: /* @__PURE__ */ jsx35("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(procedureResultData, null, 2) }) })
|
|
6233
6607
|
] });
|
|
6234
6608
|
}
|
|
6235
6609
|
}, [procedureResultData, procedure]);
|
|
6236
6610
|
if (!procedure) {
|
|
6237
|
-
return /* @__PURE__ */
|
|
6611
|
+
return /* @__PURE__ */ jsxs26(Box22, { sx: {
|
|
6238
6612
|
p: 2,
|
|
6239
6613
|
width: "100%",
|
|
6240
6614
|
boxSizing: "border-box",
|
|
@@ -6244,13 +6618,13 @@ var ProcedureForm = () => {
|
|
|
6244
6618
|
boxShadow: 3,
|
|
6245
6619
|
textAlign: "center"
|
|
6246
6620
|
}, children: [
|
|
6247
|
-
/* @__PURE__ */
|
|
6248
|
-
/* @__PURE__ */
|
|
6621
|
+
/* @__PURE__ */ jsx35(CircularProgress8, { sx: { mb: 2 } }),
|
|
6622
|
+
/* @__PURE__ */ jsx35(Typography18, { variant: "h6", color: "text.secondary", children: "Cargando procedimiento o no encontrado..." })
|
|
6249
6623
|
] });
|
|
6250
6624
|
}
|
|
6251
6625
|
return (
|
|
6252
6626
|
// Esta es la Box más externa que ahora controlará el scroll
|
|
6253
|
-
/* @__PURE__ */
|
|
6627
|
+
/* @__PURE__ */ jsxs26(Box22, { sx: {
|
|
6254
6628
|
p: 2,
|
|
6255
6629
|
ml: 1,
|
|
6256
6630
|
mt: 2,
|
|
@@ -6267,16 +6641,16 @@ var ProcedureForm = () => {
|
|
|
6267
6641
|
overflowX: "hidden"
|
|
6268
6642
|
// Oculta el scroll horizontal si no es necesario para el contenedor principal
|
|
6269
6643
|
}, children: [
|
|
6270
|
-
/* @__PURE__ */
|
|
6271
|
-
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: [
|
|
6272
6646
|
"Por favor, corrige los errores en el formulario antes de enviar.",
|
|
6273
|
-
/* @__PURE__ */
|
|
6647
|
+
/* @__PURE__ */ jsx35("ul", { children: Object.values(validationErrors).map((err, idx) => err && /* @__PURE__ */ jsx35("li", { children: err }, idx)) })
|
|
6274
6648
|
] }),
|
|
6275
|
-
!Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */
|
|
6276
|
-
!Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */
|
|
6277
|
-
/* @__PURE__ */
|
|
6278
|
-
procedure.parameters.map((param) => /* @__PURE__ */
|
|
6279
|
-
/* @__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(
|
|
6280
6654
|
Button11,
|
|
6281
6655
|
{
|
|
6282
6656
|
type: "submit",
|
|
@@ -6285,20 +6659,20 @@ var ProcedureForm = () => {
|
|
|
6285
6659
|
disabled: apiLoading || Object.values(validationErrors).some((err) => err !== null),
|
|
6286
6660
|
sx: { mt: 2 },
|
|
6287
6661
|
size: "medium",
|
|
6288
|
-
startIcon: apiLoading ? /* @__PURE__ */
|
|
6662
|
+
startIcon: apiLoading ? /* @__PURE__ */ jsx35(CircularProgress8, { size: 20, color: "inherit" }) : null,
|
|
6289
6663
|
children: apiLoading ? "Ejecutando..." : procedure.proceedLabel || "Ejecutar"
|
|
6290
6664
|
}
|
|
6291
6665
|
)
|
|
6292
6666
|
] }),
|
|
6293
|
-
ResultDisplayContent && /* @__PURE__ */
|
|
6667
|
+
ResultDisplayContent && /* @__PURE__ */ jsxs26(Box22, { sx: { mt: 2 }, children: [
|
|
6294
6668
|
" ",
|
|
6295
6669
|
ResultDisplayContent
|
|
6296
6670
|
] }),
|
|
6297
|
-
executionLog.length > 0 && /* @__PURE__ */
|
|
6298
|
-
/* @__PURE__ */
|
|
6299
|
-
/* @__PURE__ */
|
|
6300
|
-
/* @__PURE__ */
|
|
6301
|
-
|
|
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,
|
|
6302
6676
|
{
|
|
6303
6677
|
sx: {
|
|
6304
6678
|
bgcolor: "grey.100",
|
|
@@ -6311,7 +6685,7 @@ var ProcedureForm = () => {
|
|
|
6311
6685
|
fontSize: "0.75rem",
|
|
6312
6686
|
whiteSpace: "pre-wrap"
|
|
6313
6687
|
},
|
|
6314
|
-
children: executionLog.map((log, index) => /* @__PURE__ */
|
|
6688
|
+
children: executionLog.map((log, index) => /* @__PURE__ */ jsx35(
|
|
6315
6689
|
Typography18,
|
|
6316
6690
|
{
|
|
6317
6691
|
component: "pre",
|
|
@@ -6337,9 +6711,9 @@ import { Provider } from "react-redux";
|
|
|
6337
6711
|
import { PersistGate } from "redux-persist/integration/react";
|
|
6338
6712
|
|
|
6339
6713
|
// src/components/PrivateRoute.tsx
|
|
6340
|
-
import { useEffect as
|
|
6714
|
+
import { useEffect as useEffect13 } from "react";
|
|
6341
6715
|
import { Navigate as Navigate2, useLocation as useLocation4 } from "react-router-dom";
|
|
6342
|
-
import { Fragment as Fragment7, jsx as
|
|
6716
|
+
import { Fragment as Fragment7, jsx as jsx36 } from "react/jsx-runtime";
|
|
6343
6717
|
var PrivateRoute = ({ children }) => {
|
|
6344
6718
|
const location = useLocation4();
|
|
6345
6719
|
const dispatch = useAppDispatch();
|
|
@@ -6347,7 +6721,7 @@ var PrivateRoute = ({ children }) => {
|
|
|
6347
6721
|
const isAuthenticated = clientContextStatus === "succeeded";
|
|
6348
6722
|
const isLoadingAuth = clientContextStatus === "loading";
|
|
6349
6723
|
console.log(`[PrivateRoute] Render: Path=${location.pathname}, AuthStatus=${clientContextStatus}, IsAuthenticated=${isAuthenticated}, IsLoadingAuth=${isLoadingAuth}`);
|
|
6350
|
-
|
|
6724
|
+
useEffect13(() => {
|
|
6351
6725
|
console.log(`[PrivateRoute] Effect: Path=${location.pathname}, AuthStatus=${clientContextStatus}, IsAuthenticated=${isAuthenticated}, IsLoadingAuth=${isLoadingAuth}`);
|
|
6352
6726
|
if (!isAuthenticated && !isLoadingAuth && location.pathname !== "/login" && !huboCierreVoluntario()) {
|
|
6353
6727
|
const path = location.pathname + location.search + location.hash;
|
|
@@ -6363,19 +6737,19 @@ var PrivateRoute = ({ children }) => {
|
|
|
6363
6737
|
}, [isAuthenticated, isLoadingAuth, location, dispatch, clientContextStatus]);
|
|
6364
6738
|
if (isLoadingAuth) {
|
|
6365
6739
|
console.log(`[PrivateRoute] Returning loading state...`);
|
|
6366
|
-
return /* @__PURE__ */
|
|
6740
|
+
return /* @__PURE__ */ jsx36("p", { children: "Verificando autenticaci\xF3n..." });
|
|
6367
6741
|
}
|
|
6368
6742
|
if (!isAuthenticated) {
|
|
6369
6743
|
console.log(`[PrivateRoute] User not authenticated, navigating to /login`);
|
|
6370
|
-
return /* @__PURE__ */
|
|
6744
|
+
return /* @__PURE__ */ jsx36(Navigate2, { to: "/login", replace: true });
|
|
6371
6745
|
}
|
|
6372
6746
|
console.log(`[PrivateRoute] User authenticated, rendering children.`);
|
|
6373
|
-
return /* @__PURE__ */
|
|
6747
|
+
return /* @__PURE__ */ jsx36(Fragment7, { children });
|
|
6374
6748
|
};
|
|
6375
6749
|
var PrivateRoute_default = PrivateRoute;
|
|
6376
6750
|
|
|
6377
6751
|
// src/components/InitialRedirectHandler.tsx
|
|
6378
|
-
import { useEffect as
|
|
6752
|
+
import { useEffect as useEffect14, useRef as useRef11 } from "react";
|
|
6379
6753
|
import { useLocation as useLocation5, useNavigate as useNavigate5 } from "react-router-dom";
|
|
6380
6754
|
var InitialRedirectHandler = () => {
|
|
6381
6755
|
const location = useLocation5();
|
|
@@ -6385,14 +6759,14 @@ var InitialRedirectHandler = () => {
|
|
|
6385
6759
|
const clientContextStatus = useClientContextStatus();
|
|
6386
6760
|
const username = useAppSelector((state) => state.clientContext.username);
|
|
6387
6761
|
const redirectUsername = useAppSelector((state) => state.router.redirectUsername);
|
|
6388
|
-
|
|
6762
|
+
useEffect14(() => {
|
|
6389
6763
|
dispatch(setCurrentPath(location.pathname + location.search));
|
|
6390
6764
|
}, [location, dispatch]);
|
|
6391
|
-
const navegandoRef =
|
|
6392
|
-
|
|
6765
|
+
const navegandoRef = useRef11(false);
|
|
6766
|
+
useEffect14(() => {
|
|
6393
6767
|
navegandoRef.current = false;
|
|
6394
6768
|
}, [location.pathname]);
|
|
6395
|
-
|
|
6769
|
+
useEffect14(() => {
|
|
6396
6770
|
if (clientContextStatus === "succeeded") {
|
|
6397
6771
|
if (redirectPath && redirectPath !== "/login" && redirectUsername && redirectUsername !== username) {
|
|
6398
6772
|
dispatch(setRedirectPath(null));
|
|
@@ -6412,26 +6786,26 @@ var InitialRedirectHandler = () => {
|
|
|
6412
6786
|
var InitialRedirectHandler_default = InitialRedirectHandler;
|
|
6413
6787
|
|
|
6414
6788
|
// src/pages/GenericDataGridPage.tsx
|
|
6415
|
-
import
|
|
6416
|
-
import { useParams as
|
|
6417
|
-
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";
|
|
6418
6792
|
import CloseIcon2 from "@mui/icons-material/Close";
|
|
6419
|
-
import { jsx as
|
|
6793
|
+
import { jsx as jsx37, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6420
6794
|
var GenericDataGridPage = ({
|
|
6421
6795
|
initialTableName,
|
|
6422
6796
|
initialFixedFields = [],
|
|
6423
6797
|
parametros: parametrosRecibidos
|
|
6424
6798
|
}) => {
|
|
6425
|
-
const { tableName: urlTableName } =
|
|
6799
|
+
const { tableName: urlTableName } = useParams3();
|
|
6426
6800
|
const effectiveTableName = initialTableName || urlTableName;
|
|
6427
|
-
const [tabs, setTabs] =
|
|
6428
|
-
const [activeTabIdx, setActiveTabIdx] =
|
|
6801
|
+
const [tabs, setTabs] = useState22([]);
|
|
6802
|
+
const [activeTabIdx, setActiveTabIdx] = useState22(0);
|
|
6429
6803
|
const ffKey = JSON.stringify(initialFixedFields);
|
|
6430
6804
|
const location = useLocation6();
|
|
6431
6805
|
const parametros = useMemo14(() => parametrosRecibidos ?? parametrosDeTabla(void 0, location.search), [parametrosRecibidos, location.search]);
|
|
6432
6806
|
const fixedFieldsIniciales = initialFixedFields.length > 0 ? initialFixedFields : parametros.fixedFields ?? [];
|
|
6433
6807
|
const parametrosKey = JSON.stringify(parametros);
|
|
6434
|
-
|
|
6808
|
+
React28.useEffect(() => {
|
|
6435
6809
|
if (effectiveTableName) {
|
|
6436
6810
|
setTabs([{
|
|
6437
6811
|
id: `main-${effectiveTableName}-${ffKey}-${parametrosKey}`,
|
|
@@ -6467,26 +6841,26 @@ var GenericDataGridPage = ({
|
|
|
6467
6841
|
else if (activeTabIdx === index) setActiveTabIdx(index - 1);
|
|
6468
6842
|
};
|
|
6469
6843
|
if (!effectiveTableName) {
|
|
6470
|
-
return /* @__PURE__ */
|
|
6844
|
+
return /* @__PURE__ */ jsx37(Box23, { p: 3, children: /* @__PURE__ */ jsx37(Alert6, { severity: "error", children: "No se especific\xF3 una tabla." }) });
|
|
6471
6845
|
}
|
|
6472
|
-
return /* @__PURE__ */
|
|
6473
|
-
/* @__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(
|
|
6474
6848
|
Tab,
|
|
6475
6849
|
{
|
|
6476
|
-
label: /* @__PURE__ */
|
|
6477
|
-
/* @__PURE__ */
|
|
6478
|
-
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" }) })
|
|
6479
6853
|
] })
|
|
6480
6854
|
},
|
|
6481
6855
|
tab.id
|
|
6482
6856
|
)) }) }),
|
|
6483
|
-
tabs.map((tab, index) => /* @__PURE__ */
|
|
6484
|
-
|
|
6857
|
+
tabs.map((tab, index) => /* @__PURE__ */ jsx37(
|
|
6858
|
+
Box23,
|
|
6485
6859
|
{
|
|
6486
6860
|
role: "tabpanel",
|
|
6487
6861
|
hidden: activeTabIdx !== index,
|
|
6488
6862
|
sx: { flexGrow: 1, display: activeTabIdx === index ? "flex" : "none", flexDirection: "column", overflow: "hidden" },
|
|
6489
|
-
children: /* @__PURE__ */
|
|
6863
|
+
children: /* @__PURE__ */ jsx37(
|
|
6490
6864
|
GenericDataGrid_default,
|
|
6491
6865
|
{
|
|
6492
6866
|
tableName: tab.tableName,
|
|
@@ -6509,22 +6883,22 @@ var GenericDataGridPage_default = GenericDataGridPage;
|
|
|
6509
6883
|
// src/pages/PantallaDeRuta.tsx
|
|
6510
6884
|
import { useMemo as useMemo15 } from "react";
|
|
6511
6885
|
import { useSearchParams } from "react-router-dom";
|
|
6512
|
-
import { Box as
|
|
6513
|
-
import { jsx as
|
|
6886
|
+
import { Box as Box24 } from "@mui/material";
|
|
6887
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
6514
6888
|
var PantallaDeRuta = ({ screenName }) => {
|
|
6515
6889
|
const [busqueda] = useSearchParams();
|
|
6516
6890
|
const params = useMemo15(() => Object.fromEntries(busqueda.entries()), [busqueda]);
|
|
6517
6891
|
const Pantalla = wScreens[screenName];
|
|
6518
|
-
return /* @__PURE__ */
|
|
6892
|
+
return /* @__PURE__ */ jsx38(Box24, { sx: { pt: 3, pl: 4 }, children: Pantalla ? /* @__PURE__ */ jsx38(Pantalla, { screenName, params }) : /* @__PURE__ */ jsx38(FallbackWScreen, { screenName }) });
|
|
6519
6893
|
};
|
|
6520
6894
|
|
|
6521
6895
|
// src/pages/MenuTablePage.tsx
|
|
6522
6896
|
import { useMemo as useMemo16 } from "react";
|
|
6523
|
-
import { useLocation as useLocation7, useParams as
|
|
6524
|
-
import { Box as
|
|
6525
|
-
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";
|
|
6526
6900
|
var MenuTablePage = () => {
|
|
6527
|
-
const { "*": menuName } =
|
|
6901
|
+
const { "*": menuName } = useParams4();
|
|
6528
6902
|
const { clientContext } = useApp();
|
|
6529
6903
|
const { search } = useLocation7();
|
|
6530
6904
|
const { currentTableName, currentFixedFields, parametros } = useMemo16(() => {
|
|
@@ -6548,12 +6922,12 @@ var MenuTablePage = () => {
|
|
|
6548
6922
|
};
|
|
6549
6923
|
}, [menuName, clientContext, search]);
|
|
6550
6924
|
if (!currentTableName) {
|
|
6551
|
-
return /* @__PURE__ */
|
|
6552
|
-
/* @__PURE__ */
|
|
6553
|
-
/* @__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." })
|
|
6554
6928
|
] }) });
|
|
6555
6929
|
}
|
|
6556
|
-
return /* @__PURE__ */
|
|
6930
|
+
return /* @__PURE__ */ jsx39(
|
|
6557
6931
|
GenericDataGridPage_default,
|
|
6558
6932
|
{
|
|
6559
6933
|
initialTableName: currentTableName,
|
|
@@ -6565,170 +6939,9 @@ var MenuTablePage = () => {
|
|
|
6565
6939
|
var MenuTablePage_default = MenuTablePage;
|
|
6566
6940
|
|
|
6567
6941
|
// src/puente/PantallaBP.tsx
|
|
6568
|
-
import { useEffect as
|
|
6569
|
-
import { Navigate as Navigate3, useLocation as useLocation8, useParams as
|
|
6570
|
-
import { Alert as
|
|
6571
|
-
|
|
6572
|
-
// src/puente/clienteBP.ts
|
|
6573
|
-
function extraerRecursos(html) {
|
|
6574
|
-
const documento = new DOMParser().parseFromString(html, "text/html");
|
|
6575
|
-
const referencias2 = (selector, atributo) => Array.from(documento.querySelectorAll(selector)).map((elemento) => elemento.getAttribute(atributo)).filter((ruta) => !!ruta);
|
|
6576
|
-
return {
|
|
6577
|
-
hojasDeEstilo: referencias2("link[rel=stylesheet]", "href"),
|
|
6578
|
-
scripts: referencias2("script[src]", "src")
|
|
6579
|
-
};
|
|
6580
|
-
}
|
|
6581
|
-
function fijarBase(urlBackend) {
|
|
6582
|
-
const href = new URL(urlBackend.replace(/\/*$/, "/"), window.location.href).href;
|
|
6583
|
-
let base = document.querySelector("base");
|
|
6584
|
-
if (!base) {
|
|
6585
|
-
base = document.createElement("base");
|
|
6586
|
-
document.head.prepend(base);
|
|
6587
|
-
}
|
|
6588
|
-
base.href = href;
|
|
6589
|
-
}
|
|
6590
|
-
function cargarScript(ruta) {
|
|
6591
|
-
return new Promise((resolver, rechazar) => {
|
|
6592
|
-
const script = document.createElement("script");
|
|
6593
|
-
script.async = false;
|
|
6594
|
-
script.src = ruta;
|
|
6595
|
-
script.onload = () => resolver();
|
|
6596
|
-
script.onerror = () => rechazar(new Error(`No se pudo cargar ${ruta}`));
|
|
6597
|
-
document.head.appendChild(script);
|
|
6598
|
-
});
|
|
6599
|
-
}
|
|
6600
|
-
function esperarCargaDeVentana() {
|
|
6601
|
-
if (document.readyState === "complete") return Promise.resolve();
|
|
6602
|
-
return new Promise((resolver) => window.addEventListener("load", () => resolver(), { once: true }));
|
|
6603
|
-
}
|
|
6604
|
-
async function sinEscuchasDeVentana(tipos, inyectar) {
|
|
6605
|
-
const original = window.addEventListener;
|
|
6606
|
-
const filtrada = function(tipo, escucha, opciones) {
|
|
6607
|
-
if (tipos.includes(tipo)) return;
|
|
6608
|
-
original.call(this, tipo, escucha, opciones);
|
|
6609
|
-
};
|
|
6610
|
-
window.addEventListener = filtrada;
|
|
6611
|
-
try {
|
|
6612
|
-
return await inyectar();
|
|
6613
|
-
} finally {
|
|
6614
|
-
if (window.addEventListener === filtrada) window.addEventListener = original;
|
|
6615
|
-
}
|
|
6616
|
-
}
|
|
6617
|
-
async function cargarScripts(rutas) {
|
|
6618
|
-
for (const ruta of rutas) {
|
|
6619
|
-
await cargarScript(ruta);
|
|
6620
|
-
}
|
|
6621
|
-
}
|
|
6622
|
-
var carga = null;
|
|
6623
|
-
function cargarClienteBP(urlBackend) {
|
|
6624
|
-
if (!carga) {
|
|
6625
|
-
carga = cargarSinMemoria(urlBackend).catch((error) => {
|
|
6626
|
-
carga = null;
|
|
6627
|
-
throw error;
|
|
6628
|
-
});
|
|
6629
|
-
}
|
|
6630
|
-
return carga;
|
|
6631
|
-
}
|
|
6632
|
-
async function cargarSinMemoria(urlBackend) {
|
|
6633
|
-
const destino = new URL(urlBackend, window.location.href);
|
|
6634
|
-
if (destino.origin !== window.location.origin) {
|
|
6635
|
-
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}).`);
|
|
6636
|
-
}
|
|
6637
|
-
fijarBase(urlBackend);
|
|
6638
|
-
const respuesta = await fetch(`${destino.pathname.replace(/\/*$/, "")}/menu`, { credentials: "include" });
|
|
6639
|
-
if (!respuesta.ok || /\/login\/?$/.test(new URL(respuesta.url).pathname)) {
|
|
6640
|
-
throw new Error("No hay una sesi\xF3n iniciada en el backend.");
|
|
6641
|
-
}
|
|
6642
|
-
const recursos = extraerRecursos(await respuesta.text());
|
|
6643
|
-
recursos.hojasDeEstilo.forEach((ruta) => {
|
|
6644
|
-
const enlace = document.createElement("link");
|
|
6645
|
-
enlace.rel = "stylesheet";
|
|
6646
|
-
enlace.href = ruta;
|
|
6647
|
-
document.head.appendChild(enlace);
|
|
6648
|
-
});
|
|
6649
|
-
await esperarCargaDeVentana();
|
|
6650
|
-
await sinEscuchasDeVentana(["popstate"], () => cargarScripts(recursos.scripts));
|
|
6651
|
-
const myOwn = window.myOwn;
|
|
6652
|
-
if (!myOwn) throw new Error("El backend no defini\xF3 myOwn.");
|
|
6653
|
-
window.my = myOwn;
|
|
6654
|
-
await myOwn.autoSetup();
|
|
6655
|
-
return myOwn;
|
|
6656
|
-
}
|
|
6657
|
-
|
|
6658
|
-
// src/puente/ConsolaBP.tsx
|
|
6659
|
-
import { useEffect as useEffect14 } from "react";
|
|
6660
|
-
import { Box as Box24 } from "@mui/material";
|
|
6661
|
-
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
6662
|
-
var MARGEN_DE_REPETIDO_MS = 1e3;
|
|
6663
|
-
function descartarRepetidos(consola, agregados, ahora) {
|
|
6664
|
-
for (const nodo of agregados) {
|
|
6665
|
-
if (!(nodo instanceof HTMLElement)) continue;
|
|
6666
|
-
const repetido = Array.from(consola.children).find(
|
|
6667
|
-
(otro) => otro instanceof HTMLElement && otro !== nodo && otro.className === nodo.className && otro.textContent === nodo.textContent && ahora - Number(otro.dataset.instante) < MARGEN_DE_REPETIDO_MS
|
|
6668
|
-
);
|
|
6669
|
-
if (repetido) nodo.remove();
|
|
6670
|
-
else nodo.dataset.instante = String(ahora);
|
|
6671
|
-
}
|
|
6672
|
-
}
|
|
6673
|
-
var ConsolaBP = () => {
|
|
6674
|
-
useEffect14(() => {
|
|
6675
|
-
const consola = document.getElementById("mini-console");
|
|
6676
|
-
if (!consola) return;
|
|
6677
|
-
const observador = new MutationObserver(
|
|
6678
|
-
(registros) => descartarRepetidos(consola, registros.flatMap((registro) => Array.from(registro.addedNodes)), Date.now())
|
|
6679
|
-
);
|
|
6680
|
-
observador.observe(consola, { childList: true });
|
|
6681
|
-
return () => observador.disconnect();
|
|
6682
|
-
}, []);
|
|
6683
|
-
return /* @__PURE__ */ jsx37(
|
|
6684
|
-
Box24,
|
|
6685
|
-
{
|
|
6686
|
-
id: "mini-console",
|
|
6687
|
-
sx: (tema) => ({
|
|
6688
|
-
"&#mini-console": {
|
|
6689
|
-
position: "fixed",
|
|
6690
|
-
top: { xs: 64, sm: 72 },
|
|
6691
|
-
left: "auto",
|
|
6692
|
-
right: 16,
|
|
6693
|
-
bottom: "auto",
|
|
6694
|
-
float: "none",
|
|
6695
|
-
zIndex: tema.zIndex.snackbar,
|
|
6696
|
-
width: "auto",
|
|
6697
|
-
minWidth: 0,
|
|
6698
|
-
maxWidth: "min(480px, calc(100vw - 32px))",
|
|
6699
|
-
minHeight: 0,
|
|
6700
|
-
maxHeight: "none",
|
|
6701
|
-
overflow: "visible",
|
|
6702
|
-
padding: 0,
|
|
6703
|
-
border: "none",
|
|
6704
|
-
borderRadius: 0,
|
|
6705
|
-
boxShadow: "none",
|
|
6706
|
-
backgroundColor: "transparent",
|
|
6707
|
-
fontSize: "inherit",
|
|
6708
|
-
display: "flex",
|
|
6709
|
-
flexDirection: "column",
|
|
6710
|
-
gap: 1
|
|
6711
|
-
},
|
|
6712
|
-
"&#mini-console:not(:empty)": { display: "flex" },
|
|
6713
|
-
"&#mini-console:empty": { display: "none" },
|
|
6714
|
-
"& > div": {
|
|
6715
|
-
p: "6px 12px",
|
|
6716
|
-
borderRadius: 1,
|
|
6717
|
-
boxShadow: tema.shadows[3],
|
|
6718
|
-
fontSize: "0.875rem",
|
|
6719
|
-
whiteSpace: "pre-wrap",
|
|
6720
|
-
overflowWrap: "anywhere",
|
|
6721
|
-
backgroundColor: tema.palette.grey[800],
|
|
6722
|
-
color: tema.palette.common.white
|
|
6723
|
-
},
|
|
6724
|
-
"& > .status-error": {
|
|
6725
|
-
backgroundColor: tema.palette.error.main,
|
|
6726
|
-
color: tema.palette.error.contrastText
|
|
6727
|
-
}
|
|
6728
|
-
})
|
|
6729
|
-
}
|
|
6730
|
-
);
|
|
6731
|
-
};
|
|
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";
|
|
6732
6945
|
|
|
6733
6946
|
// src/puente/pantallaDeBP.ts
|
|
6734
6947
|
var RUTA_PANTALLA_BP = "/bp/menu";
|
|
@@ -6748,6 +6961,12 @@ function rutaDeEnlaceBP(href, baseDelDocumento, urlBackend) {
|
|
|
6748
6961
|
const nombre = new URLSearchParams(texto).get("w");
|
|
6749
6962
|
return nombre ? rutaDePantallaBP(nombre, texto) : null;
|
|
6750
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
|
+
}
|
|
6751
6970
|
function resolverPantallaBP(myOwn, nombre, contenedor) {
|
|
6752
6971
|
const registrada = myOwn.wScreens[nombre];
|
|
6753
6972
|
if (!registrada) return null;
|
|
@@ -6770,7 +6989,7 @@ function resolverPantallaBP(myOwn, nombre, contenedor) {
|
|
|
6770
6989
|
}
|
|
6771
6990
|
|
|
6772
6991
|
// src/puente/PantallaBP.tsx
|
|
6773
|
-
import { jsx as
|
|
6992
|
+
import { jsx as jsx40, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6774
6993
|
function buscarItemDeMenu(items, tipo) {
|
|
6775
6994
|
for (const item of items) {
|
|
6776
6995
|
if (item.menuType === tipo) return item;
|
|
@@ -6783,12 +7002,12 @@ function buscarItemDeMenu(items, tipo) {
|
|
|
6783
7002
|
}
|
|
6784
7003
|
var PantallaBP = ({ nombre, direccion }) => {
|
|
6785
7004
|
const { clientContext } = useApp();
|
|
6786
|
-
const [cargando, setCargando] =
|
|
6787
|
-
const [error, setError] =
|
|
6788
|
-
const [noExiste, setNoExiste] =
|
|
6789
|
-
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);
|
|
6790
7009
|
const menu = clientContext.menu;
|
|
6791
|
-
|
|
7010
|
+
useEffect16(() => {
|
|
6792
7011
|
const elemento = contenedor.current;
|
|
6793
7012
|
if (!elemento) return;
|
|
6794
7013
|
let vigente = true;
|
|
@@ -6798,6 +7017,7 @@ var PantallaBP = ({ nombre, direccion }) => {
|
|
|
6798
7017
|
cargarClienteBP(envConfig.backendUrl).then((myOwn) => {
|
|
6799
7018
|
if (!vigente) return;
|
|
6800
7019
|
setCargando(false);
|
|
7020
|
+
copiarSkinAlContenedor(elemento);
|
|
6801
7021
|
const pantalla = resolverPantallaBP(myOwn, nombre, elemento);
|
|
6802
7022
|
if (!pantalla) {
|
|
6803
7023
|
setNoExiste(true);
|
|
@@ -6819,82 +7039,36 @@ var PantallaBP = ({ nombre, direccion }) => {
|
|
|
6819
7039
|
elemento.replaceChildren();
|
|
6820
7040
|
};
|
|
6821
7041
|
}, [nombre, direccion, menu]);
|
|
6822
|
-
if (noExiste) return /* @__PURE__ */
|
|
7042
|
+
if (noExiste) return /* @__PURE__ */ jsx40(FallbackWScreen, { screenName: nombre });
|
|
6823
7043
|
return (
|
|
6824
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
|
|
6825
|
-
/* @__PURE__ */
|
|
6826
|
-
cargando && /* @__PURE__ */
|
|
6827
|
-
error && /* @__PURE__ */
|
|
6828
|
-
/* @__PURE__ */
|
|
6829
|
-
/* @__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, {})
|
|
6830
7050
|
] })
|
|
6831
7051
|
);
|
|
6832
7052
|
};
|
|
6833
7053
|
var PantallaDeRespaldo = () => {
|
|
6834
|
-
const { screenName = "" } =
|
|
7054
|
+
const { screenName = "" } = useParams5();
|
|
6835
7055
|
const { search } = useLocation8();
|
|
6836
7056
|
if (!puenteBPHabilitado()) {
|
|
6837
|
-
return /* @__PURE__ */
|
|
7057
|
+
return /* @__PURE__ */ jsx40(Box26, { sx: { p: 3 }, children: /* @__PURE__ */ jsx40(FallbackWScreen, { screenName }) });
|
|
6838
7058
|
}
|
|
6839
|
-
return /* @__PURE__ */
|
|
7059
|
+
return /* @__PURE__ */ jsx40(Navigate3, { to: rutaDePantallaBP(screenName, search), replace: true });
|
|
6840
7060
|
};
|
|
6841
7061
|
var PaginaBP = () => {
|
|
6842
7062
|
const { hash, search } = useLocation8();
|
|
6843
7063
|
const direccion = hash || search;
|
|
6844
7064
|
const nombre = new URLSearchParams(direccion.replace(/^[#?]/, "")).get("w");
|
|
6845
|
-
if (!puenteBPHabilitado()) return /* @__PURE__ */
|
|
6846
|
-
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: [
|
|
6847
7067
|
"Falta la pantalla de backend-plus (",
|
|
6848
|
-
/* @__PURE__ */
|
|
7068
|
+
/* @__PURE__ */ jsx40("code", { children: "#w=..." }),
|
|
6849
7069
|
")."
|
|
6850
7070
|
] }) });
|
|
6851
|
-
return /* @__PURE__ */
|
|
6852
|
-
};
|
|
6853
|
-
|
|
6854
|
-
// src/puente/GrillaBP.tsx
|
|
6855
|
-
import { useEffect as useEffect16, useRef as useRef12, useState as useState23 } from "react";
|
|
6856
|
-
import { useParams as useParams5 } from "react-router-dom";
|
|
6857
|
-
import { Alert as Alert8, Box as Box26, CircularProgress as CircularProgress9 } from "@mui/material";
|
|
6858
|
-
import { jsx as jsx39, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6859
|
-
var GrillaBP = ({ tabla, fixedFields }) => {
|
|
6860
|
-
const contenedor = useRef12(null);
|
|
6861
|
-
const [cargando, setCargando] = useState23(true);
|
|
6862
|
-
const [error, setError] = useState23(null);
|
|
6863
|
-
const clave = JSON.stringify(fixedFields ?? []);
|
|
6864
|
-
useEffect16(() => {
|
|
6865
|
-
const elemento = contenedor.current;
|
|
6866
|
-
if (!elemento) return;
|
|
6867
|
-
let vigente = true;
|
|
6868
|
-
setError(null);
|
|
6869
|
-
setCargando(true);
|
|
6870
|
-
cargarClienteBP(envConfig.backendUrl).then((myOwn) => {
|
|
6871
|
-
if (!vigente) return;
|
|
6872
|
-
setCargando(false);
|
|
6873
|
-
elemento.replaceChildren();
|
|
6874
|
-
myOwn.tableGrid(tabla, elemento, { fixedFields: JSON.parse(clave) });
|
|
6875
|
-
}).catch((err) => {
|
|
6876
|
-
if (!vigente) return;
|
|
6877
|
-
setCargando(false);
|
|
6878
|
-
setError(mensajeDeError(err));
|
|
6879
|
-
});
|
|
6880
|
-
return () => {
|
|
6881
|
-
vigente = false;
|
|
6882
|
-
elemento.replaceChildren();
|
|
6883
|
-
};
|
|
6884
|
-
}, [tabla, clave]);
|
|
6885
|
-
return (
|
|
6886
|
-
// 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
|
|
6887
|
-
/* @__PURE__ */ jsxs29(Box26, { sx: { position: "relative" }, children: [
|
|
6888
|
-
cargando && /* @__PURE__ */ jsx39(CircularProgress9, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
|
|
6889
|
-
error && /* @__PURE__ */ jsx39(Alert8, { severity: "error", sx: { m: 2 }, children: error }),
|
|
6890
|
-
/* @__PURE__ */ jsx39("div", { ref: contenedor }),
|
|
6891
|
-
/* @__PURE__ */ jsx39(ConsolaBP, {})
|
|
6892
|
-
] })
|
|
6893
|
-
);
|
|
6894
|
-
};
|
|
6895
|
-
var PaginaGrillaBP = () => {
|
|
6896
|
-
const { tableName = "" } = useParams5();
|
|
6897
|
-
return /* @__PURE__ */ jsx39(GrillaBP, { tabla: tableName }, tableName);
|
|
7071
|
+
return /* @__PURE__ */ jsx40(PantallaBP, { nombre, direccion }, nombre);
|
|
6898
7072
|
};
|
|
6899
7073
|
|
|
6900
7074
|
// src/puente/CapturaBP.tsx
|
|
@@ -6935,8 +7109,16 @@ function capturarNavegacionBP(urlBackend, navegar) {
|
|
|
6935
7109
|
reemplazarOriginal.call(history, estado, titulo, ruta === null ? url : rutaBase + ruta);
|
|
6936
7110
|
};
|
|
6937
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;
|
|
6938
7119
|
return () => {
|
|
6939
7120
|
if (history.replaceState === reemplazar) history.replaceState = reemplazarOriginal;
|
|
7121
|
+
if (window.open === abrir) window.open = abrirOriginal;
|
|
6940
7122
|
document.removeEventListener("click", alHacerClick, true);
|
|
6941
7123
|
navegacion?.removeEventListener("navigate", alNavegar);
|
|
6942
7124
|
};
|
|
@@ -6964,7 +7146,7 @@ function resultadoDeCambioDeClave(urlFinal, html) {
|
|
|
6964
7146
|
}
|
|
6965
7147
|
|
|
6966
7148
|
// src/pages/CambiarClavePage.tsx
|
|
6967
|
-
import { jsx as
|
|
7149
|
+
import { jsx as jsx41, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
6968
7150
|
var CambiarClavePage = () => {
|
|
6969
7151
|
const { clientContext, setIsLoggedIn, avisarCierreVoluntario } = useApp();
|
|
6970
7152
|
const dispatch = useDispatch5();
|
|
@@ -7005,10 +7187,10 @@ var CambiarClavePage = () => {
|
|
|
7005
7187
|
setEnviando(false);
|
|
7006
7188
|
}
|
|
7007
7189
|
};
|
|
7008
|
-
return /* @__PURE__ */
|
|
7009
|
-
/* @__PURE__ */
|
|
7010
|
-
/* @__PURE__ */
|
|
7011
|
-
/* @__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(
|
|
7012
7194
|
TextField5,
|
|
7013
7195
|
{
|
|
7014
7196
|
label: "Contrase\xF1a actual",
|
|
@@ -7023,7 +7205,7 @@ var CambiarClavePage = () => {
|
|
|
7023
7205
|
disabled: enviando
|
|
7024
7206
|
}
|
|
7025
7207
|
),
|
|
7026
|
-
/* @__PURE__ */
|
|
7208
|
+
/* @__PURE__ */ jsx41(
|
|
7027
7209
|
TextField5,
|
|
7028
7210
|
{
|
|
7029
7211
|
label: "Contrase\xF1a nueva",
|
|
@@ -7037,7 +7219,7 @@ var CambiarClavePage = () => {
|
|
|
7037
7219
|
disabled: enviando
|
|
7038
7220
|
}
|
|
7039
7221
|
),
|
|
7040
|
-
/* @__PURE__ */
|
|
7222
|
+
/* @__PURE__ */ jsx41(
|
|
7041
7223
|
TextField5,
|
|
7042
7224
|
{
|
|
7043
7225
|
label: "Repetir contrase\xF1a nueva",
|
|
@@ -7051,19 +7233,19 @@ var CambiarClavePage = () => {
|
|
|
7051
7233
|
disabled: enviando
|
|
7052
7234
|
}
|
|
7053
7235
|
),
|
|
7054
|
-
error && /* @__PURE__ */
|
|
7236
|
+
error && /* @__PURE__ */ jsx41(Alert9, { severity: "error", sx: { mt: 1, whiteSpace: "pre-line" }, children: error }),
|
|
7055
7237
|
/* @__PURE__ */ jsxs30(Box27, { sx: { display: "flex", gap: 1, justifyContent: "flex-end", mt: 2 }, children: [
|
|
7056
|
-
/* @__PURE__ */
|
|
7057
|
-
/* @__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" })
|
|
7058
7240
|
] }),
|
|
7059
|
-
/* @__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." })
|
|
7060
7242
|
] }) });
|
|
7061
7243
|
};
|
|
7062
7244
|
var CambiarClavePage_default = CambiarClavePage;
|
|
7063
7245
|
|
|
7064
7246
|
// src/App.tsx
|
|
7065
7247
|
import typeStore6 from "type-store";
|
|
7066
|
-
import { Fragment as Fragment8, jsx as
|
|
7248
|
+
import { Fragment as Fragment8, jsx as jsx42, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
7067
7249
|
var LocationTracker = () => {
|
|
7068
7250
|
const location = useLocation9();
|
|
7069
7251
|
const dispatch = useAppDispatch();
|
|
@@ -7074,45 +7256,45 @@ var LocationTracker = () => {
|
|
|
7074
7256
|
};
|
|
7075
7257
|
function FrontendPlusReactRoutes({ myRoutes, myUnloggedRoutes, layout: Layout = MainLayout_default, unloggedLayout: UnloggedLayout }) {
|
|
7076
7258
|
return /* @__PURE__ */ jsxs31(Fragment8, { children: [
|
|
7077
|
-
/* @__PURE__ */
|
|
7078
|
-
puenteBPHabilitado() && /* @__PURE__ */
|
|
7259
|
+
/* @__PURE__ */ jsx42(InitialRedirectHandler_default, {}),
|
|
7260
|
+
puenteBPHabilitado() && /* @__PURE__ */ jsx42(CapturaBP, {}),
|
|
7079
7261
|
/* @__PURE__ */ jsxs31(Routes, { children: [
|
|
7080
|
-
/* @__PURE__ */ jsxs31(Route, { element: UnloggedLayout ? /* @__PURE__ */
|
|
7081
|
-
/* @__PURE__ */
|
|
7082
|
-
/* @__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, {}) }),
|
|
7083
7265
|
myUnloggedRoutes
|
|
7084
7266
|
] }),
|
|
7085
|
-
/* @__PURE__ */ jsxs31(Route, { element: /* @__PURE__ */
|
|
7086
|
-
/* @__PURE__ */
|
|
7087
|
-
/* @__PURE__ */
|
|
7088
|
-
/* @__PURE__ */
|
|
7089
|
-
/* @__PURE__ */
|
|
7090
|
-
/* @__PURE__ */
|
|
7091
|
-
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(
|
|
7092
7274
|
Route,
|
|
7093
7275
|
{
|
|
7094
7276
|
path: `/wScreens/${screenName}`,
|
|
7095
|
-
element: /* @__PURE__ */
|
|
7277
|
+
element: /* @__PURE__ */ jsx42(PantallaDeRuta, { screenName })
|
|
7096
7278
|
},
|
|
7097
7279
|
screenName
|
|
7098
7280
|
)),
|
|
7099
|
-
/* @__PURE__ */
|
|
7100
|
-
puenteBPHabilitado() && /* @__PURE__ */
|
|
7101
|
-
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, {}) }),
|
|
7102
7284
|
myRoutes,
|
|
7103
|
-
/* @__PURE__ */
|
|
7285
|
+
/* @__PURE__ */ jsx42(Route, { path: "*", element: /* @__PURE__ */ jsx42("div", { style: { marginTop: "20px", marginLeft: "10px" }, children: "404 - Recurso No Encontrado" }) })
|
|
7104
7286
|
] }),
|
|
7105
|
-
/* @__PURE__ */
|
|
7287
|
+
/* @__PURE__ */ jsx42(Route, { path: "*", element: /* @__PURE__ */ jsx42(Navigate4, { to: "/", replace: true }) })
|
|
7106
7288
|
] })
|
|
7107
7289
|
] });
|
|
7108
7290
|
}
|
|
7109
7291
|
var FrontendPlusProviders = ({ children, publicPaths }) => {
|
|
7110
|
-
return /* @__PURE__ */
|
|
7111
|
-
/* @__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, {}),
|
|
7112
7294
|
" ",
|
|
7113
|
-
/* @__PURE__ */
|
|
7295
|
+
/* @__PURE__ */ jsx42(AppProvider, { publicPaths, children: /* @__PURE__ */ jsxs31(SnackbarProvider, { children: [
|
|
7114
7296
|
children,
|
|
7115
|
-
/* @__PURE__ */
|
|
7297
|
+
/* @__PURE__ */ jsx42(SessionExpiredMessage_default, {})
|
|
7116
7298
|
] }) })
|
|
7117
7299
|
] }) }) });
|
|
7118
7300
|
};
|
|
@@ -7158,7 +7340,7 @@ var App = ({
|
|
|
7158
7340
|
const extracted = extractPathsFromRoutes(myUnloggedRoutes);
|
|
7159
7341
|
return ["/login", "/logout", ...extracted];
|
|
7160
7342
|
}, [myUnloggedRoutes]);
|
|
7161
|
-
return /* @__PURE__ */
|
|
7343
|
+
return /* @__PURE__ */ jsx42(FrontendPlusProviders, { publicPaths: safePaths, children: /* @__PURE__ */ jsx42(
|
|
7162
7344
|
FrontendPlusReactRoutes,
|
|
7163
7345
|
{
|
|
7164
7346
|
myRoutes,
|