frontend-plus-react 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +1 -0
- package/README.md +1 -1
- package/dist/index.cjs +961 -921
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +767 -727
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/components/grid/GenericDataGrid.tsx
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as useState16, useEffect as useEffect6, useCallback as useCallback12, useContext as useContext4, useMemo as useMemo10, useRef as useRef7 } from "react";
|
|
3
3
|
import { DataGrid } from "react-data-grid";
|
|
4
4
|
import "react-data-grid/lib/styles.css";
|
|
5
5
|
|
|
@@ -1478,7 +1478,7 @@ var opcionesDeReferencia = (campo, definicionReferenciada, filasReferenciadas, f
|
|
|
1478
1478
|
const activo = campoDeActivo(definicionReferenciada);
|
|
1479
1479
|
const nombres = camposDeNombre(definicionReferenciada);
|
|
1480
1480
|
const columnasDeEtiqueta = nombres.length > 0 ? [...definicionReferenciada.primaryKey, ...nombres] : definicionReferenciada.primaryKey;
|
|
1481
|
-
const opciones = filasReferenciadas.filter((fila) => (activo === null || !!fila[activo]) && anteriores.every((par) => comoTexto(fila[par.target]) === comoTexto(filaActual[par.source]))).map((fila) => {
|
|
1481
|
+
const opciones = filasReferenciadas.filter((fila) => (activo === null || !!fila[activo]) && (filaActual === null || anteriores.every((par) => comoTexto(fila[par.target]) === comoTexto(filaActual[par.source])))).map((fila) => {
|
|
1482
1482
|
const etiquetas = columnasDeEtiqueta.map((columna) => comoTexto(fila[columna]));
|
|
1483
1483
|
return { valor: fila[columnaDelValor], etiquetas, texto: `${etiquetas.join(", ")}; ${definicionReferenciada.primaryKey.join(", ")}` };
|
|
1484
1484
|
});
|
|
@@ -1903,7 +1903,7 @@ var useGridMenu = ({
|
|
|
1903
1903
|
};
|
|
1904
1904
|
|
|
1905
1905
|
// src/hooks/grid/useGridColumns.ts
|
|
1906
|
-
import
|
|
1906
|
+
import React13, { useMemo as useMemo8 } from "react";
|
|
1907
1907
|
|
|
1908
1908
|
// src/utils/functions.tsx
|
|
1909
1909
|
import * as JSON4all2 from "json4all";
|
|
@@ -2061,11 +2061,11 @@ var ActionsColumnHeaderCell = ({
|
|
|
2061
2061
|
var detailColumnCellHeaderRenderer = (props, detailTable) => /* @__PURE__ */ jsx6(Tooltip2, { title: detailTable.label, children: /* @__PURE__ */ jsx6(Typography2, { variant: "caption", sx: { fontSize: "0.75rem", fontWeight: "bold" }, children: detailTable.abr.toUpperCase() }) });
|
|
2062
2062
|
|
|
2063
2063
|
// src/components/grid/FilterInputRender.tsx
|
|
2064
|
-
import { InputBase, Box as Box4 } from "@mui/material";
|
|
2065
|
-
import
|
|
2064
|
+
import { InputBase as InputBase3, Box as Box4 } from "@mui/material";
|
|
2065
|
+
import React10 from "react";
|
|
2066
2066
|
|
|
2067
2067
|
// src/components/forms/TypedField.tsx
|
|
2068
|
-
import { useState as
|
|
2068
|
+
import { useState as useState11, useEffect as useEffect4, useMemo as useMemo6, useCallback as useCallback8 } from "react";
|
|
2069
2069
|
import {
|
|
2070
2070
|
TextField,
|
|
2071
2071
|
FormControl,
|
|
@@ -2077,13 +2077,282 @@ import {
|
|
|
2077
2077
|
useTheme
|
|
2078
2078
|
} from "@mui/material";
|
|
2079
2079
|
import typeStore3 from "type-store";
|
|
2080
|
-
import { useRef as
|
|
2080
|
+
import { useRef as useRef5 } from "react";
|
|
2081
|
+
|
|
2082
|
+
// src/hooks/grid/useExpander.tsx
|
|
2083
|
+
import React8, { useCallback as useCallback7, useState as useState10 } from "react";
|
|
2084
|
+
import IconButton4 from "@mui/material/IconButton";
|
|
2085
|
+
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
|
|
2086
|
+
import CalendarMonthIcon from "@mui/icons-material/CalendarMonth";
|
|
2087
|
+
import SearchIcon2 from "@mui/icons-material/Search";
|
|
2088
|
+
|
|
2089
|
+
// src/components/grid/MenuDeOpciones.tsx
|
|
2090
|
+
import { useEffect as useEffect3, useMemo as useMemo5, useRef as useRef4, useState as useState7 } from "react";
|
|
2091
|
+
import { InputBase, List as List2, ListItemButton as ListItemButton2, Popover as Popover2, Typography as Typography3 } from "@mui/material";
|
|
2081
2092
|
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2093
|
+
function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar }) {
|
|
2094
|
+
const [busqueda, setBusqueda] = useState7(busquedaInicial);
|
|
2095
|
+
const [indice, setIndice] = useState7(0);
|
|
2096
|
+
const visibles = useMemo5(() => filtrarOpciones(opciones, busqueda), [opciones, busqueda]);
|
|
2097
|
+
const elegida = useRef4(null);
|
|
2098
|
+
useEffect3(() => {
|
|
2099
|
+
elegida.current?.scrollIntoView({ block: "nearest" });
|
|
2100
|
+
}, [indice, visibles]);
|
|
2101
|
+
const alApretar = (evento) => {
|
|
2102
|
+
if (evento.key === "ArrowDown") {
|
|
2103
|
+
setIndice((i) => Math.min(i + 1, visibles.length - 1));
|
|
2104
|
+
} else if (evento.key === "ArrowUp") {
|
|
2105
|
+
setIndice((i) => Math.max(i - 1, 0));
|
|
2106
|
+
} else if (evento.key === "Enter") {
|
|
2107
|
+
if (visibles[indice]) onElegir(visibles[indice].valor);
|
|
2108
|
+
} else if (evento.key === "F9" || evento.key === "Escape") {
|
|
2109
|
+
onCerrar();
|
|
2110
|
+
} else {
|
|
2111
|
+
return;
|
|
2112
|
+
}
|
|
2113
|
+
evento.preventDefault();
|
|
2114
|
+
evento.stopPropagation();
|
|
2115
|
+
};
|
|
2116
|
+
return /* @__PURE__ */ jsxs6(
|
|
2117
|
+
Popover2,
|
|
2118
|
+
{
|
|
2119
|
+
open: true,
|
|
2120
|
+
anchorEl: anclaje,
|
|
2121
|
+
onClose: onCerrar,
|
|
2122
|
+
disableRestoreFocus: true,
|
|
2123
|
+
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
2124
|
+
slotProps: { paper: { sx: { minWidth: 300, maxWidth: 520 } } },
|
|
2125
|
+
children: [
|
|
2126
|
+
/* @__PURE__ */ jsx7(
|
|
2127
|
+
InputBase,
|
|
2128
|
+
{
|
|
2129
|
+
autoFocus: true,
|
|
2130
|
+
fullWidth: true,
|
|
2131
|
+
value: busqueda,
|
|
2132
|
+
onChange: (e) => {
|
|
2133
|
+
setBusqueda(e.target.value);
|
|
2134
|
+
setIndice(0);
|
|
2135
|
+
},
|
|
2136
|
+
onKeyDown: alApretar,
|
|
2137
|
+
placeholder: "buscar",
|
|
2138
|
+
sx: { px: 1, py: 0.5, fontSize: "0.8rem", borderBottom: "1px solid #ccc" },
|
|
2139
|
+
inputProps: { "aria-label": "buscar" }
|
|
2140
|
+
}
|
|
2141
|
+
),
|
|
2142
|
+
/* @__PURE__ */ jsxs6(List2, { dense: true, disablePadding: true, sx: { maxHeight: 320, overflowY: "auto" }, role: "listbox", children: [
|
|
2143
|
+
visibles.length === 0 && /* @__PURE__ */ jsx7(Typography3, { variant: "body2", sx: { p: 1, color: "text.secondary" }, children: "sin coincidencias" }),
|
|
2144
|
+
visibles.map((opcion, i) => /* @__PURE__ */ jsx7(
|
|
2145
|
+
ListItemButton2,
|
|
2146
|
+
{
|
|
2147
|
+
ref: i === indice ? elegida : null,
|
|
2148
|
+
selected: i === indice,
|
|
2149
|
+
role: "option",
|
|
2150
|
+
onClick: () => onElegir(opcion.valor),
|
|
2151
|
+
sx: { gap: 2, py: 0.25, fontSize: "0.8rem" },
|
|
2152
|
+
children: opcion.etiquetas.map((etiqueta, j) => /* @__PURE__ */ jsx7("span", { style: { fontWeight: j === 0 ? 600 : 400, minWidth: j === 0 ? 40 : void 0 }, children: etiqueta }, j))
|
|
2153
|
+
},
|
|
2154
|
+
i
|
|
2155
|
+
))
|
|
2156
|
+
] })
|
|
2157
|
+
]
|
|
2158
|
+
}
|
|
2159
|
+
);
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
// src/components/grid/SelectorDeFecha.tsx
|
|
2163
|
+
import { useState as useState8 } from "react";
|
|
2164
|
+
import { Button as Button2, IconButton as IconButton3, Popover as Popover3, Typography as Typography4 } from "@mui/material";
|
|
2165
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2166
|
+
var MESES = ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"];
|
|
2167
|
+
var DIAS = ["lu", "ma", "mi", "ju", "vi", "s\xE1", "do"];
|
|
2168
|
+
var mismaFecha = (a, b) => b !== null && a.anio === b.anio && a.mes === b.mes && a.dia === b.dia;
|
|
2169
|
+
var MOVIMIENTOS = {
|
|
2170
|
+
ArrowLeft: [-1, 0],
|
|
2171
|
+
ArrowRight: [1, 0],
|
|
2172
|
+
ArrowUp: [-7, 0],
|
|
2173
|
+
ArrowDown: [7, 0],
|
|
2174
|
+
PageUp: [0, -1],
|
|
2175
|
+
PageDown: [0, 1]
|
|
2176
|
+
};
|
|
2177
|
+
function SelectorDeFecha({ anclaje, fechaActual, admiteNulo, onElegir, onCerrar }) {
|
|
2178
|
+
const hoy = /* @__PURE__ */ new Date();
|
|
2179
|
+
const fechaDeHoy = { anio: hoy.getFullYear(), mes: hoy.getMonth(), dia: hoy.getDate() };
|
|
2180
|
+
const [cursor, setCursor] = useState8(fechaActual ?? fechaDeHoy);
|
|
2181
|
+
const mover = (dias, meses) => {
|
|
2182
|
+
const nueva = new Date(cursor.anio, cursor.mes + meses, cursor.dia + dias);
|
|
2183
|
+
setCursor({ anio: nueva.getFullYear(), mes: nueva.getMonth(), dia: nueva.getDate() });
|
|
2184
|
+
};
|
|
2185
|
+
const alApretar = (evento) => {
|
|
2186
|
+
if (evento.key in MOVIMIENTOS) {
|
|
2187
|
+
mover(...MOVIMIENTOS[evento.key]);
|
|
2188
|
+
} else if (evento.key === "Enter") {
|
|
2189
|
+
onElegir(fechaATexto(cursor));
|
|
2190
|
+
} else if (evento.key === "F9" || evento.key === "Escape") {
|
|
2191
|
+
onCerrar();
|
|
2192
|
+
} else {
|
|
2193
|
+
return;
|
|
2194
|
+
}
|
|
2195
|
+
evento.preventDefault();
|
|
2196
|
+
evento.stopPropagation();
|
|
2197
|
+
};
|
|
2198
|
+
return /* @__PURE__ */ jsx8(Popover3, { open: true, anchorEl: anclaje, onClose: onCerrar, disableRestoreFocus: true, anchorOrigin: { vertical: "bottom", horizontal: "left" }, children: /* @__PURE__ */ jsxs7("div", { tabIndex: 0, ref: (el) => el?.focus(), onKeyDown: alApretar, style: { padding: 8, outline: "none", width: 252 }, "aria-label": "calendario", children: [
|
|
2199
|
+
/* @__PURE__ */ jsxs7("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
2200
|
+
/* @__PURE__ */ jsx8(IconButton3, { size: "small", "aria-label": "mes anterior", onClick: () => mover(0, -1), children: "\u2039" }),
|
|
2201
|
+
/* @__PURE__ */ jsxs7(Typography4, { variant: "body2", sx: { fontWeight: 600 }, children: [
|
|
2202
|
+
MESES[cursor.mes],
|
|
2203
|
+
" ",
|
|
2204
|
+
cursor.anio
|
|
2205
|
+
] }),
|
|
2206
|
+
/* @__PURE__ */ jsx8(IconButton3, { size: "small", "aria-label": "mes siguiente", onClick: () => mover(0, 1), children: "\u203A" })
|
|
2207
|
+
] }),
|
|
2208
|
+
/* @__PURE__ */ jsxs7("table", { style: { borderCollapse: "collapse", width: "100%", textAlign: "center", fontSize: "0.8rem" }, children: [
|
|
2209
|
+
/* @__PURE__ */ jsx8("thead", { children: /* @__PURE__ */ jsx8("tr", { children: DIAS.map((d) => /* @__PURE__ */ jsx8("th", { style: { fontWeight: 400, color: "#777" }, children: d }, d)) }) }),
|
|
2210
|
+
/* @__PURE__ */ jsx8("tbody", { children: semanasDelMes(cursor.anio, cursor.mes).map((semana, i) => /* @__PURE__ */ jsx8("tr", { children: semana.map((dia) => {
|
|
2211
|
+
const elegido = mismaFecha(dia, fechaActual);
|
|
2212
|
+
const enCursor = mismaFecha(dia, cursor);
|
|
2213
|
+
return /* @__PURE__ */ jsx8("td", { style: { padding: 1 }, children: /* @__PURE__ */ jsx8(
|
|
2214
|
+
"button",
|
|
2215
|
+
{
|
|
2216
|
+
type: "button",
|
|
2217
|
+
tabIndex: -1,
|
|
2218
|
+
onClick: () => onElegir(fechaATexto(dia)),
|
|
2219
|
+
style: {
|
|
2220
|
+
width: 32,
|
|
2221
|
+
height: 26,
|
|
2222
|
+
border: enCursor ? "1px solid #1976d2" : "1px solid transparent",
|
|
2223
|
+
borderRadius: 4,
|
|
2224
|
+
cursor: "pointer",
|
|
2225
|
+
background: elegido ? "#1976d2" : "transparent",
|
|
2226
|
+
color: elegido ? "#fff" : dia.delMesMostrado ? "#000" : "#aaa"
|
|
2227
|
+
},
|
|
2228
|
+
children: dia.dia
|
|
2229
|
+
}
|
|
2230
|
+
) }, `${dia.mes}-${dia.dia}`);
|
|
2231
|
+
}) }, i)) })
|
|
2232
|
+
] }),
|
|
2233
|
+
/* @__PURE__ */ jsxs7("div", { style: { display: "flex", justifyContent: "space-between", marginTop: 4 }, children: [
|
|
2234
|
+
/* @__PURE__ */ jsx8(Button2, { size: "small", onClick: () => onElegir(fechaATexto(fechaDeHoy)), children: "hoy" }),
|
|
2235
|
+
admiteNulo && /* @__PURE__ */ jsx8(Button2, { size: "small", onClick: () => onElegir(null), children: "vac\xEDo" })
|
|
2236
|
+
] })
|
|
2237
|
+
] }) });
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2240
|
+
// src/components/grid/VentanaDeTexto.tsx
|
|
2241
|
+
import { useState as useState9 } from "react";
|
|
2242
|
+
import { Button as Button3, InputBase as InputBase2, Popover as Popover4 } from "@mui/material";
|
|
2243
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2244
|
+
function VentanaDeTexto({ anclaje, texto, editable, onAceptar, onCerrar }) {
|
|
2245
|
+
const [valor, setValor] = useState9(texto);
|
|
2246
|
+
const alApretar = (evento) => {
|
|
2247
|
+
if (evento.key === "Escape" || evento.key === "F9") {
|
|
2248
|
+
onCerrar();
|
|
2249
|
+
} else if (evento.key === "Enter" && evento.ctrlKey && editable) {
|
|
2250
|
+
onAceptar(valor);
|
|
2251
|
+
} else {
|
|
2252
|
+
return;
|
|
2253
|
+
}
|
|
2254
|
+
evento.preventDefault();
|
|
2255
|
+
evento.stopPropagation();
|
|
2256
|
+
};
|
|
2257
|
+
return /* @__PURE__ */ jsx9(Popover4, { open: true, anchorEl: anclaje, onClose: onCerrar, disableRestoreFocus: true, anchorOrigin: { vertical: "bottom", horizontal: "left" }, children: /* @__PURE__ */ jsxs8("div", { style: { padding: 8, minWidth: 320, maxWidth: 640 }, children: [
|
|
2258
|
+
/* @__PURE__ */ jsx9(
|
|
2259
|
+
InputBase2,
|
|
2260
|
+
{
|
|
2261
|
+
autoFocus: true,
|
|
2262
|
+
multiline: true,
|
|
2263
|
+
fullWidth: true,
|
|
2264
|
+
readOnly: !editable,
|
|
2265
|
+
value: valor,
|
|
2266
|
+
onChange: (e) => setValor(e.target.value),
|
|
2267
|
+
onKeyDown: alApretar,
|
|
2268
|
+
minRows: 2,
|
|
2269
|
+
maxRows: 16,
|
|
2270
|
+
sx: { fontFamily: "monospace", fontSize: "0.8rem", border: "1px solid #ccc", borderRadius: "4px", p: 0.5 },
|
|
2271
|
+
inputProps: { "aria-label": "contenido de la celda" }
|
|
2272
|
+
}
|
|
2273
|
+
),
|
|
2274
|
+
editable && /* @__PURE__ */ jsxs8("div", { style: { display: "flex", justifyContent: "flex-end", gap: 8, marginTop: 4 }, children: [
|
|
2275
|
+
/* @__PURE__ */ jsx9(Button3, { size: "small", onClick: onCerrar, children: "cancelar" }),
|
|
2276
|
+
/* @__PURE__ */ jsx9(Button3, { size: "small", variant: "contained", onClick: () => onAceptar(valor), children: "aceptar" })
|
|
2277
|
+
] })
|
|
2278
|
+
] }) });
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2281
|
+
// src/hooks/grid/useExpander.tsx
|
|
2282
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
2283
|
+
var useExpander = ({ campo, editable, fila, admiteNulo, tipos, anclaje, textoActual, valorActual, alElegirValor, alConfirmarTexto, alFallar }) => {
|
|
2284
|
+
const [expansion, setExpansion] = useState10(null);
|
|
2285
|
+
const abierto = React8.useRef(false);
|
|
2286
|
+
const tipoDelCampo = tipoDeExpander(campo, editable);
|
|
2287
|
+
const tipo = tipoDelCampo === null || tipoDelCampo === "json" || tipos && !tipos.includes(tipoDelCampo) ? null : tipoDelCampo;
|
|
2288
|
+
const abrir = useCallback7(async (busqueda) => {
|
|
2289
|
+
if (tipo === null || abierto.current) return;
|
|
2290
|
+
abierto.current = true;
|
|
2291
|
+
try {
|
|
2292
|
+
if (tipo === "referencia" && esCampoConReferencia(campo)) {
|
|
2293
|
+
const { definicion, filas } = await cargarReferencia(campo.references);
|
|
2294
|
+
setExpansion({ tipo: "opciones", opciones: opcionesDeReferencia(campo, definicion, filas, fila, admiteNulo), busqueda });
|
|
2295
|
+
} else if (tipo === "booleano") {
|
|
2296
|
+
setExpansion({ tipo: "opciones", opciones: opcionesDeBooleano(admiteNulo), busqueda });
|
|
2297
|
+
} else if (tipo === "opciones") {
|
|
2298
|
+
setExpansion({ tipo: "opciones", opciones: opcionesDeEnumerado(campo.options ?? [], admiteNulo), busqueda });
|
|
2299
|
+
} else {
|
|
2300
|
+
setExpansion({ tipo: tipo === "fecha" ? "fecha" : "texto" });
|
|
2301
|
+
}
|
|
2302
|
+
} catch (err) {
|
|
2303
|
+
abierto.current = false;
|
|
2304
|
+
alFallar(mensajeDeError(err));
|
|
2305
|
+
}
|
|
2306
|
+
}, [tipo, campo, fila, admiteNulo, alFallar]);
|
|
2307
|
+
const cerrar = useCallback7(() => {
|
|
2308
|
+
abierto.current = false;
|
|
2309
|
+
setExpansion(null);
|
|
2310
|
+
setTimeout(() => anclaje.current?.focus(), 0);
|
|
2311
|
+
}, [anclaje]);
|
|
2312
|
+
const elegirValor = useCallback7((valor) => {
|
|
2313
|
+
cerrar();
|
|
2314
|
+
alElegirValor(valor);
|
|
2315
|
+
}, [cerrar, alElegirValor]);
|
|
2316
|
+
const confirmarTexto = useCallback7((texto) => {
|
|
2317
|
+
cerrar();
|
|
2318
|
+
alConfirmarTexto(texto);
|
|
2319
|
+
}, [cerrar, alConfirmarTexto]);
|
|
2320
|
+
const manejarTecla = useCallback7((event) => {
|
|
2321
|
+
const esExpander = event.key === "F9" && !event.shiftKey && !event.ctrlKey && !event.altKey || event.key === "ArrowDown" && event.altKey && !event.shiftKey && !event.ctrlKey;
|
|
2322
|
+
if (tipo === null || !esExpander) return false;
|
|
2323
|
+
event.preventDefault();
|
|
2324
|
+
void abrir("");
|
|
2325
|
+
return true;
|
|
2326
|
+
}, [tipo, abrir]);
|
|
2327
|
+
const titulo = tipo === "fecha" ? "elegir fecha (F9)" : tipo === "texto" ? "ver el contenido completo (F9)" : "elegir un valor (F9)";
|
|
2328
|
+
const lupa = tipo === null ? null : /* @__PURE__ */ jsx10(
|
|
2329
|
+
IconButton4,
|
|
2330
|
+
{
|
|
2331
|
+
size: "small",
|
|
2332
|
+
tabIndex: -1,
|
|
2333
|
+
"aria-label": titulo.replace(" (F9)", ""),
|
|
2334
|
+
title: titulo,
|
|
2335
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
2336
|
+
onClick: (e) => {
|
|
2337
|
+
e.stopPropagation();
|
|
2338
|
+
void abrir("");
|
|
2339
|
+
},
|
|
2340
|
+
sx: { p: 0, ml: 0.25, color: "primary.main", "&:hover": { backgroundColor: "action.hover" } },
|
|
2341
|
+
children: tipo === "fecha" ? /* @__PURE__ */ jsx10(CalendarMonthIcon, { sx: { fontSize: 16 } }) : tipo === "texto" ? /* @__PURE__ */ jsx10(SearchIcon2, { sx: { fontSize: 16 } }) : /* @__PURE__ */ jsx10(ArrowDropDownIcon, { sx: { fontSize: 20 } })
|
|
2342
|
+
}
|
|
2343
|
+
);
|
|
2344
|
+
const base = anclaje.current;
|
|
2345
|
+
const ventana = !expansion || !base ? null : expansion.tipo === "opciones" ? /* @__PURE__ */ jsx10(MenuDeOpciones, { anclaje: base, opciones: expansion.opciones, busquedaInicial: expansion.busqueda, onElegir: elegirValor, onCerrar: cerrar }) : expansion.tipo === "fecha" ? /* @__PURE__ */ jsx10(SelectorDeFecha, { anclaje: base, fechaActual: fechaDeValor(valorActual), admiteNulo, onElegir: confirmarTexto, onCerrar: cerrar }) : /* @__PURE__ */ jsx10(VentanaDeTexto, { anclaje: base, texto: textoActual, editable: true, onAceptar: confirmarTexto, onCerrar: cerrar });
|
|
2346
|
+
return { tipo, abierto, abrir, manejarTecla, lupa, ventana };
|
|
2347
|
+
};
|
|
2348
|
+
|
|
2349
|
+
// src/components/forms/TypedField.tsx
|
|
2350
|
+
import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2082
2351
|
var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode = false, feedback, isMandatory = false }) => {
|
|
2083
2352
|
const theme = useTheme();
|
|
2084
|
-
const typer =
|
|
2085
|
-
const isBoolean = fieldDef.typeName === "boolean";
|
|
2086
|
-
const [localString, setLocalString] =
|
|
2353
|
+
const typer = useMemo6(() => typeStore3.typerFrom(fieldDef), [fieldDef]);
|
|
2354
|
+
const isBoolean = fieldDef.typeName === "boolean" && !isFilterMode;
|
|
2355
|
+
const [localString, setLocalString] = useState11(() => {
|
|
2087
2356
|
if (isBoolean) return "";
|
|
2088
2357
|
if (isFilterMode) return value !== null && value !== void 0 ? String(value) : "";
|
|
2089
2358
|
try {
|
|
@@ -2092,10 +2361,10 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2092
2361
|
return value === null || value === void 0 ? "" : String(value);
|
|
2093
2362
|
}
|
|
2094
2363
|
});
|
|
2095
|
-
const [errorMsg, setErrorMsg] =
|
|
2096
|
-
const lastValueRef =
|
|
2097
|
-
const lastCommittedStringRef =
|
|
2098
|
-
|
|
2364
|
+
const [errorMsg, setErrorMsg] = useState11(null);
|
|
2365
|
+
const lastValueRef = useRef5(value);
|
|
2366
|
+
const lastCommittedStringRef = useRef5(localString);
|
|
2367
|
+
useEffect4(() => {
|
|
2099
2368
|
if (!isBoolean) {
|
|
2100
2369
|
if (value !== lastValueRef.current) {
|
|
2101
2370
|
lastValueRef.current = value;
|
|
@@ -2112,7 +2381,27 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2112
2381
|
}
|
|
2113
2382
|
}
|
|
2114
2383
|
}, [value, typer, isBoolean, isFilterMode]);
|
|
2115
|
-
const
|
|
2384
|
+
const entradaRef = useRef5(null);
|
|
2385
|
+
const [enfocado, setEnfocado] = useState11(false);
|
|
2386
|
+
const escribirEnFiltro = useCallback8((texto) => {
|
|
2387
|
+
setLocalString(texto);
|
|
2388
|
+
lastValueRef.current = texto;
|
|
2389
|
+
onChange(fieldDef.name, texto, true);
|
|
2390
|
+
}, [onChange, fieldDef.name]);
|
|
2391
|
+
const expander = useExpander({
|
|
2392
|
+
campo: fieldDef,
|
|
2393
|
+
editable: true,
|
|
2394
|
+
fila: null,
|
|
2395
|
+
admiteNulo: false,
|
|
2396
|
+
tipos: isFilterMode ? ["referencia", "booleano", "opciones", "fecha"] : [],
|
|
2397
|
+
anclaje: entradaRef,
|
|
2398
|
+
textoActual: localString,
|
|
2399
|
+
valorActual: localString,
|
|
2400
|
+
alElegirValor: (valor) => escribirEnFiltro(valor === null || valor === void 0 ? "" : typeof valor === "boolean" ? typer.toLocalString(valor) : String(valor)),
|
|
2401
|
+
alConfirmarTexto: (texto) => escribirEnFiltro(texto ?? ""),
|
|
2402
|
+
alFallar: (mensaje) => setErrorMsg(mensaje)
|
|
2403
|
+
});
|
|
2404
|
+
const handleTextChange = useCallback8((e) => {
|
|
2116
2405
|
const newValueString = e.target.value;
|
|
2117
2406
|
setLocalString(newValueString);
|
|
2118
2407
|
let parsedValue = null;
|
|
@@ -2133,7 +2422,7 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2133
2422
|
lastValueRef.current = parsedValue;
|
|
2134
2423
|
onChange(fieldDef.name, parsedValue, isValid);
|
|
2135
2424
|
}, [typer, onChange, fieldDef.name, isFilterMode]);
|
|
2136
|
-
const handleTextCommit =
|
|
2425
|
+
const handleTextCommit = useCallback8(() => {
|
|
2137
2426
|
if (!onCommit) return;
|
|
2138
2427
|
if (localString === lastCommittedStringRef.current) return;
|
|
2139
2428
|
lastCommittedStringRef.current = localString;
|
|
@@ -2151,13 +2440,14 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2151
2440
|
}
|
|
2152
2441
|
onCommit(fieldDef.name, parsedValue, isValid);
|
|
2153
2442
|
}, [onCommit, fieldDef.name, localString, isFilterMode, typer]);
|
|
2154
|
-
const handleTextKeyDown =
|
|
2443
|
+
const handleTextKeyDown = useCallback8((e) => {
|
|
2444
|
+
if (expander.manejarTecla(e)) return;
|
|
2155
2445
|
if (e.key === "Enter") {
|
|
2156
2446
|
e.preventDefault();
|
|
2157
2447
|
handleTextCommit();
|
|
2158
2448
|
}
|
|
2159
|
-
}, [handleTextCommit]);
|
|
2160
|
-
const handleBooleanChange =
|
|
2449
|
+
}, [handleTextCommit, expander]);
|
|
2450
|
+
const handleBooleanChange = useCallback8((e) => {
|
|
2161
2451
|
const val = e.target.value;
|
|
2162
2452
|
let finalValue = null;
|
|
2163
2453
|
if (val === "true") finalValue = true;
|
|
@@ -2185,28 +2475,28 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2185
2475
|
}
|
|
2186
2476
|
const cellBackgroundColor2 = feedback === "error" ? theme.palette.error.light : feedback === "success" ? theme.palette.success.light : defaultBgColor;
|
|
2187
2477
|
const transitionStyle2 = "background-color 0.3s ease-in-out";
|
|
2188
|
-
return /* @__PURE__ */
|
|
2189
|
-
!isFilterMode && /* @__PURE__ */
|
|
2190
|
-
/* @__PURE__ */
|
|
2478
|
+
return /* @__PURE__ */ jsxs9(FormControl, { fullWidth: true, error: !!errorMsg && !isFilterMode, disabled: isDisabled, size: "small", margin: "dense", children: [
|
|
2479
|
+
!isFilterMode && /* @__PURE__ */ jsx11(InputLabel, { shrink: true, children: fieldDef.name }),
|
|
2480
|
+
/* @__PURE__ */ jsxs9(
|
|
2191
2481
|
Select,
|
|
2192
2482
|
{
|
|
2193
2483
|
value: boolVal,
|
|
2194
2484
|
label: !isFilterMode ? fieldDef.name : void 0,
|
|
2195
2485
|
onChange: handleBooleanChange,
|
|
2196
|
-
startAdornment: isMandatory && isEmpty && !isFilterMode ? /* @__PURE__ */
|
|
2486
|
+
startAdornment: isMandatory && isEmpty && !isFilterMode ? /* @__PURE__ */ jsx11(InputAdornment, { position: "start", sx: { color: "text.secondary", ml: 0.5 }, children: "*" }) : void 0,
|
|
2197
2487
|
displayEmpty: true,
|
|
2198
2488
|
sx: isFilterMode ? { height: 25, fontSize: "0.8rem", backgroundColor: "background.paper" } : {
|
|
2199
2489
|
backgroundColor: cellBackgroundColor2,
|
|
2200
2490
|
transition: transitionStyle2
|
|
2201
2491
|
},
|
|
2202
2492
|
children: [
|
|
2203
|
-
fieldDef.nullable !== false && /* @__PURE__ */
|
|
2204
|
-
/* @__PURE__ */
|
|
2205
|
-
/* @__PURE__ */
|
|
2493
|
+
fieldDef.nullable !== false && /* @__PURE__ */ jsx11(MenuItem, { value: "", children: /* @__PURE__ */ jsx11("em", { children: "Nulo / Sin Especificar" }) }),
|
|
2494
|
+
/* @__PURE__ */ jsx11(MenuItem, { value: "true", children: "S\xED (Verdadero)" }),
|
|
2495
|
+
/* @__PURE__ */ jsx11(MenuItem, { value: "false", children: "No (Falso)" })
|
|
2206
2496
|
]
|
|
2207
2497
|
}
|
|
2208
2498
|
),
|
|
2209
|
-
errorMsg && !isFilterMode && /* @__PURE__ */
|
|
2499
|
+
errorMsg && !isFilterMode && /* @__PURE__ */ jsx11(FormHelperText, { children: errorMsg })
|
|
2210
2500
|
] });
|
|
2211
2501
|
}
|
|
2212
2502
|
let inputType = "text";
|
|
@@ -2220,54 +2510,65 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
|
|
|
2220
2510
|
}
|
|
2221
2511
|
const cellBackgroundColor = feedback === "error" ? theme.palette.error.light : feedback === "success" ? theme.palette.success.light : defaultTextBgColor;
|
|
2222
2512
|
const transitionStyle = "background-color 0.3s ease-in-out";
|
|
2223
|
-
return /* @__PURE__ */
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
minWidth: 50,
|
|
2251
|
-
fontSize: "0.8rem",
|
|
2252
|
-
padding: "0px"
|
|
2253
|
-
}
|
|
2254
|
-
} : {
|
|
2255
|
-
"& .MuiOutlinedInput-root": {
|
|
2256
|
-
backgroundColor: cellBackgroundColor,
|
|
2257
|
-
transition: transitionStyle
|
|
2513
|
+
return /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
2514
|
+
/* @__PURE__ */ jsx11(
|
|
2515
|
+
TextField,
|
|
2516
|
+
{
|
|
2517
|
+
fullWidth: true,
|
|
2518
|
+
inputRef: entradaRef,
|
|
2519
|
+
type: inputType,
|
|
2520
|
+
label: isFilterMode ? void 0 : fieldDef.name,
|
|
2521
|
+
variant: "outlined",
|
|
2522
|
+
size: "small",
|
|
2523
|
+
margin: isFilterMode ? "none" : "dense",
|
|
2524
|
+
value: localString,
|
|
2525
|
+
onChange: handleTextChange,
|
|
2526
|
+
disabled: isDisabled,
|
|
2527
|
+
error: !!errorMsg && !isFilterMode,
|
|
2528
|
+
helperText: !isFilterMode ? errorMsg || (isMandatory ? "Obligatorio" : "") : void 0,
|
|
2529
|
+
InputLabelProps: !isFilterMode ? { shrink: true } : void 0,
|
|
2530
|
+
InputProps: isFilterMode ? {
|
|
2531
|
+
// la lupa solo al enfocar el filtro, como en backend-plus
|
|
2532
|
+
endAdornment: enfocado || expander.abierto.current ? expander.lupa : void 0
|
|
2533
|
+
} : isMandatory && isEmptyText ? {
|
|
2534
|
+
startAdornment: /* @__PURE__ */ jsx11(InputAdornment, { position: "start", sx: { color: "text.secondary", mr: 0.5 }, children: "*" })
|
|
2535
|
+
} : {},
|
|
2536
|
+
inputProps: {
|
|
2537
|
+
style: {
|
|
2538
|
+
textAlign: isNumericType(fieldDef.typeName) ? "right" : "left"
|
|
2539
|
+
}
|
|
2258
2540
|
},
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2541
|
+
sx: isFilterMode ? {
|
|
2542
|
+
"& .MuiOutlinedInput-root": {
|
|
2543
|
+
backgroundColor: "background.paper",
|
|
2544
|
+
height: FILTER_ROW_HEIGHT - 5,
|
|
2545
|
+
minWidth: 50,
|
|
2546
|
+
fontSize: "0.8rem",
|
|
2547
|
+
padding: "0px"
|
|
2548
|
+
}
|
|
2549
|
+
} : {
|
|
2550
|
+
"& .MuiOutlinedInput-root": {
|
|
2551
|
+
backgroundColor: cellBackgroundColor,
|
|
2552
|
+
transition: transitionStyle
|
|
2553
|
+
},
|
|
2554
|
+
"& .MuiOutlinedInput-input": {
|
|
2555
|
+
padding: "6px 12px"
|
|
2556
|
+
}
|
|
2557
|
+
},
|
|
2558
|
+
onFocus: () => setEnfocado(true),
|
|
2559
|
+
onBlur: () => {
|
|
2560
|
+
setEnfocado(false);
|
|
2561
|
+
handleTextCommit();
|
|
2562
|
+
},
|
|
2563
|
+
onKeyDown: handleTextKeyDown
|
|
2564
|
+
}
|
|
2565
|
+
),
|
|
2566
|
+
expander.ventana
|
|
2567
|
+
] });
|
|
2267
2568
|
};
|
|
2268
2569
|
|
|
2269
2570
|
// src/components/grid/FilterInputRender.tsx
|
|
2270
|
-
import { jsx as
|
|
2571
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2271
2572
|
function FilterInputRenderer({
|
|
2272
2573
|
columnKey,
|
|
2273
2574
|
currentFilter,
|
|
@@ -2290,8 +2591,8 @@ function FilterInputRenderer({
|
|
|
2290
2591
|
[columnKey]: { operator: newOp, value: formattedVal }
|
|
2291
2592
|
}));
|
|
2292
2593
|
};
|
|
2293
|
-
return /* @__PURE__ */
|
|
2294
|
-
/* @__PURE__ */
|
|
2594
|
+
return /* @__PURE__ */ jsxs10(Box4, { sx: { mt: 0, display: "flex", alignItems: "center", gap: 0.5, pr: 1 }, children: [
|
|
2595
|
+
/* @__PURE__ */ jsx12(
|
|
2295
2596
|
"select",
|
|
2296
2597
|
{
|
|
2297
2598
|
value: operator,
|
|
@@ -2307,10 +2608,10 @@ function FilterInputRenderer({
|
|
|
2307
2608
|
textAlign: "center",
|
|
2308
2609
|
cursor: "pointer"
|
|
2309
2610
|
},
|
|
2310
|
-
children: filterOperators.map((op) => /* @__PURE__ */
|
|
2611
|
+
children: filterOperators.map((op) => /* @__PURE__ */ jsx12("option", { value: op.value, children: op.label }, op.value))
|
|
2311
2612
|
}
|
|
2312
2613
|
),
|
|
2313
|
-
/* @__PURE__ */
|
|
2614
|
+
/* @__PURE__ */ jsx12(
|
|
2314
2615
|
TypedField,
|
|
2315
2616
|
{
|
|
2316
2617
|
fieldDef,
|
|
@@ -2321,8 +2622,8 @@ function FilterInputRenderer({
|
|
|
2321
2622
|
)
|
|
2322
2623
|
] });
|
|
2323
2624
|
}
|
|
2324
|
-
return /* @__PURE__ */
|
|
2325
|
-
|
|
2625
|
+
return /* @__PURE__ */ jsx12(
|
|
2626
|
+
InputBase3,
|
|
2326
2627
|
{
|
|
2327
2628
|
value: currentFilter || "",
|
|
2328
2629
|
onChange: (e) => setFilters((prev) => ({
|
|
@@ -2344,18 +2645,18 @@ function FilterInputRenderer({
|
|
|
2344
2645
|
}
|
|
2345
2646
|
);
|
|
2346
2647
|
}
|
|
2347
|
-
var FilterInputRender_default =
|
|
2648
|
+
var FilterInputRender_default = React10.memo(FilterInputRenderer);
|
|
2348
2649
|
|
|
2349
2650
|
// src/components/grid/renderers/summaryCellRenderers.tsx
|
|
2350
2651
|
import { Box as Box5 } from "@mui/material";
|
|
2351
|
-
import { jsx as
|
|
2652
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2352
2653
|
var defaultColumnSummaryCellRenderer = (props, fixedFields) => {
|
|
2353
2654
|
const { column, row } = props;
|
|
2354
2655
|
if (row.id === "filterRow") {
|
|
2355
2656
|
const { filters, setFilters } = row;
|
|
2356
2657
|
if (valorFijoDe(fixedFields, column.key)) return null;
|
|
2357
2658
|
const fieldDef = esColumnaPropia(column) && column.customType === "default" ? column.fieldDef : void 0;
|
|
2358
|
-
return /* @__PURE__ */
|
|
2659
|
+
return /* @__PURE__ */ jsx13(Box5, { sx: { width: "100%", height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsx13(
|
|
2359
2660
|
FilterInputRender_default,
|
|
2360
2661
|
{
|
|
2361
2662
|
columnKey: column.key,
|
|
@@ -2397,7 +2698,7 @@ var defaultColumnSummaryCellRenderer = (props, fixedFields) => {
|
|
|
2397
2698
|
label = "Cant S\xED: ";
|
|
2398
2699
|
break;
|
|
2399
2700
|
}
|
|
2400
|
-
return /* @__PURE__ */
|
|
2701
|
+
return /* @__PURE__ */ jsxs11(Box5, { sx: {
|
|
2401
2702
|
px: 0,
|
|
2402
2703
|
fontWeight: "bold",
|
|
2403
2704
|
fontSize: "0.875rem",
|
|
@@ -2415,35 +2716,35 @@ var actionsColumnSummaryCellRenderer = (_props) => null;
|
|
|
2415
2716
|
var detailColumnCellSummaryRenderer = (_props) => null;
|
|
2416
2717
|
|
|
2417
2718
|
// src/components/grid/renderers/cellRenderers.tsx
|
|
2418
|
-
import
|
|
2419
|
-
import { Box as Box8, Button as
|
|
2719
|
+
import React11 from "react";
|
|
2720
|
+
import { Box as Box8, Button as Button4, Tooltip as Tooltip4, useTheme as useTheme2 } from "@mui/material";
|
|
2420
2721
|
import ViewHeadlineIcon from "@mui/icons-material/ViewHeadline";
|
|
2421
2722
|
import DeleteIcon from "@mui/icons-material/Delete";
|
|
2422
2723
|
import AddIcon2 from "@mui/icons-material/Add";
|
|
2423
2724
|
|
|
2424
2725
|
// src/components/grid/ExampleClientSideComponent.tsx
|
|
2425
|
-
import { Box as Box6, Typography as
|
|
2426
|
-
import { jsx as
|
|
2726
|
+
import { Box as Box6, Typography as Typography5 } from "@mui/material";
|
|
2727
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
2427
2728
|
var ExampleClientSideComponent = ({ row, column, fieldDefinition }) => {
|
|
2428
2729
|
const value = row[column.key];
|
|
2429
|
-
return /* @__PURE__ */
|
|
2730
|
+
return /* @__PURE__ */ jsx14(Box6, { sx: {
|
|
2430
2731
|
padding: 0.5,
|
|
2431
2732
|
width: "100%",
|
|
2432
2733
|
height: "100%",
|
|
2433
2734
|
display: "flex",
|
|
2434
2735
|
alignItems: "center",
|
|
2435
2736
|
backgroundColor: value === "Special" ? "lightblue" : "transparent"
|
|
2436
|
-
}, children: /* @__PURE__ */
|
|
2737
|
+
}, children: /* @__PURE__ */ jsx14(Typography5, { variant: "body2", sx: { fontWeight: "bold" }, children: value ? `CS: ${value}` : "N/A" }) });
|
|
2437
2738
|
};
|
|
2438
2739
|
var ExampleClientSideComponent_default = ExampleClientSideComponent;
|
|
2439
2740
|
|
|
2440
2741
|
// src/components/grid/FallbackClientSideRenderer.tsx
|
|
2441
|
-
import { Box as Box7, Typography as
|
|
2742
|
+
import { Box as Box7, Typography as Typography6, Tooltip as Tooltip3 } from "@mui/material";
|
|
2442
2743
|
import WarningAmberIcon2 from "@mui/icons-material/WarningAmber";
|
|
2443
|
-
import { jsx as
|
|
2744
|
+
import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2444
2745
|
var FallbackClientSideRenderer = ({ column, row, fieldDefinition }) => {
|
|
2445
2746
|
const clientSideName = fieldDefinition?.clientSide || "Desconocido";
|
|
2446
|
-
return /* @__PURE__ */
|
|
2747
|
+
return /* @__PURE__ */ jsx15(Tooltip3, { title: `Componente clientSide '${clientSideName}' no implementado. Mostrando valor por defecto.`, children: /* @__PURE__ */ jsxs12(
|
|
2447
2748
|
Box7,
|
|
2448
2749
|
{
|
|
2449
2750
|
sx: {
|
|
@@ -2464,8 +2765,8 @@ var FallbackClientSideRenderer = ({ column, row, fieldDefinition }) => {
|
|
|
2464
2765
|
// Evita que el contenido se desborde
|
|
2465
2766
|
},
|
|
2466
2767
|
children: [
|
|
2467
|
-
/* @__PURE__ */
|
|
2468
|
-
/* @__PURE__ */
|
|
2768
|
+
/* @__PURE__ */ jsx15(Typography6, { variant: "body2", noWrap: true, sx: { flexGrow: 1 }, children: clientSideName + " not found" }),
|
|
2769
|
+
/* @__PURE__ */ jsx15(
|
|
2469
2770
|
WarningAmberIcon2,
|
|
2470
2771
|
{
|
|
2471
2772
|
sx: {
|
|
@@ -2493,8 +2794,8 @@ var extendClientSides = (newRenderers) => {
|
|
|
2493
2794
|
};
|
|
2494
2795
|
|
|
2495
2796
|
// src/components/grid/renderers/cellRenderers.tsx
|
|
2496
|
-
import { jsx as
|
|
2497
|
-
var CeldaDato =
|
|
2797
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
2798
|
+
var CeldaDato = React11.memo(function CeldaDato2({ row, columnKey, defaultColumn }) {
|
|
2498
2799
|
const theme = useTheme2();
|
|
2499
2800
|
const { primaryKey, fixedFields, typer, isMandatory, isNumeric } = defaultColumn;
|
|
2500
2801
|
const rowId = getPrimaryKeyValues(row, primaryKey);
|
|
@@ -2515,7 +2816,7 @@ var CeldaDato = React7.memo(function CeldaDato2({ row, columnKey, defaultColumn
|
|
|
2515
2816
|
displayValue = "* " + displayValue;
|
|
2516
2817
|
}
|
|
2517
2818
|
const signal = displayValue === "--" ? "typed-controls-signal-no-data" : displayValue === "//" ? "typed-controls-signal-unknown-data" : "";
|
|
2518
|
-
const celda = /* @__PURE__ */
|
|
2819
|
+
const celda = /* @__PURE__ */ jsx16(
|
|
2519
2820
|
"div",
|
|
2520
2821
|
{
|
|
2521
2822
|
className: `fpr-celda ${isNumeric ? "fpr-celda-numerica" : ""} ${signal} ${row[NEW_ROW_INDICATOR] ? "new-row-cell-animation" : ""}`,
|
|
@@ -2523,13 +2824,13 @@ var CeldaDato = React7.memo(function CeldaDato2({ row, columnKey, defaultColumn
|
|
|
2523
2824
|
children: displayValue
|
|
2524
2825
|
}
|
|
2525
2826
|
);
|
|
2526
|
-
return currentCellFeedback?.message ? /* @__PURE__ */
|
|
2827
|
+
return currentCellFeedback?.message ? /* @__PURE__ */ jsx16(Tooltip4, { title: currentCellFeedback.message, children: celda }) : celda;
|
|
2527
2828
|
});
|
|
2528
2829
|
var allColumnsCellRenderer = (props) => {
|
|
2529
2830
|
const { row, column } = props;
|
|
2530
2831
|
if (!esColumnaPropia(column)) return void 0;
|
|
2531
2832
|
if (esFilaDetalle(row)) {
|
|
2532
|
-
return column.customType === "action" ? /* @__PURE__ */
|
|
2833
|
+
return column.customType === "action" ? /* @__PURE__ */ jsx16(CeldaDetalle, { fila: row }) : null;
|
|
2533
2834
|
}
|
|
2534
2835
|
switch (column.customType) {
|
|
2535
2836
|
case "default": {
|
|
@@ -2538,15 +2839,15 @@ var allColumnsCellRenderer = (props) => {
|
|
|
2538
2839
|
if (fieldDef?.clientSide) {
|
|
2539
2840
|
const ClientSideComponent = clientSides[fieldDef.clientSide];
|
|
2540
2841
|
if (ClientSideComponent) {
|
|
2541
|
-
return /* @__PURE__ */
|
|
2842
|
+
return /* @__PURE__ */ jsx16(ClientSideComponent, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
|
|
2542
2843
|
}
|
|
2543
|
-
return /* @__PURE__ */
|
|
2844
|
+
return /* @__PURE__ */ jsx16(FallbackClientSideRenderer_default, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
|
|
2544
2845
|
}
|
|
2545
|
-
return /* @__PURE__ */
|
|
2846
|
+
return /* @__PURE__ */ jsx16(CeldaDato, { row, columnKey: props.column.key, defaultColumn });
|
|
2546
2847
|
}
|
|
2547
2848
|
case "detail": {
|
|
2548
2849
|
const { detailTable, primaryKey } = column;
|
|
2549
|
-
return /* @__PURE__ */
|
|
2850
|
+
return /* @__PURE__ */ jsx16(
|
|
2550
2851
|
BotonDetalle,
|
|
2551
2852
|
{
|
|
2552
2853
|
row,
|
|
@@ -2581,8 +2882,8 @@ var allColumnsCellRenderer = (props) => {
|
|
|
2581
2882
|
color: "primary"
|
|
2582
2883
|
}
|
|
2583
2884
|
];
|
|
2584
|
-
return /* @__PURE__ */
|
|
2585
|
-
|
|
2885
|
+
return /* @__PURE__ */ jsx16(Box8, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%", gap: 0.5 }, children: gridActionButtons.map((actionDef) => tableDefinition.allow[actionDef.action] ? /* @__PURE__ */ jsx16(
|
|
2886
|
+
Button4,
|
|
2586
2887
|
{
|
|
2587
2888
|
variant: "outlined",
|
|
2588
2889
|
color: actionDef.color,
|
|
@@ -2590,7 +2891,7 @@ var allColumnsCellRenderer = (props) => {
|
|
|
2590
2891
|
onClick: () => actionDef.handler(row),
|
|
2591
2892
|
title: actionDef.title,
|
|
2592
2893
|
sx: { width: 22, minWidth: 22, height: 22, "& .MuiButton-startIcon": { m: 0 } },
|
|
2593
|
-
children: /* @__PURE__ */
|
|
2894
|
+
children: /* @__PURE__ */ jsx16(actionDef.icon, { sx: { fontSize: 18 } })
|
|
2594
2895
|
},
|
|
2595
2896
|
actionDef.action
|
|
2596
2897
|
) : null) });
|
|
@@ -2601,13 +2902,13 @@ var allColumnsCellRenderer = (props) => {
|
|
|
2601
2902
|
};
|
|
2602
2903
|
|
|
2603
2904
|
// src/components/grid/InputRenderer.tsx
|
|
2604
|
-
import
|
|
2905
|
+
import React12, { useCallback as useCallback10, useEffect as useEffect5, useMemo as useMemo7, useState as useState12 } from "react";
|
|
2605
2906
|
|
|
2606
2907
|
// src/hooks/useTableRecordSave.ts
|
|
2607
|
-
import { useCallback as
|
|
2908
|
+
import { useCallback as useCallback9 } from "react";
|
|
2608
2909
|
var useTableRecordSave = () => {
|
|
2609
2910
|
const { callApi, loading, error } = useApiCall();
|
|
2610
|
-
const saveRecord =
|
|
2911
|
+
const saveRecord = useCallback9(async ({
|
|
2611
2912
|
tableDefinition,
|
|
2612
2913
|
isNewRow,
|
|
2613
2914
|
formData,
|
|
@@ -2654,207 +2955,9 @@ var useTableRecordSave = () => {
|
|
|
2654
2955
|
|
|
2655
2956
|
// src/components/grid/InputRenderer.tsx
|
|
2656
2957
|
import InputBase4 from "@mui/material/InputBase";
|
|
2657
|
-
import IconButton4 from "@mui/material/IconButton";
|
|
2658
|
-
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
|
|
2659
|
-
import CalendarMonthIcon from "@mui/icons-material/CalendarMonth";
|
|
2660
|
-
import SearchIcon2 from "@mui/icons-material/Search";
|
|
2661
2958
|
import { Tooltip as Tooltip5, useTheme as useTheme3 } from "@mui/material";
|
|
2662
|
-
|
|
2663
|
-
// src/components/grid/MenuDeOpciones.tsx
|
|
2664
|
-
import { useEffect as useEffect4, useMemo as useMemo6, useRef as useRef5, useState as useState8 } from "react";
|
|
2665
|
-
import { InputBase as InputBase2, List as List2, ListItemButton as ListItemButton2, Popover as Popover2, Typography as Typography5 } from "@mui/material";
|
|
2666
|
-
import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2667
|
-
function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar }) {
|
|
2668
|
-
const [busqueda, setBusqueda] = useState8(busquedaInicial);
|
|
2669
|
-
const [indice, setIndice] = useState8(0);
|
|
2670
|
-
const visibles = useMemo6(() => filtrarOpciones(opciones, busqueda), [opciones, busqueda]);
|
|
2671
|
-
const elegida = useRef5(null);
|
|
2672
|
-
useEffect4(() => {
|
|
2673
|
-
elegida.current?.scrollIntoView({ block: "nearest" });
|
|
2674
|
-
}, [indice, visibles]);
|
|
2675
|
-
const alApretar = (evento) => {
|
|
2676
|
-
if (evento.key === "ArrowDown") {
|
|
2677
|
-
setIndice((i) => Math.min(i + 1, visibles.length - 1));
|
|
2678
|
-
} else if (evento.key === "ArrowUp") {
|
|
2679
|
-
setIndice((i) => Math.max(i - 1, 0));
|
|
2680
|
-
} else if (evento.key === "Enter") {
|
|
2681
|
-
if (visibles[indice]) onElegir(visibles[indice].valor);
|
|
2682
|
-
} else if (evento.key === "F9" || evento.key === "Escape") {
|
|
2683
|
-
onCerrar();
|
|
2684
|
-
} else {
|
|
2685
|
-
return;
|
|
2686
|
-
}
|
|
2687
|
-
evento.preventDefault();
|
|
2688
|
-
evento.stopPropagation();
|
|
2689
|
-
};
|
|
2690
|
-
return /* @__PURE__ */ jsxs10(
|
|
2691
|
-
Popover2,
|
|
2692
|
-
{
|
|
2693
|
-
open: true,
|
|
2694
|
-
anchorEl: anclaje,
|
|
2695
|
-
onClose: onCerrar,
|
|
2696
|
-
disableRestoreFocus: true,
|
|
2697
|
-
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
2698
|
-
slotProps: { paper: { sx: { minWidth: 300, maxWidth: 520 } } },
|
|
2699
|
-
children: [
|
|
2700
|
-
/* @__PURE__ */ jsx13(
|
|
2701
|
-
InputBase2,
|
|
2702
|
-
{
|
|
2703
|
-
autoFocus: true,
|
|
2704
|
-
fullWidth: true,
|
|
2705
|
-
value: busqueda,
|
|
2706
|
-
onChange: (e) => {
|
|
2707
|
-
setBusqueda(e.target.value);
|
|
2708
|
-
setIndice(0);
|
|
2709
|
-
},
|
|
2710
|
-
onKeyDown: alApretar,
|
|
2711
|
-
placeholder: "buscar",
|
|
2712
|
-
sx: { px: 1, py: 0.5, fontSize: "0.8rem", borderBottom: "1px solid #ccc" },
|
|
2713
|
-
inputProps: { "aria-label": "buscar" }
|
|
2714
|
-
}
|
|
2715
|
-
),
|
|
2716
|
-
/* @__PURE__ */ jsxs10(List2, { dense: true, disablePadding: true, sx: { maxHeight: 320, overflowY: "auto" }, role: "listbox", children: [
|
|
2717
|
-
visibles.length === 0 && /* @__PURE__ */ jsx13(Typography5, { variant: "body2", sx: { p: 1, color: "text.secondary" }, children: "sin coincidencias" }),
|
|
2718
|
-
visibles.map((opcion, i) => /* @__PURE__ */ jsx13(
|
|
2719
|
-
ListItemButton2,
|
|
2720
|
-
{
|
|
2721
|
-
ref: i === indice ? elegida : null,
|
|
2722
|
-
selected: i === indice,
|
|
2723
|
-
role: "option",
|
|
2724
|
-
onClick: () => onElegir(opcion.valor),
|
|
2725
|
-
sx: { gap: 2, py: 0.25, fontSize: "0.8rem" },
|
|
2726
|
-
children: opcion.etiquetas.map((etiqueta, j) => /* @__PURE__ */ jsx13("span", { style: { fontWeight: j === 0 ? 600 : 400, minWidth: j === 0 ? 40 : void 0 }, children: etiqueta }, j))
|
|
2727
|
-
},
|
|
2728
|
-
i
|
|
2729
|
-
))
|
|
2730
|
-
] })
|
|
2731
|
-
]
|
|
2732
|
-
}
|
|
2733
|
-
);
|
|
2734
|
-
}
|
|
2735
|
-
|
|
2736
|
-
// src/components/grid/SelectorDeFecha.tsx
|
|
2737
|
-
import { useState as useState9 } from "react";
|
|
2738
|
-
import { Button as Button3, IconButton as IconButton3, Popover as Popover3, Typography as Typography6 } from "@mui/material";
|
|
2739
|
-
import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2740
|
-
var MESES = ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"];
|
|
2741
|
-
var DIAS = ["lu", "ma", "mi", "ju", "vi", "s\xE1", "do"];
|
|
2742
|
-
var mismaFecha = (a, b) => b !== null && a.anio === b.anio && a.mes === b.mes && a.dia === b.dia;
|
|
2743
|
-
var MOVIMIENTOS = {
|
|
2744
|
-
ArrowLeft: [-1, 0],
|
|
2745
|
-
ArrowRight: [1, 0],
|
|
2746
|
-
ArrowUp: [-7, 0],
|
|
2747
|
-
ArrowDown: [7, 0],
|
|
2748
|
-
PageUp: [0, -1],
|
|
2749
|
-
PageDown: [0, 1]
|
|
2750
|
-
};
|
|
2751
|
-
function SelectorDeFecha({ anclaje, fechaActual, admiteNulo, onElegir, onCerrar }) {
|
|
2752
|
-
const hoy = /* @__PURE__ */ new Date();
|
|
2753
|
-
const fechaDeHoy = { anio: hoy.getFullYear(), mes: hoy.getMonth(), dia: hoy.getDate() };
|
|
2754
|
-
const [cursor, setCursor] = useState9(fechaActual ?? fechaDeHoy);
|
|
2755
|
-
const mover = (dias, meses) => {
|
|
2756
|
-
const nueva = new Date(cursor.anio, cursor.mes + meses, cursor.dia + dias);
|
|
2757
|
-
setCursor({ anio: nueva.getFullYear(), mes: nueva.getMonth(), dia: nueva.getDate() });
|
|
2758
|
-
};
|
|
2759
|
-
const alApretar = (evento) => {
|
|
2760
|
-
if (evento.key in MOVIMIENTOS) {
|
|
2761
|
-
mover(...MOVIMIENTOS[evento.key]);
|
|
2762
|
-
} else if (evento.key === "Enter") {
|
|
2763
|
-
onElegir(fechaATexto(cursor));
|
|
2764
|
-
} else if (evento.key === "F9" || evento.key === "Escape") {
|
|
2765
|
-
onCerrar();
|
|
2766
|
-
} else {
|
|
2767
|
-
return;
|
|
2768
|
-
}
|
|
2769
|
-
evento.preventDefault();
|
|
2770
|
-
evento.stopPropagation();
|
|
2771
|
-
};
|
|
2772
|
-
return /* @__PURE__ */ jsx14(Popover3, { open: true, anchorEl: anclaje, onClose: onCerrar, disableRestoreFocus: true, anchorOrigin: { vertical: "bottom", horizontal: "left" }, children: /* @__PURE__ */ jsxs11("div", { tabIndex: 0, ref: (el) => el?.focus(), onKeyDown: alApretar, style: { padding: 8, outline: "none", width: 252 }, "aria-label": "calendario", children: [
|
|
2773
|
-
/* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
2774
|
-
/* @__PURE__ */ jsx14(IconButton3, { size: "small", "aria-label": "mes anterior", onClick: () => mover(0, -1), children: "\u2039" }),
|
|
2775
|
-
/* @__PURE__ */ jsxs11(Typography6, { variant: "body2", sx: { fontWeight: 600 }, children: [
|
|
2776
|
-
MESES[cursor.mes],
|
|
2777
|
-
" ",
|
|
2778
|
-
cursor.anio
|
|
2779
|
-
] }),
|
|
2780
|
-
/* @__PURE__ */ jsx14(IconButton3, { size: "small", "aria-label": "mes siguiente", onClick: () => mover(0, 1), children: "\u203A" })
|
|
2781
|
-
] }),
|
|
2782
|
-
/* @__PURE__ */ jsxs11("table", { style: { borderCollapse: "collapse", width: "100%", textAlign: "center", fontSize: "0.8rem" }, children: [
|
|
2783
|
-
/* @__PURE__ */ jsx14("thead", { children: /* @__PURE__ */ jsx14("tr", { children: DIAS.map((d) => /* @__PURE__ */ jsx14("th", { style: { fontWeight: 400, color: "#777" }, children: d }, d)) }) }),
|
|
2784
|
-
/* @__PURE__ */ jsx14("tbody", { children: semanasDelMes(cursor.anio, cursor.mes).map((semana, i) => /* @__PURE__ */ jsx14("tr", { children: semana.map((dia) => {
|
|
2785
|
-
const elegido = mismaFecha(dia, fechaActual);
|
|
2786
|
-
const enCursor = mismaFecha(dia, cursor);
|
|
2787
|
-
return /* @__PURE__ */ jsx14("td", { style: { padding: 1 }, children: /* @__PURE__ */ jsx14(
|
|
2788
|
-
"button",
|
|
2789
|
-
{
|
|
2790
|
-
type: "button",
|
|
2791
|
-
tabIndex: -1,
|
|
2792
|
-
onClick: () => onElegir(fechaATexto(dia)),
|
|
2793
|
-
style: {
|
|
2794
|
-
width: 32,
|
|
2795
|
-
height: 26,
|
|
2796
|
-
border: enCursor ? "1px solid #1976d2" : "1px solid transparent",
|
|
2797
|
-
borderRadius: 4,
|
|
2798
|
-
cursor: "pointer",
|
|
2799
|
-
background: elegido ? "#1976d2" : "transparent",
|
|
2800
|
-
color: elegido ? "#fff" : dia.delMesMostrado ? "#000" : "#aaa"
|
|
2801
|
-
},
|
|
2802
|
-
children: dia.dia
|
|
2803
|
-
}
|
|
2804
|
-
) }, `${dia.mes}-${dia.dia}`);
|
|
2805
|
-
}) }, i)) })
|
|
2806
|
-
] }),
|
|
2807
|
-
/* @__PURE__ */ jsxs11("div", { style: { display: "flex", justifyContent: "space-between", marginTop: 4 }, children: [
|
|
2808
|
-
/* @__PURE__ */ jsx14(Button3, { size: "small", onClick: () => onElegir(fechaATexto(fechaDeHoy)), children: "hoy" }),
|
|
2809
|
-
admiteNulo && /* @__PURE__ */ jsx14(Button3, { size: "small", onClick: () => onElegir(null), children: "vac\xEDo" })
|
|
2810
|
-
] })
|
|
2811
|
-
] }) });
|
|
2812
|
-
}
|
|
2813
|
-
|
|
2814
|
-
// src/components/grid/VentanaDeTexto.tsx
|
|
2815
|
-
import { useState as useState10 } from "react";
|
|
2816
|
-
import { Button as Button4, InputBase as InputBase3, Popover as Popover4 } from "@mui/material";
|
|
2817
|
-
import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2818
|
-
function VentanaDeTexto({ anclaje, texto, editable, onAceptar, onCerrar }) {
|
|
2819
|
-
const [valor, setValor] = useState10(texto);
|
|
2820
|
-
const alApretar = (evento) => {
|
|
2821
|
-
if (evento.key === "Escape" || evento.key === "F9") {
|
|
2822
|
-
onCerrar();
|
|
2823
|
-
} else if (evento.key === "Enter" && evento.ctrlKey && editable) {
|
|
2824
|
-
onAceptar(valor);
|
|
2825
|
-
} else {
|
|
2826
|
-
return;
|
|
2827
|
-
}
|
|
2828
|
-
evento.preventDefault();
|
|
2829
|
-
evento.stopPropagation();
|
|
2830
|
-
};
|
|
2831
|
-
return /* @__PURE__ */ jsx15(Popover4, { open: true, anchorEl: anclaje, onClose: onCerrar, disableRestoreFocus: true, anchorOrigin: { vertical: "bottom", horizontal: "left" }, children: /* @__PURE__ */ jsxs12("div", { style: { padding: 8, minWidth: 320, maxWidth: 640 }, children: [
|
|
2832
|
-
/* @__PURE__ */ jsx15(
|
|
2833
|
-
InputBase3,
|
|
2834
|
-
{
|
|
2835
|
-
autoFocus: true,
|
|
2836
|
-
multiline: true,
|
|
2837
|
-
fullWidth: true,
|
|
2838
|
-
readOnly: !editable,
|
|
2839
|
-
value: valor,
|
|
2840
|
-
onChange: (e) => setValor(e.target.value),
|
|
2841
|
-
onKeyDown: alApretar,
|
|
2842
|
-
minRows: 2,
|
|
2843
|
-
maxRows: 16,
|
|
2844
|
-
sx: { fontFamily: "monospace", fontSize: "0.8rem", border: "1px solid #ccc", borderRadius: "4px", p: 0.5 },
|
|
2845
|
-
inputProps: { "aria-label": "contenido de la celda" }
|
|
2846
|
-
}
|
|
2847
|
-
),
|
|
2848
|
-
editable && /* @__PURE__ */ jsxs12("div", { style: { display: "flex", justifyContent: "flex-end", gap: 8, marginTop: 4 }, children: [
|
|
2849
|
-
/* @__PURE__ */ jsx15(Button4, { size: "small", onClick: onCerrar, children: "cancelar" }),
|
|
2850
|
-
/* @__PURE__ */ jsx15(Button4, { size: "small", variant: "contained", onClick: () => onAceptar(valor), children: "aceptar" })
|
|
2851
|
-
] })
|
|
2852
|
-
] }) });
|
|
2853
|
-
}
|
|
2854
|
-
|
|
2855
|
-
// src/components/grid/InputRenderer.tsx
|
|
2856
2959
|
import typeStore4 from "type-store";
|
|
2857
|
-
import { Fragment as
|
|
2960
|
+
import { Fragment as Fragment4, jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2858
2961
|
function findChangedValues(oldRowData, newRowData, isNewRow) {
|
|
2859
2962
|
let changes = [];
|
|
2860
2963
|
for (const key in newRowData) {
|
|
@@ -2881,11 +2984,9 @@ function InputRenderer({
|
|
|
2881
2984
|
const setLocalCellChanges = estadoGrilla.setCambiosLocales;
|
|
2882
2985
|
const fieldDefinition = requerido(tableDefinition.fields.find((f) => f.name === column.key), `el campo '${column.key}'`);
|
|
2883
2986
|
const typer = useMemo7(() => typeStore4.typerFrom(fieldDefinition), [fieldDefinition]);
|
|
2884
|
-
const [editingValue, setEditingValue] =
|
|
2885
|
-
const isCommitInProgress =
|
|
2886
|
-
const
|
|
2887
|
-
const menuAbierto = React11.useRef(false);
|
|
2888
|
-
const entradaRef = React11.useRef(null);
|
|
2987
|
+
const [editingValue, setEditingValue] = useState12(() => row[column.key] !== null ? isNumericType(fieldDefinition?.typeName) ? row[column.key] : typer.toLocalString(row[column.key]) : null);
|
|
2988
|
+
const isCommitInProgress = React12.useRef(false);
|
|
2989
|
+
const entradaRef = React12.useRef(null);
|
|
2889
2990
|
const theme = useTheme3();
|
|
2890
2991
|
const { showSuccess, showError } = useSnackbar();
|
|
2891
2992
|
const { saveRecord } = useTableRecordSave();
|
|
@@ -2901,7 +3002,7 @@ function InputRenderer({
|
|
|
2901
3002
|
cellBorderColor = currentCellFeedback.type === "error" ? theme.palette.error.main : theme.palette.success.main;
|
|
2902
3003
|
}
|
|
2903
3004
|
const initialRowId = useMemo7(() => getPrimaryKeyValues(row, primaryKey), [row, primaryKey]);
|
|
2904
|
-
const handleCommit =
|
|
3005
|
+
const handleCommit = useCallback10(async (currentValue, closeEditor, focusNextCell) => {
|
|
2905
3006
|
if (isCommitInProgress.current) return;
|
|
2906
3007
|
isCommitInProgress.current = true;
|
|
2907
3008
|
let processedNewValue;
|
|
@@ -3044,49 +3145,30 @@ function InputRenderer({
|
|
|
3044
3145
|
initialRowId,
|
|
3045
3146
|
typer
|
|
3046
3147
|
]);
|
|
3047
|
-
const
|
|
3048
|
-
const abrirExpander = useCallback9(async (busqueda) => {
|
|
3049
|
-
if (tipoExpander === null || tipoExpander === "json" || menuAbierto.current) return;
|
|
3050
|
-
menuAbierto.current = true;
|
|
3051
|
-
const admiteNulo = fieldDefinition.nullable !== false;
|
|
3052
|
-
try {
|
|
3053
|
-
if (tipoExpander === "referencia" && esCampoConReferencia(fieldDefinition)) {
|
|
3054
|
-
const { definicion, filas } = await cargarReferencia(fieldDefinition.references);
|
|
3055
|
-
setExpansion({ tipo: "opciones", opciones: opcionesDeReferencia(fieldDefinition, definicion, filas, row, admiteNulo), busqueda });
|
|
3056
|
-
} else if (tipoExpander === "booleano") {
|
|
3057
|
-
setExpansion({ tipo: "opciones", opciones: opcionesDeBooleano(admiteNulo), busqueda });
|
|
3058
|
-
} else if (tipoExpander === "opciones") {
|
|
3059
|
-
setExpansion({ tipo: "opciones", opciones: opcionesDeEnumerado(fieldDefinition.options ?? [], admiteNulo), busqueda });
|
|
3060
|
-
} else {
|
|
3061
|
-
setExpansion({ tipo: tipoExpander === "fecha" ? "fecha" : "texto" });
|
|
3062
|
-
}
|
|
3063
|
-
} catch (err) {
|
|
3064
|
-
menuAbierto.current = false;
|
|
3065
|
-
showError(mensajeDeError(err));
|
|
3066
|
-
}
|
|
3067
|
-
}, [tipoExpander, fieldDefinition, row, showError]);
|
|
3068
|
-
const cerrarExpansion = useCallback9(() => {
|
|
3069
|
-
menuAbierto.current = false;
|
|
3070
|
-
setExpansion(null);
|
|
3071
|
-
setTimeout(() => entradaRef.current?.focus(), 0);
|
|
3072
|
-
}, []);
|
|
3073
|
-
const confirmarEnExpansion = useCallback9((nuevo) => {
|
|
3148
|
+
const confirmarEnExpansion = useCallback10((nuevo) => {
|
|
3074
3149
|
setEditingValue(nuevo);
|
|
3075
|
-
cerrarExpansion();
|
|
3076
3150
|
void handleCommit(nuevo, true, false);
|
|
3077
|
-
}, [
|
|
3078
|
-
const elegirOpcion =
|
|
3151
|
+
}, [handleCommit]);
|
|
3152
|
+
const elegirOpcion = useCallback10((valor) => {
|
|
3079
3153
|
confirmarEnExpansion(valor === null || valor === void 0 ? null : typeof valor === "boolean" || isNumericType(fieldDefinition.typeName) ? valor : typer.toLocalString(valor));
|
|
3080
3154
|
}, [fieldDefinition.typeName, typer, confirmarEnExpansion]);
|
|
3081
|
-
const
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3155
|
+
const expander = useExpander({
|
|
3156
|
+
campo: fieldDefinition,
|
|
3157
|
+
editable: fieldDefinition.editable !== false,
|
|
3158
|
+
fila: row,
|
|
3159
|
+
admiteNulo: fieldDefinition.nullable !== false,
|
|
3160
|
+
anclaje: entradaRef,
|
|
3161
|
+
textoActual: editingValue === null || editingValue === void 0 ? "" : String(editingValue),
|
|
3162
|
+
valorActual: row[column.key],
|
|
3163
|
+
alElegirValor: elegirOpcion,
|
|
3164
|
+
alConfirmarTexto: confirmarEnExpansion,
|
|
3165
|
+
alFallar: showError
|
|
3166
|
+
});
|
|
3167
|
+
const handleKeyDown = useCallback10(async (event) => {
|
|
3168
|
+
if (expander.manejarTecla(event)) return;
|
|
3087
3169
|
if (event.key.length === 1 && !event.ctrlKey && !event.altKey && !event.metaKey && caracterRechazado(event.key, typer)) {
|
|
3088
3170
|
event.preventDefault();
|
|
3089
|
-
if (
|
|
3171
|
+
if (expander.tipo === "referencia") void expander.abrir(event.key);
|
|
3090
3172
|
return;
|
|
3091
3173
|
}
|
|
3092
3174
|
if (event.key === "F4") {
|
|
@@ -3099,24 +3181,24 @@ function InputRenderer({
|
|
|
3099
3181
|
if (onKeyPress?.(rowIdx, column.key, event, handleCommit, editingValue)) {
|
|
3100
3182
|
event.preventDefault();
|
|
3101
3183
|
}
|
|
3102
|
-
}, [handleCommit, editingValue, column.key, rowIdx, onKeyPress,
|
|
3103
|
-
const procesarTecla =
|
|
3184
|
+
}, [handleCommit, editingValue, column.key, rowIdx, onKeyPress, expander, typer]);
|
|
3185
|
+
const procesarTecla = React12.useRef(() => {
|
|
3104
3186
|
});
|
|
3105
3187
|
procesarTecla.current = (key) => {
|
|
3106
3188
|
if (key === "F9") {
|
|
3107
|
-
void
|
|
3189
|
+
void expander.abrir("");
|
|
3108
3190
|
} else if (key === "F4" && onKeyPress) {
|
|
3109
3191
|
onKeyPress(rowIdx, column.key, { key, target: document.activeElement ?? document.body }, handleCommit, editingValue);
|
|
3110
3192
|
}
|
|
3111
3193
|
};
|
|
3112
3194
|
useEffect5(() => registrarEditor?.((key) => procesarTecla.current(key)), []);
|
|
3113
|
-
const handleBlur =
|
|
3114
|
-
if (
|
|
3195
|
+
const handleBlur = useCallback10(() => {
|
|
3196
|
+
if (expander.abierto.current) return;
|
|
3115
3197
|
handleCommit(editingValue, true, false);
|
|
3116
3198
|
}, [handleCommit, editingValue]);
|
|
3117
3199
|
const isFieldEditable = fieldDefinition?.editable !== false;
|
|
3118
3200
|
const isNumeric = isNumericType(fieldDefinition?.typeName);
|
|
3119
|
-
const editor = /* @__PURE__ */
|
|
3201
|
+
const editor = /* @__PURE__ */ jsx17(
|
|
3120
3202
|
InputBase4,
|
|
3121
3203
|
{
|
|
3122
3204
|
autoFocus: true,
|
|
@@ -3149,61 +3231,19 @@ function InputRenderer({
|
|
|
3149
3231
|
},
|
|
3150
3232
|
onClick: (e) => e.stopPropagation(),
|
|
3151
3233
|
disabled: !isFieldEditable,
|
|
3152
|
-
endAdornment:
|
|
3153
|
-
IconButton4,
|
|
3154
|
-
{
|
|
3155
|
-
size: "small",
|
|
3156
|
-
tabIndex: -1,
|
|
3157
|
-
"aria-label": tipoExpander === "fecha" ? "elegir fecha" : tipoExpander === "texto" ? "ver el contenido completo" : "elegir un valor",
|
|
3158
|
-
title: tipoExpander === "fecha" ? "elegir fecha (F9)" : tipoExpander === "texto" ? "ver el contenido completo (F9)" : "elegir un valor (F9)",
|
|
3159
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
3160
|
-
onClick: (e) => {
|
|
3161
|
-
e.stopPropagation();
|
|
3162
|
-
void abrirExpander("");
|
|
3163
|
-
},
|
|
3164
|
-
sx: { p: 0, ml: 0.25, color: "primary.main", "&:hover": { backgroundColor: "action.hover" } },
|
|
3165
|
-
children: tipoExpander === "fecha" ? /* @__PURE__ */ jsx16(CalendarMonthIcon, { sx: { fontSize: 16 } }) : tipoExpander === "texto" ? /* @__PURE__ */ jsx16(SearchIcon2, { sx: { fontSize: 16 } }) : /* @__PURE__ */ jsx16(ArrowDropDownIcon, { sx: { fontSize: 20 } })
|
|
3166
|
-
}
|
|
3167
|
-
)
|
|
3234
|
+
endAdornment: expander.lupa
|
|
3168
3235
|
}
|
|
3169
3236
|
);
|
|
3170
|
-
const conMenu = /* @__PURE__ */ jsxs13(
|
|
3237
|
+
const conMenu = /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
3171
3238
|
editor,
|
|
3172
|
-
|
|
3173
|
-
MenuDeOpciones,
|
|
3174
|
-
{
|
|
3175
|
-
anclaje: entradaRef.current,
|
|
3176
|
-
opciones: expansion.opciones,
|
|
3177
|
-
busquedaInicial: expansion.busqueda,
|
|
3178
|
-
onElegir: elegirOpcion,
|
|
3179
|
-
onCerrar: cerrarExpansion
|
|
3180
|
-
}
|
|
3181
|
-
) : expansion.tipo === "fecha" ? /* @__PURE__ */ jsx16(
|
|
3182
|
-
SelectorDeFecha,
|
|
3183
|
-
{
|
|
3184
|
-
anclaje: entradaRef.current,
|
|
3185
|
-
fechaActual: fechaDeValor(row[column.key]),
|
|
3186
|
-
admiteNulo: fieldDefinition.nullable !== false,
|
|
3187
|
-
onElegir: confirmarEnExpansion,
|
|
3188
|
-
onCerrar: cerrarExpansion
|
|
3189
|
-
}
|
|
3190
|
-
) : /* @__PURE__ */ jsx16(
|
|
3191
|
-
VentanaDeTexto,
|
|
3192
|
-
{
|
|
3193
|
-
anclaje: entradaRef.current,
|
|
3194
|
-
texto: editingValue === null || editingValue === void 0 ? "" : String(editingValue),
|
|
3195
|
-
editable: true,
|
|
3196
|
-
onAceptar: confirmarEnExpansion,
|
|
3197
|
-
onCerrar: cerrarExpansion
|
|
3198
|
-
}
|
|
3199
|
-
))
|
|
3239
|
+
expander.ventana
|
|
3200
3240
|
] });
|
|
3201
|
-
return currentCellFeedback?.message ? /* @__PURE__ */
|
|
3241
|
+
return currentCellFeedback?.message ? /* @__PURE__ */ jsx17(Tooltip5, { title: currentCellFeedback.message, children: /* @__PURE__ */ jsx17("div", { style: { width: "100%" }, children: conMenu }) }) : conMenu;
|
|
3202
3242
|
}
|
|
3203
3243
|
var InputRenderer_default = InputRenderer;
|
|
3204
3244
|
|
|
3205
3245
|
// src/components/grid/renderers/editCellRenderers.tsx
|
|
3206
|
-
import { jsx as
|
|
3246
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
3207
3247
|
var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
3208
3248
|
const column = props.column;
|
|
3209
3249
|
if (!esColumnaPropia(column)) return void 0;
|
|
@@ -3225,7 +3265,7 @@ var allColumnsEditCellRenderer = (props, allColumns) => {
|
|
|
3225
3265
|
if (!isFieldEditableByUI) {
|
|
3226
3266
|
return void 0;
|
|
3227
3267
|
}
|
|
3228
|
-
return /* @__PURE__ */
|
|
3268
|
+
return /* @__PURE__ */ jsx18(
|
|
3229
3269
|
InputRenderer_default,
|
|
3230
3270
|
{
|
|
3231
3271
|
...props,
|
|
@@ -3348,7 +3388,7 @@ var useGridColumns = ({
|
|
|
3348
3388
|
editable: false,
|
|
3349
3389
|
resizable: false,
|
|
3350
3390
|
sortable: false,
|
|
3351
|
-
renderHeaderCell: () =>
|
|
3391
|
+
renderHeaderCell: () => React13.createElement(ActionsColumnHeaderCell, {
|
|
3352
3392
|
toggleFilterVisibility,
|
|
3353
3393
|
handleDataGridOptions: (e) => abrirOpcionesDeGrilla(e.currentTarget),
|
|
3354
3394
|
handleAddRow,
|
|
@@ -3393,7 +3433,7 @@ var useGridColumns = ({
|
|
|
3393
3433
|
};
|
|
3394
3434
|
|
|
3395
3435
|
// src/components/grid/ImportDialog.tsx
|
|
3396
|
-
import { useState as
|
|
3436
|
+
import { useState as useState13 } from "react";
|
|
3397
3437
|
import {
|
|
3398
3438
|
Dialog as Dialog2,
|
|
3399
3439
|
DialogTitle as DialogTitle2,
|
|
@@ -3408,10 +3448,10 @@ import {
|
|
|
3408
3448
|
Divider
|
|
3409
3449
|
} from "@mui/material";
|
|
3410
3450
|
import FileUploadIcon2 from "@mui/icons-material/FileUpload";
|
|
3411
|
-
import { jsx as
|
|
3451
|
+
import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3412
3452
|
var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
3413
|
-
const [file, setFile] =
|
|
3414
|
-
const [options, setOptions] =
|
|
3453
|
+
const [file, setFile] = useState13(null);
|
|
3454
|
+
const [options, setOptions] = useState13({
|
|
3415
3455
|
skipUnknownFieldsAtImport: false,
|
|
3416
3456
|
simplificateSpaces: true,
|
|
3417
3457
|
replaceNewLineWithSpace: true
|
|
@@ -3432,12 +3472,12 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3432
3472
|
};
|
|
3433
3473
|
return /* @__PURE__ */ jsxs14(Dialog2, { open, onClose: loading ? void 0 : onClose, maxWidth: "sm", fullWidth: true, children: [
|
|
3434
3474
|
/* @__PURE__ */ jsxs14(DialogTitle2, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
3435
|
-
/* @__PURE__ */
|
|
3475
|
+
/* @__PURE__ */ jsx19(FileUploadIcon2, { color: "primary" }),
|
|
3436
3476
|
"Importar datos desde archivo"
|
|
3437
3477
|
] }),
|
|
3438
|
-
/* @__PURE__ */
|
|
3478
|
+
/* @__PURE__ */ jsx19(DialogContent2, { dividers: true, children: /* @__PURE__ */ jsxs14(Stack, { spacing: 3, sx: { mt: 1 }, children: [
|
|
3439
3479
|
/* @__PURE__ */ jsxs14(Box9, { children: [
|
|
3440
|
-
/* @__PURE__ */
|
|
3480
|
+
/* @__PURE__ */ jsx19(Typography7, { variant: "subtitle2", gutterBottom: true, fontWeight: "bold", children: "Seleccionar archivo" }),
|
|
3441
3481
|
/* @__PURE__ */ jsxs14(
|
|
3442
3482
|
Box9,
|
|
3443
3483
|
{
|
|
@@ -3451,7 +3491,7 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3451
3491
|
position: "relative"
|
|
3452
3492
|
},
|
|
3453
3493
|
children: [
|
|
3454
|
-
/* @__PURE__ */
|
|
3494
|
+
/* @__PURE__ */ jsx19(
|
|
3455
3495
|
"input",
|
|
3456
3496
|
{
|
|
3457
3497
|
type: "file",
|
|
@@ -3468,19 +3508,19 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3468
3508
|
}
|
|
3469
3509
|
}
|
|
3470
3510
|
),
|
|
3471
|
-
/* @__PURE__ */
|
|
3511
|
+
/* @__PURE__ */ jsx19(Typography7, { variant: "body2", color: file ? "textPrimary" : "textSecondary", children: file ? file.name : "Haz clic aqu\xED para seleccionar un archivo" })
|
|
3472
3512
|
]
|
|
3473
3513
|
}
|
|
3474
3514
|
)
|
|
3475
3515
|
] }),
|
|
3476
|
-
/* @__PURE__ */
|
|
3516
|
+
/* @__PURE__ */ jsx19(Divider, {}),
|
|
3477
3517
|
/* @__PURE__ */ jsxs14(Box9, { children: [
|
|
3478
|
-
/* @__PURE__ */
|
|
3518
|
+
/* @__PURE__ */ jsx19(Typography7, { variant: "subtitle2", gutterBottom: true, fontWeight: "bold", children: "Opciones de importaci\xF3n" }),
|
|
3479
3519
|
/* @__PURE__ */ jsxs14(Stack, { children: [
|
|
3480
|
-
/* @__PURE__ */
|
|
3520
|
+
/* @__PURE__ */ jsx19(
|
|
3481
3521
|
FormControlLabel,
|
|
3482
3522
|
{
|
|
3483
|
-
control: /* @__PURE__ */
|
|
3523
|
+
control: /* @__PURE__ */ jsx19(
|
|
3484
3524
|
Checkbox,
|
|
3485
3525
|
{
|
|
3486
3526
|
checked: options.skipUnknownFieldsAtImport,
|
|
@@ -3488,13 +3528,13 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3488
3528
|
size: "small"
|
|
3489
3529
|
}
|
|
3490
3530
|
),
|
|
3491
|
-
label: /* @__PURE__ */
|
|
3531
|
+
label: /* @__PURE__ */ jsx19(Typography7, { variant: "body2", children: "Omitir campos desconocidos al importar" })
|
|
3492
3532
|
}
|
|
3493
3533
|
),
|
|
3494
|
-
/* @__PURE__ */
|
|
3534
|
+
/* @__PURE__ */ jsx19(
|
|
3495
3535
|
FormControlLabel,
|
|
3496
3536
|
{
|
|
3497
|
-
control: /* @__PURE__ */
|
|
3537
|
+
control: /* @__PURE__ */ jsx19(
|
|
3498
3538
|
Checkbox,
|
|
3499
3539
|
{
|
|
3500
3540
|
checked: options.simplificateSpaces,
|
|
@@ -3502,13 +3542,13 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3502
3542
|
size: "small"
|
|
3503
3543
|
}
|
|
3504
3544
|
),
|
|
3505
|
-
label: /* @__PURE__ */
|
|
3545
|
+
label: /* @__PURE__ */ jsx19(Typography7, { variant: "body2", children: "Simplificar espacios" })
|
|
3506
3546
|
}
|
|
3507
3547
|
),
|
|
3508
|
-
/* @__PURE__ */
|
|
3548
|
+
/* @__PURE__ */ jsx19(
|
|
3509
3549
|
FormControlLabel,
|
|
3510
3550
|
{
|
|
3511
|
-
control: /* @__PURE__ */
|
|
3551
|
+
control: /* @__PURE__ */ jsx19(
|
|
3512
3552
|
Checkbox,
|
|
3513
3553
|
{
|
|
3514
3554
|
checked: options.replaceNewLineWithSpace,
|
|
@@ -3516,21 +3556,21 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3516
3556
|
size: "small"
|
|
3517
3557
|
}
|
|
3518
3558
|
),
|
|
3519
|
-
label: /* @__PURE__ */
|
|
3559
|
+
label: /* @__PURE__ */ jsx19(Typography7, { variant: "body2", children: "Reemplazar saltos de l\xEDnea con espacios" })
|
|
3520
3560
|
}
|
|
3521
3561
|
)
|
|
3522
3562
|
] })
|
|
3523
3563
|
] })
|
|
3524
3564
|
] }) }),
|
|
3525
3565
|
/* @__PURE__ */ jsxs14(DialogActions2, { sx: { px: 3, py: 2 }, children: [
|
|
3526
|
-
/* @__PURE__ */
|
|
3527
|
-
/* @__PURE__ */
|
|
3566
|
+
/* @__PURE__ */ jsx19(Button5, { onClick: onClose, disabled: loading, children: "Cancelar" }),
|
|
3567
|
+
/* @__PURE__ */ jsx19(
|
|
3528
3568
|
Button5,
|
|
3529
3569
|
{
|
|
3530
3570
|
onClick: handleConfirm,
|
|
3531
3571
|
variant: "contained",
|
|
3532
3572
|
disabled: !file || loading,
|
|
3533
|
-
startIcon: /* @__PURE__ */
|
|
3573
|
+
startIcon: /* @__PURE__ */ jsx19(FileUploadIcon2, {}),
|
|
3534
3574
|
children: loading ? "Procesando..." : "Confirmar Importaci\xF3n"
|
|
3535
3575
|
}
|
|
3536
3576
|
)
|
|
@@ -3539,7 +3579,7 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
|
|
|
3539
3579
|
};
|
|
3540
3580
|
|
|
3541
3581
|
// src/components/grid/ExportDialog.tsx
|
|
3542
|
-
import { useState as
|
|
3582
|
+
import { useState as useState14 } from "react";
|
|
3543
3583
|
import {
|
|
3544
3584
|
Dialog as Dialog3,
|
|
3545
3585
|
DialogTitle as DialogTitle3,
|
|
@@ -3559,7 +3599,7 @@ import {
|
|
|
3559
3599
|
} from "@mui/material";
|
|
3560
3600
|
import * as XLSX from "xlsx";
|
|
3561
3601
|
import typeStore5 from "type-store";
|
|
3562
|
-
import { jsx as
|
|
3602
|
+
import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3563
3603
|
var ExportDialog = ({
|
|
3564
3604
|
open,
|
|
3565
3605
|
onClose,
|
|
@@ -3568,13 +3608,13 @@ var ExportDialog = ({
|
|
|
3568
3608
|
filteredRows,
|
|
3569
3609
|
username = "anonymous"
|
|
3570
3610
|
}) => {
|
|
3571
|
-
const [format, setFormat] =
|
|
3572
|
-
const [options, setOptions] =
|
|
3611
|
+
const [format, setFormat] = useState14("xlsx");
|
|
3612
|
+
const [options, setOptions] = useState14({
|
|
3573
3613
|
fromOtherTables: true,
|
|
3574
3614
|
readOnly: true,
|
|
3575
3615
|
hiddens: false
|
|
3576
3616
|
});
|
|
3577
|
-
const [isPreparing, setIsPreparing] =
|
|
3617
|
+
const [isPreparing, setIsPreparing] = useState14(false);
|
|
3578
3618
|
const handleOptionChange = (event) => {
|
|
3579
3619
|
setOptions({
|
|
3580
3620
|
...options,
|
|
@@ -3705,47 +3745,47 @@ var ExportDialog = ({
|
|
|
3705
3745
|
}, 0);
|
|
3706
3746
|
};
|
|
3707
3747
|
return /* @__PURE__ */ jsxs15(Dialog3, { open, onClose, maxWidth: "xs", fullWidth: true, children: [
|
|
3708
|
-
/* @__PURE__ */
|
|
3709
|
-
/* @__PURE__ */
|
|
3710
|
-
/* @__PURE__ */
|
|
3711
|
-
/* @__PURE__ */
|
|
3748
|
+
/* @__PURE__ */ jsx20(DialogTitle3, { children: "Exportar Datos" }),
|
|
3749
|
+
/* @__PURE__ */ jsx20(DialogContent3, { children: isPreparing ? /* @__PURE__ */ jsxs15(Box10, { display: "flex", flexDirection: "column", alignItems: "center", py: 4, children: [
|
|
3750
|
+
/* @__PURE__ */ jsx20(CircularProgress2, {}),
|
|
3751
|
+
/* @__PURE__ */ jsx20(Typography8, { sx: { mt: 2 }, children: "Preparando exportaci\xF3n..." })
|
|
3712
3752
|
] }) : /* @__PURE__ */ jsxs15(Box10, { sx: { mt: 1 }, children: [
|
|
3713
3753
|
/* @__PURE__ */ jsxs15(FormControl2, { component: "fieldset", children: [
|
|
3714
|
-
/* @__PURE__ */
|
|
3754
|
+
/* @__PURE__ */ jsx20(FormLabel, { component: "legend", children: "Formato" }),
|
|
3715
3755
|
/* @__PURE__ */ jsxs15(
|
|
3716
3756
|
RadioGroup,
|
|
3717
3757
|
{
|
|
3718
3758
|
value: format,
|
|
3719
3759
|
onChange: (e) => setFormat(e.target.value),
|
|
3720
3760
|
children: [
|
|
3721
|
-
/* @__PURE__ */
|
|
3722
|
-
/* @__PURE__ */
|
|
3723
|
-
/* @__PURE__ */
|
|
3761
|
+
/* @__PURE__ */ jsx20(FormControlLabel2, { value: "xlsx", control: /* @__PURE__ */ jsx20(Radio, {}), label: "Excel (.xlsx)" }),
|
|
3762
|
+
/* @__PURE__ */ jsx20(FormControlLabel2, { value: "tab", control: /* @__PURE__ */ jsx20(Radio, {}), label: "Tabulado (.tab | )" }),
|
|
3763
|
+
/* @__PURE__ */ jsx20(FormControlLabel2, { value: "csv", control: /* @__PURE__ */ jsx20(Radio, {}), label: "CSV (.csv , )" })
|
|
3724
3764
|
]
|
|
3725
3765
|
}
|
|
3726
3766
|
)
|
|
3727
3767
|
] }),
|
|
3728
3768
|
/* @__PURE__ */ jsxs15(Box10, { sx: { mt: 3 }, children: [
|
|
3729
|
-
/* @__PURE__ */
|
|
3769
|
+
/* @__PURE__ */ jsx20(Typography8, { variant: "subtitle2", gutterBottom: true, children: "Opciones de campos:" }),
|
|
3730
3770
|
/* @__PURE__ */ jsxs15(FormGroup, { children: [
|
|
3731
|
-
/* @__PURE__ */
|
|
3771
|
+
/* @__PURE__ */ jsx20(
|
|
3732
3772
|
FormControlLabel2,
|
|
3733
3773
|
{
|
|
3734
|
-
control: /* @__PURE__ */
|
|
3774
|
+
control: /* @__PURE__ */ jsx20(Checkbox2, { checked: options.fromOtherTables, onChange: handleOptionChange, name: "fromOtherTables" }),
|
|
3735
3775
|
label: "Desde otras tablas"
|
|
3736
3776
|
}
|
|
3737
3777
|
),
|
|
3738
|
-
/* @__PURE__ */
|
|
3778
|
+
/* @__PURE__ */ jsx20(
|
|
3739
3779
|
FormControlLabel2,
|
|
3740
3780
|
{
|
|
3741
|
-
control: /* @__PURE__ */
|
|
3781
|
+
control: /* @__PURE__ */ jsx20(Checkbox2, { checked: options.readOnly, onChange: handleOptionChange, name: "readOnly" }),
|
|
3742
3782
|
label: "Solo lectura"
|
|
3743
3783
|
}
|
|
3744
3784
|
),
|
|
3745
|
-
/* @__PURE__ */
|
|
3785
|
+
/* @__PURE__ */ jsx20(
|
|
3746
3786
|
FormControlLabel2,
|
|
3747
3787
|
{
|
|
3748
|
-
control: /* @__PURE__ */
|
|
3788
|
+
control: /* @__PURE__ */ jsx20(Checkbox2, { checked: options.hiddens, onChange: handleOptionChange, name: "hiddens" }),
|
|
3749
3789
|
label: "Ocultos"
|
|
3750
3790
|
}
|
|
3751
3791
|
)
|
|
@@ -3753,14 +3793,14 @@ var ExportDialog = ({
|
|
|
3753
3793
|
] })
|
|
3754
3794
|
] }) }),
|
|
3755
3795
|
/* @__PURE__ */ jsxs15(DialogActions3, { children: [
|
|
3756
|
-
/* @__PURE__ */
|
|
3757
|
-
/* @__PURE__ */
|
|
3796
|
+
/* @__PURE__ */ jsx20(Button6, { onClick: onClose, disabled: isPreparing, children: "Cancelar" }),
|
|
3797
|
+
/* @__PURE__ */ jsx20(Button6, { onClick: handlePrepareExport, variant: "contained", disabled: isPreparing, children: "Descargar" })
|
|
3758
3798
|
] })
|
|
3759
3799
|
] });
|
|
3760
3800
|
};
|
|
3761
3801
|
|
|
3762
3802
|
// src/pages/VerticalEditorPage.tsx
|
|
3763
|
-
import { useState as
|
|
3803
|
+
import { useState as useState15, useCallback as useCallback11, useMemo as useMemo9, useRef as useRef6 } from "react";
|
|
3764
3804
|
import {
|
|
3765
3805
|
DialogTitle as DialogTitle4,
|
|
3766
3806
|
DialogContent as DialogContent4,
|
|
@@ -3773,7 +3813,7 @@ import {
|
|
|
3773
3813
|
Typography as Typography9
|
|
3774
3814
|
} from "@mui/material";
|
|
3775
3815
|
import CloseIcon from "@mui/icons-material/Close";
|
|
3776
|
-
import { jsx as
|
|
3816
|
+
import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3777
3817
|
var VerticalEditorPage = ({
|
|
3778
3818
|
tableName,
|
|
3779
3819
|
tableDefinition,
|
|
@@ -3784,15 +3824,15 @@ var VerticalEditorPage = ({
|
|
|
3784
3824
|
onClose
|
|
3785
3825
|
}) => {
|
|
3786
3826
|
const { saveRecord } = useTableRecordSave();
|
|
3787
|
-
const [internalIsNewRow, setInternalIsNewRow] =
|
|
3788
|
-
const [formData, setFormData] =
|
|
3789
|
-
const [lastSavedData, setLastSavedData] =
|
|
3790
|
-
const [validityMap, setValidityMap] =
|
|
3791
|
-
const [globalError, setGlobalError] =
|
|
3792
|
-
const [isSaving, setIsSaving] =
|
|
3793
|
-
const [fieldFeedback, setFieldFeedback] =
|
|
3827
|
+
const [internalIsNewRow, setInternalIsNewRow] = useState15(isNewRow);
|
|
3828
|
+
const [formData, setFormData] = useState15(initialData);
|
|
3829
|
+
const [lastSavedData, setLastSavedData] = useState15(initialData);
|
|
3830
|
+
const [validityMap, setValidityMap] = useState15({});
|
|
3831
|
+
const [globalError, setGlobalError] = useState15(null);
|
|
3832
|
+
const [isSaving, setIsSaving] = useState15(false);
|
|
3833
|
+
const [fieldFeedback, setFieldFeedback] = useState15({});
|
|
3794
3834
|
const feedbackTimersRef = useRef6({});
|
|
3795
|
-
const handleFieldChange =
|
|
3835
|
+
const handleFieldChange = useCallback11((fieldName, newValue, isValid) => {
|
|
3796
3836
|
setFormData((prev) => ({ ...prev, [fieldName]: newValue }));
|
|
3797
3837
|
setValidityMap((prev) => ({ ...prev, [fieldName]: isValid }));
|
|
3798
3838
|
setGlobalError(null);
|
|
@@ -3810,7 +3850,7 @@ var VerticalEditorPage = ({
|
|
|
3810
3850
|
}
|
|
3811
3851
|
return true;
|
|
3812
3852
|
}, [formData, validityMap, tableDefinition.fields]);
|
|
3813
|
-
const handleCommit =
|
|
3853
|
+
const handleCommit = useCallback11(async (fieldName, newValue, isValid) => {
|
|
3814
3854
|
if (!isValid) return;
|
|
3815
3855
|
if (sameValue(newValue, lastSavedData[fieldName])) {
|
|
3816
3856
|
return;
|
|
@@ -3907,14 +3947,14 @@ var VerticalEditorPage = ({
|
|
|
3907
3947
|
" - ",
|
|
3908
3948
|
tableDefinition.title || tableName
|
|
3909
3949
|
] }),
|
|
3910
|
-
/* @__PURE__ */
|
|
3950
|
+
/* @__PURE__ */ jsx21(IconButton5, { onClick: onClose, size: "small", edge: "end", children: /* @__PURE__ */ jsx21(CloseIcon, {}) })
|
|
3911
3951
|
] }),
|
|
3912
3952
|
/* @__PURE__ */ jsxs16(DialogContent4, { dividers: true, sx: { px: 2, flexGrow: 1, py: 1 }, children: [
|
|
3913
|
-
globalError && /* @__PURE__ */
|
|
3914
|
-
/* @__PURE__ */
|
|
3953
|
+
globalError && /* @__PURE__ */ jsx21(Alert, { severity: "error", sx: { mb: 2 }, children: globalError }),
|
|
3954
|
+
/* @__PURE__ */ jsx21(Box11, { sx: { display: "flex", flexDirection: "column", gap: 0.5 }, children: tableDefinition.fields.map((field) => {
|
|
3915
3955
|
const isFixed = fixedFields?.some((ff) => ff.fieldName === field.name);
|
|
3916
3956
|
const isMandatory = field.nullable === false || tableDefinition.primaryKey.includes(field.name);
|
|
3917
|
-
return /* @__PURE__ */
|
|
3957
|
+
return /* @__PURE__ */ jsx21(Box11, { sx: { width: "100%", maxWidth: "100%" }, children: /* @__PURE__ */ jsx21(
|
|
3918
3958
|
TypedField,
|
|
3919
3959
|
{
|
|
3920
3960
|
fieldDef: field,
|
|
@@ -3930,10 +3970,10 @@ var VerticalEditorPage = ({
|
|
|
3930
3970
|
] }),
|
|
3931
3971
|
/* @__PURE__ */ jsxs16(DialogActions4, { sx: { px: 0, pb: 0, pt: 2, justifyContent: "space-between", alignItems: "center" }, children: [
|
|
3932
3972
|
/* @__PURE__ */ jsxs16(Box11, { children: [
|
|
3933
|
-
isSaving && /* @__PURE__ */
|
|
3934
|
-
/* @__PURE__ */
|
|
3973
|
+
isSaving && /* @__PURE__ */ jsx21(CircularProgress3, { size: 20, sx: { ml: 2 } }),
|
|
3974
|
+
/* @__PURE__ */ jsx21("span", { style: { marginLeft: 10, fontSize: "0.8rem", color: "#666" }, children: isSaving ? "Guardando..." : "Cambios auto-guardados" })
|
|
3935
3975
|
] }),
|
|
3936
|
-
/* @__PURE__ */
|
|
3976
|
+
/* @__PURE__ */ jsx21(Button7, { variant: "outlined", onClick: onClose, children: "Cerrar" })
|
|
3937
3977
|
] })
|
|
3938
3978
|
] });
|
|
3939
3979
|
};
|
|
@@ -4010,7 +4050,7 @@ var baseDelBundler = import.meta.env?.BASE_URL ?? "/";
|
|
|
4010
4050
|
var rutaBase = baseDelBundler.replace(/\/+$/, "");
|
|
4011
4051
|
|
|
4012
4052
|
// src/components/grid/GenericDataGrid.tsx
|
|
4013
|
-
import { jsx as
|
|
4053
|
+
import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4014
4054
|
var SUMMARY_ROW_HEIGHT = 35;
|
|
4015
4055
|
var FILTER_ROW_HEIGHT = 35;
|
|
4016
4056
|
var HEADER_ROW_HEIGHT = 30;
|
|
@@ -4042,7 +4082,7 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
4042
4082
|
name: field.label || cambiarGuionesBajosPorEspacios(field.name),
|
|
4043
4083
|
width: 150,
|
|
4044
4084
|
editable: false,
|
|
4045
|
-
renderHeaderCell: () => /* @__PURE__ */
|
|
4085
|
+
renderHeaderCell: () => /* @__PURE__ */ jsx22(Box12, { sx: { p: 0.5, height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsx22(
|
|
4046
4086
|
Typography10,
|
|
4047
4087
|
{
|
|
4048
4088
|
variant: "caption",
|
|
@@ -4054,7 +4094,7 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
4054
4094
|
children: field.label || cambiarGuionesBajosPorEspacios(field.name)
|
|
4055
4095
|
}
|
|
4056
4096
|
) }),
|
|
4057
|
-
renderCell: (props) => /* @__PURE__ */
|
|
4097
|
+
renderCell: (props) => /* @__PURE__ */ jsx22(Box12, { sx: { px: 1, height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsx22(Typography10, { variant: "body2", sx: { fontSize: "0.875rem" }, noWrap: true, children: String(props.row[field.name] ?? "") }) })
|
|
4058
4098
|
};
|
|
4059
4099
|
});
|
|
4060
4100
|
}, [tableDefinition, fieldsToHide]);
|
|
@@ -4069,7 +4109,7 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
4069
4109
|
boxShadow: theme.shadows[1],
|
|
4070
4110
|
bgcolor: "background.paper"
|
|
4071
4111
|
}, children: [
|
|
4072
|
-
/* @__PURE__ */
|
|
4112
|
+
/* @__PURE__ */ jsx22(Box12, { sx: {
|
|
4073
4113
|
bgcolor: "primary.main",
|
|
4074
4114
|
color: "primary.contrastText",
|
|
4075
4115
|
px: 1.5,
|
|
@@ -4080,8 +4120,8 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
|
|
|
4080
4120
|
alignItems: "center",
|
|
4081
4121
|
fontWeight: "bold",
|
|
4082
4122
|
gap: 1
|
|
4083
|
-
}, children: /* @__PURE__ */
|
|
4084
|
-
/* @__PURE__ */
|
|
4123
|
+
}, children: /* @__PURE__ */ jsx22(Typography10, { variant: "subtitle2", component: "div", children: cambiarGuionesBajosPorEspacios(ancestor.tableName) }) }),
|
|
4124
|
+
/* @__PURE__ */ jsx22(
|
|
4085
4125
|
DataGrid,
|
|
4086
4126
|
{
|
|
4087
4127
|
className: "rdg-light",
|
|
@@ -4122,32 +4162,32 @@ var GenericDataGrid = ({
|
|
|
4122
4162
|
// eslint-disable-line react-hooks/exhaustive-deps
|
|
4123
4163
|
);
|
|
4124
4164
|
const cacheHeredado = useContext4(CacheGrillasContext);
|
|
4125
|
-
const [cachePropio] =
|
|
4165
|
+
const [cachePropio] = useState16(() => /* @__PURE__ */ new Map());
|
|
4126
4166
|
const cache = cacheHeredado ?? cachePropio;
|
|
4127
|
-
const [guardada] =
|
|
4167
|
+
const [guardada] = useState16(() => claveCache ? cache.get(claveCache) : void 0);
|
|
4128
4168
|
const claveCargadaRef = useRef7(guardada ? `${tableName}|${claveFixedFields}|${claveParametros}` : null);
|
|
4129
|
-
const [tableDefinition, setTableDefinition] =
|
|
4130
|
-
const [tableData, setTableData] =
|
|
4131
|
-
const [cargandoInicial, setCargandoInicial] =
|
|
4132
|
-
const [errorDeCarga, setErrorDeCarga] =
|
|
4133
|
-
const [anchosCalculados, setAnchosCalculados] =
|
|
4134
|
-
const [detallesAbiertos, setDetallesAbiertos] =
|
|
4135
|
-
const [altosDetalle, setAltosDetalle] =
|
|
4136
|
-
const [anchosDetalle, setAnchosDetalle] =
|
|
4137
|
-
const [selectedRows, setSelectedRows] =
|
|
4138
|
-
const [, setSelectedCell] =
|
|
4139
|
-
const [estadoGrilla] =
|
|
4169
|
+
const [tableDefinition, setTableDefinition] = useState16(guardada?.tableDefinition ?? null);
|
|
4170
|
+
const [tableData, setTableData] = useState16(guardada?.tableData ?? []);
|
|
4171
|
+
const [cargandoInicial, setCargandoInicial] = useState16(!guardada);
|
|
4172
|
+
const [errorDeCarga, setErrorDeCarga] = useState16(null);
|
|
4173
|
+
const [anchosCalculados, setAnchosCalculados] = useState16(() => guardada?.anchosCalculados ?? /* @__PURE__ */ new Map());
|
|
4174
|
+
const [detallesAbiertos, setDetallesAbiertos] = useState16(guardada?.detallesAbiertos ?? []);
|
|
4175
|
+
const [altosDetalle, setAltosDetalle] = useState16(() => guardada?.altosDetalle ?? /* @__PURE__ */ new Map());
|
|
4176
|
+
const [anchosDetalle, setAnchosDetalle] = useState16(() => /* @__PURE__ */ new Map());
|
|
4177
|
+
const [selectedRows, setSelectedRows] = useState16(() => /* @__PURE__ */ new Set());
|
|
4178
|
+
const [, setSelectedCell] = useState16(void 0);
|
|
4179
|
+
const [estadoGrilla] = useState16(crearEstadoGrilla);
|
|
4140
4180
|
const theme = useTheme4();
|
|
4141
|
-
const [openDataGridOptions, setOpenDataGridOptions] =
|
|
4142
|
-
const [dataGridOptionsAnchorEl, setDataGridOptionsAnchorEl] =
|
|
4143
|
-
const [exitingRowIds, setExitingRowIds] =
|
|
4181
|
+
const [openDataGridOptions, setOpenDataGridOptions] = useState16(false);
|
|
4182
|
+
const [dataGridOptionsAnchorEl, setDataGridOptionsAnchorEl] = useState16(null);
|
|
4183
|
+
const [exitingRowIds, setExitingRowIds] = useState16(/* @__PURE__ */ new Set());
|
|
4144
4184
|
const { showError } = useSnackbar();
|
|
4145
4185
|
const { username: usuario } = useClientContext();
|
|
4146
4186
|
const dataGridRef = useRef7(null);
|
|
4147
4187
|
const rowAtEditStartRef = useRef7(null);
|
|
4148
|
-
const [openImportDialog, setOpenImportDialog] =
|
|
4149
|
-
const [openExportDialog, setOpenExportDialog] =
|
|
4150
|
-
const [columnWidths, setColumnWidths] =
|
|
4188
|
+
const [openImportDialog, setOpenImportDialog] = useState16(false);
|
|
4189
|
+
const [openExportDialog, setOpenExportDialog] = useState16(false);
|
|
4190
|
+
const [columnWidths, setColumnWidths] = useState16(() => /* @__PURE__ */ new Map());
|
|
4151
4191
|
const { callApi, callApiUpload, loading } = useApiCall();
|
|
4152
4192
|
const primaryKey = useMemo10(() => {
|
|
4153
4193
|
if (!tableDefinition) return ["id"];
|
|
@@ -4197,7 +4237,7 @@ var GenericDataGrid = ({
|
|
|
4197
4237
|
filasDetalleRef.current = nuevas;
|
|
4198
4238
|
return filas;
|
|
4199
4239
|
}, [filteredRows, abiertos, tableDefinition, primaryKey]);
|
|
4200
|
-
const altoDeDetalle =
|
|
4240
|
+
const altoDeDetalle = useCallback12((clave) => altosDetalle.get(clave) ?? ALTO_INICIAL_DETALLE, [altosDetalle]);
|
|
4201
4241
|
const altoDetalles = useMemo10(
|
|
4202
4242
|
() => filasMostradas.reduce((total, row) => esFilaDetalle(row) ? total + altoDeDetalle(row.clave) : total, 0),
|
|
4203
4243
|
[filasMostradas, altoDeDetalle]
|
|
@@ -4244,9 +4284,9 @@ var GenericDataGrid = ({
|
|
|
4244
4284
|
filasVisiblesMax,
|
|
4245
4285
|
conPie
|
|
4246
4286
|
});
|
|
4247
|
-
const [contenidoDeCelda, setContenidoDeCelda] =
|
|
4248
|
-
const verContenido =
|
|
4249
|
-
const cerrarContenidoDeCelda =
|
|
4287
|
+
const [contenidoDeCelda, setContenidoDeCelda] = useState16(null);
|
|
4288
|
+
const verContenido = useCallback12((anclaje, texto) => setContenidoDeCelda({ anclaje, texto }), []);
|
|
4289
|
+
const cerrarContenidoDeCelda = useCallback12(() => {
|
|
4250
4290
|
const anclaje = contenidoDeCelda?.anclaje;
|
|
4251
4291
|
setContenidoDeCelda(null);
|
|
4252
4292
|
setTimeout(() => anclaje?.focus(), 0);
|
|
@@ -4374,11 +4414,11 @@ var GenericDataGrid = ({
|
|
|
4374
4414
|
if (timer) clearTimeout(timer);
|
|
4375
4415
|
};
|
|
4376
4416
|
}, [estadoGrilla]);
|
|
4377
|
-
const resetSortingDeLaTabla =
|
|
4417
|
+
const resetSortingDeLaTabla = useCallback12(() => {
|
|
4378
4418
|
if (tableDefinition) resetSorting(tableDefinition);
|
|
4379
4419
|
}, [tableDefinition, resetSorting]);
|
|
4380
|
-
const abrirImportacion =
|
|
4381
|
-
const abrirExportacion =
|
|
4420
|
+
const abrirImportacion = useCallback12(() => setOpenImportDialog(true), []);
|
|
4421
|
+
const abrirExportacion = useCallback12(() => setOpenExportDialog(true), []);
|
|
4382
4422
|
const { menuOptions } = useGridMenu({
|
|
4383
4423
|
tableDefinition,
|
|
4384
4424
|
tableName,
|
|
@@ -4389,11 +4429,11 @@ var GenericDataGrid = ({
|
|
|
4389
4429
|
triggerImport: abrirImportacion,
|
|
4390
4430
|
triggerExport: abrirExportacion
|
|
4391
4431
|
});
|
|
4392
|
-
const abrirOpcionesDeGrilla =
|
|
4432
|
+
const abrirOpcionesDeGrilla = useCallback12((anchorEl) => {
|
|
4393
4433
|
setDataGridOptionsAnchorEl(anchorEl);
|
|
4394
4434
|
setOpenDataGridOptions(true);
|
|
4395
4435
|
}, []);
|
|
4396
|
-
const editarEnFicha =
|
|
4436
|
+
const editarEnFicha = useCallback12((row) => {
|
|
4397
4437
|
rowAtEditStartRef.current = { ...row };
|
|
4398
4438
|
handleVerticalEditRow(row);
|
|
4399
4439
|
}, [handleVerticalEditRow]);
|
|
@@ -4411,7 +4451,7 @@ var GenericDataGrid = ({
|
|
|
4411
4451
|
toggleFilterVisibility,
|
|
4412
4452
|
abrirOpcionesDeGrilla
|
|
4413
4453
|
});
|
|
4414
|
-
const abrirDetalleEnPestana =
|
|
4454
|
+
const abrirDetalleEnPestana = useCallback12((row, detailTable) => {
|
|
4415
4455
|
if (!onOpenDetail || !tableDefinition || !detailTable.table) return;
|
|
4416
4456
|
const porCampo = /* @__PURE__ */ new Map();
|
|
4417
4457
|
[...fixedFields ?? [], ...calcularFixedFieldsDetalle(detailTable, row)].forEach((ff) => porCampo.set(ff.fieldName, ff));
|
|
@@ -4421,12 +4461,12 @@ var GenericDataGrid = ({
|
|
|
4421
4461
|
const newAncestors = [...ancestors, { tableName: tableDefinition.name, row, tableDefinition, fixedFields: allFixedFields }];
|
|
4422
4462
|
onOpenDetail(detailTable.table, allFixedFields, label, newAncestors);
|
|
4423
4463
|
}, [onOpenDetail, tableDefinition, fixedFields, ancestors]);
|
|
4424
|
-
const abrirWScreenEnPestana =
|
|
4464
|
+
const abrirWScreenEnPestana = useCallback12((row, detailTable) => {
|
|
4425
4465
|
const parametros2 = new URLSearchParams();
|
|
4426
4466
|
calcularFixedFieldsDetalle(detailTable, row).forEach((ff) => parametros2.set(ff.fieldName, String(ff.value)));
|
|
4427
4467
|
window.open(`${window.location.origin}${rutaBase}/wScreens/${detailTable.wScreen}?${parametros2}`, "_blank");
|
|
4428
4468
|
}, []);
|
|
4429
|
-
const alternarDetalle =
|
|
4469
|
+
const alternarDetalle = useCallback12((row, rowId, detailTable, enOtraPestana) => {
|
|
4430
4470
|
if (enOtraPestana && detailTable.wScreen) {
|
|
4431
4471
|
abrirWScreenEnPestana(row, detailTable);
|
|
4432
4472
|
return;
|
|
@@ -4438,7 +4478,7 @@ var GenericDataGrid = ({
|
|
|
4438
4478
|
const clave = claveDetalle(rowId, detailTable);
|
|
4439
4479
|
setDetallesAbiertos((anteriores) => anteriores.includes(clave) ? anteriores.filter((c) => c !== clave) : [...anteriores, clave]);
|
|
4440
4480
|
}, [onOpenDetail, abrirDetalleEnPestana, abrirWScreenEnPestana]);
|
|
4441
|
-
const [medidas, setMedidas] =
|
|
4481
|
+
const [medidas, setMedidas] = useState16(null);
|
|
4442
4482
|
useEffect6(() => {
|
|
4443
4483
|
const elemento = dataGridRef.current?.element;
|
|
4444
4484
|
if (!elemento) return;
|
|
@@ -4452,7 +4492,7 @@ var GenericDataGrid = ({
|
|
|
4452
4492
|
return () => observador.disconnect();
|
|
4453
4493
|
}, [tableDefinition, cargandoInicial]);
|
|
4454
4494
|
const anchoVisible = medidas?.ancho ?? null;
|
|
4455
|
-
const [altoDeVentana, setAltoDeVentana] =
|
|
4495
|
+
const [altoDeVentana, setAltoDeVentana] = useState16(null);
|
|
4456
4496
|
useEffect6(() => {
|
|
4457
4497
|
if (anidada) return;
|
|
4458
4498
|
const elemento = dataGridRef.current?.element;
|
|
@@ -4465,22 +4505,22 @@ var GenericDataGrid = ({
|
|
|
4465
4505
|
const altoDeContexto = useContext4(AltoDisponibleContext);
|
|
4466
4506
|
const altoDeEstaGrilla = anidada ? altoDisponible ?? (altoDeContexto === void 0 ? void 0 : altoDeContexto - ALTO_TITULO_ANIDADA) : altoDeVentana ?? void 0;
|
|
4467
4507
|
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);
|
|
4468
|
-
const cambiarAnchoDetalle =
|
|
4508
|
+
const cambiarAnchoDetalle = useCallback12((clave, ancho) => {
|
|
4469
4509
|
setAnchosDetalle((anteriores) => anteriores.get(clave) === ancho ? anteriores : new Map(anteriores).set(clave, ancho));
|
|
4470
4510
|
}, []);
|
|
4471
|
-
const cambiarAltoDetalle =
|
|
4511
|
+
const cambiarAltoDetalle = useCallback12((clave, altoDeseado2) => {
|
|
4472
4512
|
const alto = Math.min(Math.max(Math.round(altoDeseado2), ALTO_MINIMO_DETALLE), altoMaximoDetalleEfectivo ?? Infinity);
|
|
4473
4513
|
setAltosDetalle((anteriores) => anteriores.get(clave) === alto ? anteriores : new Map(anteriores).set(clave, alto));
|
|
4474
4514
|
}, [altoMaximoDetalleEfectivo]);
|
|
4475
|
-
const renderDetalle =
|
|
4515
|
+
const renderDetalle = useCallback12((fila) => {
|
|
4476
4516
|
const { detailTable } = fila;
|
|
4477
|
-
return /* @__PURE__ */
|
|
4517
|
+
return /* @__PURE__ */ jsx22(
|
|
4478
4518
|
"div",
|
|
4479
4519
|
{
|
|
4480
4520
|
className: "fpr-detalle",
|
|
4481
4521
|
style: { maxWidth: anchoVisible ? anchoVisible - 2 : void 0 },
|
|
4482
4522
|
onKeyDown: (e) => e.stopPropagation(),
|
|
4483
|
-
children: detailTable.table ? /* @__PURE__ */
|
|
4523
|
+
children: detailTable.table ? /* @__PURE__ */ jsx22(
|
|
4484
4524
|
GenericDataGrid,
|
|
4485
4525
|
{
|
|
4486
4526
|
tableName: detailTable.table,
|
|
@@ -4493,7 +4533,7 @@ var GenericDataGrid = ({
|
|
|
4493
4533
|
onOpenDetail,
|
|
4494
4534
|
ancestors: tableDefinition ? [...ancestors, { tableName: tableDefinition.name, row: fila.filaPadre, tableDefinition, fixedFields: fila.fixedFields }] : ancestors
|
|
4495
4535
|
}
|
|
4496
|
-
) : detailTable.wScreen ? /* @__PURE__ */
|
|
4536
|
+
) : detailTable.wScreen ? /* @__PURE__ */ jsx22(
|
|
4497
4537
|
DetalleWScreen,
|
|
4498
4538
|
{
|
|
4499
4539
|
fila,
|
|
@@ -4514,9 +4554,9 @@ var GenericDataGrid = ({
|
|
|
4514
4554
|
useEffect6(() => {
|
|
4515
4555
|
onAltoDeseado?.(altoDeseado);
|
|
4516
4556
|
}, [onAltoDeseado, altoDeseado]);
|
|
4517
|
-
const rowKeyGetter =
|
|
4518
|
-
const rowHeight =
|
|
4519
|
-
const rowClass =
|
|
4557
|
+
const rowKeyGetter = useCallback12((row) => esFilaDetalle(row) ? `detalle:${row.clave}` : getPrimaryKeyValues(row, primaryKey), [primaryKey]);
|
|
4558
|
+
const rowHeight = useCallback12((row) => esFilaDetalle(row) ? altoDeDetalle(row.clave) : ROW_HEIGHT, [altoDeDetalle]);
|
|
4559
|
+
const rowClass = useCallback12(
|
|
4520
4560
|
(row) => esFilaDetalle(row) ? "fpr-fila-detalle" : exitingRowIds.has(getPrimaryKeyValues(row, primaryKey)) ? "fpr-fila-saliendo" : void 0,
|
|
4521
4561
|
[exitingRowIds, primaryKey]
|
|
4522
4562
|
);
|
|
@@ -4548,18 +4588,18 @@ var GenericDataGrid = ({
|
|
|
4548
4588
|
const fallBackMessage = getFallBackMessage();
|
|
4549
4589
|
if (cargandoInicial) {
|
|
4550
4590
|
return /* @__PURE__ */ jsxs17(Box12, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: [
|
|
4551
|
-
/* @__PURE__ */
|
|
4552
|
-
/* @__PURE__ */
|
|
4591
|
+
/* @__PURE__ */ jsx22(CircularProgress4, {}),
|
|
4592
|
+
/* @__PURE__ */ jsx22(Typography10, { variant: "h6", sx: { ml: 2 }, children: "Cargando tabla..." })
|
|
4553
4593
|
] });
|
|
4554
4594
|
}
|
|
4555
4595
|
if (errorDeCarga) {
|
|
4556
|
-
return /* @__PURE__ */
|
|
4596
|
+
return /* @__PURE__ */ jsx22(Box12, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsx22(Alert2, { severity: "error", children: errorDeCarga }) });
|
|
4557
4597
|
}
|
|
4558
4598
|
if (!tableDefinition) {
|
|
4559
|
-
return /* @__PURE__ */
|
|
4599
|
+
return /* @__PURE__ */ jsx22(Box12, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsx22(Alert2, { severity: "warning", children: "No se pudo cargar la definici\xF3n de la tabla." }) });
|
|
4560
4600
|
}
|
|
4561
|
-
return /* @__PURE__ */
|
|
4562
|
-
!anidada && ancestors.length > 0 && /* @__PURE__ */
|
|
4601
|
+
return /* @__PURE__ */ jsx22(CacheGrillasContext.Provider, { value: cache, children: /* @__PURE__ */ jsxs17(Box12, { sx: { pt: anidada ? 0 : 2, display: "flex", flexDirection: "column", height: "100%", boxSizing: "border-box", width: anchoContenido ?? void 0, maxWidth: "100%" }, children: [
|
|
4602
|
+
!anidada && ancestors.length > 0 && /* @__PURE__ */ jsx22(Box12, { sx: { px: 2, pt: 0, pb: 1, display: "flex", flexDirection: "column" }, children: ancestors.map((ancestor, index) => /* @__PURE__ */ jsx22(
|
|
4563
4603
|
StaticAncestorGrid,
|
|
4564
4604
|
{
|
|
4565
4605
|
ancestor,
|
|
@@ -4596,7 +4636,7 @@ var GenericDataGrid = ({
|
|
|
4596
4636
|
" - ",
|
|
4597
4637
|
filteredRows.length === tableData.length ? `${tableData.length} registros` : `${filteredRows.length} (F)`
|
|
4598
4638
|
] }),
|
|
4599
|
-
loading && /* @__PURE__ */
|
|
4639
|
+
loading && /* @__PURE__ */ jsx22(CircularProgress4, { size: 14, color: "inherit" })
|
|
4600
4640
|
]
|
|
4601
4641
|
}
|
|
4602
4642
|
),
|
|
@@ -4619,7 +4659,7 @@ var GenericDataGrid = ({
|
|
|
4619
4659
|
pb: anidada ? 0 : 3
|
|
4620
4660
|
},
|
|
4621
4661
|
children: [
|
|
4622
|
-
/* @__PURE__ */
|
|
4662
|
+
/* @__PURE__ */ jsx22(EstadoGrillaContext.Provider, { value: estadoGrilla, children: /* @__PURE__ */ jsx22(VistaGrillaContext.Provider, { value: vistaGrilla, children: /* @__PURE__ */ jsx22(DetallesGrillaContext.Provider, { value: detallesGrilla, children: /* @__PURE__ */ jsx22(
|
|
4623
4663
|
DataGrid,
|
|
4624
4664
|
{
|
|
4625
4665
|
className: "rdg-light",
|
|
@@ -4649,7 +4689,7 @@ var GenericDataGrid = ({
|
|
|
4649
4689
|
onCellKeyDown: handleCellKeyDown
|
|
4650
4690
|
}
|
|
4651
4691
|
) }) }) }),
|
|
4652
|
-
fallBackMessage && /* @__PURE__ */
|
|
4692
|
+
fallBackMessage && /* @__PURE__ */ jsx22(
|
|
4653
4693
|
Box12,
|
|
4654
4694
|
{
|
|
4655
4695
|
sx: {
|
|
@@ -4666,13 +4706,13 @@ var GenericDataGrid = ({
|
|
|
4666
4706
|
zIndex: tableData.length === 0 ? 10 : 1
|
|
4667
4707
|
// Mantenemos el zIndex superior para el estado vacío total
|
|
4668
4708
|
},
|
|
4669
|
-
children: /* @__PURE__ */
|
|
4709
|
+
children: /* @__PURE__ */ jsx22(Typography10, { variant: "body2", color: "textSecondary", children: fallBackMessage })
|
|
4670
4710
|
}
|
|
4671
4711
|
)
|
|
4672
4712
|
]
|
|
4673
4713
|
}
|
|
4674
4714
|
),
|
|
4675
|
-
/* @__PURE__ */
|
|
4715
|
+
/* @__PURE__ */ jsx22(
|
|
4676
4716
|
ExportDialog,
|
|
4677
4717
|
{
|
|
4678
4718
|
open: openExportDialog,
|
|
@@ -4683,7 +4723,7 @@ var GenericDataGrid = ({
|
|
|
4683
4723
|
username: usuario || "anonymous"
|
|
4684
4724
|
}
|
|
4685
4725
|
),
|
|
4686
|
-
/* @__PURE__ */
|
|
4726
|
+
/* @__PURE__ */ jsx22(
|
|
4687
4727
|
ConfirmDialog,
|
|
4688
4728
|
{
|
|
4689
4729
|
open: openConfirmDialog,
|
|
@@ -4692,7 +4732,7 @@ var GenericDataGrid = ({
|
|
|
4692
4732
|
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."
|
|
4693
4733
|
}
|
|
4694
4734
|
),
|
|
4695
|
-
/* @__PURE__ */
|
|
4735
|
+
/* @__PURE__ */ jsx22(
|
|
4696
4736
|
DataGridOptionsDialog,
|
|
4697
4737
|
{
|
|
4698
4738
|
open: openDataGridOptions,
|
|
@@ -4701,7 +4741,7 @@ var GenericDataGrid = ({
|
|
|
4701
4741
|
anchorEl: dataGridOptionsAnchorEl
|
|
4702
4742
|
}
|
|
4703
4743
|
),
|
|
4704
|
-
/* @__PURE__ */
|
|
4744
|
+
/* @__PURE__ */ jsx22(
|
|
4705
4745
|
ImportDialog,
|
|
4706
4746
|
{
|
|
4707
4747
|
open: openImportDialog,
|
|
@@ -4710,14 +4750,14 @@ var GenericDataGrid = ({
|
|
|
4710
4750
|
loading
|
|
4711
4751
|
}
|
|
4712
4752
|
),
|
|
4713
|
-
/* @__PURE__ */
|
|
4753
|
+
/* @__PURE__ */ jsx22(
|
|
4714
4754
|
Dialog4,
|
|
4715
4755
|
{
|
|
4716
4756
|
open: openVerticalEditDialog,
|
|
4717
4757
|
onClose: () => setOpenVerticalEditDialog(false),
|
|
4718
4758
|
maxWidth: "sm",
|
|
4719
4759
|
fullWidth: true,
|
|
4720
|
-
children: rowToEditVertical && /* @__PURE__ */
|
|
4760
|
+
children: rowToEditVertical && /* @__PURE__ */ jsx22(
|
|
4721
4761
|
VerticalEditorPage,
|
|
4722
4762
|
{
|
|
4723
4763
|
tableName,
|
|
@@ -4762,13 +4802,13 @@ var GenericDataGrid = ({
|
|
|
4762
4802
|
)
|
|
4763
4803
|
}
|
|
4764
4804
|
),
|
|
4765
|
-
contenidoDeCelda && /* @__PURE__ */
|
|
4805
|
+
contenidoDeCelda && /* @__PURE__ */ jsx22(VentanaDeTexto, { anclaje: contenidoDeCelda.anclaje, texto: contenidoDeCelda.texto, editable: false, onAceptar: cerrarContenidoDeCelda, onCerrar: cerrarContenidoDeCelda })
|
|
4766
4806
|
] }) });
|
|
4767
4807
|
};
|
|
4768
4808
|
var GenericDataGrid_default = GenericDataGrid;
|
|
4769
4809
|
|
|
4770
4810
|
// src/App.tsx
|
|
4771
|
-
import
|
|
4811
|
+
import React33, { useEffect as useEffect18, useMemo as useMemo16 } from "react";
|
|
4772
4812
|
import { BrowserRouter, Routes, Route, useLocation as useLocation8, Navigate as Navigate4, Outlet as Outlet2 } from "react-router-dom";
|
|
4773
4813
|
|
|
4774
4814
|
// src/components/MainLayout.tsx
|
|
@@ -4788,10 +4828,10 @@ import {
|
|
|
4788
4828
|
} from "@mui/material";
|
|
4789
4829
|
|
|
4790
4830
|
// src/contexts/AppContext.tsx
|
|
4791
|
-
import { createContext as createContext4, useContext as useContext5, useState as
|
|
4831
|
+
import { createContext as createContext4, useContext as useContext5, useState as useState17, useEffect as useEffect7, useCallback as useCallback13, useMemo as useMemo11, useRef as useRef8 } from "react";
|
|
4792
4832
|
import { useLocation, useNavigate } from "react-router-dom";
|
|
4793
4833
|
import { useSelector as useSelector2, useDispatch as useDispatch2 } from "react-redux";
|
|
4794
|
-
import { jsx as
|
|
4834
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
4795
4835
|
var AuthContext = createContext4(void 0);
|
|
4796
4836
|
var useApp = () => {
|
|
4797
4837
|
const context = useContext5(AuthContext);
|
|
@@ -4803,15 +4843,15 @@ var useApp = () => {
|
|
|
4803
4843
|
};
|
|
4804
4844
|
var AppProvider = ({ children, publicPaths = [] }) => {
|
|
4805
4845
|
console.log("AppProvider rendered/re-rendered");
|
|
4806
|
-
const [isLoggedIn, setIsLoggedIn] =
|
|
4807
|
-
const [showSessionExpiredMessage, setShowSessionExpiredMessage] =
|
|
4846
|
+
const [isLoggedIn, setIsLoggedIn] = useState17(false);
|
|
4847
|
+
const [showSessionExpiredMessage, setShowSessionExpiredMessage] = useState17(false);
|
|
4808
4848
|
const isRedirectingRef = useRef8(false);
|
|
4809
4849
|
const huboSesionRef = useRef8(false);
|
|
4810
4850
|
const dispatch = useDispatch2();
|
|
4811
4851
|
const clientContext = useSelector2((state) => state.clientContext);
|
|
4812
4852
|
if (clientContext.status === "succeeded") huboSesionRef.current = true;
|
|
4813
4853
|
const navigate = useNavigate();
|
|
4814
|
-
const handleExpiredSessionRedirect =
|
|
4854
|
+
const handleExpiredSessionRedirect = useCallback13(() => {
|
|
4815
4855
|
isRedirectingRef.current = true;
|
|
4816
4856
|
setShowSessionExpiredMessage(false);
|
|
4817
4857
|
setIsLoggedIn(false);
|
|
@@ -4821,11 +4861,11 @@ var AppProvider = ({ children, publicPaths = [] }) => {
|
|
|
4821
4861
|
}, 2e3);
|
|
4822
4862
|
}, [navigate]);
|
|
4823
4863
|
const location = useLocation();
|
|
4824
|
-
const isCurrentPathPublic =
|
|
4864
|
+
const isCurrentPathPublic = useCallback13(() => {
|
|
4825
4865
|
const current = location.pathname;
|
|
4826
4866
|
return publicPaths.some((path) => current === path || current.startsWith(`${path}/`));
|
|
4827
4867
|
}, [location.pathname, publicPaths]);
|
|
4828
|
-
const checkSession =
|
|
4868
|
+
const checkSession = useCallback13(async () => {
|
|
4829
4869
|
if (isRedirectingRef.current) return;
|
|
4830
4870
|
try {
|
|
4831
4871
|
const response = await fetchApi("/keep-alive.json", { method: "GET" });
|
|
@@ -4885,7 +4925,7 @@ var AppProvider = ({ children, publicPaths = [] }) => {
|
|
|
4885
4925
|
setShowSessionExpiredMessage,
|
|
4886
4926
|
handleExpiredSessionRedirect
|
|
4887
4927
|
]);
|
|
4888
|
-
return /* @__PURE__ */
|
|
4928
|
+
return /* @__PURE__ */ jsx23(AuthContext.Provider, { value: authContextValue, children });
|
|
4889
4929
|
};
|
|
4890
4930
|
|
|
4891
4931
|
// src/components/MainLayout.tsx
|
|
@@ -4894,7 +4934,7 @@ import MenuIcon from "@mui/icons-material/Menu";
|
|
|
4894
4934
|
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
4895
4935
|
|
|
4896
4936
|
// src/components/SideMenu.tsx
|
|
4897
|
-
import
|
|
4937
|
+
import React19, { useEffect as useEffect8 } from "react";
|
|
4898
4938
|
import { List as List3, ListItem, ListItemButton as ListItemButton3, ListItemIcon as ListItemIcon2, ListItemText as ListItemText2, Divider as Divider2, Box as Box13, Typography as Typography11, Collapse } from "@mui/material";
|
|
4899
4939
|
import ExpandLess from "@mui/icons-material/ExpandLess";
|
|
4900
4940
|
import ExpandMore from "@mui/icons-material/ExpandMore";
|
|
@@ -4928,7 +4968,7 @@ function itemInicial(menu) {
|
|
|
4928
4968
|
}
|
|
4929
4969
|
|
|
4930
4970
|
// src/components/SideMenu.tsx
|
|
4931
|
-
import { jsx as
|
|
4971
|
+
import { jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4932
4972
|
var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
4933
4973
|
const navigate = useNavigate2();
|
|
4934
4974
|
const location = useLocation2();
|
|
@@ -4947,17 +4987,17 @@ var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
|
4947
4987
|
const getIcon = (item2) => {
|
|
4948
4988
|
switch (item2.menuType) {
|
|
4949
4989
|
case "table":
|
|
4950
|
-
return /* @__PURE__ */
|
|
4990
|
+
return /* @__PURE__ */ jsx24(TableChartIcon, { sx: { color: blue[700] } });
|
|
4951
4991
|
case "proc":
|
|
4952
|
-
return /* @__PURE__ */
|
|
4992
|
+
return /* @__PURE__ */ jsx24(DnsIcon, { sx: { color: teal[700] } });
|
|
4953
4993
|
case "menu":
|
|
4954
|
-
return /* @__PURE__ */
|
|
4994
|
+
return /* @__PURE__ */ jsx24(FolderIcon, { sx: { color: orange[800] } });
|
|
4955
4995
|
default:
|
|
4956
4996
|
const WScreenComponent = wScreens[item2.menuType];
|
|
4957
4997
|
if (WScreenComponent !== void 0) {
|
|
4958
|
-
return /* @__PURE__ */
|
|
4998
|
+
return /* @__PURE__ */ jsx24(DesktopWindowsIcon, { sx: { color: grey[700] } });
|
|
4959
4999
|
}
|
|
4960
|
-
return /* @__PURE__ */
|
|
5000
|
+
return /* @__PURE__ */ jsx24(WarningAmberIcon3, { sx: { color: red[500] } });
|
|
4961
5001
|
}
|
|
4962
5002
|
};
|
|
4963
5003
|
const currentPath = location.pathname;
|
|
@@ -4971,7 +5011,7 @@ var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
|
4971
5011
|
} else if (item.menuType !== "menu") {
|
|
4972
5012
|
isSelected = currentPath.startsWith(`/wScreens/${item.menuType}`) || currentPath.startsWith(`/wScreens-fallback/${item.menuType}`);
|
|
4973
5013
|
}
|
|
4974
|
-
const itemRef =
|
|
5014
|
+
const itemRef = React19.useRef(null);
|
|
4975
5015
|
useEffect8(() => {
|
|
4976
5016
|
if (isSelected && itemRef.current) {
|
|
4977
5017
|
itemRef.current.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
@@ -4985,13 +5025,13 @@ var MenuListItem = ({ item, level, onMenuItemClick }) => {
|
|
|
4985
5025
|
sx: { pl: level * 2 },
|
|
4986
5026
|
selected: isSelected,
|
|
4987
5027
|
children: [
|
|
4988
|
-
/* @__PURE__ */
|
|
4989
|
-
/* @__PURE__ */
|
|
4990
|
-
item.menuType === "menu" ? open ? /* @__PURE__ */
|
|
5028
|
+
/* @__PURE__ */ jsx24(ListItemIcon2, { sx: { minWidth: "38px" }, children: getIcon(item) }),
|
|
5029
|
+
/* @__PURE__ */ jsx24(ListItemText2, { primary: item.label || item.name }),
|
|
5030
|
+
item.menuType === "menu" ? open ? /* @__PURE__ */ jsx24(ExpandLess, {}) : /* @__PURE__ */ jsx24(ExpandMore, {}) : null
|
|
4991
5031
|
]
|
|
4992
5032
|
}
|
|
4993
5033
|
),
|
|
4994
|
-
item.menuType === "menu" && /* @__PURE__ */
|
|
5034
|
+
item.menuType === "menu" && /* @__PURE__ */ jsx24(Collapse, { in: open, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ jsx24(List3, { component: "div", disablePadding: true, children: item.menuContent.map((subItem) => /* @__PURE__ */ jsx24(
|
|
4995
5035
|
MenuListItem,
|
|
4996
5036
|
{
|
|
4997
5037
|
item: subItem,
|
|
@@ -5015,7 +5055,7 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5015
5055
|
dispatch(setAllSubMenusOpen(!isMostlyOpen));
|
|
5016
5056
|
};
|
|
5017
5057
|
if (!clientContext || !clientContext.menu) {
|
|
5018
|
-
return /* @__PURE__ */
|
|
5058
|
+
return /* @__PURE__ */ jsx24(Box13, { sx: { p: 2, textAlign: "center" }, children: /* @__PURE__ */ jsx24(Typography11, { variant: "body2", color: "text.secondary", children: "Cargando men\xFA..." }) });
|
|
5019
5059
|
}
|
|
5020
5060
|
useEffect8(() => {
|
|
5021
5061
|
if (!clientContext?.menu) return;
|
|
@@ -5047,12 +5087,12 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5047
5087
|
expandParents(clientContext.menu, location.pathname);
|
|
5048
5088
|
}, [location.pathname, clientContext, dispatch]);
|
|
5049
5089
|
return /* @__PURE__ */ jsxs18(Box13, { sx: { width: "100%", flexShrink: 0 }, children: [
|
|
5050
|
-
clientContext.menu.some((item) => item.menuType === "menu") && /* @__PURE__ */
|
|
5051
|
-
/* @__PURE__ */
|
|
5052
|
-
/* @__PURE__ */
|
|
5090
|
+
clientContext.menu.some((item) => item.menuType === "menu") && /* @__PURE__ */ jsx24(ListItem, { disablePadding: true, children: /* @__PURE__ */ jsxs18(ListItemButton3, { onClick: handleToggleAllSubMenus, children: [
|
|
5091
|
+
/* @__PURE__ */ jsx24(ListItemIcon2, { sx: { minWidth: "38px" }, children: isMostlyOpen ? /* @__PURE__ */ jsx24(UnfoldLessIcon, {}) : /* @__PURE__ */ jsx24(UnfoldMoreIcon, {}) }),
|
|
5092
|
+
/* @__PURE__ */ jsx24(ListItemText2, { primary: isMostlyOpen ? "colapsar " : "expandir" })
|
|
5053
5093
|
] }) }),
|
|
5054
|
-
/* @__PURE__ */
|
|
5055
|
-
/* @__PURE__ */
|
|
5094
|
+
/* @__PURE__ */ jsx24(Divider2, {}),
|
|
5095
|
+
/* @__PURE__ */ jsx24(List3, { children: clientContext.menu.map((menuItem) => /* @__PURE__ */ jsx24(
|
|
5056
5096
|
MenuListItem,
|
|
5057
5097
|
{
|
|
5058
5098
|
item: menuItem,
|
|
@@ -5066,14 +5106,14 @@ var SideMenu = ({ onMenuItemClick }) => {
|
|
|
5066
5106
|
var SideMenu_default = SideMenu;
|
|
5067
5107
|
|
|
5068
5108
|
// src/hooks/useLogout.tsx
|
|
5069
|
-
import { useCallback as
|
|
5109
|
+
import { useCallback as useCallback14 } from "react";
|
|
5070
5110
|
import { useNavigate as useNavigate3 } from "react-router-dom";
|
|
5071
5111
|
import { useDispatch as useDispatch3 } from "react-redux";
|
|
5072
5112
|
var useLogout = () => {
|
|
5073
5113
|
const { setIsLoggedIn } = useApp();
|
|
5074
5114
|
const dispatch = useDispatch3();
|
|
5075
5115
|
const navigate = useNavigate3();
|
|
5076
|
-
const logout =
|
|
5116
|
+
const logout = useCallback14(async () => {
|
|
5077
5117
|
try {
|
|
5078
5118
|
const response = await fetchApi("/logout", { method: "GET" });
|
|
5079
5119
|
if (response.status === 401 || response.ok) {
|
|
@@ -5094,7 +5134,7 @@ var useLogout = () => {
|
|
|
5094
5134
|
var useLogout_default = useLogout;
|
|
5095
5135
|
|
|
5096
5136
|
// src/components/MainLayout.tsx
|
|
5097
|
-
import { jsx as
|
|
5137
|
+
import { jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
5098
5138
|
var drawerWidth = 240;
|
|
5099
5139
|
var MainLayout = () => {
|
|
5100
5140
|
const { clientContext } = useApp();
|
|
@@ -5117,11 +5157,11 @@ var MainLayout = () => {
|
|
|
5117
5157
|
}
|
|
5118
5158
|
};
|
|
5119
5159
|
if (!clientContext) {
|
|
5120
|
-
return /* @__PURE__ */
|
|
5160
|
+
return /* @__PURE__ */ jsx25(Box14, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ jsx25(Typography12, { children: "Cargando dise\xF1o de la aplicaci\xF3n..." }) });
|
|
5121
5161
|
}
|
|
5122
5162
|
return /* @__PURE__ */ jsxs19(Box14, { sx: { display: "flex", height: "100vh" }, children: [
|
|
5123
|
-
/* @__PURE__ */
|
|
5124
|
-
/* @__PURE__ */
|
|
5163
|
+
/* @__PURE__ */ jsx25(CssBaseline, {}),
|
|
5164
|
+
/* @__PURE__ */ jsx25(
|
|
5125
5165
|
AppBar,
|
|
5126
5166
|
{
|
|
5127
5167
|
position: "fixed",
|
|
@@ -5141,7 +5181,7 @@ var MainLayout = () => {
|
|
|
5141
5181
|
}
|
|
5142
5182
|
},
|
|
5143
5183
|
children: /* @__PURE__ */ jsxs19(Toolbar, { children: [
|
|
5144
|
-
/* @__PURE__ */
|
|
5184
|
+
/* @__PURE__ */ jsx25(
|
|
5145
5185
|
IconButton6,
|
|
5146
5186
|
{
|
|
5147
5187
|
color: "inherit",
|
|
@@ -5151,10 +5191,10 @@ var MainLayout = () => {
|
|
|
5151
5191
|
sx: {
|
|
5152
5192
|
marginRight: 2
|
|
5153
5193
|
},
|
|
5154
|
-
children: isDrawerOpen ? /* @__PURE__ */
|
|
5194
|
+
children: isDrawerOpen ? /* @__PURE__ */ jsx25(ChevronLeftIcon, {}) : /* @__PURE__ */ jsx25(MenuIcon, {})
|
|
5155
5195
|
}
|
|
5156
5196
|
),
|
|
5157
|
-
!isDrawerOpen && /* @__PURE__ */
|
|
5197
|
+
!isDrawerOpen && /* @__PURE__ */ jsx25(
|
|
5158
5198
|
"img",
|
|
5159
5199
|
{
|
|
5160
5200
|
src: `${envConfig.backendUrl}/img/logo-128.png`,
|
|
@@ -5162,14 +5202,14 @@ var MainLayout = () => {
|
|
|
5162
5202
|
style: { height: "32px", marginRight: "12px", objectFit: "contain" }
|
|
5163
5203
|
}
|
|
5164
5204
|
),
|
|
5165
|
-
/* @__PURE__ */
|
|
5166
|
-
/* @__PURE__ */
|
|
5167
|
-
/* @__PURE__ */
|
|
5205
|
+
/* @__PURE__ */ jsx25(Typography12, { variant: "h6", noWrap: true, component: "div", sx: { flexGrow: 1 }, children: isDrawerOpen ? "" : clientContext.config.title }),
|
|
5206
|
+
/* @__PURE__ */ jsx25(Typography12, { variant: "subtitle1", component: "div", sx: { mr: 2 }, children: clientContext.username }),
|
|
5207
|
+
/* @__PURE__ */ jsx25(
|
|
5168
5208
|
Button8,
|
|
5169
5209
|
{
|
|
5170
5210
|
color: "inherit",
|
|
5171
5211
|
onClick: logout,
|
|
5172
|
-
startIcon: /* @__PURE__ */
|
|
5212
|
+
startIcon: /* @__PURE__ */ jsx25(LogoutIcon, {}),
|
|
5173
5213
|
children: "Salir"
|
|
5174
5214
|
}
|
|
5175
5215
|
)
|
|
@@ -5206,7 +5246,7 @@ var MainLayout = () => {
|
|
|
5206
5246
|
gap: 1.5
|
|
5207
5247
|
},
|
|
5208
5248
|
children: [
|
|
5209
|
-
/* @__PURE__ */
|
|
5249
|
+
/* @__PURE__ */ jsx25(
|
|
5210
5250
|
"img",
|
|
5211
5251
|
{
|
|
5212
5252
|
src: `${envConfig.backendUrl}/img/logo-128.png`,
|
|
@@ -5214,11 +5254,11 @@ var MainLayout = () => {
|
|
|
5214
5254
|
style: { height: "32px", objectFit: "contain" }
|
|
5215
5255
|
}
|
|
5216
5256
|
),
|
|
5217
|
-
/* @__PURE__ */
|
|
5257
|
+
/* @__PURE__ */ jsx25(Typography12, { variant: "h6", sx: { fontWeight: "bold" }, children: clientContext.config.title })
|
|
5218
5258
|
]
|
|
5219
5259
|
}
|
|
5220
5260
|
),
|
|
5221
|
-
/* @__PURE__ */
|
|
5261
|
+
/* @__PURE__ */ jsx25(SideMenu_default, { onMenuItemClick: handleDrawerCloseMobile })
|
|
5222
5262
|
]
|
|
5223
5263
|
}
|
|
5224
5264
|
),
|
|
@@ -5249,8 +5289,8 @@ var MainLayout = () => {
|
|
|
5249
5289
|
width: isDrawerOpen ? `calc(100% - ${drawerWidth}px)` : "100%"
|
|
5250
5290
|
},
|
|
5251
5291
|
children: [
|
|
5252
|
-
/* @__PURE__ */
|
|
5253
|
-
/* @__PURE__ */
|
|
5292
|
+
/* @__PURE__ */ jsx25(Toolbar, {}),
|
|
5293
|
+
/* @__PURE__ */ jsx25(Box14, { sx: { flex: 1, minHeight: 0, overflowY: "auto", display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ jsx25(Outlet, {}) })
|
|
5254
5294
|
]
|
|
5255
5295
|
}
|
|
5256
5296
|
)
|
|
@@ -5260,7 +5300,7 @@ var MainLayout_default = MainLayout;
|
|
|
5260
5300
|
|
|
5261
5301
|
// src/components/SessionExpiredMessage.tsx
|
|
5262
5302
|
import { Box as Box15, Typography as Typography13, Button as Button9, Modal } from "@mui/material";
|
|
5263
|
-
import { jsx as
|
|
5303
|
+
import { jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
5264
5304
|
var style = {
|
|
5265
5305
|
position: "absolute",
|
|
5266
5306
|
top: "50%",
|
|
@@ -5279,7 +5319,7 @@ var SessionExpiredMessage = () => {
|
|
|
5279
5319
|
const handleClose = () => {
|
|
5280
5320
|
handleExpiredSessionRedirect();
|
|
5281
5321
|
};
|
|
5282
|
-
return /* @__PURE__ */
|
|
5322
|
+
return /* @__PURE__ */ jsx26(
|
|
5283
5323
|
Modal,
|
|
5284
5324
|
{
|
|
5285
5325
|
open: showSessionExpiredMessage,
|
|
@@ -5300,9 +5340,9 @@ var SessionExpiredMessage = () => {
|
|
|
5300
5340
|
}
|
|
5301
5341
|
},
|
|
5302
5342
|
children: /* @__PURE__ */ jsxs20(Box15, { sx: style, children: [
|
|
5303
|
-
/* @__PURE__ */
|
|
5304
|
-
/* @__PURE__ */
|
|
5305
|
-
/* @__PURE__ */
|
|
5343
|
+
/* @__PURE__ */ jsx26(Typography13, { id: "session-expired-modal-title", variant: "h6", component: "h2", gutterBottom: true, children: "\xA1Sesi\xF3n Expirada!" }),
|
|
5344
|
+
/* @__PURE__ */ jsx26(Typography13, { 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." }),
|
|
5345
|
+
/* @__PURE__ */ jsx26(Button9, { variant: "contained", color: "primary", onClick: handleClose, children: "Ir al Login" })
|
|
5306
5346
|
] })
|
|
5307
5347
|
}
|
|
5308
5348
|
);
|
|
@@ -5311,18 +5351,18 @@ var SessionExpiredMessage_default = SessionExpiredMessage;
|
|
|
5311
5351
|
|
|
5312
5352
|
// src/pages/PantallaInicial.tsx
|
|
5313
5353
|
import { Navigate } from "react-router-dom";
|
|
5314
|
-
import { jsx as
|
|
5354
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
5315
5355
|
var PantallaInicial = () => {
|
|
5316
5356
|
const { clientContext } = useApp();
|
|
5317
5357
|
const item = clientContext.menu ? itemInicial(clientContext.menu) : void 0;
|
|
5318
|
-
return item ? /* @__PURE__ */
|
|
5358
|
+
return item ? /* @__PURE__ */ jsx27(Navigate, { to: rutaDeItemDeMenu(item), replace: true }) : null;
|
|
5319
5359
|
};
|
|
5320
5360
|
var PantallaInicial_default = PantallaInicial;
|
|
5321
5361
|
|
|
5322
5362
|
// src/pages/LogoutPage.tsx
|
|
5323
5363
|
import { useEffect as useEffect10 } from "react";
|
|
5324
5364
|
import { Box as Box16, Typography as Typography14, CircularProgress as CircularProgress5 } from "@mui/material";
|
|
5325
|
-
import { jsx as
|
|
5365
|
+
import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5326
5366
|
var LogoutPage = () => {
|
|
5327
5367
|
const logout = useLogout_default();
|
|
5328
5368
|
useEffect10(() => {
|
|
@@ -5336,20 +5376,20 @@ var LogoutPage = () => {
|
|
|
5336
5376
|
height: "100vh",
|
|
5337
5377
|
textAlign: "center"
|
|
5338
5378
|
}, children: [
|
|
5339
|
-
/* @__PURE__ */
|
|
5340
|
-
/* @__PURE__ */
|
|
5379
|
+
/* @__PURE__ */ jsx28(CircularProgress5, { size: 60 }),
|
|
5380
|
+
/* @__PURE__ */ jsx28(Typography14, { variant: "h6", sx: { mt: 2 }, children: "Cerrando sesi\xF3n..." })
|
|
5341
5381
|
] });
|
|
5342
5382
|
};
|
|
5343
5383
|
var LogoutPage_default = LogoutPage;
|
|
5344
5384
|
|
|
5345
5385
|
// src/pages/LoginPage.tsx
|
|
5346
|
-
import { useState as
|
|
5386
|
+
import { useState as useState18 } from "react";
|
|
5347
5387
|
import { Button as Button10, TextField as TextField2, Typography as Typography15, Alert as Alert3, AlertTitle, Box as Box17, CircularProgress as CircularProgress6 } from "@mui/material";
|
|
5348
5388
|
import { useForm, Controller } from "react-hook-form";
|
|
5349
5389
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
5350
5390
|
import * as z from "zod";
|
|
5351
5391
|
import { useDispatch as useDispatch4 } from "react-redux";
|
|
5352
|
-
import { Fragment as
|
|
5392
|
+
import { Fragment as Fragment5, jsx as jsx29, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5353
5393
|
var loginSchema = z.object({
|
|
5354
5394
|
username: z.string().min(1, "El usuario es requerido"),
|
|
5355
5395
|
// Añadir validación básica
|
|
@@ -5357,8 +5397,8 @@ var loginSchema = z.object({
|
|
|
5357
5397
|
// Añadir validación básica
|
|
5358
5398
|
});
|
|
5359
5399
|
var LoginPage = () => {
|
|
5360
|
-
const [loginError, setLoginError] =
|
|
5361
|
-
const [isSubmitting, setIsSubmitting] =
|
|
5400
|
+
const [loginError, setLoginError] = useState18(null);
|
|
5401
|
+
const [isSubmitting, setIsSubmitting] = useState18(false);
|
|
5362
5402
|
const { setIsLoggedIn, checkSession } = useApp();
|
|
5363
5403
|
const dispatch = useDispatch4();
|
|
5364
5404
|
const {
|
|
@@ -5403,7 +5443,7 @@ var LoginPage = () => {
|
|
|
5403
5443
|
setIsSubmitting(false);
|
|
5404
5444
|
}
|
|
5405
5445
|
};
|
|
5406
|
-
return /* @__PURE__ */
|
|
5446
|
+
return /* @__PURE__ */ jsx29(
|
|
5407
5447
|
Box17,
|
|
5408
5448
|
{
|
|
5409
5449
|
display: "flex",
|
|
@@ -5421,7 +5461,7 @@ var LoginPage = () => {
|
|
|
5421
5461
|
borderRadius: 8,
|
|
5422
5462
|
boxShadow: 3,
|
|
5423
5463
|
children: [
|
|
5424
|
-
/* @__PURE__ */
|
|
5464
|
+
/* @__PURE__ */ jsx29(Box17, { sx: { display: "flex", justifyContent: "center", mb: 3 }, children: /* @__PURE__ */ jsx29(
|
|
5425
5465
|
"img",
|
|
5426
5466
|
{
|
|
5427
5467
|
src: `${envConfig.backendUrl}/img/login-logo-icon.png`,
|
|
@@ -5429,16 +5469,16 @@ var LoginPage = () => {
|
|
|
5429
5469
|
style: { height: "192px", maxWidth: "100%", objectFit: "contain" }
|
|
5430
5470
|
}
|
|
5431
5471
|
) }),
|
|
5432
|
-
/* @__PURE__ */
|
|
5472
|
+
/* @__PURE__ */ jsx29(Typography15, { variant: "h5", align: "center", gutterBottom: true, sx: { fontWeight: "bold", color: "primary.main" }, children: "Iniciar Sesi\xF3n" }),
|
|
5433
5473
|
/* @__PURE__ */ jsxs22("form", { onSubmit: handleSubmit(onSubmit), className: "space-y-4", children: [
|
|
5434
5474
|
/* @__PURE__ */ jsxs22("div", { children: [
|
|
5435
|
-
/* @__PURE__ */
|
|
5436
|
-
/* @__PURE__ */
|
|
5475
|
+
/* @__PURE__ */ jsx29("label", { htmlFor: "username", children: /* @__PURE__ */ jsx29(Typography15, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Usuario" }) }),
|
|
5476
|
+
/* @__PURE__ */ jsx29(
|
|
5437
5477
|
Controller,
|
|
5438
5478
|
{
|
|
5439
5479
|
name: "username",
|
|
5440
5480
|
control,
|
|
5441
|
-
render: ({ field }) => /* @__PURE__ */
|
|
5481
|
+
render: ({ field }) => /* @__PURE__ */ jsx29(
|
|
5442
5482
|
TextField2,
|
|
5443
5483
|
{
|
|
5444
5484
|
...field,
|
|
@@ -5455,13 +5495,13 @@ var LoginPage = () => {
|
|
|
5455
5495
|
)
|
|
5456
5496
|
] }),
|
|
5457
5497
|
/* @__PURE__ */ jsxs22("div", { children: [
|
|
5458
|
-
/* @__PURE__ */
|
|
5459
|
-
/* @__PURE__ */
|
|
5498
|
+
/* @__PURE__ */ jsx29("label", { htmlFor: "password", children: /* @__PURE__ */ jsx29(Typography15, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Contrase\xF1a" }) }),
|
|
5499
|
+
/* @__PURE__ */ jsx29(
|
|
5460
5500
|
Controller,
|
|
5461
5501
|
{
|
|
5462
5502
|
name: "password",
|
|
5463
5503
|
control,
|
|
5464
|
-
render: ({ field }) => /* @__PURE__ */
|
|
5504
|
+
render: ({ field }) => /* @__PURE__ */ jsx29(
|
|
5465
5505
|
TextField2,
|
|
5466
5506
|
{
|
|
5467
5507
|
...field,
|
|
@@ -5477,14 +5517,14 @@ var LoginPage = () => {
|
|
|
5477
5517
|
}
|
|
5478
5518
|
)
|
|
5479
5519
|
] }),
|
|
5480
|
-
/* @__PURE__ */
|
|
5481
|
-
/* @__PURE__ */
|
|
5520
|
+
/* @__PURE__ */ jsx29(Button10, { type: "submit", fullWidth: true, variant: "contained", color: "primary", disabled: isSubmitting, sx: { mt: 2 }, children: isSubmitting ? /* @__PURE__ */ jsxs22(Fragment5, { children: [
|
|
5521
|
+
/* @__PURE__ */ jsx29(CircularProgress6, { size: 20, sx: { mr: 1 } }),
|
|
5482
5522
|
"Iniciando sesi\xF3n..."
|
|
5483
5523
|
] }) : "Iniciar Sesi\xF3n" })
|
|
5484
5524
|
] }),
|
|
5485
5525
|
loginError && /* @__PURE__ */ jsxs22(Alert3, { severity: "error", sx: { mt: 2, maxHeight: "200px" }, children: [
|
|
5486
5526
|
" ",
|
|
5487
|
-
/* @__PURE__ */
|
|
5527
|
+
/* @__PURE__ */ jsx29(AlertTitle, { children: "Error" }),
|
|
5488
5528
|
loginError
|
|
5489
5529
|
] })
|
|
5490
5530
|
]
|
|
@@ -5496,7 +5536,7 @@ var LoginPage = () => {
|
|
|
5496
5536
|
var LoginPage_default = LoginPage;
|
|
5497
5537
|
|
|
5498
5538
|
// src/components/ProcedureForm.tsx
|
|
5499
|
-
import
|
|
5539
|
+
import React23, { useState as useState19, useCallback as useCallback15, useMemo as useMemo12 } from "react";
|
|
5500
5540
|
import { useParams } from "react-router-dom";
|
|
5501
5541
|
import {
|
|
5502
5542
|
TextField as TextField3,
|
|
@@ -5518,13 +5558,13 @@ import {
|
|
|
5518
5558
|
|
|
5519
5559
|
// src/pages/procedure-results/SuccessDisplay.tsx
|
|
5520
5560
|
import { Box as Box18, Typography as Typography16, Paper as Paper3 } from "@mui/material";
|
|
5521
|
-
import { jsx as
|
|
5561
|
+
import { jsx as jsx30, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5522
5562
|
var SuccessDisplay = ({ data }) => {
|
|
5523
5563
|
return /* @__PURE__ */ jsxs23(Paper3, { elevation: 2, sx: { p: 2, mt: 2, bgcolor: "success.light", color: "success.contrastText" }, children: [
|
|
5524
|
-
/* @__PURE__ */
|
|
5525
|
-
/* @__PURE__ */
|
|
5526
|
-
/* @__PURE__ */
|
|
5527
|
-
/* @__PURE__ */
|
|
5564
|
+
/* @__PURE__ */ jsx30(Typography16, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: "\xA1Operaci\xF3n Exitosa!" }),
|
|
5565
|
+
/* @__PURE__ */ jsx30(Typography16, { variant: "body2", sx: { fontSize: "0.85rem" }, children: "Detalles del resultado:" }),
|
|
5566
|
+
/* @__PURE__ */ jsx30(Box18, { sx: { bgcolor: "success.dark", p: 1, borderRadius: 1, mt: 1, overflowX: "auto" }, children: /* @__PURE__ */ jsx30("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(data, null, 2) }) }),
|
|
5567
|
+
/* @__PURE__ */ jsx30(Typography16, { variant: "body2", sx: { fontSize: "0.8rem", mt: 1 }, children: "Puedes revisar los detalles anteriores o cerrar este mensaje." })
|
|
5528
5568
|
] });
|
|
5529
5569
|
};
|
|
5530
5570
|
var SuccessDisplay_default = SuccessDisplay;
|
|
@@ -5538,22 +5578,22 @@ var extendResultsOk = (newComponents) => {
|
|
|
5538
5578
|
};
|
|
5539
5579
|
|
|
5540
5580
|
// src/components/ProcedureForm.tsx
|
|
5541
|
-
import { jsx as
|
|
5581
|
+
import { jsx as jsx31, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
5542
5582
|
var ProcedureForm = () => {
|
|
5543
5583
|
const { procedureName } = useParams();
|
|
5544
5584
|
const { clientContext } = useApp();
|
|
5545
5585
|
const { callApi, loading: apiLoading, error: apiError } = useApiCall();
|
|
5546
|
-
const [validationErrors, setValidationErrors] =
|
|
5547
|
-
const [successMessage, setSuccessMessage] =
|
|
5548
|
-
const [executionLog, setExecutionLog] =
|
|
5549
|
-
const [procedureResultData, setProcedureResultData] =
|
|
5586
|
+
const [validationErrors, setValidationErrors] = useState19({});
|
|
5587
|
+
const [successMessage, setSuccessMessage] = useState19(null);
|
|
5588
|
+
const [executionLog, setExecutionLog] = useState19([]);
|
|
5589
|
+
const [procedureResultData, setProcedureResultData] = useState19(null);
|
|
5550
5590
|
const procedure = useMemo12(() => {
|
|
5551
5591
|
if (procedureName && clientContext?.procedure) {
|
|
5552
5592
|
return clientContext.procedure[procedureName];
|
|
5553
5593
|
}
|
|
5554
5594
|
return void 0;
|
|
5555
5595
|
}, [procedureName, clientContext]);
|
|
5556
|
-
const [formValues, setFormValues] =
|
|
5596
|
+
const [formValues, setFormValues] = useState19(() => {
|
|
5557
5597
|
if (!procedure) return {};
|
|
5558
5598
|
const initialValues = {};
|
|
5559
5599
|
procedure.parameters.forEach((param) => {
|
|
@@ -5578,7 +5618,7 @@ var ProcedureForm = () => {
|
|
|
5578
5618
|
});
|
|
5579
5619
|
return initialValues;
|
|
5580
5620
|
});
|
|
5581
|
-
|
|
5621
|
+
React23.useEffect(() => {
|
|
5582
5622
|
if (procedure) {
|
|
5583
5623
|
setValidationErrors({});
|
|
5584
5624
|
setSuccessMessage(null);
|
|
@@ -5608,11 +5648,11 @@ var ProcedureForm = () => {
|
|
|
5608
5648
|
setExecutionLog([]);
|
|
5609
5649
|
}
|
|
5610
5650
|
}, [procedure]);
|
|
5611
|
-
const addLogMessage =
|
|
5651
|
+
const addLogMessage = useCallback15((message, isError = false) => {
|
|
5612
5652
|
const timestamp = (/* @__PURE__ */ new Date()).toLocaleTimeString("es-AR");
|
|
5613
5653
|
setExecutionLog((prev) => [...prev, `[${timestamp}] ${isError ? "ERROR: " : ""}${message}`]);
|
|
5614
5654
|
}, []);
|
|
5615
|
-
const handleChange =
|
|
5655
|
+
const handleChange = useCallback15((e, child) => {
|
|
5616
5656
|
const { name, value } = e.target;
|
|
5617
5657
|
let newValue = value;
|
|
5618
5658
|
if (e.target.type === "checkbox") {
|
|
@@ -5734,7 +5774,7 @@ var ProcedureForm = () => {
|
|
|
5734
5774
|
addLogMessage("Ejecuci\xF3n finalizada.");
|
|
5735
5775
|
}
|
|
5736
5776
|
};
|
|
5737
|
-
const renderInputField =
|
|
5777
|
+
const renderInputField = useCallback15((param) => {
|
|
5738
5778
|
const hasError = !!validationErrors[param.name];
|
|
5739
5779
|
const errorMessage = validationErrors[param.name];
|
|
5740
5780
|
const commonProps = {
|
|
@@ -5754,7 +5794,7 @@ var ProcedureForm = () => {
|
|
|
5754
5794
|
};
|
|
5755
5795
|
if (param.options && param.options.length > 0) {
|
|
5756
5796
|
return /* @__PURE__ */ jsxs24(FormControl3, { fullWidth: true, margin: "dense", size: "small", error: hasError, required: commonProps.required, children: [
|
|
5757
|
-
/* @__PURE__ */
|
|
5797
|
+
/* @__PURE__ */ jsx31(InputLabel2, { id: `${param.name}-label`, sx: { fontSize: "0.8rem" }, children: param.label || param.name }),
|
|
5758
5798
|
/* @__PURE__ */ jsxs24(
|
|
5759
5799
|
Select2,
|
|
5760
5800
|
{
|
|
@@ -5766,14 +5806,14 @@ var ProcedureForm = () => {
|
|
|
5766
5806
|
label: param.label || param.name,
|
|
5767
5807
|
disabled: apiLoading,
|
|
5768
5808
|
sx: { fontSize: "0.8rem" },
|
|
5769
|
-
renderValue: (selected) => /* @__PURE__ */
|
|
5809
|
+
renderValue: (selected) => /* @__PURE__ */ jsx31(Typography17, { sx: { fontSize: "0.8rem" }, children: selected }),
|
|
5770
5810
|
children: [
|
|
5771
|
-
(!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */
|
|
5772
|
-
param.options.map((option) => /* @__PURE__ */
|
|
5811
|
+
(!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */ jsx31(MenuItem2, { value: "", sx: { fontSize: "0.8rem" }, children: /* @__PURE__ */ jsx31("em", { children: "Seleccione..." }) }),
|
|
5812
|
+
param.options.map((option) => /* @__PURE__ */ jsx31(MenuItem2, { value: option, sx: { fontSize: "0.8rem" }, children: option }, option))
|
|
5773
5813
|
]
|
|
5774
5814
|
}
|
|
5775
5815
|
),
|
|
5776
|
-
(param.description || errorMessage) && /* @__PURE__ */
|
|
5816
|
+
(param.description || errorMessage) && /* @__PURE__ */ jsx31(FormHelperText2, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
|
|
5777
5817
|
] });
|
|
5778
5818
|
}
|
|
5779
5819
|
switch (param.typeName) {
|
|
@@ -5782,18 +5822,18 @@ var ProcedureForm = () => {
|
|
|
5782
5822
|
case "tsrange":
|
|
5783
5823
|
case "time_range":
|
|
5784
5824
|
case "daterange":
|
|
5785
|
-
return /* @__PURE__ */
|
|
5825
|
+
return /* @__PURE__ */ jsx31(TextField3, { type: "text", value: formValues[param.name] || "", ...commonProps });
|
|
5786
5826
|
case "decimal":
|
|
5787
5827
|
case "double":
|
|
5788
|
-
return /* @__PURE__ */
|
|
5828
|
+
return /* @__PURE__ */ jsx31(TextField3, { type: "number", inputProps: { step: "any", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
|
|
5789
5829
|
case "integer":
|
|
5790
5830
|
case "bigint":
|
|
5791
|
-
return /* @__PURE__ */
|
|
5831
|
+
return /* @__PURE__ */ jsx31(TextField3, { type: "number", inputProps: { step: "1", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
|
|
5792
5832
|
case "boolean":
|
|
5793
|
-
return /* @__PURE__ */
|
|
5833
|
+
return /* @__PURE__ */ jsx31(
|
|
5794
5834
|
FormControlLabel3,
|
|
5795
5835
|
{
|
|
5796
|
-
control: /* @__PURE__ */
|
|
5836
|
+
control: /* @__PURE__ */ jsx31(
|
|
5797
5837
|
Checkbox3,
|
|
5798
5838
|
{
|
|
5799
5839
|
checked: !!formValues[param.name],
|
|
@@ -5804,21 +5844,21 @@ var ProcedureForm = () => {
|
|
|
5804
5844
|
size: "small"
|
|
5805
5845
|
}
|
|
5806
5846
|
),
|
|
5807
|
-
label: /* @__PURE__ */
|
|
5847
|
+
label: /* @__PURE__ */ jsx31(Typography17, { sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "inherit" }, children: param.label || param.name }),
|
|
5808
5848
|
sx: { mt: 1, mb: 0 }
|
|
5809
5849
|
}
|
|
5810
5850
|
);
|
|
5811
5851
|
case "date":
|
|
5812
5852
|
case "timestamp":
|
|
5813
5853
|
case "time":
|
|
5814
|
-
return /* @__PURE__ */
|
|
5854
|
+
return /* @__PURE__ */ jsx31(TextField3, { type: param.typeName === "date" ? "date" : param.typeName === "timestamp" ? "datetime-local" : "time", value: formValues[param.name] || "", ...commonProps, InputLabelProps: { shrink: true, sx: { fontSize: "0.8rem" } } });
|
|
5815
5855
|
case "jsonb":
|
|
5816
5856
|
case "jsona":
|
|
5817
|
-
return /* @__PURE__ */
|
|
5857
|
+
return /* @__PURE__ */ jsx31(TextField3, { multiline: true, rows: 5, value: formValues[param.name] || "", ...commonProps, InputProps: { sx: { fontSize: "0.8rem" } } });
|
|
5818
5858
|
case "bytea":
|
|
5819
5859
|
return /* @__PURE__ */ jsxs24(FormControl3, { fullWidth: true, margin: "dense", error: hasError, required: commonProps.required, children: [
|
|
5820
|
-
/* @__PURE__ */
|
|
5821
|
-
/* @__PURE__ */
|
|
5860
|
+
/* @__PURE__ */ jsx31(Typography17, { variant: "body2", color: "textSecondary", component: "label", htmlFor: param.name, sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "text.secondary" }, children: param.label || param.name }),
|
|
5861
|
+
/* @__PURE__ */ jsx31(
|
|
5822
5862
|
"input",
|
|
5823
5863
|
{
|
|
5824
5864
|
type: "file",
|
|
@@ -5832,17 +5872,17 @@ var ProcedureForm = () => {
|
|
|
5832
5872
|
style: { padding: "6px 0", fontSize: "0.8rem" }
|
|
5833
5873
|
}
|
|
5834
5874
|
),
|
|
5835
|
-
(param.description || errorMessage) && /* @__PURE__ */
|
|
5875
|
+
(param.description || errorMessage) && /* @__PURE__ */ jsx31(FormHelperText2, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
|
|
5836
5876
|
] });
|
|
5837
5877
|
default:
|
|
5838
|
-
return /* @__PURE__ */
|
|
5878
|
+
return /* @__PURE__ */ jsx31(TextField3, { type: "text", value: formValues[param.name] || "", ...commonProps });
|
|
5839
5879
|
}
|
|
5840
5880
|
}, [formValues, handleChange, apiLoading, validationErrors]);
|
|
5841
5881
|
const ResultDisplayContent = useMemo12(() => {
|
|
5842
5882
|
if (!procedureResultData || !procedure?.resultOk) return null;
|
|
5843
5883
|
const ComponentToRender = resultsOk[procedure.resultOk];
|
|
5844
5884
|
if (ComponentToRender) {
|
|
5845
|
-
return /* @__PURE__ */
|
|
5885
|
+
return /* @__PURE__ */ jsx31(ComponentToRender, { data: procedureResultData });
|
|
5846
5886
|
} else {
|
|
5847
5887
|
return /* @__PURE__ */ jsxs24(Paper4, { elevation: 2, sx: { p: 2, mt: 0, bgcolor: "warning.light" }, children: [
|
|
5848
5888
|
/* @__PURE__ */ jsxs24(Typography17, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: [
|
|
@@ -5850,11 +5890,11 @@ var ProcedureForm = () => {
|
|
|
5850
5890
|
procedure.resultOk,
|
|
5851
5891
|
"' definido en el procedure no existe o no est\xE1 mapeado."
|
|
5852
5892
|
] }),
|
|
5853
|
-
/* @__PURE__ */
|
|
5893
|
+
/* @__PURE__ */ jsx31(Box19, { sx: {
|
|
5854
5894
|
bgcolor: "warning.dark",
|
|
5855
5895
|
p: 1,
|
|
5856
5896
|
borderRadius: 1
|
|
5857
|
-
}, children: /* @__PURE__ */
|
|
5897
|
+
}, children: /* @__PURE__ */ jsx31("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(procedureResultData, null, 2) }) })
|
|
5858
5898
|
] });
|
|
5859
5899
|
}
|
|
5860
5900
|
}, [procedureResultData, procedure]);
|
|
@@ -5869,8 +5909,8 @@ var ProcedureForm = () => {
|
|
|
5869
5909
|
boxShadow: 3,
|
|
5870
5910
|
textAlign: "center"
|
|
5871
5911
|
}, children: [
|
|
5872
|
-
/* @__PURE__ */
|
|
5873
|
-
/* @__PURE__ */
|
|
5912
|
+
/* @__PURE__ */ jsx31(CircularProgress7, { sx: { mb: 2 } }),
|
|
5913
|
+
/* @__PURE__ */ jsx31(Typography17, { variant: "h6", color: "text.secondary", children: "Cargando procedimiento o no encontrado..." })
|
|
5874
5914
|
] });
|
|
5875
5915
|
}
|
|
5876
5916
|
return (
|
|
@@ -5892,16 +5932,16 @@ var ProcedureForm = () => {
|
|
|
5892
5932
|
overflowX: "hidden"
|
|
5893
5933
|
// Oculta el scroll horizontal si no es necesario para el contenedor principal
|
|
5894
5934
|
}, children: [
|
|
5895
|
-
/* @__PURE__ */
|
|
5935
|
+
/* @__PURE__ */ jsx31(Typography17, { variant: "h5", component: "h2", gutterBottom: true, align: "left", children: cambiarGuionesBajosPorEspacios(procedure.proceedLabel || procedure.action) }),
|
|
5896
5936
|
Object.values(validationErrors).some((err) => err !== null) && /* @__PURE__ */ jsxs24(Alert4, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: [
|
|
5897
5937
|
"Por favor, corrige los errores en el formulario antes de enviar.",
|
|
5898
|
-
/* @__PURE__ */
|
|
5938
|
+
/* @__PURE__ */ jsx31("ul", { children: Object.values(validationErrors).map((err, idx) => err && /* @__PURE__ */ jsx31("li", { children: err }, idx)) })
|
|
5899
5939
|
] }),
|
|
5900
|
-
!Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */
|
|
5901
|
-
!Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */
|
|
5940
|
+
!Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */ jsx31(Alert4, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: apiError.message }),
|
|
5941
|
+
!Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */ jsx31(Alert4, { severity: "success", sx: { mb: 2, fontSize: "0.8rem" }, children: successMessage }),
|
|
5902
5942
|
/* @__PURE__ */ jsxs24("form", { onSubmit: handleSubmit, children: [
|
|
5903
|
-
procedure.parameters.map((param) => /* @__PURE__ */
|
|
5904
|
-
/* @__PURE__ */
|
|
5943
|
+
procedure.parameters.map((param) => /* @__PURE__ */ jsx31("div", { children: renderInputField(param) }, param.name)),
|
|
5944
|
+
/* @__PURE__ */ jsx31(
|
|
5905
5945
|
Button11,
|
|
5906
5946
|
{
|
|
5907
5947
|
type: "submit",
|
|
@@ -5910,7 +5950,7 @@ var ProcedureForm = () => {
|
|
|
5910
5950
|
disabled: apiLoading || Object.values(validationErrors).some((err) => err !== null),
|
|
5911
5951
|
sx: { mt: 2 },
|
|
5912
5952
|
size: "medium",
|
|
5913
|
-
startIcon: apiLoading ? /* @__PURE__ */
|
|
5953
|
+
startIcon: apiLoading ? /* @__PURE__ */ jsx31(CircularProgress7, { size: 20, color: "inherit" }) : null,
|
|
5914
5954
|
children: apiLoading ? "Ejecutando..." : procedure.proceedLabel || "Ejecutar"
|
|
5915
5955
|
}
|
|
5916
5956
|
)
|
|
@@ -5920,9 +5960,9 @@ var ProcedureForm = () => {
|
|
|
5920
5960
|
ResultDisplayContent
|
|
5921
5961
|
] }),
|
|
5922
5962
|
executionLog.length > 0 && /* @__PURE__ */ jsxs24(Box19, { sx: { mt: 3 }, children: [
|
|
5923
|
-
/* @__PURE__ */
|
|
5924
|
-
/* @__PURE__ */
|
|
5925
|
-
/* @__PURE__ */
|
|
5963
|
+
/* @__PURE__ */ jsx31(Divider3, { sx: { mb: 2 } }),
|
|
5964
|
+
/* @__PURE__ */ jsx31(Typography17, { variant: "h6", gutterBottom: true, sx: { fontSize: "0.9rem" }, children: "Registro de Ejecuci\xF3n" }),
|
|
5965
|
+
/* @__PURE__ */ jsx31(
|
|
5926
5966
|
Box19,
|
|
5927
5967
|
{
|
|
5928
5968
|
sx: {
|
|
@@ -5936,7 +5976,7 @@ var ProcedureForm = () => {
|
|
|
5936
5976
|
fontSize: "0.75rem",
|
|
5937
5977
|
whiteSpace: "pre-wrap"
|
|
5938
5978
|
},
|
|
5939
|
-
children: executionLog.map((log, index) => /* @__PURE__ */
|
|
5979
|
+
children: executionLog.map((log, index) => /* @__PURE__ */ jsx31(
|
|
5940
5980
|
Typography17,
|
|
5941
5981
|
{
|
|
5942
5982
|
component: "pre",
|
|
@@ -5964,7 +6004,7 @@ import { PersistGate } from "redux-persist/integration/react";
|
|
|
5964
6004
|
// src/components/PrivateRoute.tsx
|
|
5965
6005
|
import { useEffect as useEffect11 } from "react";
|
|
5966
6006
|
import { Navigate as Navigate2, useLocation as useLocation3 } from "react-router-dom";
|
|
5967
|
-
import { Fragment as
|
|
6007
|
+
import { Fragment as Fragment6, jsx as jsx32 } from "react/jsx-runtime";
|
|
5968
6008
|
var PrivateRoute = ({ children }) => {
|
|
5969
6009
|
const location = useLocation3();
|
|
5970
6010
|
const dispatch = useAppDispatch();
|
|
@@ -5988,14 +6028,14 @@ var PrivateRoute = ({ children }) => {
|
|
|
5988
6028
|
}, [isAuthenticated, isLoadingAuth, location, dispatch, clientContextStatus]);
|
|
5989
6029
|
if (isLoadingAuth) {
|
|
5990
6030
|
console.log(`[PrivateRoute] Returning loading state...`);
|
|
5991
|
-
return /* @__PURE__ */
|
|
6031
|
+
return /* @__PURE__ */ jsx32("p", { children: "Verificando autenticaci\xF3n..." });
|
|
5992
6032
|
}
|
|
5993
6033
|
if (!isAuthenticated) {
|
|
5994
6034
|
console.log(`[PrivateRoute] User not authenticated, navigating to /login`);
|
|
5995
|
-
return /* @__PURE__ */
|
|
6035
|
+
return /* @__PURE__ */ jsx32(Navigate2, { to: "/login", replace: true });
|
|
5996
6036
|
}
|
|
5997
6037
|
console.log(`[PrivateRoute] User authenticated, rendering children.`);
|
|
5998
|
-
return /* @__PURE__ */
|
|
6038
|
+
return /* @__PURE__ */ jsx32(Fragment6, { children });
|
|
5999
6039
|
};
|
|
6000
6040
|
var PrivateRoute_default = PrivateRoute;
|
|
6001
6041
|
|
|
@@ -6033,11 +6073,11 @@ var InitialRedirectHandler = () => {
|
|
|
6033
6073
|
var InitialRedirectHandler_default = InitialRedirectHandler;
|
|
6034
6074
|
|
|
6035
6075
|
// src/pages/GenericDataGridPage.tsx
|
|
6036
|
-
import
|
|
6076
|
+
import React26, { useState as useState20, useCallback as useCallback16, useMemo as useMemo13 } from "react";
|
|
6037
6077
|
import { useParams as useParams2, useLocation as useLocation5 } from "react-router-dom";
|
|
6038
6078
|
import { Box as Box20, Alert as Alert5, Typography as Typography18, Tabs, Tab, IconButton as IconButton7 } from "@mui/material";
|
|
6039
6079
|
import CloseIcon2 from "@mui/icons-material/Close";
|
|
6040
|
-
import { jsx as
|
|
6080
|
+
import { jsx as jsx33, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
6041
6081
|
var GenericDataGridPage = ({
|
|
6042
6082
|
initialTableName,
|
|
6043
6083
|
initialFixedFields = [],
|
|
@@ -6045,14 +6085,14 @@ var GenericDataGridPage = ({
|
|
|
6045
6085
|
}) => {
|
|
6046
6086
|
const { tableName: urlTableName } = useParams2();
|
|
6047
6087
|
const effectiveTableName = initialTableName || urlTableName;
|
|
6048
|
-
const [tabs, setTabs] =
|
|
6049
|
-
const [activeTabIdx, setActiveTabIdx] =
|
|
6088
|
+
const [tabs, setTabs] = useState20([]);
|
|
6089
|
+
const [activeTabIdx, setActiveTabIdx] = useState20(0);
|
|
6050
6090
|
const ffKey = JSON.stringify(initialFixedFields);
|
|
6051
6091
|
const location = useLocation5();
|
|
6052
6092
|
const parametros = useMemo13(() => parametrosRecibidos ?? parametrosDeTabla(void 0, location.search), [parametrosRecibidos, location.search]);
|
|
6053
6093
|
const fixedFieldsIniciales = initialFixedFields.length > 0 ? initialFixedFields : parametros.fixedFields ?? [];
|
|
6054
6094
|
const parametrosKey = JSON.stringify(parametros);
|
|
6055
|
-
|
|
6095
|
+
React26.useEffect(() => {
|
|
6056
6096
|
if (effectiveTableName) {
|
|
6057
6097
|
setTabs([{
|
|
6058
6098
|
id: `main-${effectiveTableName}-${ffKey}-${parametrosKey}`,
|
|
@@ -6066,7 +6106,7 @@ var GenericDataGridPage = ({
|
|
|
6066
6106
|
setActiveTabIdx(0);
|
|
6067
6107
|
}
|
|
6068
6108
|
}, [effectiveTableName, ffKey, parametrosKey, location.key]);
|
|
6069
|
-
const handleOpenDetail =
|
|
6109
|
+
const handleOpenDetail = useCallback16((tableName, fixedFields, label, ancestors) => {
|
|
6070
6110
|
const tabId = `${tableName}-${JSON.stringify(fixedFields)}`;
|
|
6071
6111
|
setTabs((prevTabs) => {
|
|
6072
6112
|
const existingTabIdx = prevTabs.findIndex((t) => t.id === tabId);
|
|
@@ -6088,26 +6128,26 @@ var GenericDataGridPage = ({
|
|
|
6088
6128
|
else if (activeTabIdx === index) setActiveTabIdx(index - 1);
|
|
6089
6129
|
};
|
|
6090
6130
|
if (!effectiveTableName) {
|
|
6091
|
-
return /* @__PURE__ */
|
|
6131
|
+
return /* @__PURE__ */ jsx33(Box20, { p: 3, children: /* @__PURE__ */ jsx33(Alert5, { severity: "error", children: "No se especific\xF3 una tabla." }) });
|
|
6092
6132
|
}
|
|
6093
6133
|
return /* @__PURE__ */ jsxs25(Box20, { sx: { width: "100%", height: "calc(100vh - 64px)", display: "flex", flexDirection: "column" }, children: [
|
|
6094
|
-
/* @__PURE__ */
|
|
6134
|
+
/* @__PURE__ */ jsx33(Box20, { sx: { borderBottom: 1, borderColor: "divider", bgcolor: "background.paper" }, children: /* @__PURE__ */ jsx33(Tabs, { value: activeTabIdx, onChange: (_, v) => setActiveTabIdx(v), variant: "scrollable", children: tabs.map((tab, index) => /* @__PURE__ */ jsx33(
|
|
6095
6135
|
Tab,
|
|
6096
6136
|
{
|
|
6097
6137
|
label: /* @__PURE__ */ jsxs25(Box20, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
6098
|
-
/* @__PURE__ */
|
|
6099
|
-
index !== 0 && /* @__PURE__ */
|
|
6138
|
+
/* @__PURE__ */ jsx33(Typography18, { variant: "caption", sx: { fontWeight: "bold" }, children: tab.label }),
|
|
6139
|
+
index !== 0 && /* @__PURE__ */ jsx33(IconButton7, { size: "small", onClick: (e) => handleCloseTab(index, e), children: /* @__PURE__ */ jsx33(CloseIcon2, { fontSize: "inherit" }) })
|
|
6100
6140
|
] })
|
|
6101
6141
|
},
|
|
6102
6142
|
tab.id
|
|
6103
6143
|
)) }) }),
|
|
6104
|
-
tabs.map((tab, index) => /* @__PURE__ */
|
|
6144
|
+
tabs.map((tab, index) => /* @__PURE__ */ jsx33(
|
|
6105
6145
|
Box20,
|
|
6106
6146
|
{
|
|
6107
6147
|
role: "tabpanel",
|
|
6108
6148
|
hidden: activeTabIdx !== index,
|
|
6109
6149
|
sx: { flexGrow: 1, display: activeTabIdx === index ? "flex" : "none", flexDirection: "column", overflow: "hidden" },
|
|
6110
|
-
children: /* @__PURE__ */
|
|
6150
|
+
children: /* @__PURE__ */ jsx33(
|
|
6111
6151
|
GenericDataGrid_default,
|
|
6112
6152
|
{
|
|
6113
6153
|
tableName: tab.tableName,
|
|
@@ -6131,19 +6171,19 @@ var GenericDataGridPage_default = GenericDataGridPage;
|
|
|
6131
6171
|
import { useMemo as useMemo14 } from "react";
|
|
6132
6172
|
import { useSearchParams } from "react-router-dom";
|
|
6133
6173
|
import { Box as Box21 } from "@mui/material";
|
|
6134
|
-
import { jsx as
|
|
6174
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
6135
6175
|
var PantallaDeRuta = ({ screenName }) => {
|
|
6136
6176
|
const [busqueda] = useSearchParams();
|
|
6137
6177
|
const params = useMemo14(() => Object.fromEntries(busqueda.entries()), [busqueda]);
|
|
6138
6178
|
const Pantalla = wScreens[screenName];
|
|
6139
|
-
return /* @__PURE__ */
|
|
6179
|
+
return /* @__PURE__ */ jsx34(Box21, { sx: { pt: 3, pl: 4 }, children: Pantalla ? /* @__PURE__ */ jsx34(Pantalla, { screenName, params }) : /* @__PURE__ */ jsx34(FallbackWScreen, { screenName }) });
|
|
6140
6180
|
};
|
|
6141
6181
|
|
|
6142
6182
|
// src/pages/MenuTablePage.tsx
|
|
6143
6183
|
import { useMemo as useMemo15 } from "react";
|
|
6144
6184
|
import { useLocation as useLocation6, useParams as useParams3 } from "react-router-dom";
|
|
6145
6185
|
import { Box as Box22, Alert as Alert6, Typography as Typography19 } from "@mui/material";
|
|
6146
|
-
import { jsx as
|
|
6186
|
+
import { jsx as jsx35, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
6147
6187
|
var MenuTablePage = () => {
|
|
6148
6188
|
const { menuName } = useParams3();
|
|
6149
6189
|
const { clientContext } = useApp();
|
|
@@ -6181,12 +6221,12 @@ var MenuTablePage = () => {
|
|
|
6181
6221
|
};
|
|
6182
6222
|
}, [menuName, clientContext, search]);
|
|
6183
6223
|
if (!currentTableName) {
|
|
6184
|
-
return /* @__PURE__ */
|
|
6185
|
-
/* @__PURE__ */
|
|
6186
|
-
/* @__PURE__ */
|
|
6224
|
+
return /* @__PURE__ */ jsx35(Box22, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ jsxs26(Alert6, { severity: "error", children: [
|
|
6225
|
+
/* @__PURE__ */ jsx35(Typography19, { variant: "h6", children: "Error: No se pudo cargar la informaci\xF3n de la tabla." }),
|
|
6226
|
+
/* @__PURE__ */ jsx35(Typography19, { variant: "body1", children: "Verifique la configuraci\xF3n del men\xFA o el nombre de la tabla en la URL." })
|
|
6187
6227
|
] }) });
|
|
6188
6228
|
}
|
|
6189
|
-
return /* @__PURE__ */
|
|
6229
|
+
return /* @__PURE__ */ jsx35(
|
|
6190
6230
|
GenericDataGridPage_default,
|
|
6191
6231
|
{
|
|
6192
6232
|
initialTableName: currentTableName,
|
|
@@ -6198,7 +6238,7 @@ var MenuTablePage = () => {
|
|
|
6198
6238
|
var MenuTablePage_default = MenuTablePage;
|
|
6199
6239
|
|
|
6200
6240
|
// src/puente/PantallaBP.tsx
|
|
6201
|
-
import { useEffect as useEffect15, useRef as useRef10, useState as
|
|
6241
|
+
import { useEffect as useEffect15, useRef as useRef10, useState as useState21 } from "react";
|
|
6202
6242
|
import { Navigate as Navigate3, useLocation as useLocation7, useParams as useParams4 } from "react-router-dom";
|
|
6203
6243
|
import { Alert as Alert7, Box as Box24, CircularProgress as CircularProgress8 } from "@mui/material";
|
|
6204
6244
|
|
|
@@ -6291,7 +6331,7 @@ async function cargarSinMemoria(urlBackend) {
|
|
|
6291
6331
|
// src/puente/ConsolaBP.tsx
|
|
6292
6332
|
import { useEffect as useEffect14 } from "react";
|
|
6293
6333
|
import { Box as Box23 } from "@mui/material";
|
|
6294
|
-
import { jsx as
|
|
6334
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
6295
6335
|
var MARGEN_DE_REPETIDO_MS = 1e3;
|
|
6296
6336
|
function descartarRepetidos(consola, agregados, ahora) {
|
|
6297
6337
|
for (const nodo of agregados) {
|
|
@@ -6313,7 +6353,7 @@ var ConsolaBP = () => {
|
|
|
6313
6353
|
observador.observe(consola, { childList: true });
|
|
6314
6354
|
return () => observador.disconnect();
|
|
6315
6355
|
}, []);
|
|
6316
|
-
return /* @__PURE__ */
|
|
6356
|
+
return /* @__PURE__ */ jsx36(
|
|
6317
6357
|
Box23,
|
|
6318
6358
|
{
|
|
6319
6359
|
id: "mini-console",
|
|
@@ -6410,7 +6450,7 @@ var habilitarPuenteBP = () => {
|
|
|
6410
6450
|
var puenteBPHabilitado = () => habilitado;
|
|
6411
6451
|
|
|
6412
6452
|
// src/puente/PantallaBP.tsx
|
|
6413
|
-
import { jsx as
|
|
6453
|
+
import { jsx as jsx37, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6414
6454
|
function buscarItemDeMenu(items, tipo) {
|
|
6415
6455
|
for (const item of items) {
|
|
6416
6456
|
if (item.menuType === tipo) return item;
|
|
@@ -6423,9 +6463,9 @@ function buscarItemDeMenu(items, tipo) {
|
|
|
6423
6463
|
}
|
|
6424
6464
|
var PantallaBP = ({ nombre, direccion }) => {
|
|
6425
6465
|
const { clientContext } = useApp();
|
|
6426
|
-
const [cargando, setCargando] =
|
|
6427
|
-
const [error, setError] =
|
|
6428
|
-
const [noExiste, setNoExiste] =
|
|
6466
|
+
const [cargando, setCargando] = useState21(true);
|
|
6467
|
+
const [error, setError] = useState21(null);
|
|
6468
|
+
const [noExiste, setNoExiste] = useState21(false);
|
|
6429
6469
|
const contenedor = useRef10(null);
|
|
6430
6470
|
const menu = clientContext.menu;
|
|
6431
6471
|
useEffect15(() => {
|
|
@@ -6459,14 +6499,14 @@ var PantallaBP = ({ nombre, direccion }) => {
|
|
|
6459
6499
|
elemento.replaceChildren();
|
|
6460
6500
|
};
|
|
6461
6501
|
}, [nombre, direccion, menu]);
|
|
6462
|
-
if (noExiste) return /* @__PURE__ */
|
|
6502
|
+
if (noExiste) return /* @__PURE__ */ jsx37(FallbackWScreen, { screenName: nombre });
|
|
6463
6503
|
return (
|
|
6464
6504
|
// 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
|
|
6465
6505
|
/* @__PURE__ */ jsxs27(Box24, { sx: { position: "relative" }, children: [
|
|
6466
|
-
cargando && /* @__PURE__ */
|
|
6467
|
-
error && /* @__PURE__ */
|
|
6468
|
-
/* @__PURE__ */
|
|
6469
|
-
/* @__PURE__ */
|
|
6506
|
+
cargando && /* @__PURE__ */ jsx37(CircularProgress8, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
|
|
6507
|
+
error && /* @__PURE__ */ jsx37(Alert7, { severity: "error", sx: { m: 2 }, children: error }),
|
|
6508
|
+
/* @__PURE__ */ jsx37("div", { id: "main_layout", ref: contenedor }),
|
|
6509
|
+
/* @__PURE__ */ jsx37(ConsolaBP, {})
|
|
6470
6510
|
] })
|
|
6471
6511
|
);
|
|
6472
6512
|
};
|
|
@@ -6474,32 +6514,32 @@ var PantallaDeRespaldo = () => {
|
|
|
6474
6514
|
const { screenName = "" } = useParams4();
|
|
6475
6515
|
const { search } = useLocation7();
|
|
6476
6516
|
if (!puenteBPHabilitado()) {
|
|
6477
|
-
return /* @__PURE__ */
|
|
6517
|
+
return /* @__PURE__ */ jsx37(Box24, { sx: { p: 3 }, children: /* @__PURE__ */ jsx37(FallbackWScreen, { screenName }) });
|
|
6478
6518
|
}
|
|
6479
|
-
return /* @__PURE__ */
|
|
6519
|
+
return /* @__PURE__ */ jsx37(Navigate3, { to: rutaDePantallaBP(screenName, search), replace: true });
|
|
6480
6520
|
};
|
|
6481
6521
|
var PaginaBP = () => {
|
|
6482
6522
|
const { hash, search } = useLocation7();
|
|
6483
6523
|
const direccion = hash || search;
|
|
6484
6524
|
const nombre = new URLSearchParams(direccion.replace(/^[#?]/, "")).get("w");
|
|
6485
|
-
if (!puenteBPHabilitado()) return /* @__PURE__ */
|
|
6486
|
-
if (!nombre) return /* @__PURE__ */
|
|
6525
|
+
if (!puenteBPHabilitado()) return /* @__PURE__ */ jsx37(Navigate3, { to: "/", replace: true });
|
|
6526
|
+
if (!nombre) return /* @__PURE__ */ jsx37(Box24, { sx: { p: 3 }, children: /* @__PURE__ */ jsxs27(Alert7, { severity: "warning", children: [
|
|
6487
6527
|
"Falta la pantalla de backend-plus (",
|
|
6488
|
-
/* @__PURE__ */
|
|
6528
|
+
/* @__PURE__ */ jsx37("code", { children: "#w=..." }),
|
|
6489
6529
|
")."
|
|
6490
6530
|
] }) });
|
|
6491
|
-
return /* @__PURE__ */
|
|
6531
|
+
return /* @__PURE__ */ jsx37(PantallaBP, { nombre, direccion }, nombre);
|
|
6492
6532
|
};
|
|
6493
6533
|
|
|
6494
6534
|
// src/puente/GrillaBP.tsx
|
|
6495
|
-
import { useEffect as useEffect16, useRef as useRef11, useState as
|
|
6535
|
+
import { useEffect as useEffect16, useRef as useRef11, useState as useState22 } from "react";
|
|
6496
6536
|
import { useParams as useParams5 } from "react-router-dom";
|
|
6497
6537
|
import { Alert as Alert8, Box as Box25, CircularProgress as CircularProgress9 } from "@mui/material";
|
|
6498
|
-
import { jsx as
|
|
6538
|
+
import { jsx as jsx38, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6499
6539
|
var GrillaBP = ({ tabla, fixedFields }) => {
|
|
6500
6540
|
const contenedor = useRef11(null);
|
|
6501
|
-
const [cargando, setCargando] =
|
|
6502
|
-
const [error, setError] =
|
|
6541
|
+
const [cargando, setCargando] = useState22(true);
|
|
6542
|
+
const [error, setError] = useState22(null);
|
|
6503
6543
|
const clave = JSON.stringify(fixedFields ?? []);
|
|
6504
6544
|
useEffect16(() => {
|
|
6505
6545
|
const elemento = contenedor.current;
|
|
@@ -6525,16 +6565,16 @@ var GrillaBP = ({ tabla, fixedFields }) => {
|
|
|
6525
6565
|
return (
|
|
6526
6566
|
// 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
|
|
6527
6567
|
/* @__PURE__ */ jsxs28(Box25, { sx: { position: "relative" }, children: [
|
|
6528
|
-
cargando && /* @__PURE__ */
|
|
6529
|
-
error && /* @__PURE__ */
|
|
6530
|
-
/* @__PURE__ */
|
|
6531
|
-
/* @__PURE__ */
|
|
6568
|
+
cargando && /* @__PURE__ */ jsx38(CircularProgress9, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
|
|
6569
|
+
error && /* @__PURE__ */ jsx38(Alert8, { severity: "error", sx: { m: 2 }, children: error }),
|
|
6570
|
+
/* @__PURE__ */ jsx38("div", { ref: contenedor }),
|
|
6571
|
+
/* @__PURE__ */ jsx38(ConsolaBP, {})
|
|
6532
6572
|
] })
|
|
6533
6573
|
);
|
|
6534
6574
|
};
|
|
6535
6575
|
var PaginaGrillaBP = () => {
|
|
6536
6576
|
const { tableName = "" } = useParams5();
|
|
6537
|
-
return /* @__PURE__ */
|
|
6577
|
+
return /* @__PURE__ */ jsx38(GrillaBP, { tabla: tableName }, tableName);
|
|
6538
6578
|
};
|
|
6539
6579
|
|
|
6540
6580
|
// src/puente/CapturaBP.tsx
|
|
@@ -6591,7 +6631,7 @@ var CapturaBP = () => {
|
|
|
6591
6631
|
|
|
6592
6632
|
// src/App.tsx
|
|
6593
6633
|
import typeStore6 from "type-store";
|
|
6594
|
-
import { Fragment as
|
|
6634
|
+
import { Fragment as Fragment7, jsx as jsx39, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6595
6635
|
var LocationTracker = () => {
|
|
6596
6636
|
const location = useLocation8();
|
|
6597
6637
|
const dispatch = useAppDispatch();
|
|
@@ -6601,45 +6641,45 @@ var LocationTracker = () => {
|
|
|
6601
6641
|
return null;
|
|
6602
6642
|
};
|
|
6603
6643
|
function FrontendPlusReactRoutes({ myRoutes, myUnloggedRoutes, layout: Layout = MainLayout_default, unloggedLayout: UnloggedLayout }) {
|
|
6604
|
-
return /* @__PURE__ */ jsxs29(
|
|
6605
|
-
/* @__PURE__ */
|
|
6606
|
-
puenteBPHabilitado() && /* @__PURE__ */
|
|
6644
|
+
return /* @__PURE__ */ jsxs29(Fragment7, { children: [
|
|
6645
|
+
/* @__PURE__ */ jsx39(InitialRedirectHandler_default, {}),
|
|
6646
|
+
puenteBPHabilitado() && /* @__PURE__ */ jsx39(CapturaBP, {}),
|
|
6607
6647
|
/* @__PURE__ */ jsxs29(Routes, { children: [
|
|
6608
|
-
/* @__PURE__ */ jsxs29(Route, { element: UnloggedLayout ? /* @__PURE__ */
|
|
6609
|
-
/* @__PURE__ */
|
|
6610
|
-
/* @__PURE__ */
|
|
6648
|
+
/* @__PURE__ */ jsxs29(Route, { element: UnloggedLayout ? /* @__PURE__ */ jsx39(UnloggedLayout, {}) : /* @__PURE__ */ jsx39(Outlet2, {}), children: [
|
|
6649
|
+
/* @__PURE__ */ jsx39(Route, { path: "/login", element: /* @__PURE__ */ jsx39(LoginPage_default, {}) }),
|
|
6650
|
+
/* @__PURE__ */ jsx39(Route, { path: "/logout", element: /* @__PURE__ */ jsx39(LogoutPage_default, {}) }),
|
|
6611
6651
|
myUnloggedRoutes
|
|
6612
6652
|
] }),
|
|
6613
|
-
/* @__PURE__ */ jsxs29(Route, { element: /* @__PURE__ */
|
|
6614
|
-
/* @__PURE__ */
|
|
6615
|
-
/* @__PURE__ */
|
|
6616
|
-
/* @__PURE__ */
|
|
6617
|
-
/* @__PURE__ */
|
|
6618
|
-
Object.keys(wScreens).map((screenName) => /* @__PURE__ */
|
|
6653
|
+
/* @__PURE__ */ jsxs29(Route, { element: /* @__PURE__ */ jsx39(PrivateRoute_default, { children: /* @__PURE__ */ jsx39(Layout, {}) }), children: [
|
|
6654
|
+
/* @__PURE__ */ jsx39(Route, { path: "/", element: /* @__PURE__ */ jsx39(PantallaInicial_default, {}) }),
|
|
6655
|
+
/* @__PURE__ */ jsx39(Route, { path: "/table/:tableName", element: /* @__PURE__ */ jsx39(GenericDataGridPage_default, {}) }),
|
|
6656
|
+
/* @__PURE__ */ jsx39(Route, { path: "/menu/:menuName", element: /* @__PURE__ */ jsx39(MenuTablePage_default, {}) }),
|
|
6657
|
+
/* @__PURE__ */ jsx39(Route, { path: "/procedures/:procedureName", element: /* @__PURE__ */ jsx39(ProcedureForm_default, {}) }),
|
|
6658
|
+
Object.keys(wScreens).map((screenName) => /* @__PURE__ */ jsx39(
|
|
6619
6659
|
Route,
|
|
6620
6660
|
{
|
|
6621
6661
|
path: `/wScreens/${screenName}`,
|
|
6622
|
-
element: /* @__PURE__ */
|
|
6662
|
+
element: /* @__PURE__ */ jsx39(PantallaDeRuta, { screenName })
|
|
6623
6663
|
},
|
|
6624
6664
|
screenName
|
|
6625
6665
|
)),
|
|
6626
|
-
/* @__PURE__ */
|
|
6627
|
-
puenteBPHabilitado() && /* @__PURE__ */
|
|
6628
|
-
puenteBPHabilitado() && /* @__PURE__ */
|
|
6666
|
+
/* @__PURE__ */ jsx39(Route, { path: "/wScreens-fallback/:screenName", element: /* @__PURE__ */ jsx39(PantallaDeRespaldo, {}) }),
|
|
6667
|
+
puenteBPHabilitado() && /* @__PURE__ */ jsx39(Route, { path: "/bp/menu", element: /* @__PURE__ */ jsx39(PaginaBP, {}) }),
|
|
6668
|
+
puenteBPHabilitado() && /* @__PURE__ */ jsx39(Route, { path: "/bp/table/:tableName", element: /* @__PURE__ */ jsx39(PaginaGrillaBP, {}) }),
|
|
6629
6669
|
myRoutes,
|
|
6630
|
-
/* @__PURE__ */
|
|
6670
|
+
/* @__PURE__ */ jsx39(Route, { path: "*", element: /* @__PURE__ */ jsx39("div", { style: { marginTop: "20px", marginLeft: "10px" }, children: "404 - Recurso No Encontrado" }) })
|
|
6631
6671
|
] }),
|
|
6632
|
-
/* @__PURE__ */
|
|
6672
|
+
/* @__PURE__ */ jsx39(Route, { path: "*", element: /* @__PURE__ */ jsx39(Navigate4, { to: "/", replace: true }) })
|
|
6633
6673
|
] })
|
|
6634
6674
|
] });
|
|
6635
6675
|
}
|
|
6636
6676
|
var FrontendPlusProviders = ({ children, publicPaths }) => {
|
|
6637
|
-
return /* @__PURE__ */
|
|
6638
|
-
/* @__PURE__ */
|
|
6677
|
+
return /* @__PURE__ */ jsx39(Provider, { store, children: /* @__PURE__ */ jsx39(PersistGate, { loading: null, persistor, children: /* @__PURE__ */ jsxs29(BrowserRouter, { basename: rutaBase, children: [
|
|
6678
|
+
/* @__PURE__ */ jsx39(LocationTracker, {}),
|
|
6639
6679
|
" ",
|
|
6640
|
-
/* @__PURE__ */
|
|
6680
|
+
/* @__PURE__ */ jsx39(AppProvider, { publicPaths, children: /* @__PURE__ */ jsxs29(SnackbarProvider, { children: [
|
|
6641
6681
|
children,
|
|
6642
|
-
/* @__PURE__ */
|
|
6682
|
+
/* @__PURE__ */ jsx39(SessionExpiredMessage_default, {})
|
|
6643
6683
|
] }) })
|
|
6644
6684
|
] }) }) });
|
|
6645
6685
|
};
|
|
@@ -6679,11 +6719,11 @@ var App = ({
|
|
|
6679
6719
|
link.href = `${envConfig.backendUrl}/img/logo-128.png`;
|
|
6680
6720
|
document.getElementsByTagName("head")[0].appendChild(link);
|
|
6681
6721
|
}, []);
|
|
6682
|
-
const safePaths =
|
|
6722
|
+
const safePaths = React33.useMemo(() => {
|
|
6683
6723
|
const extracted = extractPathsFromRoutes(myUnloggedRoutes);
|
|
6684
6724
|
return ["/login", "/logout", ...extracted];
|
|
6685
6725
|
}, [myUnloggedRoutes]);
|
|
6686
|
-
return /* @__PURE__ */
|
|
6726
|
+
return /* @__PURE__ */ jsx39(FrontendPlusProviders, { publicPaths: safePaths, children: /* @__PURE__ */ jsx39(
|
|
6687
6727
|
FrontendPlusReactRoutes,
|
|
6688
6728
|
{
|
|
6689
6729
|
myRoutes,
|