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.cjs
CHANGED
|
@@ -59,7 +59,7 @@ __export(src_exports, {
|
|
|
59
59
|
module.exports = __toCommonJS(src_exports);
|
|
60
60
|
|
|
61
61
|
// src/components/grid/GenericDataGrid.tsx
|
|
62
|
-
var
|
|
62
|
+
var import_react28 = require("react");
|
|
63
63
|
var import_react_data_grid = require("react-data-grid");
|
|
64
64
|
var import_styles = require("react-data-grid/lib/styles.css");
|
|
65
65
|
|
|
@@ -378,7 +378,7 @@ var useApiCallWithoutSnackbar = () => {
|
|
|
378
378
|
};
|
|
379
379
|
|
|
380
380
|
// src/components/grid/GenericDataGrid.tsx
|
|
381
|
-
var
|
|
381
|
+
var import_material21 = require("@mui/material");
|
|
382
382
|
|
|
383
383
|
// src/store/index.ts
|
|
384
384
|
var import_toolkit4 = require("@reduxjs/toolkit");
|
|
@@ -1628,6 +1628,112 @@ var textoParaVer = (valor) => {
|
|
|
1628
1628
|
return String(valor);
|
|
1629
1629
|
};
|
|
1630
1630
|
|
|
1631
|
+
// src/components/grid/ExampleClientSideComponent.tsx
|
|
1632
|
+
var import_material4 = require("@mui/material");
|
|
1633
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1634
|
+
var ExampleClientSideComponent = ({ row, column, fieldDefinition }) => {
|
|
1635
|
+
const value = row[column.key];
|
|
1636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_material4.Box, { sx: {
|
|
1637
|
+
padding: 0.5,
|
|
1638
|
+
width: "100%",
|
|
1639
|
+
height: "100%",
|
|
1640
|
+
display: "flex",
|
|
1641
|
+
alignItems: "center",
|
|
1642
|
+
backgroundColor: value === "Special" ? "lightblue" : "transparent"
|
|
1643
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_material4.Typography, { variant: "body2", sx: { fontWeight: "bold" }, children: value ? `CS: ${value}` : "N/A" }) });
|
|
1644
|
+
};
|
|
1645
|
+
var ExampleClientSideComponent_default = ExampleClientSideComponent;
|
|
1646
|
+
|
|
1647
|
+
// src/components/grid/FallbackClientSideRenderer.tsx
|
|
1648
|
+
var import_material5 = require("@mui/material");
|
|
1649
|
+
var import_WarningAmber2 = __toESM(require("@mui/icons-material/WarningAmber"), 1);
|
|
1650
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1651
|
+
var FallbackClientSideRenderer = ({ column, row, fieldDefinition }) => {
|
|
1652
|
+
const clientSideName = fieldDefinition?.clientSide || "Desconocido";
|
|
1653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_material5.Tooltip, { title: `Componente clientSide '${clientSideName}' no implementado. Mostrando valor por defecto.`, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1654
|
+
import_material5.Box,
|
|
1655
|
+
{
|
|
1656
|
+
sx: {
|
|
1657
|
+
display: "flex",
|
|
1658
|
+
alignItems: "center",
|
|
1659
|
+
justifyContent: "space-between",
|
|
1660
|
+
// Para espaciar el valor y el icono
|
|
1661
|
+
gap: 1,
|
|
1662
|
+
// Espacio entre elementos
|
|
1663
|
+
width: "100%",
|
|
1664
|
+
height: "100%",
|
|
1665
|
+
paddingLeft: "8px",
|
|
1666
|
+
backgroundColor: "rgba(255, 193, 7, 0.1)",
|
|
1667
|
+
// Amarillo claro para advertencia
|
|
1668
|
+
border: "1px dashed rgba(255, 193, 7, 0.5)",
|
|
1669
|
+
boxSizing: "border-box",
|
|
1670
|
+
overflow: "hidden"
|
|
1671
|
+
// Evita que el contenido se desborde
|
|
1672
|
+
},
|
|
1673
|
+
children: [
|
|
1674
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_material5.Typography, { variant: "body2", noWrap: true, sx: { flexGrow: 1 }, children: clientSideName + " not found" }),
|
|
1675
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1676
|
+
import_WarningAmber2.default,
|
|
1677
|
+
{
|
|
1678
|
+
sx: {
|
|
1679
|
+
fontSize: 18,
|
|
1680
|
+
color: "warning.main",
|
|
1681
|
+
marginRight: "4px"
|
|
1682
|
+
// Pequeño margen a la derecha del icono
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
)
|
|
1686
|
+
]
|
|
1687
|
+
}
|
|
1688
|
+
) });
|
|
1689
|
+
};
|
|
1690
|
+
var FallbackClientSideRenderer_default = FallbackClientSideRenderer;
|
|
1691
|
+
|
|
1692
|
+
// src/components/grid/ClientSideDisplayUrl.tsx
|
|
1693
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1694
|
+
var ClientSideDisplayUrl = ({ row, column }) => {
|
|
1695
|
+
const valor = row[column.key];
|
|
1696
|
+
if (valor === null || valor === void 0 || valor === "") return null;
|
|
1697
|
+
const url = String(valor);
|
|
1698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("a", { className: "fpr-celda", href: url, target: "_blank", rel: "noopener noreferrer", children: url });
|
|
1699
|
+
};
|
|
1700
|
+
var ClientSideDisplayUrl_default = ClientSideDisplayUrl;
|
|
1701
|
+
|
|
1702
|
+
// src/utils/columnasOcultas.ts
|
|
1703
|
+
function columnasOcultasIniciales(tableDefinition) {
|
|
1704
|
+
return Array.from(new Set(tableDefinition.hiddenColumns ?? []));
|
|
1705
|
+
}
|
|
1706
|
+
function campoDibujable(field) {
|
|
1707
|
+
return field.visible !== false;
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
// src/components/grid/clientSides.ts
|
|
1711
|
+
var clientSides = {
|
|
1712
|
+
"ExampleClientSideComponent": ExampleClientSideComponent_default,
|
|
1713
|
+
"FallbackClientSideRenderer": FallbackClientSideRenderer_default,
|
|
1714
|
+
"displayUrl": ClientSideDisplayUrl_default
|
|
1715
|
+
};
|
|
1716
|
+
var guardadosPropios = {
|
|
1717
|
+
// `newPass` de backend-plus: la clave nueva del usuario de la fila
|
|
1718
|
+
newPass: async ({ fila, primaryKey, valor, callApi }) => {
|
|
1719
|
+
const claveNueva = typeof valor === "string" ? valor.trim() : "";
|
|
1720
|
+
if (!claveNueva) return;
|
|
1721
|
+
await callApi("admin_chpass", { user: fila[primaryKey[primaryKey.length - 1]], newpass: claveNueva });
|
|
1722
|
+
}
|
|
1723
|
+
};
|
|
1724
|
+
var campoEditableEnCelda = (campo) => campo?.editable !== false && (!campo?.clientSide || campo.clientSide in guardadosPropios);
|
|
1725
|
+
var clientSidesSinImplementar = (tableDefinition) => {
|
|
1726
|
+
const deCampos = tableDefinition.fields.flatMap(
|
|
1727
|
+
(campo) => campo.clientSide && campoDibujable(campo) && !clientSides[campo.clientSide] && !guardadosPropios[campo.clientSide] ? [campo.clientSide] : []
|
|
1728
|
+
);
|
|
1729
|
+
const deTabla = tableDefinition.clientSide ? [tableDefinition.clientSide] : [];
|
|
1730
|
+
return [.../* @__PURE__ */ new Set([...deCampos, ...deTabla])];
|
|
1731
|
+
};
|
|
1732
|
+
var extendClientSides = (newRenderers) => {
|
|
1733
|
+
clientSides = { ...clientSides, ...newRenderers };
|
|
1734
|
+
console.log("clientSides extendidos:", clientSides);
|
|
1735
|
+
};
|
|
1736
|
+
|
|
1631
1737
|
// src/hooks/grid/useGridEvents.ts
|
|
1632
1738
|
var VIGENCIA_TECLA_PENDIENTE = 400;
|
|
1633
1739
|
var VIGENCIA_VALOR_PENDIENTE_F4 = 1e3;
|
|
@@ -1658,7 +1764,7 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1658
1764
|
const currentColumnIndex = currentColumns.findIndex((col) => col.key === columnKey);
|
|
1659
1765
|
const editableColumns = currentColumns.filter((col) => {
|
|
1660
1766
|
const fieldDefinition = tableDefinition2.fields.find((f) => f.name === col.key);
|
|
1661
|
-
return col.key !== "actionsColumn" && !(esColumnaPropia(col) && col.customType === "detail") && (fieldDefinition
|
|
1767
|
+
return col.key !== "actionsColumn" && !(esColumnaPropia(col) && col.customType === "detail") && campoEditableEnCelda(fieldDefinition);
|
|
1662
1768
|
});
|
|
1663
1769
|
const { key, target } = event;
|
|
1664
1770
|
const teclaAnterior = teclaAnteriorRef.current;
|
|
@@ -1789,7 +1895,7 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1789
1895
|
if (esFilaDetalle(args.row)) return;
|
|
1790
1896
|
const fieldDefinition = tableDefinition?.fields.find((f) => f.name === args.column.key);
|
|
1791
1897
|
const isFixedField = valorFijoDe(fixedFields, args.column.key) !== void 0;
|
|
1792
|
-
const isEditable = fieldDefinition
|
|
1898
|
+
const isEditable = campoEditableEnCelda(fieldDefinition) && !isFixedField;
|
|
1793
1899
|
if (isEditable) {
|
|
1794
1900
|
args.selectCell(true);
|
|
1795
1901
|
} else if (fieldDefinition && tipoDeExpander(fieldDefinition, false) !== null) {
|
|
@@ -1974,7 +2080,7 @@ var JSON4all2 = __toESM(require("json4all"), 1);
|
|
|
1974
2080
|
var cambiarGuionesBajosPorEspacios = (texto) => texto.replace(/_/g, " ");
|
|
1975
2081
|
|
|
1976
2082
|
// src/components/grid/renderers/headerCellRenderers.tsx
|
|
1977
|
-
var
|
|
2083
|
+
var import_material6 = require("@mui/material");
|
|
1978
2084
|
var import_Search = __toESM(require("@mui/icons-material/Search"), 1);
|
|
1979
2085
|
var import_SearchOff = __toESM(require("@mui/icons-material/SearchOff"), 1);
|
|
1980
2086
|
var import_MoreVert = __toESM(require("@mui/icons-material/MoreVert"), 1);
|
|
@@ -2032,7 +2138,7 @@ var VistaGrillaContext = (0, import_react11.createContext)({ isFilterRowVisible:
|
|
|
2032
2138
|
var useVistaGrilla = () => (0, import_react11.useContext)(VistaGrillaContext);
|
|
2033
2139
|
|
|
2034
2140
|
// src/components/grid/renderers/headerCellRenderers.tsx
|
|
2035
|
-
var
|
|
2141
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2036
2142
|
var defaultColumnHeaderCellRenderer = (props, fieldDef, ocultarColumna) => {
|
|
2037
2143
|
const { column, sortDirection, priority } = props;
|
|
2038
2144
|
const isPrimaryKey = fieldDef.isPk;
|
|
@@ -2045,8 +2151,8 @@ var defaultColumnHeaderCellRenderer = (props, fieldDef, ocultarColumna) => {
|
|
|
2045
2151
|
return "#AAAAAA";
|
|
2046
2152
|
};
|
|
2047
2153
|
const sortColor = sorted ? getSortColor(sortIndex) : "transparent";
|
|
2048
|
-
return /* @__PURE__ */ (0,
|
|
2049
|
-
|
|
2154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2155
|
+
import_material6.Box,
|
|
2050
2156
|
{
|
|
2051
2157
|
onClickCapture: (e) => {
|
|
2052
2158
|
if (!e.altKey || !ocultarColumna) return;
|
|
@@ -2063,8 +2169,8 @@ var defaultColumnHeaderCellRenderer = (props, fieldDef, ocultarColumna) => {
|
|
|
2063
2169
|
width: "100%"
|
|
2064
2170
|
},
|
|
2065
2171
|
children: [
|
|
2066
|
-
/* @__PURE__ */ (0,
|
|
2067
|
-
|
|
2172
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2173
|
+
import_material6.Typography,
|
|
2068
2174
|
{
|
|
2069
2175
|
variant: "body2",
|
|
2070
2176
|
sx: {
|
|
@@ -2081,7 +2187,7 @@ var defaultColumnHeaderCellRenderer = (props, fieldDef, ocultarColumna) => {
|
|
|
2081
2187
|
children: column.name
|
|
2082
2188
|
}
|
|
2083
2189
|
),
|
|
2084
|
-
sorted && /* @__PURE__ */ (0,
|
|
2190
|
+
sorted && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material6.Box, { sx: { color: sortColor, display: "flex", alignItems: "center", ml: 0.5, fontSize: "0.7rem" }, children: sortDirection === "ASC" ? "\u25B2" : "\u25BC" })
|
|
2085
2191
|
]
|
|
2086
2192
|
}
|
|
2087
2193
|
);
|
|
@@ -2093,48 +2199,48 @@ var ActionsColumnHeaderCell = ({
|
|
|
2093
2199
|
allowInsert
|
|
2094
2200
|
}) => {
|
|
2095
2201
|
const { isFilterRowVisible } = useVistaGrilla();
|
|
2096
|
-
return /* @__PURE__ */ (0,
|
|
2097
|
-
allowInsert && /* @__PURE__ */ (0,
|
|
2098
|
-
|
|
2202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_material6.Box, { sx: { display: "flex", flexDirection: "row", alignItems: "center", justifyContent: "center", gap: 0.2 }, children: [
|
|
2203
|
+
allowInsert && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2204
|
+
import_material6.IconButton,
|
|
2099
2205
|
{
|
|
2100
2206
|
onClick: () => handleAddRow(),
|
|
2101
2207
|
size: "small",
|
|
2102
2208
|
title: "A\xF1adir registro",
|
|
2103
2209
|
sx: { p: 0.25, color: "grey.800", "&:hover": { color: "success.main" } },
|
|
2104
|
-
children: /* @__PURE__ */ (0,
|
|
2210
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_Add.default, { sx: { fontSize: 18 } })
|
|
2105
2211
|
}
|
|
2106
2212
|
),
|
|
2107
|
-
/* @__PURE__ */ (0,
|
|
2108
|
-
|
|
2213
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2214
|
+
import_material6.IconButton,
|
|
2109
2215
|
{
|
|
2110
2216
|
onClick: toggleFilterVisibility,
|
|
2111
2217
|
size: "small",
|
|
2112
2218
|
title: isFilterRowVisible ? "Ocultar filtros" : "Mostrar filtros",
|
|
2113
2219
|
sx: { p: 0.25, color: "grey.800" },
|
|
2114
|
-
children: isFilterRowVisible ? /* @__PURE__ */ (0,
|
|
2220
|
+
children: isFilterRowVisible ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_SearchOff.default, { sx: { fontSize: 18 } }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_Search.default, { sx: { fontSize: 18 } })
|
|
2115
2221
|
}
|
|
2116
2222
|
),
|
|
2117
|
-
/* @__PURE__ */ (0,
|
|
2118
|
-
|
|
2223
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2224
|
+
import_material6.IconButton,
|
|
2119
2225
|
{
|
|
2120
2226
|
onClick: (event) => handleDataGridOptions(event),
|
|
2121
2227
|
size: "small",
|
|
2122
2228
|
title: "Opciones de esta tabla",
|
|
2123
2229
|
sx: { p: 0.25, color: "grey.800" },
|
|
2124
|
-
children: /* @__PURE__ */ (0,
|
|
2230
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_MoreVert.default, { sx: { fontSize: 20, variant: "filled", size: "small" } })
|
|
2125
2231
|
}
|
|
2126
2232
|
)
|
|
2127
2233
|
] });
|
|
2128
2234
|
};
|
|
2129
|
-
var detailColumnCellHeaderRenderer = (props, detailTable) => /* @__PURE__ */ (0,
|
|
2235
|
+
var detailColumnCellHeaderRenderer = (props, detailTable) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material6.Tooltip, { title: detailTable.label, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material6.Box, { sx: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material6.Typography, { variant: "caption", sx: { fontSize: "0.75rem", fontWeight: "bold" }, children: detailTable.abr.toUpperCase() }) }) });
|
|
2130
2236
|
|
|
2131
2237
|
// src/components/grid/FilterInputRender.tsx
|
|
2132
|
-
var
|
|
2238
|
+
var import_material11 = require("@mui/material");
|
|
2133
2239
|
var import_react18 = __toESM(require("react"), 1);
|
|
2134
2240
|
|
|
2135
2241
|
// src/components/forms/TypedField.tsx
|
|
2136
2242
|
var import_react16 = require("react");
|
|
2137
|
-
var
|
|
2243
|
+
var import_material10 = require("@mui/material");
|
|
2138
2244
|
var import_type_store3 = __toESM(require("type-store"), 1);
|
|
2139
2245
|
var import_react17 = require("react");
|
|
2140
2246
|
|
|
@@ -2147,8 +2253,8 @@ var import_Search2 = __toESM(require("@mui/icons-material/Search"), 1);
|
|
|
2147
2253
|
|
|
2148
2254
|
// src/components/grid/MenuDeOpciones.tsx
|
|
2149
2255
|
var import_react12 = require("react");
|
|
2150
|
-
var
|
|
2151
|
-
var
|
|
2256
|
+
var import_material7 = require("@mui/material");
|
|
2257
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2152
2258
|
function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar }) {
|
|
2153
2259
|
const [busqueda, setBusqueda] = (0, import_react12.useState)(busquedaInicial);
|
|
2154
2260
|
const [indice, setIndice] = (0, import_react12.useState)(0);
|
|
@@ -2172,8 +2278,8 @@ function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar
|
|
|
2172
2278
|
evento.preventDefault();
|
|
2173
2279
|
evento.stopPropagation();
|
|
2174
2280
|
};
|
|
2175
|
-
return /* @__PURE__ */ (0,
|
|
2176
|
-
|
|
2281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2282
|
+
import_material7.Popover,
|
|
2177
2283
|
{
|
|
2178
2284
|
open: true,
|
|
2179
2285
|
anchorEl: anclaje,
|
|
@@ -2182,8 +2288,8 @@ function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar
|
|
|
2182
2288
|
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
2183
2289
|
slotProps: { paper: { sx: { minWidth: 300, maxWidth: 520 } } },
|
|
2184
2290
|
children: [
|
|
2185
|
-
/* @__PURE__ */ (0,
|
|
2186
|
-
|
|
2291
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2292
|
+
import_material7.InputBase,
|
|
2187
2293
|
{
|
|
2188
2294
|
autoFocus: true,
|
|
2189
2295
|
fullWidth: true,
|
|
@@ -2198,17 +2304,17 @@ function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar
|
|
|
2198
2304
|
inputProps: { "aria-label": "buscar" }
|
|
2199
2305
|
}
|
|
2200
2306
|
),
|
|
2201
|
-
/* @__PURE__ */ (0,
|
|
2202
|
-
visibles.length === 0 && /* @__PURE__ */ (0,
|
|
2203
|
-
visibles.map((opcion, i) => /* @__PURE__ */ (0,
|
|
2204
|
-
|
|
2307
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_material7.List, { dense: true, disablePadding: true, sx: { maxHeight: 320, overflowY: "auto" }, role: "listbox", children: [
|
|
2308
|
+
visibles.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_material7.Typography, { variant: "body2", sx: { p: 1, color: "text.secondary" }, children: "sin coincidencias" }),
|
|
2309
|
+
visibles.map((opcion, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2310
|
+
import_material7.ListItemButton,
|
|
2205
2311
|
{
|
|
2206
2312
|
ref: i === indice ? elegida : null,
|
|
2207
2313
|
selected: i === indice,
|
|
2208
2314
|
role: "option",
|
|
2209
2315
|
onClick: () => onElegir(opcion.valor),
|
|
2210
2316
|
sx: { gap: 2, py: 0.25, fontSize: "0.8rem" },
|
|
2211
|
-
children: opcion.etiquetas.map((etiqueta, j) => /* @__PURE__ */ (0,
|
|
2317
|
+
children: opcion.etiquetas.map((etiqueta, j) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontWeight: j === 0 ? 600 : 400, minWidth: j === 0 ? 40 : void 0 }, children: etiqueta }, j))
|
|
2212
2318
|
},
|
|
2213
2319
|
i
|
|
2214
2320
|
))
|
|
@@ -2220,8 +2326,8 @@ function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar
|
|
|
2220
2326
|
|
|
2221
2327
|
// src/components/grid/SelectorDeFecha.tsx
|
|
2222
2328
|
var import_react13 = require("react");
|
|
2223
|
-
var
|
|
2224
|
-
var
|
|
2329
|
+
var import_material8 = require("@mui/material");
|
|
2330
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2225
2331
|
var MESES = ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"];
|
|
2226
2332
|
var DIAS = ["lu", "ma", "mi", "ju", "vi", "s\xE1", "do"];
|
|
2227
2333
|
var mismaFecha = (a, b) => b !== null && a.anio === b.anio && a.mes === b.mes && a.dia === b.dia;
|
|
@@ -2254,22 +2360,22 @@ function SelectorDeFecha({ anclaje, fechaActual, admiteNulo, onElegir, onCerrar
|
|
|
2254
2360
|
evento.preventDefault();
|
|
2255
2361
|
evento.stopPropagation();
|
|
2256
2362
|
};
|
|
2257
|
-
return /* @__PURE__ */ (0,
|
|
2258
|
-
/* @__PURE__ */ (0,
|
|
2259
|
-
/* @__PURE__ */ (0,
|
|
2260
|
-
/* @__PURE__ */ (0,
|
|
2363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material8.Popover, { open: true, anchorEl: anclaje, onClose: onCerrar, disableRestoreFocus: true, anchorOrigin: { vertical: "bottom", horizontal: "left" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { tabIndex: 0, ref: (el) => el?.focus(), onKeyDown: alApretar, style: { padding: 8, outline: "none", width: 252 }, "aria-label": "calendario", children: [
|
|
2364
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
2365
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material8.IconButton, { size: "small", "aria-label": "mes anterior", onClick: () => mover(0, -1), children: "\u2039" }),
|
|
2366
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_material8.Typography, { variant: "body2", sx: { fontWeight: 600 }, children: [
|
|
2261
2367
|
MESES[cursor.mes],
|
|
2262
2368
|
" ",
|
|
2263
2369
|
cursor.anio
|
|
2264
2370
|
] }),
|
|
2265
|
-
/* @__PURE__ */ (0,
|
|
2371
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material8.IconButton, { size: "small", "aria-label": "mes siguiente", onClick: () => mover(0, 1), children: "\u203A" })
|
|
2266
2372
|
] }),
|
|
2267
|
-
/* @__PURE__ */ (0,
|
|
2268
|
-
/* @__PURE__ */ (0,
|
|
2269
|
-
/* @__PURE__ */ (0,
|
|
2373
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("table", { style: { borderCollapse: "collapse", width: "100%", textAlign: "center", fontSize: "0.8rem" }, children: [
|
|
2374
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tr", { children: DIAS.map((d) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("th", { style: { fontWeight: 400, color: "#777" }, children: d }, d)) }) }),
|
|
2375
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tbody", { children: semanasDelMes(cursor.anio, cursor.mes).map((semana, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tr", { children: semana.map((dia) => {
|
|
2270
2376
|
const elegido = mismaFecha(dia, fechaActual);
|
|
2271
2377
|
const enCursor = mismaFecha(dia, cursor);
|
|
2272
|
-
return /* @__PURE__ */ (0,
|
|
2378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("td", { style: { padding: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2273
2379
|
"button",
|
|
2274
2380
|
{
|
|
2275
2381
|
type: "button",
|
|
@@ -2289,17 +2395,17 @@ function SelectorDeFecha({ anclaje, fechaActual, admiteNulo, onElegir, onCerrar
|
|
|
2289
2395
|
) }, `${dia.mes}-${dia.dia}`);
|
|
2290
2396
|
}) }, i)) })
|
|
2291
2397
|
] }),
|
|
2292
|
-
/* @__PURE__ */ (0,
|
|
2293
|
-
/* @__PURE__ */ (0,
|
|
2294
|
-
admiteNulo && /* @__PURE__ */ (0,
|
|
2398
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", marginTop: 4 }, children: [
|
|
2399
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material8.Button, { size: "small", onClick: () => onElegir(fechaATexto(fechaDeHoy)), children: "hoy" }),
|
|
2400
|
+
admiteNulo && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material8.Button, { size: "small", onClick: () => onElegir(null), children: "vac\xEDo" })
|
|
2295
2401
|
] })
|
|
2296
2402
|
] }) });
|
|
2297
2403
|
}
|
|
2298
2404
|
|
|
2299
2405
|
// src/components/grid/VentanaDeTexto.tsx
|
|
2300
2406
|
var import_react14 = require("react");
|
|
2301
|
-
var
|
|
2302
|
-
var
|
|
2407
|
+
var import_material9 = require("@mui/material");
|
|
2408
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2303
2409
|
function VentanaDeTexto({ anclaje, texto, editable, onAceptar, onCerrar }) {
|
|
2304
2410
|
const [valor, setValor] = (0, import_react14.useState)(texto);
|
|
2305
2411
|
const alApretar = (evento) => {
|
|
@@ -2313,9 +2419,9 @@ function VentanaDeTexto({ anclaje, texto, editable, onAceptar, onCerrar }) {
|
|
|
2313
2419
|
evento.preventDefault();
|
|
2314
2420
|
evento.stopPropagation();
|
|
2315
2421
|
};
|
|
2316
|
-
return /* @__PURE__ */ (0,
|
|
2317
|
-
/* @__PURE__ */ (0,
|
|
2318
|
-
|
|
2422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_material9.Popover, { open: true, anchorEl: anclaje, onClose: onCerrar, disableRestoreFocus: true, anchorOrigin: { vertical: "bottom", horizontal: "left" }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { padding: 8, minWidth: 320, maxWidth: 640 }, children: [
|
|
2423
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2424
|
+
import_material9.InputBase,
|
|
2319
2425
|
{
|
|
2320
2426
|
autoFocus: true,
|
|
2321
2427
|
multiline: true,
|
|
@@ -2330,15 +2436,15 @@ function VentanaDeTexto({ anclaje, texto, editable, onAceptar, onCerrar }) {
|
|
|
2330
2436
|
inputProps: { "aria-label": "contenido de la celda" }
|
|
2331
2437
|
}
|
|
2332
2438
|
),
|
|
2333
|
-
editable && /* @__PURE__ */ (0,
|
|
2334
|
-
/* @__PURE__ */ (0,
|
|
2335
|
-
/* @__PURE__ */ (0,
|
|
2439
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", justifyContent: "flex-end", gap: 8, marginTop: 4 }, children: [
|
|
2440
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_material9.Button, { size: "small", onClick: onCerrar, children: "cancelar" }),
|
|
2441
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_material9.Button, { size: "small", variant: "contained", onClick: () => onAceptar(valor), children: "aceptar" })
|
|
2336
2442
|
] })
|
|
2337
2443
|
] }) });
|
|
2338
2444
|
}
|
|
2339
2445
|
|
|
2340
2446
|
// src/hooks/grid/useExpander.tsx
|
|
2341
|
-
var
|
|
2447
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2342
2448
|
var useExpander = ({ campo, editable, fila, admiteNulo, tipos, anclaje, textoActual, valorActual, alElegirValor, alConfirmarTexto, alFallar }) => {
|
|
2343
2449
|
const [expansion, setExpansion] = (0, import_react15.useState)(null);
|
|
2344
2450
|
const abierto = import_react15.default.useRef(false);
|
|
@@ -2384,7 +2490,7 @@ var useExpander = ({ campo, editable, fila, admiteNulo, tipos, anclaje, textoAct
|
|
|
2384
2490
|
return true;
|
|
2385
2491
|
}, [tipo, abrir]);
|
|
2386
2492
|
const titulo = tipo === "fecha" ? "elegir fecha (F9)" : tipo === "texto" ? "ver el contenido completo (F9)" : "elegir un valor (F9)";
|
|
2387
|
-
const lupa = tipo === null ? null : /* @__PURE__ */ (0,
|
|
2493
|
+
const lupa = tipo === null ? null : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2388
2494
|
import_IconButton.default,
|
|
2389
2495
|
{
|
|
2390
2496
|
size: "small",
|
|
@@ -2397,18 +2503,18 @@ var useExpander = ({ campo, editable, fila, admiteNulo, tipos, anclaje, textoAct
|
|
|
2397
2503
|
void abrir("");
|
|
2398
2504
|
},
|
|
2399
2505
|
sx: { p: 0, ml: 0.25, color: "primary.main", "&:hover": { backgroundColor: "action.hover" } },
|
|
2400
|
-
children: tipo === "fecha" ? /* @__PURE__ */ (0,
|
|
2506
|
+
children: tipo === "fecha" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_CalendarMonth.default, { sx: { fontSize: 16 } }) : tipo === "texto" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Search2.default, { sx: { fontSize: 16 } }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_ArrowDropDown.default, { sx: { fontSize: 20 } })
|
|
2401
2507
|
}
|
|
2402
2508
|
);
|
|
2403
2509
|
const base = anclaje.current;
|
|
2404
|
-
const ventana = !expansion || !base ? null : expansion.tipo === "opciones" ? /* @__PURE__ */ (0,
|
|
2510
|
+
const ventana = !expansion || !base ? null : expansion.tipo === "opciones" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MenuDeOpciones, { anclaje: base, opciones: expansion.opciones, busquedaInicial: expansion.busqueda, onElegir: elegirValor, onCerrar: cerrar }) : expansion.tipo === "fecha" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SelectorDeFecha, { anclaje: base, fechaActual: fechaDeValor(valorActual), admiteNulo, onElegir: confirmarTexto, onCerrar: cerrar }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(VentanaDeTexto, { anclaje: base, texto: textoActual, editable: true, onAceptar: confirmarTexto, onCerrar: cerrar });
|
|
2405
2511
|
return { tipo, abierto, abrir, manejarTecla, lupa, ventana };
|
|
2406
2512
|
};
|
|
2407
2513
|
|
|
2408
2514
|
// src/components/forms/TypedField.tsx
|
|
2409
|
-
var
|
|
2515
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2410
2516
|
var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode = false, feedback, isMandatory = false }) => {
|
|
2411
|
-
const theme = (0,
|
|
2517
|
+
const theme = (0, import_material10.useTheme)();
|
|
2412
2518
|
const typer = (0, import_react16.useMemo)(() => import_type_store3.default.typerFrom(fieldDef), [fieldDef]);
|
|
2413
2519
|
const isBoolean = fieldDef.typeName === "boolean" && !isFilterMode;
|
|
2414
2520
|
const [localString, setLocalString] = (0, import_react16.useState)(() => {
|
|
@@ -2534,28 +2640,28 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2534
2640
|
}
|
|
2535
2641
|
const cellBackgroundColor2 = feedback === "error" ? theme.palette.error.light : feedback === "success" ? theme.palette.success.light : defaultBgColor;
|
|
2536
2642
|
const transitionStyle2 = "background-color 0.3s ease-in-out";
|
|
2537
|
-
return /* @__PURE__ */ (0,
|
|
2538
|
-
!isFilterMode && /* @__PURE__ */ (0,
|
|
2539
|
-
/* @__PURE__ */ (0,
|
|
2540
|
-
|
|
2643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material10.FormControl, { fullWidth: true, error: !!errorMsg && !isFilterMode, disabled: isDisabled, size: "small", margin: "dense", children: [
|
|
2644
|
+
!isFilterMode && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material10.InputLabel, { shrink: true, children: fieldDef.name }),
|
|
2645
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2646
|
+
import_material10.Select,
|
|
2541
2647
|
{
|
|
2542
2648
|
value: boolVal,
|
|
2543
2649
|
label: !isFilterMode ? fieldDef.name : void 0,
|
|
2544
2650
|
onChange: handleBooleanChange,
|
|
2545
|
-
startAdornment: isMandatory && isEmpty && !isFilterMode ? /* @__PURE__ */ (0,
|
|
2651
|
+
startAdornment: isMandatory && isEmpty && !isFilterMode ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material10.InputAdornment, { position: "start", sx: { color: "text.secondary", ml: 0.5 }, children: "*" }) : void 0,
|
|
2546
2652
|
displayEmpty: true,
|
|
2547
2653
|
sx: isFilterMode ? { height: 25, fontSize: "0.8rem", backgroundColor: "background.paper" } : {
|
|
2548
2654
|
backgroundColor: cellBackgroundColor2,
|
|
2549
2655
|
transition: transitionStyle2
|
|
2550
2656
|
},
|
|
2551
2657
|
children: [
|
|
2552
|
-
fieldDef.nullable !== false && /* @__PURE__ */ (0,
|
|
2553
|
-
/* @__PURE__ */ (0,
|
|
2554
|
-
/* @__PURE__ */ (0,
|
|
2658
|
+
fieldDef.nullable !== false && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material10.MenuItem, { value: "", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("em", { children: "Nulo / Sin Especificar" }) }),
|
|
2659
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material10.MenuItem, { value: "true", children: "S\xED (Verdadero)" }),
|
|
2660
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material10.MenuItem, { value: "false", children: "No (Falso)" })
|
|
2555
2661
|
]
|
|
2556
2662
|
}
|
|
2557
2663
|
),
|
|
2558
|
-
errorMsg && !isFilterMode && /* @__PURE__ */ (0,
|
|
2664
|
+
errorMsg && !isFilterMode && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material10.FormHelperText, { children: errorMsg })
|
|
2559
2665
|
] });
|
|
2560
2666
|
}
|
|
2561
2667
|
let inputType = "text";
|
|
@@ -2569,9 +2675,9 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2569
2675
|
}
|
|
2570
2676
|
const cellBackgroundColor = feedback === "error" ? theme.palette.error.light : feedback === "success" ? theme.palette.success.light : defaultTextBgColor;
|
|
2571
2677
|
const transitionStyle = "background-color 0.3s ease-in-out";
|
|
2572
|
-
return /* @__PURE__ */ (0,
|
|
2573
|
-
/* @__PURE__ */ (0,
|
|
2574
|
-
|
|
2678
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
2679
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2680
|
+
import_material10.TextField,
|
|
2575
2681
|
{
|
|
2576
2682
|
fullWidth: true,
|
|
2577
2683
|
inputRef: entradaRef,
|
|
@@ -2590,7 +2696,7 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2590
2696
|
// la lupa solo al enfocar el filtro, como en backend-plus
|
|
2591
2697
|
endAdornment: enfocado || expander.abierto.current ? expander.lupa : void 0
|
|
2592
2698
|
} : isMandatory && isEmptyText ? {
|
|
2593
|
-
startAdornment: /* @__PURE__ */ (0,
|
|
2699
|
+
startAdornment: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material10.InputAdornment, { position: "start", sx: { color: "text.secondary", mr: 0.5 }, children: "*" })
|
|
2594
2700
|
} : {},
|
|
2595
2701
|
inputProps: {
|
|
2596
2702
|
style: {
|
|
@@ -2630,7 +2736,7 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2630
2736
|
};
|
|
2631
2737
|
|
|
2632
2738
|
// src/components/grid/FilterInputRender.tsx
|
|
2633
|
-
var
|
|
2739
|
+
var import_jsx_runtime15 = (
|
|
2634
2740
|
// como en backend-plus, el operador es un símbolo chico y el campo se queda con el resto del ancho
|
|
2635
2741
|
require("react/jsx-runtime")
|
|
2636
2742
|
);
|
|
@@ -2656,8 +2762,8 @@ function FilterInputRenderer({
|
|
|
2656
2762
|
[columnKey]: { operator: newOp, value: formattedVal }
|
|
2657
2763
|
}));
|
|
2658
2764
|
};
|
|
2659
|
-
return /* @__PURE__ */ (0,
|
|
2660
|
-
/* @__PURE__ */ (0,
|
|
2765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_material11.Box, { sx: { mt: 0, display: "flex", alignItems: "center", gap: "2px", width: "100%" }, children: [
|
|
2766
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2661
2767
|
"select",
|
|
2662
2768
|
{
|
|
2663
2769
|
value: operator,
|
|
@@ -2676,10 +2782,10 @@ function FilterInputRenderer({
|
|
|
2676
2782
|
textAlignLast: "center",
|
|
2677
2783
|
cursor: "pointer"
|
|
2678
2784
|
},
|
|
2679
|
-
children: filterOperators.map((op) => /* @__PURE__ */ (0,
|
|
2785
|
+
children: filterOperators.map((op) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: op.value, children: op.label }, op.value))
|
|
2680
2786
|
}
|
|
2681
2787
|
),
|
|
2682
|
-
/* @__PURE__ */ (0,
|
|
2788
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2683
2789
|
TypedField,
|
|
2684
2790
|
{
|
|
2685
2791
|
fieldDef,
|
|
@@ -2690,8 +2796,8 @@ function FilterInputRenderer({
|
|
|
2690
2796
|
)
|
|
2691
2797
|
] });
|
|
2692
2798
|
}
|
|
2693
|
-
return /* @__PURE__ */ (0,
|
|
2694
|
-
|
|
2799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2800
|
+
import_material11.InputBase,
|
|
2695
2801
|
{
|
|
2696
2802
|
value: currentFilter || "",
|
|
2697
2803
|
onChange: (e) => setFilters((prev) => ({
|
|
@@ -2716,15 +2822,15 @@ function FilterInputRenderer({
|
|
|
2716
2822
|
var FilterInputRender_default = import_react18.default.memo(FilterInputRenderer);
|
|
2717
2823
|
|
|
2718
2824
|
// src/components/grid/renderers/summaryCellRenderers.tsx
|
|
2719
|
-
var
|
|
2720
|
-
var
|
|
2825
|
+
var import_material12 = require("@mui/material");
|
|
2826
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2721
2827
|
var defaultColumnSummaryCellRenderer = (props, fixedFields) => {
|
|
2722
2828
|
const { column, row } = props;
|
|
2723
2829
|
if (row.id === "filterRow") {
|
|
2724
2830
|
const { filters, setFilters } = row;
|
|
2725
2831
|
if (valorFijoDe(fixedFields, column.key)) return null;
|
|
2726
2832
|
const fieldDef = esColumnaPropia(column) && column.customType === "default" ? column.fieldDef : void 0;
|
|
2727
|
-
return /* @__PURE__ */ (0,
|
|
2833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material12.Box, { sx: { position: "absolute", inset: 0, display: "flex", alignItems: "center", px: "2px" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2728
2834
|
FilterInputRender_default,
|
|
2729
2835
|
{
|
|
2730
2836
|
columnKey: column.key,
|
|
@@ -2766,7 +2872,7 @@ var defaultColumnSummaryCellRenderer = (props, fixedFields) => {
|
|
|
2766
2872
|
label = "Cant S\xED: ";
|
|
2767
2873
|
break;
|
|
2768
2874
|
}
|
|
2769
|
-
return /* @__PURE__ */ (0,
|
|
2875
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_material12.Box, { sx: {
|
|
2770
2876
|
px: 0,
|
|
2771
2877
|
fontWeight: "bold",
|
|
2772
2878
|
fontSize: "0.875rem",
|
|
@@ -2789,80 +2895,7 @@ var import_material13 = require("@mui/material");
|
|
|
2789
2895
|
var import_ViewHeadline = __toESM(require("@mui/icons-material/ViewHeadline"), 1);
|
|
2790
2896
|
var import_Delete = __toESM(require("@mui/icons-material/Delete"), 1);
|
|
2791
2897
|
var import_Add2 = __toESM(require("@mui/icons-material/Add"), 1);
|
|
2792
|
-
|
|
2793
|
-
// src/components/grid/ExampleClientSideComponent.tsx
|
|
2794
|
-
var import_material11 = require("@mui/material");
|
|
2795
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2796
|
-
var ExampleClientSideComponent = ({ row, column, fieldDefinition }) => {
|
|
2797
|
-
const value = row[column.key];
|
|
2798
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material11.Box, { sx: {
|
|
2799
|
-
padding: 0.5,
|
|
2800
|
-
width: "100%",
|
|
2801
|
-
height: "100%",
|
|
2802
|
-
display: "flex",
|
|
2803
|
-
alignItems: "center",
|
|
2804
|
-
backgroundColor: value === "Special" ? "lightblue" : "transparent"
|
|
2805
|
-
}, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material11.Typography, { variant: "body2", sx: { fontWeight: "bold" }, children: value ? `CS: ${value}` : "N/A" }) });
|
|
2806
|
-
};
|
|
2807
|
-
var ExampleClientSideComponent_default = ExampleClientSideComponent;
|
|
2808
|
-
|
|
2809
|
-
// src/components/grid/FallbackClientSideRenderer.tsx
|
|
2810
|
-
var import_material12 = require("@mui/material");
|
|
2811
|
-
var import_WarningAmber2 = __toESM(require("@mui/icons-material/WarningAmber"), 1);
|
|
2812
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2813
|
-
var FallbackClientSideRenderer = ({ column, row, fieldDefinition }) => {
|
|
2814
|
-
const clientSideName = fieldDefinition?.clientSide || "Desconocido";
|
|
2815
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material12.Tooltip, { title: `Componente clientSide '${clientSideName}' no implementado. Mostrando valor por defecto.`, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2816
|
-
import_material12.Box,
|
|
2817
|
-
{
|
|
2818
|
-
sx: {
|
|
2819
|
-
display: "flex",
|
|
2820
|
-
alignItems: "center",
|
|
2821
|
-
justifyContent: "space-between",
|
|
2822
|
-
// Para espaciar el valor y el icono
|
|
2823
|
-
gap: 1,
|
|
2824
|
-
// Espacio entre elementos
|
|
2825
|
-
width: "100%",
|
|
2826
|
-
height: "100%",
|
|
2827
|
-
paddingLeft: "8px",
|
|
2828
|
-
backgroundColor: "rgba(255, 193, 7, 0.1)",
|
|
2829
|
-
// Amarillo claro para advertencia
|
|
2830
|
-
border: "1px dashed rgba(255, 193, 7, 0.5)",
|
|
2831
|
-
boxSizing: "border-box",
|
|
2832
|
-
overflow: "hidden"
|
|
2833
|
-
// Evita que el contenido se desborde
|
|
2834
|
-
},
|
|
2835
|
-
children: [
|
|
2836
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material12.Typography, { variant: "body2", noWrap: true, sx: { flexGrow: 1 }, children: clientSideName + " not found" }),
|
|
2837
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2838
|
-
import_WarningAmber2.default,
|
|
2839
|
-
{
|
|
2840
|
-
sx: {
|
|
2841
|
-
fontSize: 18,
|
|
2842
|
-
color: "warning.main",
|
|
2843
|
-
marginRight: "4px"
|
|
2844
|
-
// Pequeño margen a la derecha del icono
|
|
2845
|
-
}
|
|
2846
|
-
}
|
|
2847
|
-
)
|
|
2848
|
-
]
|
|
2849
|
-
}
|
|
2850
|
-
) });
|
|
2851
|
-
};
|
|
2852
|
-
var FallbackClientSideRenderer_default = FallbackClientSideRenderer;
|
|
2853
|
-
|
|
2854
|
-
// src/components/grid/clientSides.ts
|
|
2855
|
-
var clientSides = {
|
|
2856
|
-
"ExampleClientSideComponent": ExampleClientSideComponent_default,
|
|
2857
|
-
"FallbackClientSideRenderer": FallbackClientSideRenderer_default
|
|
2858
|
-
};
|
|
2859
|
-
var extendClientSides = (newRenderers) => {
|
|
2860
|
-
clientSides = { ...clientSides, ...newRenderers };
|
|
2861
|
-
console.log("clientSides extendidos:", clientSides);
|
|
2862
|
-
};
|
|
2863
|
-
|
|
2864
|
-
// src/components/grid/renderers/cellRenderers.tsx
|
|
2865
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2898
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2866
2899
|
var CeldaDato = import_react19.default.memo(function CeldaDato2({ row, columnKey, defaultColumn }) {
|
|
2867
2900
|
const theme = (0, import_material13.useTheme)();
|
|
2868
2901
|
const { primaryKey, fixedFields, typer, isMandatory, isNumeric } = defaultColumn;
|
|
@@ -2884,7 +2917,7 @@ var CeldaDato = import_react19.default.memo(function CeldaDato2({ row, columnKey
|
|
|
2884
2917
|
displayValue = "* " + displayValue;
|
|
2885
2918
|
}
|
|
2886
2919
|
const signal = displayValue === "--" ? "typed-controls-signal-no-data" : displayValue === "//" ? "typed-controls-signal-unknown-data" : "";
|
|
2887
|
-
const celda = /* @__PURE__ */ (0,
|
|
2920
|
+
const celda = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2888
2921
|
"div",
|
|
2889
2922
|
{
|
|
2890
2923
|
className: `fpr-celda ${isNumeric ? "fpr-celda-numerica" : ""} ${signal} ${row[NEW_ROW_INDICATOR] ? "new-row-cell-animation" : ""}`,
|
|
@@ -2892,30 +2925,30 @@ var CeldaDato = import_react19.default.memo(function CeldaDato2({ row, columnKey
|
|
|
2892
2925
|
children: displayValue
|
|
2893
2926
|
}
|
|
2894
2927
|
);
|
|
2895
|
-
return currentCellFeedback?.message ? /* @__PURE__ */ (0,
|
|
2928
|
+
return currentCellFeedback?.message ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material13.Tooltip, { title: currentCellFeedback.message, children: celda }) : celda;
|
|
2896
2929
|
});
|
|
2897
2930
|
var allColumnsCellRenderer = (props) => {
|
|
2898
2931
|
const { row, column } = props;
|
|
2899
2932
|
if (!esColumnaPropia(column)) return void 0;
|
|
2900
2933
|
if (esFilaDetalle(row)) {
|
|
2901
|
-
return column.customType === "action" ? /* @__PURE__ */ (0,
|
|
2934
|
+
return column.customType === "action" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CeldaDetalle, { fila: row }) : null;
|
|
2902
2935
|
}
|
|
2903
2936
|
switch (column.customType) {
|
|
2904
2937
|
case "default": {
|
|
2905
2938
|
const defaultColumn = column;
|
|
2906
2939
|
const { fieldDef, tableDefinition, primaryKey } = defaultColumn;
|
|
2907
|
-
if (fieldDef?.clientSide) {
|
|
2940
|
+
if (fieldDef?.clientSide && !(fieldDef.clientSide in guardadosPropios)) {
|
|
2908
2941
|
const ClientSideComponent = clientSides[fieldDef.clientSide];
|
|
2909
2942
|
if (ClientSideComponent) {
|
|
2910
|
-
return /* @__PURE__ */ (0,
|
|
2943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ClientSideComponent, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
|
|
2911
2944
|
}
|
|
2912
|
-
return /* @__PURE__ */ (0,
|
|
2945
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FallbackClientSideRenderer_default, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
|
|
2913
2946
|
}
|
|
2914
|
-
return /* @__PURE__ */ (0,
|
|
2947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CeldaDato, { row, columnKey: props.column.key, defaultColumn });
|
|
2915
2948
|
}
|
|
2916
2949
|
case "detail": {
|
|
2917
2950
|
const { detailTable, primaryKey } = column;
|
|
2918
|
-
return /* @__PURE__ */ (0,
|
|
2951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2919
2952
|
BotonDetalle,
|
|
2920
2953
|
{
|
|
2921
2954
|
row,
|
|
@@ -2950,14 +2983,14 @@ var allColumnsCellRenderer = (props) => {
|
|
|
2950
2983
|
color: "primary"
|
|
2951
2984
|
}
|
|
2952
2985
|
];
|
|
2953
|
-
return /* @__PURE__ */ (0,
|
|
2986
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material13.Box, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%", gap: 0.5 }, children: gridActionButtons.map((actionDef) => tableDefinition.allow[actionDef.action] ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2954
2987
|
import_material13.IconButton,
|
|
2955
2988
|
{
|
|
2956
2989
|
size: "small",
|
|
2957
2990
|
onClick: () => actionDef.handler(row),
|
|
2958
2991
|
title: actionDef.title,
|
|
2959
2992
|
sx: { width: 22, height: 22, p: 0, color: "grey.800", "&:hover": { color: `${actionDef.color}.main` } },
|
|
2960
|
-
children: /* @__PURE__ */ (0,
|
|
2993
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(actionDef.icon, { sx: { fontSize: 18 } })
|
|
2961
2994
|
},
|
|
2962
2995
|
actionDef.action
|
|
2963
2996
|
) : null) });
|
|
@@ -3023,7 +3056,7 @@ var useTableRecordSave = () => {
|
|
|
3023
3056
|
var import_InputBase = __toESM(require("@mui/material/InputBase"), 1);
|
|
3024
3057
|
var import_material14 = require("@mui/material");
|
|
3025
3058
|
var import_type_store4 = __toESM(require("type-store"), 1);
|
|
3026
|
-
var
|
|
3059
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3027
3060
|
function findChangedValues(oldRowData, newRowData, isNewRow) {
|
|
3028
3061
|
let changes = [];
|
|
3029
3062
|
for (const key in newRowData) {
|
|
@@ -3056,6 +3089,7 @@ function InputRenderer({
|
|
|
3056
3089
|
const theme = (0, import_material14.useTheme)();
|
|
3057
3090
|
const { showSuccess, showError } = useSnackbar();
|
|
3058
3091
|
const { saveRecord } = useTableRecordSave();
|
|
3092
|
+
const { callApi } = useApiCall();
|
|
3059
3093
|
const rowId = getPrimaryKeyValues(row, primaryKey);
|
|
3060
3094
|
const cellKey = `${rowId}-${column.key}`;
|
|
3061
3095
|
const currentCellFeedback = useFeedbackCelda(cellKey);
|
|
@@ -3097,6 +3131,20 @@ function InputRenderer({
|
|
|
3097
3131
|
const oldRowData = { ...row };
|
|
3098
3132
|
const primaryKeyValuesForBackend = tableDefinition.primaryKey.map((key) => potentialUpdatedRow[key]);
|
|
3099
3133
|
const currentRowIdBeforeUpdate = getPrimaryKeyValues(oldRowData, tableDefinition.primaryKey);
|
|
3134
|
+
const guardadoPropio = fieldDefinition.clientSide ? guardadosPropios[fieldDefinition.clientSide] : void 0;
|
|
3135
|
+
if (guardadoPropio && !isNewRow) {
|
|
3136
|
+
onRowChange(row, true);
|
|
3137
|
+
const claveDeLaCelda = `${currentRowIdBeforeUpdate}-${column.key}`;
|
|
3138
|
+
try {
|
|
3139
|
+
await guardadoPropio({ fila: row, primaryKey: tableDefinition.primaryKey, valor: processedNewValue, callApi });
|
|
3140
|
+
setCellFeedbackMap((prev) => new Map(prev).set(claveDeLaCelda, { rowId: currentRowIdBeforeUpdate, columnKey: column.key, type: "success" }));
|
|
3141
|
+
} catch (err) {
|
|
3142
|
+
setCellFeedbackMap((prev) => new Map(prev).set(claveDeLaCelda, { rowId: currentRowIdBeforeUpdate, columnKey: column.key, type: "error", message: mensajeDeError(err) }));
|
|
3143
|
+
} finally {
|
|
3144
|
+
if (!closeEditor) isCommitInProgress.current = false;
|
|
3145
|
+
}
|
|
3146
|
+
return;
|
|
3147
|
+
}
|
|
3100
3148
|
onRowChange({ ...row, [column.key]: processedNewValue }, true);
|
|
3101
3149
|
if (isNewRow) {
|
|
3102
3150
|
const areAllMandatoryFieldsFilled = tableDefinition.fields.every((fieldDef) => {
|
|
@@ -3209,7 +3257,9 @@ function InputRenderer({
|
|
|
3209
3257
|
setTableData,
|
|
3210
3258
|
setLocalCellChanges,
|
|
3211
3259
|
initialRowId,
|
|
3212
|
-
typer
|
|
3260
|
+
typer,
|
|
3261
|
+
fieldDefinition,
|
|
3262
|
+
callApi
|
|
3213
3263
|
]);
|
|
3214
3264
|
const confirmarEnExpansion = (0, import_react21.useCallback)((nuevo) => {
|
|
3215
3265
|
setEditingValue(nuevo);
|
|
@@ -3264,7 +3314,7 @@ function InputRenderer({
|
|
|
3264
3314
|
}, [handleCommit, editingValue]);
|
|
3265
3315
|
const isFieldEditable = fieldDefinition?.editable !== false;
|
|
3266
3316
|
const isNumeric = isNumericType(fieldDefinition?.typeName);
|
|
3267
|
-
const editor = /* @__PURE__ */ (0,
|
|
3317
|
+
const editor = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3268
3318
|
import_InputBase.default,
|
|
3269
3319
|
{
|
|
3270
3320
|
autoFocus: true,
|
|
@@ -3300,16 +3350,16 @@ function InputRenderer({
|
|
|
3300
3350
|
endAdornment: expander.lupa
|
|
3301
3351
|
}
|
|
3302
3352
|
);
|
|
3303
|
-
const conMenu = /* @__PURE__ */ (0,
|
|
3353
|
+
const conMenu = /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
3304
3354
|
editor,
|
|
3305
3355
|
expander.ventana
|
|
3306
3356
|
] });
|
|
3307
|
-
return currentCellFeedback?.message ? /* @__PURE__ */ (0,
|
|
3357
|
+
return currentCellFeedback?.message ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material14.Tooltip, { title: currentCellFeedback.message, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { width: "100%" }, children: conMenu }) }) : conMenu;
|
|
3308
3358
|
}
|
|
3309
3359
|
var InputRenderer_default = InputRenderer;
|
|
3310
3360
|
|
|
3311
3361
|
// src/components/grid/renderers/editCellRenderers.tsx
|
|
3312
|
-
var
|
|
3362
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3313
3363
|
var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
3314
3364
|
const column = props.column;
|
|
3315
3365
|
if (!esColumnaPropia(column)) return void 0;
|
|
@@ -3331,7 +3381,7 @@ var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
|
3331
3381
|
if (!isFieldEditableByUI) {
|
|
3332
3382
|
return void 0;
|
|
3333
3383
|
}
|
|
3334
|
-
return /* @__PURE__ */ (0,
|
|
3384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3335
3385
|
InputRenderer_default,
|
|
3336
3386
|
{
|
|
3337
3387
|
...props,
|
|
@@ -3356,14 +3406,6 @@ var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
|
3356
3406
|
}
|
|
3357
3407
|
};
|
|
3358
3408
|
|
|
3359
|
-
// src/utils/columnasOcultas.ts
|
|
3360
|
-
function columnasOcultasIniciales(tableDefinition) {
|
|
3361
|
-
return Array.from(new Set(tableDefinition.hiddenColumns ?? []));
|
|
3362
|
-
}
|
|
3363
|
-
function campoDibujable(field) {
|
|
3364
|
-
return field.visible !== false;
|
|
3365
|
-
}
|
|
3366
|
-
|
|
3367
3409
|
// src/hooks/grid/useGridColumns.ts
|
|
3368
3410
|
var estimateTextWidth = (text) => text.length * 8 + 16;
|
|
3369
3411
|
var contextoDeMedida;
|
|
@@ -3439,7 +3481,7 @@ var useGridColumns = ({
|
|
|
3439
3481
|
});
|
|
3440
3482
|
const defaultColumns = fieldsToShow.map((fieldDef) => {
|
|
3441
3483
|
const isFixedField = valorFijoDe(fixedFields, fieldDef.name) !== void 0;
|
|
3442
|
-
const isFieldEditable = fieldDef
|
|
3484
|
+
const isFieldEditable = campoEditableEnCelda(fieldDef) && !isFixedField;
|
|
3443
3485
|
const colWidth = anchosCalculados.get(fieldDef.name) ?? estimateTextWidth(fieldDef.label || fieldDef.name) + 20;
|
|
3444
3486
|
const column = {
|
|
3445
3487
|
key: fieldDef.name,
|
|
@@ -3531,7 +3573,7 @@ var useGridColumns = ({
|
|
|
3531
3573
|
var import_react23 = require("react");
|
|
3532
3574
|
var import_material15 = require("@mui/material");
|
|
3533
3575
|
var import_FileUpload2 = __toESM(require("@mui/icons-material/FileUpload"), 1);
|
|
3534
|
-
var
|
|
3576
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3535
3577
|
var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
3536
3578
|
const [file, setFile] = (0, import_react23.useState)(null);
|
|
3537
3579
|
const [options, setOptions] = (0, import_react23.useState)({
|
|
@@ -3553,15 +3595,15 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3553
3595
|
onClose();
|
|
3554
3596
|
}
|
|
3555
3597
|
};
|
|
3556
|
-
return /* @__PURE__ */ (0,
|
|
3557
|
-
/* @__PURE__ */ (0,
|
|
3558
|
-
/* @__PURE__ */ (0,
|
|
3598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material15.Dialog, { open, onClose: loading ? void 0 : onClose, maxWidth: "sm", fullWidth: true, children: [
|
|
3599
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material15.DialogTitle, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
3600
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_FileUpload2.default, { color: "primary" }),
|
|
3559
3601
|
"Importar datos desde archivo"
|
|
3560
3602
|
] }),
|
|
3561
|
-
/* @__PURE__ */ (0,
|
|
3562
|
-
/* @__PURE__ */ (0,
|
|
3563
|
-
/* @__PURE__ */ (0,
|
|
3564
|
-
/* @__PURE__ */ (0,
|
|
3603
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material15.DialogContent, { dividers: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material15.Stack, { spacing: 3, sx: { mt: 1 }, children: [
|
|
3604
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material15.Box, { children: [
|
|
3605
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material15.Typography, { variant: "subtitle2", gutterBottom: true, fontWeight: "bold", children: "Seleccionar archivo" }),
|
|
3606
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3565
3607
|
import_material15.Box,
|
|
3566
3608
|
{
|
|
3567
3609
|
sx: {
|
|
@@ -3574,7 +3616,7 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3574
3616
|
position: "relative"
|
|
3575
3617
|
},
|
|
3576
3618
|
children: [
|
|
3577
|
-
/* @__PURE__ */ (0,
|
|
3619
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3578
3620
|
"input",
|
|
3579
3621
|
{
|
|
3580
3622
|
type: "file",
|
|
@@ -3591,19 +3633,19 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3591
3633
|
}
|
|
3592
3634
|
}
|
|
3593
3635
|
),
|
|
3594
|
-
/* @__PURE__ */ (0,
|
|
3636
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material15.Typography, { variant: "body2", color: file ? "textPrimary" : "textSecondary", children: file ? file.name : "Haz clic aqu\xED para seleccionar un archivo" })
|
|
3595
3637
|
]
|
|
3596
3638
|
}
|
|
3597
3639
|
)
|
|
3598
3640
|
] }),
|
|
3599
|
-
/* @__PURE__ */ (0,
|
|
3600
|
-
/* @__PURE__ */ (0,
|
|
3601
|
-
/* @__PURE__ */ (0,
|
|
3602
|
-
/* @__PURE__ */ (0,
|
|
3603
|
-
/* @__PURE__ */ (0,
|
|
3641
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material15.Divider, {}),
|
|
3642
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material15.Box, { children: [
|
|
3643
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material15.Typography, { variant: "subtitle2", gutterBottom: true, fontWeight: "bold", children: "Opciones de importaci\xF3n" }),
|
|
3644
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material15.Stack, { children: [
|
|
3645
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3604
3646
|
import_material15.FormControlLabel,
|
|
3605
3647
|
{
|
|
3606
|
-
control: /* @__PURE__ */ (0,
|
|
3648
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3607
3649
|
import_material15.Checkbox,
|
|
3608
3650
|
{
|
|
3609
3651
|
checked: options.skipUnknownFieldsAtImport,
|
|
@@ -3611,13 +3653,13 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3611
3653
|
size: "small"
|
|
3612
3654
|
}
|
|
3613
3655
|
),
|
|
3614
|
-
label: /* @__PURE__ */ (0,
|
|
3656
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material15.Typography, { variant: "body2", children: "Omitir campos desconocidos al importar" })
|
|
3615
3657
|
}
|
|
3616
3658
|
),
|
|
3617
|
-
/* @__PURE__ */ (0,
|
|
3659
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3618
3660
|
import_material15.FormControlLabel,
|
|
3619
3661
|
{
|
|
3620
|
-
control: /* @__PURE__ */ (0,
|
|
3662
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3621
3663
|
import_material15.Checkbox,
|
|
3622
3664
|
{
|
|
3623
3665
|
checked: options.simplificateSpaces,
|
|
@@ -3625,13 +3667,13 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3625
3667
|
size: "small"
|
|
3626
3668
|
}
|
|
3627
3669
|
),
|
|
3628
|
-
label: /* @__PURE__ */ (0,
|
|
3670
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material15.Typography, { variant: "body2", children: "Simplificar espacios" })
|
|
3629
3671
|
}
|
|
3630
3672
|
),
|
|
3631
|
-
/* @__PURE__ */ (0,
|
|
3673
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3632
3674
|
import_material15.FormControlLabel,
|
|
3633
3675
|
{
|
|
3634
|
-
control: /* @__PURE__ */ (0,
|
|
3676
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3635
3677
|
import_material15.Checkbox,
|
|
3636
3678
|
{
|
|
3637
3679
|
checked: options.replaceNewLineWithSpace,
|
|
@@ -3639,21 +3681,21 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3639
3681
|
size: "small"
|
|
3640
3682
|
}
|
|
3641
3683
|
),
|
|
3642
|
-
label: /* @__PURE__ */ (0,
|
|
3684
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material15.Typography, { variant: "body2", children: "Reemplazar saltos de l\xEDnea con espacios" })
|
|
3643
3685
|
}
|
|
3644
3686
|
)
|
|
3645
3687
|
] })
|
|
3646
3688
|
] })
|
|
3647
3689
|
] }) }),
|
|
3648
|
-
/* @__PURE__ */ (0,
|
|
3649
|
-
/* @__PURE__ */ (0,
|
|
3650
|
-
/* @__PURE__ */ (0,
|
|
3690
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material15.DialogActions, { sx: { px: 3, py: 2 }, children: [
|
|
3691
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material15.Button, { onClick: onClose, disabled: loading, children: "Cancelar" }),
|
|
3692
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3651
3693
|
import_material15.Button,
|
|
3652
3694
|
{
|
|
3653
3695
|
onClick: handleConfirm,
|
|
3654
3696
|
variant: "contained",
|
|
3655
3697
|
disabled: !file || loading,
|
|
3656
|
-
startIcon: /* @__PURE__ */ (0,
|
|
3698
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_FileUpload2.default, {}),
|
|
3657
3699
|
children: loading ? "Procesando..." : "Confirmar Importaci\xF3n"
|
|
3658
3700
|
}
|
|
3659
3701
|
)
|
|
@@ -3666,7 +3708,7 @@ var import_react24 = require("react");
|
|
|
3666
3708
|
var import_material16 = require("@mui/material");
|
|
3667
3709
|
var XLSX = __toESM(require("xlsx"), 1);
|
|
3668
3710
|
var import_type_store5 = __toESM(require("type-store"), 1);
|
|
3669
|
-
var
|
|
3711
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3670
3712
|
var ExportDialog = ({
|
|
3671
3713
|
open,
|
|
3672
3714
|
onClose,
|
|
@@ -3811,76 +3853,76 @@ var ExportDialog = ({
|
|
|
3811
3853
|
URL.revokeObjectURL(url);
|
|
3812
3854
|
}, 0);
|
|
3813
3855
|
};
|
|
3814
|
-
return /* @__PURE__ */ (0,
|
|
3815
|
-
/* @__PURE__ */ (0,
|
|
3816
|
-
/* @__PURE__ */ (0,
|
|
3817
|
-
/* @__PURE__ */ (0,
|
|
3818
|
-
/* @__PURE__ */ (0,
|
|
3819
|
-
] }) : /* @__PURE__ */ (0,
|
|
3820
|
-
/* @__PURE__ */ (0,
|
|
3821
|
-
/* @__PURE__ */ (0,
|
|
3822
|
-
/* @__PURE__ */ (0,
|
|
3856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material16.Dialog, { open, onClose, maxWidth: "xs", fullWidth: true, children: [
|
|
3857
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material16.DialogTitle, { children: "Exportar Datos" }),
|
|
3858
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material16.DialogContent, { children: isPreparing ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material16.Box, { display: "flex", flexDirection: "column", alignItems: "center", py: 4, children: [
|
|
3859
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material16.CircularProgress, {}),
|
|
3860
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material16.Typography, { sx: { mt: 2 }, children: "Preparando exportaci\xF3n..." })
|
|
3861
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material16.Box, { sx: { mt: 1 }, children: [
|
|
3862
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material16.FormControl, { component: "fieldset", children: [
|
|
3863
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material16.FormLabel, { component: "legend", children: "Formato" }),
|
|
3864
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3823
3865
|
import_material16.RadioGroup,
|
|
3824
3866
|
{
|
|
3825
3867
|
value: format,
|
|
3826
3868
|
onChange: (e) => setFormat(e.target.value),
|
|
3827
3869
|
children: [
|
|
3828
|
-
/* @__PURE__ */ (0,
|
|
3829
|
-
/* @__PURE__ */ (0,
|
|
3830
|
-
/* @__PURE__ */ (0,
|
|
3870
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material16.FormControlLabel, { value: "xlsx", control: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material16.Radio, {}), label: "Excel (.xlsx)" }),
|
|
3871
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material16.FormControlLabel, { value: "tab", control: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material16.Radio, {}), label: "Tabulado (.tab | )" }),
|
|
3872
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material16.FormControlLabel, { value: "csv", control: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material16.Radio, {}), label: "CSV (.csv , )" })
|
|
3831
3873
|
]
|
|
3832
3874
|
}
|
|
3833
3875
|
)
|
|
3834
3876
|
] }),
|
|
3835
|
-
/* @__PURE__ */ (0,
|
|
3836
|
-
/* @__PURE__ */ (0,
|
|
3837
|
-
/* @__PURE__ */ (0,
|
|
3838
|
-
/* @__PURE__ */ (0,
|
|
3877
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material16.Box, { sx: { mt: 3 }, children: [
|
|
3878
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material16.Typography, { variant: "subtitle2", gutterBottom: true, children: "Opciones de campos:" }),
|
|
3879
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material16.FormGroup, { children: [
|
|
3880
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3839
3881
|
import_material16.FormControlLabel,
|
|
3840
3882
|
{
|
|
3841
|
-
control: /* @__PURE__ */ (0,
|
|
3883
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material16.Checkbox, { checked: options.fromOtherTables, onChange: handleOptionChange, name: "fromOtherTables" }),
|
|
3842
3884
|
label: "Desde otras tablas"
|
|
3843
3885
|
}
|
|
3844
3886
|
),
|
|
3845
|
-
/* @__PURE__ */ (0,
|
|
3887
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3846
3888
|
import_material16.FormControlLabel,
|
|
3847
3889
|
{
|
|
3848
|
-
control: /* @__PURE__ */ (0,
|
|
3890
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material16.Checkbox, { checked: options.readOnly, onChange: handleOptionChange, name: "readOnly" }),
|
|
3849
3891
|
label: "Solo lectura"
|
|
3850
3892
|
}
|
|
3851
3893
|
),
|
|
3852
|
-
/* @__PURE__ */ (0,
|
|
3894
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3853
3895
|
import_material16.FormControlLabel,
|
|
3854
3896
|
{
|
|
3855
|
-
control: /* @__PURE__ */ (0,
|
|
3897
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material16.Checkbox, { checked: options.hiddens, onChange: handleOptionChange, name: "hiddens" }),
|
|
3856
3898
|
label: "Ocultos"
|
|
3857
3899
|
}
|
|
3858
3900
|
)
|
|
3859
3901
|
] })
|
|
3860
3902
|
] })
|
|
3861
3903
|
] }) }),
|
|
3862
|
-
/* @__PURE__ */ (0,
|
|
3863
|
-
/* @__PURE__ */ (0,
|
|
3864
|
-
/* @__PURE__ */ (0,
|
|
3904
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material16.DialogActions, { children: [
|
|
3905
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material16.Button, { onClick: onClose, disabled: isPreparing, children: "Cancelar" }),
|
|
3906
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material16.Button, { onClick: handlePrepareExport, variant: "contained", disabled: isPreparing, children: "Descargar" })
|
|
3865
3907
|
] })
|
|
3866
3908
|
] });
|
|
3867
3909
|
};
|
|
3868
3910
|
|
|
3869
3911
|
// src/components/grid/DialogoDeColumnas.tsx
|
|
3870
3912
|
var import_material17 = require("@mui/material");
|
|
3871
|
-
var
|
|
3913
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3872
3914
|
var DialogoDeColumnas = ({ open, onClose, columnas, ocultas, alternarColumna }) => {
|
|
3873
|
-
const lista = (titulo, nombres, idDeLista) => /* @__PURE__ */ (0,
|
|
3874
|
-
/* @__PURE__ */ (0,
|
|
3875
|
-
/* @__PURE__ */ (0,
|
|
3915
|
+
const lista = (titulo, nombres, idDeLista) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material17.Box, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
3916
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material17.Typography, { variant: "subtitle2", sx: { mb: 1 }, children: titulo }),
|
|
3917
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material17.List, { dense: true, "data-testid": idDeLista, sx: { maxHeight: 360, overflow: "auto", border: 1, borderColor: "divider", borderRadius: 1 }, children: nombres.map((nombre) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material17.ListItemButton, { onClick: () => alternarColumna(nombre), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material17.ListItemText, { primary: nombre }) }, nombre)) })
|
|
3876
3918
|
] });
|
|
3877
|
-
return /* @__PURE__ */ (0,
|
|
3878
|
-
/* @__PURE__ */ (0,
|
|
3879
|
-
/* @__PURE__ */ (0,
|
|
3919
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material17.Dialog, { open, onClose, maxWidth: "sm", fullWidth: true, children: [
|
|
3920
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material17.DialogTitle, { children: "Ocultar o mostrar columnas" }),
|
|
3921
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material17.DialogContent, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material17.Box, { sx: { display: "flex", gap: 2, pt: 1 }, children: [
|
|
3880
3922
|
lista("Columnas mostradas", columnas.filter((nombre) => !ocultas.has(nombre)), "columnas-mostradas"),
|
|
3881
3923
|
lista("Columnas ocultas", columnas.filter((nombre) => ocultas.has(nombre)), "columnas-ocultas")
|
|
3882
3924
|
] }) }),
|
|
3883
|
-
/* @__PURE__ */ (0,
|
|
3925
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material17.DialogActions, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material17.Button, { onClick: onClose, children: "Cerrar" }) })
|
|
3884
3926
|
] });
|
|
3885
3927
|
};
|
|
3886
3928
|
|
|
@@ -3888,7 +3930,7 @@ var DialogoDeColumnas = ({ open, onClose, columnas, ocultas, alternarColumna })
|
|
|
3888
3930
|
var import_react25 = require("react");
|
|
3889
3931
|
var import_material18 = require("@mui/material");
|
|
3890
3932
|
var import_Close = __toESM(require("@mui/icons-material/Close"), 1);
|
|
3891
|
-
var
|
|
3933
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3892
3934
|
var SIN_OCULTAS = /* @__PURE__ */ new Set();
|
|
3893
3935
|
var VerticalEditorPage = ({
|
|
3894
3936
|
tableName,
|
|
@@ -4017,21 +4059,21 @@ var VerticalEditorPage = ({
|
|
|
4017
4059
|
tableDefinition,
|
|
4018
4060
|
onSaveSuccess
|
|
4019
4061
|
]);
|
|
4020
|
-
return /* @__PURE__ */ (0,
|
|
4021
|
-
/* @__PURE__ */ (0,
|
|
4022
|
-
/* @__PURE__ */ (0,
|
|
4062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material18.Box, { sx: { p: 2, display: "flex", flexDirection: "column", height: "100%" }, children: [
|
|
4063
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material18.DialogTitle, { sx: { px: 0, pt: 0, display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
4064
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material18.Typography, { component: "div", variant: "h6", children: [
|
|
4023
4065
|
isNewRow ? "Nuevo Registro" : "Editar Registro",
|
|
4024
4066
|
" - ",
|
|
4025
4067
|
tableDefinition.title || tableName
|
|
4026
4068
|
] }),
|
|
4027
|
-
/* @__PURE__ */ (0,
|
|
4069
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material18.IconButton, { onClick: onClose, size: "small", edge: "end", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_Close.default, {}) })
|
|
4028
4070
|
] }),
|
|
4029
|
-
/* @__PURE__ */ (0,
|
|
4030
|
-
globalError && /* @__PURE__ */ (0,
|
|
4031
|
-
/* @__PURE__ */ (0,
|
|
4071
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material18.DialogContent, { dividers: true, sx: { px: 2, flexGrow: 1, py: 1 }, children: [
|
|
4072
|
+
globalError && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material18.Alert, { severity: "error", sx: { mb: 2 }, children: globalError }),
|
|
4073
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material18.Box, { sx: { display: "flex", flexDirection: "column", gap: 0.5 }, children: tableDefinition.fields.filter((field) => campoDibujable(field) && !columnasOcultas.has(field.name)).map((field) => {
|
|
4032
4074
|
const isFixed = fixedFields?.some((ff) => ff.fieldName === field.name);
|
|
4033
4075
|
const isMandatory = field.nullable === false || tableDefinition.primaryKey.includes(field.name);
|
|
4034
|
-
return /* @__PURE__ */ (0,
|
|
4076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material18.Box, { sx: { width: "100%", maxWidth: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4035
4077
|
TypedField,
|
|
4036
4078
|
{
|
|
4037
4079
|
fieldDef: field,
|
|
@@ -4045,12 +4087,12 @@ var VerticalEditorPage = ({
|
|
|
4045
4087
|
) }, field.name);
|
|
4046
4088
|
}) })
|
|
4047
4089
|
] }),
|
|
4048
|
-
/* @__PURE__ */ (0,
|
|
4049
|
-
/* @__PURE__ */ (0,
|
|
4050
|
-
isSaving && /* @__PURE__ */ (0,
|
|
4051
|
-
/* @__PURE__ */ (0,
|
|
4090
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material18.DialogActions, { sx: { px: 0, pb: 0, pt: 2, justifyContent: "space-between", alignItems: "center" }, children: [
|
|
4091
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material18.Box, { children: [
|
|
4092
|
+
isSaving && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material18.CircularProgress, { size: 20, sx: { ml: 2 } }),
|
|
4093
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { style: { marginLeft: 10, fontSize: "0.8rem", color: "#666" }, children: isSaving ? "Guardando..." : "Cambios auto-guardados" })
|
|
4052
4094
|
] }),
|
|
4053
|
-
/* @__PURE__ */ (0,
|
|
4095
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material18.Button, { variant: "outlined", onClick: onClose, children: "Cerrar" })
|
|
4054
4096
|
] })
|
|
4055
4097
|
] });
|
|
4056
4098
|
};
|
|
@@ -4122,47 +4164,383 @@ function fusionar(base, cambios) {
|
|
|
4122
4164
|
return resultado;
|
|
4123
4165
|
}
|
|
4124
4166
|
|
|
4125
|
-
// src/
|
|
4126
|
-
var
|
|
4127
|
-
var
|
|
4128
|
-
|
|
4167
|
+
// src/puente/habilitacion.ts
|
|
4168
|
+
var habilitado = false;
|
|
4169
|
+
var habilitarPuenteBP = () => {
|
|
4170
|
+
habilitado = true;
|
|
4171
|
+
};
|
|
4172
|
+
var puenteBPHabilitado = () => habilitado;
|
|
4129
4173
|
|
|
4130
|
-
// src/
|
|
4131
|
-
var
|
|
4132
|
-
var
|
|
4133
|
-
var
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
var
|
|
4137
|
-
var
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
const
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4174
|
+
// src/puente/GrillaBP.tsx
|
|
4175
|
+
var import_react27 = require("react");
|
|
4176
|
+
var import_react_router_dom = require("react-router-dom");
|
|
4177
|
+
var import_material20 = require("@mui/material");
|
|
4178
|
+
|
|
4179
|
+
// src/puente/estilosBP.ts
|
|
4180
|
+
var CLASE_CONTENEDOR_BP = "fpr-bp";
|
|
4181
|
+
var cierreDeBloque = (css, abre) => {
|
|
4182
|
+
let profundidad = 0;
|
|
4183
|
+
let comilla = "";
|
|
4184
|
+
for (let i = abre; i < css.length; i++) {
|
|
4185
|
+
const c = css[i];
|
|
4186
|
+
if (comilla) {
|
|
4187
|
+
if (c === "\\") i++;
|
|
4188
|
+
else if (c === comilla) comilla = "";
|
|
4189
|
+
} else if (c === '"' || c === "'") comilla = c;
|
|
4190
|
+
else if (c === "{") profundidad++;
|
|
4191
|
+
else if (c === "}" && --profundidad === 0) return i;
|
|
4192
|
+
}
|
|
4193
|
+
return css.length - 1;
|
|
4194
|
+
};
|
|
4195
|
+
var partirPor = (lista, separador) => {
|
|
4196
|
+
const partes = [];
|
|
4197
|
+
let profundidad = 0;
|
|
4198
|
+
let comilla = "";
|
|
4199
|
+
let inicio = 0;
|
|
4200
|
+
for (let i = 0; i < lista.length; i++) {
|
|
4201
|
+
const c = lista[i];
|
|
4202
|
+
if (comilla) {
|
|
4203
|
+
if (c === "\\") i++;
|
|
4204
|
+
else if (c === comilla) comilla = "";
|
|
4205
|
+
} else if (c === '"' || c === "'") comilla = c;
|
|
4206
|
+
else if (c === "(" || c === "[") profundidad++;
|
|
4207
|
+
else if (c === ")" || c === "]") profundidad--;
|
|
4208
|
+
else if (c === separador && profundidad === 0) {
|
|
4209
|
+
partes.push(lista.slice(inicio, i));
|
|
4210
|
+
inicio = i + 1;
|
|
4211
|
+
}
|
|
4212
|
+
}
|
|
4213
|
+
partes.push(lista.slice(inicio));
|
|
4214
|
+
return partes;
|
|
4215
|
+
};
|
|
4216
|
+
var RAIZ = /^(html|body|:root)(?![\w-])/;
|
|
4217
|
+
var ATRIBUTO_DE_RAIZ = /^\[my-skin[^\]]*\]/;
|
|
4218
|
+
var MEDIDAS_DE_DOCUMENTO = /^(overflow(-[xy])?|(min-|max-)?height|position)$/i;
|
|
4219
|
+
var DE_DIALOGO = /^(div)?\.dialog-|^\[key-selected\]/;
|
|
4220
|
+
var acotarSelector = (selector) => {
|
|
4221
|
+
const limpio = selector.trim();
|
|
4222
|
+
const contenedor = `.${CLASE_CONTENEDOR_BP}`;
|
|
4223
|
+
if (DE_DIALOGO.test(limpio)) return { selector: limpio, deRaiz: false };
|
|
4224
|
+
const atributo = ATRIBUTO_DE_RAIZ.exec(limpio);
|
|
4225
|
+
if (atributo) {
|
|
4226
|
+
const resto = limpio.slice(atributo[0].length).trim();
|
|
4227
|
+
const raiz2 = RAIZ.exec(resto);
|
|
4228
|
+
if (!resto) return { selector: contenedor + atributo[0], deRaiz: true };
|
|
4229
|
+
if (raiz2) return { selector: contenedor + atributo[0] + resto.slice(raiz2[0].length), deRaiz: true };
|
|
4230
|
+
return { selector: `${contenedor}${atributo[0]} ${resto}`, deRaiz: false };
|
|
4231
|
+
}
|
|
4232
|
+
const raiz = RAIZ.exec(limpio);
|
|
4233
|
+
if (raiz) {
|
|
4234
|
+
return { selector: contenedor + limpio.slice(raiz[0].length).replace(/^\s*>?\s*body(?![\w-])/, ""), deRaiz: true };
|
|
4235
|
+
}
|
|
4236
|
+
return { selector: `${contenedor} ${limpio}`, deRaiz: false };
|
|
4237
|
+
};
|
|
4238
|
+
var sinMedidasDeDocumento = (bloque) => `{${partirPor(bloque.slice(1, -1), ";").filter((declaracion) => !MEDIDAS_DE_DOCUMENTO.test(declaracion.split(":")[0].trim())).join(";")}}`;
|
|
4239
|
+
var acotarRegla = (preludio, bloque) => {
|
|
4240
|
+
const selectores = partirPor(preludio, ",").filter((selector) => selector.trim()).map(acotarSelector);
|
|
4241
|
+
const deRaiz = selectores.filter((s) => s.deRaiz).map((s) => s.selector);
|
|
4242
|
+
const otros = selectores.filter((s) => !s.deRaiz).map((s) => s.selector);
|
|
4243
|
+
return [
|
|
4244
|
+
deRaiz.length ? `${deRaiz.join(", ")} ${sinMedidasDeDocumento(bloque)}` : "",
|
|
4245
|
+
otros.length ? `${otros.join(", ")} ${bloque}` : ""
|
|
4246
|
+
].filter(Boolean).join(" ");
|
|
4247
|
+
};
|
|
4248
|
+
var urlsAbsolutas = (css, urlHoja) => css.replace(
|
|
4249
|
+
/url\(\s*(['"]?)([^'")]+)\1\s*\)/g,
|
|
4250
|
+
(completo, comilla, ruta) => /^(data:|#)/.test(ruta) ? completo : `url(${comilla}${new URL(ruta, urlHoja).href}${comilla})`
|
|
4251
|
+
);
|
|
4252
|
+
var ARROBAS_CON_REGLAS = /^@(media|supports|layer|container|document)\b/i;
|
|
4253
|
+
var acotarReglas = (css) => {
|
|
4254
|
+
let salida = "";
|
|
4255
|
+
let i = 0;
|
|
4256
|
+
while (i < css.length) {
|
|
4257
|
+
const llave = css.indexOf("{", i);
|
|
4258
|
+
const puntoYComa = css.indexOf(";", i);
|
|
4259
|
+
if (llave === -1 && puntoYComa === -1) {
|
|
4260
|
+
salida += css.slice(i);
|
|
4261
|
+
break;
|
|
4262
|
+
}
|
|
4263
|
+
if (puntoYComa !== -1 && (llave === -1 || puntoYComa < llave) && css.slice(i).trimStart().startsWith("@")) {
|
|
4264
|
+
salida += css.slice(i, puntoYComa + 1);
|
|
4265
|
+
i = puntoYComa + 1;
|
|
4266
|
+
continue;
|
|
4267
|
+
}
|
|
4268
|
+
if (llave === -1) {
|
|
4269
|
+
salida += css.slice(i);
|
|
4270
|
+
break;
|
|
4271
|
+
}
|
|
4272
|
+
const preludio = css.slice(i, llave);
|
|
4273
|
+
const cierre = cierreDeBloque(css, llave);
|
|
4274
|
+
const bloque = css.slice(llave, cierre + 1);
|
|
4275
|
+
const encabezado = preludio.trim();
|
|
4276
|
+
if (encabezado.startsWith("@")) {
|
|
4277
|
+
salida += ARROBAS_CON_REGLAS.test(encabezado) ? `${preludio}{${acotarReglas(bloque.slice(1, -1))}}` : preludio + bloque;
|
|
4278
|
+
} else {
|
|
4279
|
+
salida += acotarRegla(preludio, bloque);
|
|
4280
|
+
}
|
|
4281
|
+
i = cierre + 1;
|
|
4282
|
+
}
|
|
4283
|
+
return salida;
|
|
4284
|
+
};
|
|
4285
|
+
var acotarEstilos = (css, urlHoja) => acotarReglas(urlsAbsolutas(css.replace(/\/\*[\s\S]*?\*\//g, ""), urlHoja));
|
|
4286
|
+
var copiarSkinAlContenedor = (dentro) => {
|
|
4287
|
+
const skin = document.body.getAttribute("my-skin");
|
|
4288
|
+
const contenedor = dentro.closest(`.${CLASE_CONTENEDOR_BP}`);
|
|
4289
|
+
if (skin && contenedor) contenedor.setAttribute("my-skin", skin);
|
|
4290
|
+
};
|
|
4291
|
+
|
|
4292
|
+
// src/puente/clienteBP.ts
|
|
4293
|
+
function extraerRecursos(html) {
|
|
4294
|
+
const documento = new DOMParser().parseFromString(html, "text/html");
|
|
4295
|
+
const referencias2 = (selector, atributo) => Array.from(documento.querySelectorAll(selector)).map((elemento) => elemento.getAttribute(atributo)).filter((ruta) => !!ruta);
|
|
4296
|
+
return {
|
|
4297
|
+
hojasDeEstilo: referencias2("link[rel=stylesheet]", "href"),
|
|
4298
|
+
scripts: referencias2("script[src]", "src")
|
|
4299
|
+
};
|
|
4300
|
+
}
|
|
4301
|
+
function fijarBase(urlBackend) {
|
|
4302
|
+
const href = new URL(urlBackend.replace(/\/*$/, "/"), window.location.href).href;
|
|
4303
|
+
let base = document.querySelector("base");
|
|
4304
|
+
if (!base) {
|
|
4305
|
+
base = document.createElement("base");
|
|
4306
|
+
document.head.prepend(base);
|
|
4307
|
+
}
|
|
4308
|
+
base.href = href;
|
|
4309
|
+
}
|
|
4310
|
+
function cargarScript(ruta) {
|
|
4311
|
+
return new Promise((resolver, rechazar) => {
|
|
4312
|
+
const script = document.createElement("script");
|
|
4313
|
+
script.async = false;
|
|
4314
|
+
script.src = ruta;
|
|
4315
|
+
script.onload = () => resolver();
|
|
4316
|
+
script.onerror = () => rechazar(new Error(`No se pudo cargar ${ruta}`));
|
|
4317
|
+
document.head.appendChild(script);
|
|
4318
|
+
});
|
|
4319
|
+
}
|
|
4320
|
+
function esperarCargaDeVentana() {
|
|
4321
|
+
if (document.readyState === "complete") return Promise.resolve();
|
|
4322
|
+
return new Promise((resolver) => window.addEventListener("load", () => resolver(), { once: true }));
|
|
4323
|
+
}
|
|
4324
|
+
async function sinEscuchasDeVentana(tipos, inyectar) {
|
|
4325
|
+
const original = window.addEventListener;
|
|
4326
|
+
const filtrada = function(tipo, escucha, opciones) {
|
|
4327
|
+
if (tipos.includes(tipo)) return;
|
|
4328
|
+
original.call(this, tipo, escucha, opciones);
|
|
4329
|
+
};
|
|
4330
|
+
window.addEventListener = filtrada;
|
|
4331
|
+
try {
|
|
4332
|
+
return await inyectar();
|
|
4333
|
+
} finally {
|
|
4334
|
+
if (window.addEventListener === filtrada) window.addEventListener = original;
|
|
4335
|
+
}
|
|
4336
|
+
}
|
|
4337
|
+
async function cargarScripts(rutas) {
|
|
4338
|
+
for (const ruta of rutas) {
|
|
4339
|
+
await cargarScript(ruta);
|
|
4340
|
+
}
|
|
4341
|
+
}
|
|
4342
|
+
var carga = null;
|
|
4343
|
+
function cargarClienteBP(urlBackend) {
|
|
4344
|
+
if (!carga) {
|
|
4345
|
+
carga = cargarSinMemoria(urlBackend).catch((error) => {
|
|
4346
|
+
carga = null;
|
|
4347
|
+
throw error;
|
|
4348
|
+
});
|
|
4349
|
+
}
|
|
4350
|
+
return carga;
|
|
4351
|
+
}
|
|
4352
|
+
async function cargarSinMemoria(urlBackend) {
|
|
4353
|
+
const destino = new URL(urlBackend, window.location.href);
|
|
4354
|
+
if (destino.origin !== window.location.origin) {
|
|
4355
|
+
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}).`);
|
|
4356
|
+
}
|
|
4357
|
+
fijarBase(urlBackend);
|
|
4358
|
+
const respuesta = await fetch(`${destino.pathname.replace(/\/*$/, "")}/menu`, { credentials: "include" });
|
|
4359
|
+
if (!respuesta.ok || /\/login\/?$/.test(new URL(respuesta.url).pathname)) {
|
|
4360
|
+
throw new Error("No hay una sesi\xF3n iniciada en el backend.");
|
|
4361
|
+
}
|
|
4362
|
+
const recursos = extraerRecursos(await respuesta.text());
|
|
4363
|
+
await Promise.all(recursos.hojasDeEstilo.map(async (ruta) => {
|
|
4364
|
+
const url = new URL(ruta, document.baseURI).href;
|
|
4365
|
+
try {
|
|
4366
|
+
const hoja = await fetch(url, { credentials: "include" });
|
|
4367
|
+
if (!hoja.ok) throw new Error(`${hoja.status}`);
|
|
4368
|
+
const estilo = document.createElement("style");
|
|
4369
|
+
estilo.textContent = acotarEstilos(await hoja.text(), url);
|
|
4370
|
+
document.head.appendChild(estilo);
|
|
4371
|
+
} catch (err) {
|
|
4372
|
+
console.warn(`No se pudo cargar la hoja de estilo ${url}:`, err);
|
|
4373
|
+
}
|
|
4374
|
+
}));
|
|
4375
|
+
await esperarCargaDeVentana();
|
|
4376
|
+
await sinEscuchasDeVentana(["popstate"], () => cargarScripts(recursos.scripts));
|
|
4377
|
+
const myOwn = window.myOwn;
|
|
4378
|
+
if (!myOwn) throw new Error("El backend no defini\xF3 myOwn.");
|
|
4379
|
+
window.my = myOwn;
|
|
4380
|
+
await myOwn.autoSetup();
|
|
4381
|
+
return myOwn;
|
|
4382
|
+
}
|
|
4383
|
+
|
|
4384
|
+
// src/puente/ConsolaBP.tsx
|
|
4385
|
+
var import_react26 = require("react");
|
|
4386
|
+
var import_material19 = require("@mui/material");
|
|
4387
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4388
|
+
var MARGEN_DE_REPETIDO_MS = 1e3;
|
|
4389
|
+
function descartarRepetidos(consola, agregados, ahora) {
|
|
4390
|
+
for (const nodo of agregados) {
|
|
4391
|
+
if (!(nodo instanceof HTMLElement)) continue;
|
|
4392
|
+
const repetido = Array.from(consola.children).find(
|
|
4393
|
+
(otro) => otro instanceof HTMLElement && otro !== nodo && otro.className === nodo.className && otro.textContent === nodo.textContent && ahora - Number(otro.dataset.instante) < MARGEN_DE_REPETIDO_MS
|
|
4394
|
+
);
|
|
4395
|
+
if (repetido) nodo.remove();
|
|
4396
|
+
else nodo.dataset.instante = String(ahora);
|
|
4397
|
+
}
|
|
4398
|
+
}
|
|
4399
|
+
var ConsolaBP = () => {
|
|
4400
|
+
(0, import_react26.useEffect)(() => {
|
|
4401
|
+
const consola = document.getElementById("mini-console");
|
|
4402
|
+
if (!consola) return;
|
|
4403
|
+
const observador = new MutationObserver(
|
|
4404
|
+
(registros) => descartarRepetidos(consola, registros.flatMap((registro) => Array.from(registro.addedNodes)), Date.now())
|
|
4405
|
+
);
|
|
4406
|
+
observador.observe(consola, { childList: true });
|
|
4407
|
+
return () => observador.disconnect();
|
|
4408
|
+
}, []);
|
|
4409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4410
|
+
import_material19.Box,
|
|
4411
|
+
{
|
|
4412
|
+
id: "mini-console",
|
|
4413
|
+
sx: (tema) => ({
|
|
4414
|
+
"&#mini-console": {
|
|
4415
|
+
position: "fixed",
|
|
4416
|
+
top: { xs: 64, sm: 72 },
|
|
4417
|
+
left: "auto",
|
|
4418
|
+
right: 16,
|
|
4419
|
+
bottom: "auto",
|
|
4420
|
+
float: "none",
|
|
4421
|
+
zIndex: tema.zIndex.snackbar,
|
|
4422
|
+
width: "auto",
|
|
4423
|
+
minWidth: 0,
|
|
4424
|
+
maxWidth: "min(480px, calc(100vw - 32px))",
|
|
4425
|
+
minHeight: 0,
|
|
4426
|
+
maxHeight: "none",
|
|
4427
|
+
overflow: "visible",
|
|
4428
|
+
padding: 0,
|
|
4429
|
+
border: "none",
|
|
4430
|
+
borderRadius: 0,
|
|
4431
|
+
boxShadow: "none",
|
|
4432
|
+
backgroundColor: "transparent",
|
|
4433
|
+
fontSize: "inherit",
|
|
4434
|
+
display: "flex",
|
|
4435
|
+
flexDirection: "column",
|
|
4436
|
+
gap: 1
|
|
4437
|
+
},
|
|
4438
|
+
"&#mini-console:not(:empty)": { display: "flex" },
|
|
4439
|
+
"&#mini-console:empty": { display: "none" },
|
|
4440
|
+
"& > div": {
|
|
4441
|
+
p: "6px 12px",
|
|
4442
|
+
borderRadius: 1,
|
|
4443
|
+
boxShadow: tema.shadows[3],
|
|
4444
|
+
fontSize: "0.875rem",
|
|
4445
|
+
whiteSpace: "pre-wrap",
|
|
4446
|
+
overflowWrap: "anywhere",
|
|
4447
|
+
backgroundColor: tema.palette.grey[800],
|
|
4448
|
+
color: tema.palette.common.white
|
|
4449
|
+
},
|
|
4450
|
+
"& > .status-error": {
|
|
4451
|
+
backgroundColor: tema.palette.error.main,
|
|
4452
|
+
color: tema.palette.error.contrastText
|
|
4453
|
+
}
|
|
4454
|
+
})
|
|
4455
|
+
}
|
|
4456
|
+
);
|
|
4457
|
+
};
|
|
4458
|
+
|
|
4459
|
+
// src/puente/GrillaBP.tsx
|
|
4460
|
+
var import_jsx_runtime25 = (
|
|
4461
|
+
// 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
|
|
4462
|
+
require("react/jsx-runtime")
|
|
4463
|
+
);
|
|
4464
|
+
var GrillaBP = ({ tabla, fixedFields }) => {
|
|
4465
|
+
const contenedor = (0, import_react27.useRef)(null);
|
|
4466
|
+
const [cargando, setCargando] = (0, import_react27.useState)(true);
|
|
4467
|
+
const [error, setError] = (0, import_react27.useState)(null);
|
|
4468
|
+
const clave = JSON.stringify(fixedFields ?? []);
|
|
4469
|
+
(0, import_react27.useEffect)(() => {
|
|
4470
|
+
const elemento = contenedor.current;
|
|
4471
|
+
if (!elemento) return;
|
|
4472
|
+
let vigente = true;
|
|
4473
|
+
setError(null);
|
|
4474
|
+
setCargando(true);
|
|
4475
|
+
cargarClienteBP(envConfig.backendUrl).then((myOwn) => {
|
|
4476
|
+
if (!vigente) return;
|
|
4477
|
+
setCargando(false);
|
|
4478
|
+
copiarSkinAlContenedor(elemento);
|
|
4479
|
+
elemento.replaceChildren();
|
|
4480
|
+
myOwn.tableGrid(tabla, elemento, { fixedFields: JSON.parse(clave) });
|
|
4481
|
+
}).catch((err) => {
|
|
4482
|
+
if (!vigente) return;
|
|
4483
|
+
setCargando(false);
|
|
4484
|
+
setError(mensajeDeError(err));
|
|
4485
|
+
});
|
|
4486
|
+
return () => {
|
|
4487
|
+
vigente = false;
|
|
4488
|
+
elemento.replaceChildren();
|
|
4489
|
+
};
|
|
4490
|
+
}, [tabla, clave]);
|
|
4491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material20.Box, { className: CLASE_CONTENEDOR_BP, sx: { position: "relative" }, children: [
|
|
4492
|
+
cargando && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.CircularProgress, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
|
|
4493
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Alert, { severity: "error", sx: { m: 2 }, children: error }),
|
|
4494
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref: contenedor }),
|
|
4495
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ConsolaBP, {})
|
|
4496
|
+
] });
|
|
4497
|
+
};
|
|
4498
|
+
var PaginaGrillaBP = () => {
|
|
4499
|
+
const { tableName = "" } = (0, import_react_router_dom.useParams)();
|
|
4500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GrillaBP, { tabla: tableName }, tableName);
|
|
4501
|
+
};
|
|
4502
|
+
|
|
4503
|
+
// src/rutaBase.ts
|
|
4504
|
+
var import_meta2 = {};
|
|
4505
|
+
var baseDelBundler = import_meta2.env?.BASE_URL ?? "/";
|
|
4506
|
+
var rutaBase = baseDelBundler.replace(/\/+$/, "");
|
|
4507
|
+
|
|
4508
|
+
// src/components/grid/GenericDataGrid.tsx
|
|
4509
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4510
|
+
var SUMMARY_ROW_HEIGHT = 35;
|
|
4511
|
+
var FILTER_ROW_HEIGHT = 35;
|
|
4512
|
+
var HEADER_ROW_HEIGHT = 30;
|
|
4513
|
+
var ROW_HEIGHT = 30;
|
|
4514
|
+
var MIN_BODY_HEIGHT = 260;
|
|
4515
|
+
var DURACION_FEEDBACK_EXITO = 3e3;
|
|
4516
|
+
var ALTO_TITULO_ANIDADA = 26;
|
|
4517
|
+
var ALTO_MINIMO_CUERPO_ANIDADA = 120;
|
|
4518
|
+
var HOLGURA_ANIDADA = 24;
|
|
4519
|
+
var ANCHO_MINIMO_ANIDADA = 240;
|
|
4520
|
+
var ANCHO_RESERVADO_PANTALLA = 320;
|
|
4521
|
+
var SANGRIA_DETALLE = 28 + 8 + 3;
|
|
4522
|
+
var MARGEN_INFERIOR_PAGINA = 24;
|
|
4523
|
+
var PRIMERAS_FILAS_ANIDADA = 20;
|
|
4524
|
+
var LIMITE_PRIMERAS_FILAS_ANIDADA = 30;
|
|
4525
|
+
var esColumnaPropia = (columna) => "customType" in columna;
|
|
4526
|
+
var SIN_ANCESTROS = [];
|
|
4527
|
+
var cargasEnCurso = /* @__PURE__ */ new Map();
|
|
4528
|
+
var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
4529
|
+
const theme = (0, import_material21.useTheme)();
|
|
4530
|
+
const { tableDefinition, row } = ancestor;
|
|
4531
|
+
const columns = (0, import_react28.useMemo)(() => {
|
|
4532
|
+
const filteredFields = tableDefinition.fields.filter(
|
|
4533
|
+
(field) => !fieldsToHide?.some((ff) => ff.fieldName === field.name)
|
|
4534
|
+
);
|
|
4535
|
+
return filteredFields.map((field) => {
|
|
4536
|
+
const isPrimaryKey = tableDefinition.primaryKey.includes(field.name);
|
|
4537
|
+
return {
|
|
4538
|
+
key: field.name,
|
|
4539
|
+
name: field.label || cambiarGuionesBajosPorEspacios(field.name),
|
|
4162
4540
|
width: 150,
|
|
4163
4541
|
editable: false,
|
|
4164
|
-
renderHeaderCell: () => /* @__PURE__ */ (0,
|
|
4165
|
-
|
|
4542
|
+
renderHeaderCell: () => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Box, { sx: { p: 0.5, height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4543
|
+
import_material21.Typography,
|
|
4166
4544
|
{
|
|
4167
4545
|
variant: "caption",
|
|
4168
4546
|
sx: {
|
|
@@ -4173,11 +4551,11 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
4173
4551
|
children: field.label || cambiarGuionesBajosPorEspacios(field.name)
|
|
4174
4552
|
}
|
|
4175
4553
|
) }),
|
|
4176
|
-
renderCell: (props) => /* @__PURE__ */ (0,
|
|
4554
|
+
renderCell: (props) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Box, { sx: { px: 1, height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Typography, { variant: "body2", sx: { fontSize: "0.875rem" }, noWrap: true, children: String(props.row[field.name] ?? "") }) })
|
|
4177
4555
|
};
|
|
4178
4556
|
});
|
|
4179
4557
|
}, [tableDefinition, fieldsToHide]);
|
|
4180
|
-
return /* @__PURE__ */ (0,
|
|
4558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_material21.Box, { sx: {
|
|
4181
4559
|
mb: 1.5,
|
|
4182
4560
|
ml: index * 4,
|
|
4183
4561
|
// El primer ancestro (index 0) no tiene margen, los siguientes sí
|
|
@@ -4188,7 +4566,7 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
4188
4566
|
boxShadow: theme.shadows[1],
|
|
4189
4567
|
bgcolor: "background.paper"
|
|
4190
4568
|
}, children: [
|
|
4191
|
-
/* @__PURE__ */ (0,
|
|
4569
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Box, { sx: {
|
|
4192
4570
|
bgcolor: "primary.main",
|
|
4193
4571
|
color: "primary.contrastText",
|
|
4194
4572
|
px: 1.5,
|
|
@@ -4199,8 +4577,8 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
4199
4577
|
alignItems: "center",
|
|
4200
4578
|
fontWeight: "bold",
|
|
4201
4579
|
gap: 1
|
|
4202
|
-
}, children: /* @__PURE__ */ (0,
|
|
4203
|
-
/* @__PURE__ */ (0,
|
|
4580
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Typography, { variant: "subtitle2", component: "div", children: cambiarGuionesBajosPorEspacios(ancestor.tableName) }) }),
|
|
4581
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4204
4582
|
import_react_data_grid.DataGrid,
|
|
4205
4583
|
{
|
|
4206
4584
|
className: "rdg-light",
|
|
@@ -4233,48 +4611,48 @@ var GenericDataGrid = ({
|
|
|
4233
4611
|
altoMaximoDetalle
|
|
4234
4612
|
}) => {
|
|
4235
4613
|
const claveFixedFields = JSON.stringify(fixedFieldsRecibidos ?? null);
|
|
4236
|
-
const fixedFields = (0,
|
|
4614
|
+
const fixedFields = (0, import_react28.useMemo)(() => fixedFieldsRecibidos, [claveFixedFields]);
|
|
4237
4615
|
const claveParametros = JSON.stringify([filterColumnsRecibidos ?? null, tableDefRecibido ?? null, parameterFunctionsRecibido ?? null, pickRecibido ?? null]);
|
|
4238
|
-
const parametros = (0,
|
|
4616
|
+
const parametros = (0, import_react28.useMemo)(
|
|
4239
4617
|
() => ({ filterColumns: filterColumnsRecibidos, tableDef: tableDefRecibido, parameterFunctions: parameterFunctionsRecibido, pick: pickRecibido }),
|
|
4240
4618
|
[claveParametros]
|
|
4241
4619
|
// eslint-disable-line react-hooks/exhaustive-deps
|
|
4242
4620
|
);
|
|
4243
|
-
const cacheHeredado = (0,
|
|
4244
|
-
const [cachePropio] = (0,
|
|
4621
|
+
const cacheHeredado = (0, import_react28.useContext)(CacheGrillasContext);
|
|
4622
|
+
const [cachePropio] = (0, import_react28.useState)(() => /* @__PURE__ */ new Map());
|
|
4245
4623
|
const cache = cacheHeredado ?? cachePropio;
|
|
4246
|
-
const [guardada] = (0,
|
|
4247
|
-
const claveCargadaRef = (0,
|
|
4248
|
-
const [tableDefinition, setTableDefinition] = (0,
|
|
4249
|
-
const [tableData, setTableData] = (0,
|
|
4250
|
-
const [cargandoInicial, setCargandoInicial] = (0,
|
|
4251
|
-
const [errorDeCarga, setErrorDeCarga] = (0,
|
|
4252
|
-
const [anchosCalculados, setAnchosCalculados] = (0,
|
|
4253
|
-
const [columnasOcultas, setColumnasOcultas] = (0,
|
|
4254
|
-
const [openDialogoDeColumnas, setOpenDialogoDeColumnas] = (0,
|
|
4255
|
-
const conjuntoDeOcultas = (0,
|
|
4256
|
-
const ocultarColumna = (0,
|
|
4257
|
-
const alternarColumna = (0,
|
|
4258
|
-
const abrirDialogoDeColumnas = (0,
|
|
4259
|
-
const [detallesAbiertos, setDetallesAbiertos] = (0,
|
|
4260
|
-
const [altosDetalle, setAltosDetalle] = (0,
|
|
4261
|
-
const [anchosDetalle, setAnchosDetalle] = (0,
|
|
4262
|
-
const [selectedRows, setSelectedRows] = (0,
|
|
4263
|
-
const [, setSelectedCell] = (0,
|
|
4264
|
-
const [estadoGrilla] = (0,
|
|
4265
|
-
const theme = (0,
|
|
4266
|
-
const [openDataGridOptions, setOpenDataGridOptions] = (0,
|
|
4267
|
-
const [dataGridOptionsAnchorEl, setDataGridOptionsAnchorEl] = (0,
|
|
4268
|
-
const [exitingRowIds, setExitingRowIds] = (0,
|
|
4624
|
+
const [guardada] = (0, import_react28.useState)(() => claveCache ? cache.get(claveCache) : void 0);
|
|
4625
|
+
const claveCargadaRef = (0, import_react28.useRef)(guardada ? `${tableName}|${claveFixedFields}|${claveParametros}` : null);
|
|
4626
|
+
const [tableDefinition, setTableDefinition] = (0, import_react28.useState)(guardada?.tableDefinition ?? null);
|
|
4627
|
+
const [tableData, setTableData] = (0, import_react28.useState)(guardada?.tableData ?? []);
|
|
4628
|
+
const [cargandoInicial, setCargandoInicial] = (0, import_react28.useState)(!guardada);
|
|
4629
|
+
const [errorDeCarga, setErrorDeCarga] = (0, import_react28.useState)(null);
|
|
4630
|
+
const [anchosCalculados, setAnchosCalculados] = (0, import_react28.useState)(() => guardada?.anchosCalculados ?? /* @__PURE__ */ new Map());
|
|
4631
|
+
const [columnasOcultas, setColumnasOcultas] = (0, import_react28.useState)(() => guardada?.columnasOcultas ?? []);
|
|
4632
|
+
const [openDialogoDeColumnas, setOpenDialogoDeColumnas] = (0, import_react28.useState)(false);
|
|
4633
|
+
const conjuntoDeOcultas = (0, import_react28.useMemo)(() => new Set(columnasOcultas), [columnasOcultas]);
|
|
4634
|
+
const ocultarColumna = (0, import_react28.useCallback)((columna) => setColumnasOcultas((anteriores) => anteriores.includes(columna) ? anteriores : [...anteriores, columna]), []);
|
|
4635
|
+
const alternarColumna = (0, import_react28.useCallback)((columna) => setColumnasOcultas((anteriores) => anteriores.includes(columna) ? anteriores.filter((oculta) => oculta !== columna) : [...anteriores, columna]), []);
|
|
4636
|
+
const abrirDialogoDeColumnas = (0, import_react28.useCallback)(() => setOpenDialogoDeColumnas(true), []);
|
|
4637
|
+
const [detallesAbiertos, setDetallesAbiertos] = (0, import_react28.useState)(guardada?.detallesAbiertos ?? []);
|
|
4638
|
+
const [altosDetalle, setAltosDetalle] = (0, import_react28.useState)(() => guardada?.altosDetalle ?? /* @__PURE__ */ new Map());
|
|
4639
|
+
const [anchosDetalle, setAnchosDetalle] = (0, import_react28.useState)(() => /* @__PURE__ */ new Map());
|
|
4640
|
+
const [selectedRows, setSelectedRows] = (0, import_react28.useState)(() => /* @__PURE__ */ new Set());
|
|
4641
|
+
const [, setSelectedCell] = (0, import_react28.useState)(void 0);
|
|
4642
|
+
const [estadoGrilla] = (0, import_react28.useState)(crearEstadoGrilla);
|
|
4643
|
+
const theme = (0, import_material21.useTheme)();
|
|
4644
|
+
const [openDataGridOptions, setOpenDataGridOptions] = (0, import_react28.useState)(false);
|
|
4645
|
+
const [dataGridOptionsAnchorEl, setDataGridOptionsAnchorEl] = (0, import_react28.useState)(null);
|
|
4646
|
+
const [exitingRowIds, setExitingRowIds] = (0, import_react28.useState)(/* @__PURE__ */ new Set());
|
|
4269
4647
|
const { showError } = useSnackbar();
|
|
4270
4648
|
const { username: usuario } = useClientContext();
|
|
4271
|
-
const dataGridRef = (0,
|
|
4272
|
-
const rowAtEditStartRef = (0,
|
|
4273
|
-
const [openImportDialog, setOpenImportDialog] = (0,
|
|
4274
|
-
const [openExportDialog, setOpenExportDialog] = (0,
|
|
4275
|
-
const [columnWidths, setColumnWidths] = (0,
|
|
4649
|
+
const dataGridRef = (0, import_react28.useRef)(null);
|
|
4650
|
+
const rowAtEditStartRef = (0, import_react28.useRef)(null);
|
|
4651
|
+
const [openImportDialog, setOpenImportDialog] = (0, import_react28.useState)(false);
|
|
4652
|
+
const [openExportDialog, setOpenExportDialog] = (0, import_react28.useState)(false);
|
|
4653
|
+
const [columnWidths, setColumnWidths] = (0, import_react28.useState)(() => /* @__PURE__ */ new Map());
|
|
4276
4654
|
const { callApi, callApiUpload, loading } = useApiCall();
|
|
4277
|
-
const primaryKey = (0,
|
|
4655
|
+
const primaryKey = (0, import_react28.useMemo)(() => {
|
|
4278
4656
|
if (!tableDefinition) return ["id"];
|
|
4279
4657
|
return tableDefinition.primaryKey && tableDefinition.primaryKey.length > 0 ? tableDefinition.primaryKey : ["id"];
|
|
4280
4658
|
}, [tableDefinition]);
|
|
@@ -4293,9 +4671,9 @@ var GenericDataGrid = ({
|
|
|
4293
4671
|
summaryData,
|
|
4294
4672
|
resetView
|
|
4295
4673
|
} = useGridDataView({ tableData, tableDefinition });
|
|
4296
|
-
const abiertos = (0,
|
|
4297
|
-
const filasDetalleRef = (0,
|
|
4298
|
-
const filasMostradas = (0,
|
|
4674
|
+
const abiertos = (0, import_react28.useMemo)(() => new Set(detallesAbiertos), [detallesAbiertos]);
|
|
4675
|
+
const filasDetalleRef = (0, import_react28.useRef)(/* @__PURE__ */ new Map());
|
|
4676
|
+
const filasMostradas = (0, import_react28.useMemo)(() => {
|
|
4299
4677
|
const detailTables = tableDefinition?.detailTables ?? [];
|
|
4300
4678
|
if (abiertos.size === 0 || detailTables.length === 0) return filteredRows;
|
|
4301
4679
|
const anteriores = filasDetalleRef.current;
|
|
@@ -4322,8 +4700,8 @@ var GenericDataGrid = ({
|
|
|
4322
4700
|
filasDetalleRef.current = nuevas;
|
|
4323
4701
|
return filas;
|
|
4324
4702
|
}, [filteredRows, abiertos, tableDefinition, primaryKey]);
|
|
4325
|
-
const altoDeDetalle = (0,
|
|
4326
|
-
const altoDetalles = (0,
|
|
4703
|
+
const altoDeDetalle = (0, import_react28.useCallback)((clave) => altosDetalle.get(clave) ?? ALTO_INICIAL_DETALLE, [altosDetalle]);
|
|
4704
|
+
const altoDetalles = (0, import_react28.useMemo)(
|
|
4327
4705
|
() => filasMostradas.reduce((total, row) => esFilaDetalle(row) ? total + altoDeDetalle(row.clave) : total, 0),
|
|
4328
4706
|
[filasMostradas, altoDeDetalle]
|
|
4329
4707
|
);
|
|
@@ -4369,9 +4747,9 @@ var GenericDataGrid = ({
|
|
|
4369
4747
|
filasVisiblesMax,
|
|
4370
4748
|
conPie
|
|
4371
4749
|
});
|
|
4372
|
-
const [contenidoDeCelda, setContenidoDeCelda] = (0,
|
|
4373
|
-
const verContenido = (0,
|
|
4374
|
-
const cerrarContenidoDeCelda = (0,
|
|
4750
|
+
const [contenidoDeCelda, setContenidoDeCelda] = (0, import_react28.useState)(null);
|
|
4751
|
+
const verContenido = (0, import_react28.useCallback)((anclaje, texto) => setContenidoDeCelda({ anclaje, texto }), []);
|
|
4752
|
+
const cerrarContenidoDeCelda = (0, import_react28.useCallback)(() => {
|
|
4375
4753
|
const anclaje = contenidoDeCelda?.anclaje;
|
|
4376
4754
|
setContenidoDeCelda(null);
|
|
4377
4755
|
setTimeout(() => anclaje?.focus(), 0);
|
|
@@ -4387,8 +4765,8 @@ var GenericDataGrid = ({
|
|
|
4387
4765
|
setSortColumns,
|
|
4388
4766
|
verContenido
|
|
4389
4767
|
});
|
|
4390
|
-
const tableNameAnteriorRef = (0,
|
|
4391
|
-
(0,
|
|
4768
|
+
const tableNameAnteriorRef = (0, import_react28.useRef)(tableName);
|
|
4769
|
+
(0, import_react28.useEffect)(() => {
|
|
4392
4770
|
if (tableNameAnteriorRef.current === tableName) return;
|
|
4393
4771
|
tableNameAnteriorRef.current = tableName;
|
|
4394
4772
|
setDetallesAbiertos([]);
|
|
@@ -4402,7 +4780,7 @@ var GenericDataGrid = ({
|
|
|
4402
4780
|
setExitingRowIds(/* @__PURE__ */ new Set());
|
|
4403
4781
|
setColumnWidths(/* @__PURE__ */ new Map());
|
|
4404
4782
|
}, [tableName, estadoGrilla, resetView]);
|
|
4405
|
-
(0,
|
|
4783
|
+
(0, import_react28.useEffect)(() => {
|
|
4406
4784
|
const claveCarga = `${tableName}|${claveFixedFields}|${claveParametros}`;
|
|
4407
4785
|
if (claveCargadaRef.current === claveCarga) {
|
|
4408
4786
|
if (guardada) setSortColumns(guardada.sortColumns);
|
|
@@ -4471,11 +4849,11 @@ var GenericDataGrid = ({
|
|
|
4471
4849
|
vigente = false;
|
|
4472
4850
|
};
|
|
4473
4851
|
}, [tableName, claveFixedFields, fixedFields, claveParametros, parametros, showError, callApi, getInitialSortColumns, setSortColumns, aplicarFiltrosIniciales, guardada]);
|
|
4474
|
-
(0,
|
|
4852
|
+
(0, import_react28.useEffect)(() => {
|
|
4475
4853
|
if (!claveCache || !tableDefinition || cargandoInicial) return;
|
|
4476
4854
|
cache.set(claveCache, { tableDefinition, tableData, anchosCalculados, columnasOcultas, sortColumns, detallesAbiertos, altosDetalle });
|
|
4477
4855
|
}, [cache, claveCache, tableDefinition, tableData, anchosCalculados, columnasOcultas, sortColumns, detallesAbiertos, altosDetalle, cargandoInicial]);
|
|
4478
|
-
(0,
|
|
4856
|
+
(0, import_react28.useEffect)(() => {
|
|
4479
4857
|
let timer = null;
|
|
4480
4858
|
const desuscribir = estadoGrilla.suscribir(() => {
|
|
4481
4859
|
const hayExitos = Array.from(estadoGrilla.obtenerFeedback().values()).some((f) => f.type === "success");
|
|
@@ -4500,11 +4878,11 @@ var GenericDataGrid = ({
|
|
|
4500
4878
|
if (timer) clearTimeout(timer);
|
|
4501
4879
|
};
|
|
4502
4880
|
}, [estadoGrilla]);
|
|
4503
|
-
const resetSortingDeLaTabla = (0,
|
|
4881
|
+
const resetSortingDeLaTabla = (0, import_react28.useCallback)(() => {
|
|
4504
4882
|
if (tableDefinition) resetSorting(tableDefinition);
|
|
4505
4883
|
}, [tableDefinition, resetSorting]);
|
|
4506
|
-
const abrirImportacion = (0,
|
|
4507
|
-
const abrirExportacion = (0,
|
|
4884
|
+
const abrirImportacion = (0, import_react28.useCallback)(() => setOpenImportDialog(true), []);
|
|
4885
|
+
const abrirExportacion = (0, import_react28.useCallback)(() => setOpenExportDialog(true), []);
|
|
4508
4886
|
const { menuOptions } = useGridMenu({
|
|
4509
4887
|
tableDefinition,
|
|
4510
4888
|
tableName,
|
|
@@ -4516,11 +4894,11 @@ var GenericDataGrid = ({
|
|
|
4516
4894
|
triggerExport: abrirExportacion,
|
|
4517
4895
|
abrirColumnas: abrirDialogoDeColumnas
|
|
4518
4896
|
});
|
|
4519
|
-
const abrirOpcionesDeGrilla = (0,
|
|
4897
|
+
const abrirOpcionesDeGrilla = (0, import_react28.useCallback)((anchorEl) => {
|
|
4520
4898
|
setDataGridOptionsAnchorEl(anchorEl);
|
|
4521
4899
|
setOpenDataGridOptions(true);
|
|
4522
4900
|
}, []);
|
|
4523
|
-
const editarEnFicha = (0,
|
|
4901
|
+
const editarEnFicha = (0, import_react28.useCallback)((row) => {
|
|
4524
4902
|
rowAtEditStartRef.current = { ...row };
|
|
4525
4903
|
handleVerticalEditRow(row);
|
|
4526
4904
|
}, [handleVerticalEditRow]);
|
|
@@ -4540,7 +4918,7 @@ var GenericDataGrid = ({
|
|
|
4540
4918
|
toggleFilterVisibility,
|
|
4541
4919
|
abrirOpcionesDeGrilla
|
|
4542
4920
|
});
|
|
4543
|
-
const abrirDetalleEnPestana = (0,
|
|
4921
|
+
const abrirDetalleEnPestana = (0, import_react28.useCallback)((row, detailTable) => {
|
|
4544
4922
|
if (!onOpenDetail || !tableDefinition || !detailTable.table) return;
|
|
4545
4923
|
const porCampo = /* @__PURE__ */ new Map();
|
|
4546
4924
|
[...fixedFields ?? [], ...calcularFixedFieldsDetalle(detailTable, row)].forEach((ff) => porCampo.set(ff.fieldName, ff));
|
|
@@ -4550,12 +4928,12 @@ var GenericDataGrid = ({
|
|
|
4550
4928
|
const newAncestors = [...ancestors, { tableName: tableDefinition.name, row, tableDefinition, fixedFields: allFixedFields }];
|
|
4551
4929
|
onOpenDetail(detailTable.table, allFixedFields, label, newAncestors);
|
|
4552
4930
|
}, [onOpenDetail, tableDefinition, fixedFields, ancestors]);
|
|
4553
|
-
const abrirWScreenEnPestana = (0,
|
|
4931
|
+
const abrirWScreenEnPestana = (0, import_react28.useCallback)((row, detailTable) => {
|
|
4554
4932
|
const parametros2 = new URLSearchParams();
|
|
4555
4933
|
calcularFixedFieldsDetalle(detailTable, row).forEach((ff) => parametros2.set(ff.fieldName, String(ff.value)));
|
|
4556
4934
|
window.open(`${window.location.origin}${rutaBase}/wScreens/${detailTable.wScreen}?${parametros2}`, "_blank");
|
|
4557
4935
|
}, []);
|
|
4558
|
-
const alternarDetalle = (0,
|
|
4936
|
+
const alternarDetalle = (0, import_react28.useCallback)((row, rowId, detailTable, enOtraPestana) => {
|
|
4559
4937
|
if (enOtraPestana && detailTable.wScreen) {
|
|
4560
4938
|
abrirWScreenEnPestana(row, detailTable);
|
|
4561
4939
|
return;
|
|
@@ -4567,8 +4945,8 @@ var GenericDataGrid = ({
|
|
|
4567
4945
|
const clave = claveDetalle(rowId, detailTable);
|
|
4568
4946
|
setDetallesAbiertos((anteriores) => anteriores.includes(clave) ? anteriores.filter((c) => c !== clave) : [...anteriores, clave]);
|
|
4569
4947
|
}, [onOpenDetail, abrirDetalleEnPestana, abrirWScreenEnPestana]);
|
|
4570
|
-
const [medidas, setMedidas] = (0,
|
|
4571
|
-
(0,
|
|
4948
|
+
const [medidas, setMedidas] = (0, import_react28.useState)(null);
|
|
4949
|
+
(0, import_react28.useEffect)(() => {
|
|
4572
4950
|
const elemento = dataGridRef.current?.element;
|
|
4573
4951
|
if (!elemento) return;
|
|
4574
4952
|
const medir = () => setMedidas((anteriores) => {
|
|
@@ -4581,8 +4959,8 @@ var GenericDataGrid = ({
|
|
|
4581
4959
|
return () => observador.disconnect();
|
|
4582
4960
|
}, [tableDefinition, cargandoInicial]);
|
|
4583
4961
|
const anchoVisible = medidas?.ancho ?? null;
|
|
4584
|
-
const [altoDeVentana, setAltoDeVentana] = (0,
|
|
4585
|
-
(0,
|
|
4962
|
+
const [altoDeVentana, setAltoDeVentana] = (0, import_react28.useState)(null);
|
|
4963
|
+
(0, import_react28.useEffect)(() => {
|
|
4586
4964
|
if (anidada) return;
|
|
4587
4965
|
const elemento = dataGridRef.current?.element;
|
|
4588
4966
|
if (!elemento) return;
|
|
@@ -4591,25 +4969,25 @@ var GenericDataGrid = ({
|
|
|
4591
4969
|
window.addEventListener("resize", calcular);
|
|
4592
4970
|
return () => window.removeEventListener("resize", calcular);
|
|
4593
4971
|
}, [anidada, tableDefinition, cargandoInicial]);
|
|
4594
|
-
const altoDeContexto = (0,
|
|
4972
|
+
const altoDeContexto = (0, import_react28.useContext)(AltoDisponibleContext);
|
|
4595
4973
|
const altoDeEstaGrilla = anidada ? altoDisponible ?? (altoDeContexto === void 0 ? void 0 : altoDeContexto - ALTO_TITULO_ANIDADA) : altoDeVentana ?? void 0;
|
|
4596
4974
|
const altoMaximoDetalleEfectivo = altoMaximoDetalle ?? (altoDeEstaGrilla !== void 0 ? Math.max(ALTO_MINIMO_DETALLE, altoDeEstaGrilla - HEADER_ROW_HEIGHT - (conPie ? SUMMARY_ROW_HEIGHT : 0) - ROW_HEIGHT - (isFilterRowVisible ? FILTER_ROW_HEIGHT : 0)) : void 0);
|
|
4597
|
-
const cambiarAnchoDetalle = (0,
|
|
4975
|
+
const cambiarAnchoDetalle = (0, import_react28.useCallback)((clave, ancho) => {
|
|
4598
4976
|
setAnchosDetalle((anteriores) => anteriores.get(clave) === ancho ? anteriores : new Map(anteriores).set(clave, ancho));
|
|
4599
4977
|
}, []);
|
|
4600
|
-
const cambiarAltoDetalle = (0,
|
|
4978
|
+
const cambiarAltoDetalle = (0, import_react28.useCallback)((clave, altoDeseado2) => {
|
|
4601
4979
|
const alto = Math.min(Math.max(Math.round(altoDeseado2), ALTO_MINIMO_DETALLE), altoMaximoDetalleEfectivo ?? Infinity);
|
|
4602
4980
|
setAltosDetalle((anteriores) => anteriores.get(clave) === alto ? anteriores : new Map(anteriores).set(clave, alto));
|
|
4603
4981
|
}, [altoMaximoDetalleEfectivo]);
|
|
4604
|
-
const renderDetalle = (0,
|
|
4982
|
+
const renderDetalle = (0, import_react28.useCallback)((fila) => {
|
|
4605
4983
|
const { detailTable } = fila;
|
|
4606
|
-
return /* @__PURE__ */ (0,
|
|
4984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4607
4985
|
"div",
|
|
4608
4986
|
{
|
|
4609
4987
|
className: "fpr-detalle",
|
|
4610
4988
|
style: { maxWidth: anchoVisible ? anchoVisible - 2 : void 0 },
|
|
4611
4989
|
onKeyDown: (e) => e.stopPropagation(),
|
|
4612
|
-
children: detailTable.table ? /* @__PURE__ */ (0,
|
|
4990
|
+
children: detailTable.table ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4613
4991
|
GenericDataGrid,
|
|
4614
4992
|
{
|
|
4615
4993
|
tableName: detailTable.table,
|
|
@@ -4622,7 +5000,7 @@ var GenericDataGrid = ({
|
|
|
4622
5000
|
onOpenDetail,
|
|
4623
5001
|
ancestors: tableDefinition ? [...ancestors, { tableName: tableDefinition.name, row: fila.filaPadre, tableDefinition, fixedFields: fila.fixedFields }] : ancestors
|
|
4624
5002
|
}
|
|
4625
|
-
) : detailTable.wScreen ? /* @__PURE__ */ (0,
|
|
5003
|
+
) : detailTable.wScreen ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4626
5004
|
DetalleWScreen,
|
|
4627
5005
|
{
|
|
4628
5006
|
fila,
|
|
@@ -4630,7 +5008,7 @@ var GenericDataGrid = ({
|
|
|
4630
5008
|
onAlto: (alto) => cambiarAltoDetalle(fila.clave, alto),
|
|
4631
5009
|
onAncho: (ancho) => cambiarAnchoDetalle(fila.clave, ancho)
|
|
4632
5010
|
}
|
|
4633
|
-
) : /* @__PURE__ */ (0,
|
|
5011
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_material21.Alert, { severity: "warning", children: [
|
|
4634
5012
|
"El detalle '",
|
|
4635
5013
|
detailTable.abr,
|
|
4636
5014
|
"' no tiene ni tabla ni wScreen."
|
|
@@ -4638,18 +5016,18 @@ var GenericDataGrid = ({
|
|
|
4638
5016
|
}
|
|
4639
5017
|
);
|
|
4640
5018
|
}, [anchoVisible, claveCache, tableName, cambiarAltoDetalle, cambiarAnchoDetalle, altoMaximoDetalleEfectivo, onOpenDetail, tableDefinition, ancestors]);
|
|
4641
|
-
const detallesGrilla = (0,
|
|
5019
|
+
const detallesGrilla = (0, import_react28.useMemo)(() => ({ abiertos, alternarDetalle, renderDetalle }), [abiertos, alternarDetalle, renderDetalle]);
|
|
4642
5020
|
const altoDeseado = cargandoInicial ? ALTO_INICIAL_DETALLE : gridHeight + ALTO_TITULO_ANIDADA + 8;
|
|
4643
|
-
(0,
|
|
5021
|
+
(0, import_react28.useEffect)(() => {
|
|
4644
5022
|
onAltoDeseado?.(altoDeseado);
|
|
4645
5023
|
}, [onAltoDeseado, altoDeseado]);
|
|
4646
|
-
const rowKeyGetter = (0,
|
|
4647
|
-
const rowHeight = (0,
|
|
4648
|
-
const rowClass = (0,
|
|
5024
|
+
const rowKeyGetter = (0, import_react28.useCallback)((row) => esFilaDetalle(row) ? `detalle:${row.clave}` : getPrimaryKeyValues(row, primaryKey), [primaryKey]);
|
|
5025
|
+
const rowHeight = (0, import_react28.useCallback)((row) => esFilaDetalle(row) ? altoDeDetalle(row.clave) : ROW_HEIGHT, [altoDeDetalle]);
|
|
5026
|
+
const rowClass = (0, import_react28.useCallback)(
|
|
4649
5027
|
(row) => esFilaDetalle(row) ? "fpr-fila-detalle" : exitingRowIds.has(getPrimaryKeyValues(row, primaryKey)) ? "fpr-fila-saliendo" : void 0,
|
|
4650
5028
|
[exitingRowIds, primaryKey]
|
|
4651
5029
|
);
|
|
4652
|
-
const anchoContenido = (0,
|
|
5030
|
+
const anchoContenido = (0, import_react28.useMemo)(() => {
|
|
4653
5031
|
if (columns.length === 0) return void 0;
|
|
4654
5032
|
const sumaColumnas = columns.reduce((total, col) => {
|
|
4655
5033
|
const medido = columnWidths.get(col.key)?.width;
|
|
@@ -4659,13 +5037,13 @@ var GenericDataGrid = ({
|
|
|
4659
5037
|
const anchoDetalleMax = detallesAbiertos.reduce((max, clave) => Math.max(max, anchosDetalle.get(clave) ?? 0), 0);
|
|
4660
5038
|
return Math.max(ANCHO_MINIMO_ANIDADA, propio, anchoDetalleMax > 0 ? anchoDetalleMax + SANGRIA_DETALLE + (medidas?.barra ?? 0) + 2 : 0);
|
|
4661
5039
|
}, [anidada, columns, columnWidths, medidas?.barra, detallesAbiertos, anchosDetalle]);
|
|
4662
|
-
(0,
|
|
5040
|
+
(0, import_react28.useEffect)(() => {
|
|
4663
5041
|
if (anidada && anchoContenido !== void 0) onAnchoDeseado?.(anchoContenido);
|
|
4664
5042
|
}, [onAnchoDeseado, anidada, anchoContenido]);
|
|
4665
5043
|
const anchoExterior = anchoContenido === void 0 ? void 0 : anidada ? anchoContenido : anchoContenido - 2 + 32 + ancestors.length * 32;
|
|
4666
|
-
const estiloGrilla = (0,
|
|
4667
|
-
const bottomSummaryRows = (0,
|
|
4668
|
-
const vistaGrilla = (0,
|
|
5044
|
+
const estiloGrilla = (0, import_react28.useMemo)(() => ({ height: "100%", width: "100%", boxSizing: "border-box", ...gridStyles }), [gridStyles]);
|
|
5045
|
+
const bottomSummaryRows = (0, import_react28.useMemo)(() => conPie ? [bottomSummaryRow] : [], [conPie, bottomSummaryRow]);
|
|
5046
|
+
const vistaGrilla = (0, import_react28.useMemo)(() => ({ isFilterRowVisible }), [isFilterRowVisible]);
|
|
4669
5047
|
const getFallBackMessage = () => {
|
|
4670
5048
|
if (tableData.length === 0) {
|
|
4671
5049
|
return "No hay filas para mostrar";
|
|
@@ -4677,19 +5055,22 @@ var GenericDataGrid = ({
|
|
|
4677
5055
|
};
|
|
4678
5056
|
const fallBackMessage = getFallBackMessage();
|
|
4679
5057
|
if (cargandoInicial) {
|
|
4680
|
-
return /* @__PURE__ */ (0,
|
|
4681
|
-
/* @__PURE__ */ (0,
|
|
4682
|
-
/* @__PURE__ */ (0,
|
|
5058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_material21.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: [
|
|
5059
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.CircularProgress, {}),
|
|
5060
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Typography, { variant: "h6", sx: { ml: 2 }, children: "Cargando tabla..." })
|
|
4683
5061
|
] });
|
|
4684
5062
|
}
|
|
4685
5063
|
if (errorDeCarga) {
|
|
4686
|
-
return /* @__PURE__ */ (0,
|
|
5064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Alert, { severity: "error", children: errorDeCarga }) });
|
|
4687
5065
|
}
|
|
4688
5066
|
if (!tableDefinition) {
|
|
4689
|
-
return /* @__PURE__ */ (0,
|
|
5067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Alert, { severity: "warning", children: "No se pudo cargar la definici\xF3n de la tabla." }) });
|
|
5068
|
+
}
|
|
5069
|
+
if (puenteBPHabilitado() && clientSidesSinImplementar(tableDefinition).length > 0) {
|
|
5070
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Box, { sx: { height: anidada ? void 0 : "100%", minHeight: 0, overflow: anidada ? void 0 : "auto", boxSizing: "border-box", p: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(GrillaBP, { tabla: tableName, fixedFields }) });
|
|
4690
5071
|
}
|
|
4691
|
-
return /* @__PURE__ */ (0,
|
|
4692
|
-
!anidada && ancestors.length > 0 && /* @__PURE__ */ (0,
|
|
5072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CacheGrillasContext.Provider, { value: cache, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_material21.Box, { sx: { pt: anidada ? 0 : 2, display: "flex", flexDirection: "column", height: "100%", boxSizing: "border-box", width: anchoExterior, maxWidth: "100%" }, children: [
|
|
5073
|
+
!anidada && ancestors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Box, { sx: { px: 2, pt: 0, pb: 1, display: "flex", flexDirection: "column" }, children: ancestors.map((ancestor, index) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4693
5074
|
StaticAncestorGrid,
|
|
4694
5075
|
{
|
|
4695
5076
|
ancestor,
|
|
@@ -4698,8 +5079,8 @@ var GenericDataGrid = ({
|
|
|
4698
5079
|
},
|
|
4699
5080
|
index
|
|
4700
5081
|
)) }),
|
|
4701
|
-
/* @__PURE__ */ (0,
|
|
4702
|
-
|
|
5082
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
5083
|
+
import_material21.Box,
|
|
4703
5084
|
{
|
|
4704
5085
|
sx: {
|
|
4705
5086
|
backgroundColor: theme.palette.primary.main,
|
|
@@ -4721,17 +5102,17 @@ var GenericDataGrid = ({
|
|
|
4721
5102
|
gap: 1
|
|
4722
5103
|
},
|
|
4723
5104
|
children: [
|
|
4724
|
-
/* @__PURE__ */ (0,
|
|
5105
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_material21.Typography, { variant: "subtitle2", component: "div", children: [
|
|
4725
5106
|
titulo ?? cambiarGuionesBajosPorEspacios(tableDefinition.title || tableDefinition.name),
|
|
4726
5107
|
" - ",
|
|
4727
5108
|
filteredRows.length === tableData.length ? `${tableData.length} registros` : `${filteredRows.length} (F)`
|
|
4728
5109
|
] }),
|
|
4729
|
-
loading && /* @__PURE__ */ (0,
|
|
5110
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.CircularProgress, { size: 14, color: "inherit" })
|
|
4730
5111
|
]
|
|
4731
5112
|
}
|
|
4732
5113
|
),
|
|
4733
|
-
/* @__PURE__ */ (0,
|
|
4734
|
-
|
|
5114
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
5115
|
+
import_material21.Box,
|
|
4735
5116
|
{
|
|
4736
5117
|
sx: {
|
|
4737
5118
|
// Una grilla anidada se acota con px (el alto que le dio la de arriba, o el de una wScreen): una wScreen
|
|
@@ -4749,7 +5130,7 @@ var GenericDataGrid = ({
|
|
|
4749
5130
|
pb: anidada ? 0 : 3
|
|
4750
5131
|
},
|
|
4751
5132
|
children: [
|
|
4752
|
-
/* @__PURE__ */ (0,
|
|
5133
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(EstadoGrillaContext.Provider, { value: estadoGrilla, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(VistaGrillaContext.Provider, { value: vistaGrilla, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DetallesGrillaContext.Provider, { value: detallesGrilla, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4753
5134
|
import_react_data_grid.DataGrid,
|
|
4754
5135
|
{
|
|
4755
5136
|
className: "rdg-light",
|
|
@@ -4779,8 +5160,8 @@ var GenericDataGrid = ({
|
|
|
4779
5160
|
onCellKeyDown: handleCellKeyDown
|
|
4780
5161
|
}
|
|
4781
5162
|
) }) }) }),
|
|
4782
|
-
fallBackMessage && /* @__PURE__ */ (0,
|
|
4783
|
-
|
|
5163
|
+
fallBackMessage && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5164
|
+
import_material21.Box,
|
|
4784
5165
|
{
|
|
4785
5166
|
sx: {
|
|
4786
5167
|
position: "absolute",
|
|
@@ -4796,13 +5177,13 @@ var GenericDataGrid = ({
|
|
|
4796
5177
|
zIndex: tableData.length === 0 ? 10 : 1
|
|
4797
5178
|
// Mantenemos el zIndex superior para el estado vacío total
|
|
4798
5179
|
},
|
|
4799
|
-
children: /* @__PURE__ */ (0,
|
|
5180
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Typography, { variant: "body2", color: "textSecondary", children: fallBackMessage })
|
|
4800
5181
|
}
|
|
4801
5182
|
)
|
|
4802
5183
|
]
|
|
4803
5184
|
}
|
|
4804
5185
|
),
|
|
4805
|
-
/* @__PURE__ */ (0,
|
|
5186
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4806
5187
|
ExportDialog,
|
|
4807
5188
|
{
|
|
4808
5189
|
open: openExportDialog,
|
|
@@ -4814,7 +5195,7 @@ var GenericDataGrid = ({
|
|
|
4814
5195
|
username: usuario || "anonymous"
|
|
4815
5196
|
}
|
|
4816
5197
|
),
|
|
4817
|
-
/* @__PURE__ */ (0,
|
|
5198
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4818
5199
|
DialogoDeColumnas,
|
|
4819
5200
|
{
|
|
4820
5201
|
open: openDialogoDeColumnas,
|
|
@@ -4824,7 +5205,7 @@ var GenericDataGrid = ({
|
|
|
4824
5205
|
alternarColumna
|
|
4825
5206
|
}
|
|
4826
5207
|
),
|
|
4827
|
-
/* @__PURE__ */ (0,
|
|
5208
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4828
5209
|
ConfirmDialog,
|
|
4829
5210
|
{
|
|
4830
5211
|
open: openConfirmDialog,
|
|
@@ -4833,7 +5214,7 @@ var GenericDataGrid = ({
|
|
|
4833
5214
|
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."
|
|
4834
5215
|
}
|
|
4835
5216
|
),
|
|
4836
|
-
/* @__PURE__ */ (0,
|
|
5217
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4837
5218
|
DataGridOptionsDialog,
|
|
4838
5219
|
{
|
|
4839
5220
|
open: openDataGridOptions,
|
|
@@ -4842,7 +5223,7 @@ var GenericDataGrid = ({
|
|
|
4842
5223
|
anchorEl: dataGridOptionsAnchorEl
|
|
4843
5224
|
}
|
|
4844
5225
|
),
|
|
4845
|
-
/* @__PURE__ */ (0,
|
|
5226
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4846
5227
|
ImportDialog,
|
|
4847
5228
|
{
|
|
4848
5229
|
open: openImportDialog,
|
|
@@ -4851,14 +5232,14 @@ var GenericDataGrid = ({
|
|
|
4851
5232
|
loading
|
|
4852
5233
|
}
|
|
4853
5234
|
),
|
|
4854
|
-
/* @__PURE__ */ (0,
|
|
4855
|
-
|
|
5235
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5236
|
+
import_material21.Dialog,
|
|
4856
5237
|
{
|
|
4857
5238
|
open: openVerticalEditDialog,
|
|
4858
5239
|
onClose: () => setOpenVerticalEditDialog(false),
|
|
4859
5240
|
maxWidth: "sm",
|
|
4860
5241
|
fullWidth: true,
|
|
4861
|
-
children: rowToEditVertical && /* @__PURE__ */ (0,
|
|
5242
|
+
children: rowToEditVertical && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4862
5243
|
VerticalEditorPage,
|
|
4863
5244
|
{
|
|
4864
5245
|
tableName,
|
|
@@ -4904,7 +5285,7 @@ var GenericDataGrid = ({
|
|
|
4904
5285
|
)
|
|
4905
5286
|
}
|
|
4906
5287
|
),
|
|
4907
|
-
contenidoDeCelda && /* @__PURE__ */ (0,
|
|
5288
|
+
contenidoDeCelda && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(VentanaDeTexto, { anclaje: contenidoDeCelda.anclaje, texto: contenidoDeCelda.texto, editable: false, onAceptar: cerrarContenidoDeCelda, onCerrar: cerrarContenidoDeCelda })
|
|
4908
5289
|
] }) });
|
|
4909
5290
|
};
|
|
4910
5291
|
var GenericDataGrid_default = GenericDataGrid;
|
|
@@ -4914,13 +5295,13 @@ var import_react44 = __toESM(require("react"), 1);
|
|
|
4914
5295
|
var import_react_router_dom18 = require("react-router-dom");
|
|
4915
5296
|
|
|
4916
5297
|
// src/components/MainLayout.tsx
|
|
4917
|
-
var
|
|
4918
|
-
var
|
|
4919
|
-
var
|
|
5298
|
+
var import_react32 = require("react");
|
|
5299
|
+
var import_react_router_dom5 = require("react-router-dom");
|
|
5300
|
+
var import_material23 = require("@mui/material");
|
|
4920
5301
|
|
|
4921
5302
|
// src/contexts/AppContext.tsx
|
|
4922
|
-
var
|
|
4923
|
-
var
|
|
5303
|
+
var import_react29 = require("react");
|
|
5304
|
+
var import_react_router_dom2 = require("react-router-dom");
|
|
4924
5305
|
var import_react_redux2 = require("react-redux");
|
|
4925
5306
|
|
|
4926
5307
|
// src/utils/cierreVoluntario.ts
|
|
@@ -4931,10 +5312,10 @@ var marcarCierreVoluntario = (activo) => {
|
|
|
4931
5312
|
var huboCierreVoluntario = () => cierreVoluntario;
|
|
4932
5313
|
|
|
4933
5314
|
// src/contexts/AppContext.tsx
|
|
4934
|
-
var
|
|
4935
|
-
var AuthContext = (0,
|
|
5315
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
5316
|
+
var AuthContext = (0, import_react29.createContext)(void 0);
|
|
4936
5317
|
var useApp = () => {
|
|
4937
|
-
const context = (0,
|
|
5318
|
+
const context = (0, import_react29.useContext)(AuthContext);
|
|
4938
5319
|
if (!context) {
|
|
4939
5320
|
throw new Error("useApp must be used within an AppProvider");
|
|
4940
5321
|
}
|
|
@@ -4943,16 +5324,16 @@ var useApp = () => {
|
|
|
4943
5324
|
};
|
|
4944
5325
|
var AppProvider = ({ children, publicPaths = [] }) => {
|
|
4945
5326
|
console.log("AppProvider rendered/re-rendered");
|
|
4946
|
-
const [isLoggedIn, setIsLoggedIn] = (0,
|
|
4947
|
-
const [showSessionExpiredMessage, setShowSessionExpiredMessage] = (0,
|
|
4948
|
-
const isRedirectingRef = (0,
|
|
4949
|
-
const huboSesionRef = (0,
|
|
4950
|
-
const cierreVoluntarioRef = (0,
|
|
5327
|
+
const [isLoggedIn, setIsLoggedIn] = (0, import_react29.useState)(false);
|
|
5328
|
+
const [showSessionExpiredMessage, setShowSessionExpiredMessage] = (0, import_react29.useState)(false);
|
|
5329
|
+
const isRedirectingRef = (0, import_react29.useRef)(false);
|
|
5330
|
+
const huboSesionRef = (0, import_react29.useRef)(false);
|
|
5331
|
+
const cierreVoluntarioRef = (0, import_react29.useRef)(false);
|
|
4951
5332
|
const dispatch = (0, import_react_redux2.useDispatch)();
|
|
4952
5333
|
const clientContext = (0, import_react_redux2.useSelector)((state) => state.clientContext);
|
|
4953
5334
|
if (clientContext.status === "succeeded" && !cierreVoluntarioRef.current) huboSesionRef.current = true;
|
|
4954
|
-
const navigate = (0,
|
|
4955
|
-
const handleExpiredSessionRedirect = (0,
|
|
5335
|
+
const navigate = (0, import_react_router_dom2.useNavigate)();
|
|
5336
|
+
const handleExpiredSessionRedirect = (0, import_react29.useCallback)(() => {
|
|
4956
5337
|
isRedirectingRef.current = true;
|
|
4957
5338
|
setShowSessionExpiredMessage(false);
|
|
4958
5339
|
setIsLoggedIn(false);
|
|
@@ -4961,23 +5342,23 @@ var AppProvider = ({ children, publicPaths = [] }) => {
|
|
|
4961
5342
|
isRedirectingRef.current = false;
|
|
4962
5343
|
}, 2e3);
|
|
4963
5344
|
}, [navigate]);
|
|
4964
|
-
const avisarCierreVoluntario = (0,
|
|
5345
|
+
const avisarCierreVoluntario = (0, import_react29.useCallback)((activo) => {
|
|
4965
5346
|
cierreVoluntarioRef.current = activo;
|
|
4966
5347
|
marcarCierreVoluntario(activo);
|
|
4967
5348
|
if (activo) huboSesionRef.current = false;
|
|
4968
5349
|
}, []);
|
|
4969
|
-
const limpiarContextoPorSesionPerdida = (0,
|
|
5350
|
+
const limpiarContextoPorSesionPerdida = (0, import_react29.useCallback)(() => {
|
|
4970
5351
|
if (clientContext.status === "succeeded" && clientContext.username !== "" && !cierreVoluntarioRef.current) {
|
|
4971
5352
|
dispatch(setRedirectUsername(clientContext.username));
|
|
4972
5353
|
}
|
|
4973
5354
|
dispatch(clearClientContext());
|
|
4974
5355
|
}, [dispatch, clientContext.status, clientContext.username]);
|
|
4975
|
-
const location = (0,
|
|
4976
|
-
const isCurrentPathPublic = (0,
|
|
5356
|
+
const location = (0, import_react_router_dom2.useLocation)();
|
|
5357
|
+
const isCurrentPathPublic = (0, import_react29.useCallback)(() => {
|
|
4977
5358
|
const current = location.pathname;
|
|
4978
5359
|
return publicPaths.some((path) => current === path || current.startsWith(`${path}/`));
|
|
4979
5360
|
}, [location.pathname, publicPaths]);
|
|
4980
|
-
const checkSession = (0,
|
|
5361
|
+
const checkSession = (0, import_react29.useCallback)(async () => {
|
|
4981
5362
|
if (isRedirectingRef.current) return;
|
|
4982
5363
|
try {
|
|
4983
5364
|
const response = await fetchApi("/keep-alive.json", { method: "GET" });
|
|
@@ -5015,14 +5396,14 @@ var AppProvider = ({ children, publicPaths = [] }) => {
|
|
|
5015
5396
|
}
|
|
5016
5397
|
}
|
|
5017
5398
|
}, [dispatch, clientContext.status, showSessionExpiredMessage, isCurrentPathPublic, limpiarContextoPorSesionPerdida]);
|
|
5018
|
-
(0,
|
|
5399
|
+
(0, import_react29.useEffect)(() => {
|
|
5019
5400
|
checkSession();
|
|
5020
5401
|
const intervalId = setInterval(checkSession, 15 * 1e3);
|
|
5021
5402
|
return () => {
|
|
5022
5403
|
clearInterval(intervalId);
|
|
5023
5404
|
};
|
|
5024
5405
|
}, [checkSession]);
|
|
5025
|
-
const authContextValue = (0,
|
|
5406
|
+
const authContextValue = (0, import_react29.useMemo)(() => ({
|
|
5026
5407
|
isLoggedIn,
|
|
5027
5408
|
setIsLoggedIn,
|
|
5028
5409
|
checkSession,
|
|
@@ -5039,19 +5420,19 @@ var AppProvider = ({ children, publicPaths = [] }) => {
|
|
|
5039
5420
|
handleExpiredSessionRedirect,
|
|
5040
5421
|
avisarCierreVoluntario
|
|
5041
5422
|
]);
|
|
5042
|
-
return /* @__PURE__ */ (0,
|
|
5423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AuthContext.Provider, { value: authContextValue, children });
|
|
5043
5424
|
};
|
|
5044
5425
|
|
|
5045
5426
|
// src/components/MainLayout.tsx
|
|
5046
|
-
var
|
|
5427
|
+
var import_react_router_dom6 = require("react-router-dom");
|
|
5047
5428
|
var import_Logout = __toESM(require("@mui/icons-material/Logout"), 1);
|
|
5048
5429
|
var import_VpnKey = __toESM(require("@mui/icons-material/VpnKey"), 1);
|
|
5049
5430
|
var import_Menu = __toESM(require("@mui/icons-material/Menu"), 1);
|
|
5050
5431
|
var import_ChevronLeft = __toESM(require("@mui/icons-material/ChevronLeft"), 1);
|
|
5051
5432
|
|
|
5052
5433
|
// src/components/SideMenu.tsx
|
|
5053
|
-
var
|
|
5054
|
-
var
|
|
5434
|
+
var import_react30 = __toESM(require("react"), 1);
|
|
5435
|
+
var import_material22 = require("@mui/material");
|
|
5055
5436
|
var import_ExpandLess = __toESM(require("@mui/icons-material/ExpandLess"), 1);
|
|
5056
5437
|
var import_ExpandMore = __toESM(require("@mui/icons-material/ExpandMore"), 1);
|
|
5057
5438
|
var import_TableChart = __toESM(require("@mui/icons-material/TableChart"), 1);
|
|
@@ -5061,16 +5442,9 @@ var import_WarningAmber3 = __toESM(require("@mui/icons-material/WarningAmber"),
|
|
|
5061
5442
|
var import_DesktopWindows = __toESM(require("@mui/icons-material/DesktopWindows"), 1);
|
|
5062
5443
|
var import_Search3 = __toESM(require("@mui/icons-material/Search"), 1);
|
|
5063
5444
|
var import_Clear = __toESM(require("@mui/icons-material/Clear"), 1);
|
|
5064
|
-
var
|
|
5445
|
+
var import_react_router_dom3 = require("react-router-dom");
|
|
5065
5446
|
var import_colors = require("@mui/material/colors");
|
|
5066
5447
|
|
|
5067
|
-
// src/puente/habilitacion.ts
|
|
5068
|
-
var habilitado = false;
|
|
5069
|
-
var habilitarPuenteBP = () => {
|
|
5070
|
-
habilitado = true;
|
|
5071
|
-
};
|
|
5072
|
-
var puenteBPHabilitado = () => habilitado;
|
|
5073
|
-
|
|
5074
5448
|
// src/utils/menuInicial.ts
|
|
5075
5449
|
function rutaDeTablaDeMenu(camino) {
|
|
5076
5450
|
return `/menu/${camino.map(encodeURIComponent).join("/")}`;
|
|
@@ -5151,22 +5525,22 @@ function buscarEnMenu(hojas, consulta) {
|
|
|
5151
5525
|
}
|
|
5152
5526
|
|
|
5153
5527
|
// src/components/SideMenu.tsx
|
|
5154
|
-
var
|
|
5528
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
5155
5529
|
var CLAVE_RECIENTES = "fpr.menu.recientes";
|
|
5156
5530
|
var MAXIMO_RECIENTES = 4;
|
|
5157
5531
|
var getIcon = (item, destacado = false) => {
|
|
5158
5532
|
switch (item.menuType) {
|
|
5159
5533
|
case "table":
|
|
5160
|
-
return /* @__PURE__ */ (0,
|
|
5534
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_TableChart.default, { sx: destacado ? { color: import_colors.blue[700] } : void 0 });
|
|
5161
5535
|
case "proc":
|
|
5162
|
-
return /* @__PURE__ */ (0,
|
|
5536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_Dns.default, { sx: destacado ? { color: import_colors.teal[700] } : void 0 });
|
|
5163
5537
|
case "menu":
|
|
5164
|
-
return /* @__PURE__ */ (0,
|
|
5538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_Folder.default, { sx: destacado ? { color: import_colors.orange[800] } : void 0 });
|
|
5165
5539
|
default:
|
|
5166
5540
|
if (wScreens[item.menuType] !== void 0 || puenteBPHabilitado()) {
|
|
5167
|
-
return /* @__PURE__ */ (0,
|
|
5541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_DesktopWindows.default, { sx: destacado ? { color: import_colors.indigo[500] } : void 0 });
|
|
5168
5542
|
}
|
|
5169
|
-
return /* @__PURE__ */ (0,
|
|
5543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_WarningAmber3.default, { sx: destacado ? { color: import_colors.red[500] } : void 0 });
|
|
5170
5544
|
}
|
|
5171
5545
|
};
|
|
5172
5546
|
var estaSeleccionado = (item, grupos, currentPath, hash = "") => {
|
|
@@ -5196,8 +5570,8 @@ var guardarRecientes = (recientes) => {
|
|
|
5196
5570
|
}
|
|
5197
5571
|
};
|
|
5198
5572
|
var MenuListItem = ({ item, level, grupos = [], hermanos = [], onMenuItemClick }) => {
|
|
5199
|
-
const navigate = (0,
|
|
5200
|
-
const location = (0,
|
|
5573
|
+
const navigate = (0, import_react_router_dom3.useNavigate)();
|
|
5574
|
+
const location = (0, import_react_router_dom3.useLocation)();
|
|
5201
5575
|
const clave = claveDeMenu([...grupos, item.name]);
|
|
5202
5576
|
const open = useSubMenuOpenState(clave);
|
|
5203
5577
|
const dispatch = useAppDispatch();
|
|
@@ -5216,28 +5590,28 @@ var MenuListItem = ({ item, level, grupos = [], hermanos = [], onMenuItemClick }
|
|
|
5216
5590
|
}
|
|
5217
5591
|
};
|
|
5218
5592
|
const isSelected = estaSeleccionado(item, grupos, location.pathname, location.hash);
|
|
5219
|
-
const itemRef =
|
|
5220
|
-
(0,
|
|
5593
|
+
const itemRef = import_react30.default.useRef(null);
|
|
5594
|
+
(0, import_react30.useEffect)(() => {
|
|
5221
5595
|
if (isSelected && itemRef.current) {
|
|
5222
5596
|
itemRef.current.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
5223
5597
|
}
|
|
5224
5598
|
}, [isSelected]);
|
|
5225
5599
|
const contenido = item.menuType === "menu" ? item.menuContent : [];
|
|
5226
|
-
return /* @__PURE__ */ (0,
|
|
5227
|
-
/* @__PURE__ */ (0,
|
|
5228
|
-
|
|
5600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { ref: itemRef, children: [
|
|
5601
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5602
|
+
import_material22.ListItemButton,
|
|
5229
5603
|
{
|
|
5230
5604
|
onClick: handleClick,
|
|
5231
5605
|
sx: { pl: level * 2 },
|
|
5232
5606
|
selected: isSelected,
|
|
5233
5607
|
children: [
|
|
5234
|
-
/* @__PURE__ */ (0,
|
|
5235
|
-
/* @__PURE__ */ (0,
|
|
5236
|
-
item.menuType === "menu" ? open ? /* @__PURE__ */ (0,
|
|
5608
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.ListItemIcon, { sx: { minWidth: "38px" }, children: getIcon(item, isSelected || open) }),
|
|
5609
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.ListItemText, { primary: etiquetaDeItem(item) }),
|
|
5610
|
+
item.menuType === "menu" ? open ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_ExpandLess.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_ExpandMore.default, {}) : null
|
|
5237
5611
|
]
|
|
5238
5612
|
}
|
|
5239
5613
|
),
|
|
5240
|
-
item.menuType === "menu" && /* @__PURE__ */ (0,
|
|
5614
|
+
item.menuType === "menu" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.Collapse, { in: open, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.List, { component: "div", disablePadding: true, children: contenido.map((subItem) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5241
5615
|
MenuListItem,
|
|
5242
5616
|
{
|
|
5243
5617
|
item: subItem,
|
|
@@ -5251,14 +5625,14 @@ var MenuListItem = ({ item, level, grupos = [], hermanos = [], onMenuItemClick }
|
|
|
5251
5625
|
] });
|
|
5252
5626
|
};
|
|
5253
5627
|
var ItemPlano = ({ hoja, seleccionado, traerALaVista = false, onElegir }) => {
|
|
5254
|
-
const boton = (0,
|
|
5255
|
-
(0,
|
|
5628
|
+
const boton = (0, import_react30.useRef)(null);
|
|
5629
|
+
(0, import_react30.useEffect)(() => {
|
|
5256
5630
|
if (traerALaVista && seleccionado) boton.current?.scrollIntoView({ block: "nearest" });
|
|
5257
5631
|
}, [traerALaVista, seleccionado]);
|
|
5258
|
-
return /* @__PURE__ */ (0,
|
|
5259
|
-
/* @__PURE__ */ (0,
|
|
5260
|
-
/* @__PURE__ */ (0,
|
|
5261
|
-
|
|
5632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_material22.ListItemButton, { dense: true, selected: seleccionado, onClick: () => onElegir(hoja), ref: boton, children: [
|
|
5633
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.ListItemIcon, { sx: { minWidth: "38px" }, children: getIcon(hoja.item, seleccionado) }),
|
|
5634
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5635
|
+
import_material22.ListItemText,
|
|
5262
5636
|
{
|
|
5263
5637
|
primary: etiquetaDeItem(hoja.item),
|
|
5264
5638
|
secondary: hoja.etiquetasDeGrupos.join(" \u203A ") || void 0,
|
|
@@ -5269,17 +5643,17 @@ var ItemPlano = ({ hoja, seleccionado, traerALaVista = false, onElegir }) => {
|
|
|
5269
5643
|
};
|
|
5270
5644
|
var SideMenu = ({ onMenuItemClick }) => {
|
|
5271
5645
|
const { clientContext } = useApp();
|
|
5272
|
-
const navigate = (0,
|
|
5273
|
-
const location = (0,
|
|
5646
|
+
const navigate = (0, import_react_router_dom3.useNavigate)();
|
|
5647
|
+
const location = (0, import_react_router_dom3.useLocation)();
|
|
5274
5648
|
const dispatch = useAppDispatch();
|
|
5275
|
-
const [consulta, setConsulta] = (0,
|
|
5276
|
-
const [indice, setIndice] = (0,
|
|
5277
|
-
const [recientes, setRecientes] = (0,
|
|
5278
|
-
const campoDeBusqueda = (0,
|
|
5649
|
+
const [consulta, setConsulta] = (0, import_react30.useState)("");
|
|
5650
|
+
const [indice, setIndice] = (0, import_react30.useState)(0);
|
|
5651
|
+
const [recientes, setRecientes] = (0, import_react30.useState)(leerRecientes);
|
|
5652
|
+
const campoDeBusqueda = (0, import_react30.useRef)(null);
|
|
5279
5653
|
const menu = clientContext?.menu;
|
|
5280
|
-
const hojas = (0,
|
|
5281
|
-
const resultados = (0,
|
|
5282
|
-
(0,
|
|
5654
|
+
const hojas = (0, import_react30.useMemo)(() => hojasDeMenu(menu ?? []), [menu]);
|
|
5655
|
+
const resultados = (0, import_react30.useMemo)(() => buscarEnMenu(hojas, consulta), [hojas, consulta]);
|
|
5656
|
+
(0, import_react30.useEffect)(() => {
|
|
5283
5657
|
const alApretar = (evento) => {
|
|
5284
5658
|
if ((evento.ctrlKey || evento.metaKey) && !evento.altKey && !evento.shiftKey && evento.key.toLowerCase() === "k") {
|
|
5285
5659
|
evento.preventDefault();
|
|
@@ -5293,7 +5667,7 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5293
5667
|
window.addEventListener("keydown", alApretar);
|
|
5294
5668
|
return () => window.removeEventListener("keydown", alApretar);
|
|
5295
5669
|
}, [dispatch]);
|
|
5296
|
-
(0,
|
|
5670
|
+
(0, import_react30.useEffect)(() => {
|
|
5297
5671
|
const actual = hojas.find((hoja) => estaSeleccionado(hoja.item, hoja.grupos, location.pathname, location.hash));
|
|
5298
5672
|
if (!actual) return;
|
|
5299
5673
|
dispatch(abrirCamino(actual.grupos.map((_, i) => claveDeMenu(actual.grupos.slice(0, i + 1)))));
|
|
@@ -5305,7 +5679,7 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5305
5679
|
});
|
|
5306
5680
|
}, [location.pathname, location.hash, hojas, dispatch]);
|
|
5307
5681
|
if (!menu) {
|
|
5308
|
-
return /* @__PURE__ */ (0,
|
|
5682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.Box, { sx: { p: 2, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.Typography, { variant: "body2", color: "text.secondary", children: "Cargando men\xFA..." }) });
|
|
5309
5683
|
}
|
|
5310
5684
|
const elegir = (hoja) => {
|
|
5311
5685
|
navigate(rutaDeItemDeMenu(hoja.item, hoja.grupos));
|
|
@@ -5330,9 +5704,9 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5330
5704
|
}
|
|
5331
5705
|
};
|
|
5332
5706
|
const hojasRecientes = recientes.map((clave) => hojas.find((hoja) => hoja.clave === clave)).filter((hoja) => hoja !== void 0);
|
|
5333
|
-
return /* @__PURE__ */ (0,
|
|
5334
|
-
/* @__PURE__ */ (0,
|
|
5335
|
-
|
|
5707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_material22.Box, { sx: { width: "100%", flex: 1, minHeight: 0, display: "flex", flexDirection: "column" }, children: [
|
|
5708
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.Box, { sx: { px: 1.5, py: 1, flexShrink: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5709
|
+
import_material22.TextField,
|
|
5336
5710
|
{
|
|
5337
5711
|
inputRef: campoDeBusqueda,
|
|
5338
5712
|
value: consulta,
|
|
@@ -5347,19 +5721,19 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5347
5721
|
autoComplete: "off",
|
|
5348
5722
|
sx: { "& .MuiInputBase-input": { fontSize: "0.8rem" } },
|
|
5349
5723
|
InputProps: {
|
|
5350
|
-
startAdornment: /* @__PURE__ */ (0,
|
|
5351
|
-
endAdornment: consulta !== "" ? /* @__PURE__ */ (0,
|
|
5724
|
+
startAdornment: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.InputAdornment, { position: "start", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_Search3.default, { fontSize: "small" }) }),
|
|
5725
|
+
endAdornment: consulta !== "" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.InputAdornment, { position: "end", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.IconButton, { size: "small", "aria-label": "borrar b\xFAsqueda", edge: "end", onClick: () => {
|
|
5352
5726
|
setConsulta("");
|
|
5353
5727
|
campoDeBusqueda.current?.focus();
|
|
5354
|
-
}, children: /* @__PURE__ */ (0,
|
|
5728
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_Clear.default, { fontSize: "small" }) }) }) : void 0
|
|
5355
5729
|
}
|
|
5356
5730
|
}
|
|
5357
5731
|
) }),
|
|
5358
|
-
/* @__PURE__ */ (0,
|
|
5359
|
-
/* @__PURE__ */ (0,
|
|
5360
|
-
hojasRecientes.length > 0 && /* @__PURE__ */ (0,
|
|
5361
|
-
/* @__PURE__ */ (0,
|
|
5362
|
-
/* @__PURE__ */ (0,
|
|
5732
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.Divider, {}),
|
|
5733
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.Box, { sx: { flex: 1, minHeight: 0, overflowY: "auto" }, children: consulta.trim() !== "" ? resultados.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.Box, { sx: { p: 2, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.Typography, { variant: "body2", color: "text.secondary", children: "Sin resultados" }) }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.List, { children: resultados.map((hoja, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ItemPlano, { hoja, seleccionado: i === indice, traerALaVista: true, onElegir: elegir }, hoja.clave)) }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
5734
|
+
hojasRecientes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
5735
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.Typography, { variant: "overline", color: "text.secondary", sx: { display: "block", px: 2, pt: 1, lineHeight: 2 }, children: "Recientes" }),
|
|
5736
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.List, { disablePadding: true, children: hojasRecientes.map((hoja) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5363
5737
|
ItemPlano,
|
|
5364
5738
|
{
|
|
5365
5739
|
hoja,
|
|
@@ -5368,9 +5742,9 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5368
5742
|
},
|
|
5369
5743
|
hoja.clave
|
|
5370
5744
|
)) }),
|
|
5371
|
-
/* @__PURE__ */ (0,
|
|
5745
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.Divider, {})
|
|
5372
5746
|
] }),
|
|
5373
|
-
/* @__PURE__ */ (0,
|
|
5747
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.List, { children: menu.map((menuItem) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5374
5748
|
MenuListItem,
|
|
5375
5749
|
{
|
|
5376
5750
|
item: menuItem,
|
|
@@ -5386,14 +5760,14 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5386
5760
|
var SideMenu_default = SideMenu;
|
|
5387
5761
|
|
|
5388
5762
|
// src/hooks/useLogout.tsx
|
|
5389
|
-
var
|
|
5390
|
-
var
|
|
5763
|
+
var import_react31 = require("react");
|
|
5764
|
+
var import_react_router_dom4 = require("react-router-dom");
|
|
5391
5765
|
var import_react_redux3 = require("react-redux");
|
|
5392
5766
|
var useLogout = () => {
|
|
5393
5767
|
const { setIsLoggedIn, avisarCierreVoluntario } = useApp();
|
|
5394
5768
|
const dispatch = (0, import_react_redux3.useDispatch)();
|
|
5395
|
-
const navigate = (0,
|
|
5396
|
-
const logout = (0,
|
|
5769
|
+
const navigate = (0, import_react_router_dom4.useNavigate)();
|
|
5770
|
+
const logout = (0, import_react31.useCallback)(async () => {
|
|
5397
5771
|
avisarCierreVoluntario(true);
|
|
5398
5772
|
try {
|
|
5399
5773
|
const response = await fetchApi("/logout", { method: "GET" });
|
|
@@ -5416,17 +5790,17 @@ var useLogout = () => {
|
|
|
5416
5790
|
var useLogout_default = useLogout;
|
|
5417
5791
|
|
|
5418
5792
|
// src/components/MainLayout.tsx
|
|
5419
|
-
var
|
|
5793
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5420
5794
|
var drawerWidth = 240;
|
|
5421
5795
|
var MainLayout = () => {
|
|
5422
5796
|
const { clientContext } = useApp();
|
|
5423
5797
|
const logout = useLogout_default();
|
|
5424
|
-
const navigate = (0,
|
|
5798
|
+
const navigate = (0, import_react_router_dom6.useNavigate)();
|
|
5425
5799
|
const isDrawerOpen = useIsDrawerOpen();
|
|
5426
5800
|
const dispatch = useAppDispatch();
|
|
5427
|
-
const theme = (0,
|
|
5428
|
-
const isMobile = (0,
|
|
5429
|
-
(0,
|
|
5801
|
+
const theme = (0, import_material23.useTheme)();
|
|
5802
|
+
const isMobile = (0, import_material23.useMediaQuery)(theme.breakpoints.down("sm"));
|
|
5803
|
+
(0, import_react32.useEffect)(() => {
|
|
5430
5804
|
if (isMobile && isDrawerOpen) {
|
|
5431
5805
|
dispatch(setDrawerOpen(false));
|
|
5432
5806
|
}
|
|
@@ -5440,12 +5814,12 @@ var MainLayout = () => {
|
|
|
5440
5814
|
}
|
|
5441
5815
|
};
|
|
5442
5816
|
if (!clientContext) {
|
|
5443
|
-
return /* @__PURE__ */ (0,
|
|
5817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Box, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Typography, { children: "Cargando dise\xF1o de la aplicaci\xF3n..." }) });
|
|
5444
5818
|
}
|
|
5445
|
-
return /* @__PURE__ */ (0,
|
|
5446
|
-
/* @__PURE__ */ (0,
|
|
5447
|
-
/* @__PURE__ */ (0,
|
|
5448
|
-
|
|
5819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_material23.Box, { sx: { display: "flex", height: "100vh" }, children: [
|
|
5820
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.CssBaseline, {}),
|
|
5821
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5822
|
+
import_material23.AppBar,
|
|
5449
5823
|
{
|
|
5450
5824
|
position: "fixed",
|
|
5451
5825
|
sx: {
|
|
@@ -5463,9 +5837,9 @@ var MainLayout = () => {
|
|
|
5463
5837
|
})
|
|
5464
5838
|
}
|
|
5465
5839
|
},
|
|
5466
|
-
children: /* @__PURE__ */ (0,
|
|
5467
|
-
/* @__PURE__ */ (0,
|
|
5468
|
-
|
|
5840
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_material23.Toolbar, { children: [
|
|
5841
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5842
|
+
import_material23.IconButton,
|
|
5469
5843
|
{
|
|
5470
5844
|
color: "inherit",
|
|
5471
5845
|
"aria-label": "open drawer",
|
|
@@ -5474,10 +5848,10 @@ var MainLayout = () => {
|
|
|
5474
5848
|
sx: {
|
|
5475
5849
|
marginRight: 2
|
|
5476
5850
|
},
|
|
5477
|
-
children: isDrawerOpen ? /* @__PURE__ */ (0,
|
|
5851
|
+
children: isDrawerOpen ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_ChevronLeft.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_Menu.default, {})
|
|
5478
5852
|
}
|
|
5479
5853
|
),
|
|
5480
|
-
!isDrawerOpen && /* @__PURE__ */ (0,
|
|
5854
|
+
!isDrawerOpen && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5481
5855
|
"img",
|
|
5482
5856
|
{
|
|
5483
5857
|
src: `${envConfig.backendUrl}/img/logo-128.png`,
|
|
@@ -5485,23 +5859,23 @@ var MainLayout = () => {
|
|
|
5485
5859
|
style: { height: "32px", marginRight: "12px", objectFit: "contain" }
|
|
5486
5860
|
}
|
|
5487
5861
|
),
|
|
5488
|
-
/* @__PURE__ */ (0,
|
|
5489
|
-
/* @__PURE__ */ (0,
|
|
5490
|
-
/* @__PURE__ */ (0,
|
|
5491
|
-
/* @__PURE__ */ (0,
|
|
5492
|
-
|
|
5862
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Typography, { variant: "h6", noWrap: true, component: "div", sx: { flexGrow: 1 }, children: isDrawerOpen ? "" : clientContext.config.title }),
|
|
5863
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Typography, { variant: "subtitle1", component: "div", sx: { mr: 2 }, children: clientContext.username }),
|
|
5864
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.IconButton, { color: "inherit", title: "Cambiar contrase\xF1a", "aria-label": "cambiar contrase\xF1a", onClick: () => navigate("/chpass"), sx: { mr: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_VpnKey.default, {}) }),
|
|
5865
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5866
|
+
import_material23.Button,
|
|
5493
5867
|
{
|
|
5494
5868
|
color: "inherit",
|
|
5495
5869
|
onClick: logout,
|
|
5496
|
-
startIcon: /* @__PURE__ */ (0,
|
|
5870
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_Logout.default, {}),
|
|
5497
5871
|
children: "Salir"
|
|
5498
5872
|
}
|
|
5499
5873
|
)
|
|
5500
5874
|
] })
|
|
5501
5875
|
}
|
|
5502
5876
|
),
|
|
5503
|
-
/* @__PURE__ */ (0,
|
|
5504
|
-
|
|
5877
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5878
|
+
import_material23.Drawer,
|
|
5505
5879
|
{
|
|
5506
5880
|
variant: "persistent",
|
|
5507
5881
|
anchor: "left",
|
|
@@ -5518,8 +5892,8 @@ var MainLayout = () => {
|
|
|
5518
5892
|
}
|
|
5519
5893
|
},
|
|
5520
5894
|
children: [
|
|
5521
|
-
/* @__PURE__ */ (0,
|
|
5522
|
-
|
|
5895
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5896
|
+
import_material23.Toolbar,
|
|
5523
5897
|
{
|
|
5524
5898
|
sx: {
|
|
5525
5899
|
display: "flex",
|
|
@@ -5533,7 +5907,7 @@ var MainLayout = () => {
|
|
|
5533
5907
|
gap: 1.5
|
|
5534
5908
|
},
|
|
5535
5909
|
children: [
|
|
5536
|
-
/* @__PURE__ */ (0,
|
|
5910
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5537
5911
|
"img",
|
|
5538
5912
|
{
|
|
5539
5913
|
src: `${envConfig.backendUrl}/img/logo-128.png`,
|
|
@@ -5541,16 +5915,16 @@ var MainLayout = () => {
|
|
|
5541
5915
|
style: { height: "32px", objectFit: "contain" }
|
|
5542
5916
|
}
|
|
5543
5917
|
),
|
|
5544
|
-
/* @__PURE__ */ (0,
|
|
5918
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Typography, { variant: "h6", sx: { fontWeight: "bold" }, children: clientContext.config.title })
|
|
5545
5919
|
]
|
|
5546
5920
|
}
|
|
5547
5921
|
),
|
|
5548
|
-
/* @__PURE__ */ (0,
|
|
5922
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SideMenu_default, { onMenuItemClick: handleDrawerCloseMobile })
|
|
5549
5923
|
]
|
|
5550
5924
|
}
|
|
5551
5925
|
),
|
|
5552
|
-
/* @__PURE__ */ (0,
|
|
5553
|
-
|
|
5926
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5927
|
+
import_material23.Box,
|
|
5554
5928
|
{
|
|
5555
5929
|
component: "main",
|
|
5556
5930
|
sx: {
|
|
@@ -5576,8 +5950,8 @@ var MainLayout = () => {
|
|
|
5576
5950
|
width: isDrawerOpen ? `calc(100% - ${drawerWidth}px)` : "100%"
|
|
5577
5951
|
},
|
|
5578
5952
|
children: [
|
|
5579
|
-
/* @__PURE__ */ (0,
|
|
5580
|
-
/* @__PURE__ */ (0,
|
|
5953
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Toolbar, {}),
|
|
5954
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Box, { sx: { flex: 1, minHeight: 0, overflowY: "auto", display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_router_dom5.Outlet, {}) })
|
|
5581
5955
|
]
|
|
5582
5956
|
}
|
|
5583
5957
|
)
|
|
@@ -5586,8 +5960,8 @@ var MainLayout = () => {
|
|
|
5586
5960
|
var MainLayout_default = MainLayout;
|
|
5587
5961
|
|
|
5588
5962
|
// src/components/SessionExpiredMessage.tsx
|
|
5589
|
-
var
|
|
5590
|
-
var
|
|
5963
|
+
var import_material24 = require("@mui/material");
|
|
5964
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5591
5965
|
var style = {
|
|
5592
5966
|
position: "absolute",
|
|
5593
5967
|
top: "50%",
|
|
@@ -5606,8 +5980,8 @@ var SessionExpiredMessage = () => {
|
|
|
5606
5980
|
const handleClose = () => {
|
|
5607
5981
|
handleExpiredSessionRedirect();
|
|
5608
5982
|
};
|
|
5609
|
-
return /* @__PURE__ */ (0,
|
|
5610
|
-
|
|
5983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5984
|
+
import_material24.Modal,
|
|
5611
5985
|
{
|
|
5612
5986
|
open: showSessionExpiredMessage,
|
|
5613
5987
|
onClose: () => {
|
|
@@ -5626,10 +6000,10 @@ var SessionExpiredMessage = () => {
|
|
|
5626
6000
|
}
|
|
5627
6001
|
}
|
|
5628
6002
|
},
|
|
5629
|
-
children: /* @__PURE__ */ (0,
|
|
5630
|
-
/* @__PURE__ */ (0,
|
|
5631
|
-
/* @__PURE__ */ (0,
|
|
5632
|
-
/* @__PURE__ */ (0,
|
|
6003
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material24.Box, { sx: style, children: [
|
|
6004
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material24.Typography, { id: "session-expired-modal-title", variant: "h6", component: "h2", gutterBottom: true, children: "\xA1Sesi\xF3n Expirada!" }),
|
|
6005
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material24.Typography, { id: "session-expired-modal-description", sx: { mt: 2, mb: 3 }, children: "Tu sesi\xF3n ha expirado por inactividad o por seguridad. Por favor, inicia sesi\xF3n de nuevo." }),
|
|
6006
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material24.Button, { variant: "contained", color: "primary", onClick: handleClose, children: "Ir al Login" })
|
|
5633
6007
|
] })
|
|
5634
6008
|
}
|
|
5635
6009
|
);
|
|
@@ -5637,25 +6011,25 @@ var SessionExpiredMessage = () => {
|
|
|
5637
6011
|
var SessionExpiredMessage_default = SessionExpiredMessage;
|
|
5638
6012
|
|
|
5639
6013
|
// src/pages/PantallaInicial.tsx
|
|
5640
|
-
var
|
|
5641
|
-
var
|
|
6014
|
+
var import_react_router_dom7 = require("react-router-dom");
|
|
6015
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5642
6016
|
var PantallaInicial = () => {
|
|
5643
6017
|
const { clientContext } = useApp();
|
|
5644
6018
|
const item = clientContext.menu ? itemInicial(clientContext.menu) : void 0;
|
|
5645
|
-
return item && clientContext.menu ? /* @__PURE__ */ (0,
|
|
6019
|
+
return item && clientContext.menu ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_router_dom7.Navigate, { to: rutaDeItemDeMenu(item, gruposDeItem(clientContext.menu, item)), replace: true }) : null;
|
|
5646
6020
|
};
|
|
5647
6021
|
var PantallaInicial_default = PantallaInicial;
|
|
5648
6022
|
|
|
5649
6023
|
// src/pages/LogoutPage.tsx
|
|
5650
|
-
var
|
|
5651
|
-
var
|
|
5652
|
-
var
|
|
6024
|
+
var import_react33 = require("react");
|
|
6025
|
+
var import_material25 = require("@mui/material");
|
|
6026
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5653
6027
|
var LogoutPage = () => {
|
|
5654
6028
|
const logout = useLogout_default();
|
|
5655
|
-
(0,
|
|
6029
|
+
(0, import_react33.useEffect)(() => {
|
|
5656
6030
|
logout();
|
|
5657
6031
|
}, [logout]);
|
|
5658
|
-
return /* @__PURE__ */ (0,
|
|
6032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_material25.Box, { sx: {
|
|
5659
6033
|
display: "flex",
|
|
5660
6034
|
flexDirection: "column",
|
|
5661
6035
|
justifyContent: "center",
|
|
@@ -5663,16 +6037,16 @@ var LogoutPage = () => {
|
|
|
5663
6037
|
height: "100vh",
|
|
5664
6038
|
textAlign: "center"
|
|
5665
6039
|
}, children: [
|
|
5666
|
-
/* @__PURE__ */ (0,
|
|
5667
|
-
/* @__PURE__ */ (0,
|
|
6040
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material25.CircularProgress, { size: 60 }),
|
|
6041
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material25.Typography, { variant: "h6", sx: { mt: 2 }, children: "Cerrando sesi\xF3n..." })
|
|
5668
6042
|
] });
|
|
5669
6043
|
};
|
|
5670
6044
|
var LogoutPage_default = LogoutPage;
|
|
5671
6045
|
|
|
5672
6046
|
// src/pages/LoginPage.tsx
|
|
5673
|
-
var
|
|
5674
|
-
var
|
|
5675
|
-
var
|
|
6047
|
+
var import_react34 = require("react");
|
|
6048
|
+
var import_material26 = require("@mui/material");
|
|
6049
|
+
var import_react_router_dom8 = require("react-router-dom");
|
|
5676
6050
|
|
|
5677
6051
|
// src/pages/configuracionLogin.ts
|
|
5678
6052
|
var RUTA_POR_OMISION = "/new-pass";
|
|
@@ -5687,7 +6061,7 @@ var import_react_hook_form = require("react-hook-form");
|
|
|
5687
6061
|
var import_zod = require("@hookform/resolvers/zod");
|
|
5688
6062
|
var z = __toESM(require("zod"), 1);
|
|
5689
6063
|
var import_react_redux4 = require("react-redux");
|
|
5690
|
-
var
|
|
6064
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
5691
6065
|
var loginSchema = z.object({
|
|
5692
6066
|
username: z.string().min(1, "El usuario es requerido"),
|
|
5693
6067
|
// Añadir validación básica
|
|
@@ -5695,9 +6069,9 @@ var loginSchema = z.object({
|
|
|
5695
6069
|
// Añadir validación básica
|
|
5696
6070
|
});
|
|
5697
6071
|
var LoginPage = () => {
|
|
5698
|
-
const [loginError, setLoginError] = (0,
|
|
5699
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
5700
|
-
const estadoDeLaRuta = (0,
|
|
6072
|
+
const [loginError, setLoginError] = (0, import_react34.useState)(null);
|
|
6073
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react34.useState)(false);
|
|
6074
|
+
const estadoDeLaRuta = (0, import_react_router_dom8.useLocation)().state;
|
|
5701
6075
|
const claveCambiada = typeof estadoDeLaRuta === "object" && estadoDeLaRuta !== null && "claveCambiada" in estadoDeLaRuta && estadoDeLaRuta.claveCambiada === true;
|
|
5702
6076
|
const rutaDeRecuperarClave2 = rutaParaRecuperarClave();
|
|
5703
6077
|
const { setIsLoggedIn, checkSession, avisarCierreVoluntario } = useApp();
|
|
@@ -5745,16 +6119,16 @@ var LoginPage = () => {
|
|
|
5745
6119
|
setIsSubmitting(false);
|
|
5746
6120
|
}
|
|
5747
6121
|
};
|
|
5748
|
-
return /* @__PURE__ */ (0,
|
|
5749
|
-
|
|
6122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6123
|
+
import_material26.Box,
|
|
5750
6124
|
{
|
|
5751
6125
|
display: "flex",
|
|
5752
6126
|
alignItems: "center",
|
|
5753
6127
|
justifyContent: "center",
|
|
5754
6128
|
minHeight: "100vh",
|
|
5755
6129
|
bgcolor: "#f5f5f5",
|
|
5756
|
-
children: /* @__PURE__ */ (0,
|
|
5757
|
-
|
|
6130
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
6131
|
+
import_material26.Box,
|
|
5758
6132
|
{
|
|
5759
6133
|
width: "100%",
|
|
5760
6134
|
maxWidth: "400px",
|
|
@@ -5763,7 +6137,7 @@ var LoginPage = () => {
|
|
|
5763
6137
|
borderRadius: 8,
|
|
5764
6138
|
boxShadow: 3,
|
|
5765
6139
|
children: [
|
|
5766
|
-
/* @__PURE__ */ (0,
|
|
6140
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material26.Box, { sx: { display: "flex", justifyContent: "center", mb: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5767
6141
|
"img",
|
|
5768
6142
|
{
|
|
5769
6143
|
src: `${envConfig.backendUrl}/img/login-logo-icon.png`,
|
|
@@ -5771,8 +6145,8 @@ var LoginPage = () => {
|
|
|
5771
6145
|
style: { height: "192px", maxWidth: "100%", objectFit: "contain" }
|
|
5772
6146
|
}
|
|
5773
6147
|
) }),
|
|
5774
|
-
/* @__PURE__ */ (0,
|
|
5775
|
-
/* @__PURE__ */ (0,
|
|
6148
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material26.Typography, { variant: "h5", align: "center", gutterBottom: true, sx: { fontWeight: "bold", color: "primary.main" }, children: "Iniciar Sesi\xF3n" }),
|
|
6149
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
5776
6150
|
"form",
|
|
5777
6151
|
{
|
|
5778
6152
|
onSubmit: handleSubmit(onSubmit),
|
|
@@ -5784,15 +6158,15 @@ var LoginPage = () => {
|
|
|
5784
6158
|
if (!isSubmitting) void handleSubmit(onSubmit)();
|
|
5785
6159
|
},
|
|
5786
6160
|
children: [
|
|
5787
|
-
/* @__PURE__ */ (0,
|
|
5788
|
-
/* @__PURE__ */ (0,
|
|
5789
|
-
/* @__PURE__ */ (0,
|
|
6161
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { children: [
|
|
6162
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("label", { htmlFor: "username", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material26.Typography, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Usuario" }) }),
|
|
6163
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5790
6164
|
import_react_hook_form.Controller,
|
|
5791
6165
|
{
|
|
5792
6166
|
name: "username",
|
|
5793
6167
|
control,
|
|
5794
|
-
render: ({ field }) => /* @__PURE__ */ (0,
|
|
5795
|
-
|
|
6168
|
+
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6169
|
+
import_material26.TextField,
|
|
5796
6170
|
{
|
|
5797
6171
|
...field,
|
|
5798
6172
|
type: "text",
|
|
@@ -5809,15 +6183,15 @@ var LoginPage = () => {
|
|
|
5809
6183
|
}
|
|
5810
6184
|
)
|
|
5811
6185
|
] }),
|
|
5812
|
-
/* @__PURE__ */ (0,
|
|
5813
|
-
/* @__PURE__ */ (0,
|
|
5814
|
-
/* @__PURE__ */ (0,
|
|
6186
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { children: [
|
|
6187
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("label", { htmlFor: "password", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material26.Typography, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Contrase\xF1a" }) }),
|
|
6188
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5815
6189
|
import_react_hook_form.Controller,
|
|
5816
6190
|
{
|
|
5817
6191
|
name: "password",
|
|
5818
6192
|
control,
|
|
5819
|
-
render: ({ field }) => /* @__PURE__ */ (0,
|
|
5820
|
-
|
|
6193
|
+
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6194
|
+
import_material26.TextField,
|
|
5821
6195
|
{
|
|
5822
6196
|
...field,
|
|
5823
6197
|
type: "password",
|
|
@@ -5834,18 +6208,18 @@ var LoginPage = () => {
|
|
|
5834
6208
|
}
|
|
5835
6209
|
)
|
|
5836
6210
|
] }),
|
|
5837
|
-
/* @__PURE__ */ (0,
|
|
5838
|
-
/* @__PURE__ */ (0,
|
|
6211
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material26.Button, { type: "submit", fullWidth: true, variant: "contained", color: "primary", disabled: isSubmitting, sx: { mt: 2 }, children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
6212
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material26.CircularProgress, { size: 20, sx: { mr: 1 } }),
|
|
5839
6213
|
"Iniciando sesi\xF3n..."
|
|
5840
6214
|
] }) : "Iniciar Sesi\xF3n" })
|
|
5841
6215
|
]
|
|
5842
6216
|
}
|
|
5843
6217
|
),
|
|
5844
|
-
rutaDeRecuperarClave2 && /* @__PURE__ */ (0,
|
|
5845
|
-
claveCambiada && !loginError && /* @__PURE__ */ (0,
|
|
5846
|
-
loginError && /* @__PURE__ */ (0,
|
|
6218
|
+
rutaDeRecuperarClave2 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material26.Box, { sx: { mt: 2, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material26.Link, { href: `${envConfig.backendUrl}${rutaDeRecuperarClave2}`, variant: "body2", underline: "hover", children: "Me olvid\xE9 la clave / es mi primer ingreso" }) }),
|
|
6219
|
+
claveCambiada && !loginError && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material26.Alert, { severity: "success", sx: { mt: 2 }, children: "La contrase\xF1a se cambi\xF3. Ingres\xE1 con la clave nueva." }),
|
|
6220
|
+
loginError && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_material26.Alert, { severity: "error", sx: { mt: 2, maxHeight: "200px" }, children: [
|
|
5847
6221
|
" ",
|
|
5848
|
-
/* @__PURE__ */ (0,
|
|
6222
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material26.AlertTitle, { children: "Error" }),
|
|
5849
6223
|
loginError
|
|
5850
6224
|
] })
|
|
5851
6225
|
]
|
|
@@ -5857,19 +6231,19 @@ var LoginPage = () => {
|
|
|
5857
6231
|
var LoginPage_default = LoginPage;
|
|
5858
6232
|
|
|
5859
6233
|
// src/components/ProcedureForm.tsx
|
|
5860
|
-
var
|
|
5861
|
-
var
|
|
5862
|
-
var
|
|
6234
|
+
var import_react35 = __toESM(require("react"), 1);
|
|
6235
|
+
var import_react_router_dom9 = require("react-router-dom");
|
|
6236
|
+
var import_material28 = require("@mui/material");
|
|
5863
6237
|
|
|
5864
6238
|
// src/pages/procedure-results/SuccessDisplay.tsx
|
|
5865
|
-
var
|
|
5866
|
-
var
|
|
6239
|
+
var import_material27 = require("@mui/material");
|
|
6240
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
5867
6241
|
var SuccessDisplay = ({ data }) => {
|
|
5868
|
-
return /* @__PURE__ */ (0,
|
|
5869
|
-
/* @__PURE__ */ (0,
|
|
5870
|
-
/* @__PURE__ */ (0,
|
|
5871
|
-
/* @__PURE__ */ (0,
|
|
5872
|
-
/* @__PURE__ */ (0,
|
|
6242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_material27.Paper, { elevation: 2, sx: { p: 2, mt: 2, bgcolor: "success.light", color: "success.contrastText" }, children: [
|
|
6243
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material27.Typography, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: "\xA1Operaci\xF3n Exitosa!" }),
|
|
6244
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material27.Typography, { variant: "body2", sx: { fontSize: "0.85rem" }, children: "Detalles del resultado:" }),
|
|
6245
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material27.Box, { sx: { bgcolor: "success.dark", p: 1, borderRadius: 1, mt: 1, overflowX: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(data, null, 2) }) }),
|
|
6246
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material27.Typography, { variant: "body2", sx: { fontSize: "0.8rem", mt: 1 }, children: "Puedes revisar los detalles anteriores o cerrar este mensaje." })
|
|
5873
6247
|
] });
|
|
5874
6248
|
};
|
|
5875
6249
|
var SuccessDisplay_default = SuccessDisplay;
|
|
@@ -5883,22 +6257,22 @@ var extendResultsOk = (newComponents) => {
|
|
|
5883
6257
|
};
|
|
5884
6258
|
|
|
5885
6259
|
// src/components/ProcedureForm.tsx
|
|
5886
|
-
var
|
|
6260
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
5887
6261
|
var ProcedureForm = () => {
|
|
5888
|
-
const { procedureName } = (0,
|
|
6262
|
+
const { procedureName } = (0, import_react_router_dom9.useParams)();
|
|
5889
6263
|
const { clientContext } = useApp();
|
|
5890
6264
|
const { callApi, loading: apiLoading, error: apiError } = useApiCall();
|
|
5891
|
-
const [validationErrors, setValidationErrors] = (0,
|
|
5892
|
-
const [successMessage, setSuccessMessage] = (0,
|
|
5893
|
-
const [executionLog, setExecutionLog] = (0,
|
|
5894
|
-
const [procedureResultData, setProcedureResultData] = (0,
|
|
5895
|
-
const procedure = (0,
|
|
6265
|
+
const [validationErrors, setValidationErrors] = (0, import_react35.useState)({});
|
|
6266
|
+
const [successMessage, setSuccessMessage] = (0, import_react35.useState)(null);
|
|
6267
|
+
const [executionLog, setExecutionLog] = (0, import_react35.useState)([]);
|
|
6268
|
+
const [procedureResultData, setProcedureResultData] = (0, import_react35.useState)(null);
|
|
6269
|
+
const procedure = (0, import_react35.useMemo)(() => {
|
|
5896
6270
|
if (procedureName && clientContext?.procedure) {
|
|
5897
6271
|
return clientContext.procedure[procedureName];
|
|
5898
6272
|
}
|
|
5899
6273
|
return void 0;
|
|
5900
6274
|
}, [procedureName, clientContext]);
|
|
5901
|
-
const [formValues, setFormValues] = (0,
|
|
6275
|
+
const [formValues, setFormValues] = (0, import_react35.useState)(() => {
|
|
5902
6276
|
if (!procedure) return {};
|
|
5903
6277
|
const initialValues = {};
|
|
5904
6278
|
procedure.parameters.forEach((param) => {
|
|
@@ -5923,7 +6297,7 @@ var ProcedureForm = () => {
|
|
|
5923
6297
|
});
|
|
5924
6298
|
return initialValues;
|
|
5925
6299
|
});
|
|
5926
|
-
|
|
6300
|
+
import_react35.default.useEffect(() => {
|
|
5927
6301
|
if (procedure) {
|
|
5928
6302
|
setValidationErrors({});
|
|
5929
6303
|
setSuccessMessage(null);
|
|
@@ -5953,11 +6327,11 @@ var ProcedureForm = () => {
|
|
|
5953
6327
|
setExecutionLog([]);
|
|
5954
6328
|
}
|
|
5955
6329
|
}, [procedure]);
|
|
5956
|
-
const addLogMessage = (0,
|
|
6330
|
+
const addLogMessage = (0, import_react35.useCallback)((message, isError = false) => {
|
|
5957
6331
|
const timestamp = (/* @__PURE__ */ new Date()).toLocaleTimeString("es-AR");
|
|
5958
6332
|
setExecutionLog((prev) => [...prev, `[${timestamp}] ${isError ? "ERROR: " : ""}${message}`]);
|
|
5959
6333
|
}, []);
|
|
5960
|
-
const handleChange = (0,
|
|
6334
|
+
const handleChange = (0, import_react35.useCallback)((e, child) => {
|
|
5961
6335
|
const { name, value } = e.target;
|
|
5962
6336
|
let newValue = value;
|
|
5963
6337
|
if (e.target.type === "checkbox") {
|
|
@@ -6079,7 +6453,7 @@ var ProcedureForm = () => {
|
|
|
6079
6453
|
addLogMessage("Ejecuci\xF3n finalizada.");
|
|
6080
6454
|
}
|
|
6081
6455
|
};
|
|
6082
|
-
const renderInputField = (0,
|
|
6456
|
+
const renderInputField = (0, import_react35.useCallback)((param) => {
|
|
6083
6457
|
const hasError = !!validationErrors[param.name];
|
|
6084
6458
|
const errorMessage = validationErrors[param.name];
|
|
6085
6459
|
const commonProps = {
|
|
@@ -6098,10 +6472,10 @@ var ProcedureForm = () => {
|
|
|
6098
6472
|
sx: { fontSize: "0.8rem" }
|
|
6099
6473
|
};
|
|
6100
6474
|
if (param.options && param.options.length > 0) {
|
|
6101
|
-
return /* @__PURE__ */ (0,
|
|
6102
|
-
/* @__PURE__ */ (0,
|
|
6103
|
-
/* @__PURE__ */ (0,
|
|
6104
|
-
|
|
6475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_material28.FormControl, { fullWidth: true, margin: "dense", size: "small", error: hasError, required: commonProps.required, children: [
|
|
6476
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.InputLabel, { id: `${param.name}-label`, sx: { fontSize: "0.8rem" }, children: param.label || param.name }),
|
|
6477
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
6478
|
+
import_material28.Select,
|
|
6105
6479
|
{
|
|
6106
6480
|
labelId: `${param.name}-label`,
|
|
6107
6481
|
value: formValues[param.name] === void 0 ? "" : formValues[param.name],
|
|
@@ -6111,14 +6485,14 @@ var ProcedureForm = () => {
|
|
|
6111
6485
|
label: param.label || param.name,
|
|
6112
6486
|
disabled: apiLoading,
|
|
6113
6487
|
sx: { fontSize: "0.8rem" },
|
|
6114
|
-
renderValue: (selected) => /* @__PURE__ */ (0,
|
|
6488
|
+
renderValue: (selected) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.Typography, { sx: { fontSize: "0.8rem" }, children: selected }),
|
|
6115
6489
|
children: [
|
|
6116
|
-
(!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */ (0,
|
|
6117
|
-
param.options.map((option) => /* @__PURE__ */ (0,
|
|
6490
|
+
(!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.MenuItem, { value: "", sx: { fontSize: "0.8rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("em", { children: "Seleccione..." }) }),
|
|
6491
|
+
param.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.MenuItem, { value: option, sx: { fontSize: "0.8rem" }, children: option }, option))
|
|
6118
6492
|
]
|
|
6119
6493
|
}
|
|
6120
6494
|
),
|
|
6121
|
-
(param.description || errorMessage) && /* @__PURE__ */ (0,
|
|
6495
|
+
(param.description || errorMessage) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
|
|
6122
6496
|
] });
|
|
6123
6497
|
}
|
|
6124
6498
|
switch (param.typeName) {
|
|
@@ -6127,19 +6501,19 @@ var ProcedureForm = () => {
|
|
|
6127
6501
|
case "tsrange":
|
|
6128
6502
|
case "time_range":
|
|
6129
6503
|
case "daterange":
|
|
6130
|
-
return /* @__PURE__ */ (0,
|
|
6504
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.TextField, { type: "text", value: formValues[param.name] || "", ...commonProps });
|
|
6131
6505
|
case "decimal":
|
|
6132
6506
|
case "double":
|
|
6133
|
-
return /* @__PURE__ */ (0,
|
|
6507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.TextField, { type: "number", inputProps: { step: "any", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
|
|
6134
6508
|
case "integer":
|
|
6135
6509
|
case "bigint":
|
|
6136
|
-
return /* @__PURE__ */ (0,
|
|
6510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.TextField, { type: "number", inputProps: { step: "1", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
|
|
6137
6511
|
case "boolean":
|
|
6138
|
-
return /* @__PURE__ */ (0,
|
|
6139
|
-
|
|
6512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6513
|
+
import_material28.FormControlLabel,
|
|
6140
6514
|
{
|
|
6141
|
-
control: /* @__PURE__ */ (0,
|
|
6142
|
-
|
|
6515
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6516
|
+
import_material28.Checkbox,
|
|
6143
6517
|
{
|
|
6144
6518
|
checked: !!formValues[param.name],
|
|
6145
6519
|
onChange: handleChange,
|
|
@@ -6149,21 +6523,21 @@ var ProcedureForm = () => {
|
|
|
6149
6523
|
size: "small"
|
|
6150
6524
|
}
|
|
6151
6525
|
),
|
|
6152
|
-
label: /* @__PURE__ */ (0,
|
|
6526
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.Typography, { sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "inherit" }, children: param.label || param.name }),
|
|
6153
6527
|
sx: { mt: 1, mb: 0 }
|
|
6154
6528
|
}
|
|
6155
6529
|
);
|
|
6156
6530
|
case "date":
|
|
6157
6531
|
case "timestamp":
|
|
6158
6532
|
case "time":
|
|
6159
|
-
return /* @__PURE__ */ (0,
|
|
6533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.TextField, { type: param.typeName === "date" ? "date" : param.typeName === "timestamp" ? "datetime-local" : "time", value: formValues[param.name] || "", ...commonProps, InputLabelProps: { shrink: true, sx: { fontSize: "0.8rem" } } });
|
|
6160
6534
|
case "jsonb":
|
|
6161
6535
|
case "jsona":
|
|
6162
|
-
return /* @__PURE__ */ (0,
|
|
6536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.TextField, { multiline: true, rows: 5, value: formValues[param.name] || "", ...commonProps, InputProps: { sx: { fontSize: "0.8rem" } } });
|
|
6163
6537
|
case "bytea":
|
|
6164
|
-
return /* @__PURE__ */ (0,
|
|
6165
|
-
/* @__PURE__ */ (0,
|
|
6166
|
-
/* @__PURE__ */ (0,
|
|
6538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_material28.FormControl, { fullWidth: true, margin: "dense", error: hasError, required: commonProps.required, children: [
|
|
6539
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.Typography, { variant: "body2", color: "textSecondary", component: "label", htmlFor: param.name, sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "text.secondary" }, children: param.label || param.name }),
|
|
6540
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6167
6541
|
"input",
|
|
6168
6542
|
{
|
|
6169
6543
|
type: "file",
|
|
@@ -6177,34 +6551,34 @@ var ProcedureForm = () => {
|
|
|
6177
6551
|
style: { padding: "6px 0", fontSize: "0.8rem" }
|
|
6178
6552
|
}
|
|
6179
6553
|
),
|
|
6180
|
-
(param.description || errorMessage) && /* @__PURE__ */ (0,
|
|
6554
|
+
(param.description || errorMessage) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
|
|
6181
6555
|
] });
|
|
6182
6556
|
default:
|
|
6183
|
-
return /* @__PURE__ */ (0,
|
|
6557
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.TextField, { type: "text", value: formValues[param.name] || "", ...commonProps });
|
|
6184
6558
|
}
|
|
6185
6559
|
}, [formValues, handleChange, apiLoading, validationErrors]);
|
|
6186
|
-
const ResultDisplayContent = (0,
|
|
6560
|
+
const ResultDisplayContent = (0, import_react35.useMemo)(() => {
|
|
6187
6561
|
if (!procedureResultData || !procedure?.resultOk) return null;
|
|
6188
6562
|
const ComponentToRender = resultsOk[procedure.resultOk];
|
|
6189
6563
|
if (ComponentToRender) {
|
|
6190
|
-
return /* @__PURE__ */ (0,
|
|
6564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ComponentToRender, { data: procedureResultData });
|
|
6191
6565
|
} else {
|
|
6192
|
-
return /* @__PURE__ */ (0,
|
|
6193
|
-
/* @__PURE__ */ (0,
|
|
6566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_material28.Paper, { elevation: 2, sx: { p: 2, mt: 0, bgcolor: "warning.light" }, children: [
|
|
6567
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_material28.Typography, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: [
|
|
6194
6568
|
"el componente para resolver el resultOk: '",
|
|
6195
6569
|
procedure.resultOk,
|
|
6196
6570
|
"' definido en el procedure no existe o no est\xE1 mapeado."
|
|
6197
6571
|
] }),
|
|
6198
|
-
/* @__PURE__ */ (0,
|
|
6572
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.Box, { sx: {
|
|
6199
6573
|
bgcolor: "warning.dark",
|
|
6200
6574
|
p: 1,
|
|
6201
6575
|
borderRadius: 1
|
|
6202
|
-
}, children: /* @__PURE__ */ (0,
|
|
6576
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(procedureResultData, null, 2) }) })
|
|
6203
6577
|
] });
|
|
6204
6578
|
}
|
|
6205
6579
|
}, [procedureResultData, procedure]);
|
|
6206
6580
|
if (!procedure) {
|
|
6207
|
-
return /* @__PURE__ */ (0,
|
|
6581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_material28.Box, { sx: {
|
|
6208
6582
|
p: 2,
|
|
6209
6583
|
width: "100%",
|
|
6210
6584
|
boxSizing: "border-box",
|
|
@@ -6214,13 +6588,13 @@ var ProcedureForm = () => {
|
|
|
6214
6588
|
boxShadow: 3,
|
|
6215
6589
|
textAlign: "center"
|
|
6216
6590
|
}, children: [
|
|
6217
|
-
/* @__PURE__ */ (0,
|
|
6218
|
-
/* @__PURE__ */ (0,
|
|
6591
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.CircularProgress, { sx: { mb: 2 } }),
|
|
6592
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.Typography, { variant: "h6", color: "text.secondary", children: "Cargando procedimiento o no encontrado..." })
|
|
6219
6593
|
] });
|
|
6220
6594
|
}
|
|
6221
6595
|
return (
|
|
6222
6596
|
// Esta es la Box más externa que ahora controlará el scroll
|
|
6223
|
-
/* @__PURE__ */ (0,
|
|
6597
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_material28.Box, { sx: {
|
|
6224
6598
|
p: 2,
|
|
6225
6599
|
ml: 1,
|
|
6226
6600
|
mt: 2,
|
|
@@ -6237,17 +6611,17 @@ var ProcedureForm = () => {
|
|
|
6237
6611
|
overflowX: "hidden"
|
|
6238
6612
|
// Oculta el scroll horizontal si no es necesario para el contenedor principal
|
|
6239
6613
|
}, children: [
|
|
6240
|
-
/* @__PURE__ */ (0,
|
|
6241
|
-
Object.values(validationErrors).some((err) => err !== null) && /* @__PURE__ */ (0,
|
|
6614
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.Typography, { variant: "h5", component: "h2", gutterBottom: true, align: "left", children: cambiarGuionesBajosPorEspacios(procedure.proceedLabel || procedure.action) }),
|
|
6615
|
+
Object.values(validationErrors).some((err) => err !== null) && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_material28.Alert, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: [
|
|
6242
6616
|
"Por favor, corrige los errores en el formulario antes de enviar.",
|
|
6243
|
-
/* @__PURE__ */ (0,
|
|
6617
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("ul", { children: Object.values(validationErrors).map((err, idx) => err && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("li", { children: err }, idx)) })
|
|
6244
6618
|
] }),
|
|
6245
|
-
!Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */ (0,
|
|
6246
|
-
!Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */ (0,
|
|
6247
|
-
/* @__PURE__ */ (0,
|
|
6248
|
-
procedure.parameters.map((param) => /* @__PURE__ */ (0,
|
|
6249
|
-
/* @__PURE__ */ (0,
|
|
6250
|
-
|
|
6619
|
+
!Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.Alert, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: apiError.message }),
|
|
6620
|
+
!Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.Alert, { severity: "success", sx: { mb: 2, fontSize: "0.8rem" }, children: successMessage }),
|
|
6621
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("form", { onSubmit: handleSubmit, children: [
|
|
6622
|
+
procedure.parameters.map((param) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { children: renderInputField(param) }, param.name)),
|
|
6623
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6624
|
+
import_material28.Button,
|
|
6251
6625
|
{
|
|
6252
6626
|
type: "submit",
|
|
6253
6627
|
variant: "contained",
|
|
@@ -6255,20 +6629,20 @@ var ProcedureForm = () => {
|
|
|
6255
6629
|
disabled: apiLoading || Object.values(validationErrors).some((err) => err !== null),
|
|
6256
6630
|
sx: { mt: 2 },
|
|
6257
6631
|
size: "medium",
|
|
6258
|
-
startIcon: apiLoading ? /* @__PURE__ */ (0,
|
|
6632
|
+
startIcon: apiLoading ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.CircularProgress, { size: 20, color: "inherit" }) : null,
|
|
6259
6633
|
children: apiLoading ? "Ejecutando..." : procedure.proceedLabel || "Ejecutar"
|
|
6260
6634
|
}
|
|
6261
6635
|
)
|
|
6262
6636
|
] }),
|
|
6263
|
-
ResultDisplayContent && /* @__PURE__ */ (0,
|
|
6637
|
+
ResultDisplayContent && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_material28.Box, { sx: { mt: 2 }, children: [
|
|
6264
6638
|
" ",
|
|
6265
6639
|
ResultDisplayContent
|
|
6266
6640
|
] }),
|
|
6267
|
-
executionLog.length > 0 && /* @__PURE__ */ (0,
|
|
6268
|
-
/* @__PURE__ */ (0,
|
|
6269
|
-
/* @__PURE__ */ (0,
|
|
6270
|
-
/* @__PURE__ */ (0,
|
|
6271
|
-
|
|
6641
|
+
executionLog.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_material28.Box, { sx: { mt: 3 }, children: [
|
|
6642
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.Divider, { sx: { mb: 2 } }),
|
|
6643
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.Typography, { variant: "h6", gutterBottom: true, sx: { fontSize: "0.9rem" }, children: "Registro de Ejecuci\xF3n" }),
|
|
6644
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6645
|
+
import_material28.Box,
|
|
6272
6646
|
{
|
|
6273
6647
|
sx: {
|
|
6274
6648
|
bgcolor: "grey.100",
|
|
@@ -6281,8 +6655,8 @@ var ProcedureForm = () => {
|
|
|
6281
6655
|
fontSize: "0.75rem",
|
|
6282
6656
|
whiteSpace: "pre-wrap"
|
|
6283
6657
|
},
|
|
6284
|
-
children: executionLog.map((log, index) => /* @__PURE__ */ (0,
|
|
6285
|
-
|
|
6658
|
+
children: executionLog.map((log, index) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6659
|
+
import_material28.Typography,
|
|
6286
6660
|
{
|
|
6287
6661
|
component: "pre",
|
|
6288
6662
|
sx: {
|
|
@@ -6307,17 +6681,17 @@ var import_react_redux6 = require("react-redux");
|
|
|
6307
6681
|
var import_react45 = require("redux-persist/integration/react");
|
|
6308
6682
|
|
|
6309
6683
|
// src/components/PrivateRoute.tsx
|
|
6310
|
-
var
|
|
6311
|
-
var
|
|
6312
|
-
var
|
|
6684
|
+
var import_react36 = require("react");
|
|
6685
|
+
var import_react_router_dom10 = require("react-router-dom");
|
|
6686
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
6313
6687
|
var PrivateRoute = ({ children }) => {
|
|
6314
|
-
const location = (0,
|
|
6688
|
+
const location = (0, import_react_router_dom10.useLocation)();
|
|
6315
6689
|
const dispatch = useAppDispatch();
|
|
6316
6690
|
const clientContextStatus = useClientContextStatus();
|
|
6317
6691
|
const isAuthenticated = clientContextStatus === "succeeded";
|
|
6318
6692
|
const isLoadingAuth = clientContextStatus === "loading";
|
|
6319
6693
|
console.log(`[PrivateRoute] Render: Path=${location.pathname}, AuthStatus=${clientContextStatus}, IsAuthenticated=${isAuthenticated}, IsLoadingAuth=${isLoadingAuth}`);
|
|
6320
|
-
(0,
|
|
6694
|
+
(0, import_react36.useEffect)(() => {
|
|
6321
6695
|
console.log(`[PrivateRoute] Effect: Path=${location.pathname}, AuthStatus=${clientContextStatus}, IsAuthenticated=${isAuthenticated}, IsLoadingAuth=${isLoadingAuth}`);
|
|
6322
6696
|
if (!isAuthenticated && !isLoadingAuth && location.pathname !== "/login" && !huboCierreVoluntario()) {
|
|
6323
6697
|
const path = location.pathname + location.search + location.hash;
|
|
@@ -6333,36 +6707,36 @@ var PrivateRoute = ({ children }) => {
|
|
|
6333
6707
|
}, [isAuthenticated, isLoadingAuth, location, dispatch, clientContextStatus]);
|
|
6334
6708
|
if (isLoadingAuth) {
|
|
6335
6709
|
console.log(`[PrivateRoute] Returning loading state...`);
|
|
6336
|
-
return /* @__PURE__ */ (0,
|
|
6710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { children: "Verificando autenticaci\xF3n..." });
|
|
6337
6711
|
}
|
|
6338
6712
|
if (!isAuthenticated) {
|
|
6339
6713
|
console.log(`[PrivateRoute] User not authenticated, navigating to /login`);
|
|
6340
|
-
return /* @__PURE__ */ (0,
|
|
6714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_router_dom10.Navigate, { to: "/login", replace: true });
|
|
6341
6715
|
}
|
|
6342
6716
|
console.log(`[PrivateRoute] User authenticated, rendering children.`);
|
|
6343
|
-
return /* @__PURE__ */ (0,
|
|
6717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children });
|
|
6344
6718
|
};
|
|
6345
6719
|
var PrivateRoute_default = PrivateRoute;
|
|
6346
6720
|
|
|
6347
6721
|
// src/components/InitialRedirectHandler.tsx
|
|
6348
|
-
var
|
|
6349
|
-
var
|
|
6722
|
+
var import_react37 = require("react");
|
|
6723
|
+
var import_react_router_dom11 = require("react-router-dom");
|
|
6350
6724
|
var InitialRedirectHandler = () => {
|
|
6351
|
-
const location = (0,
|
|
6352
|
-
const navigate = (0,
|
|
6725
|
+
const location = (0, import_react_router_dom11.useLocation)();
|
|
6726
|
+
const navigate = (0, import_react_router_dom11.useNavigate)();
|
|
6353
6727
|
const dispatch = useAppDispatch();
|
|
6354
6728
|
const redirectPath = useRedirectPath();
|
|
6355
6729
|
const clientContextStatus = useClientContextStatus();
|
|
6356
6730
|
const username = useAppSelector((state) => state.clientContext.username);
|
|
6357
6731
|
const redirectUsername = useAppSelector((state) => state.router.redirectUsername);
|
|
6358
|
-
(0,
|
|
6732
|
+
(0, import_react37.useEffect)(() => {
|
|
6359
6733
|
dispatch(setCurrentPath(location.pathname + location.search));
|
|
6360
6734
|
}, [location, dispatch]);
|
|
6361
|
-
const navegandoRef = (0,
|
|
6362
|
-
(0,
|
|
6735
|
+
const navegandoRef = (0, import_react37.useRef)(false);
|
|
6736
|
+
(0, import_react37.useEffect)(() => {
|
|
6363
6737
|
navegandoRef.current = false;
|
|
6364
6738
|
}, [location.pathname]);
|
|
6365
|
-
(0,
|
|
6739
|
+
(0, import_react37.useEffect)(() => {
|
|
6366
6740
|
if (clientContextStatus === "succeeded") {
|
|
6367
6741
|
if (redirectPath && redirectPath !== "/login" && redirectUsername && redirectUsername !== username) {
|
|
6368
6742
|
dispatch(setRedirectPath(null));
|
|
@@ -6382,26 +6756,26 @@ var InitialRedirectHandler = () => {
|
|
|
6382
6756
|
var InitialRedirectHandler_default = InitialRedirectHandler;
|
|
6383
6757
|
|
|
6384
6758
|
// src/pages/GenericDataGridPage.tsx
|
|
6385
|
-
var
|
|
6386
|
-
var
|
|
6387
|
-
var
|
|
6759
|
+
var import_react38 = __toESM(require("react"), 1);
|
|
6760
|
+
var import_react_router_dom12 = require("react-router-dom");
|
|
6761
|
+
var import_material29 = require("@mui/material");
|
|
6388
6762
|
var import_Close2 = __toESM(require("@mui/icons-material/Close"), 1);
|
|
6389
|
-
var
|
|
6763
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
6390
6764
|
var GenericDataGridPage = ({
|
|
6391
6765
|
initialTableName,
|
|
6392
6766
|
initialFixedFields = [],
|
|
6393
6767
|
parametros: parametrosRecibidos
|
|
6394
6768
|
}) => {
|
|
6395
|
-
const { tableName: urlTableName } = (0,
|
|
6769
|
+
const { tableName: urlTableName } = (0, import_react_router_dom12.useParams)();
|
|
6396
6770
|
const effectiveTableName = initialTableName || urlTableName;
|
|
6397
|
-
const [tabs, setTabs] = (0,
|
|
6398
|
-
const [activeTabIdx, setActiveTabIdx] = (0,
|
|
6771
|
+
const [tabs, setTabs] = (0, import_react38.useState)([]);
|
|
6772
|
+
const [activeTabIdx, setActiveTabIdx] = (0, import_react38.useState)(0);
|
|
6399
6773
|
const ffKey = JSON.stringify(initialFixedFields);
|
|
6400
|
-
const location = (0,
|
|
6401
|
-
const parametros = (0,
|
|
6774
|
+
const location = (0, import_react_router_dom12.useLocation)();
|
|
6775
|
+
const parametros = (0, import_react38.useMemo)(() => parametrosRecibidos ?? parametrosDeTabla(void 0, location.search), [parametrosRecibidos, location.search]);
|
|
6402
6776
|
const fixedFieldsIniciales = initialFixedFields.length > 0 ? initialFixedFields : parametros.fixedFields ?? [];
|
|
6403
6777
|
const parametrosKey = JSON.stringify(parametros);
|
|
6404
|
-
|
|
6778
|
+
import_react38.default.useEffect(() => {
|
|
6405
6779
|
if (effectiveTableName) {
|
|
6406
6780
|
setTabs([{
|
|
6407
6781
|
id: `main-${effectiveTableName}-${ffKey}-${parametrosKey}`,
|
|
@@ -6415,7 +6789,7 @@ var GenericDataGridPage = ({
|
|
|
6415
6789
|
setActiveTabIdx(0);
|
|
6416
6790
|
}
|
|
6417
6791
|
}, [effectiveTableName, ffKey, parametrosKey, location.key]);
|
|
6418
|
-
const handleOpenDetail = (0,
|
|
6792
|
+
const handleOpenDetail = (0, import_react38.useCallback)((tableName, fixedFields, label, ancestors) => {
|
|
6419
6793
|
const tabId = `${tableName}-${JSON.stringify(fixedFields)}`;
|
|
6420
6794
|
setTabs((prevTabs) => {
|
|
6421
6795
|
const existingTabIdx = prevTabs.findIndex((t) => t.id === tabId);
|
|
@@ -6437,26 +6811,26 @@ var GenericDataGridPage = ({
|
|
|
6437
6811
|
else if (activeTabIdx === index) setActiveTabIdx(index - 1);
|
|
6438
6812
|
};
|
|
6439
6813
|
if (!effectiveTableName) {
|
|
6440
|
-
return /* @__PURE__ */ (0,
|
|
6814
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material29.Box, { p: 3, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material29.Alert, { severity: "error", children: "No se especific\xF3 una tabla." }) });
|
|
6441
6815
|
}
|
|
6442
|
-
return /* @__PURE__ */ (0,
|
|
6443
|
-
/* @__PURE__ */ (0,
|
|
6444
|
-
|
|
6816
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_material29.Box, { sx: { width: "100%", height: "calc(100vh - 64px)", display: "flex", flexDirection: "column" }, children: [
|
|
6817
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material29.Box, { sx: { borderBottom: 1, borderColor: "divider", bgcolor: "background.paper" }, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material29.Tabs, { value: activeTabIdx, onChange: (_, v) => setActiveTabIdx(v), variant: "scrollable", children: tabs.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6818
|
+
import_material29.Tab,
|
|
6445
6819
|
{
|
|
6446
|
-
label: /* @__PURE__ */ (0,
|
|
6447
|
-
/* @__PURE__ */ (0,
|
|
6448
|
-
index !== 0 && /* @__PURE__ */ (0,
|
|
6820
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_material29.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
6821
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material29.Typography, { variant: "caption", sx: { fontWeight: "bold" }, children: tab.label }),
|
|
6822
|
+
index !== 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material29.IconButton, { size: "small", onClick: (e) => handleCloseTab(index, e), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_Close2.default, { fontSize: "inherit" }) })
|
|
6449
6823
|
] })
|
|
6450
6824
|
},
|
|
6451
6825
|
tab.id
|
|
6452
6826
|
)) }) }),
|
|
6453
|
-
tabs.map((tab, index) => /* @__PURE__ */ (0,
|
|
6454
|
-
|
|
6827
|
+
tabs.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6828
|
+
import_material29.Box,
|
|
6455
6829
|
{
|
|
6456
6830
|
role: "tabpanel",
|
|
6457
6831
|
hidden: activeTabIdx !== index,
|
|
6458
6832
|
sx: { flexGrow: 1, display: activeTabIdx === index ? "flex" : "none", flexDirection: "column", overflow: "hidden" },
|
|
6459
|
-
children: /* @__PURE__ */ (0,
|
|
6833
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6460
6834
|
GenericDataGrid_default,
|
|
6461
6835
|
{
|
|
6462
6836
|
tableName: tab.tableName,
|
|
@@ -6477,27 +6851,27 @@ var GenericDataGridPage = ({
|
|
|
6477
6851
|
var GenericDataGridPage_default = GenericDataGridPage;
|
|
6478
6852
|
|
|
6479
6853
|
// src/pages/PantallaDeRuta.tsx
|
|
6480
|
-
var
|
|
6481
|
-
var
|
|
6482
|
-
var
|
|
6483
|
-
var
|
|
6854
|
+
var import_react39 = require("react");
|
|
6855
|
+
var import_react_router_dom13 = require("react-router-dom");
|
|
6856
|
+
var import_material30 = require("@mui/material");
|
|
6857
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
6484
6858
|
var PantallaDeRuta = ({ screenName }) => {
|
|
6485
|
-
const [busqueda] = (0,
|
|
6486
|
-
const params = (0,
|
|
6859
|
+
const [busqueda] = (0, import_react_router_dom13.useSearchParams)();
|
|
6860
|
+
const params = (0, import_react39.useMemo)(() => Object.fromEntries(busqueda.entries()), [busqueda]);
|
|
6487
6861
|
const Pantalla = wScreens[screenName];
|
|
6488
|
-
return /* @__PURE__ */ (0,
|
|
6862
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material30.Box, { sx: { pt: 3, pl: 4 }, children: Pantalla ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Pantalla, { screenName, params }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(FallbackWScreen, { screenName }) });
|
|
6489
6863
|
};
|
|
6490
6864
|
|
|
6491
6865
|
// src/pages/MenuTablePage.tsx
|
|
6492
|
-
var
|
|
6493
|
-
var
|
|
6494
|
-
var
|
|
6495
|
-
var
|
|
6866
|
+
var import_react40 = require("react");
|
|
6867
|
+
var import_react_router_dom14 = require("react-router-dom");
|
|
6868
|
+
var import_material31 = require("@mui/material");
|
|
6869
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
6496
6870
|
var MenuTablePage = () => {
|
|
6497
|
-
const { "*": menuName } = (0,
|
|
6871
|
+
const { "*": menuName } = (0, import_react_router_dom14.useParams)();
|
|
6498
6872
|
const { clientContext } = useApp();
|
|
6499
|
-
const { search } = (0,
|
|
6500
|
-
const { currentTableName, currentFixedFields, parametros } = (0,
|
|
6873
|
+
const { search } = (0, import_react_router_dom14.useLocation)();
|
|
6874
|
+
const { currentTableName, currentFixedFields, parametros } = (0, import_react40.useMemo)(() => {
|
|
6501
6875
|
let tableName = void 0;
|
|
6502
6876
|
let fixedFields = [];
|
|
6503
6877
|
let parametros2 = {};
|
|
@@ -6518,12 +6892,12 @@ var MenuTablePage = () => {
|
|
|
6518
6892
|
};
|
|
6519
6893
|
}, [menuName, clientContext, search]);
|
|
6520
6894
|
if (!currentTableName) {
|
|
6521
|
-
return /* @__PURE__ */ (0,
|
|
6522
|
-
/* @__PURE__ */ (0,
|
|
6523
|
-
/* @__PURE__ */ (0,
|
|
6895
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material31.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_material31.Alert, { severity: "error", children: [
|
|
6896
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material31.Typography, { variant: "h6", children: "Error: No se pudo cargar la informaci\xF3n de la tabla." }),
|
|
6897
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material31.Typography, { variant: "body1", children: "Verifique la configuraci\xF3n del men\xFA o el nombre de la tabla en la URL." })
|
|
6524
6898
|
] }) });
|
|
6525
6899
|
}
|
|
6526
|
-
return /* @__PURE__ */ (0,
|
|
6900
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6527
6901
|
GenericDataGridPage_default,
|
|
6528
6902
|
{
|
|
6529
6903
|
initialTableName: currentTableName,
|
|
@@ -6535,170 +6909,9 @@ var MenuTablePage = () => {
|
|
|
6535
6909
|
var MenuTablePage_default = MenuTablePage;
|
|
6536
6910
|
|
|
6537
6911
|
// src/puente/PantallaBP.tsx
|
|
6538
|
-
var
|
|
6539
|
-
var
|
|
6540
|
-
var
|
|
6541
|
-
|
|
6542
|
-
// src/puente/clienteBP.ts
|
|
6543
|
-
function extraerRecursos(html) {
|
|
6544
|
-
const documento = new DOMParser().parseFromString(html, "text/html");
|
|
6545
|
-
const referencias2 = (selector, atributo) => Array.from(documento.querySelectorAll(selector)).map((elemento) => elemento.getAttribute(atributo)).filter((ruta) => !!ruta);
|
|
6546
|
-
return {
|
|
6547
|
-
hojasDeEstilo: referencias2("link[rel=stylesheet]", "href"),
|
|
6548
|
-
scripts: referencias2("script[src]", "src")
|
|
6549
|
-
};
|
|
6550
|
-
}
|
|
6551
|
-
function fijarBase(urlBackend) {
|
|
6552
|
-
const href = new URL(urlBackend.replace(/\/*$/, "/"), window.location.href).href;
|
|
6553
|
-
let base = document.querySelector("base");
|
|
6554
|
-
if (!base) {
|
|
6555
|
-
base = document.createElement("base");
|
|
6556
|
-
document.head.prepend(base);
|
|
6557
|
-
}
|
|
6558
|
-
base.href = href;
|
|
6559
|
-
}
|
|
6560
|
-
function cargarScript(ruta) {
|
|
6561
|
-
return new Promise((resolver, rechazar) => {
|
|
6562
|
-
const script = document.createElement("script");
|
|
6563
|
-
script.async = false;
|
|
6564
|
-
script.src = ruta;
|
|
6565
|
-
script.onload = () => resolver();
|
|
6566
|
-
script.onerror = () => rechazar(new Error(`No se pudo cargar ${ruta}`));
|
|
6567
|
-
document.head.appendChild(script);
|
|
6568
|
-
});
|
|
6569
|
-
}
|
|
6570
|
-
function esperarCargaDeVentana() {
|
|
6571
|
-
if (document.readyState === "complete") return Promise.resolve();
|
|
6572
|
-
return new Promise((resolver) => window.addEventListener("load", () => resolver(), { once: true }));
|
|
6573
|
-
}
|
|
6574
|
-
async function sinEscuchasDeVentana(tipos, inyectar) {
|
|
6575
|
-
const original = window.addEventListener;
|
|
6576
|
-
const filtrada = function(tipo, escucha, opciones) {
|
|
6577
|
-
if (tipos.includes(tipo)) return;
|
|
6578
|
-
original.call(this, tipo, escucha, opciones);
|
|
6579
|
-
};
|
|
6580
|
-
window.addEventListener = filtrada;
|
|
6581
|
-
try {
|
|
6582
|
-
return await inyectar();
|
|
6583
|
-
} finally {
|
|
6584
|
-
if (window.addEventListener === filtrada) window.addEventListener = original;
|
|
6585
|
-
}
|
|
6586
|
-
}
|
|
6587
|
-
async function cargarScripts(rutas) {
|
|
6588
|
-
for (const ruta of rutas) {
|
|
6589
|
-
await cargarScript(ruta);
|
|
6590
|
-
}
|
|
6591
|
-
}
|
|
6592
|
-
var carga = null;
|
|
6593
|
-
function cargarClienteBP(urlBackend) {
|
|
6594
|
-
if (!carga) {
|
|
6595
|
-
carga = cargarSinMemoria(urlBackend).catch((error) => {
|
|
6596
|
-
carga = null;
|
|
6597
|
-
throw error;
|
|
6598
|
-
});
|
|
6599
|
-
}
|
|
6600
|
-
return carga;
|
|
6601
|
-
}
|
|
6602
|
-
async function cargarSinMemoria(urlBackend) {
|
|
6603
|
-
const destino = new URL(urlBackend, window.location.href);
|
|
6604
|
-
if (destino.origin !== window.location.origin) {
|
|
6605
|
-
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}).`);
|
|
6606
|
-
}
|
|
6607
|
-
fijarBase(urlBackend);
|
|
6608
|
-
const respuesta = await fetch(`${destino.pathname.replace(/\/*$/, "")}/menu`, { credentials: "include" });
|
|
6609
|
-
if (!respuesta.ok || /\/login\/?$/.test(new URL(respuesta.url).pathname)) {
|
|
6610
|
-
throw new Error("No hay una sesi\xF3n iniciada en el backend.");
|
|
6611
|
-
}
|
|
6612
|
-
const recursos = extraerRecursos(await respuesta.text());
|
|
6613
|
-
recursos.hojasDeEstilo.forEach((ruta) => {
|
|
6614
|
-
const enlace = document.createElement("link");
|
|
6615
|
-
enlace.rel = "stylesheet";
|
|
6616
|
-
enlace.href = ruta;
|
|
6617
|
-
document.head.appendChild(enlace);
|
|
6618
|
-
});
|
|
6619
|
-
await esperarCargaDeVentana();
|
|
6620
|
-
await sinEscuchasDeVentana(["popstate"], () => cargarScripts(recursos.scripts));
|
|
6621
|
-
const myOwn = window.myOwn;
|
|
6622
|
-
if (!myOwn) throw new Error("El backend no defini\xF3 myOwn.");
|
|
6623
|
-
window.my = myOwn;
|
|
6624
|
-
await myOwn.autoSetup();
|
|
6625
|
-
return myOwn;
|
|
6626
|
-
}
|
|
6627
|
-
|
|
6628
|
-
// src/puente/ConsolaBP.tsx
|
|
6629
|
-
var import_react39 = require("react");
|
|
6630
|
-
var import_material30 = require("@mui/material");
|
|
6631
|
-
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
6632
|
-
var MARGEN_DE_REPETIDO_MS = 1e3;
|
|
6633
|
-
function descartarRepetidos(consola, agregados, ahora) {
|
|
6634
|
-
for (const nodo of agregados) {
|
|
6635
|
-
if (!(nodo instanceof HTMLElement)) continue;
|
|
6636
|
-
const repetido = Array.from(consola.children).find(
|
|
6637
|
-
(otro) => otro instanceof HTMLElement && otro !== nodo && otro.className === nodo.className && otro.textContent === nodo.textContent && ahora - Number(otro.dataset.instante) < MARGEN_DE_REPETIDO_MS
|
|
6638
|
-
);
|
|
6639
|
-
if (repetido) nodo.remove();
|
|
6640
|
-
else nodo.dataset.instante = String(ahora);
|
|
6641
|
-
}
|
|
6642
|
-
}
|
|
6643
|
-
var ConsolaBP = () => {
|
|
6644
|
-
(0, import_react39.useEffect)(() => {
|
|
6645
|
-
const consola = document.getElementById("mini-console");
|
|
6646
|
-
if (!consola) return;
|
|
6647
|
-
const observador = new MutationObserver(
|
|
6648
|
-
(registros) => descartarRepetidos(consola, registros.flatMap((registro) => Array.from(registro.addedNodes)), Date.now())
|
|
6649
|
-
);
|
|
6650
|
-
observador.observe(consola, { childList: true });
|
|
6651
|
-
return () => observador.disconnect();
|
|
6652
|
-
}, []);
|
|
6653
|
-
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6654
|
-
import_material30.Box,
|
|
6655
|
-
{
|
|
6656
|
-
id: "mini-console",
|
|
6657
|
-
sx: (tema) => ({
|
|
6658
|
-
"&#mini-console": {
|
|
6659
|
-
position: "fixed",
|
|
6660
|
-
top: { xs: 64, sm: 72 },
|
|
6661
|
-
left: "auto",
|
|
6662
|
-
right: 16,
|
|
6663
|
-
bottom: "auto",
|
|
6664
|
-
float: "none",
|
|
6665
|
-
zIndex: tema.zIndex.snackbar,
|
|
6666
|
-
width: "auto",
|
|
6667
|
-
minWidth: 0,
|
|
6668
|
-
maxWidth: "min(480px, calc(100vw - 32px))",
|
|
6669
|
-
minHeight: 0,
|
|
6670
|
-
maxHeight: "none",
|
|
6671
|
-
overflow: "visible",
|
|
6672
|
-
padding: 0,
|
|
6673
|
-
border: "none",
|
|
6674
|
-
borderRadius: 0,
|
|
6675
|
-
boxShadow: "none",
|
|
6676
|
-
backgroundColor: "transparent",
|
|
6677
|
-
fontSize: "inherit",
|
|
6678
|
-
display: "flex",
|
|
6679
|
-
flexDirection: "column",
|
|
6680
|
-
gap: 1
|
|
6681
|
-
},
|
|
6682
|
-
"&#mini-console:not(:empty)": { display: "flex" },
|
|
6683
|
-
"&#mini-console:empty": { display: "none" },
|
|
6684
|
-
"& > div": {
|
|
6685
|
-
p: "6px 12px",
|
|
6686
|
-
borderRadius: 1,
|
|
6687
|
-
boxShadow: tema.shadows[3],
|
|
6688
|
-
fontSize: "0.875rem",
|
|
6689
|
-
whiteSpace: "pre-wrap",
|
|
6690
|
-
overflowWrap: "anywhere",
|
|
6691
|
-
backgroundColor: tema.palette.grey[800],
|
|
6692
|
-
color: tema.palette.common.white
|
|
6693
|
-
},
|
|
6694
|
-
"& > .status-error": {
|
|
6695
|
-
backgroundColor: tema.palette.error.main,
|
|
6696
|
-
color: tema.palette.error.contrastText
|
|
6697
|
-
}
|
|
6698
|
-
})
|
|
6699
|
-
}
|
|
6700
|
-
);
|
|
6701
|
-
};
|
|
6912
|
+
var import_react41 = require("react");
|
|
6913
|
+
var import_react_router_dom15 = require("react-router-dom");
|
|
6914
|
+
var import_material32 = require("@mui/material");
|
|
6702
6915
|
|
|
6703
6916
|
// src/puente/pantallaDeBP.ts
|
|
6704
6917
|
var RUTA_PANTALLA_BP = "/bp/menu";
|
|
@@ -6718,6 +6931,12 @@ function rutaDeEnlaceBP(href, baseDelDocumento, urlBackend) {
|
|
|
6718
6931
|
const nombre = new URLSearchParams(texto).get("w");
|
|
6719
6932
|
return nombre ? rutaDePantallaBP(nombre, texto) : null;
|
|
6720
6933
|
}
|
|
6934
|
+
function rutaDeHashDeBP(href, baseDelDocumento) {
|
|
6935
|
+
const enlace = new URL(href, baseDelDocumento);
|
|
6936
|
+
if (enlace.origin !== new URL(baseDelDocumento).origin) return null;
|
|
6937
|
+
const nombre = new URLSearchParams(enlace.hash.slice(1)).get("w");
|
|
6938
|
+
return nombre ? rutaDePantallaBP(nombre, enlace.hash) : null;
|
|
6939
|
+
}
|
|
6721
6940
|
function resolverPantallaBP(myOwn, nombre, contenedor) {
|
|
6722
6941
|
const registrada = myOwn.wScreens[nombre];
|
|
6723
6942
|
if (!registrada) return null;
|
|
@@ -6740,7 +6959,7 @@ function resolverPantallaBP(myOwn, nombre, contenedor) {
|
|
|
6740
6959
|
}
|
|
6741
6960
|
|
|
6742
6961
|
// src/puente/PantallaBP.tsx
|
|
6743
|
-
var
|
|
6962
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
6744
6963
|
function buscarItemDeMenu(items, tipo) {
|
|
6745
6964
|
for (const item of items) {
|
|
6746
6965
|
if (item.menuType === tipo) return item;
|
|
@@ -6753,12 +6972,12 @@ function buscarItemDeMenu(items, tipo) {
|
|
|
6753
6972
|
}
|
|
6754
6973
|
var PantallaBP = ({ nombre, direccion }) => {
|
|
6755
6974
|
const { clientContext } = useApp();
|
|
6756
|
-
const [cargando, setCargando] = (0,
|
|
6757
|
-
const [error, setError] = (0,
|
|
6758
|
-
const [noExiste, setNoExiste] = (0,
|
|
6759
|
-
const contenedor = (0,
|
|
6975
|
+
const [cargando, setCargando] = (0, import_react41.useState)(true);
|
|
6976
|
+
const [error, setError] = (0, import_react41.useState)(null);
|
|
6977
|
+
const [noExiste, setNoExiste] = (0, import_react41.useState)(false);
|
|
6978
|
+
const contenedor = (0, import_react41.useRef)(null);
|
|
6760
6979
|
const menu = clientContext.menu;
|
|
6761
|
-
(0,
|
|
6980
|
+
(0, import_react41.useEffect)(() => {
|
|
6762
6981
|
const elemento = contenedor.current;
|
|
6763
6982
|
if (!elemento) return;
|
|
6764
6983
|
let vigente = true;
|
|
@@ -6768,6 +6987,7 @@ var PantallaBP = ({ nombre, direccion }) => {
|
|
|
6768
6987
|
cargarClienteBP(envConfig.backendUrl).then((myOwn) => {
|
|
6769
6988
|
if (!vigente) return;
|
|
6770
6989
|
setCargando(false);
|
|
6990
|
+
copiarSkinAlContenedor(elemento);
|
|
6771
6991
|
const pantalla = resolverPantallaBP(myOwn, nombre, elemento);
|
|
6772
6992
|
if (!pantalla) {
|
|
6773
6993
|
setNoExiste(true);
|
|
@@ -6789,82 +7009,36 @@ var PantallaBP = ({ nombre, direccion }) => {
|
|
|
6789
7009
|
elemento.replaceChildren();
|
|
6790
7010
|
};
|
|
6791
7011
|
}, [nombre, direccion, menu]);
|
|
6792
|
-
if (noExiste) return /* @__PURE__ */ (0,
|
|
7012
|
+
if (noExiste) return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FallbackWScreen, { screenName: nombre });
|
|
6793
7013
|
return (
|
|
6794
7014
|
// 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
|
|
6795
|
-
/* @__PURE__ */ (0,
|
|
6796
|
-
cargando && /* @__PURE__ */ (0,
|
|
6797
|
-
error && /* @__PURE__ */ (0,
|
|
6798
|
-
/* @__PURE__ */ (0,
|
|
6799
|
-
/* @__PURE__ */ (0,
|
|
7015
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_material32.Box, { className: CLASE_CONTENEDOR_BP, sx: { position: "relative" }, children: [
|
|
7016
|
+
cargando && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_material32.CircularProgress, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
|
|
7017
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_material32.Alert, { severity: "error", sx: { m: 2 }, children: error }),
|
|
7018
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { id: "main_layout", ref: contenedor }),
|
|
7019
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ConsolaBP, {})
|
|
6800
7020
|
] })
|
|
6801
7021
|
);
|
|
6802
7022
|
};
|
|
6803
7023
|
var PantallaDeRespaldo = () => {
|
|
6804
|
-
const { screenName = "" } = (0,
|
|
6805
|
-
const { search } = (0,
|
|
7024
|
+
const { screenName = "" } = (0, import_react_router_dom15.useParams)();
|
|
7025
|
+
const { search } = (0, import_react_router_dom15.useLocation)();
|
|
6806
7026
|
if (!puenteBPHabilitado()) {
|
|
6807
|
-
return /* @__PURE__ */ (0,
|
|
7027
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_material32.Box, { sx: { p: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FallbackWScreen, { screenName }) });
|
|
6808
7028
|
}
|
|
6809
|
-
return /* @__PURE__ */ (0,
|
|
7029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_router_dom15.Navigate, { to: rutaDePantallaBP(screenName, search), replace: true });
|
|
6810
7030
|
};
|
|
6811
7031
|
var PaginaBP = () => {
|
|
6812
|
-
const { hash, search } = (0,
|
|
7032
|
+
const { hash, search } = (0, import_react_router_dom15.useLocation)();
|
|
6813
7033
|
const direccion = hash || search;
|
|
6814
7034
|
const nombre = new URLSearchParams(direccion.replace(/^[#?]/, "")).get("w");
|
|
6815
|
-
if (!puenteBPHabilitado()) return /* @__PURE__ */ (0,
|
|
6816
|
-
if (!nombre) return /* @__PURE__ */ (0,
|
|
7035
|
+
if (!puenteBPHabilitado()) return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_router_dom15.Navigate, { to: "/", replace: true });
|
|
7036
|
+
if (!nombre) return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_material32.Box, { sx: { p: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_material32.Alert, { severity: "warning", children: [
|
|
6817
7037
|
"Falta la pantalla de backend-plus (",
|
|
6818
|
-
/* @__PURE__ */ (0,
|
|
7038
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("code", { children: "#w=..." }),
|
|
6819
7039
|
")."
|
|
6820
7040
|
] }) });
|
|
6821
|
-
return /* @__PURE__ */ (0,
|
|
6822
|
-
};
|
|
6823
|
-
|
|
6824
|
-
// src/puente/GrillaBP.tsx
|
|
6825
|
-
var import_react41 = require("react");
|
|
6826
|
-
var import_react_router_dom15 = require("react-router-dom");
|
|
6827
|
-
var import_material32 = require("@mui/material");
|
|
6828
|
-
var import_jsx_runtime39 = (
|
|
6829
|
-
// 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
|
|
6830
|
-
require("react/jsx-runtime")
|
|
6831
|
-
);
|
|
6832
|
-
var GrillaBP = ({ tabla, fixedFields }) => {
|
|
6833
|
-
const contenedor = (0, import_react41.useRef)(null);
|
|
6834
|
-
const [cargando, setCargando] = (0, import_react41.useState)(true);
|
|
6835
|
-
const [error, setError] = (0, import_react41.useState)(null);
|
|
6836
|
-
const clave = JSON.stringify(fixedFields ?? []);
|
|
6837
|
-
(0, import_react41.useEffect)(() => {
|
|
6838
|
-
const elemento = contenedor.current;
|
|
6839
|
-
if (!elemento) return;
|
|
6840
|
-
let vigente = true;
|
|
6841
|
-
setError(null);
|
|
6842
|
-
setCargando(true);
|
|
6843
|
-
cargarClienteBP(envConfig.backendUrl).then((myOwn) => {
|
|
6844
|
-
if (!vigente) return;
|
|
6845
|
-
setCargando(false);
|
|
6846
|
-
elemento.replaceChildren();
|
|
6847
|
-
myOwn.tableGrid(tabla, elemento, { fixedFields: JSON.parse(clave) });
|
|
6848
|
-
}).catch((err) => {
|
|
6849
|
-
if (!vigente) return;
|
|
6850
|
-
setCargando(false);
|
|
6851
|
-
setError(mensajeDeError(err));
|
|
6852
|
-
});
|
|
6853
|
-
return () => {
|
|
6854
|
-
vigente = false;
|
|
6855
|
-
elemento.replaceChildren();
|
|
6856
|
-
};
|
|
6857
|
-
}, [tabla, clave]);
|
|
6858
|
-
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_material32.Box, { sx: { position: "relative" }, children: [
|
|
6859
|
-
cargando && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material32.CircularProgress, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
|
|
6860
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material32.Alert, { severity: "error", sx: { m: 2 }, children: error }),
|
|
6861
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { ref: contenedor }),
|
|
6862
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ConsolaBP, {})
|
|
6863
|
-
] });
|
|
6864
|
-
};
|
|
6865
|
-
var PaginaGrillaBP = () => {
|
|
6866
|
-
const { tableName = "" } = (0, import_react_router_dom15.useParams)();
|
|
6867
|
-
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(GrillaBP, { tabla: tableName }, tableName);
|
|
7041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PantallaBP, { nombre, direccion }, nombre);
|
|
6868
7042
|
};
|
|
6869
7043
|
|
|
6870
7044
|
// src/puente/CapturaBP.tsx
|
|
@@ -6905,8 +7079,16 @@ function capturarNavegacionBP(urlBackend, navegar) {
|
|
|
6905
7079
|
reemplazarOriginal.call(history, estado, titulo, ruta === null ? url : rutaBase + ruta);
|
|
6906
7080
|
};
|
|
6907
7081
|
history.replaceState = reemplazar;
|
|
7082
|
+
const abrirOriginal = window.open;
|
|
7083
|
+
const abrir = (url, destino, caracteristicas) => {
|
|
7084
|
+
const direccion = url === void 0 || url === null ? null : String(url);
|
|
7085
|
+
const ruta = direccion === null ? null : rutaDeEnlaceBP(direccion, document.baseURI, urlBackend) ?? rutaDeHashDeBP(direccion, document.baseURI);
|
|
7086
|
+
return abrirOriginal.call(window, ruta === null ? url : window.location.origin + rutaBase + ruta, destino, caracteristicas);
|
|
7087
|
+
};
|
|
7088
|
+
window.open = abrir;
|
|
6908
7089
|
return () => {
|
|
6909
7090
|
if (history.replaceState === reemplazar) history.replaceState = reemplazarOriginal;
|
|
7091
|
+
if (window.open === abrir) window.open = abrirOriginal;
|
|
6910
7092
|
document.removeEventListener("click", alHacerClick, true);
|
|
6911
7093
|
navegacion?.removeEventListener("navigate", alNavegar);
|
|
6912
7094
|
};
|
|
@@ -6934,7 +7116,7 @@ function resultadoDeCambioDeClave(urlFinal, html) {
|
|
|
6934
7116
|
}
|
|
6935
7117
|
|
|
6936
7118
|
// src/pages/CambiarClavePage.tsx
|
|
6937
|
-
var
|
|
7119
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
6938
7120
|
var CambiarClavePage = () => {
|
|
6939
7121
|
const { clientContext, setIsLoggedIn, avisarCierreVoluntario } = useApp();
|
|
6940
7122
|
const dispatch = (0, import_react_redux5.useDispatch)();
|
|
@@ -6975,10 +7157,10 @@ var CambiarClavePage = () => {
|
|
|
6975
7157
|
setEnviando(false);
|
|
6976
7158
|
}
|
|
6977
7159
|
};
|
|
6978
|
-
return /* @__PURE__ */ (0,
|
|
6979
|
-
/* @__PURE__ */ (0,
|
|
6980
|
-
/* @__PURE__ */ (0,
|
|
6981
|
-
/* @__PURE__ */ (0,
|
|
7160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_material33.Box, { sx: { p: 3, display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_material33.Box, { component: "form", onSubmit: enviar, sx: { width: "100%", maxWidth: 420 }, children: [
|
|
7161
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_material33.Typography, { variant: "h5", gutterBottom: true, children: "Cambiar contrase\xF1a" }),
|
|
7162
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_material33.TextField, { label: "Usuario", value: clientContext?.username ?? "", fullWidth: true, margin: "normal", disabled: true, autoComplete: "username" }),
|
|
7163
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6982
7164
|
import_material33.TextField,
|
|
6983
7165
|
{
|
|
6984
7166
|
label: "Contrase\xF1a actual",
|
|
@@ -6993,7 +7175,7 @@ var CambiarClavePage = () => {
|
|
|
6993
7175
|
disabled: enviando
|
|
6994
7176
|
}
|
|
6995
7177
|
),
|
|
6996
|
-
/* @__PURE__ */ (0,
|
|
7178
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6997
7179
|
import_material33.TextField,
|
|
6998
7180
|
{
|
|
6999
7181
|
label: "Contrase\xF1a nueva",
|
|
@@ -7007,7 +7189,7 @@ var CambiarClavePage = () => {
|
|
|
7007
7189
|
disabled: enviando
|
|
7008
7190
|
}
|
|
7009
7191
|
),
|
|
7010
|
-
/* @__PURE__ */ (0,
|
|
7192
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7011
7193
|
import_material33.TextField,
|
|
7012
7194
|
{
|
|
7013
7195
|
label: "Repetir contrase\xF1a nueva",
|
|
@@ -7021,19 +7203,19 @@ var CambiarClavePage = () => {
|
|
|
7021
7203
|
disabled: enviando
|
|
7022
7204
|
}
|
|
7023
7205
|
),
|
|
7024
|
-
error && /* @__PURE__ */ (0,
|
|
7025
|
-
/* @__PURE__ */ (0,
|
|
7026
|
-
/* @__PURE__ */ (0,
|
|
7027
|
-
/* @__PURE__ */ (0,
|
|
7206
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_material33.Alert, { severity: "error", sx: { mt: 1, whiteSpace: "pre-line" }, children: error }),
|
|
7207
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_material33.Box, { sx: { display: "flex", gap: 1, justifyContent: "flex-end", mt: 2 }, children: [
|
|
7208
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_material33.Button, { onClick: () => navigate(-1), disabled: enviando, children: "Cancelar" }),
|
|
7209
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_material33.Button, { type: "submit", variant: "contained", disabled: enviando, children: enviando ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_material33.CircularProgress, { size: 20 }) : "Cambiar contrase\xF1a" })
|
|
7028
7210
|
] }),
|
|
7029
|
-
/* @__PURE__ */ (0,
|
|
7211
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_material33.Typography, { 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." })
|
|
7030
7212
|
] }) });
|
|
7031
7213
|
};
|
|
7032
7214
|
var CambiarClavePage_default = CambiarClavePage;
|
|
7033
7215
|
|
|
7034
7216
|
// src/App.tsx
|
|
7035
7217
|
var import_type_store6 = __toESM(require("type-store"), 1);
|
|
7036
|
-
var
|
|
7218
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
7037
7219
|
var LocationTracker = () => {
|
|
7038
7220
|
const location = (0, import_react_router_dom18.useLocation)();
|
|
7039
7221
|
const dispatch = useAppDispatch();
|
|
@@ -7043,46 +7225,46 @@ var LocationTracker = () => {
|
|
|
7043
7225
|
return null;
|
|
7044
7226
|
};
|
|
7045
7227
|
function FrontendPlusReactRoutes({ myRoutes, myUnloggedRoutes, layout: Layout = MainLayout_default, unloggedLayout: UnloggedLayout }) {
|
|
7046
|
-
return /* @__PURE__ */ (0,
|
|
7047
|
-
/* @__PURE__ */ (0,
|
|
7048
|
-
puenteBPHabilitado() && /* @__PURE__ */ (0,
|
|
7049
|
-
/* @__PURE__ */ (0,
|
|
7050
|
-
/* @__PURE__ */ (0,
|
|
7051
|
-
/* @__PURE__ */ (0,
|
|
7052
|
-
/* @__PURE__ */ (0,
|
|
7228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
7229
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(InitialRedirectHandler_default, {}),
|
|
7230
|
+
puenteBPHabilitado() && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CapturaBP, {}),
|
|
7231
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react_router_dom18.Routes, { children: [
|
|
7232
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react_router_dom18.Route, { element: UnloggedLayout ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(UnloggedLayout, {}) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_router_dom18.Outlet, {}), children: [
|
|
7233
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_router_dom18.Route, { path: "/login", element: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(LoginPage_default, {}) }),
|
|
7234
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_router_dom18.Route, { path: "/logout", element: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(LogoutPage_default, {}) }),
|
|
7053
7235
|
myUnloggedRoutes
|
|
7054
7236
|
] }),
|
|
7055
|
-
/* @__PURE__ */ (0,
|
|
7056
|
-
/* @__PURE__ */ (0,
|
|
7057
|
-
/* @__PURE__ */ (0,
|
|
7058
|
-
/* @__PURE__ */ (0,
|
|
7059
|
-
/* @__PURE__ */ (0,
|
|
7060
|
-
/* @__PURE__ */ (0,
|
|
7061
|
-
Object.keys(wScreens).map((screenName) => /* @__PURE__ */ (0,
|
|
7237
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react_router_dom18.Route, { element: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PrivateRoute_default, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Layout, {}) }), children: [
|
|
7238
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_router_dom18.Route, { path: "/", element: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PantallaInicial_default, {}) }),
|
|
7239
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_router_dom18.Route, { path: "/table/:tableName", element: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(GenericDataGridPage_default, {}) }),
|
|
7240
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_router_dom18.Route, { path: "/menu/*", element: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MenuTablePage_default, {}) }),
|
|
7241
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_router_dom18.Route, { path: "/procedures/:procedureName", element: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ProcedureForm_default, {}) }),
|
|
7242
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_router_dom18.Route, { path: "/chpass", element: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CambiarClavePage_default, {}) }),
|
|
7243
|
+
Object.keys(wScreens).map((screenName) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7062
7244
|
import_react_router_dom18.Route,
|
|
7063
7245
|
{
|
|
7064
7246
|
path: `/wScreens/${screenName}`,
|
|
7065
|
-
element: /* @__PURE__ */ (0,
|
|
7247
|
+
element: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PantallaDeRuta, { screenName })
|
|
7066
7248
|
},
|
|
7067
7249
|
screenName
|
|
7068
7250
|
)),
|
|
7069
|
-
/* @__PURE__ */ (0,
|
|
7070
|
-
puenteBPHabilitado() && /* @__PURE__ */ (0,
|
|
7071
|
-
puenteBPHabilitado() && /* @__PURE__ */ (0,
|
|
7251
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_router_dom18.Route, { path: "/wScreens-fallback/:screenName", element: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PantallaDeRespaldo, {}) }),
|
|
7252
|
+
puenteBPHabilitado() && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_router_dom18.Route, { path: "/bp/menu", element: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PaginaBP, {}) }),
|
|
7253
|
+
puenteBPHabilitado() && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_router_dom18.Route, { path: "/bp/table/:tableName", element: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PaginaGrillaBP, {}) }),
|
|
7072
7254
|
myRoutes,
|
|
7073
|
-
/* @__PURE__ */ (0,
|
|
7255
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_router_dom18.Route, { path: "*", element: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { style: { marginTop: "20px", marginLeft: "10px" }, children: "404 - Recurso No Encontrado" }) })
|
|
7074
7256
|
] }),
|
|
7075
|
-
/* @__PURE__ */ (0,
|
|
7257
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_router_dom18.Route, { path: "*", element: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_router_dom18.Navigate, { to: "/", replace: true }) })
|
|
7076
7258
|
] })
|
|
7077
7259
|
] });
|
|
7078
7260
|
}
|
|
7079
7261
|
var FrontendPlusProviders = ({ children, publicPaths }) => {
|
|
7080
|
-
return /* @__PURE__ */ (0,
|
|
7081
|
-
/* @__PURE__ */ (0,
|
|
7262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_redux6.Provider, { store, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react45.PersistGate, { loading: null, persistor, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react_router_dom18.BrowserRouter, { basename: rutaBase, children: [
|
|
7263
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(LocationTracker, {}),
|
|
7082
7264
|
" ",
|
|
7083
|
-
/* @__PURE__ */ (0,
|
|
7265
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AppProvider, { publicPaths, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(SnackbarProvider, { children: [
|
|
7084
7266
|
children,
|
|
7085
|
-
/* @__PURE__ */ (0,
|
|
7267
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SessionExpiredMessage_default, {})
|
|
7086
7268
|
] }) })
|
|
7087
7269
|
] }) }) });
|
|
7088
7270
|
};
|
|
@@ -7128,7 +7310,7 @@ var App = ({
|
|
|
7128
7310
|
const extracted = extractPathsFromRoutes(myUnloggedRoutes);
|
|
7129
7311
|
return ["/login", "/logout", ...extracted];
|
|
7130
7312
|
}, [myUnloggedRoutes]);
|
|
7131
|
-
return /* @__PURE__ */ (0,
|
|
7313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(FrontendPlusProviders, { publicPaths: safePaths, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7132
7314
|
FrontendPlusReactRoutes,
|
|
7133
7315
|
{
|
|
7134
7316
|
myRoutes,
|