frontend-plus-react 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +5 -2
- package/dist/index.cjs +1153 -967
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +14 -4
- package/dist/index.css.map +1 -1
- package/dist/index.js +1060 -874
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.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");
|
|
@@ -1441,8 +1441,12 @@ function BotonDetalle({ row, rowId, detailTable, deshabilitado }) {
|
|
|
1441
1441
|
import_material3.IconButton,
|
|
1442
1442
|
{
|
|
1443
1443
|
size: "small",
|
|
1444
|
+
sx: { width: 24, height: 24, p: 0 },
|
|
1444
1445
|
disabled: deshabilitado,
|
|
1445
1446
|
onClick: (e) => alternarDetalle(row, rowId, detailTable, e.ctrlKey || e.metaKey),
|
|
1447
|
+
onMouseDown: (e) => {
|
|
1448
|
+
if (e.button === 1) e.preventDefault();
|
|
1449
|
+
},
|
|
1446
1450
|
onAuxClick: (e) => {
|
|
1447
1451
|
if (e.button === 1) alternarDetalle(row, rowId, detailTable, true);
|
|
1448
1452
|
},
|
|
@@ -1624,6 +1628,112 @@ var textoParaVer = (valor) => {
|
|
|
1624
1628
|
return String(valor);
|
|
1625
1629
|
};
|
|
1626
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
|
+
|
|
1627
1737
|
// src/hooks/grid/useGridEvents.ts
|
|
1628
1738
|
var VIGENCIA_TECLA_PENDIENTE = 400;
|
|
1629
1739
|
var VIGENCIA_VALOR_PENDIENTE_F4 = 1e3;
|
|
@@ -1654,7 +1764,7 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1654
1764
|
const currentColumnIndex = currentColumns.findIndex((col) => col.key === columnKey);
|
|
1655
1765
|
const editableColumns = currentColumns.filter((col) => {
|
|
1656
1766
|
const fieldDefinition = tableDefinition2.fields.find((f) => f.name === col.key);
|
|
1657
|
-
return col.key !== "actionsColumn" && !(esColumnaPropia(col) && col.customType === "detail") && (fieldDefinition
|
|
1767
|
+
return col.key !== "actionsColumn" && !(esColumnaPropia(col) && col.customType === "detail") && campoEditableEnCelda(fieldDefinition);
|
|
1658
1768
|
});
|
|
1659
1769
|
const { key, target } = event;
|
|
1660
1770
|
const teclaAnterior = teclaAnteriorRef.current;
|
|
@@ -1785,7 +1895,7 @@ var useGridEvents = ({ dataGridRef, tableDefinition, filteredRows, tableData, fi
|
|
|
1785
1895
|
if (esFilaDetalle(args.row)) return;
|
|
1786
1896
|
const fieldDefinition = tableDefinition?.fields.find((f) => f.name === args.column.key);
|
|
1787
1897
|
const isFixedField = valorFijoDe(fixedFields, args.column.key) !== void 0;
|
|
1788
|
-
const isEditable = fieldDefinition
|
|
1898
|
+
const isEditable = campoEditableEnCelda(fieldDefinition) && !isFixedField;
|
|
1789
1899
|
if (isEditable) {
|
|
1790
1900
|
args.selectCell(true);
|
|
1791
1901
|
} else if (fieldDefinition && tipoDeExpander(fieldDefinition, false) !== null) {
|
|
@@ -1970,7 +2080,7 @@ var JSON4all2 = __toESM(require("json4all"), 1);
|
|
|
1970
2080
|
var cambiarGuionesBajosPorEspacios = (texto) => texto.replace(/_/g, " ");
|
|
1971
2081
|
|
|
1972
2082
|
// src/components/grid/renderers/headerCellRenderers.tsx
|
|
1973
|
-
var
|
|
2083
|
+
var import_material6 = require("@mui/material");
|
|
1974
2084
|
var import_Search = __toESM(require("@mui/icons-material/Search"), 1);
|
|
1975
2085
|
var import_SearchOff = __toESM(require("@mui/icons-material/SearchOff"), 1);
|
|
1976
2086
|
var import_MoreVert = __toESM(require("@mui/icons-material/MoreVert"), 1);
|
|
@@ -2028,7 +2138,7 @@ var VistaGrillaContext = (0, import_react11.createContext)({ isFilterRowVisible:
|
|
|
2028
2138
|
var useVistaGrilla = () => (0, import_react11.useContext)(VistaGrillaContext);
|
|
2029
2139
|
|
|
2030
2140
|
// src/components/grid/renderers/headerCellRenderers.tsx
|
|
2031
|
-
var
|
|
2141
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2032
2142
|
var defaultColumnHeaderCellRenderer = (props, fieldDef, ocultarColumna) => {
|
|
2033
2143
|
const { column, sortDirection, priority } = props;
|
|
2034
2144
|
const isPrimaryKey = fieldDef.isPk;
|
|
@@ -2041,8 +2151,8 @@ var defaultColumnHeaderCellRenderer = (props, fieldDef, ocultarColumna) => {
|
|
|
2041
2151
|
return "#AAAAAA";
|
|
2042
2152
|
};
|
|
2043
2153
|
const sortColor = sorted ? getSortColor(sortIndex) : "transparent";
|
|
2044
|
-
return /* @__PURE__ */ (0,
|
|
2045
|
-
|
|
2154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2155
|
+
import_material6.Box,
|
|
2046
2156
|
{
|
|
2047
2157
|
onClickCapture: (e) => {
|
|
2048
2158
|
if (!e.altKey || !ocultarColumna) return;
|
|
@@ -2059,8 +2169,8 @@ var defaultColumnHeaderCellRenderer = (props, fieldDef, ocultarColumna) => {
|
|
|
2059
2169
|
width: "100%"
|
|
2060
2170
|
},
|
|
2061
2171
|
children: [
|
|
2062
|
-
/* @__PURE__ */ (0,
|
|
2063
|
-
|
|
2172
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2173
|
+
import_material6.Typography,
|
|
2064
2174
|
{
|
|
2065
2175
|
variant: "body2",
|
|
2066
2176
|
sx: {
|
|
@@ -2077,7 +2187,7 @@ var defaultColumnHeaderCellRenderer = (props, fieldDef, ocultarColumna) => {
|
|
|
2077
2187
|
children: column.name
|
|
2078
2188
|
}
|
|
2079
2189
|
),
|
|
2080
|
-
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" })
|
|
2081
2191
|
]
|
|
2082
2192
|
}
|
|
2083
2193
|
);
|
|
@@ -2089,48 +2199,48 @@ var ActionsColumnHeaderCell = ({
|
|
|
2089
2199
|
allowInsert
|
|
2090
2200
|
}) => {
|
|
2091
2201
|
const { isFilterRowVisible } = useVistaGrilla();
|
|
2092
|
-
return /* @__PURE__ */ (0,
|
|
2093
|
-
allowInsert && /* @__PURE__ */ (0,
|
|
2094
|
-
|
|
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,
|
|
2095
2205
|
{
|
|
2096
2206
|
onClick: () => handleAddRow(),
|
|
2097
2207
|
size: "small",
|
|
2098
2208
|
title: "A\xF1adir registro",
|
|
2099
2209
|
sx: { p: 0.25, color: "grey.800", "&:hover": { color: "success.main" } },
|
|
2100
|
-
children: /* @__PURE__ */ (0,
|
|
2210
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_Add.default, { sx: { fontSize: 18 } })
|
|
2101
2211
|
}
|
|
2102
2212
|
),
|
|
2103
|
-
/* @__PURE__ */ (0,
|
|
2104
|
-
|
|
2213
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2214
|
+
import_material6.IconButton,
|
|
2105
2215
|
{
|
|
2106
2216
|
onClick: toggleFilterVisibility,
|
|
2107
2217
|
size: "small",
|
|
2108
2218
|
title: isFilterRowVisible ? "Ocultar filtros" : "Mostrar filtros",
|
|
2109
2219
|
sx: { p: 0.25, color: "grey.800" },
|
|
2110
|
-
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 } })
|
|
2111
2221
|
}
|
|
2112
2222
|
),
|
|
2113
|
-
/* @__PURE__ */ (0,
|
|
2114
|
-
|
|
2223
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2224
|
+
import_material6.IconButton,
|
|
2115
2225
|
{
|
|
2116
2226
|
onClick: (event) => handleDataGridOptions(event),
|
|
2117
2227
|
size: "small",
|
|
2118
2228
|
title: "Opciones de esta tabla",
|
|
2119
2229
|
sx: { p: 0.25, color: "grey.800" },
|
|
2120
|
-
children: /* @__PURE__ */ (0,
|
|
2230
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_MoreVert.default, { sx: { fontSize: 20, variant: "filled", size: "small" } })
|
|
2121
2231
|
}
|
|
2122
2232
|
)
|
|
2123
2233
|
] });
|
|
2124
2234
|
};
|
|
2125
|
-
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() }) }) });
|
|
2126
2236
|
|
|
2127
2237
|
// src/components/grid/FilterInputRender.tsx
|
|
2128
|
-
var
|
|
2238
|
+
var import_material11 = require("@mui/material");
|
|
2129
2239
|
var import_react18 = __toESM(require("react"), 1);
|
|
2130
2240
|
|
|
2131
2241
|
// src/components/forms/TypedField.tsx
|
|
2132
2242
|
var import_react16 = require("react");
|
|
2133
|
-
var
|
|
2243
|
+
var import_material10 = require("@mui/material");
|
|
2134
2244
|
var import_type_store3 = __toESM(require("type-store"), 1);
|
|
2135
2245
|
var import_react17 = require("react");
|
|
2136
2246
|
|
|
@@ -2143,8 +2253,8 @@ var import_Search2 = __toESM(require("@mui/icons-material/Search"), 1);
|
|
|
2143
2253
|
|
|
2144
2254
|
// src/components/grid/MenuDeOpciones.tsx
|
|
2145
2255
|
var import_react12 = require("react");
|
|
2146
|
-
var
|
|
2147
|
-
var
|
|
2256
|
+
var import_material7 = require("@mui/material");
|
|
2257
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2148
2258
|
function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar }) {
|
|
2149
2259
|
const [busqueda, setBusqueda] = (0, import_react12.useState)(busquedaInicial);
|
|
2150
2260
|
const [indice, setIndice] = (0, import_react12.useState)(0);
|
|
@@ -2168,8 +2278,8 @@ function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar
|
|
|
2168
2278
|
evento.preventDefault();
|
|
2169
2279
|
evento.stopPropagation();
|
|
2170
2280
|
};
|
|
2171
|
-
return /* @__PURE__ */ (0,
|
|
2172
|
-
|
|
2281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2282
|
+
import_material7.Popover,
|
|
2173
2283
|
{
|
|
2174
2284
|
open: true,
|
|
2175
2285
|
anchorEl: anclaje,
|
|
@@ -2178,8 +2288,8 @@ function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar
|
|
|
2178
2288
|
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
2179
2289
|
slotProps: { paper: { sx: { minWidth: 300, maxWidth: 520 } } },
|
|
2180
2290
|
children: [
|
|
2181
|
-
/* @__PURE__ */ (0,
|
|
2182
|
-
|
|
2291
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2292
|
+
import_material7.InputBase,
|
|
2183
2293
|
{
|
|
2184
2294
|
autoFocus: true,
|
|
2185
2295
|
fullWidth: true,
|
|
@@ -2194,17 +2304,17 @@ function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar
|
|
|
2194
2304
|
inputProps: { "aria-label": "buscar" }
|
|
2195
2305
|
}
|
|
2196
2306
|
),
|
|
2197
|
-
/* @__PURE__ */ (0,
|
|
2198
|
-
visibles.length === 0 && /* @__PURE__ */ (0,
|
|
2199
|
-
visibles.map((opcion, i) => /* @__PURE__ */ (0,
|
|
2200
|
-
|
|
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,
|
|
2201
2311
|
{
|
|
2202
2312
|
ref: i === indice ? elegida : null,
|
|
2203
2313
|
selected: i === indice,
|
|
2204
2314
|
role: "option",
|
|
2205
2315
|
onClick: () => onElegir(opcion.valor),
|
|
2206
2316
|
sx: { gap: 2, py: 0.25, fontSize: "0.8rem" },
|
|
2207
|
-
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))
|
|
2208
2318
|
},
|
|
2209
2319
|
i
|
|
2210
2320
|
))
|
|
@@ -2216,8 +2326,8 @@ function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar
|
|
|
2216
2326
|
|
|
2217
2327
|
// src/components/grid/SelectorDeFecha.tsx
|
|
2218
2328
|
var import_react13 = require("react");
|
|
2219
|
-
var
|
|
2220
|
-
var
|
|
2329
|
+
var import_material8 = require("@mui/material");
|
|
2330
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2221
2331
|
var MESES = ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"];
|
|
2222
2332
|
var DIAS = ["lu", "ma", "mi", "ju", "vi", "s\xE1", "do"];
|
|
2223
2333
|
var mismaFecha = (a, b) => b !== null && a.anio === b.anio && a.mes === b.mes && a.dia === b.dia;
|
|
@@ -2250,22 +2360,22 @@ function SelectorDeFecha({ anclaje, fechaActual, admiteNulo, onElegir, onCerrar
|
|
|
2250
2360
|
evento.preventDefault();
|
|
2251
2361
|
evento.stopPropagation();
|
|
2252
2362
|
};
|
|
2253
|
-
return /* @__PURE__ */ (0,
|
|
2254
|
-
/* @__PURE__ */ (0,
|
|
2255
|
-
/* @__PURE__ */ (0,
|
|
2256
|
-
/* @__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: [
|
|
2257
2367
|
MESES[cursor.mes],
|
|
2258
2368
|
" ",
|
|
2259
2369
|
cursor.anio
|
|
2260
2370
|
] }),
|
|
2261
|
-
/* @__PURE__ */ (0,
|
|
2371
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material8.IconButton, { size: "small", "aria-label": "mes siguiente", onClick: () => mover(0, 1), children: "\u203A" })
|
|
2262
2372
|
] }),
|
|
2263
|
-
/* @__PURE__ */ (0,
|
|
2264
|
-
/* @__PURE__ */ (0,
|
|
2265
|
-
/* @__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) => {
|
|
2266
2376
|
const elegido = mismaFecha(dia, fechaActual);
|
|
2267
2377
|
const enCursor = mismaFecha(dia, cursor);
|
|
2268
|
-
return /* @__PURE__ */ (0,
|
|
2378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("td", { style: { padding: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2269
2379
|
"button",
|
|
2270
2380
|
{
|
|
2271
2381
|
type: "button",
|
|
@@ -2285,17 +2395,17 @@ function SelectorDeFecha({ anclaje, fechaActual, admiteNulo, onElegir, onCerrar
|
|
|
2285
2395
|
) }, `${dia.mes}-${dia.dia}`);
|
|
2286
2396
|
}) }, i)) })
|
|
2287
2397
|
] }),
|
|
2288
|
-
/* @__PURE__ */ (0,
|
|
2289
|
-
/* @__PURE__ */ (0,
|
|
2290
|
-
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" })
|
|
2291
2401
|
] })
|
|
2292
2402
|
] }) });
|
|
2293
2403
|
}
|
|
2294
2404
|
|
|
2295
2405
|
// src/components/grid/VentanaDeTexto.tsx
|
|
2296
2406
|
var import_react14 = require("react");
|
|
2297
|
-
var
|
|
2298
|
-
var
|
|
2407
|
+
var import_material9 = require("@mui/material");
|
|
2408
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2299
2409
|
function VentanaDeTexto({ anclaje, texto, editable, onAceptar, onCerrar }) {
|
|
2300
2410
|
const [valor, setValor] = (0, import_react14.useState)(texto);
|
|
2301
2411
|
const alApretar = (evento) => {
|
|
@@ -2309,9 +2419,9 @@ function VentanaDeTexto({ anclaje, texto, editable, onAceptar, onCerrar }) {
|
|
|
2309
2419
|
evento.preventDefault();
|
|
2310
2420
|
evento.stopPropagation();
|
|
2311
2421
|
};
|
|
2312
|
-
return /* @__PURE__ */ (0,
|
|
2313
|
-
/* @__PURE__ */ (0,
|
|
2314
|
-
|
|
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,
|
|
2315
2425
|
{
|
|
2316
2426
|
autoFocus: true,
|
|
2317
2427
|
multiline: true,
|
|
@@ -2326,15 +2436,15 @@ function VentanaDeTexto({ anclaje, texto, editable, onAceptar, onCerrar }) {
|
|
|
2326
2436
|
inputProps: { "aria-label": "contenido de la celda" }
|
|
2327
2437
|
}
|
|
2328
2438
|
),
|
|
2329
|
-
editable && /* @__PURE__ */ (0,
|
|
2330
|
-
/* @__PURE__ */ (0,
|
|
2331
|
-
/* @__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" })
|
|
2332
2442
|
] })
|
|
2333
2443
|
] }) });
|
|
2334
2444
|
}
|
|
2335
2445
|
|
|
2336
2446
|
// src/hooks/grid/useExpander.tsx
|
|
2337
|
-
var
|
|
2447
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2338
2448
|
var useExpander = ({ campo, editable, fila, admiteNulo, tipos, anclaje, textoActual, valorActual, alElegirValor, alConfirmarTexto, alFallar }) => {
|
|
2339
2449
|
const [expansion, setExpansion] = (0, import_react15.useState)(null);
|
|
2340
2450
|
const abierto = import_react15.default.useRef(false);
|
|
@@ -2380,7 +2490,7 @@ var useExpander = ({ campo, editable, fila, admiteNulo, tipos, anclaje, textoAct
|
|
|
2380
2490
|
return true;
|
|
2381
2491
|
}, [tipo, abrir]);
|
|
2382
2492
|
const titulo = tipo === "fecha" ? "elegir fecha (F9)" : tipo === "texto" ? "ver el contenido completo (F9)" : "elegir un valor (F9)";
|
|
2383
|
-
const lupa = tipo === null ? null : /* @__PURE__ */ (0,
|
|
2493
|
+
const lupa = tipo === null ? null : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2384
2494
|
import_IconButton.default,
|
|
2385
2495
|
{
|
|
2386
2496
|
size: "small",
|
|
@@ -2393,18 +2503,18 @@ var useExpander = ({ campo, editable, fila, admiteNulo, tipos, anclaje, textoAct
|
|
|
2393
2503
|
void abrir("");
|
|
2394
2504
|
},
|
|
2395
2505
|
sx: { p: 0, ml: 0.25, color: "primary.main", "&:hover": { backgroundColor: "action.hover" } },
|
|
2396
|
-
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 } })
|
|
2397
2507
|
}
|
|
2398
2508
|
);
|
|
2399
2509
|
const base = anclaje.current;
|
|
2400
|
-
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 });
|
|
2401
2511
|
return { tipo, abierto, abrir, manejarTecla, lupa, ventana };
|
|
2402
2512
|
};
|
|
2403
2513
|
|
|
2404
2514
|
// src/components/forms/TypedField.tsx
|
|
2405
|
-
var
|
|
2515
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2406
2516
|
var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode = false, feedback, isMandatory = false }) => {
|
|
2407
|
-
const theme = (0,
|
|
2517
|
+
const theme = (0, import_material10.useTheme)();
|
|
2408
2518
|
const typer = (0, import_react16.useMemo)(() => import_type_store3.default.typerFrom(fieldDef), [fieldDef]);
|
|
2409
2519
|
const isBoolean = fieldDef.typeName === "boolean" && !isFilterMode;
|
|
2410
2520
|
const [localString, setLocalString] = (0, import_react16.useState)(() => {
|
|
@@ -2530,28 +2640,28 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2530
2640
|
}
|
|
2531
2641
|
const cellBackgroundColor2 = feedback === "error" ? theme.palette.error.light : feedback === "success" ? theme.palette.success.light : defaultBgColor;
|
|
2532
2642
|
const transitionStyle2 = "background-color 0.3s ease-in-out";
|
|
2533
|
-
return /* @__PURE__ */ (0,
|
|
2534
|
-
!isFilterMode && /* @__PURE__ */ (0,
|
|
2535
|
-
/* @__PURE__ */ (0,
|
|
2536
|
-
|
|
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,
|
|
2537
2647
|
{
|
|
2538
2648
|
value: boolVal,
|
|
2539
2649
|
label: !isFilterMode ? fieldDef.name : void 0,
|
|
2540
2650
|
onChange: handleBooleanChange,
|
|
2541
|
-
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,
|
|
2542
2652
|
displayEmpty: true,
|
|
2543
2653
|
sx: isFilterMode ? { height: 25, fontSize: "0.8rem", backgroundColor: "background.paper" } : {
|
|
2544
2654
|
backgroundColor: cellBackgroundColor2,
|
|
2545
2655
|
transition: transitionStyle2
|
|
2546
2656
|
},
|
|
2547
2657
|
children: [
|
|
2548
|
-
fieldDef.nullable !== false && /* @__PURE__ */ (0,
|
|
2549
|
-
/* @__PURE__ */ (0,
|
|
2550
|
-
/* @__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)" })
|
|
2551
2661
|
]
|
|
2552
2662
|
}
|
|
2553
2663
|
),
|
|
2554
|
-
errorMsg && !isFilterMode && /* @__PURE__ */ (0,
|
|
2664
|
+
errorMsg && !isFilterMode && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material10.FormHelperText, { children: errorMsg })
|
|
2555
2665
|
] });
|
|
2556
2666
|
}
|
|
2557
2667
|
let inputType = "text";
|
|
@@ -2565,9 +2675,9 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2565
2675
|
}
|
|
2566
2676
|
const cellBackgroundColor = feedback === "error" ? theme.palette.error.light : feedback === "success" ? theme.palette.success.light : defaultTextBgColor;
|
|
2567
2677
|
const transitionStyle = "background-color 0.3s ease-in-out";
|
|
2568
|
-
return /* @__PURE__ */ (0,
|
|
2569
|
-
/* @__PURE__ */ (0,
|
|
2570
|
-
|
|
2678
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
2679
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2680
|
+
import_material10.TextField,
|
|
2571
2681
|
{
|
|
2572
2682
|
fullWidth: true,
|
|
2573
2683
|
inputRef: entradaRef,
|
|
@@ -2586,7 +2696,7 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2586
2696
|
// la lupa solo al enfocar el filtro, como en backend-plus
|
|
2587
2697
|
endAdornment: enfocado || expander.abierto.current ? expander.lupa : void 0
|
|
2588
2698
|
} : isMandatory && isEmptyText ? {
|
|
2589
|
-
startAdornment: /* @__PURE__ */ (0,
|
|
2699
|
+
startAdornment: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material10.InputAdornment, { position: "start", sx: { color: "text.secondary", mr: 0.5 }, children: "*" })
|
|
2590
2700
|
} : {},
|
|
2591
2701
|
inputProps: {
|
|
2592
2702
|
style: {
|
|
@@ -2626,7 +2736,7 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2626
2736
|
};
|
|
2627
2737
|
|
|
2628
2738
|
// src/components/grid/FilterInputRender.tsx
|
|
2629
|
-
var
|
|
2739
|
+
var import_jsx_runtime15 = (
|
|
2630
2740
|
// como en backend-plus, el operador es un símbolo chico y el campo se queda con el resto del ancho
|
|
2631
2741
|
require("react/jsx-runtime")
|
|
2632
2742
|
);
|
|
@@ -2652,8 +2762,8 @@ function FilterInputRenderer({
|
|
|
2652
2762
|
[columnKey]: { operator: newOp, value: formattedVal }
|
|
2653
2763
|
}));
|
|
2654
2764
|
};
|
|
2655
|
-
return /* @__PURE__ */ (0,
|
|
2656
|
-
/* @__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)(
|
|
2657
2767
|
"select",
|
|
2658
2768
|
{
|
|
2659
2769
|
value: operator,
|
|
@@ -2672,10 +2782,10 @@ function FilterInputRenderer({
|
|
|
2672
2782
|
textAlignLast: "center",
|
|
2673
2783
|
cursor: "pointer"
|
|
2674
2784
|
},
|
|
2675
|
-
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))
|
|
2676
2786
|
}
|
|
2677
2787
|
),
|
|
2678
|
-
/* @__PURE__ */ (0,
|
|
2788
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2679
2789
|
TypedField,
|
|
2680
2790
|
{
|
|
2681
2791
|
fieldDef,
|
|
@@ -2686,8 +2796,8 @@ function FilterInputRenderer({
|
|
|
2686
2796
|
)
|
|
2687
2797
|
] });
|
|
2688
2798
|
}
|
|
2689
|
-
return /* @__PURE__ */ (0,
|
|
2690
|
-
|
|
2799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2800
|
+
import_material11.InputBase,
|
|
2691
2801
|
{
|
|
2692
2802
|
value: currentFilter || "",
|
|
2693
2803
|
onChange: (e) => setFilters((prev) => ({
|
|
@@ -2712,15 +2822,15 @@ function FilterInputRenderer({
|
|
|
2712
2822
|
var FilterInputRender_default = import_react18.default.memo(FilterInputRenderer);
|
|
2713
2823
|
|
|
2714
2824
|
// src/components/grid/renderers/summaryCellRenderers.tsx
|
|
2715
|
-
var
|
|
2716
|
-
var
|
|
2825
|
+
var import_material12 = require("@mui/material");
|
|
2826
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2717
2827
|
var defaultColumnSummaryCellRenderer = (props, fixedFields) => {
|
|
2718
2828
|
const { column, row } = props;
|
|
2719
2829
|
if (row.id === "filterRow") {
|
|
2720
2830
|
const { filters, setFilters } = row;
|
|
2721
2831
|
if (valorFijoDe(fixedFields, column.key)) return null;
|
|
2722
2832
|
const fieldDef = esColumnaPropia(column) && column.customType === "default" ? column.fieldDef : void 0;
|
|
2723
|
-
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)(
|
|
2724
2834
|
FilterInputRender_default,
|
|
2725
2835
|
{
|
|
2726
2836
|
columnKey: column.key,
|
|
@@ -2762,7 +2872,7 @@ var defaultColumnSummaryCellRenderer = (props, fixedFields) => {
|
|
|
2762
2872
|
label = "Cant S\xED: ";
|
|
2763
2873
|
break;
|
|
2764
2874
|
}
|
|
2765
|
-
return /* @__PURE__ */ (0,
|
|
2875
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_material12.Box, { sx: {
|
|
2766
2876
|
px: 0,
|
|
2767
2877
|
fontWeight: "bold",
|
|
2768
2878
|
fontSize: "0.875rem",
|
|
@@ -2785,80 +2895,7 @@ var import_material13 = require("@mui/material");
|
|
|
2785
2895
|
var import_ViewHeadline = __toESM(require("@mui/icons-material/ViewHeadline"), 1);
|
|
2786
2896
|
var import_Delete = __toESM(require("@mui/icons-material/Delete"), 1);
|
|
2787
2897
|
var import_Add2 = __toESM(require("@mui/icons-material/Add"), 1);
|
|
2788
|
-
|
|
2789
|
-
// src/components/grid/ExampleClientSideComponent.tsx
|
|
2790
|
-
var import_material11 = require("@mui/material");
|
|
2791
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2792
|
-
var ExampleClientSideComponent = ({ row, column, fieldDefinition }) => {
|
|
2793
|
-
const value = row[column.key];
|
|
2794
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material11.Box, { sx: {
|
|
2795
|
-
padding: 0.5,
|
|
2796
|
-
width: "100%",
|
|
2797
|
-
height: "100%",
|
|
2798
|
-
display: "flex",
|
|
2799
|
-
alignItems: "center",
|
|
2800
|
-
backgroundColor: value === "Special" ? "lightblue" : "transparent"
|
|
2801
|
-
}, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material11.Typography, { variant: "body2", sx: { fontWeight: "bold" }, children: value ? `CS: ${value}` : "N/A" }) });
|
|
2802
|
-
};
|
|
2803
|
-
var ExampleClientSideComponent_default = ExampleClientSideComponent;
|
|
2804
|
-
|
|
2805
|
-
// src/components/grid/FallbackClientSideRenderer.tsx
|
|
2806
|
-
var import_material12 = require("@mui/material");
|
|
2807
|
-
var import_WarningAmber2 = __toESM(require("@mui/icons-material/WarningAmber"), 1);
|
|
2808
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2809
|
-
var FallbackClientSideRenderer = ({ column, row, fieldDefinition }) => {
|
|
2810
|
-
const clientSideName = fieldDefinition?.clientSide || "Desconocido";
|
|
2811
|
-
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)(
|
|
2812
|
-
import_material12.Box,
|
|
2813
|
-
{
|
|
2814
|
-
sx: {
|
|
2815
|
-
display: "flex",
|
|
2816
|
-
alignItems: "center",
|
|
2817
|
-
justifyContent: "space-between",
|
|
2818
|
-
// Para espaciar el valor y el icono
|
|
2819
|
-
gap: 1,
|
|
2820
|
-
// Espacio entre elementos
|
|
2821
|
-
width: "100%",
|
|
2822
|
-
height: "100%",
|
|
2823
|
-
paddingLeft: "8px",
|
|
2824
|
-
backgroundColor: "rgba(255, 193, 7, 0.1)",
|
|
2825
|
-
// Amarillo claro para advertencia
|
|
2826
|
-
border: "1px dashed rgba(255, 193, 7, 0.5)",
|
|
2827
|
-
boxSizing: "border-box",
|
|
2828
|
-
overflow: "hidden"
|
|
2829
|
-
// Evita que el contenido se desborde
|
|
2830
|
-
},
|
|
2831
|
-
children: [
|
|
2832
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material12.Typography, { variant: "body2", noWrap: true, sx: { flexGrow: 1 }, children: clientSideName + " not found" }),
|
|
2833
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2834
|
-
import_WarningAmber2.default,
|
|
2835
|
-
{
|
|
2836
|
-
sx: {
|
|
2837
|
-
fontSize: 18,
|
|
2838
|
-
color: "warning.main",
|
|
2839
|
-
marginRight: "4px"
|
|
2840
|
-
// Pequeño margen a la derecha del icono
|
|
2841
|
-
}
|
|
2842
|
-
}
|
|
2843
|
-
)
|
|
2844
|
-
]
|
|
2845
|
-
}
|
|
2846
|
-
) });
|
|
2847
|
-
};
|
|
2848
|
-
var FallbackClientSideRenderer_default = FallbackClientSideRenderer;
|
|
2849
|
-
|
|
2850
|
-
// src/components/grid/clientSides.ts
|
|
2851
|
-
var clientSides = {
|
|
2852
|
-
"ExampleClientSideComponent": ExampleClientSideComponent_default,
|
|
2853
|
-
"FallbackClientSideRenderer": FallbackClientSideRenderer_default
|
|
2854
|
-
};
|
|
2855
|
-
var extendClientSides = (newRenderers) => {
|
|
2856
|
-
clientSides = { ...clientSides, ...newRenderers };
|
|
2857
|
-
console.log("clientSides extendidos:", clientSides);
|
|
2858
|
-
};
|
|
2859
|
-
|
|
2860
|
-
// src/components/grid/renderers/cellRenderers.tsx
|
|
2861
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2898
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2862
2899
|
var CeldaDato = import_react19.default.memo(function CeldaDato2({ row, columnKey, defaultColumn }) {
|
|
2863
2900
|
const theme = (0, import_material13.useTheme)();
|
|
2864
2901
|
const { primaryKey, fixedFields, typer, isMandatory, isNumeric } = defaultColumn;
|
|
@@ -2880,7 +2917,7 @@ var CeldaDato = import_react19.default.memo(function CeldaDato2({ row, columnKey
|
|
|
2880
2917
|
displayValue = "* " + displayValue;
|
|
2881
2918
|
}
|
|
2882
2919
|
const signal = displayValue === "--" ? "typed-controls-signal-no-data" : displayValue === "//" ? "typed-controls-signal-unknown-data" : "";
|
|
2883
|
-
const celda = /* @__PURE__ */ (0,
|
|
2920
|
+
const celda = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2884
2921
|
"div",
|
|
2885
2922
|
{
|
|
2886
2923
|
className: `fpr-celda ${isNumeric ? "fpr-celda-numerica" : ""} ${signal} ${row[NEW_ROW_INDICATOR] ? "new-row-cell-animation" : ""}`,
|
|
@@ -2888,30 +2925,30 @@ var CeldaDato = import_react19.default.memo(function CeldaDato2({ row, columnKey
|
|
|
2888
2925
|
children: displayValue
|
|
2889
2926
|
}
|
|
2890
2927
|
);
|
|
2891
|
-
return currentCellFeedback?.message ? /* @__PURE__ */ (0,
|
|
2928
|
+
return currentCellFeedback?.message ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material13.Tooltip, { title: currentCellFeedback.message, children: celda }) : celda;
|
|
2892
2929
|
});
|
|
2893
2930
|
var allColumnsCellRenderer = (props) => {
|
|
2894
2931
|
const { row, column } = props;
|
|
2895
2932
|
if (!esColumnaPropia(column)) return void 0;
|
|
2896
2933
|
if (esFilaDetalle(row)) {
|
|
2897
|
-
return column.customType === "action" ? /* @__PURE__ */ (0,
|
|
2934
|
+
return column.customType === "action" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CeldaDetalle, { fila: row }) : null;
|
|
2898
2935
|
}
|
|
2899
2936
|
switch (column.customType) {
|
|
2900
2937
|
case "default": {
|
|
2901
2938
|
const defaultColumn = column;
|
|
2902
2939
|
const { fieldDef, tableDefinition, primaryKey } = defaultColumn;
|
|
2903
|
-
if (fieldDef?.clientSide) {
|
|
2940
|
+
if (fieldDef?.clientSide && !(fieldDef.clientSide in guardadosPropios)) {
|
|
2904
2941
|
const ClientSideComponent = clientSides[fieldDef.clientSide];
|
|
2905
2942
|
if (ClientSideComponent) {
|
|
2906
|
-
return /* @__PURE__ */ (0,
|
|
2943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ClientSideComponent, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
|
|
2907
2944
|
}
|
|
2908
|
-
return /* @__PURE__ */ (0,
|
|
2945
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FallbackClientSideRenderer_default, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
|
|
2909
2946
|
}
|
|
2910
|
-
return /* @__PURE__ */ (0,
|
|
2947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CeldaDato, { row, columnKey: props.column.key, defaultColumn });
|
|
2911
2948
|
}
|
|
2912
2949
|
case "detail": {
|
|
2913
2950
|
const { detailTable, primaryKey } = column;
|
|
2914
|
-
return /* @__PURE__ */ (0,
|
|
2951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2915
2952
|
BotonDetalle,
|
|
2916
2953
|
{
|
|
2917
2954
|
row,
|
|
@@ -2946,14 +2983,14 @@ var allColumnsCellRenderer = (props) => {
|
|
|
2946
2983
|
color: "primary"
|
|
2947
2984
|
}
|
|
2948
2985
|
];
|
|
2949
|
-
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)(
|
|
2950
2987
|
import_material13.IconButton,
|
|
2951
2988
|
{
|
|
2952
2989
|
size: "small",
|
|
2953
2990
|
onClick: () => actionDef.handler(row),
|
|
2954
2991
|
title: actionDef.title,
|
|
2955
2992
|
sx: { width: 22, height: 22, p: 0, color: "grey.800", "&:hover": { color: `${actionDef.color}.main` } },
|
|
2956
|
-
children: /* @__PURE__ */ (0,
|
|
2993
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(actionDef.icon, { sx: { fontSize: 18 } })
|
|
2957
2994
|
},
|
|
2958
2995
|
actionDef.action
|
|
2959
2996
|
) : null) });
|
|
@@ -3019,7 +3056,7 @@ var useTableRecordSave = () => {
|
|
|
3019
3056
|
var import_InputBase = __toESM(require("@mui/material/InputBase"), 1);
|
|
3020
3057
|
var import_material14 = require("@mui/material");
|
|
3021
3058
|
var import_type_store4 = __toESM(require("type-store"), 1);
|
|
3022
|
-
var
|
|
3059
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3023
3060
|
function findChangedValues(oldRowData, newRowData, isNewRow) {
|
|
3024
3061
|
let changes = [];
|
|
3025
3062
|
for (const key in newRowData) {
|
|
@@ -3052,6 +3089,7 @@ function InputRenderer({
|
|
|
3052
3089
|
const theme = (0, import_material14.useTheme)();
|
|
3053
3090
|
const { showSuccess, showError } = useSnackbar();
|
|
3054
3091
|
const { saveRecord } = useTableRecordSave();
|
|
3092
|
+
const { callApi } = useApiCall();
|
|
3055
3093
|
const rowId = getPrimaryKeyValues(row, primaryKey);
|
|
3056
3094
|
const cellKey = `${rowId}-${column.key}`;
|
|
3057
3095
|
const currentCellFeedback = useFeedbackCelda(cellKey);
|
|
@@ -3093,6 +3131,20 @@ function InputRenderer({
|
|
|
3093
3131
|
const oldRowData = { ...row };
|
|
3094
3132
|
const primaryKeyValuesForBackend = tableDefinition.primaryKey.map((key) => potentialUpdatedRow[key]);
|
|
3095
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
|
+
}
|
|
3096
3148
|
onRowChange({ ...row, [column.key]: processedNewValue }, true);
|
|
3097
3149
|
if (isNewRow) {
|
|
3098
3150
|
const areAllMandatoryFieldsFilled = tableDefinition.fields.every((fieldDef) => {
|
|
@@ -3205,7 +3257,9 @@ function InputRenderer({
|
|
|
3205
3257
|
setTableData,
|
|
3206
3258
|
setLocalCellChanges,
|
|
3207
3259
|
initialRowId,
|
|
3208
|
-
typer
|
|
3260
|
+
typer,
|
|
3261
|
+
fieldDefinition,
|
|
3262
|
+
callApi
|
|
3209
3263
|
]);
|
|
3210
3264
|
const confirmarEnExpansion = (0, import_react21.useCallback)((nuevo) => {
|
|
3211
3265
|
setEditingValue(nuevo);
|
|
@@ -3260,7 +3314,7 @@ function InputRenderer({
|
|
|
3260
3314
|
}, [handleCommit, editingValue]);
|
|
3261
3315
|
const isFieldEditable = fieldDefinition?.editable !== false;
|
|
3262
3316
|
const isNumeric = isNumericType(fieldDefinition?.typeName);
|
|
3263
|
-
const editor = /* @__PURE__ */ (0,
|
|
3317
|
+
const editor = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3264
3318
|
import_InputBase.default,
|
|
3265
3319
|
{
|
|
3266
3320
|
autoFocus: true,
|
|
@@ -3296,16 +3350,16 @@ function InputRenderer({
|
|
|
3296
3350
|
endAdornment: expander.lupa
|
|
3297
3351
|
}
|
|
3298
3352
|
);
|
|
3299
|
-
const conMenu = /* @__PURE__ */ (0,
|
|
3353
|
+
const conMenu = /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
3300
3354
|
editor,
|
|
3301
3355
|
expander.ventana
|
|
3302
3356
|
] });
|
|
3303
|
-
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;
|
|
3304
3358
|
}
|
|
3305
3359
|
var InputRenderer_default = InputRenderer;
|
|
3306
3360
|
|
|
3307
3361
|
// src/components/grid/renderers/editCellRenderers.tsx
|
|
3308
|
-
var
|
|
3362
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3309
3363
|
var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
3310
3364
|
const column = props.column;
|
|
3311
3365
|
if (!esColumnaPropia(column)) return void 0;
|
|
@@ -3327,7 +3381,7 @@ var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
|
3327
3381
|
if (!isFieldEditableByUI) {
|
|
3328
3382
|
return void 0;
|
|
3329
3383
|
}
|
|
3330
|
-
return /* @__PURE__ */ (0,
|
|
3384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3331
3385
|
InputRenderer_default,
|
|
3332
3386
|
{
|
|
3333
3387
|
...props,
|
|
@@ -3352,14 +3406,6 @@ var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
|
3352
3406
|
}
|
|
3353
3407
|
};
|
|
3354
3408
|
|
|
3355
|
-
// src/utils/columnasOcultas.ts
|
|
3356
|
-
function columnasOcultasIniciales(tableDefinition) {
|
|
3357
|
-
return Array.from(new Set(tableDefinition.hiddenColumns ?? []));
|
|
3358
|
-
}
|
|
3359
|
-
function campoDibujable(field) {
|
|
3360
|
-
return field.visible !== false;
|
|
3361
|
-
}
|
|
3362
|
-
|
|
3363
3409
|
// src/hooks/grid/useGridColumns.ts
|
|
3364
3410
|
var estimateTextWidth = (text) => text.length * 8 + 16;
|
|
3365
3411
|
var contextoDeMedida;
|
|
@@ -3435,7 +3481,7 @@ var useGridColumns = ({
|
|
|
3435
3481
|
});
|
|
3436
3482
|
const defaultColumns = fieldsToShow.map((fieldDef) => {
|
|
3437
3483
|
const isFixedField = valorFijoDe(fixedFields, fieldDef.name) !== void 0;
|
|
3438
|
-
const isFieldEditable = fieldDef
|
|
3484
|
+
const isFieldEditable = campoEditableEnCelda(fieldDef) && !isFixedField;
|
|
3439
3485
|
const colWidth = anchosCalculados.get(fieldDef.name) ?? estimateTextWidth(fieldDef.label || fieldDef.name) + 20;
|
|
3440
3486
|
const column = {
|
|
3441
3487
|
key: fieldDef.name,
|
|
@@ -3527,7 +3573,7 @@ var useGridColumns = ({
|
|
|
3527
3573
|
var import_react23 = require("react");
|
|
3528
3574
|
var import_material15 = require("@mui/material");
|
|
3529
3575
|
var import_FileUpload2 = __toESM(require("@mui/icons-material/FileUpload"), 1);
|
|
3530
|
-
var
|
|
3576
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3531
3577
|
var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
3532
3578
|
const [file, setFile] = (0, import_react23.useState)(null);
|
|
3533
3579
|
const [options, setOptions] = (0, import_react23.useState)({
|
|
@@ -3549,15 +3595,15 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3549
3595
|
onClose();
|
|
3550
3596
|
}
|
|
3551
3597
|
};
|
|
3552
|
-
return /* @__PURE__ */ (0,
|
|
3553
|
-
/* @__PURE__ */ (0,
|
|
3554
|
-
/* @__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" }),
|
|
3555
3601
|
"Importar datos desde archivo"
|
|
3556
3602
|
] }),
|
|
3557
|
-
/* @__PURE__ */ (0,
|
|
3558
|
-
/* @__PURE__ */ (0,
|
|
3559
|
-
/* @__PURE__ */ (0,
|
|
3560
|
-
/* @__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)(
|
|
3561
3607
|
import_material15.Box,
|
|
3562
3608
|
{
|
|
3563
3609
|
sx: {
|
|
@@ -3570,7 +3616,7 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3570
3616
|
position: "relative"
|
|
3571
3617
|
},
|
|
3572
3618
|
children: [
|
|
3573
|
-
/* @__PURE__ */ (0,
|
|
3619
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3574
3620
|
"input",
|
|
3575
3621
|
{
|
|
3576
3622
|
type: "file",
|
|
@@ -3587,19 +3633,19 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3587
3633
|
}
|
|
3588
3634
|
}
|
|
3589
3635
|
),
|
|
3590
|
-
/* @__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" })
|
|
3591
3637
|
]
|
|
3592
3638
|
}
|
|
3593
3639
|
)
|
|
3594
3640
|
] }),
|
|
3595
|
-
/* @__PURE__ */ (0,
|
|
3596
|
-
/* @__PURE__ */ (0,
|
|
3597
|
-
/* @__PURE__ */ (0,
|
|
3598
|
-
/* @__PURE__ */ (0,
|
|
3599
|
-
/* @__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)(
|
|
3600
3646
|
import_material15.FormControlLabel,
|
|
3601
3647
|
{
|
|
3602
|
-
control: /* @__PURE__ */ (0,
|
|
3648
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3603
3649
|
import_material15.Checkbox,
|
|
3604
3650
|
{
|
|
3605
3651
|
checked: options.skipUnknownFieldsAtImport,
|
|
@@ -3607,13 +3653,13 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3607
3653
|
size: "small"
|
|
3608
3654
|
}
|
|
3609
3655
|
),
|
|
3610
|
-
label: /* @__PURE__ */ (0,
|
|
3656
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material15.Typography, { variant: "body2", children: "Omitir campos desconocidos al importar" })
|
|
3611
3657
|
}
|
|
3612
3658
|
),
|
|
3613
|
-
/* @__PURE__ */ (0,
|
|
3659
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3614
3660
|
import_material15.FormControlLabel,
|
|
3615
3661
|
{
|
|
3616
|
-
control: /* @__PURE__ */ (0,
|
|
3662
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3617
3663
|
import_material15.Checkbox,
|
|
3618
3664
|
{
|
|
3619
3665
|
checked: options.simplificateSpaces,
|
|
@@ -3621,13 +3667,13 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3621
3667
|
size: "small"
|
|
3622
3668
|
}
|
|
3623
3669
|
),
|
|
3624
|
-
label: /* @__PURE__ */ (0,
|
|
3670
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material15.Typography, { variant: "body2", children: "Simplificar espacios" })
|
|
3625
3671
|
}
|
|
3626
3672
|
),
|
|
3627
|
-
/* @__PURE__ */ (0,
|
|
3673
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3628
3674
|
import_material15.FormControlLabel,
|
|
3629
3675
|
{
|
|
3630
|
-
control: /* @__PURE__ */ (0,
|
|
3676
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3631
3677
|
import_material15.Checkbox,
|
|
3632
3678
|
{
|
|
3633
3679
|
checked: options.replaceNewLineWithSpace,
|
|
@@ -3635,21 +3681,21 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3635
3681
|
size: "small"
|
|
3636
3682
|
}
|
|
3637
3683
|
),
|
|
3638
|
-
label: /* @__PURE__ */ (0,
|
|
3684
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material15.Typography, { variant: "body2", children: "Reemplazar saltos de l\xEDnea con espacios" })
|
|
3639
3685
|
}
|
|
3640
3686
|
)
|
|
3641
3687
|
] })
|
|
3642
3688
|
] })
|
|
3643
3689
|
] }) }),
|
|
3644
|
-
/* @__PURE__ */ (0,
|
|
3645
|
-
/* @__PURE__ */ (0,
|
|
3646
|
-
/* @__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)(
|
|
3647
3693
|
import_material15.Button,
|
|
3648
3694
|
{
|
|
3649
3695
|
onClick: handleConfirm,
|
|
3650
3696
|
variant: "contained",
|
|
3651
3697
|
disabled: !file || loading,
|
|
3652
|
-
startIcon: /* @__PURE__ */ (0,
|
|
3698
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_FileUpload2.default, {}),
|
|
3653
3699
|
children: loading ? "Procesando..." : "Confirmar Importaci\xF3n"
|
|
3654
3700
|
}
|
|
3655
3701
|
)
|
|
@@ -3662,7 +3708,7 @@ var import_react24 = require("react");
|
|
|
3662
3708
|
var import_material16 = require("@mui/material");
|
|
3663
3709
|
var XLSX = __toESM(require("xlsx"), 1);
|
|
3664
3710
|
var import_type_store5 = __toESM(require("type-store"), 1);
|
|
3665
|
-
var
|
|
3711
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3666
3712
|
var ExportDialog = ({
|
|
3667
3713
|
open,
|
|
3668
3714
|
onClose,
|
|
@@ -3807,76 +3853,76 @@ var ExportDialog = ({
|
|
|
3807
3853
|
URL.revokeObjectURL(url);
|
|
3808
3854
|
}, 0);
|
|
3809
3855
|
};
|
|
3810
|
-
return /* @__PURE__ */ (0,
|
|
3811
|
-
/* @__PURE__ */ (0,
|
|
3812
|
-
/* @__PURE__ */ (0,
|
|
3813
|
-
/* @__PURE__ */ (0,
|
|
3814
|
-
/* @__PURE__ */ (0,
|
|
3815
|
-
] }) : /* @__PURE__ */ (0,
|
|
3816
|
-
/* @__PURE__ */ (0,
|
|
3817
|
-
/* @__PURE__ */ (0,
|
|
3818
|
-
/* @__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)(
|
|
3819
3865
|
import_material16.RadioGroup,
|
|
3820
3866
|
{
|
|
3821
3867
|
value: format,
|
|
3822
3868
|
onChange: (e) => setFormat(e.target.value),
|
|
3823
3869
|
children: [
|
|
3824
|
-
/* @__PURE__ */ (0,
|
|
3825
|
-
/* @__PURE__ */ (0,
|
|
3826
|
-
/* @__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 , )" })
|
|
3827
3873
|
]
|
|
3828
3874
|
}
|
|
3829
3875
|
)
|
|
3830
3876
|
] }),
|
|
3831
|
-
/* @__PURE__ */ (0,
|
|
3832
|
-
/* @__PURE__ */ (0,
|
|
3833
|
-
/* @__PURE__ */ (0,
|
|
3834
|
-
/* @__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)(
|
|
3835
3881
|
import_material16.FormControlLabel,
|
|
3836
3882
|
{
|
|
3837
|
-
control: /* @__PURE__ */ (0,
|
|
3883
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material16.Checkbox, { checked: options.fromOtherTables, onChange: handleOptionChange, name: "fromOtherTables" }),
|
|
3838
3884
|
label: "Desde otras tablas"
|
|
3839
3885
|
}
|
|
3840
3886
|
),
|
|
3841
|
-
/* @__PURE__ */ (0,
|
|
3887
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3842
3888
|
import_material16.FormControlLabel,
|
|
3843
3889
|
{
|
|
3844
|
-
control: /* @__PURE__ */ (0,
|
|
3890
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material16.Checkbox, { checked: options.readOnly, onChange: handleOptionChange, name: "readOnly" }),
|
|
3845
3891
|
label: "Solo lectura"
|
|
3846
3892
|
}
|
|
3847
3893
|
),
|
|
3848
|
-
/* @__PURE__ */ (0,
|
|
3894
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3849
3895
|
import_material16.FormControlLabel,
|
|
3850
3896
|
{
|
|
3851
|
-
control: /* @__PURE__ */ (0,
|
|
3897
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material16.Checkbox, { checked: options.hiddens, onChange: handleOptionChange, name: "hiddens" }),
|
|
3852
3898
|
label: "Ocultos"
|
|
3853
3899
|
}
|
|
3854
3900
|
)
|
|
3855
3901
|
] })
|
|
3856
3902
|
] })
|
|
3857
3903
|
] }) }),
|
|
3858
|
-
/* @__PURE__ */ (0,
|
|
3859
|
-
/* @__PURE__ */ (0,
|
|
3860
|
-
/* @__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" })
|
|
3861
3907
|
] })
|
|
3862
3908
|
] });
|
|
3863
3909
|
};
|
|
3864
3910
|
|
|
3865
3911
|
// src/components/grid/DialogoDeColumnas.tsx
|
|
3866
3912
|
var import_material17 = require("@mui/material");
|
|
3867
|
-
var
|
|
3913
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3868
3914
|
var DialogoDeColumnas = ({ open, onClose, columnas, ocultas, alternarColumna }) => {
|
|
3869
|
-
const lista = (titulo, nombres, idDeLista) => /* @__PURE__ */ (0,
|
|
3870
|
-
/* @__PURE__ */ (0,
|
|
3871
|
-
/* @__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)) })
|
|
3872
3918
|
] });
|
|
3873
|
-
return /* @__PURE__ */ (0,
|
|
3874
|
-
/* @__PURE__ */ (0,
|
|
3875
|
-
/* @__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: [
|
|
3876
3922
|
lista("Columnas mostradas", columnas.filter((nombre) => !ocultas.has(nombre)), "columnas-mostradas"),
|
|
3877
3923
|
lista("Columnas ocultas", columnas.filter((nombre) => ocultas.has(nombre)), "columnas-ocultas")
|
|
3878
3924
|
] }) }),
|
|
3879
|
-
/* @__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" }) })
|
|
3880
3926
|
] });
|
|
3881
3927
|
};
|
|
3882
3928
|
|
|
@@ -3884,7 +3930,7 @@ var DialogoDeColumnas = ({ open, onClose, columnas, ocultas, alternarColumna })
|
|
|
3884
3930
|
var import_react25 = require("react");
|
|
3885
3931
|
var import_material18 = require("@mui/material");
|
|
3886
3932
|
var import_Close = __toESM(require("@mui/icons-material/Close"), 1);
|
|
3887
|
-
var
|
|
3933
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3888
3934
|
var SIN_OCULTAS = /* @__PURE__ */ new Set();
|
|
3889
3935
|
var VerticalEditorPage = ({
|
|
3890
3936
|
tableName,
|
|
@@ -4013,21 +4059,21 @@ var VerticalEditorPage = ({
|
|
|
4013
4059
|
tableDefinition,
|
|
4014
4060
|
onSaveSuccess
|
|
4015
4061
|
]);
|
|
4016
|
-
return /* @__PURE__ */ (0,
|
|
4017
|
-
/* @__PURE__ */ (0,
|
|
4018
|
-
/* @__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: [
|
|
4019
4065
|
isNewRow ? "Nuevo Registro" : "Editar Registro",
|
|
4020
4066
|
" - ",
|
|
4021
4067
|
tableDefinition.title || tableName
|
|
4022
4068
|
] }),
|
|
4023
|
-
/* @__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, {}) })
|
|
4024
4070
|
] }),
|
|
4025
|
-
/* @__PURE__ */ (0,
|
|
4026
|
-
globalError && /* @__PURE__ */ (0,
|
|
4027
|
-
/* @__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) => {
|
|
4028
4074
|
const isFixed = fixedFields?.some((ff) => ff.fieldName === field.name);
|
|
4029
4075
|
const isMandatory = field.nullable === false || tableDefinition.primaryKey.includes(field.name);
|
|
4030
|
-
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)(
|
|
4031
4077
|
TypedField,
|
|
4032
4078
|
{
|
|
4033
4079
|
fieldDef: field,
|
|
@@ -4041,12 +4087,12 @@ var VerticalEditorPage = ({
|
|
|
4041
4087
|
) }, field.name);
|
|
4042
4088
|
}) })
|
|
4043
4089
|
] }),
|
|
4044
|
-
/* @__PURE__ */ (0,
|
|
4045
|
-
/* @__PURE__ */ (0,
|
|
4046
|
-
isSaving && /* @__PURE__ */ (0,
|
|
4047
|
-
/* @__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" })
|
|
4048
4094
|
] }),
|
|
4049
|
-
/* @__PURE__ */ (0,
|
|
4095
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material18.Button, { variant: "outlined", onClick: onClose, children: "Cerrar" })
|
|
4050
4096
|
] })
|
|
4051
4097
|
] });
|
|
4052
4098
|
};
|
|
@@ -4118,47 +4164,383 @@ function fusionar(base, cambios) {
|
|
|
4118
4164
|
return resultado;
|
|
4119
4165
|
}
|
|
4120
4166
|
|
|
4121
|
-
// src/
|
|
4122
|
-
var
|
|
4123
|
-
var
|
|
4124
|
-
|
|
4167
|
+
// src/puente/habilitacion.ts
|
|
4168
|
+
var habilitado = false;
|
|
4169
|
+
var habilitarPuenteBP = () => {
|
|
4170
|
+
habilitado = true;
|
|
4171
|
+
};
|
|
4172
|
+
var puenteBPHabilitado = () => habilitado;
|
|
4125
4173
|
|
|
4126
|
-
// src/
|
|
4127
|
-
var
|
|
4128
|
-
var
|
|
4129
|
-
var
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
var
|
|
4133
|
-
var
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
const
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
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,
|
|
4157
4539
|
name: field.label || cambiarGuionesBajosPorEspacios(field.name),
|
|
4158
4540
|
width: 150,
|
|
4159
4541
|
editable: false,
|
|
4160
|
-
renderHeaderCell: () => /* @__PURE__ */ (0,
|
|
4161
|
-
|
|
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,
|
|
4162
4544
|
{
|
|
4163
4545
|
variant: "caption",
|
|
4164
4546
|
sx: {
|
|
@@ -4169,11 +4551,11 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
4169
4551
|
children: field.label || cambiarGuionesBajosPorEspacios(field.name)
|
|
4170
4552
|
}
|
|
4171
4553
|
) }),
|
|
4172
|
-
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] ?? "") }) })
|
|
4173
4555
|
};
|
|
4174
4556
|
});
|
|
4175
4557
|
}, [tableDefinition, fieldsToHide]);
|
|
4176
|
-
return /* @__PURE__ */ (0,
|
|
4558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_material21.Box, { sx: {
|
|
4177
4559
|
mb: 1.5,
|
|
4178
4560
|
ml: index * 4,
|
|
4179
4561
|
// El primer ancestro (index 0) no tiene margen, los siguientes sí
|
|
@@ -4184,7 +4566,7 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
4184
4566
|
boxShadow: theme.shadows[1],
|
|
4185
4567
|
bgcolor: "background.paper"
|
|
4186
4568
|
}, children: [
|
|
4187
|
-
/* @__PURE__ */ (0,
|
|
4569
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Box, { sx: {
|
|
4188
4570
|
bgcolor: "primary.main",
|
|
4189
4571
|
color: "primary.contrastText",
|
|
4190
4572
|
px: 1.5,
|
|
@@ -4195,8 +4577,8 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
4195
4577
|
alignItems: "center",
|
|
4196
4578
|
fontWeight: "bold",
|
|
4197
4579
|
gap: 1
|
|
4198
|
-
}, children: /* @__PURE__ */ (0,
|
|
4199
|
-
/* @__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)(
|
|
4200
4582
|
import_react_data_grid.DataGrid,
|
|
4201
4583
|
{
|
|
4202
4584
|
className: "rdg-light",
|
|
@@ -4229,48 +4611,48 @@ var GenericDataGrid = ({
|
|
|
4229
4611
|
altoMaximoDetalle
|
|
4230
4612
|
}) => {
|
|
4231
4613
|
const claveFixedFields = JSON.stringify(fixedFieldsRecibidos ?? null);
|
|
4232
|
-
const fixedFields = (0,
|
|
4614
|
+
const fixedFields = (0, import_react28.useMemo)(() => fixedFieldsRecibidos, [claveFixedFields]);
|
|
4233
4615
|
const claveParametros = JSON.stringify([filterColumnsRecibidos ?? null, tableDefRecibido ?? null, parameterFunctionsRecibido ?? null, pickRecibido ?? null]);
|
|
4234
|
-
const parametros = (0,
|
|
4616
|
+
const parametros = (0, import_react28.useMemo)(
|
|
4235
4617
|
() => ({ filterColumns: filterColumnsRecibidos, tableDef: tableDefRecibido, parameterFunctions: parameterFunctionsRecibido, pick: pickRecibido }),
|
|
4236
4618
|
[claveParametros]
|
|
4237
4619
|
// eslint-disable-line react-hooks/exhaustive-deps
|
|
4238
4620
|
);
|
|
4239
|
-
const cacheHeredado = (0,
|
|
4240
|
-
const [cachePropio] = (0,
|
|
4621
|
+
const cacheHeredado = (0, import_react28.useContext)(CacheGrillasContext);
|
|
4622
|
+
const [cachePropio] = (0, import_react28.useState)(() => /* @__PURE__ */ new Map());
|
|
4241
4623
|
const cache = cacheHeredado ?? cachePropio;
|
|
4242
|
-
const [guardada] = (0,
|
|
4243
|
-
const claveCargadaRef = (0,
|
|
4244
|
-
const [tableDefinition, setTableDefinition] = (0,
|
|
4245
|
-
const [tableData, setTableData] = (0,
|
|
4246
|
-
const [cargandoInicial, setCargandoInicial] = (0,
|
|
4247
|
-
const [errorDeCarga, setErrorDeCarga] = (0,
|
|
4248
|
-
const [anchosCalculados, setAnchosCalculados] = (0,
|
|
4249
|
-
const [columnasOcultas, setColumnasOcultas] = (0,
|
|
4250
|
-
const [openDialogoDeColumnas, setOpenDialogoDeColumnas] = (0,
|
|
4251
|
-
const conjuntoDeOcultas = (0,
|
|
4252
|
-
const ocultarColumna = (0,
|
|
4253
|
-
const alternarColumna = (0,
|
|
4254
|
-
const abrirDialogoDeColumnas = (0,
|
|
4255
|
-
const [detallesAbiertos, setDetallesAbiertos] = (0,
|
|
4256
|
-
const [altosDetalle, setAltosDetalle] = (0,
|
|
4257
|
-
const [anchosDetalle, setAnchosDetalle] = (0,
|
|
4258
|
-
const [selectedRows, setSelectedRows] = (0,
|
|
4259
|
-
const [, setSelectedCell] = (0,
|
|
4260
|
-
const [estadoGrilla] = (0,
|
|
4261
|
-
const theme = (0,
|
|
4262
|
-
const [openDataGridOptions, setOpenDataGridOptions] = (0,
|
|
4263
|
-
const [dataGridOptionsAnchorEl, setDataGridOptionsAnchorEl] = (0,
|
|
4264
|
-
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());
|
|
4265
4647
|
const { showError } = useSnackbar();
|
|
4266
4648
|
const { username: usuario } = useClientContext();
|
|
4267
|
-
const dataGridRef = (0,
|
|
4268
|
-
const rowAtEditStartRef = (0,
|
|
4269
|
-
const [openImportDialog, setOpenImportDialog] = (0,
|
|
4270
|
-
const [openExportDialog, setOpenExportDialog] = (0,
|
|
4271
|
-
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());
|
|
4272
4654
|
const { callApi, callApiUpload, loading } = useApiCall();
|
|
4273
|
-
const primaryKey = (0,
|
|
4655
|
+
const primaryKey = (0, import_react28.useMemo)(() => {
|
|
4274
4656
|
if (!tableDefinition) return ["id"];
|
|
4275
4657
|
return tableDefinition.primaryKey && tableDefinition.primaryKey.length > 0 ? tableDefinition.primaryKey : ["id"];
|
|
4276
4658
|
}, [tableDefinition]);
|
|
@@ -4289,9 +4671,9 @@ var GenericDataGrid = ({
|
|
|
4289
4671
|
summaryData,
|
|
4290
4672
|
resetView
|
|
4291
4673
|
} = useGridDataView({ tableData, tableDefinition });
|
|
4292
|
-
const abiertos = (0,
|
|
4293
|
-
const filasDetalleRef = (0,
|
|
4294
|
-
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)(() => {
|
|
4295
4677
|
const detailTables = tableDefinition?.detailTables ?? [];
|
|
4296
4678
|
if (abiertos.size === 0 || detailTables.length === 0) return filteredRows;
|
|
4297
4679
|
const anteriores = filasDetalleRef.current;
|
|
@@ -4318,8 +4700,8 @@ var GenericDataGrid = ({
|
|
|
4318
4700
|
filasDetalleRef.current = nuevas;
|
|
4319
4701
|
return filas;
|
|
4320
4702
|
}, [filteredRows, abiertos, tableDefinition, primaryKey]);
|
|
4321
|
-
const altoDeDetalle = (0,
|
|
4322
|
-
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)(
|
|
4323
4705
|
() => filasMostradas.reduce((total, row) => esFilaDetalle(row) ? total + altoDeDetalle(row.clave) : total, 0),
|
|
4324
4706
|
[filasMostradas, altoDeDetalle]
|
|
4325
4707
|
);
|
|
@@ -4365,9 +4747,9 @@ var GenericDataGrid = ({
|
|
|
4365
4747
|
filasVisiblesMax,
|
|
4366
4748
|
conPie
|
|
4367
4749
|
});
|
|
4368
|
-
const [contenidoDeCelda, setContenidoDeCelda] = (0,
|
|
4369
|
-
const verContenido = (0,
|
|
4370
|
-
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)(() => {
|
|
4371
4753
|
const anclaje = contenidoDeCelda?.anclaje;
|
|
4372
4754
|
setContenidoDeCelda(null);
|
|
4373
4755
|
setTimeout(() => anclaje?.focus(), 0);
|
|
@@ -4383,8 +4765,8 @@ var GenericDataGrid = ({
|
|
|
4383
4765
|
setSortColumns,
|
|
4384
4766
|
verContenido
|
|
4385
4767
|
});
|
|
4386
|
-
const tableNameAnteriorRef = (0,
|
|
4387
|
-
(0,
|
|
4768
|
+
const tableNameAnteriorRef = (0, import_react28.useRef)(tableName);
|
|
4769
|
+
(0, import_react28.useEffect)(() => {
|
|
4388
4770
|
if (tableNameAnteriorRef.current === tableName) return;
|
|
4389
4771
|
tableNameAnteriorRef.current = tableName;
|
|
4390
4772
|
setDetallesAbiertos([]);
|
|
@@ -4398,7 +4780,7 @@ var GenericDataGrid = ({
|
|
|
4398
4780
|
setExitingRowIds(/* @__PURE__ */ new Set());
|
|
4399
4781
|
setColumnWidths(/* @__PURE__ */ new Map());
|
|
4400
4782
|
}, [tableName, estadoGrilla, resetView]);
|
|
4401
|
-
(0,
|
|
4783
|
+
(0, import_react28.useEffect)(() => {
|
|
4402
4784
|
const claveCarga = `${tableName}|${claveFixedFields}|${claveParametros}`;
|
|
4403
4785
|
if (claveCargadaRef.current === claveCarga) {
|
|
4404
4786
|
if (guardada) setSortColumns(guardada.sortColumns);
|
|
@@ -4467,11 +4849,11 @@ var GenericDataGrid = ({
|
|
|
4467
4849
|
vigente = false;
|
|
4468
4850
|
};
|
|
4469
4851
|
}, [tableName, claveFixedFields, fixedFields, claveParametros, parametros, showError, callApi, getInitialSortColumns, setSortColumns, aplicarFiltrosIniciales, guardada]);
|
|
4470
|
-
(0,
|
|
4852
|
+
(0, import_react28.useEffect)(() => {
|
|
4471
4853
|
if (!claveCache || !tableDefinition || cargandoInicial) return;
|
|
4472
4854
|
cache.set(claveCache, { tableDefinition, tableData, anchosCalculados, columnasOcultas, sortColumns, detallesAbiertos, altosDetalle });
|
|
4473
4855
|
}, [cache, claveCache, tableDefinition, tableData, anchosCalculados, columnasOcultas, sortColumns, detallesAbiertos, altosDetalle, cargandoInicial]);
|
|
4474
|
-
(0,
|
|
4856
|
+
(0, import_react28.useEffect)(() => {
|
|
4475
4857
|
let timer = null;
|
|
4476
4858
|
const desuscribir = estadoGrilla.suscribir(() => {
|
|
4477
4859
|
const hayExitos = Array.from(estadoGrilla.obtenerFeedback().values()).some((f) => f.type === "success");
|
|
@@ -4496,11 +4878,11 @@ var GenericDataGrid = ({
|
|
|
4496
4878
|
if (timer) clearTimeout(timer);
|
|
4497
4879
|
};
|
|
4498
4880
|
}, [estadoGrilla]);
|
|
4499
|
-
const resetSortingDeLaTabla = (0,
|
|
4881
|
+
const resetSortingDeLaTabla = (0, import_react28.useCallback)(() => {
|
|
4500
4882
|
if (tableDefinition) resetSorting(tableDefinition);
|
|
4501
4883
|
}, [tableDefinition, resetSorting]);
|
|
4502
|
-
const abrirImportacion = (0,
|
|
4503
|
-
const abrirExportacion = (0,
|
|
4884
|
+
const abrirImportacion = (0, import_react28.useCallback)(() => setOpenImportDialog(true), []);
|
|
4885
|
+
const abrirExportacion = (0, import_react28.useCallback)(() => setOpenExportDialog(true), []);
|
|
4504
4886
|
const { menuOptions } = useGridMenu({
|
|
4505
4887
|
tableDefinition,
|
|
4506
4888
|
tableName,
|
|
@@ -4512,11 +4894,11 @@ var GenericDataGrid = ({
|
|
|
4512
4894
|
triggerExport: abrirExportacion,
|
|
4513
4895
|
abrirColumnas: abrirDialogoDeColumnas
|
|
4514
4896
|
});
|
|
4515
|
-
const abrirOpcionesDeGrilla = (0,
|
|
4897
|
+
const abrirOpcionesDeGrilla = (0, import_react28.useCallback)((anchorEl) => {
|
|
4516
4898
|
setDataGridOptionsAnchorEl(anchorEl);
|
|
4517
4899
|
setOpenDataGridOptions(true);
|
|
4518
4900
|
}, []);
|
|
4519
|
-
const editarEnFicha = (0,
|
|
4901
|
+
const editarEnFicha = (0, import_react28.useCallback)((row) => {
|
|
4520
4902
|
rowAtEditStartRef.current = { ...row };
|
|
4521
4903
|
handleVerticalEditRow(row);
|
|
4522
4904
|
}, [handleVerticalEditRow]);
|
|
@@ -4536,7 +4918,7 @@ var GenericDataGrid = ({
|
|
|
4536
4918
|
toggleFilterVisibility,
|
|
4537
4919
|
abrirOpcionesDeGrilla
|
|
4538
4920
|
});
|
|
4539
|
-
const abrirDetalleEnPestana = (0,
|
|
4921
|
+
const abrirDetalleEnPestana = (0, import_react28.useCallback)((row, detailTable) => {
|
|
4540
4922
|
if (!onOpenDetail || !tableDefinition || !detailTable.table) return;
|
|
4541
4923
|
const porCampo = /* @__PURE__ */ new Map();
|
|
4542
4924
|
[...fixedFields ?? [], ...calcularFixedFieldsDetalle(detailTable, row)].forEach((ff) => porCampo.set(ff.fieldName, ff));
|
|
@@ -4546,12 +4928,12 @@ var GenericDataGrid = ({
|
|
|
4546
4928
|
const newAncestors = [...ancestors, { tableName: tableDefinition.name, row, tableDefinition, fixedFields: allFixedFields }];
|
|
4547
4929
|
onOpenDetail(detailTable.table, allFixedFields, label, newAncestors);
|
|
4548
4930
|
}, [onOpenDetail, tableDefinition, fixedFields, ancestors]);
|
|
4549
|
-
const abrirWScreenEnPestana = (0,
|
|
4931
|
+
const abrirWScreenEnPestana = (0, import_react28.useCallback)((row, detailTable) => {
|
|
4550
4932
|
const parametros2 = new URLSearchParams();
|
|
4551
4933
|
calcularFixedFieldsDetalle(detailTable, row).forEach((ff) => parametros2.set(ff.fieldName, String(ff.value)));
|
|
4552
4934
|
window.open(`${window.location.origin}${rutaBase}/wScreens/${detailTable.wScreen}?${parametros2}`, "_blank");
|
|
4553
4935
|
}, []);
|
|
4554
|
-
const alternarDetalle = (0,
|
|
4936
|
+
const alternarDetalle = (0, import_react28.useCallback)((row, rowId, detailTable, enOtraPestana) => {
|
|
4555
4937
|
if (enOtraPestana && detailTable.wScreen) {
|
|
4556
4938
|
abrirWScreenEnPestana(row, detailTable);
|
|
4557
4939
|
return;
|
|
@@ -4563,8 +4945,8 @@ var GenericDataGrid = ({
|
|
|
4563
4945
|
const clave = claveDetalle(rowId, detailTable);
|
|
4564
4946
|
setDetallesAbiertos((anteriores) => anteriores.includes(clave) ? anteriores.filter((c) => c !== clave) : [...anteriores, clave]);
|
|
4565
4947
|
}, [onOpenDetail, abrirDetalleEnPestana, abrirWScreenEnPestana]);
|
|
4566
|
-
const [medidas, setMedidas] = (0,
|
|
4567
|
-
(0,
|
|
4948
|
+
const [medidas, setMedidas] = (0, import_react28.useState)(null);
|
|
4949
|
+
(0, import_react28.useEffect)(() => {
|
|
4568
4950
|
const elemento = dataGridRef.current?.element;
|
|
4569
4951
|
if (!elemento) return;
|
|
4570
4952
|
const medir = () => setMedidas((anteriores) => {
|
|
@@ -4577,8 +4959,8 @@ var GenericDataGrid = ({
|
|
|
4577
4959
|
return () => observador.disconnect();
|
|
4578
4960
|
}, [tableDefinition, cargandoInicial]);
|
|
4579
4961
|
const anchoVisible = medidas?.ancho ?? null;
|
|
4580
|
-
const [altoDeVentana, setAltoDeVentana] = (0,
|
|
4581
|
-
(0,
|
|
4962
|
+
const [altoDeVentana, setAltoDeVentana] = (0, import_react28.useState)(null);
|
|
4963
|
+
(0, import_react28.useEffect)(() => {
|
|
4582
4964
|
if (anidada) return;
|
|
4583
4965
|
const elemento = dataGridRef.current?.element;
|
|
4584
4966
|
if (!elemento) return;
|
|
@@ -4587,25 +4969,25 @@ var GenericDataGrid = ({
|
|
|
4587
4969
|
window.addEventListener("resize", calcular);
|
|
4588
4970
|
return () => window.removeEventListener("resize", calcular);
|
|
4589
4971
|
}, [anidada, tableDefinition, cargandoInicial]);
|
|
4590
|
-
const altoDeContexto = (0,
|
|
4972
|
+
const altoDeContexto = (0, import_react28.useContext)(AltoDisponibleContext);
|
|
4591
4973
|
const altoDeEstaGrilla = anidada ? altoDisponible ?? (altoDeContexto === void 0 ? void 0 : altoDeContexto - ALTO_TITULO_ANIDADA) : altoDeVentana ?? void 0;
|
|
4592
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);
|
|
4593
|
-
const cambiarAnchoDetalle = (0,
|
|
4975
|
+
const cambiarAnchoDetalle = (0, import_react28.useCallback)((clave, ancho) => {
|
|
4594
4976
|
setAnchosDetalle((anteriores) => anteriores.get(clave) === ancho ? anteriores : new Map(anteriores).set(clave, ancho));
|
|
4595
4977
|
}, []);
|
|
4596
|
-
const cambiarAltoDetalle = (0,
|
|
4978
|
+
const cambiarAltoDetalle = (0, import_react28.useCallback)((clave, altoDeseado2) => {
|
|
4597
4979
|
const alto = Math.min(Math.max(Math.round(altoDeseado2), ALTO_MINIMO_DETALLE), altoMaximoDetalleEfectivo ?? Infinity);
|
|
4598
4980
|
setAltosDetalle((anteriores) => anteriores.get(clave) === alto ? anteriores : new Map(anteriores).set(clave, alto));
|
|
4599
4981
|
}, [altoMaximoDetalleEfectivo]);
|
|
4600
|
-
const renderDetalle = (0,
|
|
4982
|
+
const renderDetalle = (0, import_react28.useCallback)((fila) => {
|
|
4601
4983
|
const { detailTable } = fila;
|
|
4602
|
-
return /* @__PURE__ */ (0,
|
|
4984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4603
4985
|
"div",
|
|
4604
4986
|
{
|
|
4605
4987
|
className: "fpr-detalle",
|
|
4606
4988
|
style: { maxWidth: anchoVisible ? anchoVisible - 2 : void 0 },
|
|
4607
4989
|
onKeyDown: (e) => e.stopPropagation(),
|
|
4608
|
-
children: detailTable.table ? /* @__PURE__ */ (0,
|
|
4990
|
+
children: detailTable.table ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4609
4991
|
GenericDataGrid,
|
|
4610
4992
|
{
|
|
4611
4993
|
tableName: detailTable.table,
|
|
@@ -4618,7 +5000,7 @@ var GenericDataGrid = ({
|
|
|
4618
5000
|
onOpenDetail,
|
|
4619
5001
|
ancestors: tableDefinition ? [...ancestors, { tableName: tableDefinition.name, row: fila.filaPadre, tableDefinition, fixedFields: fila.fixedFields }] : ancestors
|
|
4620
5002
|
}
|
|
4621
|
-
) : detailTable.wScreen ? /* @__PURE__ */ (0,
|
|
5003
|
+
) : detailTable.wScreen ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4622
5004
|
DetalleWScreen,
|
|
4623
5005
|
{
|
|
4624
5006
|
fila,
|
|
@@ -4626,7 +5008,7 @@ var GenericDataGrid = ({
|
|
|
4626
5008
|
onAlto: (alto) => cambiarAltoDetalle(fila.clave, alto),
|
|
4627
5009
|
onAncho: (ancho) => cambiarAnchoDetalle(fila.clave, ancho)
|
|
4628
5010
|
}
|
|
4629
|
-
) : /* @__PURE__ */ (0,
|
|
5011
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_material21.Alert, { severity: "warning", children: [
|
|
4630
5012
|
"El detalle '",
|
|
4631
5013
|
detailTable.abr,
|
|
4632
5014
|
"' no tiene ni tabla ni wScreen."
|
|
@@ -4634,18 +5016,18 @@ var GenericDataGrid = ({
|
|
|
4634
5016
|
}
|
|
4635
5017
|
);
|
|
4636
5018
|
}, [anchoVisible, claveCache, tableName, cambiarAltoDetalle, cambiarAnchoDetalle, altoMaximoDetalleEfectivo, onOpenDetail, tableDefinition, ancestors]);
|
|
4637
|
-
const detallesGrilla = (0,
|
|
5019
|
+
const detallesGrilla = (0, import_react28.useMemo)(() => ({ abiertos, alternarDetalle, renderDetalle }), [abiertos, alternarDetalle, renderDetalle]);
|
|
4638
5020
|
const altoDeseado = cargandoInicial ? ALTO_INICIAL_DETALLE : gridHeight + ALTO_TITULO_ANIDADA + 8;
|
|
4639
|
-
(0,
|
|
5021
|
+
(0, import_react28.useEffect)(() => {
|
|
4640
5022
|
onAltoDeseado?.(altoDeseado);
|
|
4641
5023
|
}, [onAltoDeseado, altoDeseado]);
|
|
4642
|
-
const rowKeyGetter = (0,
|
|
4643
|
-
const rowHeight = (0,
|
|
4644
|
-
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)(
|
|
4645
5027
|
(row) => esFilaDetalle(row) ? "fpr-fila-detalle" : exitingRowIds.has(getPrimaryKeyValues(row, primaryKey)) ? "fpr-fila-saliendo" : void 0,
|
|
4646
5028
|
[exitingRowIds, primaryKey]
|
|
4647
5029
|
);
|
|
4648
|
-
const anchoContenido = (0,
|
|
5030
|
+
const anchoContenido = (0, import_react28.useMemo)(() => {
|
|
4649
5031
|
if (columns.length === 0) return void 0;
|
|
4650
5032
|
const sumaColumnas = columns.reduce((total, col) => {
|
|
4651
5033
|
const medido = columnWidths.get(col.key)?.width;
|
|
@@ -4655,13 +5037,13 @@ var GenericDataGrid = ({
|
|
|
4655
5037
|
const anchoDetalleMax = detallesAbiertos.reduce((max, clave) => Math.max(max, anchosDetalle.get(clave) ?? 0), 0);
|
|
4656
5038
|
return Math.max(ANCHO_MINIMO_ANIDADA, propio, anchoDetalleMax > 0 ? anchoDetalleMax + SANGRIA_DETALLE + (medidas?.barra ?? 0) + 2 : 0);
|
|
4657
5039
|
}, [anidada, columns, columnWidths, medidas?.barra, detallesAbiertos, anchosDetalle]);
|
|
4658
|
-
(0,
|
|
5040
|
+
(0, import_react28.useEffect)(() => {
|
|
4659
5041
|
if (anidada && anchoContenido !== void 0) onAnchoDeseado?.(anchoContenido);
|
|
4660
5042
|
}, [onAnchoDeseado, anidada, anchoContenido]);
|
|
4661
5043
|
const anchoExterior = anchoContenido === void 0 ? void 0 : anidada ? anchoContenido : anchoContenido - 2 + 32 + ancestors.length * 32;
|
|
4662
|
-
const estiloGrilla = (0,
|
|
4663
|
-
const bottomSummaryRows = (0,
|
|
4664
|
-
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]);
|
|
4665
5047
|
const getFallBackMessage = () => {
|
|
4666
5048
|
if (tableData.length === 0) {
|
|
4667
5049
|
return "No hay filas para mostrar";
|
|
@@ -4673,19 +5055,22 @@ var GenericDataGrid = ({
|
|
|
4673
5055
|
};
|
|
4674
5056
|
const fallBackMessage = getFallBackMessage();
|
|
4675
5057
|
if (cargandoInicial) {
|
|
4676
|
-
return /* @__PURE__ */ (0,
|
|
4677
|
-
/* @__PURE__ */ (0,
|
|
4678
|
-
/* @__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..." })
|
|
4679
5061
|
] });
|
|
4680
5062
|
}
|
|
4681
5063
|
if (errorDeCarga) {
|
|
4682
|
-
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 }) });
|
|
4683
5065
|
}
|
|
4684
5066
|
if (!tableDefinition) {
|
|
4685
|
-
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 }) });
|
|
4686
5071
|
}
|
|
4687
|
-
return /* @__PURE__ */ (0,
|
|
4688
|
-
!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)(
|
|
4689
5074
|
StaticAncestorGrid,
|
|
4690
5075
|
{
|
|
4691
5076
|
ancestor,
|
|
@@ -4694,8 +5079,8 @@ var GenericDataGrid = ({
|
|
|
4694
5079
|
},
|
|
4695
5080
|
index
|
|
4696
5081
|
)) }),
|
|
4697
|
-
/* @__PURE__ */ (0,
|
|
4698
|
-
|
|
5082
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
5083
|
+
import_material21.Box,
|
|
4699
5084
|
{
|
|
4700
5085
|
sx: {
|
|
4701
5086
|
backgroundColor: theme.palette.primary.main,
|
|
@@ -4717,17 +5102,17 @@ var GenericDataGrid = ({
|
|
|
4717
5102
|
gap: 1
|
|
4718
5103
|
},
|
|
4719
5104
|
children: [
|
|
4720
|
-
/* @__PURE__ */ (0,
|
|
5105
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_material21.Typography, { variant: "subtitle2", component: "div", children: [
|
|
4721
5106
|
titulo ?? cambiarGuionesBajosPorEspacios(tableDefinition.title || tableDefinition.name),
|
|
4722
5107
|
" - ",
|
|
4723
5108
|
filteredRows.length === tableData.length ? `${tableData.length} registros` : `${filteredRows.length} (F)`
|
|
4724
5109
|
] }),
|
|
4725
|
-
loading && /* @__PURE__ */ (0,
|
|
5110
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.CircularProgress, { size: 14, color: "inherit" })
|
|
4726
5111
|
]
|
|
4727
5112
|
}
|
|
4728
5113
|
),
|
|
4729
|
-
/* @__PURE__ */ (0,
|
|
4730
|
-
|
|
5114
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
5115
|
+
import_material21.Box,
|
|
4731
5116
|
{
|
|
4732
5117
|
sx: {
|
|
4733
5118
|
// Una grilla anidada se acota con px (el alto que le dio la de arriba, o el de una wScreen): una wScreen
|
|
@@ -4745,7 +5130,7 @@ var GenericDataGrid = ({
|
|
|
4745
5130
|
pb: anidada ? 0 : 3
|
|
4746
5131
|
},
|
|
4747
5132
|
children: [
|
|
4748
|
-
/* @__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)(
|
|
4749
5134
|
import_react_data_grid.DataGrid,
|
|
4750
5135
|
{
|
|
4751
5136
|
className: "rdg-light",
|
|
@@ -4775,8 +5160,8 @@ var GenericDataGrid = ({
|
|
|
4775
5160
|
onCellKeyDown: handleCellKeyDown
|
|
4776
5161
|
}
|
|
4777
5162
|
) }) }) }),
|
|
4778
|
-
fallBackMessage && /* @__PURE__ */ (0,
|
|
4779
|
-
|
|
5163
|
+
fallBackMessage && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5164
|
+
import_material21.Box,
|
|
4780
5165
|
{
|
|
4781
5166
|
sx: {
|
|
4782
5167
|
position: "absolute",
|
|
@@ -4792,13 +5177,13 @@ var GenericDataGrid = ({
|
|
|
4792
5177
|
zIndex: tableData.length === 0 ? 10 : 1
|
|
4793
5178
|
// Mantenemos el zIndex superior para el estado vacío total
|
|
4794
5179
|
},
|
|
4795
|
-
children: /* @__PURE__ */ (0,
|
|
5180
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Typography, { variant: "body2", color: "textSecondary", children: fallBackMessage })
|
|
4796
5181
|
}
|
|
4797
5182
|
)
|
|
4798
5183
|
]
|
|
4799
5184
|
}
|
|
4800
5185
|
),
|
|
4801
|
-
/* @__PURE__ */ (0,
|
|
5186
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4802
5187
|
ExportDialog,
|
|
4803
5188
|
{
|
|
4804
5189
|
open: openExportDialog,
|
|
@@ -4810,7 +5195,7 @@ var GenericDataGrid = ({
|
|
|
4810
5195
|
username: usuario || "anonymous"
|
|
4811
5196
|
}
|
|
4812
5197
|
),
|
|
4813
|
-
/* @__PURE__ */ (0,
|
|
5198
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4814
5199
|
DialogoDeColumnas,
|
|
4815
5200
|
{
|
|
4816
5201
|
open: openDialogoDeColumnas,
|
|
@@ -4820,7 +5205,7 @@ var GenericDataGrid = ({
|
|
|
4820
5205
|
alternarColumna
|
|
4821
5206
|
}
|
|
4822
5207
|
),
|
|
4823
|
-
/* @__PURE__ */ (0,
|
|
5208
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4824
5209
|
ConfirmDialog,
|
|
4825
5210
|
{
|
|
4826
5211
|
open: openConfirmDialog,
|
|
@@ -4829,7 +5214,7 @@ var GenericDataGrid = ({
|
|
|
4829
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."
|
|
4830
5215
|
}
|
|
4831
5216
|
),
|
|
4832
|
-
/* @__PURE__ */ (0,
|
|
5217
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4833
5218
|
DataGridOptionsDialog,
|
|
4834
5219
|
{
|
|
4835
5220
|
open: openDataGridOptions,
|
|
@@ -4838,7 +5223,7 @@ var GenericDataGrid = ({
|
|
|
4838
5223
|
anchorEl: dataGridOptionsAnchorEl
|
|
4839
5224
|
}
|
|
4840
5225
|
),
|
|
4841
|
-
/* @__PURE__ */ (0,
|
|
5226
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4842
5227
|
ImportDialog,
|
|
4843
5228
|
{
|
|
4844
5229
|
open: openImportDialog,
|
|
@@ -4847,14 +5232,14 @@ var GenericDataGrid = ({
|
|
|
4847
5232
|
loading
|
|
4848
5233
|
}
|
|
4849
5234
|
),
|
|
4850
|
-
/* @__PURE__ */ (0,
|
|
4851
|
-
|
|
5235
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5236
|
+
import_material21.Dialog,
|
|
4852
5237
|
{
|
|
4853
5238
|
open: openVerticalEditDialog,
|
|
4854
5239
|
onClose: () => setOpenVerticalEditDialog(false),
|
|
4855
5240
|
maxWidth: "sm",
|
|
4856
5241
|
fullWidth: true,
|
|
4857
|
-
children: rowToEditVertical && /* @__PURE__ */ (0,
|
|
5242
|
+
children: rowToEditVertical && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4858
5243
|
VerticalEditorPage,
|
|
4859
5244
|
{
|
|
4860
5245
|
tableName,
|
|
@@ -4900,7 +5285,7 @@ var GenericDataGrid = ({
|
|
|
4900
5285
|
)
|
|
4901
5286
|
}
|
|
4902
5287
|
),
|
|
4903
|
-
contenidoDeCelda && /* @__PURE__ */ (0,
|
|
5288
|
+
contenidoDeCelda && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(VentanaDeTexto, { anclaje: contenidoDeCelda.anclaje, texto: contenidoDeCelda.texto, editable: false, onAceptar: cerrarContenidoDeCelda, onCerrar: cerrarContenidoDeCelda })
|
|
4904
5289
|
] }) });
|
|
4905
5290
|
};
|
|
4906
5291
|
var GenericDataGrid_default = GenericDataGrid;
|
|
@@ -4910,13 +5295,13 @@ var import_react44 = __toESM(require("react"), 1);
|
|
|
4910
5295
|
var import_react_router_dom18 = require("react-router-dom");
|
|
4911
5296
|
|
|
4912
5297
|
// src/components/MainLayout.tsx
|
|
4913
|
-
var
|
|
4914
|
-
var
|
|
4915
|
-
var
|
|
5298
|
+
var import_react32 = require("react");
|
|
5299
|
+
var import_react_router_dom5 = require("react-router-dom");
|
|
5300
|
+
var import_material23 = require("@mui/material");
|
|
4916
5301
|
|
|
4917
5302
|
// src/contexts/AppContext.tsx
|
|
4918
|
-
var
|
|
4919
|
-
var
|
|
5303
|
+
var import_react29 = require("react");
|
|
5304
|
+
var import_react_router_dom2 = require("react-router-dom");
|
|
4920
5305
|
var import_react_redux2 = require("react-redux");
|
|
4921
5306
|
|
|
4922
5307
|
// src/utils/cierreVoluntario.ts
|
|
@@ -4927,10 +5312,10 @@ var marcarCierreVoluntario = (activo) => {
|
|
|
4927
5312
|
var huboCierreVoluntario = () => cierreVoluntario;
|
|
4928
5313
|
|
|
4929
5314
|
// src/contexts/AppContext.tsx
|
|
4930
|
-
var
|
|
4931
|
-
var AuthContext = (0,
|
|
5315
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
5316
|
+
var AuthContext = (0, import_react29.createContext)(void 0);
|
|
4932
5317
|
var useApp = () => {
|
|
4933
|
-
const context = (0,
|
|
5318
|
+
const context = (0, import_react29.useContext)(AuthContext);
|
|
4934
5319
|
if (!context) {
|
|
4935
5320
|
throw new Error("useApp must be used within an AppProvider");
|
|
4936
5321
|
}
|
|
@@ -4939,16 +5324,16 @@ var useApp = () => {
|
|
|
4939
5324
|
};
|
|
4940
5325
|
var AppProvider = ({ children, publicPaths = [] }) => {
|
|
4941
5326
|
console.log("AppProvider rendered/re-rendered");
|
|
4942
|
-
const [isLoggedIn, setIsLoggedIn] = (0,
|
|
4943
|
-
const [showSessionExpiredMessage, setShowSessionExpiredMessage] = (0,
|
|
4944
|
-
const isRedirectingRef = (0,
|
|
4945
|
-
const huboSesionRef = (0,
|
|
4946
|
-
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);
|
|
4947
5332
|
const dispatch = (0, import_react_redux2.useDispatch)();
|
|
4948
5333
|
const clientContext = (0, import_react_redux2.useSelector)((state) => state.clientContext);
|
|
4949
5334
|
if (clientContext.status === "succeeded" && !cierreVoluntarioRef.current) huboSesionRef.current = true;
|
|
4950
|
-
const navigate = (0,
|
|
4951
|
-
const handleExpiredSessionRedirect = (0,
|
|
5335
|
+
const navigate = (0, import_react_router_dom2.useNavigate)();
|
|
5336
|
+
const handleExpiredSessionRedirect = (0, import_react29.useCallback)(() => {
|
|
4952
5337
|
isRedirectingRef.current = true;
|
|
4953
5338
|
setShowSessionExpiredMessage(false);
|
|
4954
5339
|
setIsLoggedIn(false);
|
|
@@ -4957,23 +5342,23 @@ var AppProvider = ({ children, publicPaths = [] }) => {
|
|
|
4957
5342
|
isRedirectingRef.current = false;
|
|
4958
5343
|
}, 2e3);
|
|
4959
5344
|
}, [navigate]);
|
|
4960
|
-
const avisarCierreVoluntario = (0,
|
|
5345
|
+
const avisarCierreVoluntario = (0, import_react29.useCallback)((activo) => {
|
|
4961
5346
|
cierreVoluntarioRef.current = activo;
|
|
4962
5347
|
marcarCierreVoluntario(activo);
|
|
4963
5348
|
if (activo) huboSesionRef.current = false;
|
|
4964
5349
|
}, []);
|
|
4965
|
-
const limpiarContextoPorSesionPerdida = (0,
|
|
5350
|
+
const limpiarContextoPorSesionPerdida = (0, import_react29.useCallback)(() => {
|
|
4966
5351
|
if (clientContext.status === "succeeded" && clientContext.username !== "" && !cierreVoluntarioRef.current) {
|
|
4967
5352
|
dispatch(setRedirectUsername(clientContext.username));
|
|
4968
5353
|
}
|
|
4969
5354
|
dispatch(clearClientContext());
|
|
4970
5355
|
}, [dispatch, clientContext.status, clientContext.username]);
|
|
4971
|
-
const location = (0,
|
|
4972
|
-
const isCurrentPathPublic = (0,
|
|
5356
|
+
const location = (0, import_react_router_dom2.useLocation)();
|
|
5357
|
+
const isCurrentPathPublic = (0, import_react29.useCallback)(() => {
|
|
4973
5358
|
const current = location.pathname;
|
|
4974
5359
|
return publicPaths.some((path) => current === path || current.startsWith(`${path}/`));
|
|
4975
5360
|
}, [location.pathname, publicPaths]);
|
|
4976
|
-
const checkSession = (0,
|
|
5361
|
+
const checkSession = (0, import_react29.useCallback)(async () => {
|
|
4977
5362
|
if (isRedirectingRef.current) return;
|
|
4978
5363
|
try {
|
|
4979
5364
|
const response = await fetchApi("/keep-alive.json", { method: "GET" });
|
|
@@ -5011,14 +5396,14 @@ var AppProvider = ({ children, publicPaths = [] }) => {
|
|
|
5011
5396
|
}
|
|
5012
5397
|
}
|
|
5013
5398
|
}, [dispatch, clientContext.status, showSessionExpiredMessage, isCurrentPathPublic, limpiarContextoPorSesionPerdida]);
|
|
5014
|
-
(0,
|
|
5399
|
+
(0, import_react29.useEffect)(() => {
|
|
5015
5400
|
checkSession();
|
|
5016
5401
|
const intervalId = setInterval(checkSession, 15 * 1e3);
|
|
5017
5402
|
return () => {
|
|
5018
5403
|
clearInterval(intervalId);
|
|
5019
5404
|
};
|
|
5020
5405
|
}, [checkSession]);
|
|
5021
|
-
const authContextValue = (0,
|
|
5406
|
+
const authContextValue = (0, import_react29.useMemo)(() => ({
|
|
5022
5407
|
isLoggedIn,
|
|
5023
5408
|
setIsLoggedIn,
|
|
5024
5409
|
checkSession,
|
|
@@ -5035,19 +5420,19 @@ var AppProvider = ({ children, publicPaths = [] }) => {
|
|
|
5035
5420
|
handleExpiredSessionRedirect,
|
|
5036
5421
|
avisarCierreVoluntario
|
|
5037
5422
|
]);
|
|
5038
|
-
return /* @__PURE__ */ (0,
|
|
5423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AuthContext.Provider, { value: authContextValue, children });
|
|
5039
5424
|
};
|
|
5040
5425
|
|
|
5041
5426
|
// src/components/MainLayout.tsx
|
|
5042
|
-
var
|
|
5427
|
+
var import_react_router_dom6 = require("react-router-dom");
|
|
5043
5428
|
var import_Logout = __toESM(require("@mui/icons-material/Logout"), 1);
|
|
5044
5429
|
var import_VpnKey = __toESM(require("@mui/icons-material/VpnKey"), 1);
|
|
5045
5430
|
var import_Menu = __toESM(require("@mui/icons-material/Menu"), 1);
|
|
5046
5431
|
var import_ChevronLeft = __toESM(require("@mui/icons-material/ChevronLeft"), 1);
|
|
5047
5432
|
|
|
5048
5433
|
// src/components/SideMenu.tsx
|
|
5049
|
-
var
|
|
5050
|
-
var
|
|
5434
|
+
var import_react30 = __toESM(require("react"), 1);
|
|
5435
|
+
var import_material22 = require("@mui/material");
|
|
5051
5436
|
var import_ExpandLess = __toESM(require("@mui/icons-material/ExpandLess"), 1);
|
|
5052
5437
|
var import_ExpandMore = __toESM(require("@mui/icons-material/ExpandMore"), 1);
|
|
5053
5438
|
var import_TableChart = __toESM(require("@mui/icons-material/TableChart"), 1);
|
|
@@ -5057,16 +5442,9 @@ var import_WarningAmber3 = __toESM(require("@mui/icons-material/WarningAmber"),
|
|
|
5057
5442
|
var import_DesktopWindows = __toESM(require("@mui/icons-material/DesktopWindows"), 1);
|
|
5058
5443
|
var import_Search3 = __toESM(require("@mui/icons-material/Search"), 1);
|
|
5059
5444
|
var import_Clear = __toESM(require("@mui/icons-material/Clear"), 1);
|
|
5060
|
-
var
|
|
5445
|
+
var import_react_router_dom3 = require("react-router-dom");
|
|
5061
5446
|
var import_colors = require("@mui/material/colors");
|
|
5062
5447
|
|
|
5063
|
-
// src/puente/habilitacion.ts
|
|
5064
|
-
var habilitado = false;
|
|
5065
|
-
var habilitarPuenteBP = () => {
|
|
5066
|
-
habilitado = true;
|
|
5067
|
-
};
|
|
5068
|
-
var puenteBPHabilitado = () => habilitado;
|
|
5069
|
-
|
|
5070
5448
|
// src/utils/menuInicial.ts
|
|
5071
5449
|
function rutaDeTablaDeMenu(camino) {
|
|
5072
5450
|
return `/menu/${camino.map(encodeURIComponent).join("/")}`;
|
|
@@ -5147,22 +5525,22 @@ function buscarEnMenu(hojas, consulta) {
|
|
|
5147
5525
|
}
|
|
5148
5526
|
|
|
5149
5527
|
// src/components/SideMenu.tsx
|
|
5150
|
-
var
|
|
5528
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
5151
5529
|
var CLAVE_RECIENTES = "fpr.menu.recientes";
|
|
5152
5530
|
var MAXIMO_RECIENTES = 4;
|
|
5153
5531
|
var getIcon = (item, destacado = false) => {
|
|
5154
5532
|
switch (item.menuType) {
|
|
5155
5533
|
case "table":
|
|
5156
|
-
return /* @__PURE__ */ (0,
|
|
5534
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_TableChart.default, { sx: destacado ? { color: import_colors.blue[700] } : void 0 });
|
|
5157
5535
|
case "proc":
|
|
5158
|
-
return /* @__PURE__ */ (0,
|
|
5536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_Dns.default, { sx: destacado ? { color: import_colors.teal[700] } : void 0 });
|
|
5159
5537
|
case "menu":
|
|
5160
|
-
return /* @__PURE__ */ (0,
|
|
5538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_Folder.default, { sx: destacado ? { color: import_colors.orange[800] } : void 0 });
|
|
5161
5539
|
default:
|
|
5162
5540
|
if (wScreens[item.menuType] !== void 0 || puenteBPHabilitado()) {
|
|
5163
|
-
return /* @__PURE__ */ (0,
|
|
5541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_DesktopWindows.default, { sx: destacado ? { color: import_colors.indigo[500] } : void 0 });
|
|
5164
5542
|
}
|
|
5165
|
-
return /* @__PURE__ */ (0,
|
|
5543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_WarningAmber3.default, { sx: destacado ? { color: import_colors.red[500] } : void 0 });
|
|
5166
5544
|
}
|
|
5167
5545
|
};
|
|
5168
5546
|
var estaSeleccionado = (item, grupos, currentPath, hash = "") => {
|
|
@@ -5192,8 +5570,8 @@ var guardarRecientes = (recientes) => {
|
|
|
5192
5570
|
}
|
|
5193
5571
|
};
|
|
5194
5572
|
var MenuListItem = ({ item, level, grupos = [], hermanos = [], onMenuItemClick }) => {
|
|
5195
|
-
const navigate = (0,
|
|
5196
|
-
const location = (0,
|
|
5573
|
+
const navigate = (0, import_react_router_dom3.useNavigate)();
|
|
5574
|
+
const location = (0, import_react_router_dom3.useLocation)();
|
|
5197
5575
|
const clave = claveDeMenu([...grupos, item.name]);
|
|
5198
5576
|
const open = useSubMenuOpenState(clave);
|
|
5199
5577
|
const dispatch = useAppDispatch();
|
|
@@ -5212,28 +5590,28 @@ var MenuListItem = ({ item, level, grupos = [], hermanos = [], onMenuItemClick }
|
|
|
5212
5590
|
}
|
|
5213
5591
|
};
|
|
5214
5592
|
const isSelected = estaSeleccionado(item, grupos, location.pathname, location.hash);
|
|
5215
|
-
const itemRef =
|
|
5216
|
-
(0,
|
|
5593
|
+
const itemRef = import_react30.default.useRef(null);
|
|
5594
|
+
(0, import_react30.useEffect)(() => {
|
|
5217
5595
|
if (isSelected && itemRef.current) {
|
|
5218
5596
|
itemRef.current.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
5219
5597
|
}
|
|
5220
5598
|
}, [isSelected]);
|
|
5221
5599
|
const contenido = item.menuType === "menu" ? item.menuContent : [];
|
|
5222
|
-
return /* @__PURE__ */ (0,
|
|
5223
|
-
/* @__PURE__ */ (0,
|
|
5224
|
-
|
|
5600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { ref: itemRef, children: [
|
|
5601
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5602
|
+
import_material22.ListItemButton,
|
|
5225
5603
|
{
|
|
5226
5604
|
onClick: handleClick,
|
|
5227
5605
|
sx: { pl: level * 2 },
|
|
5228
5606
|
selected: isSelected,
|
|
5229
5607
|
children: [
|
|
5230
|
-
/* @__PURE__ */ (0,
|
|
5231
|
-
/* @__PURE__ */ (0,
|
|
5232
|
-
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
|
|
5233
5611
|
]
|
|
5234
5612
|
}
|
|
5235
5613
|
),
|
|
5236
|
-
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)(
|
|
5237
5615
|
MenuListItem,
|
|
5238
5616
|
{
|
|
5239
5617
|
item: subItem,
|
|
@@ -5247,14 +5625,14 @@ var MenuListItem = ({ item, level, grupos = [], hermanos = [], onMenuItemClick }
|
|
|
5247
5625
|
] });
|
|
5248
5626
|
};
|
|
5249
5627
|
var ItemPlano = ({ hoja, seleccionado, traerALaVista = false, onElegir }) => {
|
|
5250
|
-
const boton = (0,
|
|
5251
|
-
(0,
|
|
5628
|
+
const boton = (0, import_react30.useRef)(null);
|
|
5629
|
+
(0, import_react30.useEffect)(() => {
|
|
5252
5630
|
if (traerALaVista && seleccionado) boton.current?.scrollIntoView({ block: "nearest" });
|
|
5253
5631
|
}, [traerALaVista, seleccionado]);
|
|
5254
|
-
return /* @__PURE__ */ (0,
|
|
5255
|
-
/* @__PURE__ */ (0,
|
|
5256
|
-
/* @__PURE__ */ (0,
|
|
5257
|
-
|
|
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,
|
|
5258
5636
|
{
|
|
5259
5637
|
primary: etiquetaDeItem(hoja.item),
|
|
5260
5638
|
secondary: hoja.etiquetasDeGrupos.join(" \u203A ") || void 0,
|
|
@@ -5265,17 +5643,17 @@ var ItemPlano = ({ hoja, seleccionado, traerALaVista = false, onElegir }) => {
|
|
|
5265
5643
|
};
|
|
5266
5644
|
var SideMenu = ({ onMenuItemClick }) => {
|
|
5267
5645
|
const { clientContext } = useApp();
|
|
5268
|
-
const navigate = (0,
|
|
5269
|
-
const location = (0,
|
|
5646
|
+
const navigate = (0, import_react_router_dom3.useNavigate)();
|
|
5647
|
+
const location = (0, import_react_router_dom3.useLocation)();
|
|
5270
5648
|
const dispatch = useAppDispatch();
|
|
5271
|
-
const [consulta, setConsulta] = (0,
|
|
5272
|
-
const [indice, setIndice] = (0,
|
|
5273
|
-
const [recientes, setRecientes] = (0,
|
|
5274
|
-
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);
|
|
5275
5653
|
const menu = clientContext?.menu;
|
|
5276
|
-
const hojas = (0,
|
|
5277
|
-
const resultados = (0,
|
|
5278
|
-
(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)(() => {
|
|
5279
5657
|
const alApretar = (evento) => {
|
|
5280
5658
|
if ((evento.ctrlKey || evento.metaKey) && !evento.altKey && !evento.shiftKey && evento.key.toLowerCase() === "k") {
|
|
5281
5659
|
evento.preventDefault();
|
|
@@ -5289,7 +5667,7 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5289
5667
|
window.addEventListener("keydown", alApretar);
|
|
5290
5668
|
return () => window.removeEventListener("keydown", alApretar);
|
|
5291
5669
|
}, [dispatch]);
|
|
5292
|
-
(0,
|
|
5670
|
+
(0, import_react30.useEffect)(() => {
|
|
5293
5671
|
const actual = hojas.find((hoja) => estaSeleccionado(hoja.item, hoja.grupos, location.pathname, location.hash));
|
|
5294
5672
|
if (!actual) return;
|
|
5295
5673
|
dispatch(abrirCamino(actual.grupos.map((_, i) => claveDeMenu(actual.grupos.slice(0, i + 1)))));
|
|
@@ -5301,7 +5679,7 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5301
5679
|
});
|
|
5302
5680
|
}, [location.pathname, location.hash, hojas, dispatch]);
|
|
5303
5681
|
if (!menu) {
|
|
5304
|
-
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..." }) });
|
|
5305
5683
|
}
|
|
5306
5684
|
const elegir = (hoja) => {
|
|
5307
5685
|
navigate(rutaDeItemDeMenu(hoja.item, hoja.grupos));
|
|
@@ -5326,9 +5704,9 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5326
5704
|
}
|
|
5327
5705
|
};
|
|
5328
5706
|
const hojasRecientes = recientes.map((clave) => hojas.find((hoja) => hoja.clave === clave)).filter((hoja) => hoja !== void 0);
|
|
5329
|
-
return /* @__PURE__ */ (0,
|
|
5330
|
-
/* @__PURE__ */ (0,
|
|
5331
|
-
|
|
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,
|
|
5332
5710
|
{
|
|
5333
5711
|
inputRef: campoDeBusqueda,
|
|
5334
5712
|
value: consulta,
|
|
@@ -5343,19 +5721,19 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5343
5721
|
autoComplete: "off",
|
|
5344
5722
|
sx: { "& .MuiInputBase-input": { fontSize: "0.8rem" } },
|
|
5345
5723
|
InputProps: {
|
|
5346
|
-
startAdornment: /* @__PURE__ */ (0,
|
|
5347
|
-
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: () => {
|
|
5348
5726
|
setConsulta("");
|
|
5349
5727
|
campoDeBusqueda.current?.focus();
|
|
5350
|
-
}, children: /* @__PURE__ */ (0,
|
|
5728
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_Clear.default, { fontSize: "small" }) }) }) : void 0
|
|
5351
5729
|
}
|
|
5352
5730
|
}
|
|
5353
5731
|
) }),
|
|
5354
|
-
/* @__PURE__ */ (0,
|
|
5355
|
-
/* @__PURE__ */ (0,
|
|
5356
|
-
hojasRecientes.length > 0 && /* @__PURE__ */ (0,
|
|
5357
|
-
/* @__PURE__ */ (0,
|
|
5358
|
-
/* @__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)(
|
|
5359
5737
|
ItemPlano,
|
|
5360
5738
|
{
|
|
5361
5739
|
hoja,
|
|
@@ -5364,9 +5742,9 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5364
5742
|
},
|
|
5365
5743
|
hoja.clave
|
|
5366
5744
|
)) }),
|
|
5367
|
-
/* @__PURE__ */ (0,
|
|
5745
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.Divider, {})
|
|
5368
5746
|
] }),
|
|
5369
|
-
/* @__PURE__ */ (0,
|
|
5747
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.List, { children: menu.map((menuItem) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5370
5748
|
MenuListItem,
|
|
5371
5749
|
{
|
|
5372
5750
|
item: menuItem,
|
|
@@ -5382,14 +5760,14 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5382
5760
|
var SideMenu_default = SideMenu;
|
|
5383
5761
|
|
|
5384
5762
|
// src/hooks/useLogout.tsx
|
|
5385
|
-
var
|
|
5386
|
-
var
|
|
5763
|
+
var import_react31 = require("react");
|
|
5764
|
+
var import_react_router_dom4 = require("react-router-dom");
|
|
5387
5765
|
var import_react_redux3 = require("react-redux");
|
|
5388
5766
|
var useLogout = () => {
|
|
5389
5767
|
const { setIsLoggedIn, avisarCierreVoluntario } = useApp();
|
|
5390
5768
|
const dispatch = (0, import_react_redux3.useDispatch)();
|
|
5391
|
-
const navigate = (0,
|
|
5392
|
-
const logout = (0,
|
|
5769
|
+
const navigate = (0, import_react_router_dom4.useNavigate)();
|
|
5770
|
+
const logout = (0, import_react31.useCallback)(async () => {
|
|
5393
5771
|
avisarCierreVoluntario(true);
|
|
5394
5772
|
try {
|
|
5395
5773
|
const response = await fetchApi("/logout", { method: "GET" });
|
|
@@ -5412,17 +5790,17 @@ var useLogout = () => {
|
|
|
5412
5790
|
var useLogout_default = useLogout;
|
|
5413
5791
|
|
|
5414
5792
|
// src/components/MainLayout.tsx
|
|
5415
|
-
var
|
|
5793
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5416
5794
|
var drawerWidth = 240;
|
|
5417
5795
|
var MainLayout = () => {
|
|
5418
5796
|
const { clientContext } = useApp();
|
|
5419
5797
|
const logout = useLogout_default();
|
|
5420
|
-
const navigate = (0,
|
|
5798
|
+
const navigate = (0, import_react_router_dom6.useNavigate)();
|
|
5421
5799
|
const isDrawerOpen = useIsDrawerOpen();
|
|
5422
5800
|
const dispatch = useAppDispatch();
|
|
5423
|
-
const theme = (0,
|
|
5424
|
-
const isMobile = (0,
|
|
5425
|
-
(0,
|
|
5801
|
+
const theme = (0, import_material23.useTheme)();
|
|
5802
|
+
const isMobile = (0, import_material23.useMediaQuery)(theme.breakpoints.down("sm"));
|
|
5803
|
+
(0, import_react32.useEffect)(() => {
|
|
5426
5804
|
if (isMobile && isDrawerOpen) {
|
|
5427
5805
|
dispatch(setDrawerOpen(false));
|
|
5428
5806
|
}
|
|
@@ -5436,12 +5814,12 @@ var MainLayout = () => {
|
|
|
5436
5814
|
}
|
|
5437
5815
|
};
|
|
5438
5816
|
if (!clientContext) {
|
|
5439
|
-
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..." }) });
|
|
5440
5818
|
}
|
|
5441
|
-
return /* @__PURE__ */ (0,
|
|
5442
|
-
/* @__PURE__ */ (0,
|
|
5443
|
-
/* @__PURE__ */ (0,
|
|
5444
|
-
|
|
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,
|
|
5445
5823
|
{
|
|
5446
5824
|
position: "fixed",
|
|
5447
5825
|
sx: {
|
|
@@ -5459,9 +5837,9 @@ var MainLayout = () => {
|
|
|
5459
5837
|
})
|
|
5460
5838
|
}
|
|
5461
5839
|
},
|
|
5462
|
-
children: /* @__PURE__ */ (0,
|
|
5463
|
-
/* @__PURE__ */ (0,
|
|
5464
|
-
|
|
5840
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_material23.Toolbar, { children: [
|
|
5841
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5842
|
+
import_material23.IconButton,
|
|
5465
5843
|
{
|
|
5466
5844
|
color: "inherit",
|
|
5467
5845
|
"aria-label": "open drawer",
|
|
@@ -5470,10 +5848,10 @@ var MainLayout = () => {
|
|
|
5470
5848
|
sx: {
|
|
5471
5849
|
marginRight: 2
|
|
5472
5850
|
},
|
|
5473
|
-
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, {})
|
|
5474
5852
|
}
|
|
5475
5853
|
),
|
|
5476
|
-
!isDrawerOpen && /* @__PURE__ */ (0,
|
|
5854
|
+
!isDrawerOpen && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5477
5855
|
"img",
|
|
5478
5856
|
{
|
|
5479
5857
|
src: `${envConfig.backendUrl}/img/logo-128.png`,
|
|
@@ -5481,23 +5859,23 @@ var MainLayout = () => {
|
|
|
5481
5859
|
style: { height: "32px", marginRight: "12px", objectFit: "contain" }
|
|
5482
5860
|
}
|
|
5483
5861
|
),
|
|
5484
|
-
/* @__PURE__ */ (0,
|
|
5485
|
-
/* @__PURE__ */ (0,
|
|
5486
|
-
/* @__PURE__ */ (0,
|
|
5487
|
-
/* @__PURE__ */ (0,
|
|
5488
|
-
|
|
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,
|
|
5489
5867
|
{
|
|
5490
5868
|
color: "inherit",
|
|
5491
5869
|
onClick: logout,
|
|
5492
|
-
startIcon: /* @__PURE__ */ (0,
|
|
5870
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_Logout.default, {}),
|
|
5493
5871
|
children: "Salir"
|
|
5494
5872
|
}
|
|
5495
5873
|
)
|
|
5496
5874
|
] })
|
|
5497
5875
|
}
|
|
5498
5876
|
),
|
|
5499
|
-
/* @__PURE__ */ (0,
|
|
5500
|
-
|
|
5877
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5878
|
+
import_material23.Drawer,
|
|
5501
5879
|
{
|
|
5502
5880
|
variant: "persistent",
|
|
5503
5881
|
anchor: "left",
|
|
@@ -5514,8 +5892,8 @@ var MainLayout = () => {
|
|
|
5514
5892
|
}
|
|
5515
5893
|
},
|
|
5516
5894
|
children: [
|
|
5517
|
-
/* @__PURE__ */ (0,
|
|
5518
|
-
|
|
5895
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5896
|
+
import_material23.Toolbar,
|
|
5519
5897
|
{
|
|
5520
5898
|
sx: {
|
|
5521
5899
|
display: "flex",
|
|
@@ -5529,7 +5907,7 @@ var MainLayout = () => {
|
|
|
5529
5907
|
gap: 1.5
|
|
5530
5908
|
},
|
|
5531
5909
|
children: [
|
|
5532
|
-
/* @__PURE__ */ (0,
|
|
5910
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5533
5911
|
"img",
|
|
5534
5912
|
{
|
|
5535
5913
|
src: `${envConfig.backendUrl}/img/logo-128.png`,
|
|
@@ -5537,16 +5915,16 @@ var MainLayout = () => {
|
|
|
5537
5915
|
style: { height: "32px", objectFit: "contain" }
|
|
5538
5916
|
}
|
|
5539
5917
|
),
|
|
5540
|
-
/* @__PURE__ */ (0,
|
|
5918
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Typography, { variant: "h6", sx: { fontWeight: "bold" }, children: clientContext.config.title })
|
|
5541
5919
|
]
|
|
5542
5920
|
}
|
|
5543
5921
|
),
|
|
5544
|
-
/* @__PURE__ */ (0,
|
|
5922
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SideMenu_default, { onMenuItemClick: handleDrawerCloseMobile })
|
|
5545
5923
|
]
|
|
5546
5924
|
}
|
|
5547
5925
|
),
|
|
5548
|
-
/* @__PURE__ */ (0,
|
|
5549
|
-
|
|
5926
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5927
|
+
import_material23.Box,
|
|
5550
5928
|
{
|
|
5551
5929
|
component: "main",
|
|
5552
5930
|
sx: {
|
|
@@ -5572,8 +5950,8 @@ var MainLayout = () => {
|
|
|
5572
5950
|
width: isDrawerOpen ? `calc(100% - ${drawerWidth}px)` : "100%"
|
|
5573
5951
|
},
|
|
5574
5952
|
children: [
|
|
5575
|
-
/* @__PURE__ */ (0,
|
|
5576
|
-
/* @__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, {}) })
|
|
5577
5955
|
]
|
|
5578
5956
|
}
|
|
5579
5957
|
)
|
|
@@ -5582,8 +5960,8 @@ var MainLayout = () => {
|
|
|
5582
5960
|
var MainLayout_default = MainLayout;
|
|
5583
5961
|
|
|
5584
5962
|
// src/components/SessionExpiredMessage.tsx
|
|
5585
|
-
var
|
|
5586
|
-
var
|
|
5963
|
+
var import_material24 = require("@mui/material");
|
|
5964
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5587
5965
|
var style = {
|
|
5588
5966
|
position: "absolute",
|
|
5589
5967
|
top: "50%",
|
|
@@ -5602,8 +5980,8 @@ var SessionExpiredMessage = () => {
|
|
|
5602
5980
|
const handleClose = () => {
|
|
5603
5981
|
handleExpiredSessionRedirect();
|
|
5604
5982
|
};
|
|
5605
|
-
return /* @__PURE__ */ (0,
|
|
5606
|
-
|
|
5983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5984
|
+
import_material24.Modal,
|
|
5607
5985
|
{
|
|
5608
5986
|
open: showSessionExpiredMessage,
|
|
5609
5987
|
onClose: () => {
|
|
@@ -5622,10 +6000,10 @@ var SessionExpiredMessage = () => {
|
|
|
5622
6000
|
}
|
|
5623
6001
|
}
|
|
5624
6002
|
},
|
|
5625
|
-
children: /* @__PURE__ */ (0,
|
|
5626
|
-
/* @__PURE__ */ (0,
|
|
5627
|
-
/* @__PURE__ */ (0,
|
|
5628
|
-
/* @__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" })
|
|
5629
6007
|
] })
|
|
5630
6008
|
}
|
|
5631
6009
|
);
|
|
@@ -5633,25 +6011,25 @@ var SessionExpiredMessage = () => {
|
|
|
5633
6011
|
var SessionExpiredMessage_default = SessionExpiredMessage;
|
|
5634
6012
|
|
|
5635
6013
|
// src/pages/PantallaInicial.tsx
|
|
5636
|
-
var
|
|
5637
|
-
var
|
|
6014
|
+
var import_react_router_dom7 = require("react-router-dom");
|
|
6015
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5638
6016
|
var PantallaInicial = () => {
|
|
5639
6017
|
const { clientContext } = useApp();
|
|
5640
6018
|
const item = clientContext.menu ? itemInicial(clientContext.menu) : void 0;
|
|
5641
|
-
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;
|
|
5642
6020
|
};
|
|
5643
6021
|
var PantallaInicial_default = PantallaInicial;
|
|
5644
6022
|
|
|
5645
6023
|
// src/pages/LogoutPage.tsx
|
|
5646
|
-
var
|
|
5647
|
-
var
|
|
5648
|
-
var
|
|
6024
|
+
var import_react33 = require("react");
|
|
6025
|
+
var import_material25 = require("@mui/material");
|
|
6026
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5649
6027
|
var LogoutPage = () => {
|
|
5650
6028
|
const logout = useLogout_default();
|
|
5651
|
-
(0,
|
|
6029
|
+
(0, import_react33.useEffect)(() => {
|
|
5652
6030
|
logout();
|
|
5653
6031
|
}, [logout]);
|
|
5654
|
-
return /* @__PURE__ */ (0,
|
|
6032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_material25.Box, { sx: {
|
|
5655
6033
|
display: "flex",
|
|
5656
6034
|
flexDirection: "column",
|
|
5657
6035
|
justifyContent: "center",
|
|
@@ -5659,16 +6037,16 @@ var LogoutPage = () => {
|
|
|
5659
6037
|
height: "100vh",
|
|
5660
6038
|
textAlign: "center"
|
|
5661
6039
|
}, children: [
|
|
5662
|
-
/* @__PURE__ */ (0,
|
|
5663
|
-
/* @__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..." })
|
|
5664
6042
|
] });
|
|
5665
6043
|
};
|
|
5666
6044
|
var LogoutPage_default = LogoutPage;
|
|
5667
6045
|
|
|
5668
6046
|
// src/pages/LoginPage.tsx
|
|
5669
|
-
var
|
|
5670
|
-
var
|
|
5671
|
-
var
|
|
6047
|
+
var import_react34 = require("react");
|
|
6048
|
+
var import_material26 = require("@mui/material");
|
|
6049
|
+
var import_react_router_dom8 = require("react-router-dom");
|
|
5672
6050
|
|
|
5673
6051
|
// src/pages/configuracionLogin.ts
|
|
5674
6052
|
var RUTA_POR_OMISION = "/new-pass";
|
|
@@ -5683,7 +6061,7 @@ var import_react_hook_form = require("react-hook-form");
|
|
|
5683
6061
|
var import_zod = require("@hookform/resolvers/zod");
|
|
5684
6062
|
var z = __toESM(require("zod"), 1);
|
|
5685
6063
|
var import_react_redux4 = require("react-redux");
|
|
5686
|
-
var
|
|
6064
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
5687
6065
|
var loginSchema = z.object({
|
|
5688
6066
|
username: z.string().min(1, "El usuario es requerido"),
|
|
5689
6067
|
// Añadir validación básica
|
|
@@ -5691,9 +6069,9 @@ var loginSchema = z.object({
|
|
|
5691
6069
|
// Añadir validación básica
|
|
5692
6070
|
});
|
|
5693
6071
|
var LoginPage = () => {
|
|
5694
|
-
const [loginError, setLoginError] = (0,
|
|
5695
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
5696
|
-
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;
|
|
5697
6075
|
const claveCambiada = typeof estadoDeLaRuta === "object" && estadoDeLaRuta !== null && "claveCambiada" in estadoDeLaRuta && estadoDeLaRuta.claveCambiada === true;
|
|
5698
6076
|
const rutaDeRecuperarClave2 = rutaParaRecuperarClave();
|
|
5699
6077
|
const { setIsLoggedIn, checkSession, avisarCierreVoluntario } = useApp();
|
|
@@ -5741,16 +6119,16 @@ var LoginPage = () => {
|
|
|
5741
6119
|
setIsSubmitting(false);
|
|
5742
6120
|
}
|
|
5743
6121
|
};
|
|
5744
|
-
return /* @__PURE__ */ (0,
|
|
5745
|
-
|
|
6122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6123
|
+
import_material26.Box,
|
|
5746
6124
|
{
|
|
5747
6125
|
display: "flex",
|
|
5748
6126
|
alignItems: "center",
|
|
5749
6127
|
justifyContent: "center",
|
|
5750
6128
|
minHeight: "100vh",
|
|
5751
6129
|
bgcolor: "#f5f5f5",
|
|
5752
|
-
children: /* @__PURE__ */ (0,
|
|
5753
|
-
|
|
6130
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
6131
|
+
import_material26.Box,
|
|
5754
6132
|
{
|
|
5755
6133
|
width: "100%",
|
|
5756
6134
|
maxWidth: "400px",
|
|
@@ -5759,7 +6137,7 @@ var LoginPage = () => {
|
|
|
5759
6137
|
borderRadius: 8,
|
|
5760
6138
|
boxShadow: 3,
|
|
5761
6139
|
children: [
|
|
5762
|
-
/* @__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)(
|
|
5763
6141
|
"img",
|
|
5764
6142
|
{
|
|
5765
6143
|
src: `${envConfig.backendUrl}/img/login-logo-icon.png`,
|
|
@@ -5767,8 +6145,8 @@ var LoginPage = () => {
|
|
|
5767
6145
|
style: { height: "192px", maxWidth: "100%", objectFit: "contain" }
|
|
5768
6146
|
}
|
|
5769
6147
|
) }),
|
|
5770
|
-
/* @__PURE__ */ (0,
|
|
5771
|
-
/* @__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)(
|
|
5772
6150
|
"form",
|
|
5773
6151
|
{
|
|
5774
6152
|
onSubmit: handleSubmit(onSubmit),
|
|
@@ -5780,15 +6158,15 @@ var LoginPage = () => {
|
|
|
5780
6158
|
if (!isSubmitting) void handleSubmit(onSubmit)();
|
|
5781
6159
|
},
|
|
5782
6160
|
children: [
|
|
5783
|
-
/* @__PURE__ */ (0,
|
|
5784
|
-
/* @__PURE__ */ (0,
|
|
5785
|
-
/* @__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)(
|
|
5786
6164
|
import_react_hook_form.Controller,
|
|
5787
6165
|
{
|
|
5788
6166
|
name: "username",
|
|
5789
6167
|
control,
|
|
5790
|
-
render: ({ field }) => /* @__PURE__ */ (0,
|
|
5791
|
-
|
|
6168
|
+
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6169
|
+
import_material26.TextField,
|
|
5792
6170
|
{
|
|
5793
6171
|
...field,
|
|
5794
6172
|
type: "text",
|
|
@@ -5805,15 +6183,15 @@ var LoginPage = () => {
|
|
|
5805
6183
|
}
|
|
5806
6184
|
)
|
|
5807
6185
|
] }),
|
|
5808
|
-
/* @__PURE__ */ (0,
|
|
5809
|
-
/* @__PURE__ */ (0,
|
|
5810
|
-
/* @__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)(
|
|
5811
6189
|
import_react_hook_form.Controller,
|
|
5812
6190
|
{
|
|
5813
6191
|
name: "password",
|
|
5814
6192
|
control,
|
|
5815
|
-
render: ({ field }) => /* @__PURE__ */ (0,
|
|
5816
|
-
|
|
6193
|
+
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
6194
|
+
import_material26.TextField,
|
|
5817
6195
|
{
|
|
5818
6196
|
...field,
|
|
5819
6197
|
type: "password",
|
|
@@ -5830,18 +6208,18 @@ var LoginPage = () => {
|
|
|
5830
6208
|
}
|
|
5831
6209
|
)
|
|
5832
6210
|
] }),
|
|
5833
|
-
/* @__PURE__ */ (0,
|
|
5834
|
-
/* @__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 } }),
|
|
5835
6213
|
"Iniciando sesi\xF3n..."
|
|
5836
6214
|
] }) : "Iniciar Sesi\xF3n" })
|
|
5837
6215
|
]
|
|
5838
6216
|
}
|
|
5839
6217
|
),
|
|
5840
|
-
rutaDeRecuperarClave2 && /* @__PURE__ */ (0,
|
|
5841
|
-
claveCambiada && !loginError && /* @__PURE__ */ (0,
|
|
5842
|
-
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: [
|
|
5843
6221
|
" ",
|
|
5844
|
-
/* @__PURE__ */ (0,
|
|
6222
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material26.AlertTitle, { children: "Error" }),
|
|
5845
6223
|
loginError
|
|
5846
6224
|
] })
|
|
5847
6225
|
]
|
|
@@ -5853,19 +6231,19 @@ var LoginPage = () => {
|
|
|
5853
6231
|
var LoginPage_default = LoginPage;
|
|
5854
6232
|
|
|
5855
6233
|
// src/components/ProcedureForm.tsx
|
|
5856
|
-
var
|
|
5857
|
-
var
|
|
5858
|
-
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");
|
|
5859
6237
|
|
|
5860
6238
|
// src/pages/procedure-results/SuccessDisplay.tsx
|
|
5861
|
-
var
|
|
5862
|
-
var
|
|
6239
|
+
var import_material27 = require("@mui/material");
|
|
6240
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
5863
6241
|
var SuccessDisplay = ({ data }) => {
|
|
5864
|
-
return /* @__PURE__ */ (0,
|
|
5865
|
-
/* @__PURE__ */ (0,
|
|
5866
|
-
/* @__PURE__ */ (0,
|
|
5867
|
-
/* @__PURE__ */ (0,
|
|
5868
|
-
/* @__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." })
|
|
5869
6247
|
] });
|
|
5870
6248
|
};
|
|
5871
6249
|
var SuccessDisplay_default = SuccessDisplay;
|
|
@@ -5879,22 +6257,22 @@ var extendResultsOk = (newComponents) => {
|
|
|
5879
6257
|
};
|
|
5880
6258
|
|
|
5881
6259
|
// src/components/ProcedureForm.tsx
|
|
5882
|
-
var
|
|
6260
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
5883
6261
|
var ProcedureForm = () => {
|
|
5884
|
-
const { procedureName } = (0,
|
|
6262
|
+
const { procedureName } = (0, import_react_router_dom9.useParams)();
|
|
5885
6263
|
const { clientContext } = useApp();
|
|
5886
6264
|
const { callApi, loading: apiLoading, error: apiError } = useApiCall();
|
|
5887
|
-
const [validationErrors, setValidationErrors] = (0,
|
|
5888
|
-
const [successMessage, setSuccessMessage] = (0,
|
|
5889
|
-
const [executionLog, setExecutionLog] = (0,
|
|
5890
|
-
const [procedureResultData, setProcedureResultData] = (0,
|
|
5891
|
-
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)(() => {
|
|
5892
6270
|
if (procedureName && clientContext?.procedure) {
|
|
5893
6271
|
return clientContext.procedure[procedureName];
|
|
5894
6272
|
}
|
|
5895
6273
|
return void 0;
|
|
5896
6274
|
}, [procedureName, clientContext]);
|
|
5897
|
-
const [formValues, setFormValues] = (0,
|
|
6275
|
+
const [formValues, setFormValues] = (0, import_react35.useState)(() => {
|
|
5898
6276
|
if (!procedure) return {};
|
|
5899
6277
|
const initialValues = {};
|
|
5900
6278
|
procedure.parameters.forEach((param) => {
|
|
@@ -5919,7 +6297,7 @@ var ProcedureForm = () => {
|
|
|
5919
6297
|
});
|
|
5920
6298
|
return initialValues;
|
|
5921
6299
|
});
|
|
5922
|
-
|
|
6300
|
+
import_react35.default.useEffect(() => {
|
|
5923
6301
|
if (procedure) {
|
|
5924
6302
|
setValidationErrors({});
|
|
5925
6303
|
setSuccessMessage(null);
|
|
@@ -5949,11 +6327,11 @@ var ProcedureForm = () => {
|
|
|
5949
6327
|
setExecutionLog([]);
|
|
5950
6328
|
}
|
|
5951
6329
|
}, [procedure]);
|
|
5952
|
-
const addLogMessage = (0,
|
|
6330
|
+
const addLogMessage = (0, import_react35.useCallback)((message, isError = false) => {
|
|
5953
6331
|
const timestamp = (/* @__PURE__ */ new Date()).toLocaleTimeString("es-AR");
|
|
5954
6332
|
setExecutionLog((prev) => [...prev, `[${timestamp}] ${isError ? "ERROR: " : ""}${message}`]);
|
|
5955
6333
|
}, []);
|
|
5956
|
-
const handleChange = (0,
|
|
6334
|
+
const handleChange = (0, import_react35.useCallback)((e, child) => {
|
|
5957
6335
|
const { name, value } = e.target;
|
|
5958
6336
|
let newValue = value;
|
|
5959
6337
|
if (e.target.type === "checkbox") {
|
|
@@ -6075,7 +6453,7 @@ var ProcedureForm = () => {
|
|
|
6075
6453
|
addLogMessage("Ejecuci\xF3n finalizada.");
|
|
6076
6454
|
}
|
|
6077
6455
|
};
|
|
6078
|
-
const renderInputField = (0,
|
|
6456
|
+
const renderInputField = (0, import_react35.useCallback)((param) => {
|
|
6079
6457
|
const hasError = !!validationErrors[param.name];
|
|
6080
6458
|
const errorMessage = validationErrors[param.name];
|
|
6081
6459
|
const commonProps = {
|
|
@@ -6094,10 +6472,10 @@ var ProcedureForm = () => {
|
|
|
6094
6472
|
sx: { fontSize: "0.8rem" }
|
|
6095
6473
|
};
|
|
6096
6474
|
if (param.options && param.options.length > 0) {
|
|
6097
|
-
return /* @__PURE__ */ (0,
|
|
6098
|
-
/* @__PURE__ */ (0,
|
|
6099
|
-
/* @__PURE__ */ (0,
|
|
6100
|
-
|
|
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,
|
|
6101
6479
|
{
|
|
6102
6480
|
labelId: `${param.name}-label`,
|
|
6103
6481
|
value: formValues[param.name] === void 0 ? "" : formValues[param.name],
|
|
@@ -6107,14 +6485,14 @@ var ProcedureForm = () => {
|
|
|
6107
6485
|
label: param.label || param.name,
|
|
6108
6486
|
disabled: apiLoading,
|
|
6109
6487
|
sx: { fontSize: "0.8rem" },
|
|
6110
|
-
renderValue: (selected) => /* @__PURE__ */ (0,
|
|
6488
|
+
renderValue: (selected) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.Typography, { sx: { fontSize: "0.8rem" }, children: selected }),
|
|
6111
6489
|
children: [
|
|
6112
|
-
(!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */ (0,
|
|
6113
|
-
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))
|
|
6114
6492
|
]
|
|
6115
6493
|
}
|
|
6116
6494
|
),
|
|
6117
|
-
(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 })
|
|
6118
6496
|
] });
|
|
6119
6497
|
}
|
|
6120
6498
|
switch (param.typeName) {
|
|
@@ -6123,19 +6501,19 @@ var ProcedureForm = () => {
|
|
|
6123
6501
|
case "tsrange":
|
|
6124
6502
|
case "time_range":
|
|
6125
6503
|
case "daterange":
|
|
6126
|
-
return /* @__PURE__ */ (0,
|
|
6504
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.TextField, { type: "text", value: formValues[param.name] || "", ...commonProps });
|
|
6127
6505
|
case "decimal":
|
|
6128
6506
|
case "double":
|
|
6129
|
-
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 });
|
|
6130
6508
|
case "integer":
|
|
6131
6509
|
case "bigint":
|
|
6132
|
-
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 });
|
|
6133
6511
|
case "boolean":
|
|
6134
|
-
return /* @__PURE__ */ (0,
|
|
6135
|
-
|
|
6512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6513
|
+
import_material28.FormControlLabel,
|
|
6136
6514
|
{
|
|
6137
|
-
control: /* @__PURE__ */ (0,
|
|
6138
|
-
|
|
6515
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6516
|
+
import_material28.Checkbox,
|
|
6139
6517
|
{
|
|
6140
6518
|
checked: !!formValues[param.name],
|
|
6141
6519
|
onChange: handleChange,
|
|
@@ -6145,21 +6523,21 @@ var ProcedureForm = () => {
|
|
|
6145
6523
|
size: "small"
|
|
6146
6524
|
}
|
|
6147
6525
|
),
|
|
6148
|
-
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 }),
|
|
6149
6527
|
sx: { mt: 1, mb: 0 }
|
|
6150
6528
|
}
|
|
6151
6529
|
);
|
|
6152
6530
|
case "date":
|
|
6153
6531
|
case "timestamp":
|
|
6154
6532
|
case "time":
|
|
6155
|
-
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" } } });
|
|
6156
6534
|
case "jsonb":
|
|
6157
6535
|
case "jsona":
|
|
6158
|
-
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" } } });
|
|
6159
6537
|
case "bytea":
|
|
6160
|
-
return /* @__PURE__ */ (0,
|
|
6161
|
-
/* @__PURE__ */ (0,
|
|
6162
|
-
/* @__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)(
|
|
6163
6541
|
"input",
|
|
6164
6542
|
{
|
|
6165
6543
|
type: "file",
|
|
@@ -6173,34 +6551,34 @@ var ProcedureForm = () => {
|
|
|
6173
6551
|
style: { padding: "6px 0", fontSize: "0.8rem" }
|
|
6174
6552
|
}
|
|
6175
6553
|
),
|
|
6176
|
-
(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 })
|
|
6177
6555
|
] });
|
|
6178
6556
|
default:
|
|
6179
|
-
return /* @__PURE__ */ (0,
|
|
6557
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.TextField, { type: "text", value: formValues[param.name] || "", ...commonProps });
|
|
6180
6558
|
}
|
|
6181
6559
|
}, [formValues, handleChange, apiLoading, validationErrors]);
|
|
6182
|
-
const ResultDisplayContent = (0,
|
|
6560
|
+
const ResultDisplayContent = (0, import_react35.useMemo)(() => {
|
|
6183
6561
|
if (!procedureResultData || !procedure?.resultOk) return null;
|
|
6184
6562
|
const ComponentToRender = resultsOk[procedure.resultOk];
|
|
6185
6563
|
if (ComponentToRender) {
|
|
6186
|
-
return /* @__PURE__ */ (0,
|
|
6564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ComponentToRender, { data: procedureResultData });
|
|
6187
6565
|
} else {
|
|
6188
|
-
return /* @__PURE__ */ (0,
|
|
6189
|
-
/* @__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: [
|
|
6190
6568
|
"el componente para resolver el resultOk: '",
|
|
6191
6569
|
procedure.resultOk,
|
|
6192
6570
|
"' definido en el procedure no existe o no est\xE1 mapeado."
|
|
6193
6571
|
] }),
|
|
6194
|
-
/* @__PURE__ */ (0,
|
|
6572
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.Box, { sx: {
|
|
6195
6573
|
bgcolor: "warning.dark",
|
|
6196
6574
|
p: 1,
|
|
6197
6575
|
borderRadius: 1
|
|
6198
|
-
}, 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) }) })
|
|
6199
6577
|
] });
|
|
6200
6578
|
}
|
|
6201
6579
|
}, [procedureResultData, procedure]);
|
|
6202
6580
|
if (!procedure) {
|
|
6203
|
-
return /* @__PURE__ */ (0,
|
|
6581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_material28.Box, { sx: {
|
|
6204
6582
|
p: 2,
|
|
6205
6583
|
width: "100%",
|
|
6206
6584
|
boxSizing: "border-box",
|
|
@@ -6210,13 +6588,13 @@ var ProcedureForm = () => {
|
|
|
6210
6588
|
boxShadow: 3,
|
|
6211
6589
|
textAlign: "center"
|
|
6212
6590
|
}, children: [
|
|
6213
|
-
/* @__PURE__ */ (0,
|
|
6214
|
-
/* @__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..." })
|
|
6215
6593
|
] });
|
|
6216
6594
|
}
|
|
6217
6595
|
return (
|
|
6218
6596
|
// Esta es la Box más externa que ahora controlará el scroll
|
|
6219
|
-
/* @__PURE__ */ (0,
|
|
6597
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_material28.Box, { sx: {
|
|
6220
6598
|
p: 2,
|
|
6221
6599
|
ml: 1,
|
|
6222
6600
|
mt: 2,
|
|
@@ -6233,17 +6611,17 @@ var ProcedureForm = () => {
|
|
|
6233
6611
|
overflowX: "hidden"
|
|
6234
6612
|
// Oculta el scroll horizontal si no es necesario para el contenedor principal
|
|
6235
6613
|
}, children: [
|
|
6236
|
-
/* @__PURE__ */ (0,
|
|
6237
|
-
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: [
|
|
6238
6616
|
"Por favor, corrige los errores en el formulario antes de enviar.",
|
|
6239
|
-
/* @__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)) })
|
|
6240
6618
|
] }),
|
|
6241
|
-
!Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */ (0,
|
|
6242
|
-
!Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */ (0,
|
|
6243
|
-
/* @__PURE__ */ (0,
|
|
6244
|
-
procedure.parameters.map((param) => /* @__PURE__ */ (0,
|
|
6245
|
-
/* @__PURE__ */ (0,
|
|
6246
|
-
|
|
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,
|
|
6247
6625
|
{
|
|
6248
6626
|
type: "submit",
|
|
6249
6627
|
variant: "contained",
|
|
@@ -6251,20 +6629,20 @@ var ProcedureForm = () => {
|
|
|
6251
6629
|
disabled: apiLoading || Object.values(validationErrors).some((err) => err !== null),
|
|
6252
6630
|
sx: { mt: 2 },
|
|
6253
6631
|
size: "medium",
|
|
6254
|
-
startIcon: apiLoading ? /* @__PURE__ */ (0,
|
|
6632
|
+
startIcon: apiLoading ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.CircularProgress, { size: 20, color: "inherit" }) : null,
|
|
6255
6633
|
children: apiLoading ? "Ejecutando..." : procedure.proceedLabel || "Ejecutar"
|
|
6256
6634
|
}
|
|
6257
6635
|
)
|
|
6258
6636
|
] }),
|
|
6259
|
-
ResultDisplayContent && /* @__PURE__ */ (0,
|
|
6637
|
+
ResultDisplayContent && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_material28.Box, { sx: { mt: 2 }, children: [
|
|
6260
6638
|
" ",
|
|
6261
6639
|
ResultDisplayContent
|
|
6262
6640
|
] }),
|
|
6263
|
-
executionLog.length > 0 && /* @__PURE__ */ (0,
|
|
6264
|
-
/* @__PURE__ */ (0,
|
|
6265
|
-
/* @__PURE__ */ (0,
|
|
6266
|
-
/* @__PURE__ */ (0,
|
|
6267
|
-
|
|
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,
|
|
6268
6646
|
{
|
|
6269
6647
|
sx: {
|
|
6270
6648
|
bgcolor: "grey.100",
|
|
@@ -6277,8 +6655,8 @@ var ProcedureForm = () => {
|
|
|
6277
6655
|
fontSize: "0.75rem",
|
|
6278
6656
|
whiteSpace: "pre-wrap"
|
|
6279
6657
|
},
|
|
6280
|
-
children: executionLog.map((log, index) => /* @__PURE__ */ (0,
|
|
6281
|
-
|
|
6658
|
+
children: executionLog.map((log, index) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
6659
|
+
import_material28.Typography,
|
|
6282
6660
|
{
|
|
6283
6661
|
component: "pre",
|
|
6284
6662
|
sx: {
|
|
@@ -6303,17 +6681,17 @@ var import_react_redux6 = require("react-redux");
|
|
|
6303
6681
|
var import_react45 = require("redux-persist/integration/react");
|
|
6304
6682
|
|
|
6305
6683
|
// src/components/PrivateRoute.tsx
|
|
6306
|
-
var
|
|
6307
|
-
var
|
|
6308
|
-
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");
|
|
6309
6687
|
var PrivateRoute = ({ children }) => {
|
|
6310
|
-
const location = (0,
|
|
6688
|
+
const location = (0, import_react_router_dom10.useLocation)();
|
|
6311
6689
|
const dispatch = useAppDispatch();
|
|
6312
6690
|
const clientContextStatus = useClientContextStatus();
|
|
6313
6691
|
const isAuthenticated = clientContextStatus === "succeeded";
|
|
6314
6692
|
const isLoadingAuth = clientContextStatus === "loading";
|
|
6315
6693
|
console.log(`[PrivateRoute] Render: Path=${location.pathname}, AuthStatus=${clientContextStatus}, IsAuthenticated=${isAuthenticated}, IsLoadingAuth=${isLoadingAuth}`);
|
|
6316
|
-
(0,
|
|
6694
|
+
(0, import_react36.useEffect)(() => {
|
|
6317
6695
|
console.log(`[PrivateRoute] Effect: Path=${location.pathname}, AuthStatus=${clientContextStatus}, IsAuthenticated=${isAuthenticated}, IsLoadingAuth=${isLoadingAuth}`);
|
|
6318
6696
|
if (!isAuthenticated && !isLoadingAuth && location.pathname !== "/login" && !huboCierreVoluntario()) {
|
|
6319
6697
|
const path = location.pathname + location.search + location.hash;
|
|
@@ -6329,36 +6707,36 @@ var PrivateRoute = ({ children }) => {
|
|
|
6329
6707
|
}, [isAuthenticated, isLoadingAuth, location, dispatch, clientContextStatus]);
|
|
6330
6708
|
if (isLoadingAuth) {
|
|
6331
6709
|
console.log(`[PrivateRoute] Returning loading state...`);
|
|
6332
|
-
return /* @__PURE__ */ (0,
|
|
6710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { children: "Verificando autenticaci\xF3n..." });
|
|
6333
6711
|
}
|
|
6334
6712
|
if (!isAuthenticated) {
|
|
6335
6713
|
console.log(`[PrivateRoute] User not authenticated, navigating to /login`);
|
|
6336
|
-
return /* @__PURE__ */ (0,
|
|
6714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_router_dom10.Navigate, { to: "/login", replace: true });
|
|
6337
6715
|
}
|
|
6338
6716
|
console.log(`[PrivateRoute] User authenticated, rendering children.`);
|
|
6339
|
-
return /* @__PURE__ */ (0,
|
|
6717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children });
|
|
6340
6718
|
};
|
|
6341
6719
|
var PrivateRoute_default = PrivateRoute;
|
|
6342
6720
|
|
|
6343
6721
|
// src/components/InitialRedirectHandler.tsx
|
|
6344
|
-
var
|
|
6345
|
-
var
|
|
6722
|
+
var import_react37 = require("react");
|
|
6723
|
+
var import_react_router_dom11 = require("react-router-dom");
|
|
6346
6724
|
var InitialRedirectHandler = () => {
|
|
6347
|
-
const location = (0,
|
|
6348
|
-
const navigate = (0,
|
|
6725
|
+
const location = (0, import_react_router_dom11.useLocation)();
|
|
6726
|
+
const navigate = (0, import_react_router_dom11.useNavigate)();
|
|
6349
6727
|
const dispatch = useAppDispatch();
|
|
6350
6728
|
const redirectPath = useRedirectPath();
|
|
6351
6729
|
const clientContextStatus = useClientContextStatus();
|
|
6352
6730
|
const username = useAppSelector((state) => state.clientContext.username);
|
|
6353
6731
|
const redirectUsername = useAppSelector((state) => state.router.redirectUsername);
|
|
6354
|
-
(0,
|
|
6732
|
+
(0, import_react37.useEffect)(() => {
|
|
6355
6733
|
dispatch(setCurrentPath(location.pathname + location.search));
|
|
6356
6734
|
}, [location, dispatch]);
|
|
6357
|
-
const navegandoRef = (0,
|
|
6358
|
-
(0,
|
|
6735
|
+
const navegandoRef = (0, import_react37.useRef)(false);
|
|
6736
|
+
(0, import_react37.useEffect)(() => {
|
|
6359
6737
|
navegandoRef.current = false;
|
|
6360
6738
|
}, [location.pathname]);
|
|
6361
|
-
(0,
|
|
6739
|
+
(0, import_react37.useEffect)(() => {
|
|
6362
6740
|
if (clientContextStatus === "succeeded") {
|
|
6363
6741
|
if (redirectPath && redirectPath !== "/login" && redirectUsername && redirectUsername !== username) {
|
|
6364
6742
|
dispatch(setRedirectPath(null));
|
|
@@ -6378,26 +6756,26 @@ var InitialRedirectHandler = () => {
|
|
|
6378
6756
|
var InitialRedirectHandler_default = InitialRedirectHandler;
|
|
6379
6757
|
|
|
6380
6758
|
// src/pages/GenericDataGridPage.tsx
|
|
6381
|
-
var
|
|
6382
|
-
var
|
|
6383
|
-
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");
|
|
6384
6762
|
var import_Close2 = __toESM(require("@mui/icons-material/Close"), 1);
|
|
6385
|
-
var
|
|
6763
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
6386
6764
|
var GenericDataGridPage = ({
|
|
6387
6765
|
initialTableName,
|
|
6388
6766
|
initialFixedFields = [],
|
|
6389
6767
|
parametros: parametrosRecibidos
|
|
6390
6768
|
}) => {
|
|
6391
|
-
const { tableName: urlTableName } = (0,
|
|
6769
|
+
const { tableName: urlTableName } = (0, import_react_router_dom12.useParams)();
|
|
6392
6770
|
const effectiveTableName = initialTableName || urlTableName;
|
|
6393
|
-
const [tabs, setTabs] = (0,
|
|
6394
|
-
const [activeTabIdx, setActiveTabIdx] = (0,
|
|
6771
|
+
const [tabs, setTabs] = (0, import_react38.useState)([]);
|
|
6772
|
+
const [activeTabIdx, setActiveTabIdx] = (0, import_react38.useState)(0);
|
|
6395
6773
|
const ffKey = JSON.stringify(initialFixedFields);
|
|
6396
|
-
const location = (0,
|
|
6397
|
-
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]);
|
|
6398
6776
|
const fixedFieldsIniciales = initialFixedFields.length > 0 ? initialFixedFields : parametros.fixedFields ?? [];
|
|
6399
6777
|
const parametrosKey = JSON.stringify(parametros);
|
|
6400
|
-
|
|
6778
|
+
import_react38.default.useEffect(() => {
|
|
6401
6779
|
if (effectiveTableName) {
|
|
6402
6780
|
setTabs([{
|
|
6403
6781
|
id: `main-${effectiveTableName}-${ffKey}-${parametrosKey}`,
|
|
@@ -6411,7 +6789,7 @@ var GenericDataGridPage = ({
|
|
|
6411
6789
|
setActiveTabIdx(0);
|
|
6412
6790
|
}
|
|
6413
6791
|
}, [effectiveTableName, ffKey, parametrosKey, location.key]);
|
|
6414
|
-
const handleOpenDetail = (0,
|
|
6792
|
+
const handleOpenDetail = (0, import_react38.useCallback)((tableName, fixedFields, label, ancestors) => {
|
|
6415
6793
|
const tabId = `${tableName}-${JSON.stringify(fixedFields)}`;
|
|
6416
6794
|
setTabs((prevTabs) => {
|
|
6417
6795
|
const existingTabIdx = prevTabs.findIndex((t) => t.id === tabId);
|
|
@@ -6433,26 +6811,26 @@ var GenericDataGridPage = ({
|
|
|
6433
6811
|
else if (activeTabIdx === index) setActiveTabIdx(index - 1);
|
|
6434
6812
|
};
|
|
6435
6813
|
if (!effectiveTableName) {
|
|
6436
|
-
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." }) });
|
|
6437
6815
|
}
|
|
6438
|
-
return /* @__PURE__ */ (0,
|
|
6439
|
-
/* @__PURE__ */ (0,
|
|
6440
|
-
|
|
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,
|
|
6441
6819
|
{
|
|
6442
|
-
label: /* @__PURE__ */ (0,
|
|
6443
|
-
/* @__PURE__ */ (0,
|
|
6444
|
-
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" }) })
|
|
6445
6823
|
] })
|
|
6446
6824
|
},
|
|
6447
6825
|
tab.id
|
|
6448
6826
|
)) }) }),
|
|
6449
|
-
tabs.map((tab, index) => /* @__PURE__ */ (0,
|
|
6450
|
-
|
|
6827
|
+
tabs.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6828
|
+
import_material29.Box,
|
|
6451
6829
|
{
|
|
6452
6830
|
role: "tabpanel",
|
|
6453
6831
|
hidden: activeTabIdx !== index,
|
|
6454
6832
|
sx: { flexGrow: 1, display: activeTabIdx === index ? "flex" : "none", flexDirection: "column", overflow: "hidden" },
|
|
6455
|
-
children: /* @__PURE__ */ (0,
|
|
6833
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6456
6834
|
GenericDataGrid_default,
|
|
6457
6835
|
{
|
|
6458
6836
|
tableName: tab.tableName,
|
|
@@ -6473,27 +6851,27 @@ var GenericDataGridPage = ({
|
|
|
6473
6851
|
var GenericDataGridPage_default = GenericDataGridPage;
|
|
6474
6852
|
|
|
6475
6853
|
// src/pages/PantallaDeRuta.tsx
|
|
6476
|
-
var
|
|
6477
|
-
var
|
|
6478
|
-
var
|
|
6479
|
-
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");
|
|
6480
6858
|
var PantallaDeRuta = ({ screenName }) => {
|
|
6481
|
-
const [busqueda] = (0,
|
|
6482
|
-
const params = (0,
|
|
6859
|
+
const [busqueda] = (0, import_react_router_dom13.useSearchParams)();
|
|
6860
|
+
const params = (0, import_react39.useMemo)(() => Object.fromEntries(busqueda.entries()), [busqueda]);
|
|
6483
6861
|
const Pantalla = wScreens[screenName];
|
|
6484
|
-
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 }) });
|
|
6485
6863
|
};
|
|
6486
6864
|
|
|
6487
6865
|
// src/pages/MenuTablePage.tsx
|
|
6488
|
-
var
|
|
6489
|
-
var
|
|
6490
|
-
var
|
|
6491
|
-
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");
|
|
6492
6870
|
var MenuTablePage = () => {
|
|
6493
|
-
const { "*": menuName } = (0,
|
|
6871
|
+
const { "*": menuName } = (0, import_react_router_dom14.useParams)();
|
|
6494
6872
|
const { clientContext } = useApp();
|
|
6495
|
-
const { search } = (0,
|
|
6496
|
-
const { currentTableName, currentFixedFields, parametros } = (0,
|
|
6873
|
+
const { search } = (0, import_react_router_dom14.useLocation)();
|
|
6874
|
+
const { currentTableName, currentFixedFields, parametros } = (0, import_react40.useMemo)(() => {
|
|
6497
6875
|
let tableName = void 0;
|
|
6498
6876
|
let fixedFields = [];
|
|
6499
6877
|
let parametros2 = {};
|
|
@@ -6514,12 +6892,12 @@ var MenuTablePage = () => {
|
|
|
6514
6892
|
};
|
|
6515
6893
|
}, [menuName, clientContext, search]);
|
|
6516
6894
|
if (!currentTableName) {
|
|
6517
|
-
return /* @__PURE__ */ (0,
|
|
6518
|
-
/* @__PURE__ */ (0,
|
|
6519
|
-
/* @__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." })
|
|
6520
6898
|
] }) });
|
|
6521
6899
|
}
|
|
6522
|
-
return /* @__PURE__ */ (0,
|
|
6900
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6523
6901
|
GenericDataGridPage_default,
|
|
6524
6902
|
{
|
|
6525
6903
|
initialTableName: currentTableName,
|
|
@@ -6531,170 +6909,9 @@ var MenuTablePage = () => {
|
|
|
6531
6909
|
var MenuTablePage_default = MenuTablePage;
|
|
6532
6910
|
|
|
6533
6911
|
// src/puente/PantallaBP.tsx
|
|
6534
|
-
var
|
|
6535
|
-
var
|
|
6536
|
-
var
|
|
6537
|
-
|
|
6538
|
-
// src/puente/clienteBP.ts
|
|
6539
|
-
function extraerRecursos(html) {
|
|
6540
|
-
const documento = new DOMParser().parseFromString(html, "text/html");
|
|
6541
|
-
const referencias2 = (selector, atributo) => Array.from(documento.querySelectorAll(selector)).map((elemento) => elemento.getAttribute(atributo)).filter((ruta) => !!ruta);
|
|
6542
|
-
return {
|
|
6543
|
-
hojasDeEstilo: referencias2("link[rel=stylesheet]", "href"),
|
|
6544
|
-
scripts: referencias2("script[src]", "src")
|
|
6545
|
-
};
|
|
6546
|
-
}
|
|
6547
|
-
function fijarBase(urlBackend) {
|
|
6548
|
-
const href = new URL(urlBackend.replace(/\/*$/, "/"), window.location.href).href;
|
|
6549
|
-
let base = document.querySelector("base");
|
|
6550
|
-
if (!base) {
|
|
6551
|
-
base = document.createElement("base");
|
|
6552
|
-
document.head.prepend(base);
|
|
6553
|
-
}
|
|
6554
|
-
base.href = href;
|
|
6555
|
-
}
|
|
6556
|
-
function cargarScript(ruta) {
|
|
6557
|
-
return new Promise((resolver, rechazar) => {
|
|
6558
|
-
const script = document.createElement("script");
|
|
6559
|
-
script.async = false;
|
|
6560
|
-
script.src = ruta;
|
|
6561
|
-
script.onload = () => resolver();
|
|
6562
|
-
script.onerror = () => rechazar(new Error(`No se pudo cargar ${ruta}`));
|
|
6563
|
-
document.head.appendChild(script);
|
|
6564
|
-
});
|
|
6565
|
-
}
|
|
6566
|
-
function esperarCargaDeVentana() {
|
|
6567
|
-
if (document.readyState === "complete") return Promise.resolve();
|
|
6568
|
-
return new Promise((resolver) => window.addEventListener("load", () => resolver(), { once: true }));
|
|
6569
|
-
}
|
|
6570
|
-
async function sinEscuchasDeVentana(tipos, inyectar) {
|
|
6571
|
-
const original = window.addEventListener;
|
|
6572
|
-
const filtrada = function(tipo, escucha, opciones) {
|
|
6573
|
-
if (tipos.includes(tipo)) return;
|
|
6574
|
-
original.call(this, tipo, escucha, opciones);
|
|
6575
|
-
};
|
|
6576
|
-
window.addEventListener = filtrada;
|
|
6577
|
-
try {
|
|
6578
|
-
return await inyectar();
|
|
6579
|
-
} finally {
|
|
6580
|
-
if (window.addEventListener === filtrada) window.addEventListener = original;
|
|
6581
|
-
}
|
|
6582
|
-
}
|
|
6583
|
-
async function cargarScripts(rutas) {
|
|
6584
|
-
for (const ruta of rutas) {
|
|
6585
|
-
await cargarScript(ruta);
|
|
6586
|
-
}
|
|
6587
|
-
}
|
|
6588
|
-
var carga = null;
|
|
6589
|
-
function cargarClienteBP(urlBackend) {
|
|
6590
|
-
if (!carga) {
|
|
6591
|
-
carga = cargarSinMemoria(urlBackend).catch((error) => {
|
|
6592
|
-
carga = null;
|
|
6593
|
-
throw error;
|
|
6594
|
-
});
|
|
6595
|
-
}
|
|
6596
|
-
return carga;
|
|
6597
|
-
}
|
|
6598
|
-
async function cargarSinMemoria(urlBackend) {
|
|
6599
|
-
const destino = new URL(urlBackend, window.location.href);
|
|
6600
|
-
if (destino.origin !== window.location.origin) {
|
|
6601
|
-
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}).`);
|
|
6602
|
-
}
|
|
6603
|
-
fijarBase(urlBackend);
|
|
6604
|
-
const respuesta = await fetch(`${destino.pathname.replace(/\/*$/, "")}/menu`, { credentials: "include" });
|
|
6605
|
-
if (!respuesta.ok || /\/login\/?$/.test(new URL(respuesta.url).pathname)) {
|
|
6606
|
-
throw new Error("No hay una sesi\xF3n iniciada en el backend.");
|
|
6607
|
-
}
|
|
6608
|
-
const recursos = extraerRecursos(await respuesta.text());
|
|
6609
|
-
recursos.hojasDeEstilo.forEach((ruta) => {
|
|
6610
|
-
const enlace = document.createElement("link");
|
|
6611
|
-
enlace.rel = "stylesheet";
|
|
6612
|
-
enlace.href = ruta;
|
|
6613
|
-
document.head.appendChild(enlace);
|
|
6614
|
-
});
|
|
6615
|
-
await esperarCargaDeVentana();
|
|
6616
|
-
await sinEscuchasDeVentana(["popstate"], () => cargarScripts(recursos.scripts));
|
|
6617
|
-
const myOwn = window.myOwn;
|
|
6618
|
-
if (!myOwn) throw new Error("El backend no defini\xF3 myOwn.");
|
|
6619
|
-
window.my = myOwn;
|
|
6620
|
-
await myOwn.autoSetup();
|
|
6621
|
-
return myOwn;
|
|
6622
|
-
}
|
|
6623
|
-
|
|
6624
|
-
// src/puente/ConsolaBP.tsx
|
|
6625
|
-
var import_react39 = require("react");
|
|
6626
|
-
var import_material30 = require("@mui/material");
|
|
6627
|
-
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
6628
|
-
var MARGEN_DE_REPETIDO_MS = 1e3;
|
|
6629
|
-
function descartarRepetidos(consola, agregados, ahora) {
|
|
6630
|
-
for (const nodo of agregados) {
|
|
6631
|
-
if (!(nodo instanceof HTMLElement)) continue;
|
|
6632
|
-
const repetido = Array.from(consola.children).find(
|
|
6633
|
-
(otro) => otro instanceof HTMLElement && otro !== nodo && otro.className === nodo.className && otro.textContent === nodo.textContent && ahora - Number(otro.dataset.instante) < MARGEN_DE_REPETIDO_MS
|
|
6634
|
-
);
|
|
6635
|
-
if (repetido) nodo.remove();
|
|
6636
|
-
else nodo.dataset.instante = String(ahora);
|
|
6637
|
-
}
|
|
6638
|
-
}
|
|
6639
|
-
var ConsolaBP = () => {
|
|
6640
|
-
(0, import_react39.useEffect)(() => {
|
|
6641
|
-
const consola = document.getElementById("mini-console");
|
|
6642
|
-
if (!consola) return;
|
|
6643
|
-
const observador = new MutationObserver(
|
|
6644
|
-
(registros) => descartarRepetidos(consola, registros.flatMap((registro) => Array.from(registro.addedNodes)), Date.now())
|
|
6645
|
-
);
|
|
6646
|
-
observador.observe(consola, { childList: true });
|
|
6647
|
-
return () => observador.disconnect();
|
|
6648
|
-
}, []);
|
|
6649
|
-
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6650
|
-
import_material30.Box,
|
|
6651
|
-
{
|
|
6652
|
-
id: "mini-console",
|
|
6653
|
-
sx: (tema) => ({
|
|
6654
|
-
"&#mini-console": {
|
|
6655
|
-
position: "fixed",
|
|
6656
|
-
top: { xs: 64, sm: 72 },
|
|
6657
|
-
left: "auto",
|
|
6658
|
-
right: 16,
|
|
6659
|
-
bottom: "auto",
|
|
6660
|
-
float: "none",
|
|
6661
|
-
zIndex: tema.zIndex.snackbar,
|
|
6662
|
-
width: "auto",
|
|
6663
|
-
minWidth: 0,
|
|
6664
|
-
maxWidth: "min(480px, calc(100vw - 32px))",
|
|
6665
|
-
minHeight: 0,
|
|
6666
|
-
maxHeight: "none",
|
|
6667
|
-
overflow: "visible",
|
|
6668
|
-
padding: 0,
|
|
6669
|
-
border: "none",
|
|
6670
|
-
borderRadius: 0,
|
|
6671
|
-
boxShadow: "none",
|
|
6672
|
-
backgroundColor: "transparent",
|
|
6673
|
-
fontSize: "inherit",
|
|
6674
|
-
display: "flex",
|
|
6675
|
-
flexDirection: "column",
|
|
6676
|
-
gap: 1
|
|
6677
|
-
},
|
|
6678
|
-
"&#mini-console:not(:empty)": { display: "flex" },
|
|
6679
|
-
"&#mini-console:empty": { display: "none" },
|
|
6680
|
-
"& > div": {
|
|
6681
|
-
p: "6px 12px",
|
|
6682
|
-
borderRadius: 1,
|
|
6683
|
-
boxShadow: tema.shadows[3],
|
|
6684
|
-
fontSize: "0.875rem",
|
|
6685
|
-
whiteSpace: "pre-wrap",
|
|
6686
|
-
overflowWrap: "anywhere",
|
|
6687
|
-
backgroundColor: tema.palette.grey[800],
|
|
6688
|
-
color: tema.palette.common.white
|
|
6689
|
-
},
|
|
6690
|
-
"& > .status-error": {
|
|
6691
|
-
backgroundColor: tema.palette.error.main,
|
|
6692
|
-
color: tema.palette.error.contrastText
|
|
6693
|
-
}
|
|
6694
|
-
})
|
|
6695
|
-
}
|
|
6696
|
-
);
|
|
6697
|
-
};
|
|
6912
|
+
var import_react41 = require("react");
|
|
6913
|
+
var import_react_router_dom15 = require("react-router-dom");
|
|
6914
|
+
var import_material32 = require("@mui/material");
|
|
6698
6915
|
|
|
6699
6916
|
// src/puente/pantallaDeBP.ts
|
|
6700
6917
|
var RUTA_PANTALLA_BP = "/bp/menu";
|
|
@@ -6714,6 +6931,12 @@ function rutaDeEnlaceBP(href, baseDelDocumento, urlBackend) {
|
|
|
6714
6931
|
const nombre = new URLSearchParams(texto).get("w");
|
|
6715
6932
|
return nombre ? rutaDePantallaBP(nombre, texto) : null;
|
|
6716
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
|
+
}
|
|
6717
6940
|
function resolverPantallaBP(myOwn, nombre, contenedor) {
|
|
6718
6941
|
const registrada = myOwn.wScreens[nombre];
|
|
6719
6942
|
if (!registrada) return null;
|
|
@@ -6736,7 +6959,7 @@ function resolverPantallaBP(myOwn, nombre, contenedor) {
|
|
|
6736
6959
|
}
|
|
6737
6960
|
|
|
6738
6961
|
// src/puente/PantallaBP.tsx
|
|
6739
|
-
var
|
|
6962
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
6740
6963
|
function buscarItemDeMenu(items, tipo) {
|
|
6741
6964
|
for (const item of items) {
|
|
6742
6965
|
if (item.menuType === tipo) return item;
|
|
@@ -6749,12 +6972,12 @@ function buscarItemDeMenu(items, tipo) {
|
|
|
6749
6972
|
}
|
|
6750
6973
|
var PantallaBP = ({ nombre, direccion }) => {
|
|
6751
6974
|
const { clientContext } = useApp();
|
|
6752
|
-
const [cargando, setCargando] = (0,
|
|
6753
|
-
const [error, setError] = (0,
|
|
6754
|
-
const [noExiste, setNoExiste] = (0,
|
|
6755
|
-
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);
|
|
6756
6979
|
const menu = clientContext.menu;
|
|
6757
|
-
(0,
|
|
6980
|
+
(0, import_react41.useEffect)(() => {
|
|
6758
6981
|
const elemento = contenedor.current;
|
|
6759
6982
|
if (!elemento) return;
|
|
6760
6983
|
let vigente = true;
|
|
@@ -6764,6 +6987,7 @@ var PantallaBP = ({ nombre, direccion }) => {
|
|
|
6764
6987
|
cargarClienteBP(envConfig.backendUrl).then((myOwn) => {
|
|
6765
6988
|
if (!vigente) return;
|
|
6766
6989
|
setCargando(false);
|
|
6990
|
+
copiarSkinAlContenedor(elemento);
|
|
6767
6991
|
const pantalla = resolverPantallaBP(myOwn, nombre, elemento);
|
|
6768
6992
|
if (!pantalla) {
|
|
6769
6993
|
setNoExiste(true);
|
|
@@ -6785,82 +7009,36 @@ var PantallaBP = ({ nombre, direccion }) => {
|
|
|
6785
7009
|
elemento.replaceChildren();
|
|
6786
7010
|
};
|
|
6787
7011
|
}, [nombre, direccion, menu]);
|
|
6788
|
-
if (noExiste) return /* @__PURE__ */ (0,
|
|
7012
|
+
if (noExiste) return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FallbackWScreen, { screenName: nombre });
|
|
6789
7013
|
return (
|
|
6790
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
|
|
6791
|
-
/* @__PURE__ */ (0,
|
|
6792
|
-
cargando && /* @__PURE__ */ (0,
|
|
6793
|
-
error && /* @__PURE__ */ (0,
|
|
6794
|
-
/* @__PURE__ */ (0,
|
|
6795
|
-
/* @__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, {})
|
|
6796
7020
|
] })
|
|
6797
7021
|
);
|
|
6798
7022
|
};
|
|
6799
7023
|
var PantallaDeRespaldo = () => {
|
|
6800
|
-
const { screenName = "" } = (0,
|
|
6801
|
-
const { search } = (0,
|
|
7024
|
+
const { screenName = "" } = (0, import_react_router_dom15.useParams)();
|
|
7025
|
+
const { search } = (0, import_react_router_dom15.useLocation)();
|
|
6802
7026
|
if (!puenteBPHabilitado()) {
|
|
6803
|
-
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 }) });
|
|
6804
7028
|
}
|
|
6805
|
-
return /* @__PURE__ */ (0,
|
|
7029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_router_dom15.Navigate, { to: rutaDePantallaBP(screenName, search), replace: true });
|
|
6806
7030
|
};
|
|
6807
7031
|
var PaginaBP = () => {
|
|
6808
|
-
const { hash, search } = (0,
|
|
7032
|
+
const { hash, search } = (0, import_react_router_dom15.useLocation)();
|
|
6809
7033
|
const direccion = hash || search;
|
|
6810
7034
|
const nombre = new URLSearchParams(direccion.replace(/^[#?]/, "")).get("w");
|
|
6811
|
-
if (!puenteBPHabilitado()) return /* @__PURE__ */ (0,
|
|
6812
|
-
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: [
|
|
6813
7037
|
"Falta la pantalla de backend-plus (",
|
|
6814
|
-
/* @__PURE__ */ (0,
|
|
7038
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("code", { children: "#w=..." }),
|
|
6815
7039
|
")."
|
|
6816
7040
|
] }) });
|
|
6817
|
-
return /* @__PURE__ */ (0,
|
|
6818
|
-
};
|
|
6819
|
-
|
|
6820
|
-
// src/puente/GrillaBP.tsx
|
|
6821
|
-
var import_react41 = require("react");
|
|
6822
|
-
var import_react_router_dom15 = require("react-router-dom");
|
|
6823
|
-
var import_material32 = require("@mui/material");
|
|
6824
|
-
var import_jsx_runtime39 = (
|
|
6825
|
-
// 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
|
|
6826
|
-
require("react/jsx-runtime")
|
|
6827
|
-
);
|
|
6828
|
-
var GrillaBP = ({ tabla, fixedFields }) => {
|
|
6829
|
-
const contenedor = (0, import_react41.useRef)(null);
|
|
6830
|
-
const [cargando, setCargando] = (0, import_react41.useState)(true);
|
|
6831
|
-
const [error, setError] = (0, import_react41.useState)(null);
|
|
6832
|
-
const clave = JSON.stringify(fixedFields ?? []);
|
|
6833
|
-
(0, import_react41.useEffect)(() => {
|
|
6834
|
-
const elemento = contenedor.current;
|
|
6835
|
-
if (!elemento) return;
|
|
6836
|
-
let vigente = true;
|
|
6837
|
-
setError(null);
|
|
6838
|
-
setCargando(true);
|
|
6839
|
-
cargarClienteBP(envConfig.backendUrl).then((myOwn) => {
|
|
6840
|
-
if (!vigente) return;
|
|
6841
|
-
setCargando(false);
|
|
6842
|
-
elemento.replaceChildren();
|
|
6843
|
-
myOwn.tableGrid(tabla, elemento, { fixedFields: JSON.parse(clave) });
|
|
6844
|
-
}).catch((err) => {
|
|
6845
|
-
if (!vigente) return;
|
|
6846
|
-
setCargando(false);
|
|
6847
|
-
setError(mensajeDeError(err));
|
|
6848
|
-
});
|
|
6849
|
-
return () => {
|
|
6850
|
-
vigente = false;
|
|
6851
|
-
elemento.replaceChildren();
|
|
6852
|
-
};
|
|
6853
|
-
}, [tabla, clave]);
|
|
6854
|
-
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_material32.Box, { sx: { position: "relative" }, children: [
|
|
6855
|
-
cargando && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material32.CircularProgress, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
|
|
6856
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_material32.Alert, { severity: "error", sx: { m: 2 }, children: error }),
|
|
6857
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { ref: contenedor }),
|
|
6858
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ConsolaBP, {})
|
|
6859
|
-
] });
|
|
6860
|
-
};
|
|
6861
|
-
var PaginaGrillaBP = () => {
|
|
6862
|
-
const { tableName = "" } = (0, import_react_router_dom15.useParams)();
|
|
6863
|
-
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(GrillaBP, { tabla: tableName }, tableName);
|
|
7041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PantallaBP, { nombre, direccion }, nombre);
|
|
6864
7042
|
};
|
|
6865
7043
|
|
|
6866
7044
|
// src/puente/CapturaBP.tsx
|
|
@@ -6901,8 +7079,16 @@ function capturarNavegacionBP(urlBackend, navegar) {
|
|
|
6901
7079
|
reemplazarOriginal.call(history, estado, titulo, ruta === null ? url : rutaBase + ruta);
|
|
6902
7080
|
};
|
|
6903
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;
|
|
6904
7089
|
return () => {
|
|
6905
7090
|
if (history.replaceState === reemplazar) history.replaceState = reemplazarOriginal;
|
|
7091
|
+
if (window.open === abrir) window.open = abrirOriginal;
|
|
6906
7092
|
document.removeEventListener("click", alHacerClick, true);
|
|
6907
7093
|
navegacion?.removeEventListener("navigate", alNavegar);
|
|
6908
7094
|
};
|
|
@@ -6930,7 +7116,7 @@ function resultadoDeCambioDeClave(urlFinal, html) {
|
|
|
6930
7116
|
}
|
|
6931
7117
|
|
|
6932
7118
|
// src/pages/CambiarClavePage.tsx
|
|
6933
|
-
var
|
|
7119
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
6934
7120
|
var CambiarClavePage = () => {
|
|
6935
7121
|
const { clientContext, setIsLoggedIn, avisarCierreVoluntario } = useApp();
|
|
6936
7122
|
const dispatch = (0, import_react_redux5.useDispatch)();
|
|
@@ -6971,10 +7157,10 @@ var CambiarClavePage = () => {
|
|
|
6971
7157
|
setEnviando(false);
|
|
6972
7158
|
}
|
|
6973
7159
|
};
|
|
6974
|
-
return /* @__PURE__ */ (0,
|
|
6975
|
-
/* @__PURE__ */ (0,
|
|
6976
|
-
/* @__PURE__ */ (0,
|
|
6977
|
-
/* @__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)(
|
|
6978
7164
|
import_material33.TextField,
|
|
6979
7165
|
{
|
|
6980
7166
|
label: "Contrase\xF1a actual",
|
|
@@ -6989,7 +7175,7 @@ var CambiarClavePage = () => {
|
|
|
6989
7175
|
disabled: enviando
|
|
6990
7176
|
}
|
|
6991
7177
|
),
|
|
6992
|
-
/* @__PURE__ */ (0,
|
|
7178
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
6993
7179
|
import_material33.TextField,
|
|
6994
7180
|
{
|
|
6995
7181
|
label: "Contrase\xF1a nueva",
|
|
@@ -7003,7 +7189,7 @@ var CambiarClavePage = () => {
|
|
|
7003
7189
|
disabled: enviando
|
|
7004
7190
|
}
|
|
7005
7191
|
),
|
|
7006
|
-
/* @__PURE__ */ (0,
|
|
7192
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7007
7193
|
import_material33.TextField,
|
|
7008
7194
|
{
|
|
7009
7195
|
label: "Repetir contrase\xF1a nueva",
|
|
@@ -7017,19 +7203,19 @@ var CambiarClavePage = () => {
|
|
|
7017
7203
|
disabled: enviando
|
|
7018
7204
|
}
|
|
7019
7205
|
),
|
|
7020
|
-
error && /* @__PURE__ */ (0,
|
|
7021
|
-
/* @__PURE__ */ (0,
|
|
7022
|
-
/* @__PURE__ */ (0,
|
|
7023
|
-
/* @__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" })
|
|
7024
7210
|
] }),
|
|
7025
|
-
/* @__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." })
|
|
7026
7212
|
] }) });
|
|
7027
7213
|
};
|
|
7028
7214
|
var CambiarClavePage_default = CambiarClavePage;
|
|
7029
7215
|
|
|
7030
7216
|
// src/App.tsx
|
|
7031
7217
|
var import_type_store6 = __toESM(require("type-store"), 1);
|
|
7032
|
-
var
|
|
7218
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
7033
7219
|
var LocationTracker = () => {
|
|
7034
7220
|
const location = (0, import_react_router_dom18.useLocation)();
|
|
7035
7221
|
const dispatch = useAppDispatch();
|
|
@@ -7039,46 +7225,46 @@ var LocationTracker = () => {
|
|
|
7039
7225
|
return null;
|
|
7040
7226
|
};
|
|
7041
7227
|
function FrontendPlusReactRoutes({ myRoutes, myUnloggedRoutes, layout: Layout = MainLayout_default, unloggedLayout: UnloggedLayout }) {
|
|
7042
|
-
return /* @__PURE__ */ (0,
|
|
7043
|
-
/* @__PURE__ */ (0,
|
|
7044
|
-
puenteBPHabilitado() && /* @__PURE__ */ (0,
|
|
7045
|
-
/* @__PURE__ */ (0,
|
|
7046
|
-
/* @__PURE__ */ (0,
|
|
7047
|
-
/* @__PURE__ */ (0,
|
|
7048
|
-
/* @__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, {}) }),
|
|
7049
7235
|
myUnloggedRoutes
|
|
7050
7236
|
] }),
|
|
7051
|
-
/* @__PURE__ */ (0,
|
|
7052
|
-
/* @__PURE__ */ (0,
|
|
7053
|
-
/* @__PURE__ */ (0,
|
|
7054
|
-
/* @__PURE__ */ (0,
|
|
7055
|
-
/* @__PURE__ */ (0,
|
|
7056
|
-
/* @__PURE__ */ (0,
|
|
7057
|
-
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)(
|
|
7058
7244
|
import_react_router_dom18.Route,
|
|
7059
7245
|
{
|
|
7060
7246
|
path: `/wScreens/${screenName}`,
|
|
7061
|
-
element: /* @__PURE__ */ (0,
|
|
7247
|
+
element: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PantallaDeRuta, { screenName })
|
|
7062
7248
|
},
|
|
7063
7249
|
screenName
|
|
7064
7250
|
)),
|
|
7065
|
-
/* @__PURE__ */ (0,
|
|
7066
|
-
puenteBPHabilitado() && /* @__PURE__ */ (0,
|
|
7067
|
-
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, {}) }),
|
|
7068
7254
|
myRoutes,
|
|
7069
|
-
/* @__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" }) })
|
|
7070
7256
|
] }),
|
|
7071
|
-
/* @__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 }) })
|
|
7072
7258
|
] })
|
|
7073
7259
|
] });
|
|
7074
7260
|
}
|
|
7075
7261
|
var FrontendPlusProviders = ({ children, publicPaths }) => {
|
|
7076
|
-
return /* @__PURE__ */ (0,
|
|
7077
|
-
/* @__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, {}),
|
|
7078
7264
|
" ",
|
|
7079
|
-
/* @__PURE__ */ (0,
|
|
7265
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AppProvider, { publicPaths, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(SnackbarProvider, { children: [
|
|
7080
7266
|
children,
|
|
7081
|
-
/* @__PURE__ */ (0,
|
|
7267
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(SessionExpiredMessage_default, {})
|
|
7082
7268
|
] }) })
|
|
7083
7269
|
] }) }) });
|
|
7084
7270
|
};
|
|
@@ -7124,7 +7310,7 @@ var App = ({
|
|
|
7124
7310
|
const extracted = extractPathsFromRoutes(myUnloggedRoutes);
|
|
7125
7311
|
return ["/login", "/logout", ...extracted];
|
|
7126
7312
|
}, [myUnloggedRoutes]);
|
|
7127
|
-
return /* @__PURE__ */ (0,
|
|
7313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(FrontendPlusProviders, { publicPaths: safePaths, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7128
7314
|
FrontendPlusReactRoutes,
|
|
7129
7315
|
{
|
|
7130
7316
|
myRoutes,
|