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/dist/index.cjs CHANGED
@@ -59,7 +59,7 @@ __export(src_exports, {
59
59
  module.exports = __toCommonJS(src_exports);
60
60
 
61
61
  // src/components/grid/GenericDataGrid.tsx
62
- var import_react25 = require("react");
62
+ var import_react26 = require("react");
63
63
  var import_react_data_grid = require("react-data-grid");
64
64
  var import_styles = require("react-data-grid/lib/styles.css");
65
65
 
@@ -1521,7 +1521,7 @@ var opcionesDeReferencia = (campo, definicionReferenciada, filasReferenciadas, f
1521
1521
  const activo = campoDeActivo(definicionReferenciada);
1522
1522
  const nombres = camposDeNombre(definicionReferenciada);
1523
1523
  const columnasDeEtiqueta = nombres.length > 0 ? [...definicionReferenciada.primaryKey, ...nombres] : definicionReferenciada.primaryKey;
1524
- const opciones = filasReferenciadas.filter((fila) => (activo === null || !!fila[activo]) && anteriores.every((par) => comoTexto(fila[par.target]) === comoTexto(filaActual[par.source]))).map((fila) => {
1524
+ const opciones = filasReferenciadas.filter((fila) => (activo === null || !!fila[activo]) && (filaActual === null || anteriores.every((par) => comoTexto(fila[par.target]) === comoTexto(filaActual[par.source])))).map((fila) => {
1525
1525
  const etiquetas = columnasDeEtiqueta.map((columna) => comoTexto(fila[columna]));
1526
1526
  return { valor: fila[columnaDelValor], etiquetas, texto: `${etiquetas.join(", ")}; ${definicionReferenciada.primaryKey.join(", ")}` };
1527
1527
  });
@@ -1946,7 +1946,7 @@ var useGridMenu = ({
1946
1946
  };
1947
1947
 
1948
1948
  // src/hooks/grid/useGridColumns.ts
1949
- var import_react21 = __toESM(require("react"), 1);
1949
+ var import_react22 = __toESM(require("react"), 1);
1950
1950
 
1951
1951
  // src/utils/functions.tsx
1952
1952
  var JSON4all2 = __toESM(require("json4all"), 1);
@@ -2104,20 +2104,289 @@ var ActionsColumnHeaderCell = ({
2104
2104
  var detailColumnCellHeaderRenderer = (props, detailTable) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_material4.Tooltip, { title: detailTable.label, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_material4.Typography, { variant: "caption", sx: { fontSize: "0.75rem", fontWeight: "bold" }, children: detailTable.abr.toUpperCase() }) });
2105
2105
 
2106
2106
  // src/components/grid/FilterInputRender.tsx
2107
- var import_material6 = require("@mui/material");
2108
- var import_react14 = __toESM(require("react"), 1);
2107
+ var import_material9 = require("@mui/material");
2108
+ var import_react18 = __toESM(require("react"), 1);
2109
2109
 
2110
2110
  // src/components/forms/TypedField.tsx
2111
+ var import_react16 = require("react");
2112
+ var import_material8 = require("@mui/material");
2113
+ var import_type_store3 = __toESM(require("type-store"), 1);
2114
+ var import_react17 = require("react");
2115
+
2116
+ // src/hooks/grid/useExpander.tsx
2117
+ var import_react15 = __toESM(require("react"), 1);
2118
+ var import_IconButton = __toESM(require("@mui/material/IconButton"), 1);
2119
+ var import_ArrowDropDown = __toESM(require("@mui/icons-material/ArrowDropDown"), 1);
2120
+ var import_CalendarMonth = __toESM(require("@mui/icons-material/CalendarMonth"), 1);
2121
+ var import_Search2 = __toESM(require("@mui/icons-material/Search"), 1);
2122
+
2123
+ // src/components/grid/MenuDeOpciones.tsx
2111
2124
  var import_react12 = require("react");
2112
2125
  var import_material5 = require("@mui/material");
2113
- var import_type_store3 = __toESM(require("type-store"), 1);
2114
- var import_react13 = require("react");
2115
2126
  var import_jsx_runtime7 = require("react/jsx-runtime");
2127
+ function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar }) {
2128
+ const [busqueda, setBusqueda] = (0, import_react12.useState)(busquedaInicial);
2129
+ const [indice, setIndice] = (0, import_react12.useState)(0);
2130
+ const visibles = (0, import_react12.useMemo)(() => filtrarOpciones(opciones, busqueda), [opciones, busqueda]);
2131
+ const elegida = (0, import_react12.useRef)(null);
2132
+ (0, import_react12.useEffect)(() => {
2133
+ elegida.current?.scrollIntoView({ block: "nearest" });
2134
+ }, [indice, visibles]);
2135
+ const alApretar = (evento) => {
2136
+ if (evento.key === "ArrowDown") {
2137
+ setIndice((i) => Math.min(i + 1, visibles.length - 1));
2138
+ } else if (evento.key === "ArrowUp") {
2139
+ setIndice((i) => Math.max(i - 1, 0));
2140
+ } else if (evento.key === "Enter") {
2141
+ if (visibles[indice]) onElegir(visibles[indice].valor);
2142
+ } else if (evento.key === "F9" || evento.key === "Escape") {
2143
+ onCerrar();
2144
+ } else {
2145
+ return;
2146
+ }
2147
+ evento.preventDefault();
2148
+ evento.stopPropagation();
2149
+ };
2150
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
2151
+ import_material5.Popover,
2152
+ {
2153
+ open: true,
2154
+ anchorEl: anclaje,
2155
+ onClose: onCerrar,
2156
+ disableRestoreFocus: true,
2157
+ anchorOrigin: { vertical: "bottom", horizontal: "left" },
2158
+ slotProps: { paper: { sx: { minWidth: 300, maxWidth: 520 } } },
2159
+ children: [
2160
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2161
+ import_material5.InputBase,
2162
+ {
2163
+ autoFocus: true,
2164
+ fullWidth: true,
2165
+ value: busqueda,
2166
+ onChange: (e) => {
2167
+ setBusqueda(e.target.value);
2168
+ setIndice(0);
2169
+ },
2170
+ onKeyDown: alApretar,
2171
+ placeholder: "buscar",
2172
+ sx: { px: 1, py: 0.5, fontSize: "0.8rem", borderBottom: "1px solid #ccc" },
2173
+ inputProps: { "aria-label": "buscar" }
2174
+ }
2175
+ ),
2176
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_material5.List, { dense: true, disablePadding: true, sx: { maxHeight: 320, overflowY: "auto" }, role: "listbox", children: [
2177
+ visibles.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_material5.Typography, { variant: "body2", sx: { p: 1, color: "text.secondary" }, children: "sin coincidencias" }),
2178
+ visibles.map((opcion, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2179
+ import_material5.ListItemButton,
2180
+ {
2181
+ ref: i === indice ? elegida : null,
2182
+ selected: i === indice,
2183
+ role: "option",
2184
+ onClick: () => onElegir(opcion.valor),
2185
+ sx: { gap: 2, py: 0.25, fontSize: "0.8rem" },
2186
+ children: opcion.etiquetas.map((etiqueta, j) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { fontWeight: j === 0 ? 600 : 400, minWidth: j === 0 ? 40 : void 0 }, children: etiqueta }, j))
2187
+ },
2188
+ i
2189
+ ))
2190
+ ] })
2191
+ ]
2192
+ }
2193
+ );
2194
+ }
2195
+
2196
+ // src/components/grid/SelectorDeFecha.tsx
2197
+ var import_react13 = require("react");
2198
+ var import_material6 = require("@mui/material");
2199
+ var import_jsx_runtime8 = require("react/jsx-runtime");
2200
+ var MESES = ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"];
2201
+ var DIAS = ["lu", "ma", "mi", "ju", "vi", "s\xE1", "do"];
2202
+ var mismaFecha = (a, b) => b !== null && a.anio === b.anio && a.mes === b.mes && a.dia === b.dia;
2203
+ var MOVIMIENTOS = {
2204
+ ArrowLeft: [-1, 0],
2205
+ ArrowRight: [1, 0],
2206
+ ArrowUp: [-7, 0],
2207
+ ArrowDown: [7, 0],
2208
+ PageUp: [0, -1],
2209
+ PageDown: [0, 1]
2210
+ };
2211
+ function SelectorDeFecha({ anclaje, fechaActual, admiteNulo, onElegir, onCerrar }) {
2212
+ const hoy = /* @__PURE__ */ new Date();
2213
+ const fechaDeHoy = { anio: hoy.getFullYear(), mes: hoy.getMonth(), dia: hoy.getDate() };
2214
+ const [cursor, setCursor] = (0, import_react13.useState)(fechaActual ?? fechaDeHoy);
2215
+ const mover = (dias, meses) => {
2216
+ const nueva = new Date(cursor.anio, cursor.mes + meses, cursor.dia + dias);
2217
+ setCursor({ anio: nueva.getFullYear(), mes: nueva.getMonth(), dia: nueva.getDate() });
2218
+ };
2219
+ const alApretar = (evento) => {
2220
+ if (evento.key in MOVIMIENTOS) {
2221
+ mover(...MOVIMIENTOS[evento.key]);
2222
+ } else if (evento.key === "Enter") {
2223
+ onElegir(fechaATexto(cursor));
2224
+ } else if (evento.key === "F9" || evento.key === "Escape") {
2225
+ onCerrar();
2226
+ } else {
2227
+ return;
2228
+ }
2229
+ evento.preventDefault();
2230
+ evento.stopPropagation();
2231
+ };
2232
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.Popover, { open: true, anchorEl: anclaje, onClose: onCerrar, disableRestoreFocus: true, anchorOrigin: { vertical: "bottom", horizontal: "left" }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { tabIndex: 0, ref: (el) => el?.focus(), onKeyDown: alApretar, style: { padding: 8, outline: "none", width: 252 }, "aria-label": "calendario", children: [
2233
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
2234
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.IconButton, { size: "small", "aria-label": "mes anterior", onClick: () => mover(0, -1), children: "\u2039" }),
2235
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_material6.Typography, { variant: "body2", sx: { fontWeight: 600 }, children: [
2236
+ MESES[cursor.mes],
2237
+ " ",
2238
+ cursor.anio
2239
+ ] }),
2240
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.IconButton, { size: "small", "aria-label": "mes siguiente", onClick: () => mover(0, 1), children: "\u203A" })
2241
+ ] }),
2242
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("table", { style: { borderCollapse: "collapse", width: "100%", textAlign: "center", fontSize: "0.8rem" }, children: [
2243
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("tr", { children: DIAS.map((d) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("th", { style: { fontWeight: 400, color: "#777" }, children: d }, d)) }) }),
2244
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("tbody", { children: semanasDelMes(cursor.anio, cursor.mes).map((semana, i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("tr", { children: semana.map((dia) => {
2245
+ const elegido = mismaFecha(dia, fechaActual);
2246
+ const enCursor = mismaFecha(dia, cursor);
2247
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("td", { style: { padding: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2248
+ "button",
2249
+ {
2250
+ type: "button",
2251
+ tabIndex: -1,
2252
+ onClick: () => onElegir(fechaATexto(dia)),
2253
+ style: {
2254
+ width: 32,
2255
+ height: 26,
2256
+ border: enCursor ? "1px solid #1976d2" : "1px solid transparent",
2257
+ borderRadius: 4,
2258
+ cursor: "pointer",
2259
+ background: elegido ? "#1976d2" : "transparent",
2260
+ color: elegido ? "#fff" : dia.delMesMostrado ? "#000" : "#aaa"
2261
+ },
2262
+ children: dia.dia
2263
+ }
2264
+ ) }, `${dia.mes}-${dia.dia}`);
2265
+ }) }, i)) })
2266
+ ] }),
2267
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", marginTop: 4 }, children: [
2268
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.Button, { size: "small", onClick: () => onElegir(fechaATexto(fechaDeHoy)), children: "hoy" }),
2269
+ admiteNulo && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_material6.Button, { size: "small", onClick: () => onElegir(null), children: "vac\xEDo" })
2270
+ ] })
2271
+ ] }) });
2272
+ }
2273
+
2274
+ // src/components/grid/VentanaDeTexto.tsx
2275
+ var import_react14 = require("react");
2276
+ var import_material7 = require("@mui/material");
2277
+ var import_jsx_runtime9 = require("react/jsx-runtime");
2278
+ function VentanaDeTexto({ anclaje, texto, editable, onAceptar, onCerrar }) {
2279
+ const [valor, setValor] = (0, import_react14.useState)(texto);
2280
+ const alApretar = (evento) => {
2281
+ if (evento.key === "Escape" || evento.key === "F9") {
2282
+ onCerrar();
2283
+ } else if (evento.key === "Enter" && evento.ctrlKey && editable) {
2284
+ onAceptar(valor);
2285
+ } else {
2286
+ return;
2287
+ }
2288
+ evento.preventDefault();
2289
+ evento.stopPropagation();
2290
+ };
2291
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material7.Popover, { open: true, anchorEl: anclaje, onClose: onCerrar, disableRestoreFocus: true, anchorOrigin: { vertical: "bottom", horizontal: "left" }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { padding: 8, minWidth: 320, maxWidth: 640 }, children: [
2292
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2293
+ import_material7.InputBase,
2294
+ {
2295
+ autoFocus: true,
2296
+ multiline: true,
2297
+ fullWidth: true,
2298
+ readOnly: !editable,
2299
+ value: valor,
2300
+ onChange: (e) => setValor(e.target.value),
2301
+ onKeyDown: alApretar,
2302
+ minRows: 2,
2303
+ maxRows: 16,
2304
+ sx: { fontFamily: "monospace", fontSize: "0.8rem", border: "1px solid #ccc", borderRadius: "4px", p: 0.5 },
2305
+ inputProps: { "aria-label": "contenido de la celda" }
2306
+ }
2307
+ ),
2308
+ editable && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { display: "flex", justifyContent: "flex-end", gap: 8, marginTop: 4 }, children: [
2309
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material7.Button, { size: "small", onClick: onCerrar, children: "cancelar" }),
2310
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material7.Button, { size: "small", variant: "contained", onClick: () => onAceptar(valor), children: "aceptar" })
2311
+ ] })
2312
+ ] }) });
2313
+ }
2314
+
2315
+ // src/hooks/grid/useExpander.tsx
2316
+ var import_jsx_runtime10 = require("react/jsx-runtime");
2317
+ var useExpander = ({ campo, editable, fila, admiteNulo, tipos, anclaje, textoActual, valorActual, alElegirValor, alConfirmarTexto, alFallar }) => {
2318
+ const [expansion, setExpansion] = (0, import_react15.useState)(null);
2319
+ const abierto = import_react15.default.useRef(false);
2320
+ const tipoDelCampo = tipoDeExpander(campo, editable);
2321
+ const tipo = tipoDelCampo === null || tipoDelCampo === "json" || tipos && !tipos.includes(tipoDelCampo) ? null : tipoDelCampo;
2322
+ const abrir = (0, import_react15.useCallback)(async (busqueda) => {
2323
+ if (tipo === null || abierto.current) return;
2324
+ abierto.current = true;
2325
+ try {
2326
+ if (tipo === "referencia" && esCampoConReferencia(campo)) {
2327
+ const { definicion, filas } = await cargarReferencia(campo.references);
2328
+ setExpansion({ tipo: "opciones", opciones: opcionesDeReferencia(campo, definicion, filas, fila, admiteNulo), busqueda });
2329
+ } else if (tipo === "booleano") {
2330
+ setExpansion({ tipo: "opciones", opciones: opcionesDeBooleano(admiteNulo), busqueda });
2331
+ } else if (tipo === "opciones") {
2332
+ setExpansion({ tipo: "opciones", opciones: opcionesDeEnumerado(campo.options ?? [], admiteNulo), busqueda });
2333
+ } else {
2334
+ setExpansion({ tipo: tipo === "fecha" ? "fecha" : "texto" });
2335
+ }
2336
+ } catch (err) {
2337
+ abierto.current = false;
2338
+ alFallar(mensajeDeError(err));
2339
+ }
2340
+ }, [tipo, campo, fila, admiteNulo, alFallar]);
2341
+ const cerrar = (0, import_react15.useCallback)(() => {
2342
+ abierto.current = false;
2343
+ setExpansion(null);
2344
+ setTimeout(() => anclaje.current?.focus(), 0);
2345
+ }, [anclaje]);
2346
+ const elegirValor = (0, import_react15.useCallback)((valor) => {
2347
+ cerrar();
2348
+ alElegirValor(valor);
2349
+ }, [cerrar, alElegirValor]);
2350
+ const confirmarTexto = (0, import_react15.useCallback)((texto) => {
2351
+ cerrar();
2352
+ alConfirmarTexto(texto);
2353
+ }, [cerrar, alConfirmarTexto]);
2354
+ const manejarTecla = (0, import_react15.useCallback)((event) => {
2355
+ const esExpander = event.key === "F9" && !event.shiftKey && !event.ctrlKey && !event.altKey || event.key === "ArrowDown" && event.altKey && !event.shiftKey && !event.ctrlKey;
2356
+ if (tipo === null || !esExpander) return false;
2357
+ event.preventDefault();
2358
+ void abrir("");
2359
+ return true;
2360
+ }, [tipo, abrir]);
2361
+ const titulo = tipo === "fecha" ? "elegir fecha (F9)" : tipo === "texto" ? "ver el contenido completo (F9)" : "elegir un valor (F9)";
2362
+ const lupa = tipo === null ? null : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2363
+ import_IconButton.default,
2364
+ {
2365
+ size: "small",
2366
+ tabIndex: -1,
2367
+ "aria-label": titulo.replace(" (F9)", ""),
2368
+ title: titulo,
2369
+ onMouseDown: (e) => e.preventDefault(),
2370
+ onClick: (e) => {
2371
+ e.stopPropagation();
2372
+ void abrir("");
2373
+ },
2374
+ sx: { p: 0, ml: 0.25, color: "primary.main", "&:hover": { backgroundColor: "action.hover" } },
2375
+ children: tipo === "fecha" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_CalendarMonth.default, { sx: { fontSize: 16 } }) : tipo === "texto" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_Search2.default, { sx: { fontSize: 16 } }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_ArrowDropDown.default, { sx: { fontSize: 20 } })
2376
+ }
2377
+ );
2378
+ const base = anclaje.current;
2379
+ const ventana = !expansion || !base ? null : expansion.tipo === "opciones" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MenuDeOpciones, { anclaje: base, opciones: expansion.opciones, busquedaInicial: expansion.busqueda, onElegir: elegirValor, onCerrar: cerrar }) : expansion.tipo === "fecha" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SelectorDeFecha, { anclaje: base, fechaActual: fechaDeValor(valorActual), admiteNulo, onElegir: confirmarTexto, onCerrar: cerrar }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(VentanaDeTexto, { anclaje: base, texto: textoActual, editable: true, onAceptar: confirmarTexto, onCerrar: cerrar });
2380
+ return { tipo, abierto, abrir, manejarTecla, lupa, ventana };
2381
+ };
2382
+
2383
+ // src/components/forms/TypedField.tsx
2384
+ var import_jsx_runtime11 = require("react/jsx-runtime");
2116
2385
  var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode = false, feedback, isMandatory = false }) => {
2117
- const theme = (0, import_material5.useTheme)();
2118
- const typer = (0, import_react12.useMemo)(() => import_type_store3.default.typerFrom(fieldDef), [fieldDef]);
2119
- const isBoolean = fieldDef.typeName === "boolean";
2120
- const [localString, setLocalString] = (0, import_react12.useState)(() => {
2386
+ const theme = (0, import_material8.useTheme)();
2387
+ const typer = (0, import_react16.useMemo)(() => import_type_store3.default.typerFrom(fieldDef), [fieldDef]);
2388
+ const isBoolean = fieldDef.typeName === "boolean" && !isFilterMode;
2389
+ const [localString, setLocalString] = (0, import_react16.useState)(() => {
2121
2390
  if (isBoolean) return "";
2122
2391
  if (isFilterMode) return value !== null && value !== void 0 ? String(value) : "";
2123
2392
  try {
@@ -2126,10 +2395,10 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
2126
2395
  return value === null || value === void 0 ? "" : String(value);
2127
2396
  }
2128
2397
  });
2129
- const [errorMsg, setErrorMsg] = (0, import_react12.useState)(null);
2130
- const lastValueRef = (0, import_react13.useRef)(value);
2131
- const lastCommittedStringRef = (0, import_react13.useRef)(localString);
2132
- (0, import_react12.useEffect)(() => {
2398
+ const [errorMsg, setErrorMsg] = (0, import_react16.useState)(null);
2399
+ const lastValueRef = (0, import_react17.useRef)(value);
2400
+ const lastCommittedStringRef = (0, import_react17.useRef)(localString);
2401
+ (0, import_react16.useEffect)(() => {
2133
2402
  if (!isBoolean) {
2134
2403
  if (value !== lastValueRef.current) {
2135
2404
  lastValueRef.current = value;
@@ -2146,7 +2415,27 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
2146
2415
  }
2147
2416
  }
2148
2417
  }, [value, typer, isBoolean, isFilterMode]);
2149
- const handleTextChange = (0, import_react12.useCallback)((e) => {
2418
+ const entradaRef = (0, import_react17.useRef)(null);
2419
+ const [enfocado, setEnfocado] = (0, import_react16.useState)(false);
2420
+ const escribirEnFiltro = (0, import_react16.useCallback)((texto) => {
2421
+ setLocalString(texto);
2422
+ lastValueRef.current = texto;
2423
+ onChange(fieldDef.name, texto, true);
2424
+ }, [onChange, fieldDef.name]);
2425
+ const expander = useExpander({
2426
+ campo: fieldDef,
2427
+ editable: true,
2428
+ fila: null,
2429
+ admiteNulo: false,
2430
+ tipos: isFilterMode ? ["referencia", "booleano", "opciones", "fecha"] : [],
2431
+ anclaje: entradaRef,
2432
+ textoActual: localString,
2433
+ valorActual: localString,
2434
+ alElegirValor: (valor) => escribirEnFiltro(valor === null || valor === void 0 ? "" : typeof valor === "boolean" ? typer.toLocalString(valor) : String(valor)),
2435
+ alConfirmarTexto: (texto) => escribirEnFiltro(texto ?? ""),
2436
+ alFallar: (mensaje) => setErrorMsg(mensaje)
2437
+ });
2438
+ const handleTextChange = (0, import_react16.useCallback)((e) => {
2150
2439
  const newValueString = e.target.value;
2151
2440
  setLocalString(newValueString);
2152
2441
  let parsedValue = null;
@@ -2167,7 +2456,7 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
2167
2456
  lastValueRef.current = parsedValue;
2168
2457
  onChange(fieldDef.name, parsedValue, isValid);
2169
2458
  }, [typer, onChange, fieldDef.name, isFilterMode]);
2170
- const handleTextCommit = (0, import_react12.useCallback)(() => {
2459
+ const handleTextCommit = (0, import_react16.useCallback)(() => {
2171
2460
  if (!onCommit) return;
2172
2461
  if (localString === lastCommittedStringRef.current) return;
2173
2462
  lastCommittedStringRef.current = localString;
@@ -2185,13 +2474,14 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
2185
2474
  }
2186
2475
  onCommit(fieldDef.name, parsedValue, isValid);
2187
2476
  }, [onCommit, fieldDef.name, localString, isFilterMode, typer]);
2188
- const handleTextKeyDown = (0, import_react12.useCallback)((e) => {
2477
+ const handleTextKeyDown = (0, import_react16.useCallback)((e) => {
2478
+ if (expander.manejarTecla(e)) return;
2189
2479
  if (e.key === "Enter") {
2190
2480
  e.preventDefault();
2191
2481
  handleTextCommit();
2192
2482
  }
2193
- }, [handleTextCommit]);
2194
- const handleBooleanChange = (0, import_react12.useCallback)((e) => {
2483
+ }, [handleTextCommit, expander]);
2484
+ const handleBooleanChange = (0, import_react16.useCallback)((e) => {
2195
2485
  const val = e.target.value;
2196
2486
  let finalValue = null;
2197
2487
  if (val === "true") finalValue = true;
@@ -2219,28 +2509,28 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
2219
2509
  }
2220
2510
  const cellBackgroundColor2 = feedback === "error" ? theme.palette.error.light : feedback === "success" ? theme.palette.success.light : defaultBgColor;
2221
2511
  const transitionStyle2 = "background-color 0.3s ease-in-out";
2222
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_material5.FormControl, { fullWidth: true, error: !!errorMsg && !isFilterMode, disabled: isDisabled, size: "small", margin: "dense", children: [
2223
- !isFilterMode && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_material5.InputLabel, { shrink: true, children: fieldDef.name }),
2224
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
2225
- import_material5.Select,
2512
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_material8.FormControl, { fullWidth: true, error: !!errorMsg && !isFilterMode, disabled: isDisabled, size: "small", margin: "dense", children: [
2513
+ !isFilterMode && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material8.InputLabel, { shrink: true, children: fieldDef.name }),
2514
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2515
+ import_material8.Select,
2226
2516
  {
2227
2517
  value: boolVal,
2228
2518
  label: !isFilterMode ? fieldDef.name : void 0,
2229
2519
  onChange: handleBooleanChange,
2230
- startAdornment: isMandatory && isEmpty && !isFilterMode ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_material5.InputAdornment, { position: "start", sx: { color: "text.secondary", ml: 0.5 }, children: "*" }) : void 0,
2520
+ startAdornment: isMandatory && isEmpty && !isFilterMode ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material8.InputAdornment, { position: "start", sx: { color: "text.secondary", ml: 0.5 }, children: "*" }) : void 0,
2231
2521
  displayEmpty: true,
2232
2522
  sx: isFilterMode ? { height: 25, fontSize: "0.8rem", backgroundColor: "background.paper" } : {
2233
2523
  backgroundColor: cellBackgroundColor2,
2234
2524
  transition: transitionStyle2
2235
2525
  },
2236
2526
  children: [
2237
- fieldDef.nullable !== false && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_material5.MenuItem, { value: "", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("em", { children: "Nulo / Sin Especificar" }) }),
2238
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_material5.MenuItem, { value: "true", children: "S\xED (Verdadero)" }),
2239
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_material5.MenuItem, { value: "false", children: "No (Falso)" })
2527
+ fieldDef.nullable !== false && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material8.MenuItem, { value: "", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("em", { children: "Nulo / Sin Especificar" }) }),
2528
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material8.MenuItem, { value: "true", children: "S\xED (Verdadero)" }),
2529
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material8.MenuItem, { value: "false", children: "No (Falso)" })
2240
2530
  ]
2241
2531
  }
2242
2532
  ),
2243
- errorMsg && !isFilterMode && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_material5.FormHelperText, { children: errorMsg })
2533
+ errorMsg && !isFilterMode && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material8.FormHelperText, { children: errorMsg })
2244
2534
  ] });
2245
2535
  }
2246
2536
  let inputType = "text";
@@ -2254,54 +2544,65 @@ var TypedField = ({ fieldDef, value, onChange, onCommit, disabled, isFilterMode
2254
2544
  }
2255
2545
  const cellBackgroundColor = feedback === "error" ? theme.palette.error.light : feedback === "success" ? theme.palette.success.light : defaultTextBgColor;
2256
2546
  const transitionStyle = "background-color 0.3s ease-in-out";
2257
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2258
- import_material5.TextField,
2259
- {
2260
- fullWidth: true,
2261
- type: inputType,
2262
- label: isFilterMode ? void 0 : fieldDef.name,
2263
- variant: "outlined",
2264
- size: "small",
2265
- margin: isFilterMode ? "none" : "dense",
2266
- value: localString,
2267
- onChange: handleTextChange,
2268
- disabled: isDisabled,
2269
- error: !!errorMsg && !isFilterMode,
2270
- helperText: !isFilterMode ? errorMsg || (isMandatory ? "Obligatorio" : "") : void 0,
2271
- InputLabelProps: !isFilterMode ? { shrink: true } : void 0,
2272
- InputProps: !isFilterMode && isMandatory && isEmptyText ? {
2273
- startAdornment: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_material5.InputAdornment, { position: "start", sx: { color: "text.secondary", mr: 0.5 }, children: "*" })
2274
- } : {},
2275
- inputProps: {
2276
- style: {
2277
- textAlign: isNumericType(fieldDef.typeName) ? "right" : "left"
2278
- }
2279
- },
2280
- sx: isFilterMode ? {
2281
- "& .MuiOutlinedInput-root": {
2282
- backgroundColor: "background.paper",
2283
- height: FILTER_ROW_HEIGHT - 5,
2284
- minWidth: 50,
2285
- fontSize: "0.8rem",
2286
- padding: "0px"
2287
- }
2288
- } : {
2289
- "& .MuiOutlinedInput-root": {
2290
- backgroundColor: cellBackgroundColor,
2291
- transition: transitionStyle
2547
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
2548
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2549
+ import_material8.TextField,
2550
+ {
2551
+ fullWidth: true,
2552
+ inputRef: entradaRef,
2553
+ type: inputType,
2554
+ label: isFilterMode ? void 0 : fieldDef.name,
2555
+ variant: "outlined",
2556
+ size: "small",
2557
+ margin: isFilterMode ? "none" : "dense",
2558
+ value: localString,
2559
+ onChange: handleTextChange,
2560
+ disabled: isDisabled,
2561
+ error: !!errorMsg && !isFilterMode,
2562
+ helperText: !isFilterMode ? errorMsg || (isMandatory ? "Obligatorio" : "") : void 0,
2563
+ InputLabelProps: !isFilterMode ? { shrink: true } : void 0,
2564
+ InputProps: isFilterMode ? {
2565
+ // la lupa solo al enfocar el filtro, como en backend-plus
2566
+ endAdornment: enfocado || expander.abierto.current ? expander.lupa : void 0
2567
+ } : isMandatory && isEmptyText ? {
2568
+ startAdornment: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material8.InputAdornment, { position: "start", sx: { color: "text.secondary", mr: 0.5 }, children: "*" })
2569
+ } : {},
2570
+ inputProps: {
2571
+ style: {
2572
+ textAlign: isNumericType(fieldDef.typeName) ? "right" : "left"
2573
+ }
2292
2574
  },
2293
- "& .MuiOutlinedInput-input": {
2294
- padding: "6px 12px"
2295
- }
2296
- },
2297
- onBlur: handleTextCommit,
2298
- onKeyDown: handleTextKeyDown
2299
- }
2300
- );
2575
+ sx: isFilterMode ? {
2576
+ "& .MuiOutlinedInput-root": {
2577
+ backgroundColor: "background.paper",
2578
+ height: FILTER_ROW_HEIGHT - 5,
2579
+ minWidth: 50,
2580
+ fontSize: "0.8rem",
2581
+ padding: "0px"
2582
+ }
2583
+ } : {
2584
+ "& .MuiOutlinedInput-root": {
2585
+ backgroundColor: cellBackgroundColor,
2586
+ transition: transitionStyle
2587
+ },
2588
+ "& .MuiOutlinedInput-input": {
2589
+ padding: "6px 12px"
2590
+ }
2591
+ },
2592
+ onFocus: () => setEnfocado(true),
2593
+ onBlur: () => {
2594
+ setEnfocado(false);
2595
+ handleTextCommit();
2596
+ },
2597
+ onKeyDown: handleTextKeyDown
2598
+ }
2599
+ ),
2600
+ expander.ventana
2601
+ ] });
2301
2602
  };
2302
2603
 
2303
2604
  // src/components/grid/FilterInputRender.tsx
2304
- var import_jsx_runtime8 = require("react/jsx-runtime");
2605
+ var import_jsx_runtime12 = require("react/jsx-runtime");
2305
2606
  function FilterInputRenderer({
2306
2607
  columnKey,
2307
2608
  currentFilter,
@@ -2324,8 +2625,8 @@ function FilterInputRenderer({
2324
2625
  [columnKey]: { operator: newOp, value: formattedVal }
2325
2626
  }));
2326
2627
  };
2327
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_material6.Box, { sx: { mt: 0, display: "flex", alignItems: "center", gap: 0.5, pr: 1 }, children: [
2328
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2628
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_material9.Box, { sx: { mt: 0, display: "flex", alignItems: "center", gap: 0.5, pr: 1 }, children: [
2629
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2329
2630
  "select",
2330
2631
  {
2331
2632
  value: operator,
@@ -2341,10 +2642,10 @@ function FilterInputRenderer({
2341
2642
  textAlign: "center",
2342
2643
  cursor: "pointer"
2343
2644
  },
2344
- children: filterOperators.map((op) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: op.value, children: op.label }, op.value))
2645
+ children: filterOperators.map((op) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: op.value, children: op.label }, op.value))
2345
2646
  }
2346
2647
  ),
2347
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2648
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2348
2649
  TypedField,
2349
2650
  {
2350
2651
  fieldDef,
@@ -2355,8 +2656,8 @@ function FilterInputRenderer({
2355
2656
  )
2356
2657
  ] });
2357
2658
  }
2358
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2359
- import_material6.InputBase,
2659
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2660
+ import_material9.InputBase,
2360
2661
  {
2361
2662
  value: currentFilter || "",
2362
2663
  onChange: (e) => setFilters((prev) => ({
@@ -2378,18 +2679,18 @@ function FilterInputRenderer({
2378
2679
  }
2379
2680
  );
2380
2681
  }
2381
- var FilterInputRender_default = import_react14.default.memo(FilterInputRenderer);
2682
+ var FilterInputRender_default = import_react18.default.memo(FilterInputRenderer);
2382
2683
 
2383
2684
  // src/components/grid/renderers/summaryCellRenderers.tsx
2384
- var import_material7 = require("@mui/material");
2385
- var import_jsx_runtime9 = require("react/jsx-runtime");
2685
+ var import_material10 = require("@mui/material");
2686
+ var import_jsx_runtime13 = require("react/jsx-runtime");
2386
2687
  var defaultColumnSummaryCellRenderer = (props, fixedFields) => {
2387
2688
  const { column, row } = props;
2388
2689
  if (row.id === "filterRow") {
2389
2690
  const { filters, setFilters } = row;
2390
2691
  if (valorFijoDe(fixedFields, column.key)) return null;
2391
2692
  const fieldDef = esColumnaPropia(column) && column.customType === "default" ? column.fieldDef : void 0;
2392
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_material7.Box, { sx: { width: "100%", height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2693
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_material10.Box, { sx: { width: "100%", height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2393
2694
  FilterInputRender_default,
2394
2695
  {
2395
2696
  columnKey: column.key,
@@ -2431,7 +2732,7 @@ var defaultColumnSummaryCellRenderer = (props, fixedFields) => {
2431
2732
  label = "Cant S\xED: ";
2432
2733
  break;
2433
2734
  }
2434
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_material7.Box, { sx: {
2735
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_material10.Box, { sx: {
2435
2736
  px: 0,
2436
2737
  fontWeight: "bold",
2437
2738
  fontSize: "0.875rem",
@@ -2449,36 +2750,36 @@ var actionsColumnSummaryCellRenderer = (_props) => null;
2449
2750
  var detailColumnCellSummaryRenderer = (_props) => null;
2450
2751
 
2451
2752
  // src/components/grid/renderers/cellRenderers.tsx
2452
- var import_react15 = __toESM(require("react"), 1);
2453
- var import_material10 = require("@mui/material");
2753
+ var import_react19 = __toESM(require("react"), 1);
2754
+ var import_material13 = require("@mui/material");
2454
2755
  var import_ViewHeadline = __toESM(require("@mui/icons-material/ViewHeadline"), 1);
2455
2756
  var import_Delete = __toESM(require("@mui/icons-material/Delete"), 1);
2456
2757
  var import_Add2 = __toESM(require("@mui/icons-material/Add"), 1);
2457
2758
 
2458
2759
  // src/components/grid/ExampleClientSideComponent.tsx
2459
- var import_material8 = require("@mui/material");
2460
- var import_jsx_runtime10 = require("react/jsx-runtime");
2760
+ var import_material11 = require("@mui/material");
2761
+ var import_jsx_runtime14 = require("react/jsx-runtime");
2461
2762
  var ExampleClientSideComponent = ({ row, column, fieldDefinition }) => {
2462
2763
  const value = row[column.key];
2463
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_material8.Box, { sx: {
2764
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material11.Box, { sx: {
2464
2765
  padding: 0.5,
2465
2766
  width: "100%",
2466
2767
  height: "100%",
2467
2768
  display: "flex",
2468
2769
  alignItems: "center",
2469
2770
  backgroundColor: value === "Special" ? "lightblue" : "transparent"
2470
- }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_material8.Typography, { variant: "body2", sx: { fontWeight: "bold" }, children: value ? `CS: ${value}` : "N/A" }) });
2771
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material11.Typography, { variant: "body2", sx: { fontWeight: "bold" }, children: value ? `CS: ${value}` : "N/A" }) });
2471
2772
  };
2472
2773
  var ExampleClientSideComponent_default = ExampleClientSideComponent;
2473
2774
 
2474
2775
  // src/components/grid/FallbackClientSideRenderer.tsx
2475
- var import_material9 = require("@mui/material");
2776
+ var import_material12 = require("@mui/material");
2476
2777
  var import_WarningAmber2 = __toESM(require("@mui/icons-material/WarningAmber"), 1);
2477
- var import_jsx_runtime11 = require("react/jsx-runtime");
2778
+ var import_jsx_runtime15 = require("react/jsx-runtime");
2478
2779
  var FallbackClientSideRenderer = ({ column, row, fieldDefinition }) => {
2479
2780
  const clientSideName = fieldDefinition?.clientSide || "Desconocido";
2480
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material9.Tooltip, { title: `Componente clientSide '${clientSideName}' no implementado. Mostrando valor por defecto.`, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2481
- import_material9.Box,
2781
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material12.Tooltip, { title: `Componente clientSide '${clientSideName}' no implementado. Mostrando valor por defecto.`, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2782
+ import_material12.Box,
2482
2783
  {
2483
2784
  sx: {
2484
2785
  display: "flex",
@@ -2498,8 +2799,8 @@ var FallbackClientSideRenderer = ({ column, row, fieldDefinition }) => {
2498
2799
  // Evita que el contenido se desborde
2499
2800
  },
2500
2801
  children: [
2501
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_material9.Typography, { variant: "body2", noWrap: true, sx: { flexGrow: 1 }, children: clientSideName + " not found" }),
2502
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2802
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material12.Typography, { variant: "body2", noWrap: true, sx: { flexGrow: 1 }, children: clientSideName + " not found" }),
2803
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2503
2804
  import_WarningAmber2.default,
2504
2805
  {
2505
2806
  sx: {
@@ -2527,9 +2828,9 @@ var extendClientSides = (newRenderers) => {
2527
2828
  };
2528
2829
 
2529
2830
  // src/components/grid/renderers/cellRenderers.tsx
2530
- var import_jsx_runtime12 = require("react/jsx-runtime");
2531
- var CeldaDato = import_react15.default.memo(function CeldaDato2({ row, columnKey, defaultColumn }) {
2532
- const theme = (0, import_material10.useTheme)();
2831
+ var import_jsx_runtime16 = require("react/jsx-runtime");
2832
+ var CeldaDato = import_react19.default.memo(function CeldaDato2({ row, columnKey, defaultColumn }) {
2833
+ const theme = (0, import_material13.useTheme)();
2533
2834
  const { primaryKey, fixedFields, typer, isMandatory, isNumeric } = defaultColumn;
2534
2835
  const rowId = getPrimaryKeyValues(row, primaryKey);
2535
2836
  const currentCellFeedback = useFeedbackCelda(`${rowId}-${columnKey}`);
@@ -2549,7 +2850,7 @@ var CeldaDato = import_react15.default.memo(function CeldaDato2({ row, columnKey
2549
2850
  displayValue = "* " + displayValue;
2550
2851
  }
2551
2852
  const signal = displayValue === "--" ? "typed-controls-signal-no-data" : displayValue === "//" ? "typed-controls-signal-unknown-data" : "";
2552
- const celda = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2853
+ const celda = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2553
2854
  "div",
2554
2855
  {
2555
2856
  className: `fpr-celda ${isNumeric ? "fpr-celda-numerica" : ""} ${signal} ${row[NEW_ROW_INDICATOR] ? "new-row-cell-animation" : ""}`,
@@ -2557,13 +2858,13 @@ var CeldaDato = import_react15.default.memo(function CeldaDato2({ row, columnKey
2557
2858
  children: displayValue
2558
2859
  }
2559
2860
  );
2560
- return currentCellFeedback?.message ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_material10.Tooltip, { title: currentCellFeedback.message, children: celda }) : celda;
2861
+ return currentCellFeedback?.message ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material13.Tooltip, { title: currentCellFeedback.message, children: celda }) : celda;
2561
2862
  });
2562
2863
  var allColumnsCellRenderer = (props) => {
2563
2864
  const { row, column } = props;
2564
2865
  if (!esColumnaPropia(column)) return void 0;
2565
2866
  if (esFilaDetalle(row)) {
2566
- return column.customType === "action" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CeldaDetalle, { fila: row }) : null;
2867
+ return column.customType === "action" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CeldaDetalle, { fila: row }) : null;
2567
2868
  }
2568
2869
  switch (column.customType) {
2569
2870
  case "default": {
@@ -2572,15 +2873,15 @@ var allColumnsCellRenderer = (props) => {
2572
2873
  if (fieldDef?.clientSide) {
2573
2874
  const ClientSideComponent = clientSides[fieldDef.clientSide];
2574
2875
  if (ClientSideComponent) {
2575
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ClientSideComponent, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
2876
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ClientSideComponent, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
2576
2877
  }
2577
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FallbackClientSideRenderer_default, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
2878
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(FallbackClientSideRenderer_default, { ...props, fieldDefinition: fieldDef, tableDefinition, primaryKey });
2578
2879
  }
2579
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CeldaDato, { row, columnKey: props.column.key, defaultColumn });
2880
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CeldaDato, { row, columnKey: props.column.key, defaultColumn });
2580
2881
  }
2581
2882
  case "detail": {
2582
2883
  const { detailTable, primaryKey } = column;
2583
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2884
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2584
2885
  BotonDetalle,
2585
2886
  {
2586
2887
  row,
@@ -2615,280 +2916,82 @@ var allColumnsCellRenderer = (props) => {
2615
2916
  color: "primary"
2616
2917
  }
2617
2918
  ];
2618
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_material10.Box, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%", gap: 0.5 }, children: gridActionButtons.map((actionDef) => tableDefinition.allow[actionDef.action] ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2619
- import_material10.Button,
2919
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material13.Box, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100%", gap: 0.5 }, children: gridActionButtons.map((actionDef) => tableDefinition.allow[actionDef.action] ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2920
+ import_material13.Button,
2620
2921
  {
2621
2922
  variant: "outlined",
2622
- color: actionDef.color,
2623
- size: "small",
2624
- onClick: () => actionDef.handler(row),
2625
- title: actionDef.title,
2626
- sx: { width: 22, minWidth: 22, height: 22, "& .MuiButton-startIcon": { m: 0 } },
2627
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(actionDef.icon, { sx: { fontSize: 18 } })
2628
- },
2629
- actionDef.action
2630
- ) : null) });
2631
- }
2632
- default:
2633
- return void 0;
2634
- }
2635
- };
2636
-
2637
- // src/components/grid/InputRenderer.tsx
2638
- var import_react20 = __toESM(require("react"), 1);
2639
-
2640
- // src/hooks/useTableRecordSave.ts
2641
- var import_react16 = require("react");
2642
- var useTableRecordSave = () => {
2643
- const { callApi, loading, error } = useApiCall();
2644
- const saveRecord = (0, import_react16.useCallback)(async ({
2645
- tableDefinition,
2646
- isNewRow,
2647
- formData,
2648
- initialData,
2649
- targetFieldName
2650
- }) => {
2651
- const status = isNewRow ? "new" : "update";
2652
- let rowToSend = {};
2653
- if (isNewRow) {
2654
- tableDefinition.fields.forEach((fieldDef) => {
2655
- const fieldValue = formData[fieldDef.name];
2656
- if (fieldValue !== void 0 && fieldValue !== null && String(fieldValue).trim() !== "") {
2657
- rowToSend[fieldDef.name] = fieldValue;
2658
- } else if (tableDefinition.primaryKey.includes(fieldDef.name) && (fieldValue === null || fieldValue === void 0 || String(fieldValue).trim() === "")) {
2659
- rowToSend[fieldDef.name] = fieldValue;
2660
- }
2661
- });
2662
- delete rowToSend["$new"];
2663
- } else {
2664
- if (targetFieldName) {
2665
- rowToSend[targetFieldName] = formData[targetFieldName];
2666
- } else {
2667
- Object.keys(formData).forEach((key) => {
2668
- if (formData[key] !== initialData[key]) {
2669
- rowToSend[key] = formData[key];
2670
- }
2671
- });
2672
- }
2673
- }
2674
- const primaryKeyValuesForBackend = isNewRow ? [] : tableDefinition.primaryKey.map((key) => initialData[key]);
2675
- const response = await callApi("table_record_save", {
2676
- // como backend-plus (`depot.def.name`): el servidor busca la definición por este nombre. Una definición que guarda en
2677
- // otra tabla (`tableName`, con campos de `table`) no existe con el nombre de la física: ahí faltarían sus campos
2678
- table: tableDefinition.name,
2679
- primaryKeyValues: primaryKeyValuesForBackend,
2680
- newRow: rowToSend,
2681
- oldRow: isNewRow ? {} : initialData,
2682
- status
2683
- });
2684
- return requerido(response, "la respuesta del guardado");
2685
- }, [callApi]);
2686
- return { saveRecord, loading, error };
2687
- };
2688
-
2689
- // src/components/grid/InputRenderer.tsx
2690
- var import_InputBase = __toESM(require("@mui/material/InputBase"), 1);
2691
- var import_IconButton = __toESM(require("@mui/material/IconButton"), 1);
2692
- var import_ArrowDropDown = __toESM(require("@mui/icons-material/ArrowDropDown"), 1);
2693
- var import_CalendarMonth = __toESM(require("@mui/icons-material/CalendarMonth"), 1);
2694
- var import_Search2 = __toESM(require("@mui/icons-material/Search"), 1);
2695
- var import_material14 = require("@mui/material");
2696
-
2697
- // src/components/grid/MenuDeOpciones.tsx
2698
- var import_react17 = require("react");
2699
- var import_material11 = require("@mui/material");
2700
- var import_jsx_runtime13 = require("react/jsx-runtime");
2701
- function MenuDeOpciones({ anclaje, opciones, busquedaInicial, onElegir, onCerrar }) {
2702
- const [busqueda, setBusqueda] = (0, import_react17.useState)(busquedaInicial);
2703
- const [indice, setIndice] = (0, import_react17.useState)(0);
2704
- const visibles = (0, import_react17.useMemo)(() => filtrarOpciones(opciones, busqueda), [opciones, busqueda]);
2705
- const elegida = (0, import_react17.useRef)(null);
2706
- (0, import_react17.useEffect)(() => {
2707
- elegida.current?.scrollIntoView({ block: "nearest" });
2708
- }, [indice, visibles]);
2709
- const alApretar = (evento) => {
2710
- if (evento.key === "ArrowDown") {
2711
- setIndice((i) => Math.min(i + 1, visibles.length - 1));
2712
- } else if (evento.key === "ArrowUp") {
2713
- setIndice((i) => Math.max(i - 1, 0));
2714
- } else if (evento.key === "Enter") {
2715
- if (visibles[indice]) onElegir(visibles[indice].valor);
2716
- } else if (evento.key === "F9" || evento.key === "Escape") {
2717
- onCerrar();
2718
- } else {
2719
- return;
2720
- }
2721
- evento.preventDefault();
2722
- evento.stopPropagation();
2723
- };
2724
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2725
- import_material11.Popover,
2726
- {
2727
- open: true,
2728
- anchorEl: anclaje,
2729
- onClose: onCerrar,
2730
- disableRestoreFocus: true,
2731
- anchorOrigin: { vertical: "bottom", horizontal: "left" },
2732
- slotProps: { paper: { sx: { minWidth: 300, maxWidth: 520 } } },
2733
- children: [
2734
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2735
- import_material11.InputBase,
2736
- {
2737
- autoFocus: true,
2738
- fullWidth: true,
2739
- value: busqueda,
2740
- onChange: (e) => {
2741
- setBusqueda(e.target.value);
2742
- setIndice(0);
2743
- },
2744
- onKeyDown: alApretar,
2745
- placeholder: "buscar",
2746
- sx: { px: 1, py: 0.5, fontSize: "0.8rem", borderBottom: "1px solid #ccc" },
2747
- inputProps: { "aria-label": "buscar" }
2748
- }
2749
- ),
2750
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_material11.List, { dense: true, disablePadding: true, sx: { maxHeight: 320, overflowY: "auto" }, role: "listbox", children: [
2751
- visibles.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_material11.Typography, { variant: "body2", sx: { p: 1, color: "text.secondary" }, children: "sin coincidencias" }),
2752
- visibles.map((opcion, i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2753
- import_material11.ListItemButton,
2754
- {
2755
- ref: i === indice ? elegida : null,
2756
- selected: i === indice,
2757
- role: "option",
2758
- onClick: () => onElegir(opcion.valor),
2759
- sx: { gap: 2, py: 0.25, fontSize: "0.8rem" },
2760
- children: opcion.etiquetas.map((etiqueta, j) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontWeight: j === 0 ? 600 : 400, minWidth: j === 0 ? 40 : void 0 }, children: etiqueta }, j))
2761
- },
2762
- i
2763
- ))
2764
- ] })
2765
- ]
2766
- }
2767
- );
2768
- }
2769
-
2770
- // src/components/grid/SelectorDeFecha.tsx
2771
- var import_react18 = require("react");
2772
- var import_material12 = require("@mui/material");
2773
- var import_jsx_runtime14 = require("react/jsx-runtime");
2774
- var MESES = ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"];
2775
- var DIAS = ["lu", "ma", "mi", "ju", "vi", "s\xE1", "do"];
2776
- var mismaFecha = (a, b) => b !== null && a.anio === b.anio && a.mes === b.mes && a.dia === b.dia;
2777
- var MOVIMIENTOS = {
2778
- ArrowLeft: [-1, 0],
2779
- ArrowRight: [1, 0],
2780
- ArrowUp: [-7, 0],
2781
- ArrowDown: [7, 0],
2782
- PageUp: [0, -1],
2783
- PageDown: [0, 1]
2784
- };
2785
- function SelectorDeFecha({ anclaje, fechaActual, admiteNulo, onElegir, onCerrar }) {
2786
- const hoy = /* @__PURE__ */ new Date();
2787
- const fechaDeHoy = { anio: hoy.getFullYear(), mes: hoy.getMonth(), dia: hoy.getDate() };
2788
- const [cursor, setCursor] = (0, import_react18.useState)(fechaActual ?? fechaDeHoy);
2789
- const mover = (dias, meses) => {
2790
- const nueva = new Date(cursor.anio, cursor.mes + meses, cursor.dia + dias);
2791
- setCursor({ anio: nueva.getFullYear(), mes: nueva.getMonth(), dia: nueva.getDate() });
2792
- };
2793
- const alApretar = (evento) => {
2794
- if (evento.key in MOVIMIENTOS) {
2795
- mover(...MOVIMIENTOS[evento.key]);
2796
- } else if (evento.key === "Enter") {
2797
- onElegir(fechaATexto(cursor));
2798
- } else if (evento.key === "F9" || evento.key === "Escape") {
2799
- onCerrar();
2800
- } else {
2801
- return;
2923
+ color: actionDef.color,
2924
+ size: "small",
2925
+ onClick: () => actionDef.handler(row),
2926
+ title: actionDef.title,
2927
+ sx: { width: 22, minWidth: 22, height: 22, "& .MuiButton-startIcon": { m: 0 } },
2928
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(actionDef.icon, { sx: { fontSize: 18 } })
2929
+ },
2930
+ actionDef.action
2931
+ ) : null) });
2802
2932
  }
2803
- evento.preventDefault();
2804
- evento.stopPropagation();
2805
- };
2806
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Popover, { open: true, anchorEl: anclaje, onClose: onCerrar, disableRestoreFocus: true, anchorOrigin: { vertical: "bottom", horizontal: "left" }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { tabIndex: 0, ref: (el) => el?.focus(), onKeyDown: alApretar, style: { padding: 8, outline: "none", width: 252 }, "aria-label": "calendario", children: [
2807
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
2808
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.IconButton, { size: "small", "aria-label": "mes anterior", onClick: () => mover(0, -1), children: "\u2039" }),
2809
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_material12.Typography, { variant: "body2", sx: { fontWeight: 600 }, children: [
2810
- MESES[cursor.mes],
2811
- " ",
2812
- cursor.anio
2813
- ] }),
2814
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.IconButton, { size: "small", "aria-label": "mes siguiente", onClick: () => mover(0, 1), children: "\u203A" })
2815
- ] }),
2816
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("table", { style: { borderCollapse: "collapse", width: "100%", textAlign: "center", fontSize: "0.8rem" }, children: [
2817
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tr", { children: DIAS.map((d) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("th", { style: { fontWeight: 400, color: "#777" }, children: d }, d)) }) }),
2818
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tbody", { children: semanasDelMes(cursor.anio, cursor.mes).map((semana, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tr", { children: semana.map((dia) => {
2819
- const elegido = mismaFecha(dia, fechaActual);
2820
- const enCursor = mismaFecha(dia, cursor);
2821
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { style: { padding: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2822
- "button",
2823
- {
2824
- type: "button",
2825
- tabIndex: -1,
2826
- onClick: () => onElegir(fechaATexto(dia)),
2827
- style: {
2828
- width: 32,
2829
- height: 26,
2830
- border: enCursor ? "1px solid #1976d2" : "1px solid transparent",
2831
- borderRadius: 4,
2832
- cursor: "pointer",
2833
- background: elegido ? "#1976d2" : "transparent",
2834
- color: elegido ? "#fff" : dia.delMesMostrado ? "#000" : "#aaa"
2835
- },
2836
- children: dia.dia
2837
- }
2838
- ) }, `${dia.mes}-${dia.dia}`);
2839
- }) }, i)) })
2840
- ] }),
2841
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", marginTop: 4 }, children: [
2842
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Button, { size: "small", onClick: () => onElegir(fechaATexto(fechaDeHoy)), children: "hoy" }),
2843
- admiteNulo && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_material12.Button, { size: "small", onClick: () => onElegir(null), children: "vac\xEDo" })
2844
- ] })
2845
- ] }) });
2846
- }
2933
+ default:
2934
+ return void 0;
2935
+ }
2936
+ };
2847
2937
 
2848
- // src/components/grid/VentanaDeTexto.tsx
2849
- var import_react19 = require("react");
2850
- var import_material13 = require("@mui/material");
2851
- var import_jsx_runtime15 = require("react/jsx-runtime");
2852
- function VentanaDeTexto({ anclaje, texto, editable, onAceptar, onCerrar }) {
2853
- const [valor, setValor] = (0, import_react19.useState)(texto);
2854
- const alApretar = (evento) => {
2855
- if (evento.key === "Escape" || evento.key === "F9") {
2856
- onCerrar();
2857
- } else if (evento.key === "Enter" && evento.ctrlKey && editable) {
2858
- onAceptar(valor);
2938
+ // src/components/grid/InputRenderer.tsx
2939
+ var import_react21 = __toESM(require("react"), 1);
2940
+
2941
+ // src/hooks/useTableRecordSave.ts
2942
+ var import_react20 = require("react");
2943
+ var useTableRecordSave = () => {
2944
+ const { callApi, loading, error } = useApiCall();
2945
+ const saveRecord = (0, import_react20.useCallback)(async ({
2946
+ tableDefinition,
2947
+ isNewRow,
2948
+ formData,
2949
+ initialData,
2950
+ targetFieldName
2951
+ }) => {
2952
+ const status = isNewRow ? "new" : "update";
2953
+ let rowToSend = {};
2954
+ if (isNewRow) {
2955
+ tableDefinition.fields.forEach((fieldDef) => {
2956
+ const fieldValue = formData[fieldDef.name];
2957
+ if (fieldValue !== void 0 && fieldValue !== null && String(fieldValue).trim() !== "") {
2958
+ rowToSend[fieldDef.name] = fieldValue;
2959
+ } else if (tableDefinition.primaryKey.includes(fieldDef.name) && (fieldValue === null || fieldValue === void 0 || String(fieldValue).trim() === "")) {
2960
+ rowToSend[fieldDef.name] = fieldValue;
2961
+ }
2962
+ });
2963
+ delete rowToSend["$new"];
2859
2964
  } else {
2860
- return;
2861
- }
2862
- evento.preventDefault();
2863
- evento.stopPropagation();
2864
- };
2865
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material13.Popover, { open: true, anchorEl: anclaje, onClose: onCerrar, disableRestoreFocus: true, anchorOrigin: { vertical: "bottom", horizontal: "left" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { padding: 8, minWidth: 320, maxWidth: 640 }, children: [
2866
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2867
- import_material13.InputBase,
2868
- {
2869
- autoFocus: true,
2870
- multiline: true,
2871
- fullWidth: true,
2872
- readOnly: !editable,
2873
- value: valor,
2874
- onChange: (e) => setValor(e.target.value),
2875
- onKeyDown: alApretar,
2876
- minRows: 2,
2877
- maxRows: 16,
2878
- sx: { fontFamily: "monospace", fontSize: "0.8rem", border: "1px solid #ccc", borderRadius: "4px", p: 0.5 },
2879
- inputProps: { "aria-label": "contenido de la celda" }
2965
+ if (targetFieldName) {
2966
+ rowToSend[targetFieldName] = formData[targetFieldName];
2967
+ } else {
2968
+ Object.keys(formData).forEach((key) => {
2969
+ if (formData[key] !== initialData[key]) {
2970
+ rowToSend[key] = formData[key];
2971
+ }
2972
+ });
2880
2973
  }
2881
- ),
2882
- editable && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", justifyContent: "flex-end", gap: 8, marginTop: 4 }, children: [
2883
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material13.Button, { size: "small", onClick: onCerrar, children: "cancelar" }),
2884
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_material13.Button, { size: "small", variant: "contained", onClick: () => onAceptar(valor), children: "aceptar" })
2885
- ] })
2886
- ] }) });
2887
- }
2974
+ }
2975
+ const primaryKeyValuesForBackend = isNewRow ? [] : tableDefinition.primaryKey.map((key) => initialData[key]);
2976
+ const response = await callApi("table_record_save", {
2977
+ // como backend-plus (`depot.def.name`): el servidor busca la definición por este nombre. Una definición que guarda en
2978
+ // otra tabla (`tableName`, con campos de `table`) no existe con el nombre de la física: ahí faltarían sus campos
2979
+ table: tableDefinition.name,
2980
+ primaryKeyValues: primaryKeyValuesForBackend,
2981
+ newRow: rowToSend,
2982
+ oldRow: isNewRow ? {} : initialData,
2983
+ status
2984
+ });
2985
+ return requerido(response, "la respuesta del guardado");
2986
+ }, [callApi]);
2987
+ return { saveRecord, loading, error };
2988
+ };
2888
2989
 
2889
2990
  // src/components/grid/InputRenderer.tsx
2991
+ var import_InputBase = __toESM(require("@mui/material/InputBase"), 1);
2992
+ var import_material14 = require("@mui/material");
2890
2993
  var import_type_store4 = __toESM(require("type-store"), 1);
2891
- var import_jsx_runtime16 = require("react/jsx-runtime");
2994
+ var import_jsx_runtime17 = require("react/jsx-runtime");
2892
2995
  function findChangedValues(oldRowData, newRowData, isNewRow) {
2893
2996
  let changes = [];
2894
2997
  for (const key in newRowData) {
@@ -2914,12 +3017,10 @@ function InputRenderer({
2914
3017
  const setCellFeedbackMap = estadoGrilla.setFeedback;
2915
3018
  const setLocalCellChanges = estadoGrilla.setCambiosLocales;
2916
3019
  const fieldDefinition = requerido(tableDefinition.fields.find((f) => f.name === column.key), `el campo '${column.key}'`);
2917
- const typer = (0, import_react20.useMemo)(() => import_type_store4.default.typerFrom(fieldDefinition), [fieldDefinition]);
2918
- const [editingValue, setEditingValue] = (0, import_react20.useState)(() => row[column.key] !== null ? isNumericType(fieldDefinition?.typeName) ? row[column.key] : typer.toLocalString(row[column.key]) : null);
2919
- const isCommitInProgress = import_react20.default.useRef(false);
2920
- const [expansion, setExpansion] = (0, import_react20.useState)(null);
2921
- const menuAbierto = import_react20.default.useRef(false);
2922
- const entradaRef = import_react20.default.useRef(null);
3020
+ const typer = (0, import_react21.useMemo)(() => import_type_store4.default.typerFrom(fieldDefinition), [fieldDefinition]);
3021
+ const [editingValue, setEditingValue] = (0, import_react21.useState)(() => row[column.key] !== null ? isNumericType(fieldDefinition?.typeName) ? row[column.key] : typer.toLocalString(row[column.key]) : null);
3022
+ const isCommitInProgress = import_react21.default.useRef(false);
3023
+ const entradaRef = import_react21.default.useRef(null);
2923
3024
  const theme = (0, import_material14.useTheme)();
2924
3025
  const { showSuccess, showError } = useSnackbar();
2925
3026
  const { saveRecord } = useTableRecordSave();
@@ -2934,8 +3035,8 @@ function InputRenderer({
2934
3035
  cellBackgroundColor = currentCellFeedback.type === "error" ? theme.palette.error.light : theme.palette.success.light;
2935
3036
  cellBorderColor = currentCellFeedback.type === "error" ? theme.palette.error.main : theme.palette.success.main;
2936
3037
  }
2937
- const initialRowId = (0, import_react20.useMemo)(() => getPrimaryKeyValues(row, primaryKey), [row, primaryKey]);
2938
- const handleCommit = (0, import_react20.useCallback)(async (currentValue, closeEditor, focusNextCell) => {
3038
+ const initialRowId = (0, import_react21.useMemo)(() => getPrimaryKeyValues(row, primaryKey), [row, primaryKey]);
3039
+ const handleCommit = (0, import_react21.useCallback)(async (currentValue, closeEditor, focusNextCell) => {
2939
3040
  if (isCommitInProgress.current) return;
2940
3041
  isCommitInProgress.current = true;
2941
3042
  let processedNewValue;
@@ -3078,49 +3179,30 @@ function InputRenderer({
3078
3179
  initialRowId,
3079
3180
  typer
3080
3181
  ]);
3081
- const tipoExpander = tipoDeExpander(fieldDefinition, fieldDefinition.editable !== false);
3082
- const abrirExpander = (0, import_react20.useCallback)(async (busqueda) => {
3083
- if (tipoExpander === null || tipoExpander === "json" || menuAbierto.current) return;
3084
- menuAbierto.current = true;
3085
- const admiteNulo = fieldDefinition.nullable !== false;
3086
- try {
3087
- if (tipoExpander === "referencia" && esCampoConReferencia(fieldDefinition)) {
3088
- const { definicion, filas } = await cargarReferencia(fieldDefinition.references);
3089
- setExpansion({ tipo: "opciones", opciones: opcionesDeReferencia(fieldDefinition, definicion, filas, row, admiteNulo), busqueda });
3090
- } else if (tipoExpander === "booleano") {
3091
- setExpansion({ tipo: "opciones", opciones: opcionesDeBooleano(admiteNulo), busqueda });
3092
- } else if (tipoExpander === "opciones") {
3093
- setExpansion({ tipo: "opciones", opciones: opcionesDeEnumerado(fieldDefinition.options ?? [], admiteNulo), busqueda });
3094
- } else {
3095
- setExpansion({ tipo: tipoExpander === "fecha" ? "fecha" : "texto" });
3096
- }
3097
- } catch (err) {
3098
- menuAbierto.current = false;
3099
- showError(mensajeDeError(err));
3100
- }
3101
- }, [tipoExpander, fieldDefinition, row, showError]);
3102
- const cerrarExpansion = (0, import_react20.useCallback)(() => {
3103
- menuAbierto.current = false;
3104
- setExpansion(null);
3105
- setTimeout(() => entradaRef.current?.focus(), 0);
3106
- }, []);
3107
- const confirmarEnExpansion = (0, import_react20.useCallback)((nuevo) => {
3182
+ const confirmarEnExpansion = (0, import_react21.useCallback)((nuevo) => {
3108
3183
  setEditingValue(nuevo);
3109
- cerrarExpansion();
3110
3184
  void handleCommit(nuevo, true, false);
3111
- }, [cerrarExpansion, handleCommit]);
3112
- const elegirOpcion = (0, import_react20.useCallback)((valor) => {
3185
+ }, [handleCommit]);
3186
+ const elegirOpcion = (0, import_react21.useCallback)((valor) => {
3113
3187
  confirmarEnExpansion(valor === null || valor === void 0 ? null : typeof valor === "boolean" || isNumericType(fieldDefinition.typeName) ? valor : typer.toLocalString(valor));
3114
3188
  }, [fieldDefinition.typeName, typer, confirmarEnExpansion]);
3115
- const handleKeyDown = (0, import_react20.useCallback)(async (event) => {
3116
- if (tipoExpander !== null && (event.key === "F9" && !event.shiftKey && !event.ctrlKey && !event.altKey || event.key === "ArrowDown" && event.altKey && !event.shiftKey && !event.ctrlKey)) {
3117
- event.preventDefault();
3118
- void abrirExpander("");
3119
- return;
3120
- }
3189
+ const expander = useExpander({
3190
+ campo: fieldDefinition,
3191
+ editable: fieldDefinition.editable !== false,
3192
+ fila: row,
3193
+ admiteNulo: fieldDefinition.nullable !== false,
3194
+ anclaje: entradaRef,
3195
+ textoActual: editingValue === null || editingValue === void 0 ? "" : String(editingValue),
3196
+ valorActual: row[column.key],
3197
+ alElegirValor: elegirOpcion,
3198
+ alConfirmarTexto: confirmarEnExpansion,
3199
+ alFallar: showError
3200
+ });
3201
+ const handleKeyDown = (0, import_react21.useCallback)(async (event) => {
3202
+ if (expander.manejarTecla(event)) return;
3121
3203
  if (event.key.length === 1 && !event.ctrlKey && !event.altKey && !event.metaKey && caracterRechazado(event.key, typer)) {
3122
3204
  event.preventDefault();
3123
- if (tipoExpander === "referencia") void abrirExpander(event.key);
3205
+ if (expander.tipo === "referencia") void expander.abrir(event.key);
3124
3206
  return;
3125
3207
  }
3126
3208
  if (event.key === "F4") {
@@ -3133,24 +3215,24 @@ function InputRenderer({
3133
3215
  if (onKeyPress?.(rowIdx, column.key, event, handleCommit, editingValue)) {
3134
3216
  event.preventDefault();
3135
3217
  }
3136
- }, [handleCommit, editingValue, column.key, rowIdx, onKeyPress, tipoExpander, abrirExpander, typer]);
3137
- const procesarTecla = import_react20.default.useRef(() => {
3218
+ }, [handleCommit, editingValue, column.key, rowIdx, onKeyPress, expander, typer]);
3219
+ const procesarTecla = import_react21.default.useRef(() => {
3138
3220
  });
3139
3221
  procesarTecla.current = (key) => {
3140
3222
  if (key === "F9") {
3141
- void abrirExpander("");
3223
+ void expander.abrir("");
3142
3224
  } else if (key === "F4" && onKeyPress) {
3143
3225
  onKeyPress(rowIdx, column.key, { key, target: document.activeElement ?? document.body }, handleCommit, editingValue);
3144
3226
  }
3145
3227
  };
3146
- (0, import_react20.useEffect)(() => registrarEditor?.((key) => procesarTecla.current(key)), []);
3147
- const handleBlur = (0, import_react20.useCallback)(() => {
3148
- if (menuAbierto.current) return;
3228
+ (0, import_react21.useEffect)(() => registrarEditor?.((key) => procesarTecla.current(key)), []);
3229
+ const handleBlur = (0, import_react21.useCallback)(() => {
3230
+ if (expander.abierto.current) return;
3149
3231
  handleCommit(editingValue, true, false);
3150
3232
  }, [handleCommit, editingValue]);
3151
3233
  const isFieldEditable = fieldDefinition?.editable !== false;
3152
3234
  const isNumeric = isNumericType(fieldDefinition?.typeName);
3153
- const editor = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3235
+ const editor = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3154
3236
  import_InputBase.default,
3155
3237
  {
3156
3238
  autoFocus: true,
@@ -3183,61 +3265,19 @@ function InputRenderer({
3183
3265
  },
3184
3266
  onClick: (e) => e.stopPropagation(),
3185
3267
  disabled: !isFieldEditable,
3186
- endAdornment: tipoExpander !== null && tipoExpander !== "json" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3187
- import_IconButton.default,
3188
- {
3189
- size: "small",
3190
- tabIndex: -1,
3191
- "aria-label": tipoExpander === "fecha" ? "elegir fecha" : tipoExpander === "texto" ? "ver el contenido completo" : "elegir un valor",
3192
- title: tipoExpander === "fecha" ? "elegir fecha (F9)" : tipoExpander === "texto" ? "ver el contenido completo (F9)" : "elegir un valor (F9)",
3193
- onMouseDown: (e) => e.preventDefault(),
3194
- onClick: (e) => {
3195
- e.stopPropagation();
3196
- void abrirExpander("");
3197
- },
3198
- sx: { p: 0, ml: 0.25, color: "primary.main", "&:hover": { backgroundColor: "action.hover" } },
3199
- children: tipoExpander === "fecha" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_CalendarMonth.default, { sx: { fontSize: 16 } }) : tipoExpander === "texto" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_Search2.default, { sx: { fontSize: 16 } }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_ArrowDropDown.default, { sx: { fontSize: 20 } })
3200
- }
3201
- )
3268
+ endAdornment: expander.lupa
3202
3269
  }
3203
3270
  );
3204
- const conMenu = /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
3271
+ const conMenu = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
3205
3272
  editor,
3206
- expansion && entradaRef.current && (expansion.tipo === "opciones" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3207
- MenuDeOpciones,
3208
- {
3209
- anclaje: entradaRef.current,
3210
- opciones: expansion.opciones,
3211
- busquedaInicial: expansion.busqueda,
3212
- onElegir: elegirOpcion,
3213
- onCerrar: cerrarExpansion
3214
- }
3215
- ) : expansion.tipo === "fecha" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3216
- SelectorDeFecha,
3217
- {
3218
- anclaje: entradaRef.current,
3219
- fechaActual: fechaDeValor(row[column.key]),
3220
- admiteNulo: fieldDefinition.nullable !== false,
3221
- onElegir: confirmarEnExpansion,
3222
- onCerrar: cerrarExpansion
3223
- }
3224
- ) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3225
- VentanaDeTexto,
3226
- {
3227
- anclaje: entradaRef.current,
3228
- texto: editingValue === null || editingValue === void 0 ? "" : String(editingValue),
3229
- editable: true,
3230
- onAceptar: confirmarEnExpansion,
3231
- onCerrar: cerrarExpansion
3232
- }
3233
- ))
3273
+ expander.ventana
3234
3274
  ] });
3235
- return currentCellFeedback?.message ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_material14.Tooltip, { title: currentCellFeedback.message, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { width: "100%" }, children: conMenu }) }) : conMenu;
3275
+ return currentCellFeedback?.message ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_material14.Tooltip, { title: currentCellFeedback.message, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { width: "100%" }, children: conMenu }) }) : conMenu;
3236
3276
  }
3237
3277
  var InputRenderer_default = InputRenderer;
3238
3278
 
3239
3279
  // src/components/grid/renderers/editCellRenderers.tsx
3240
- var import_jsx_runtime17 = require("react/jsx-runtime");
3280
+ var import_jsx_runtime18 = require("react/jsx-runtime");
3241
3281
  var allColumnsEditCellRenderer = (props, allColumns) => {
3242
3282
  const column = props.column;
3243
3283
  if (!esColumnaPropia(column)) return void 0;
@@ -3259,7 +3299,7 @@ var allColumnsEditCellRenderer = (props, allColumns) => {
3259
3299
  if (!isFieldEditableByUI) {
3260
3300
  return void 0;
3261
3301
  }
3262
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3302
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3263
3303
  InputRenderer_default,
3264
3304
  {
3265
3305
  ...props,
@@ -3331,7 +3371,7 @@ var useGridColumns = ({
3331
3371
  toggleFilterVisibility,
3332
3372
  abrirOpcionesDeGrilla
3333
3373
  }) => {
3334
- const columns = (0, import_react21.useMemo)(() => {
3374
+ const columns = (0, import_react22.useMemo)(() => {
3335
3375
  if (!tableDefinition) return [];
3336
3376
  const fieldsToShow = tableDefinition.fields.filter((field) => {
3337
3377
  return !columnaOcultaPorFixedField(fixedFields, field.name) && field.visible !== false;
@@ -3382,7 +3422,7 @@ var useGridColumns = ({
3382
3422
  editable: false,
3383
3423
  resizable: false,
3384
3424
  sortable: false,
3385
- renderHeaderCell: () => import_react21.default.createElement(ActionsColumnHeaderCell, {
3425
+ renderHeaderCell: () => import_react22.default.createElement(ActionsColumnHeaderCell, {
3386
3426
  toggleFilterVisibility,
3387
3427
  handleDataGridOptions: (e) => abrirOpcionesDeGrilla(e.currentTarget),
3388
3428
  handleAddRow,
@@ -3427,13 +3467,13 @@ var useGridColumns = ({
3427
3467
  };
3428
3468
 
3429
3469
  // src/components/grid/ImportDialog.tsx
3430
- var import_react22 = require("react");
3470
+ var import_react23 = require("react");
3431
3471
  var import_material15 = require("@mui/material");
3432
3472
  var import_FileUpload2 = __toESM(require("@mui/icons-material/FileUpload"), 1);
3433
- var import_jsx_runtime18 = require("react/jsx-runtime");
3473
+ var import_jsx_runtime19 = require("react/jsx-runtime");
3434
3474
  var ImportDialog = ({ open, onClose, onImport, loading }) => {
3435
- const [file, setFile] = (0, import_react22.useState)(null);
3436
- const [options, setOptions] = (0, import_react22.useState)({
3475
+ const [file, setFile] = (0, import_react23.useState)(null);
3476
+ const [options, setOptions] = (0, import_react23.useState)({
3437
3477
  skipUnknownFieldsAtImport: false,
3438
3478
  simplificateSpaces: true,
3439
3479
  replaceNewLineWithSpace: true
@@ -3452,15 +3492,15 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
3452
3492
  onClose();
3453
3493
  }
3454
3494
  };
3455
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material15.Dialog, { open, onClose: loading ? void 0 : onClose, maxWidth: "sm", fullWidth: true, children: [
3456
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material15.DialogTitle, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
3457
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_FileUpload2.default, { color: "primary" }),
3495
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material15.Dialog, { open, onClose: loading ? void 0 : onClose, maxWidth: "sm", fullWidth: true, children: [
3496
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material15.DialogTitle, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
3497
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_FileUpload2.default, { color: "primary" }),
3458
3498
  "Importar datos desde archivo"
3459
3499
  ] }),
3460
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.DialogContent, { dividers: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material15.Stack, { spacing: 3, sx: { mt: 1 }, children: [
3461
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material15.Box, { children: [
3462
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.Typography, { variant: "subtitle2", gutterBottom: true, fontWeight: "bold", children: "Seleccionar archivo" }),
3463
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3500
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material15.DialogContent, { dividers: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material15.Stack, { spacing: 3, sx: { mt: 1 }, children: [
3501
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material15.Box, { children: [
3502
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material15.Typography, { variant: "subtitle2", gutterBottom: true, fontWeight: "bold", children: "Seleccionar archivo" }),
3503
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
3464
3504
  import_material15.Box,
3465
3505
  {
3466
3506
  sx: {
@@ -3473,7 +3513,7 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
3473
3513
  position: "relative"
3474
3514
  },
3475
3515
  children: [
3476
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3516
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3477
3517
  "input",
3478
3518
  {
3479
3519
  type: "file",
@@ -3490,19 +3530,19 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
3490
3530
  }
3491
3531
  }
3492
3532
  ),
3493
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.Typography, { variant: "body2", color: file ? "textPrimary" : "textSecondary", children: file ? file.name : "Haz clic aqu\xED para seleccionar un archivo" })
3533
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material15.Typography, { variant: "body2", color: file ? "textPrimary" : "textSecondary", children: file ? file.name : "Haz clic aqu\xED para seleccionar un archivo" })
3494
3534
  ]
3495
3535
  }
3496
3536
  )
3497
3537
  ] }),
3498
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.Divider, {}),
3499
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material15.Box, { children: [
3500
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.Typography, { variant: "subtitle2", gutterBottom: true, fontWeight: "bold", children: "Opciones de importaci\xF3n" }),
3501
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material15.Stack, { children: [
3502
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3538
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material15.Divider, {}),
3539
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material15.Box, { children: [
3540
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material15.Typography, { variant: "subtitle2", gutterBottom: true, fontWeight: "bold", children: "Opciones de importaci\xF3n" }),
3541
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material15.Stack, { children: [
3542
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3503
3543
  import_material15.FormControlLabel,
3504
3544
  {
3505
- control: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3545
+ control: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3506
3546
  import_material15.Checkbox,
3507
3547
  {
3508
3548
  checked: options.skipUnknownFieldsAtImport,
@@ -3510,13 +3550,13 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
3510
3550
  size: "small"
3511
3551
  }
3512
3552
  ),
3513
- label: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.Typography, { variant: "body2", children: "Omitir campos desconocidos al importar" })
3553
+ label: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material15.Typography, { variant: "body2", children: "Omitir campos desconocidos al importar" })
3514
3554
  }
3515
3555
  ),
3516
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3556
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3517
3557
  import_material15.FormControlLabel,
3518
3558
  {
3519
- control: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3559
+ control: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3520
3560
  import_material15.Checkbox,
3521
3561
  {
3522
3562
  checked: options.simplificateSpaces,
@@ -3524,13 +3564,13 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
3524
3564
  size: "small"
3525
3565
  }
3526
3566
  ),
3527
- label: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.Typography, { variant: "body2", children: "Simplificar espacios" })
3567
+ label: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material15.Typography, { variant: "body2", children: "Simplificar espacios" })
3528
3568
  }
3529
3569
  ),
3530
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3570
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3531
3571
  import_material15.FormControlLabel,
3532
3572
  {
3533
- control: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3573
+ control: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3534
3574
  import_material15.Checkbox,
3535
3575
  {
3536
3576
  checked: options.replaceNewLineWithSpace,
@@ -3538,21 +3578,21 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
3538
3578
  size: "small"
3539
3579
  }
3540
3580
  ),
3541
- label: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.Typography, { variant: "body2", children: "Reemplazar saltos de l\xEDnea con espacios" })
3581
+ label: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material15.Typography, { variant: "body2", children: "Reemplazar saltos de l\xEDnea con espacios" })
3542
3582
  }
3543
3583
  )
3544
3584
  ] })
3545
3585
  ] })
3546
3586
  ] }) }),
3547
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_material15.DialogActions, { sx: { px: 3, py: 2 }, children: [
3548
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_material15.Button, { onClick: onClose, disabled: loading, children: "Cancelar" }),
3549
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3587
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material15.DialogActions, { sx: { px: 3, py: 2 }, children: [
3588
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material15.Button, { onClick: onClose, disabled: loading, children: "Cancelar" }),
3589
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3550
3590
  import_material15.Button,
3551
3591
  {
3552
3592
  onClick: handleConfirm,
3553
3593
  variant: "contained",
3554
3594
  disabled: !file || loading,
3555
- startIcon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_FileUpload2.default, {}),
3595
+ startIcon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_FileUpload2.default, {}),
3556
3596
  children: loading ? "Procesando..." : "Confirmar Importaci\xF3n"
3557
3597
  }
3558
3598
  )
@@ -3561,11 +3601,11 @@ var ImportDialog = ({ open, onClose, onImport, loading }) => {
3561
3601
  };
3562
3602
 
3563
3603
  // src/components/grid/ExportDialog.tsx
3564
- var import_react23 = require("react");
3604
+ var import_react24 = require("react");
3565
3605
  var import_material16 = require("@mui/material");
3566
3606
  var XLSX = __toESM(require("xlsx"), 1);
3567
3607
  var import_type_store5 = __toESM(require("type-store"), 1);
3568
- var import_jsx_runtime19 = require("react/jsx-runtime");
3608
+ var import_jsx_runtime20 = require("react/jsx-runtime");
3569
3609
  var ExportDialog = ({
3570
3610
  open,
3571
3611
  onClose,
@@ -3574,13 +3614,13 @@ var ExportDialog = ({
3574
3614
  filteredRows,
3575
3615
  username = "anonymous"
3576
3616
  }) => {
3577
- const [format, setFormat] = (0, import_react23.useState)("xlsx");
3578
- const [options, setOptions] = (0, import_react23.useState)({
3617
+ const [format, setFormat] = (0, import_react24.useState)("xlsx");
3618
+ const [options, setOptions] = (0, import_react24.useState)({
3579
3619
  fromOtherTables: true,
3580
3620
  readOnly: true,
3581
3621
  hiddens: false
3582
3622
  });
3583
- const [isPreparing, setIsPreparing] = (0, import_react23.useState)(false);
3623
+ const [isPreparing, setIsPreparing] = (0, import_react24.useState)(false);
3584
3624
  const handleOptionChange = (event) => {
3585
3625
  setOptions({
3586
3626
  ...options,
@@ -3710,66 +3750,66 @@ var ExportDialog = ({
3710
3750
  URL.revokeObjectURL(url);
3711
3751
  }, 0);
3712
3752
  };
3713
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material16.Dialog, { open, onClose, maxWidth: "xs", fullWidth: true, children: [
3714
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.DialogTitle, { children: "Exportar Datos" }),
3715
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.DialogContent, { children: isPreparing ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material16.Box, { display: "flex", flexDirection: "column", alignItems: "center", py: 4, children: [
3716
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.CircularProgress, {}),
3717
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.Typography, { sx: { mt: 2 }, children: "Preparando exportaci\xF3n..." })
3718
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material16.Box, { sx: { mt: 1 }, children: [
3719
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material16.FormControl, { component: "fieldset", children: [
3720
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.FormLabel, { component: "legend", children: "Formato" }),
3721
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
3753
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material16.Dialog, { open, onClose, maxWidth: "xs", fullWidth: true, children: [
3754
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.DialogTitle, { children: "Exportar Datos" }),
3755
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.DialogContent, { children: isPreparing ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material16.Box, { display: "flex", flexDirection: "column", alignItems: "center", py: 4, children: [
3756
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.CircularProgress, {}),
3757
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Typography, { sx: { mt: 2 }, children: "Preparando exportaci\xF3n..." })
3758
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material16.Box, { sx: { mt: 1 }, children: [
3759
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material16.FormControl, { component: "fieldset", children: [
3760
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.FormLabel, { component: "legend", children: "Formato" }),
3761
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
3722
3762
  import_material16.RadioGroup,
3723
3763
  {
3724
3764
  value: format,
3725
3765
  onChange: (e) => setFormat(e.target.value),
3726
3766
  children: [
3727
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.FormControlLabel, { value: "xlsx", control: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.Radio, {}), label: "Excel (.xlsx)" }),
3728
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.FormControlLabel, { value: "tab", control: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.Radio, {}), label: "Tabulado (.tab | )" }),
3729
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.FormControlLabel, { value: "csv", control: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.Radio, {}), label: "CSV (.csv , )" })
3767
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.FormControlLabel, { value: "xlsx", control: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Radio, {}), label: "Excel (.xlsx)" }),
3768
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.FormControlLabel, { value: "tab", control: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Radio, {}), label: "Tabulado (.tab | )" }),
3769
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.FormControlLabel, { value: "csv", control: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Radio, {}), label: "CSV (.csv , )" })
3730
3770
  ]
3731
3771
  }
3732
3772
  )
3733
3773
  ] }),
3734
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material16.Box, { sx: { mt: 3 }, children: [
3735
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.Typography, { variant: "subtitle2", gutterBottom: true, children: "Opciones de campos:" }),
3736
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material16.FormGroup, { children: [
3737
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3774
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material16.Box, { sx: { mt: 3 }, children: [
3775
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Typography, { variant: "subtitle2", gutterBottom: true, children: "Opciones de campos:" }),
3776
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material16.FormGroup, { children: [
3777
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3738
3778
  import_material16.FormControlLabel,
3739
3779
  {
3740
- control: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.Checkbox, { checked: options.fromOtherTables, onChange: handleOptionChange, name: "fromOtherTables" }),
3780
+ control: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Checkbox, { checked: options.fromOtherTables, onChange: handleOptionChange, name: "fromOtherTables" }),
3741
3781
  label: "Desde otras tablas"
3742
3782
  }
3743
3783
  ),
3744
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3784
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3745
3785
  import_material16.FormControlLabel,
3746
3786
  {
3747
- control: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.Checkbox, { checked: options.readOnly, onChange: handleOptionChange, name: "readOnly" }),
3787
+ control: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Checkbox, { checked: options.readOnly, onChange: handleOptionChange, name: "readOnly" }),
3748
3788
  label: "Solo lectura"
3749
3789
  }
3750
3790
  ),
3751
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3791
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3752
3792
  import_material16.FormControlLabel,
3753
3793
  {
3754
- control: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.Checkbox, { checked: options.hiddens, onChange: handleOptionChange, name: "hiddens" }),
3794
+ control: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Checkbox, { checked: options.hiddens, onChange: handleOptionChange, name: "hiddens" }),
3755
3795
  label: "Ocultos"
3756
3796
  }
3757
3797
  )
3758
3798
  ] })
3759
3799
  ] })
3760
3800
  ] }) }),
3761
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_material16.DialogActions, { children: [
3762
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.Button, { onClick: onClose, disabled: isPreparing, children: "Cancelar" }),
3763
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_material16.Button, { onClick: handlePrepareExport, variant: "contained", disabled: isPreparing, children: "Descargar" })
3801
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material16.DialogActions, { children: [
3802
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Button, { onClick: onClose, disabled: isPreparing, children: "Cancelar" }),
3803
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material16.Button, { onClick: handlePrepareExport, variant: "contained", disabled: isPreparing, children: "Descargar" })
3764
3804
  ] })
3765
3805
  ] });
3766
3806
  };
3767
3807
 
3768
3808
  // src/pages/VerticalEditorPage.tsx
3769
- var import_react24 = require("react");
3809
+ var import_react25 = require("react");
3770
3810
  var import_material17 = require("@mui/material");
3771
3811
  var import_Close = __toESM(require("@mui/icons-material/Close"), 1);
3772
- var import_jsx_runtime20 = require("react/jsx-runtime");
3812
+ var import_jsx_runtime21 = require("react/jsx-runtime");
3773
3813
  var VerticalEditorPage = ({
3774
3814
  tableName,
3775
3815
  tableDefinition,
@@ -3780,20 +3820,20 @@ var VerticalEditorPage = ({
3780
3820
  onClose
3781
3821
  }) => {
3782
3822
  const { saveRecord } = useTableRecordSave();
3783
- const [internalIsNewRow, setInternalIsNewRow] = (0, import_react24.useState)(isNewRow);
3784
- const [formData, setFormData] = (0, import_react24.useState)(initialData);
3785
- const [lastSavedData, setLastSavedData] = (0, import_react24.useState)(initialData);
3786
- const [validityMap, setValidityMap] = (0, import_react24.useState)({});
3787
- const [globalError, setGlobalError] = (0, import_react24.useState)(null);
3788
- const [isSaving, setIsSaving] = (0, import_react24.useState)(false);
3789
- const [fieldFeedback, setFieldFeedback] = (0, import_react24.useState)({});
3790
- const feedbackTimersRef = (0, import_react24.useRef)({});
3791
- const handleFieldChange = (0, import_react24.useCallback)((fieldName, newValue, isValid) => {
3823
+ const [internalIsNewRow, setInternalIsNewRow] = (0, import_react25.useState)(isNewRow);
3824
+ const [formData, setFormData] = (0, import_react25.useState)(initialData);
3825
+ const [lastSavedData, setLastSavedData] = (0, import_react25.useState)(initialData);
3826
+ const [validityMap, setValidityMap] = (0, import_react25.useState)({});
3827
+ const [globalError, setGlobalError] = (0, import_react25.useState)(null);
3828
+ const [isSaving, setIsSaving] = (0, import_react25.useState)(false);
3829
+ const [fieldFeedback, setFieldFeedback] = (0, import_react25.useState)({});
3830
+ const feedbackTimersRef = (0, import_react25.useRef)({});
3831
+ const handleFieldChange = (0, import_react25.useCallback)((fieldName, newValue, isValid) => {
3792
3832
  setFormData((prev) => ({ ...prev, [fieldName]: newValue }));
3793
3833
  setValidityMap((prev) => ({ ...prev, [fieldName]: isValid }));
3794
3834
  setGlobalError(null);
3795
3835
  }, []);
3796
- const isFormValid = (0, import_react24.useMemo)(() => {
3836
+ const isFormValid = (0, import_react25.useMemo)(() => {
3797
3837
  for (const key in validityMap) {
3798
3838
  if (validityMap[key] === false) return false;
3799
3839
  }
@@ -3806,7 +3846,7 @@ var VerticalEditorPage = ({
3806
3846
  }
3807
3847
  return true;
3808
3848
  }, [formData, validityMap, tableDefinition.fields]);
3809
- const handleCommit = (0, import_react24.useCallback)(async (fieldName, newValue, isValid) => {
3849
+ const handleCommit = (0, import_react25.useCallback)(async (fieldName, newValue, isValid) => {
3810
3850
  if (!isValid) return;
3811
3851
  if (sameValue(newValue, lastSavedData[fieldName])) {
3812
3852
  return;
@@ -3896,21 +3936,21 @@ var VerticalEditorPage = ({
3896
3936
  tableDefinition,
3897
3937
  onSaveSuccess
3898
3938
  ]);
3899
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material17.Box, { sx: { p: 2, display: "flex", flexDirection: "column", height: "100%" }, children: [
3900
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material17.DialogTitle, { sx: { px: 0, pt: 0, display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
3901
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material17.Typography, { component: "div", variant: "h6", children: [
3939
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.Box, { sx: { p: 2, display: "flex", flexDirection: "column", height: "100%" }, children: [
3940
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.DialogTitle, { sx: { px: 0, pt: 0, display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
3941
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.Typography, { component: "div", variant: "h6", children: [
3902
3942
  isNewRow ? "Nuevo Registro" : "Editar Registro",
3903
3943
  " - ",
3904
3944
  tableDefinition.title || tableName
3905
3945
  ] }),
3906
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material17.IconButton, { onClick: onClose, size: "small", edge: "end", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_Close.default, {}) })
3946
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.IconButton, { onClick: onClose, size: "small", edge: "end", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_Close.default, {}) })
3907
3947
  ] }),
3908
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material17.DialogContent, { dividers: true, sx: { px: 2, flexGrow: 1, py: 1 }, children: [
3909
- globalError && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material17.Alert, { severity: "error", sx: { mb: 2 }, children: globalError }),
3910
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material17.Box, { sx: { display: "flex", flexDirection: "column", gap: 0.5 }, children: tableDefinition.fields.map((field) => {
3948
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.DialogContent, { dividers: true, sx: { px: 2, flexGrow: 1, py: 1 }, children: [
3949
+ globalError && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Alert, { severity: "error", sx: { mb: 2 }, children: globalError }),
3950
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Box, { sx: { display: "flex", flexDirection: "column", gap: 0.5 }, children: tableDefinition.fields.map((field) => {
3911
3951
  const isFixed = fixedFields?.some((ff) => ff.fieldName === field.name);
3912
3952
  const isMandatory = field.nullable === false || tableDefinition.primaryKey.includes(field.name);
3913
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material17.Box, { sx: { width: "100%", maxWidth: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3953
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Box, { sx: { width: "100%", maxWidth: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3914
3954
  TypedField,
3915
3955
  {
3916
3956
  fieldDef: field,
@@ -3924,12 +3964,12 @@ var VerticalEditorPage = ({
3924
3964
  ) }, field.name);
3925
3965
  }) })
3926
3966
  ] }),
3927
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material17.DialogActions, { sx: { px: 0, pb: 0, pt: 2, justifyContent: "space-between", alignItems: "center" }, children: [
3928
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_material17.Box, { children: [
3929
- isSaving && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material17.CircularProgress, { size: 20, sx: { ml: 2 } }),
3930
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { style: { marginLeft: 10, fontSize: "0.8rem", color: "#666" }, children: isSaving ? "Guardando..." : "Cambios auto-guardados" })
3967
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.DialogActions, { sx: { px: 0, pb: 0, pt: 2, justifyContent: "space-between", alignItems: "center" }, children: [
3968
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material17.Box, { children: [
3969
+ isSaving && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.CircularProgress, { size: 20, sx: { ml: 2 } }),
3970
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { marginLeft: 10, fontSize: "0.8rem", color: "#666" }, children: isSaving ? "Guardando..." : "Cambios auto-guardados" })
3931
3971
  ] }),
3932
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_material17.Button, { variant: "outlined", onClick: onClose, children: "Cerrar" })
3972
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material17.Button, { variant: "outlined", onClick: onClose, children: "Cerrar" })
3933
3973
  ] })
3934
3974
  ] });
3935
3975
  };
@@ -4007,7 +4047,7 @@ var baseDelBundler = import_meta2.env?.BASE_URL ?? "/";
4007
4047
  var rutaBase = baseDelBundler.replace(/\/+$/, "");
4008
4048
 
4009
4049
  // src/components/grid/GenericDataGrid.tsx
4010
- var import_jsx_runtime21 = require("react/jsx-runtime");
4050
+ var import_jsx_runtime22 = require("react/jsx-runtime");
4011
4051
  var SUMMARY_ROW_HEIGHT = 35;
4012
4052
  var FILTER_ROW_HEIGHT = 35;
4013
4053
  var HEADER_ROW_HEIGHT = 30;
@@ -4028,7 +4068,7 @@ var cargasEnCurso = /* @__PURE__ */ new Map();
4028
4068
  var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
4029
4069
  const theme = (0, import_material18.useTheme)();
4030
4070
  const { tableDefinition, row } = ancestor;
4031
- const columns = (0, import_react25.useMemo)(() => {
4071
+ const columns = (0, import_react26.useMemo)(() => {
4032
4072
  const filteredFields = tableDefinition.fields.filter(
4033
4073
  (field) => !fieldsToHide?.some((ff) => ff.fieldName === field.name)
4034
4074
  );
@@ -4039,7 +4079,7 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
4039
4079
  name: field.label || cambiarGuionesBajosPorEspacios(field.name),
4040
4080
  width: 150,
4041
4081
  editable: false,
4042
- renderHeaderCell: () => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Box, { sx: { p: 0.5, height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4082
+ renderHeaderCell: () => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Box, { sx: { p: 0.5, height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4043
4083
  import_material18.Typography,
4044
4084
  {
4045
4085
  variant: "caption",
@@ -4051,11 +4091,11 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
4051
4091
  children: field.label || cambiarGuionesBajosPorEspacios(field.name)
4052
4092
  }
4053
4093
  ) }),
4054
- renderCell: (props) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Box, { sx: { px: 1, height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Typography, { variant: "body2", sx: { fontSize: "0.875rem" }, noWrap: true, children: String(props.row[field.name] ?? "") }) })
4094
+ renderCell: (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Box, { sx: { px: 1, height: "100%", display: "flex", alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Typography, { variant: "body2", sx: { fontSize: "0.875rem" }, noWrap: true, children: String(props.row[field.name] ?? "") }) })
4055
4095
  };
4056
4096
  });
4057
4097
  }, [tableDefinition, fieldsToHide]);
4058
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material18.Box, { sx: {
4098
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: {
4059
4099
  mb: 1.5,
4060
4100
  ml: index * 4,
4061
4101
  // El primer ancestro (index 0) no tiene margen, los siguientes sí
@@ -4066,7 +4106,7 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
4066
4106
  boxShadow: theme.shadows[1],
4067
4107
  bgcolor: "background.paper"
4068
4108
  }, children: [
4069
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Box, { sx: {
4109
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Box, { sx: {
4070
4110
  bgcolor: "primary.main",
4071
4111
  color: "primary.contrastText",
4072
4112
  px: 1.5,
@@ -4077,8 +4117,8 @@ var StaticAncestorGrid = ({ ancestor, index, fieldsToHide }) => {
4077
4117
  alignItems: "center",
4078
4118
  fontWeight: "bold",
4079
4119
  gap: 1
4080
- }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Typography, { variant: "subtitle2", component: "div", children: cambiarGuionesBajosPorEspacios(ancestor.tableName) }) }),
4081
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4120
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Typography, { variant: "subtitle2", component: "div", children: cambiarGuionesBajosPorEspacios(ancestor.tableName) }) }),
4121
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4082
4122
  import_react_data_grid.DataGrid,
4083
4123
  {
4084
4124
  className: "rdg-light",
@@ -4111,42 +4151,42 @@ var GenericDataGrid = ({
4111
4151
  altoMaximoDetalle
4112
4152
  }) => {
4113
4153
  const claveFixedFields = JSON.stringify(fixedFieldsRecibidos ?? null);
4114
- const fixedFields = (0, import_react25.useMemo)(() => fixedFieldsRecibidos, [claveFixedFields]);
4154
+ const fixedFields = (0, import_react26.useMemo)(() => fixedFieldsRecibidos, [claveFixedFields]);
4115
4155
  const claveParametros = JSON.stringify([filterColumnsRecibidos ?? null, tableDefRecibido ?? null, parameterFunctionsRecibido ?? null, pickRecibido ?? null]);
4116
- const parametros = (0, import_react25.useMemo)(
4156
+ const parametros = (0, import_react26.useMemo)(
4117
4157
  () => ({ filterColumns: filterColumnsRecibidos, tableDef: tableDefRecibido, parameterFunctions: parameterFunctionsRecibido, pick: pickRecibido }),
4118
4158
  [claveParametros]
4119
4159
  // eslint-disable-line react-hooks/exhaustive-deps
4120
4160
  );
4121
- const cacheHeredado = (0, import_react25.useContext)(CacheGrillasContext);
4122
- const [cachePropio] = (0, import_react25.useState)(() => /* @__PURE__ */ new Map());
4161
+ const cacheHeredado = (0, import_react26.useContext)(CacheGrillasContext);
4162
+ const [cachePropio] = (0, import_react26.useState)(() => /* @__PURE__ */ new Map());
4123
4163
  const cache = cacheHeredado ?? cachePropio;
4124
- const [guardada] = (0, import_react25.useState)(() => claveCache ? cache.get(claveCache) : void 0);
4125
- const claveCargadaRef = (0, import_react25.useRef)(guardada ? `${tableName}|${claveFixedFields}|${claveParametros}` : null);
4126
- const [tableDefinition, setTableDefinition] = (0, import_react25.useState)(guardada?.tableDefinition ?? null);
4127
- const [tableData, setTableData] = (0, import_react25.useState)(guardada?.tableData ?? []);
4128
- const [cargandoInicial, setCargandoInicial] = (0, import_react25.useState)(!guardada);
4129
- const [errorDeCarga, setErrorDeCarga] = (0, import_react25.useState)(null);
4130
- const [anchosCalculados, setAnchosCalculados] = (0, import_react25.useState)(() => guardada?.anchosCalculados ?? /* @__PURE__ */ new Map());
4131
- const [detallesAbiertos, setDetallesAbiertos] = (0, import_react25.useState)(guardada?.detallesAbiertos ?? []);
4132
- const [altosDetalle, setAltosDetalle] = (0, import_react25.useState)(() => guardada?.altosDetalle ?? /* @__PURE__ */ new Map());
4133
- const [anchosDetalle, setAnchosDetalle] = (0, import_react25.useState)(() => /* @__PURE__ */ new Map());
4134
- const [selectedRows, setSelectedRows] = (0, import_react25.useState)(() => /* @__PURE__ */ new Set());
4135
- const [, setSelectedCell] = (0, import_react25.useState)(void 0);
4136
- const [estadoGrilla] = (0, import_react25.useState)(crearEstadoGrilla);
4164
+ const [guardada] = (0, import_react26.useState)(() => claveCache ? cache.get(claveCache) : void 0);
4165
+ const claveCargadaRef = (0, import_react26.useRef)(guardada ? `${tableName}|${claveFixedFields}|${claveParametros}` : null);
4166
+ const [tableDefinition, setTableDefinition] = (0, import_react26.useState)(guardada?.tableDefinition ?? null);
4167
+ const [tableData, setTableData] = (0, import_react26.useState)(guardada?.tableData ?? []);
4168
+ const [cargandoInicial, setCargandoInicial] = (0, import_react26.useState)(!guardada);
4169
+ const [errorDeCarga, setErrorDeCarga] = (0, import_react26.useState)(null);
4170
+ const [anchosCalculados, setAnchosCalculados] = (0, import_react26.useState)(() => guardada?.anchosCalculados ?? /* @__PURE__ */ new Map());
4171
+ const [detallesAbiertos, setDetallesAbiertos] = (0, import_react26.useState)(guardada?.detallesAbiertos ?? []);
4172
+ const [altosDetalle, setAltosDetalle] = (0, import_react26.useState)(() => guardada?.altosDetalle ?? /* @__PURE__ */ new Map());
4173
+ const [anchosDetalle, setAnchosDetalle] = (0, import_react26.useState)(() => /* @__PURE__ */ new Map());
4174
+ const [selectedRows, setSelectedRows] = (0, import_react26.useState)(() => /* @__PURE__ */ new Set());
4175
+ const [, setSelectedCell] = (0, import_react26.useState)(void 0);
4176
+ const [estadoGrilla] = (0, import_react26.useState)(crearEstadoGrilla);
4137
4177
  const theme = (0, import_material18.useTheme)();
4138
- const [openDataGridOptions, setOpenDataGridOptions] = (0, import_react25.useState)(false);
4139
- const [dataGridOptionsAnchorEl, setDataGridOptionsAnchorEl] = (0, import_react25.useState)(null);
4140
- const [exitingRowIds, setExitingRowIds] = (0, import_react25.useState)(/* @__PURE__ */ new Set());
4178
+ const [openDataGridOptions, setOpenDataGridOptions] = (0, import_react26.useState)(false);
4179
+ const [dataGridOptionsAnchorEl, setDataGridOptionsAnchorEl] = (0, import_react26.useState)(null);
4180
+ const [exitingRowIds, setExitingRowIds] = (0, import_react26.useState)(/* @__PURE__ */ new Set());
4141
4181
  const { showError } = useSnackbar();
4142
4182
  const { username: usuario } = useClientContext();
4143
- const dataGridRef = (0, import_react25.useRef)(null);
4144
- const rowAtEditStartRef = (0, import_react25.useRef)(null);
4145
- const [openImportDialog, setOpenImportDialog] = (0, import_react25.useState)(false);
4146
- const [openExportDialog, setOpenExportDialog] = (0, import_react25.useState)(false);
4147
- const [columnWidths, setColumnWidths] = (0, import_react25.useState)(() => /* @__PURE__ */ new Map());
4183
+ const dataGridRef = (0, import_react26.useRef)(null);
4184
+ const rowAtEditStartRef = (0, import_react26.useRef)(null);
4185
+ const [openImportDialog, setOpenImportDialog] = (0, import_react26.useState)(false);
4186
+ const [openExportDialog, setOpenExportDialog] = (0, import_react26.useState)(false);
4187
+ const [columnWidths, setColumnWidths] = (0, import_react26.useState)(() => /* @__PURE__ */ new Map());
4148
4188
  const { callApi, callApiUpload, loading } = useApiCall();
4149
- const primaryKey = (0, import_react25.useMemo)(() => {
4189
+ const primaryKey = (0, import_react26.useMemo)(() => {
4150
4190
  if (!tableDefinition) return ["id"];
4151
4191
  return tableDefinition.primaryKey && tableDefinition.primaryKey.length > 0 ? tableDefinition.primaryKey : ["id"];
4152
4192
  }, [tableDefinition]);
@@ -4165,9 +4205,9 @@ var GenericDataGrid = ({
4165
4205
  summaryData,
4166
4206
  resetView
4167
4207
  } = useGridDataView({ tableData, tableDefinition });
4168
- const abiertos = (0, import_react25.useMemo)(() => new Set(detallesAbiertos), [detallesAbiertos]);
4169
- const filasDetalleRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
4170
- const filasMostradas = (0, import_react25.useMemo)(() => {
4208
+ const abiertos = (0, import_react26.useMemo)(() => new Set(detallesAbiertos), [detallesAbiertos]);
4209
+ const filasDetalleRef = (0, import_react26.useRef)(/* @__PURE__ */ new Map());
4210
+ const filasMostradas = (0, import_react26.useMemo)(() => {
4171
4211
  const detailTables = tableDefinition?.detailTables ?? [];
4172
4212
  if (abiertos.size === 0 || detailTables.length === 0) return filteredRows;
4173
4213
  const anteriores = filasDetalleRef.current;
@@ -4194,8 +4234,8 @@ var GenericDataGrid = ({
4194
4234
  filasDetalleRef.current = nuevas;
4195
4235
  return filas;
4196
4236
  }, [filteredRows, abiertos, tableDefinition, primaryKey]);
4197
- const altoDeDetalle = (0, import_react25.useCallback)((clave) => altosDetalle.get(clave) ?? ALTO_INICIAL_DETALLE, [altosDetalle]);
4198
- const altoDetalles = (0, import_react25.useMemo)(
4237
+ const altoDeDetalle = (0, import_react26.useCallback)((clave) => altosDetalle.get(clave) ?? ALTO_INICIAL_DETALLE, [altosDetalle]);
4238
+ const altoDetalles = (0, import_react26.useMemo)(
4199
4239
  () => filasMostradas.reduce((total, row) => esFilaDetalle(row) ? total + altoDeDetalle(row.clave) : total, 0),
4200
4240
  [filasMostradas, altoDeDetalle]
4201
4241
  );
@@ -4241,9 +4281,9 @@ var GenericDataGrid = ({
4241
4281
  filasVisiblesMax,
4242
4282
  conPie
4243
4283
  });
4244
- const [contenidoDeCelda, setContenidoDeCelda] = (0, import_react25.useState)(null);
4245
- const verContenido = (0, import_react25.useCallback)((anclaje, texto) => setContenidoDeCelda({ anclaje, texto }), []);
4246
- const cerrarContenidoDeCelda = (0, import_react25.useCallback)(() => {
4284
+ const [contenidoDeCelda, setContenidoDeCelda] = (0, import_react26.useState)(null);
4285
+ const verContenido = (0, import_react26.useCallback)((anclaje, texto) => setContenidoDeCelda({ anclaje, texto }), []);
4286
+ const cerrarContenidoDeCelda = (0, import_react26.useCallback)(() => {
4247
4287
  const anclaje = contenidoDeCelda?.anclaje;
4248
4288
  setContenidoDeCelda(null);
4249
4289
  setTimeout(() => anclaje?.focus(), 0);
@@ -4259,8 +4299,8 @@ var GenericDataGrid = ({
4259
4299
  setSortColumns,
4260
4300
  verContenido
4261
4301
  });
4262
- const tableNameAnteriorRef = (0, import_react25.useRef)(tableName);
4263
- (0, import_react25.useEffect)(() => {
4302
+ const tableNameAnteriorRef = (0, import_react26.useRef)(tableName);
4303
+ (0, import_react26.useEffect)(() => {
4264
4304
  if (tableNameAnteriorRef.current === tableName) return;
4265
4305
  tableNameAnteriorRef.current = tableName;
4266
4306
  setDetallesAbiertos([]);
@@ -4274,7 +4314,7 @@ var GenericDataGrid = ({
4274
4314
  setExitingRowIds(/* @__PURE__ */ new Set());
4275
4315
  setColumnWidths(/* @__PURE__ */ new Map());
4276
4316
  }, [tableName, estadoGrilla, resetView]);
4277
- (0, import_react25.useEffect)(() => {
4317
+ (0, import_react26.useEffect)(() => {
4278
4318
  const claveCarga = `${tableName}|${claveFixedFields}|${claveParametros}`;
4279
4319
  if (claveCargadaRef.current === claveCarga) {
4280
4320
  if (guardada) setSortColumns(guardada.sortColumns);
@@ -4342,11 +4382,11 @@ var GenericDataGrid = ({
4342
4382
  vigente = false;
4343
4383
  };
4344
4384
  }, [tableName, claveFixedFields, fixedFields, claveParametros, parametros, showError, callApi, getInitialSortColumns, setSortColumns, aplicarFiltrosIniciales, guardada]);
4345
- (0, import_react25.useEffect)(() => {
4385
+ (0, import_react26.useEffect)(() => {
4346
4386
  if (!claveCache || !tableDefinition || cargandoInicial) return;
4347
4387
  cache.set(claveCache, { tableDefinition, tableData, anchosCalculados, sortColumns, detallesAbiertos, altosDetalle });
4348
4388
  }, [cache, claveCache, tableDefinition, tableData, anchosCalculados, sortColumns, detallesAbiertos, altosDetalle, cargandoInicial]);
4349
- (0, import_react25.useEffect)(() => {
4389
+ (0, import_react26.useEffect)(() => {
4350
4390
  let timer = null;
4351
4391
  const desuscribir = estadoGrilla.suscribir(() => {
4352
4392
  const hayExitos = Array.from(estadoGrilla.obtenerFeedback().values()).some((f) => f.type === "success");
@@ -4371,11 +4411,11 @@ var GenericDataGrid = ({
4371
4411
  if (timer) clearTimeout(timer);
4372
4412
  };
4373
4413
  }, [estadoGrilla]);
4374
- const resetSortingDeLaTabla = (0, import_react25.useCallback)(() => {
4414
+ const resetSortingDeLaTabla = (0, import_react26.useCallback)(() => {
4375
4415
  if (tableDefinition) resetSorting(tableDefinition);
4376
4416
  }, [tableDefinition, resetSorting]);
4377
- const abrirImportacion = (0, import_react25.useCallback)(() => setOpenImportDialog(true), []);
4378
- const abrirExportacion = (0, import_react25.useCallback)(() => setOpenExportDialog(true), []);
4417
+ const abrirImportacion = (0, import_react26.useCallback)(() => setOpenImportDialog(true), []);
4418
+ const abrirExportacion = (0, import_react26.useCallback)(() => setOpenExportDialog(true), []);
4379
4419
  const { menuOptions } = useGridMenu({
4380
4420
  tableDefinition,
4381
4421
  tableName,
@@ -4386,11 +4426,11 @@ var GenericDataGrid = ({
4386
4426
  triggerImport: abrirImportacion,
4387
4427
  triggerExport: abrirExportacion
4388
4428
  });
4389
- const abrirOpcionesDeGrilla = (0, import_react25.useCallback)((anchorEl) => {
4429
+ const abrirOpcionesDeGrilla = (0, import_react26.useCallback)((anchorEl) => {
4390
4430
  setDataGridOptionsAnchorEl(anchorEl);
4391
4431
  setOpenDataGridOptions(true);
4392
4432
  }, []);
4393
- const editarEnFicha = (0, import_react25.useCallback)((row) => {
4433
+ const editarEnFicha = (0, import_react26.useCallback)((row) => {
4394
4434
  rowAtEditStartRef.current = { ...row };
4395
4435
  handleVerticalEditRow(row);
4396
4436
  }, [handleVerticalEditRow]);
@@ -4408,7 +4448,7 @@ var GenericDataGrid = ({
4408
4448
  toggleFilterVisibility,
4409
4449
  abrirOpcionesDeGrilla
4410
4450
  });
4411
- const abrirDetalleEnPestana = (0, import_react25.useCallback)((row, detailTable) => {
4451
+ const abrirDetalleEnPestana = (0, import_react26.useCallback)((row, detailTable) => {
4412
4452
  if (!onOpenDetail || !tableDefinition || !detailTable.table) return;
4413
4453
  const porCampo = /* @__PURE__ */ new Map();
4414
4454
  [...fixedFields ?? [], ...calcularFixedFieldsDetalle(detailTable, row)].forEach((ff) => porCampo.set(ff.fieldName, ff));
@@ -4418,12 +4458,12 @@ var GenericDataGrid = ({
4418
4458
  const newAncestors = [...ancestors, { tableName: tableDefinition.name, row, tableDefinition, fixedFields: allFixedFields }];
4419
4459
  onOpenDetail(detailTable.table, allFixedFields, label, newAncestors);
4420
4460
  }, [onOpenDetail, tableDefinition, fixedFields, ancestors]);
4421
- const abrirWScreenEnPestana = (0, import_react25.useCallback)((row, detailTable) => {
4461
+ const abrirWScreenEnPestana = (0, import_react26.useCallback)((row, detailTable) => {
4422
4462
  const parametros2 = new URLSearchParams();
4423
4463
  calcularFixedFieldsDetalle(detailTable, row).forEach((ff) => parametros2.set(ff.fieldName, String(ff.value)));
4424
4464
  window.open(`${window.location.origin}${rutaBase}/wScreens/${detailTable.wScreen}?${parametros2}`, "_blank");
4425
4465
  }, []);
4426
- const alternarDetalle = (0, import_react25.useCallback)((row, rowId, detailTable, enOtraPestana) => {
4466
+ const alternarDetalle = (0, import_react26.useCallback)((row, rowId, detailTable, enOtraPestana) => {
4427
4467
  if (enOtraPestana && detailTable.wScreen) {
4428
4468
  abrirWScreenEnPestana(row, detailTable);
4429
4469
  return;
@@ -4435,8 +4475,8 @@ var GenericDataGrid = ({
4435
4475
  const clave = claveDetalle(rowId, detailTable);
4436
4476
  setDetallesAbiertos((anteriores) => anteriores.includes(clave) ? anteriores.filter((c) => c !== clave) : [...anteriores, clave]);
4437
4477
  }, [onOpenDetail, abrirDetalleEnPestana, abrirWScreenEnPestana]);
4438
- const [medidas, setMedidas] = (0, import_react25.useState)(null);
4439
- (0, import_react25.useEffect)(() => {
4478
+ const [medidas, setMedidas] = (0, import_react26.useState)(null);
4479
+ (0, import_react26.useEffect)(() => {
4440
4480
  const elemento = dataGridRef.current?.element;
4441
4481
  if (!elemento) return;
4442
4482
  const medir = () => setMedidas((anteriores) => {
@@ -4449,8 +4489,8 @@ var GenericDataGrid = ({
4449
4489
  return () => observador.disconnect();
4450
4490
  }, [tableDefinition, cargandoInicial]);
4451
4491
  const anchoVisible = medidas?.ancho ?? null;
4452
- const [altoDeVentana, setAltoDeVentana] = (0, import_react25.useState)(null);
4453
- (0, import_react25.useEffect)(() => {
4492
+ const [altoDeVentana, setAltoDeVentana] = (0, import_react26.useState)(null);
4493
+ (0, import_react26.useEffect)(() => {
4454
4494
  if (anidada) return;
4455
4495
  const elemento = dataGridRef.current?.element;
4456
4496
  if (!elemento) return;
@@ -4459,25 +4499,25 @@ var GenericDataGrid = ({
4459
4499
  window.addEventListener("resize", calcular);
4460
4500
  return () => window.removeEventListener("resize", calcular);
4461
4501
  }, [anidada, tableDefinition, cargandoInicial]);
4462
- const altoDeContexto = (0, import_react25.useContext)(AltoDisponibleContext);
4502
+ const altoDeContexto = (0, import_react26.useContext)(AltoDisponibleContext);
4463
4503
  const altoDeEstaGrilla = anidada ? altoDisponible ?? (altoDeContexto === void 0 ? void 0 : altoDeContexto - ALTO_TITULO_ANIDADA) : altoDeVentana ?? void 0;
4464
4504
  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);
4465
- const cambiarAnchoDetalle = (0, import_react25.useCallback)((clave, ancho) => {
4505
+ const cambiarAnchoDetalle = (0, import_react26.useCallback)((clave, ancho) => {
4466
4506
  setAnchosDetalle((anteriores) => anteriores.get(clave) === ancho ? anteriores : new Map(anteriores).set(clave, ancho));
4467
4507
  }, []);
4468
- const cambiarAltoDetalle = (0, import_react25.useCallback)((clave, altoDeseado2) => {
4508
+ const cambiarAltoDetalle = (0, import_react26.useCallback)((clave, altoDeseado2) => {
4469
4509
  const alto = Math.min(Math.max(Math.round(altoDeseado2), ALTO_MINIMO_DETALLE), altoMaximoDetalleEfectivo ?? Infinity);
4470
4510
  setAltosDetalle((anteriores) => anteriores.get(clave) === alto ? anteriores : new Map(anteriores).set(clave, alto));
4471
4511
  }, [altoMaximoDetalleEfectivo]);
4472
- const renderDetalle = (0, import_react25.useCallback)((fila) => {
4512
+ const renderDetalle = (0, import_react26.useCallback)((fila) => {
4473
4513
  const { detailTable } = fila;
4474
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4514
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4475
4515
  "div",
4476
4516
  {
4477
4517
  className: "fpr-detalle",
4478
4518
  style: { maxWidth: anchoVisible ? anchoVisible - 2 : void 0 },
4479
4519
  onKeyDown: (e) => e.stopPropagation(),
4480
- children: detailTable.table ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4520
+ children: detailTable.table ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4481
4521
  GenericDataGrid,
4482
4522
  {
4483
4523
  tableName: detailTable.table,
@@ -4490,7 +4530,7 @@ var GenericDataGrid = ({
4490
4530
  onOpenDetail,
4491
4531
  ancestors: tableDefinition ? [...ancestors, { tableName: tableDefinition.name, row: fila.filaPadre, tableDefinition, fixedFields: fila.fixedFields }] : ancestors
4492
4532
  }
4493
- ) : detailTable.wScreen ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4533
+ ) : detailTable.wScreen ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4494
4534
  DetalleWScreen,
4495
4535
  {
4496
4536
  fila,
@@ -4498,7 +4538,7 @@ var GenericDataGrid = ({
4498
4538
  onAlto: (alto) => cambiarAltoDetalle(fila.clave, alto),
4499
4539
  onAncho: (ancho) => cambiarAnchoDetalle(fila.clave, ancho)
4500
4540
  }
4501
- ) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material18.Alert, { severity: "warning", children: [
4541
+ ) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Alert, { severity: "warning", children: [
4502
4542
  "El detalle '",
4503
4543
  detailTable.abr,
4504
4544
  "' no tiene ni tabla ni wScreen."
@@ -4506,18 +4546,18 @@ var GenericDataGrid = ({
4506
4546
  }
4507
4547
  );
4508
4548
  }, [anchoVisible, claveCache, tableName, cambiarAltoDetalle, cambiarAnchoDetalle, altoMaximoDetalleEfectivo, onOpenDetail, tableDefinition, ancestors]);
4509
- const detallesGrilla = (0, import_react25.useMemo)(() => ({ abiertos, alternarDetalle, renderDetalle }), [abiertos, alternarDetalle, renderDetalle]);
4549
+ const detallesGrilla = (0, import_react26.useMemo)(() => ({ abiertos, alternarDetalle, renderDetalle }), [abiertos, alternarDetalle, renderDetalle]);
4510
4550
  const altoDeseado = cargandoInicial ? ALTO_INICIAL_DETALLE : gridHeight + ALTO_TITULO_ANIDADA + 8;
4511
- (0, import_react25.useEffect)(() => {
4551
+ (0, import_react26.useEffect)(() => {
4512
4552
  onAltoDeseado?.(altoDeseado);
4513
4553
  }, [onAltoDeseado, altoDeseado]);
4514
- const rowKeyGetter = (0, import_react25.useCallback)((row) => esFilaDetalle(row) ? `detalle:${row.clave}` : getPrimaryKeyValues(row, primaryKey), [primaryKey]);
4515
- const rowHeight = (0, import_react25.useCallback)((row) => esFilaDetalle(row) ? altoDeDetalle(row.clave) : ROW_HEIGHT, [altoDeDetalle]);
4516
- const rowClass = (0, import_react25.useCallback)(
4554
+ const rowKeyGetter = (0, import_react26.useCallback)((row) => esFilaDetalle(row) ? `detalle:${row.clave}` : getPrimaryKeyValues(row, primaryKey), [primaryKey]);
4555
+ const rowHeight = (0, import_react26.useCallback)((row) => esFilaDetalle(row) ? altoDeDetalle(row.clave) : ROW_HEIGHT, [altoDeDetalle]);
4556
+ const rowClass = (0, import_react26.useCallback)(
4517
4557
  (row) => esFilaDetalle(row) ? "fpr-fila-detalle" : exitingRowIds.has(getPrimaryKeyValues(row, primaryKey)) ? "fpr-fila-saliendo" : void 0,
4518
4558
  [exitingRowIds, primaryKey]
4519
4559
  );
4520
- const anchoContenido = (0, import_react25.useMemo)(() => {
4560
+ const anchoContenido = (0, import_react26.useMemo)(() => {
4521
4561
  if (!anidada || columns.length === 0) return void 0;
4522
4562
  const sumaColumnas = columns.reduce((total, col) => {
4523
4563
  const medido = columnWidths.get(col.key)?.width;
@@ -4527,12 +4567,12 @@ var GenericDataGrid = ({
4527
4567
  const anchoDetalleMax = detallesAbiertos.reduce((max, clave) => Math.max(max, anchosDetalle.get(clave) ?? 0), 0);
4528
4568
  return Math.max(ANCHO_MINIMO_ANIDADA, propio, anchoDetalleMax > 0 ? anchoDetalleMax + SANGRIA_DETALLE + (medidas?.barra ?? 0) + 2 : 0);
4529
4569
  }, [anidada, columns, columnWidths, medidas?.barra, detallesAbiertos, anchosDetalle]);
4530
- (0, import_react25.useEffect)(() => {
4570
+ (0, import_react26.useEffect)(() => {
4531
4571
  if (anchoContenido !== void 0) onAnchoDeseado?.(anchoContenido);
4532
4572
  }, [onAnchoDeseado, anchoContenido]);
4533
- const estiloGrilla = (0, import_react25.useMemo)(() => ({ height: "100%", width: "100%", boxSizing: "border-box", ...gridStyles }), [gridStyles]);
4534
- const bottomSummaryRows = (0, import_react25.useMemo)(() => conPie ? [bottomSummaryRow] : [], [conPie, bottomSummaryRow]);
4535
- const vistaGrilla = (0, import_react25.useMemo)(() => ({ isFilterRowVisible }), [isFilterRowVisible]);
4573
+ const estiloGrilla = (0, import_react26.useMemo)(() => ({ height: "100%", width: "100%", boxSizing: "border-box", ...gridStyles }), [gridStyles]);
4574
+ const bottomSummaryRows = (0, import_react26.useMemo)(() => conPie ? [bottomSummaryRow] : [], [conPie, bottomSummaryRow]);
4575
+ const vistaGrilla = (0, import_react26.useMemo)(() => ({ isFilterRowVisible }), [isFilterRowVisible]);
4536
4576
  const getFallBackMessage = () => {
4537
4577
  if (tableData.length === 0) {
4538
4578
  return "No hay filas para mostrar";
@@ -4544,19 +4584,19 @@ var GenericDataGrid = ({
4544
4584
  };
4545
4585
  const fallBackMessage = getFallBackMessage();
4546
4586
  if (cargandoInicial) {
4547
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material18.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: [
4548
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.CircularProgress, {}),
4549
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Typography, { variant: "h6", sx: { ml: 2 }, children: "Cargando tabla..." })
4587
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: [
4588
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.CircularProgress, {}),
4589
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Typography, { variant: "h6", sx: { ml: 2 }, children: "Cargando tabla..." })
4550
4590
  ] });
4551
4591
  }
4552
4592
  if (errorDeCarga) {
4553
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Alert, { severity: "error", children: errorDeCarga }) });
4593
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Alert, { severity: "error", children: errorDeCarga }) });
4554
4594
  }
4555
4595
  if (!tableDefinition) {
4556
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Alert, { severity: "warning", children: "No se pudo cargar la definici\xF3n de la tabla." }) });
4596
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Alert, { severity: "warning", children: "No se pudo cargar la definici\xF3n de la tabla." }) });
4557
4597
  }
4558
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CacheGrillasContext.Provider, { value: cache, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material18.Box, { sx: { pt: anidada ? 0 : 2, display: "flex", flexDirection: "column", height: "100%", boxSizing: "border-box", width: anchoContenido ?? void 0, maxWidth: "100%" }, children: [
4559
- !anidada && ancestors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Box, { sx: { px: 2, pt: 0, pb: 1, display: "flex", flexDirection: "column" }, children: ancestors.map((ancestor, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4598
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CacheGrillasContext.Provider, { value: cache, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Box, { sx: { pt: anidada ? 0 : 2, display: "flex", flexDirection: "column", height: "100%", boxSizing: "border-box", width: anchoContenido ?? void 0, maxWidth: "100%" }, children: [
4599
+ !anidada && ancestors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Box, { sx: { px: 2, pt: 0, pb: 1, display: "flex", flexDirection: "column" }, children: ancestors.map((ancestor, index) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4560
4600
  StaticAncestorGrid,
4561
4601
  {
4562
4602
  ancestor,
@@ -4565,7 +4605,7 @@ var GenericDataGrid = ({
4565
4605
  },
4566
4606
  index
4567
4607
  )) }),
4568
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
4608
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
4569
4609
  import_material18.Box,
4570
4610
  {
4571
4611
  sx: {
@@ -4588,16 +4628,16 @@ var GenericDataGrid = ({
4588
4628
  gap: 1
4589
4629
  },
4590
4630
  children: [
4591
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_material18.Typography, { variant: "subtitle2", component: "div", children: [
4631
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_material18.Typography, { variant: "subtitle2", component: "div", children: [
4592
4632
  titulo ?? cambiarGuionesBajosPorEspacios(tableDefinition.title || tableDefinition.name),
4593
4633
  " - ",
4594
4634
  filteredRows.length === tableData.length ? `${tableData.length} registros` : `${filteredRows.length} (F)`
4595
4635
  ] }),
4596
- loading && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.CircularProgress, { size: 14, color: "inherit" })
4636
+ loading && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.CircularProgress, { size: 14, color: "inherit" })
4597
4637
  ]
4598
4638
  }
4599
4639
  ),
4600
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
4640
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
4601
4641
  import_material18.Box,
4602
4642
  {
4603
4643
  sx: {
@@ -4616,7 +4656,7 @@ var GenericDataGrid = ({
4616
4656
  pb: anidada ? 0 : 3
4617
4657
  },
4618
4658
  children: [
4619
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(EstadoGrillaContext.Provider, { value: estadoGrilla, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VistaGrillaContext.Provider, { value: vistaGrilla, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DetallesGrillaContext.Provider, { value: detallesGrilla, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4659
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EstadoGrillaContext.Provider, { value: estadoGrilla, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(VistaGrillaContext.Provider, { value: vistaGrilla, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DetallesGrillaContext.Provider, { value: detallesGrilla, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4620
4660
  import_react_data_grid.DataGrid,
4621
4661
  {
4622
4662
  className: "rdg-light",
@@ -4646,7 +4686,7 @@ var GenericDataGrid = ({
4646
4686
  onCellKeyDown: handleCellKeyDown
4647
4687
  }
4648
4688
  ) }) }) }),
4649
- fallBackMessage && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4689
+ fallBackMessage && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4650
4690
  import_material18.Box,
4651
4691
  {
4652
4692
  sx: {
@@ -4663,13 +4703,13 @@ var GenericDataGrid = ({
4663
4703
  zIndex: tableData.length === 0 ? 10 : 1
4664
4704
  // Mantenemos el zIndex superior para el estado vacío total
4665
4705
  },
4666
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material18.Typography, { variant: "body2", color: "textSecondary", children: fallBackMessage })
4706
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_material18.Typography, { variant: "body2", color: "textSecondary", children: fallBackMessage })
4667
4707
  }
4668
4708
  )
4669
4709
  ]
4670
4710
  }
4671
4711
  ),
4672
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4712
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4673
4713
  ExportDialog,
4674
4714
  {
4675
4715
  open: openExportDialog,
@@ -4680,7 +4720,7 @@ var GenericDataGrid = ({
4680
4720
  username: usuario || "anonymous"
4681
4721
  }
4682
4722
  ),
4683
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4723
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4684
4724
  ConfirmDialog,
4685
4725
  {
4686
4726
  open: openConfirmDialog,
@@ -4689,7 +4729,7 @@ var GenericDataGrid = ({
4689
4729
  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."
4690
4730
  }
4691
4731
  ),
4692
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4732
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4693
4733
  DataGridOptionsDialog,
4694
4734
  {
4695
4735
  open: openDataGridOptions,
@@ -4698,7 +4738,7 @@ var GenericDataGrid = ({
4698
4738
  anchorEl: dataGridOptionsAnchorEl
4699
4739
  }
4700
4740
  ),
4701
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4741
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4702
4742
  ImportDialog,
4703
4743
  {
4704
4744
  open: openImportDialog,
@@ -4707,14 +4747,14 @@ var GenericDataGrid = ({
4707
4747
  loading
4708
4748
  }
4709
4749
  ),
4710
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4750
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4711
4751
  import_material18.Dialog,
4712
4752
  {
4713
4753
  open: openVerticalEditDialog,
4714
4754
  onClose: () => setOpenVerticalEditDialog(false),
4715
4755
  maxWidth: "sm",
4716
4756
  fullWidth: true,
4717
- children: rowToEditVertical && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
4757
+ children: rowToEditVertical && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4718
4758
  VerticalEditorPage,
4719
4759
  {
4720
4760
  tableName,
@@ -4759,28 +4799,28 @@ var GenericDataGrid = ({
4759
4799
  )
4760
4800
  }
4761
4801
  ),
4762
- contenidoDeCelda && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VentanaDeTexto, { anclaje: contenidoDeCelda.anclaje, texto: contenidoDeCelda.texto, editable: false, onAceptar: cerrarContenidoDeCelda, onCerrar: cerrarContenidoDeCelda })
4802
+ contenidoDeCelda && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(VentanaDeTexto, { anclaje: contenidoDeCelda.anclaje, texto: contenidoDeCelda.texto, editable: false, onAceptar: cerrarContenidoDeCelda, onCerrar: cerrarContenidoDeCelda })
4763
4803
  ] }) });
4764
4804
  };
4765
4805
  var GenericDataGrid_default = GenericDataGrid;
4766
4806
 
4767
4807
  // src/App.tsx
4768
- var import_react42 = __toESM(require("react"), 1);
4808
+ var import_react43 = __toESM(require("react"), 1);
4769
4809
  var import_react_router_dom15 = require("react-router-dom");
4770
4810
 
4771
4811
  // src/components/MainLayout.tsx
4772
- var import_react29 = require("react");
4812
+ var import_react30 = require("react");
4773
4813
  var import_react_router_dom4 = require("react-router-dom");
4774
4814
  var import_material20 = require("@mui/material");
4775
4815
 
4776
4816
  // src/contexts/AppContext.tsx
4777
- var import_react26 = require("react");
4817
+ var import_react27 = require("react");
4778
4818
  var import_react_router_dom = require("react-router-dom");
4779
4819
  var import_react_redux2 = require("react-redux");
4780
- var import_jsx_runtime22 = require("react/jsx-runtime");
4781
- var AuthContext = (0, import_react26.createContext)(void 0);
4820
+ var import_jsx_runtime23 = require("react/jsx-runtime");
4821
+ var AuthContext = (0, import_react27.createContext)(void 0);
4782
4822
  var useApp = () => {
4783
- const context = (0, import_react26.useContext)(AuthContext);
4823
+ const context = (0, import_react27.useContext)(AuthContext);
4784
4824
  if (!context) {
4785
4825
  throw new Error("useApp must be used within an AppProvider");
4786
4826
  }
@@ -4789,15 +4829,15 @@ var useApp = () => {
4789
4829
  };
4790
4830
  var AppProvider = ({ children, publicPaths = [] }) => {
4791
4831
  console.log("AppProvider rendered/re-rendered");
4792
- const [isLoggedIn, setIsLoggedIn] = (0, import_react26.useState)(false);
4793
- const [showSessionExpiredMessage, setShowSessionExpiredMessage] = (0, import_react26.useState)(false);
4794
- const isRedirectingRef = (0, import_react26.useRef)(false);
4795
- const huboSesionRef = (0, import_react26.useRef)(false);
4832
+ const [isLoggedIn, setIsLoggedIn] = (0, import_react27.useState)(false);
4833
+ const [showSessionExpiredMessage, setShowSessionExpiredMessage] = (0, import_react27.useState)(false);
4834
+ const isRedirectingRef = (0, import_react27.useRef)(false);
4835
+ const huboSesionRef = (0, import_react27.useRef)(false);
4796
4836
  const dispatch = (0, import_react_redux2.useDispatch)();
4797
4837
  const clientContext = (0, import_react_redux2.useSelector)((state) => state.clientContext);
4798
4838
  if (clientContext.status === "succeeded") huboSesionRef.current = true;
4799
4839
  const navigate = (0, import_react_router_dom.useNavigate)();
4800
- const handleExpiredSessionRedirect = (0, import_react26.useCallback)(() => {
4840
+ const handleExpiredSessionRedirect = (0, import_react27.useCallback)(() => {
4801
4841
  isRedirectingRef.current = true;
4802
4842
  setShowSessionExpiredMessage(false);
4803
4843
  setIsLoggedIn(false);
@@ -4807,11 +4847,11 @@ var AppProvider = ({ children, publicPaths = [] }) => {
4807
4847
  }, 2e3);
4808
4848
  }, [navigate]);
4809
4849
  const location = (0, import_react_router_dom.useLocation)();
4810
- const isCurrentPathPublic = (0, import_react26.useCallback)(() => {
4850
+ const isCurrentPathPublic = (0, import_react27.useCallback)(() => {
4811
4851
  const current = location.pathname;
4812
4852
  return publicPaths.some((path) => current === path || current.startsWith(`${path}/`));
4813
4853
  }, [location.pathname, publicPaths]);
4814
- const checkSession = (0, import_react26.useCallback)(async () => {
4854
+ const checkSession = (0, import_react27.useCallback)(async () => {
4815
4855
  if (isRedirectingRef.current) return;
4816
4856
  try {
4817
4857
  const response = await fetchApi("/keep-alive.json", { method: "GET" });
@@ -4849,14 +4889,14 @@ var AppProvider = ({ children, publicPaths = [] }) => {
4849
4889
  }
4850
4890
  }
4851
4891
  }, [dispatch, clientContext.status, showSessionExpiredMessage, isCurrentPathPublic]);
4852
- (0, import_react26.useEffect)(() => {
4892
+ (0, import_react27.useEffect)(() => {
4853
4893
  checkSession();
4854
4894
  const intervalId = setInterval(checkSession, 15 * 1e3);
4855
4895
  return () => {
4856
4896
  clearInterval(intervalId);
4857
4897
  };
4858
4898
  }, [checkSession]);
4859
- const authContextValue = (0, import_react26.useMemo)(() => ({
4899
+ const authContextValue = (0, import_react27.useMemo)(() => ({
4860
4900
  isLoggedIn,
4861
4901
  setIsLoggedIn,
4862
4902
  checkSession,
@@ -4871,7 +4911,7 @@ var AppProvider = ({ children, publicPaths = [] }) => {
4871
4911
  setShowSessionExpiredMessage,
4872
4912
  handleExpiredSessionRedirect
4873
4913
  ]);
4874
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AuthContext.Provider, { value: authContextValue, children });
4914
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AuthContext.Provider, { value: authContextValue, children });
4875
4915
  };
4876
4916
 
4877
4917
  // src/components/MainLayout.tsx
@@ -4880,7 +4920,7 @@ var import_Menu = __toESM(require("@mui/icons-material/Menu"), 1);
4880
4920
  var import_ChevronLeft = __toESM(require("@mui/icons-material/ChevronLeft"), 1);
4881
4921
 
4882
4922
  // src/components/SideMenu.tsx
4883
- var import_react27 = __toESM(require("react"), 1);
4923
+ var import_react28 = __toESM(require("react"), 1);
4884
4924
  var import_material19 = require("@mui/material");
4885
4925
  var import_ExpandLess = __toESM(require("@mui/icons-material/ExpandLess"), 1);
4886
4926
  var import_ExpandMore = __toESM(require("@mui/icons-material/ExpandMore"), 1);
@@ -4914,7 +4954,7 @@ function itemInicial(menu) {
4914
4954
  }
4915
4955
 
4916
4956
  // src/components/SideMenu.tsx
4917
- var import_jsx_runtime23 = require("react/jsx-runtime");
4957
+ var import_jsx_runtime24 = require("react/jsx-runtime");
4918
4958
  var MenuListItem = ({ item, level, onMenuItemClick }) => {
4919
4959
  const navigate = (0, import_react_router_dom2.useNavigate)();
4920
4960
  const location = (0, import_react_router_dom2.useLocation)();
@@ -4933,17 +4973,17 @@ var MenuListItem = ({ item, level, onMenuItemClick }) => {
4933
4973
  const getIcon = (item2) => {
4934
4974
  switch (item2.menuType) {
4935
4975
  case "table":
4936
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_TableChart.default, { sx: { color: import_colors.blue[700] } });
4976
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_TableChart.default, { sx: { color: import_colors.blue[700] } });
4937
4977
  case "proc":
4938
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_Dns.default, { sx: { color: import_colors.teal[700] } });
4978
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_Dns.default, { sx: { color: import_colors.teal[700] } });
4939
4979
  case "menu":
4940
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_Folder.default, { sx: { color: import_colors.orange[800] } });
4980
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_Folder.default, { sx: { color: import_colors.orange[800] } });
4941
4981
  default:
4942
4982
  const WScreenComponent = wScreens[item2.menuType];
4943
4983
  if (WScreenComponent !== void 0) {
4944
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_DesktopWindows.default, { sx: { color: import_colors.grey[700] } });
4984
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_DesktopWindows.default, { sx: { color: import_colors.grey[700] } });
4945
4985
  }
4946
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_WarningAmber3.default, { sx: { color: import_colors.red[500] } });
4986
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_WarningAmber3.default, { sx: { color: import_colors.red[500] } });
4947
4987
  }
4948
4988
  };
4949
4989
  const currentPath = location.pathname;
@@ -4957,27 +4997,27 @@ var MenuListItem = ({ item, level, onMenuItemClick }) => {
4957
4997
  } else if (item.menuType !== "menu") {
4958
4998
  isSelected = currentPath.startsWith(`/wScreens/${item.menuType}`) || currentPath.startsWith(`/wScreens-fallback/${item.menuType}`);
4959
4999
  }
4960
- const itemRef = import_react27.default.useRef(null);
4961
- (0, import_react27.useEffect)(() => {
5000
+ const itemRef = import_react28.default.useRef(null);
5001
+ (0, import_react28.useEffect)(() => {
4962
5002
  if (isSelected && itemRef.current) {
4963
5003
  itemRef.current.scrollIntoView({ behavior: "smooth", block: "nearest" });
4964
5004
  }
4965
5005
  }, [isSelected]);
4966
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { ref: itemRef, children: [
4967
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
5006
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { ref: itemRef, children: [
5007
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
4968
5008
  import_material19.ListItemButton,
4969
5009
  {
4970
5010
  onClick: handleClick,
4971
5011
  sx: { pl: level * 2 },
4972
5012
  selected: isSelected,
4973
5013
  children: [
4974
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.ListItemIcon, { sx: { minWidth: "38px" }, children: getIcon(item) }),
4975
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.ListItemText, { primary: item.label || item.name }),
4976
- item.menuType === "menu" ? open ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_ExpandLess.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_ExpandMore.default, {}) : null
5014
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.ListItemIcon, { sx: { minWidth: "38px" }, children: getIcon(item) }),
5015
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.ListItemText, { primary: item.label || item.name }),
5016
+ item.menuType === "menu" ? open ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_ExpandLess.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_ExpandMore.default, {}) : null
4977
5017
  ]
4978
5018
  }
4979
5019
  ),
4980
- item.menuType === "menu" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Collapse, { in: open, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.List, { component: "div", disablePadding: true, children: item.menuContent.map((subItem) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5020
+ item.menuType === "menu" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.Collapse, { in: open, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.List, { component: "div", disablePadding: true, children: item.menuContent.map((subItem) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4981
5021
  MenuListItem,
4982
5022
  {
4983
5023
  item: subItem,
@@ -5001,9 +5041,9 @@ var SideMenu = ({ onMenuItemClick }) => {
5001
5041
  dispatch(setAllSubMenusOpen(!isMostlyOpen));
5002
5042
  };
5003
5043
  if (!clientContext || !clientContext.menu) {
5004
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Box, { sx: { p: 2, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Typography, { variant: "body2", color: "text.secondary", children: "Cargando men\xFA..." }) });
5044
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.Box, { sx: { p: 2, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.Typography, { variant: "body2", color: "text.secondary", children: "Cargando men\xFA..." }) });
5005
5045
  }
5006
- (0, import_react27.useEffect)(() => {
5046
+ (0, import_react28.useEffect)(() => {
5007
5047
  if (!clientContext?.menu) return;
5008
5048
  const expandParents = (items, targetPath, parentNames = []) => {
5009
5049
  const pathParts = targetPath.split("/");
@@ -5032,13 +5072,13 @@ var SideMenu = ({ onMenuItemClick }) => {
5032
5072
  };
5033
5073
  expandParents(clientContext.menu, location.pathname);
5034
5074
  }, [location.pathname, clientContext, dispatch]);
5035
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material19.Box, { sx: { width: "100%", flexShrink: 0 }, children: [
5036
- clientContext.menu.some((item) => item.menuType === "menu") && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.ListItem, { disablePadding: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_material19.ListItemButton, { onClick: handleToggleAllSubMenus, children: [
5037
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.ListItemIcon, { sx: { minWidth: "38px" }, children: isMostlyOpen ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_UnfoldLess.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_UnfoldMore.default, {}) }),
5038
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.ListItemText, { primary: isMostlyOpen ? "colapsar " : "expandir" })
5075
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material19.Box, { sx: { width: "100%", flexShrink: 0 }, children: [
5076
+ clientContext.menu.some((item) => item.menuType === "menu") && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.ListItem, { disablePadding: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material19.ListItemButton, { onClick: handleToggleAllSubMenus, children: [
5077
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.ListItemIcon, { sx: { minWidth: "38px" }, children: isMostlyOpen ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_UnfoldLess.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_UnfoldMore.default, {}) }),
5078
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.ListItemText, { primary: isMostlyOpen ? "colapsar " : "expandir" })
5039
5079
  ] }) }),
5040
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.Divider, {}),
5041
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_material19.List, { children: clientContext.menu.map((menuItem) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
5080
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.Divider, {}),
5081
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material19.List, { children: clientContext.menu.map((menuItem) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5042
5082
  MenuListItem,
5043
5083
  {
5044
5084
  item: menuItem,
@@ -5052,14 +5092,14 @@ var SideMenu = ({ onMenuItemClick }) => {
5052
5092
  var SideMenu_default = SideMenu;
5053
5093
 
5054
5094
  // src/hooks/useLogout.tsx
5055
- var import_react28 = require("react");
5095
+ var import_react29 = require("react");
5056
5096
  var import_react_router_dom3 = require("react-router-dom");
5057
5097
  var import_react_redux3 = require("react-redux");
5058
5098
  var useLogout = () => {
5059
5099
  const { setIsLoggedIn } = useApp();
5060
5100
  const dispatch = (0, import_react_redux3.useDispatch)();
5061
5101
  const navigate = (0, import_react_router_dom3.useNavigate)();
5062
- const logout = (0, import_react28.useCallback)(async () => {
5102
+ const logout = (0, import_react29.useCallback)(async () => {
5063
5103
  try {
5064
5104
  const response = await fetchApi("/logout", { method: "GET" });
5065
5105
  if (response.status === 401 || response.ok) {
@@ -5080,7 +5120,7 @@ var useLogout = () => {
5080
5120
  var useLogout_default = useLogout;
5081
5121
 
5082
5122
  // src/components/MainLayout.tsx
5083
- var import_jsx_runtime24 = require("react/jsx-runtime");
5123
+ var import_jsx_runtime25 = require("react/jsx-runtime");
5084
5124
  var drawerWidth = 240;
5085
5125
  var MainLayout = () => {
5086
5126
  const { clientContext } = useApp();
@@ -5089,7 +5129,7 @@ var MainLayout = () => {
5089
5129
  const dispatch = useAppDispatch();
5090
5130
  const theme = (0, import_material20.useTheme)();
5091
5131
  const isMobile = (0, import_material20.useMediaQuery)(theme.breakpoints.down("sm"));
5092
- (0, import_react29.useEffect)(() => {
5132
+ (0, import_react30.useEffect)(() => {
5093
5133
  if (isMobile && isDrawerOpen) {
5094
5134
  dispatch(setDrawerOpen(false));
5095
5135
  }
@@ -5103,11 +5143,11 @@ var MainLayout = () => {
5103
5143
  }
5104
5144
  };
5105
5145
  if (!clientContext) {
5106
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Box, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Typography, { children: "Cargando dise\xF1o de la aplicaci\xF3n..." }) });
5146
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Box, { sx: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Typography, { children: "Cargando dise\xF1o de la aplicaci\xF3n..." }) });
5107
5147
  }
5108
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Box, { sx: { display: "flex", height: "100vh" }, children: [
5109
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.CssBaseline, {}),
5110
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5148
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material20.Box, { sx: { display: "flex", height: "100vh" }, children: [
5149
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.CssBaseline, {}),
5150
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5111
5151
  import_material20.AppBar,
5112
5152
  {
5113
5153
  position: "fixed",
@@ -5126,8 +5166,8 @@ var MainLayout = () => {
5126
5166
  })
5127
5167
  }
5128
5168
  },
5129
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_material20.Toolbar, { children: [
5130
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5169
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material20.Toolbar, { children: [
5170
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5131
5171
  import_material20.IconButton,
5132
5172
  {
5133
5173
  color: "inherit",
@@ -5137,10 +5177,10 @@ var MainLayout = () => {
5137
5177
  sx: {
5138
5178
  marginRight: 2
5139
5179
  },
5140
- children: isDrawerOpen ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_ChevronLeft.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_Menu.default, {})
5180
+ children: isDrawerOpen ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_ChevronLeft.default, {}) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_Menu.default, {})
5141
5181
  }
5142
5182
  ),
5143
- !isDrawerOpen && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5183
+ !isDrawerOpen && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5144
5184
  "img",
5145
5185
  {
5146
5186
  src: `${envConfig.backendUrl}/img/logo-128.png`,
@@ -5148,21 +5188,21 @@ var MainLayout = () => {
5148
5188
  style: { height: "32px", marginRight: "12px", objectFit: "contain" }
5149
5189
  }
5150
5190
  ),
5151
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Typography, { variant: "h6", noWrap: true, component: "div", sx: { flexGrow: 1 }, children: isDrawerOpen ? "" : clientContext.config.title }),
5152
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Typography, { variant: "subtitle1", component: "div", sx: { mr: 2 }, children: clientContext.username }),
5153
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5191
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Typography, { variant: "h6", noWrap: true, component: "div", sx: { flexGrow: 1 }, children: isDrawerOpen ? "" : clientContext.config.title }),
5192
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Typography, { variant: "subtitle1", component: "div", sx: { mr: 2 }, children: clientContext.username }),
5193
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5154
5194
  import_material20.Button,
5155
5195
  {
5156
5196
  color: "inherit",
5157
5197
  onClick: logout,
5158
- startIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_Logout.default, {}),
5198
+ startIcon: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_Logout.default, {}),
5159
5199
  children: "Salir"
5160
5200
  }
5161
5201
  )
5162
5202
  ] })
5163
5203
  }
5164
5204
  ),
5165
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
5205
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
5166
5206
  import_material20.Drawer,
5167
5207
  {
5168
5208
  variant: "persistent",
@@ -5179,7 +5219,7 @@ var MainLayout = () => {
5179
5219
  }
5180
5220
  },
5181
5221
  children: [
5182
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
5222
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
5183
5223
  import_material20.Toolbar,
5184
5224
  {
5185
5225
  sx: {
@@ -5192,7 +5232,7 @@ var MainLayout = () => {
5192
5232
  gap: 1.5
5193
5233
  },
5194
5234
  children: [
5195
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5235
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5196
5236
  "img",
5197
5237
  {
5198
5238
  src: `${envConfig.backendUrl}/img/logo-128.png`,
@@ -5200,15 +5240,15 @@ var MainLayout = () => {
5200
5240
  style: { height: "32px", objectFit: "contain" }
5201
5241
  }
5202
5242
  ),
5203
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Typography, { variant: "h6", sx: { fontWeight: "bold" }, children: clientContext.config.title })
5243
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Typography, { variant: "h6", sx: { fontWeight: "bold" }, children: clientContext.config.title })
5204
5244
  ]
5205
5245
  }
5206
5246
  ),
5207
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SideMenu_default, { onMenuItemClick: handleDrawerCloseMobile })
5247
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SideMenu_default, { onMenuItemClick: handleDrawerCloseMobile })
5208
5248
  ]
5209
5249
  }
5210
5250
  ),
5211
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
5251
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
5212
5252
  import_material20.Box,
5213
5253
  {
5214
5254
  component: "main",
@@ -5235,8 +5275,8 @@ var MainLayout = () => {
5235
5275
  width: isDrawerOpen ? `calc(100% - ${drawerWidth}px)` : "100%"
5236
5276
  },
5237
5277
  children: [
5238
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Toolbar, {}),
5239
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material20.Box, { sx: { flex: 1, minHeight: 0, overflowY: "auto", display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_router_dom4.Outlet, {}) })
5278
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Toolbar, {}),
5279
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material20.Box, { sx: { flex: 1, minHeight: 0, overflowY: "auto", display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_router_dom4.Outlet, {}) })
5240
5280
  ]
5241
5281
  }
5242
5282
  )
@@ -5246,7 +5286,7 @@ var MainLayout_default = MainLayout;
5246
5286
 
5247
5287
  // src/components/SessionExpiredMessage.tsx
5248
5288
  var import_material21 = require("@mui/material");
5249
- var import_jsx_runtime25 = require("react/jsx-runtime");
5289
+ var import_jsx_runtime26 = require("react/jsx-runtime");
5250
5290
  var style = {
5251
5291
  position: "absolute",
5252
5292
  top: "50%",
@@ -5265,7 +5305,7 @@ var SessionExpiredMessage = () => {
5265
5305
  const handleClose = () => {
5266
5306
  handleExpiredSessionRedirect();
5267
5307
  };
5268
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5308
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5269
5309
  import_material21.Modal,
5270
5310
  {
5271
5311
  open: showSessionExpiredMessage,
@@ -5285,10 +5325,10 @@ var SessionExpiredMessage = () => {
5285
5325
  }
5286
5326
  }
5287
5327
  },
5288
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_material21.Box, { sx: style, children: [
5289
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Typography, { id: "session-expired-modal-title", variant: "h6", component: "h2", gutterBottom: true, children: "\xA1Sesi\xF3n Expirada!" }),
5290
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Typography, { id: "session-expired-modal-description", sx: { mt: 2, mb: 3 }, children: "Tu sesi\xF3n ha expirado por inactividad o por seguridad. Por favor, inicia sesi\xF3n de nuevo." }),
5291
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_material21.Button, { variant: "contained", color: "primary", onClick: handleClose, children: "Ir al Login" })
5328
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_material21.Box, { sx: style, children: [
5329
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Typography, { id: "session-expired-modal-title", variant: "h6", component: "h2", gutterBottom: true, children: "\xA1Sesi\xF3n Expirada!" }),
5330
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Typography, { id: "session-expired-modal-description", sx: { mt: 2, mb: 3 }, children: "Tu sesi\xF3n ha expirado por inactividad o por seguridad. Por favor, inicia sesi\xF3n de nuevo." }),
5331
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_material21.Button, { variant: "contained", color: "primary", onClick: handleClose, children: "Ir al Login" })
5292
5332
  ] })
5293
5333
  }
5294
5334
  );
@@ -5297,24 +5337,24 @@ var SessionExpiredMessage_default = SessionExpiredMessage;
5297
5337
 
5298
5338
  // src/pages/PantallaInicial.tsx
5299
5339
  var import_react_router_dom5 = require("react-router-dom");
5300
- var import_jsx_runtime26 = require("react/jsx-runtime");
5340
+ var import_jsx_runtime27 = require("react/jsx-runtime");
5301
5341
  var PantallaInicial = () => {
5302
5342
  const { clientContext } = useApp();
5303
5343
  const item = clientContext.menu ? itemInicial(clientContext.menu) : void 0;
5304
- return item ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_router_dom5.Navigate, { to: rutaDeItemDeMenu(item), replace: true }) : null;
5344
+ return item ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_router_dom5.Navigate, { to: rutaDeItemDeMenu(item), replace: true }) : null;
5305
5345
  };
5306
5346
  var PantallaInicial_default = PantallaInicial;
5307
5347
 
5308
5348
  // src/pages/LogoutPage.tsx
5309
- var import_react30 = require("react");
5349
+ var import_react31 = require("react");
5310
5350
  var import_material22 = require("@mui/material");
5311
- var import_jsx_runtime27 = require("react/jsx-runtime");
5351
+ var import_jsx_runtime28 = require("react/jsx-runtime");
5312
5352
  var LogoutPage = () => {
5313
5353
  const logout = useLogout_default();
5314
- (0, import_react30.useEffect)(() => {
5354
+ (0, import_react31.useEffect)(() => {
5315
5355
  logout();
5316
5356
  }, [logout]);
5317
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_material22.Box, { sx: {
5357
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_material22.Box, { sx: {
5318
5358
  display: "flex",
5319
5359
  flexDirection: "column",
5320
5360
  justifyContent: "center",
@@ -5322,20 +5362,20 @@ var LogoutPage = () => {
5322
5362
  height: "100vh",
5323
5363
  textAlign: "center"
5324
5364
  }, children: [
5325
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.CircularProgress, { size: 60 }),
5326
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_material22.Typography, { variant: "h6", sx: { mt: 2 }, children: "Cerrando sesi\xF3n..." })
5365
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.CircularProgress, { size: 60 }),
5366
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material22.Typography, { variant: "h6", sx: { mt: 2 }, children: "Cerrando sesi\xF3n..." })
5327
5367
  ] });
5328
5368
  };
5329
5369
  var LogoutPage_default = LogoutPage;
5330
5370
 
5331
5371
  // src/pages/LoginPage.tsx
5332
- var import_react31 = require("react");
5372
+ var import_react32 = require("react");
5333
5373
  var import_material23 = require("@mui/material");
5334
5374
  var import_react_hook_form = require("react-hook-form");
5335
5375
  var import_zod = require("@hookform/resolvers/zod");
5336
5376
  var z = __toESM(require("zod"), 1);
5337
5377
  var import_react_redux4 = require("react-redux");
5338
- var import_jsx_runtime28 = require("react/jsx-runtime");
5378
+ var import_jsx_runtime29 = require("react/jsx-runtime");
5339
5379
  var loginSchema = z.object({
5340
5380
  username: z.string().min(1, "El usuario es requerido"),
5341
5381
  // Añadir validación básica
@@ -5343,8 +5383,8 @@ var loginSchema = z.object({
5343
5383
  // Añadir validación básica
5344
5384
  });
5345
5385
  var LoginPage = () => {
5346
- const [loginError, setLoginError] = (0, import_react31.useState)(null);
5347
- const [isSubmitting, setIsSubmitting] = (0, import_react31.useState)(false);
5386
+ const [loginError, setLoginError] = (0, import_react32.useState)(null);
5387
+ const [isSubmitting, setIsSubmitting] = (0, import_react32.useState)(false);
5348
5388
  const { setIsLoggedIn, checkSession } = useApp();
5349
5389
  const dispatch = (0, import_react_redux4.useDispatch)();
5350
5390
  const {
@@ -5389,7 +5429,7 @@ var LoginPage = () => {
5389
5429
  setIsSubmitting(false);
5390
5430
  }
5391
5431
  };
5392
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5432
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5393
5433
  import_material23.Box,
5394
5434
  {
5395
5435
  display: "flex",
@@ -5397,7 +5437,7 @@ var LoginPage = () => {
5397
5437
  justifyContent: "center",
5398
5438
  minHeight: "100vh",
5399
5439
  bgcolor: "#f5f5f5",
5400
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
5440
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
5401
5441
  import_material23.Box,
5402
5442
  {
5403
5443
  width: "100%",
@@ -5407,7 +5447,7 @@ var LoginPage = () => {
5407
5447
  borderRadius: 8,
5408
5448
  boxShadow: 3,
5409
5449
  children: [
5410
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material23.Box, { sx: { display: "flex", justifyContent: "center", mb: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5450
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Box, { sx: { display: "flex", justifyContent: "center", mb: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5411
5451
  "img",
5412
5452
  {
5413
5453
  src: `${envConfig.backendUrl}/img/login-logo-icon.png`,
@@ -5415,16 +5455,16 @@ var LoginPage = () => {
5415
5455
  style: { height: "192px", maxWidth: "100%", objectFit: "contain" }
5416
5456
  }
5417
5457
  ) }),
5418
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material23.Typography, { variant: "h5", align: "center", gutterBottom: true, sx: { fontWeight: "bold", color: "primary.main" }, children: "Iniciar Sesi\xF3n" }),
5419
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("form", { onSubmit: handleSubmit(onSubmit), className: "space-y-4", children: [
5420
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { children: [
5421
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("label", { htmlFor: "username", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material23.Typography, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Usuario" }) }),
5422
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5458
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Typography, { variant: "h5", align: "center", gutterBottom: true, sx: { fontWeight: "bold", color: "primary.main" }, children: "Iniciar Sesi\xF3n" }),
5459
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("form", { onSubmit: handleSubmit(onSubmit), className: "space-y-4", children: [
5460
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { children: [
5461
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("label", { htmlFor: "username", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Typography, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Usuario" }) }),
5462
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5423
5463
  import_react_hook_form.Controller,
5424
5464
  {
5425
5465
  name: "username",
5426
5466
  control,
5427
- render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5467
+ render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5428
5468
  import_material23.TextField,
5429
5469
  {
5430
5470
  ...field,
@@ -5440,14 +5480,14 @@ var LoginPage = () => {
5440
5480
  }
5441
5481
  )
5442
5482
  ] }),
5443
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { children: [
5444
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("label", { htmlFor: "password", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material23.Typography, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Contrase\xF1a" }) }),
5445
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5483
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { children: [
5484
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("label", { htmlFor: "password", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Typography, { variant: "subtitle1", component: "div", sx: { fontWeight: "medium" }, children: "Contrase\xF1a" }) }),
5485
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5446
5486
  import_react_hook_form.Controller,
5447
5487
  {
5448
5488
  name: "password",
5449
5489
  control,
5450
- render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5490
+ render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5451
5491
  import_material23.TextField,
5452
5492
  {
5453
5493
  ...field,
@@ -5463,14 +5503,14 @@ var LoginPage = () => {
5463
5503
  }
5464
5504
  )
5465
5505
  ] }),
5466
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material23.Button, { type: "submit", fullWidth: true, variant: "contained", color: "primary", disabled: isSubmitting, sx: { mt: 2 }, children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
5467
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material23.CircularProgress, { size: 20, sx: { mr: 1 } }),
5506
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.Button, { type: "submit", fullWidth: true, variant: "contained", color: "primary", disabled: isSubmitting, sx: { mt: 2 }, children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
5507
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.CircularProgress, { size: 20, sx: { mr: 1 } }),
5468
5508
  "Iniciando sesi\xF3n..."
5469
5509
  ] }) : "Iniciar Sesi\xF3n" })
5470
5510
  ] }),
5471
- loginError && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_material23.Alert, { severity: "error", sx: { mt: 2, maxHeight: "200px" }, children: [
5511
+ loginError && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_material23.Alert, { severity: "error", sx: { mt: 2, maxHeight: "200px" }, children: [
5472
5512
  " ",
5473
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material23.AlertTitle, { children: "Error" }),
5513
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material23.AlertTitle, { children: "Error" }),
5474
5514
  loginError
5475
5515
  ] })
5476
5516
  ]
@@ -5482,19 +5522,19 @@ var LoginPage = () => {
5482
5522
  var LoginPage_default = LoginPage;
5483
5523
 
5484
5524
  // src/components/ProcedureForm.tsx
5485
- var import_react32 = __toESM(require("react"), 1);
5525
+ var import_react33 = __toESM(require("react"), 1);
5486
5526
  var import_react_router_dom6 = require("react-router-dom");
5487
5527
  var import_material25 = require("@mui/material");
5488
5528
 
5489
5529
  // src/pages/procedure-results/SuccessDisplay.tsx
5490
5530
  var import_material24 = require("@mui/material");
5491
- var import_jsx_runtime29 = require("react/jsx-runtime");
5531
+ var import_jsx_runtime30 = require("react/jsx-runtime");
5492
5532
  var SuccessDisplay = ({ data }) => {
5493
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_material24.Paper, { elevation: 2, sx: { p: 2, mt: 2, bgcolor: "success.light", color: "success.contrastText" }, children: [
5494
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material24.Typography, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: "\xA1Operaci\xF3n Exitosa!" }),
5495
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material24.Typography, { variant: "body2", sx: { fontSize: "0.85rem" }, children: "Detalles del resultado:" }),
5496
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material24.Box, { sx: { bgcolor: "success.dark", p: 1, borderRadius: 1, mt: 1, overflowX: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(data, null, 2) }) }),
5497
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_material24.Typography, { variant: "body2", sx: { fontSize: "0.8rem", mt: 1 }, children: "Puedes revisar los detalles anteriores o cerrar este mensaje." })
5533
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material24.Paper, { elevation: 2, sx: { p: 2, mt: 2, bgcolor: "success.light", color: "success.contrastText" }, children: [
5534
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material24.Typography, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: "\xA1Operaci\xF3n Exitosa!" }),
5535
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material24.Typography, { variant: "body2", sx: { fontSize: "0.85rem" }, children: "Detalles del resultado:" }),
5536
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material24.Box, { sx: { bgcolor: "success.dark", p: 1, borderRadius: 1, mt: 1, overflowX: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(data, null, 2) }) }),
5537
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material24.Typography, { variant: "body2", sx: { fontSize: "0.8rem", mt: 1 }, children: "Puedes revisar los detalles anteriores o cerrar este mensaje." })
5498
5538
  ] });
5499
5539
  };
5500
5540
  var SuccessDisplay_default = SuccessDisplay;
@@ -5508,22 +5548,22 @@ var extendResultsOk = (newComponents) => {
5508
5548
  };
5509
5549
 
5510
5550
  // src/components/ProcedureForm.tsx
5511
- var import_jsx_runtime30 = require("react/jsx-runtime");
5551
+ var import_jsx_runtime31 = require("react/jsx-runtime");
5512
5552
  var ProcedureForm = () => {
5513
5553
  const { procedureName } = (0, import_react_router_dom6.useParams)();
5514
5554
  const { clientContext } = useApp();
5515
5555
  const { callApi, loading: apiLoading, error: apiError } = useApiCall();
5516
- const [validationErrors, setValidationErrors] = (0, import_react32.useState)({});
5517
- const [successMessage, setSuccessMessage] = (0, import_react32.useState)(null);
5518
- const [executionLog, setExecutionLog] = (0, import_react32.useState)([]);
5519
- const [procedureResultData, setProcedureResultData] = (0, import_react32.useState)(null);
5520
- const procedure = (0, import_react32.useMemo)(() => {
5556
+ const [validationErrors, setValidationErrors] = (0, import_react33.useState)({});
5557
+ const [successMessage, setSuccessMessage] = (0, import_react33.useState)(null);
5558
+ const [executionLog, setExecutionLog] = (0, import_react33.useState)([]);
5559
+ const [procedureResultData, setProcedureResultData] = (0, import_react33.useState)(null);
5560
+ const procedure = (0, import_react33.useMemo)(() => {
5521
5561
  if (procedureName && clientContext?.procedure) {
5522
5562
  return clientContext.procedure[procedureName];
5523
5563
  }
5524
5564
  return void 0;
5525
5565
  }, [procedureName, clientContext]);
5526
- const [formValues, setFormValues] = (0, import_react32.useState)(() => {
5566
+ const [formValues, setFormValues] = (0, import_react33.useState)(() => {
5527
5567
  if (!procedure) return {};
5528
5568
  const initialValues = {};
5529
5569
  procedure.parameters.forEach((param) => {
@@ -5548,7 +5588,7 @@ var ProcedureForm = () => {
5548
5588
  });
5549
5589
  return initialValues;
5550
5590
  });
5551
- import_react32.default.useEffect(() => {
5591
+ import_react33.default.useEffect(() => {
5552
5592
  if (procedure) {
5553
5593
  setValidationErrors({});
5554
5594
  setSuccessMessage(null);
@@ -5578,11 +5618,11 @@ var ProcedureForm = () => {
5578
5618
  setExecutionLog([]);
5579
5619
  }
5580
5620
  }, [procedure]);
5581
- const addLogMessage = (0, import_react32.useCallback)((message, isError = false) => {
5621
+ const addLogMessage = (0, import_react33.useCallback)((message, isError = false) => {
5582
5622
  const timestamp = (/* @__PURE__ */ new Date()).toLocaleTimeString("es-AR");
5583
5623
  setExecutionLog((prev) => [...prev, `[${timestamp}] ${isError ? "ERROR: " : ""}${message}`]);
5584
5624
  }, []);
5585
- const handleChange = (0, import_react32.useCallback)((e, child) => {
5625
+ const handleChange = (0, import_react33.useCallback)((e, child) => {
5586
5626
  const { name, value } = e.target;
5587
5627
  let newValue = value;
5588
5628
  if (e.target.type === "checkbox") {
@@ -5704,7 +5744,7 @@ var ProcedureForm = () => {
5704
5744
  addLogMessage("Ejecuci\xF3n finalizada.");
5705
5745
  }
5706
5746
  };
5707
- const renderInputField = (0, import_react32.useCallback)((param) => {
5747
+ const renderInputField = (0, import_react33.useCallback)((param) => {
5708
5748
  const hasError = !!validationErrors[param.name];
5709
5749
  const errorMessage = validationErrors[param.name];
5710
5750
  const commonProps = {
@@ -5723,9 +5763,9 @@ var ProcedureForm = () => {
5723
5763
  sx: { fontSize: "0.8rem" }
5724
5764
  };
5725
5765
  if (param.options && param.options.length > 0) {
5726
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material25.FormControl, { fullWidth: true, margin: "dense", size: "small", error: hasError, required: commonProps.required, children: [
5727
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.InputLabel, { id: `${param.name}-label`, sx: { fontSize: "0.8rem" }, children: param.label || param.name }),
5728
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5766
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_material25.FormControl, { fullWidth: true, margin: "dense", size: "small", error: hasError, required: commonProps.required, children: [
5767
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.InputLabel, { id: `${param.name}-label`, sx: { fontSize: "0.8rem" }, children: param.label || param.name }),
5768
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
5729
5769
  import_material25.Select,
5730
5770
  {
5731
5771
  labelId: `${param.name}-label`,
@@ -5736,14 +5776,14 @@ var ProcedureForm = () => {
5736
5776
  label: param.label || param.name,
5737
5777
  disabled: apiLoading,
5738
5778
  sx: { fontSize: "0.8rem" },
5739
- renderValue: (selected) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.Typography, { sx: { fontSize: "0.8rem" }, children: selected }),
5779
+ renderValue: (selected) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Typography, { sx: { fontSize: "0.8rem" }, children: selected }),
5740
5780
  children: [
5741
- (!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.MenuItem, { value: "", sx: { fontSize: "0.8rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("em", { children: "Seleccione..." }) }),
5742
- param.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.MenuItem, { value: option, sx: { fontSize: "0.8rem" }, children: option }, option))
5781
+ (!commonProps.required || formValues[param.name] === "") && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.MenuItem, { value: "", sx: { fontSize: "0.8rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("em", { children: "Seleccione..." }) }),
5782
+ param.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.MenuItem, { value: option, sx: { fontSize: "0.8rem" }, children: option }, option))
5743
5783
  ]
5744
5784
  }
5745
5785
  ),
5746
- (param.description || errorMessage) && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
5786
+ (param.description || errorMessage) && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
5747
5787
  ] });
5748
5788
  }
5749
5789
  switch (param.typeName) {
@@ -5752,18 +5792,18 @@ var ProcedureForm = () => {
5752
5792
  case "tsrange":
5753
5793
  case "time_range":
5754
5794
  case "daterange":
5755
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.TextField, { type: "text", value: formValues[param.name] || "", ...commonProps });
5795
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.TextField, { type: "text", value: formValues[param.name] || "", ...commonProps });
5756
5796
  case "decimal":
5757
5797
  case "double":
5758
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.TextField, { type: "number", inputProps: { step: "any", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
5798
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.TextField, { type: "number", inputProps: { step: "any", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
5759
5799
  case "integer":
5760
5800
  case "bigint":
5761
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.TextField, { type: "number", inputProps: { step: "1", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
5801
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.TextField, { type: "number", inputProps: { step: "1", style: { fontSize: "0.8rem" } }, value: formValues[param.name] || "", ...commonProps });
5762
5802
  case "boolean":
5763
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5803
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5764
5804
  import_material25.FormControlLabel,
5765
5805
  {
5766
- control: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5806
+ control: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5767
5807
  import_material25.Checkbox,
5768
5808
  {
5769
5809
  checked: !!formValues[param.name],
@@ -5774,21 +5814,21 @@ var ProcedureForm = () => {
5774
5814
  size: "small"
5775
5815
  }
5776
5816
  ),
5777
- label: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.Typography, { sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "inherit" }, children: param.label || param.name }),
5817
+ label: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Typography, { sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "inherit" }, children: param.label || param.name }),
5778
5818
  sx: { mt: 1, mb: 0 }
5779
5819
  }
5780
5820
  );
5781
5821
  case "date":
5782
5822
  case "timestamp":
5783
5823
  case "time":
5784
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.TextField, { type: param.typeName === "date" ? "date" : param.typeName === "timestamp" ? "datetime-local" : "time", value: formValues[param.name] || "", ...commonProps, InputLabelProps: { shrink: true, sx: { fontSize: "0.8rem" } } });
5824
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.TextField, { type: param.typeName === "date" ? "date" : param.typeName === "timestamp" ? "datetime-local" : "time", value: formValues[param.name] || "", ...commonProps, InputLabelProps: { shrink: true, sx: { fontSize: "0.8rem" } } });
5785
5825
  case "jsonb":
5786
5826
  case "jsona":
5787
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.TextField, { multiline: true, rows: 5, value: formValues[param.name] || "", ...commonProps, InputProps: { sx: { fontSize: "0.8rem" } } });
5827
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.TextField, { multiline: true, rows: 5, value: formValues[param.name] || "", ...commonProps, InputProps: { sx: { fontSize: "0.8rem" } } });
5788
5828
  case "bytea":
5789
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material25.FormControl, { fullWidth: true, margin: "dense", error: hasError, required: commonProps.required, children: [
5790
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.Typography, { variant: "body2", color: "textSecondary", component: "label", htmlFor: param.name, sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "text.secondary" }, children: param.label || param.name }),
5791
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5829
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_material25.FormControl, { fullWidth: true, margin: "dense", error: hasError, required: commonProps.required, children: [
5830
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Typography, { variant: "body2", color: "textSecondary", component: "label", htmlFor: param.name, sx: { fontSize: "0.8rem", color: hasError ? "error.main" : "text.secondary" }, children: param.label || param.name }),
5831
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5792
5832
  "input",
5793
5833
  {
5794
5834
  type: "file",
@@ -5802,34 +5842,34 @@ var ProcedureForm = () => {
5802
5842
  style: { padding: "6px 0", fontSize: "0.8rem" }
5803
5843
  }
5804
5844
  ),
5805
- (param.description || errorMessage) && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
5845
+ (param.description || errorMessage) && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.FormHelperText, { sx: { fontSize: "0.7rem" }, children: errorMessage || param.description })
5806
5846
  ] });
5807
5847
  default:
5808
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.TextField, { type: "text", value: formValues[param.name] || "", ...commonProps });
5848
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.TextField, { type: "text", value: formValues[param.name] || "", ...commonProps });
5809
5849
  }
5810
5850
  }, [formValues, handleChange, apiLoading, validationErrors]);
5811
- const ResultDisplayContent = (0, import_react32.useMemo)(() => {
5851
+ const ResultDisplayContent = (0, import_react33.useMemo)(() => {
5812
5852
  if (!procedureResultData || !procedure?.resultOk) return null;
5813
5853
  const ComponentToRender = resultsOk[procedure.resultOk];
5814
5854
  if (ComponentToRender) {
5815
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ComponentToRender, { data: procedureResultData });
5855
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ComponentToRender, { data: procedureResultData });
5816
5856
  } else {
5817
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material25.Paper, { elevation: 2, sx: { p: 2, mt: 0, bgcolor: "warning.light" }, children: [
5818
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material25.Typography, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: [
5857
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_material25.Paper, { elevation: 2, sx: { p: 2, mt: 0, bgcolor: "warning.light" }, children: [
5858
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_material25.Typography, { variant: "h6", sx: { fontSize: "1rem", mb: 1 }, children: [
5819
5859
  "el componente para resolver el resultOk: '",
5820
5860
  procedure.resultOk,
5821
5861
  "' definido en el procedure no existe o no est\xE1 mapeado."
5822
5862
  ] }),
5823
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.Box, { sx: {
5863
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Box, { sx: {
5824
5864
  bgcolor: "warning.dark",
5825
5865
  p: 1,
5826
5866
  borderRadius: 1
5827
- }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(procedureResultData, null, 2) }) })
5867
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("pre", { style: { margin: 0, fontSize: "0.75rem", color: "white" }, children: JSON.stringify(procedureResultData, null, 2) }) })
5828
5868
  ] });
5829
5869
  }
5830
5870
  }, [procedureResultData, procedure]);
5831
5871
  if (!procedure) {
5832
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material25.Box, { sx: {
5872
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_material25.Box, { sx: {
5833
5873
  p: 2,
5834
5874
  width: "100%",
5835
5875
  boxSizing: "border-box",
@@ -5839,13 +5879,13 @@ var ProcedureForm = () => {
5839
5879
  boxShadow: 3,
5840
5880
  textAlign: "center"
5841
5881
  }, children: [
5842
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.CircularProgress, { sx: { mb: 2 } }),
5843
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.Typography, { variant: "h6", color: "text.secondary", children: "Cargando procedimiento o no encontrado..." })
5882
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.CircularProgress, { sx: { mb: 2 } }),
5883
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Typography, { variant: "h6", color: "text.secondary", children: "Cargando procedimiento o no encontrado..." })
5844
5884
  ] });
5845
5885
  }
5846
5886
  return (
5847
5887
  // Esta es la Box más externa que ahora controlará el scroll
5848
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material25.Box, { sx: {
5888
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_material25.Box, { sx: {
5849
5889
  p: 2,
5850
5890
  ml: 1,
5851
5891
  mt: 2,
@@ -5862,16 +5902,16 @@ var ProcedureForm = () => {
5862
5902
  overflowX: "hidden"
5863
5903
  // Oculta el scroll horizontal si no es necesario para el contenedor principal
5864
5904
  }, children: [
5865
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.Typography, { variant: "h5", component: "h2", gutterBottom: true, align: "left", children: cambiarGuionesBajosPorEspacios(procedure.proceedLabel || procedure.action) }),
5866
- Object.values(validationErrors).some((err) => err !== null) && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material25.Alert, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: [
5905
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Typography, { variant: "h5", component: "h2", gutterBottom: true, align: "left", children: cambiarGuionesBajosPorEspacios(procedure.proceedLabel || procedure.action) }),
5906
+ Object.values(validationErrors).some((err) => err !== null) && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_material25.Alert, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: [
5867
5907
  "Por favor, corrige los errores en el formulario antes de enviar.",
5868
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("ul", { children: Object.values(validationErrors).map((err, idx) => err && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("li", { children: err }, idx)) })
5908
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("ul", { children: Object.values(validationErrors).map((err, idx) => err && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("li", { children: err }, idx)) })
5869
5909
  ] }),
5870
- !Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.Alert, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: apiError.message }),
5871
- !Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.Alert, { severity: "success", sx: { mb: 2, fontSize: "0.8rem" }, children: successMessage }),
5872
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("form", { onSubmit: handleSubmit, children: [
5873
- procedure.parameters.map((param) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { children: renderInputField(param) }, param.name)),
5874
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5910
+ !Object.values(validationErrors).some((err) => err !== null) && apiError && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Alert, { severity: "error", sx: { mb: 2, fontSize: "0.8rem" }, children: apiError.message }),
5911
+ !Object.values(validationErrors).some((err) => err !== null) && !apiError && successMessage && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Alert, { severity: "success", sx: { mb: 2, fontSize: "0.8rem" }, children: successMessage }),
5912
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("form", { onSubmit: handleSubmit, children: [
5913
+ procedure.parameters.map((param) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children: renderInputField(param) }, param.name)),
5914
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5875
5915
  import_material25.Button,
5876
5916
  {
5877
5917
  type: "submit",
@@ -5880,19 +5920,19 @@ var ProcedureForm = () => {
5880
5920
  disabled: apiLoading || Object.values(validationErrors).some((err) => err !== null),
5881
5921
  sx: { mt: 2 },
5882
5922
  size: "medium",
5883
- startIcon: apiLoading ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.CircularProgress, { size: 20, color: "inherit" }) : null,
5923
+ startIcon: apiLoading ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.CircularProgress, { size: 20, color: "inherit" }) : null,
5884
5924
  children: apiLoading ? "Ejecutando..." : procedure.proceedLabel || "Ejecutar"
5885
5925
  }
5886
5926
  )
5887
5927
  ] }),
5888
- ResultDisplayContent && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material25.Box, { sx: { mt: 2 }, children: [
5928
+ ResultDisplayContent && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_material25.Box, { sx: { mt: 2 }, children: [
5889
5929
  " ",
5890
5930
  ResultDisplayContent
5891
5931
  ] }),
5892
- executionLog.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_material25.Box, { sx: { mt: 3 }, children: [
5893
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.Divider, { sx: { mb: 2 } }),
5894
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_material25.Typography, { variant: "h6", gutterBottom: true, sx: { fontSize: "0.9rem" }, children: "Registro de Ejecuci\xF3n" }),
5895
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5932
+ executionLog.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_material25.Box, { sx: { mt: 3 }, children: [
5933
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Divider, { sx: { mb: 2 } }),
5934
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_material25.Typography, { variant: "h6", gutterBottom: true, sx: { fontSize: "0.9rem" }, children: "Registro de Ejecuci\xF3n" }),
5935
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5896
5936
  import_material25.Box,
5897
5937
  {
5898
5938
  sx: {
@@ -5906,7 +5946,7 @@ var ProcedureForm = () => {
5906
5946
  fontSize: "0.75rem",
5907
5947
  whiteSpace: "pre-wrap"
5908
5948
  },
5909
- children: executionLog.map((log, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5949
+ children: executionLog.map((log, index) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5910
5950
  import_material25.Typography,
5911
5951
  {
5912
5952
  component: "pre",
@@ -5929,12 +5969,12 @@ var ProcedureForm_default = ProcedureForm;
5929
5969
 
5930
5970
  // src/App.tsx
5931
5971
  var import_react_redux5 = require("react-redux");
5932
- var import_react43 = require("redux-persist/integration/react");
5972
+ var import_react44 = require("redux-persist/integration/react");
5933
5973
 
5934
5974
  // src/components/PrivateRoute.tsx
5935
- var import_react33 = require("react");
5975
+ var import_react34 = require("react");
5936
5976
  var import_react_router_dom7 = require("react-router-dom");
5937
- var import_jsx_runtime31 = require("react/jsx-runtime");
5977
+ var import_jsx_runtime32 = require("react/jsx-runtime");
5938
5978
  var PrivateRoute = ({ children }) => {
5939
5979
  const location = (0, import_react_router_dom7.useLocation)();
5940
5980
  const dispatch = useAppDispatch();
@@ -5942,7 +5982,7 @@ var PrivateRoute = ({ children }) => {
5942
5982
  const isAuthenticated = clientContextStatus === "succeeded";
5943
5983
  const isLoadingAuth = clientContextStatus === "loading";
5944
5984
  console.log(`[PrivateRoute] Render: Path=${location.pathname}, AuthStatus=${clientContextStatus}, IsAuthenticated=${isAuthenticated}, IsLoadingAuth=${isLoadingAuth}`);
5945
- (0, import_react33.useEffect)(() => {
5985
+ (0, import_react34.useEffect)(() => {
5946
5986
  console.log(`[PrivateRoute] Effect: Path=${location.pathname}, AuthStatus=${clientContextStatus}, IsAuthenticated=${isAuthenticated}, IsLoadingAuth=${isLoadingAuth}`);
5947
5987
  if (!isAuthenticated && !isLoadingAuth && location.pathname !== "/login") {
5948
5988
  const path = location.pathname + location.search + location.hash;
@@ -5958,19 +5998,19 @@ var PrivateRoute = ({ children }) => {
5958
5998
  }, [isAuthenticated, isLoadingAuth, location, dispatch, clientContextStatus]);
5959
5999
  if (isLoadingAuth) {
5960
6000
  console.log(`[PrivateRoute] Returning loading state...`);
5961
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { children: "Verificando autenticaci\xF3n..." });
6001
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { children: "Verificando autenticaci\xF3n..." });
5962
6002
  }
5963
6003
  if (!isAuthenticated) {
5964
6004
  console.log(`[PrivateRoute] User not authenticated, navigating to /login`);
5965
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_router_dom7.Navigate, { to: "/login", replace: true });
6005
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_router_dom7.Navigate, { to: "/login", replace: true });
5966
6006
  }
5967
6007
  console.log(`[PrivateRoute] User authenticated, rendering children.`);
5968
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children });
6008
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children });
5969
6009
  };
5970
6010
  var PrivateRoute_default = PrivateRoute;
5971
6011
 
5972
6012
  // src/components/InitialRedirectHandler.tsx
5973
- var import_react34 = require("react");
6013
+ var import_react35 = require("react");
5974
6014
  var import_react_router_dom8 = require("react-router-dom");
5975
6015
  var InitialRedirectHandler = () => {
5976
6016
  const location = (0, import_react_router_dom8.useLocation)();
@@ -5978,14 +6018,14 @@ var InitialRedirectHandler = () => {
5978
6018
  const dispatch = useAppDispatch();
5979
6019
  const redirectPath = useRedirectPath();
5980
6020
  const clientContextStatus = useClientContextStatus();
5981
- (0, import_react34.useEffect)(() => {
6021
+ (0, import_react35.useEffect)(() => {
5982
6022
  dispatch(setCurrentPath(location.pathname + location.search));
5983
6023
  }, [location, dispatch]);
5984
- const navegandoRef = (0, import_react34.useRef)(false);
5985
- (0, import_react34.useEffect)(() => {
6024
+ const navegandoRef = (0, import_react35.useRef)(false);
6025
+ (0, import_react35.useEffect)(() => {
5986
6026
  navegandoRef.current = false;
5987
6027
  }, [location.pathname]);
5988
- (0, import_react34.useEffect)(() => {
6028
+ (0, import_react35.useEffect)(() => {
5989
6029
  if (clientContextStatus === "succeeded") {
5990
6030
  if (redirectPath && redirectPath !== "/login") {
5991
6031
  console.log("Redirigiendo a la ruta guardada:", redirectPath);
@@ -6003,11 +6043,11 @@ var InitialRedirectHandler = () => {
6003
6043
  var InitialRedirectHandler_default = InitialRedirectHandler;
6004
6044
 
6005
6045
  // src/pages/GenericDataGridPage.tsx
6006
- var import_react35 = __toESM(require("react"), 1);
6046
+ var import_react36 = __toESM(require("react"), 1);
6007
6047
  var import_react_router_dom9 = require("react-router-dom");
6008
6048
  var import_material26 = require("@mui/material");
6009
6049
  var import_Close2 = __toESM(require("@mui/icons-material/Close"), 1);
6010
- var import_jsx_runtime32 = require("react/jsx-runtime");
6050
+ var import_jsx_runtime33 = require("react/jsx-runtime");
6011
6051
  var GenericDataGridPage = ({
6012
6052
  initialTableName,
6013
6053
  initialFixedFields = [],
@@ -6015,14 +6055,14 @@ var GenericDataGridPage = ({
6015
6055
  }) => {
6016
6056
  const { tableName: urlTableName } = (0, import_react_router_dom9.useParams)();
6017
6057
  const effectiveTableName = initialTableName || urlTableName;
6018
- const [tabs, setTabs] = (0, import_react35.useState)([]);
6019
- const [activeTabIdx, setActiveTabIdx] = (0, import_react35.useState)(0);
6058
+ const [tabs, setTabs] = (0, import_react36.useState)([]);
6059
+ const [activeTabIdx, setActiveTabIdx] = (0, import_react36.useState)(0);
6020
6060
  const ffKey = JSON.stringify(initialFixedFields);
6021
6061
  const location = (0, import_react_router_dom9.useLocation)();
6022
- const parametros = (0, import_react35.useMemo)(() => parametrosRecibidos ?? parametrosDeTabla(void 0, location.search), [parametrosRecibidos, location.search]);
6062
+ const parametros = (0, import_react36.useMemo)(() => parametrosRecibidos ?? parametrosDeTabla(void 0, location.search), [parametrosRecibidos, location.search]);
6023
6063
  const fixedFieldsIniciales = initialFixedFields.length > 0 ? initialFixedFields : parametros.fixedFields ?? [];
6024
6064
  const parametrosKey = JSON.stringify(parametros);
6025
- import_react35.default.useEffect(() => {
6065
+ import_react36.default.useEffect(() => {
6026
6066
  if (effectiveTableName) {
6027
6067
  setTabs([{
6028
6068
  id: `main-${effectiveTableName}-${ffKey}-${parametrosKey}`,
@@ -6036,7 +6076,7 @@ var GenericDataGridPage = ({
6036
6076
  setActiveTabIdx(0);
6037
6077
  }
6038
6078
  }, [effectiveTableName, ffKey, parametrosKey, location.key]);
6039
- const handleOpenDetail = (0, import_react35.useCallback)((tableName, fixedFields, label, ancestors) => {
6079
+ const handleOpenDetail = (0, import_react36.useCallback)((tableName, fixedFields, label, ancestors) => {
6040
6080
  const tabId = `${tableName}-${JSON.stringify(fixedFields)}`;
6041
6081
  setTabs((prevTabs) => {
6042
6082
  const existingTabIdx = prevTabs.findIndex((t) => t.id === tabId);
@@ -6058,26 +6098,26 @@ var GenericDataGridPage = ({
6058
6098
  else if (activeTabIdx === index) setActiveTabIdx(index - 1);
6059
6099
  };
6060
6100
  if (!effectiveTableName) {
6061
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material26.Box, { p: 3, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material26.Alert, { severity: "error", children: "No se especific\xF3 una tabla." }) });
6101
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material26.Box, { p: 3, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material26.Alert, { severity: "error", children: "No se especific\xF3 una tabla." }) });
6062
6102
  }
6063
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_material26.Box, { sx: { width: "100%", height: "calc(100vh - 64px)", display: "flex", flexDirection: "column" }, children: [
6064
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material26.Box, { sx: { borderBottom: 1, borderColor: "divider", bgcolor: "background.paper" }, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material26.Tabs, { value: activeTabIdx, onChange: (_, v) => setActiveTabIdx(v), variant: "scrollable", children: tabs.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6103
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_material26.Box, { sx: { width: "100%", height: "calc(100vh - 64px)", display: "flex", flexDirection: "column" }, children: [
6104
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material26.Box, { sx: { borderBottom: 1, borderColor: "divider", bgcolor: "background.paper" }, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material26.Tabs, { value: activeTabIdx, onChange: (_, v) => setActiveTabIdx(v), variant: "scrollable", children: tabs.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6065
6105
  import_material26.Tab,
6066
6106
  {
6067
- label: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_material26.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
6068
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material26.Typography, { variant: "caption", sx: { fontWeight: "bold" }, children: tab.label }),
6069
- index !== 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_material26.IconButton, { size: "small", onClick: (e) => handleCloseTab(index, e), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_Close2.default, { fontSize: "inherit" }) })
6107
+ label: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_material26.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
6108
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material26.Typography, { variant: "caption", sx: { fontWeight: "bold" }, children: tab.label }),
6109
+ index !== 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material26.IconButton, { size: "small", onClick: (e) => handleCloseTab(index, e), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_Close2.default, { fontSize: "inherit" }) })
6070
6110
  ] })
6071
6111
  },
6072
6112
  tab.id
6073
6113
  )) }) }),
6074
- tabs.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6114
+ tabs.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6075
6115
  import_material26.Box,
6076
6116
  {
6077
6117
  role: "tabpanel",
6078
6118
  hidden: activeTabIdx !== index,
6079
6119
  sx: { flexGrow: 1, display: activeTabIdx === index ? "flex" : "none", flexDirection: "column", overflow: "hidden" },
6080
- children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6120
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6081
6121
  GenericDataGrid_default,
6082
6122
  {
6083
6123
  tableName: tab.tableName,
@@ -6098,22 +6138,22 @@ var GenericDataGridPage = ({
6098
6138
  var GenericDataGridPage_default = GenericDataGridPage;
6099
6139
 
6100
6140
  // src/pages/PantallaDeRuta.tsx
6101
- var import_react36 = require("react");
6141
+ var import_react37 = require("react");
6102
6142
  var import_react_router_dom10 = require("react-router-dom");
6103
6143
  var import_material27 = require("@mui/material");
6104
- var import_jsx_runtime33 = require("react/jsx-runtime");
6144
+ var import_jsx_runtime34 = require("react/jsx-runtime");
6105
6145
  var PantallaDeRuta = ({ screenName }) => {
6106
6146
  const [busqueda] = (0, import_react_router_dom10.useSearchParams)();
6107
- const params = (0, import_react36.useMemo)(() => Object.fromEntries(busqueda.entries()), [busqueda]);
6147
+ const params = (0, import_react37.useMemo)(() => Object.fromEntries(busqueda.entries()), [busqueda]);
6108
6148
  const Pantalla = wScreens[screenName];
6109
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_material27.Box, { sx: { pt: 3, pl: 4 }, children: Pantalla ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Pantalla, { screenName, params }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FallbackWScreen, { screenName }) });
6149
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material27.Box, { sx: { pt: 3, pl: 4 }, children: Pantalla ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Pantalla, { screenName, params }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(FallbackWScreen, { screenName }) });
6110
6150
  };
6111
6151
 
6112
6152
  // src/pages/MenuTablePage.tsx
6113
- var import_react37 = require("react");
6153
+ var import_react38 = require("react");
6114
6154
  var import_react_router_dom11 = require("react-router-dom");
6115
6155
  var import_material28 = require("@mui/material");
6116
- var import_jsx_runtime34 = require("react/jsx-runtime");
6156
+ var import_jsx_runtime35 = require("react/jsx-runtime");
6117
6157
  var MenuTablePage = () => {
6118
6158
  const { menuName } = (0, import_react_router_dom11.useParams)();
6119
6159
  const { clientContext } = useApp();
@@ -6130,7 +6170,7 @@ var MenuTablePage = () => {
6130
6170
  }
6131
6171
  return void 0;
6132
6172
  };
6133
- const { currentTableName, currentFixedFields, parametros } = (0, import_react37.useMemo)(() => {
6173
+ const { currentTableName, currentFixedFields, parametros } = (0, import_react38.useMemo)(() => {
6134
6174
  let tableName = void 0;
6135
6175
  let fixedFields = [];
6136
6176
  let parametros2 = {};
@@ -6151,12 +6191,12 @@ var MenuTablePage = () => {
6151
6191
  };
6152
6192
  }, [menuName, clientContext, search]);
6153
6193
  if (!currentTableName) {
6154
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material28.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_material28.Alert, { severity: "error", children: [
6155
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material28.Typography, { variant: "h6", children: "Error: No se pudo cargar la informaci\xF3n de la tabla." }),
6156
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_material28.Typography, { variant: "body1", children: "Verifique la configuraci\xF3n del men\xFA o el nombre de la tabla en la URL." })
6194
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.Box, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: "200px", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_material28.Alert, { severity: "error", children: [
6195
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.Typography, { variant: "h6", children: "Error: No se pudo cargar la informaci\xF3n de la tabla." }),
6196
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_material28.Typography, { variant: "body1", children: "Verifique la configuraci\xF3n del men\xFA o el nombre de la tabla en la URL." })
6157
6197
  ] }) });
6158
6198
  }
6159
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
6199
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6160
6200
  GenericDataGridPage_default,
6161
6201
  {
6162
6202
  initialTableName: currentTableName,
@@ -6168,7 +6208,7 @@ var MenuTablePage = () => {
6168
6208
  var MenuTablePage_default = MenuTablePage;
6169
6209
 
6170
6210
  // src/puente/PantallaBP.tsx
6171
- var import_react39 = require("react");
6211
+ var import_react40 = require("react");
6172
6212
  var import_react_router_dom12 = require("react-router-dom");
6173
6213
  var import_material30 = require("@mui/material");
6174
6214
 
@@ -6259,9 +6299,9 @@ async function cargarSinMemoria(urlBackend) {
6259
6299
  }
6260
6300
 
6261
6301
  // src/puente/ConsolaBP.tsx
6262
- var import_react38 = require("react");
6302
+ var import_react39 = require("react");
6263
6303
  var import_material29 = require("@mui/material");
6264
- var import_jsx_runtime35 = require("react/jsx-runtime");
6304
+ var import_jsx_runtime36 = require("react/jsx-runtime");
6265
6305
  var MARGEN_DE_REPETIDO_MS = 1e3;
6266
6306
  function descartarRepetidos(consola, agregados, ahora) {
6267
6307
  for (const nodo of agregados) {
@@ -6274,7 +6314,7 @@ function descartarRepetidos(consola, agregados, ahora) {
6274
6314
  }
6275
6315
  }
6276
6316
  var ConsolaBP = () => {
6277
- (0, import_react38.useEffect)(() => {
6317
+ (0, import_react39.useEffect)(() => {
6278
6318
  const consola = document.getElementById("mini-console");
6279
6319
  if (!consola) return;
6280
6320
  const observador = new MutationObserver(
@@ -6283,7 +6323,7 @@ var ConsolaBP = () => {
6283
6323
  observador.observe(consola, { childList: true });
6284
6324
  return () => observador.disconnect();
6285
6325
  }, []);
6286
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6326
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
6287
6327
  import_material29.Box,
6288
6328
  {
6289
6329
  id: "mini-console",
@@ -6380,7 +6420,7 @@ var habilitarPuenteBP = () => {
6380
6420
  var puenteBPHabilitado = () => habilitado;
6381
6421
 
6382
6422
  // src/puente/PantallaBP.tsx
6383
- var import_jsx_runtime36 = require("react/jsx-runtime");
6423
+ var import_jsx_runtime37 = require("react/jsx-runtime");
6384
6424
  function buscarItemDeMenu(items, tipo) {
6385
6425
  for (const item of items) {
6386
6426
  if (item.menuType === tipo) return item;
@@ -6393,12 +6433,12 @@ function buscarItemDeMenu(items, tipo) {
6393
6433
  }
6394
6434
  var PantallaBP = ({ nombre, direccion }) => {
6395
6435
  const { clientContext } = useApp();
6396
- const [cargando, setCargando] = (0, import_react39.useState)(true);
6397
- const [error, setError] = (0, import_react39.useState)(null);
6398
- const [noExiste, setNoExiste] = (0, import_react39.useState)(false);
6399
- const contenedor = (0, import_react39.useRef)(null);
6436
+ const [cargando, setCargando] = (0, import_react40.useState)(true);
6437
+ const [error, setError] = (0, import_react40.useState)(null);
6438
+ const [noExiste, setNoExiste] = (0, import_react40.useState)(false);
6439
+ const contenedor = (0, import_react40.useRef)(null);
6400
6440
  const menu = clientContext.menu;
6401
- (0, import_react39.useEffect)(() => {
6441
+ (0, import_react40.useEffect)(() => {
6402
6442
  const elemento = contenedor.current;
6403
6443
  if (!elemento) return;
6404
6444
  let vigente = true;
@@ -6429,14 +6469,14 @@ var PantallaBP = ({ nombre, direccion }) => {
6429
6469
  elemento.replaceChildren();
6430
6470
  };
6431
6471
  }, [nombre, direccion, menu]);
6432
- if (noExiste) return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(FallbackWScreen, { screenName: nombre });
6472
+ if (noExiste) return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(FallbackWScreen, { screenName: nombre });
6433
6473
  return (
6434
6474
  // 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
6435
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_material30.Box, { sx: { position: "relative" }, children: [
6436
- cargando && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_material30.CircularProgress, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
6437
- error && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_material30.Alert, { severity: "error", sx: { m: 2 }, children: error }),
6438
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { id: "main_layout", ref: contenedor }),
6439
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ConsolaBP, {})
6475
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_material30.Box, { sx: { position: "relative" }, children: [
6476
+ cargando && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material30.CircularProgress, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
6477
+ error && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material30.Alert, { severity: "error", sx: { m: 2 }, children: error }),
6478
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { id: "main_layout", ref: contenedor }),
6479
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ConsolaBP, {})
6440
6480
  ] })
6441
6481
  );
6442
6482
  };
@@ -6444,37 +6484,37 @@ var PantallaDeRespaldo = () => {
6444
6484
  const { screenName = "" } = (0, import_react_router_dom12.useParams)();
6445
6485
  const { search } = (0, import_react_router_dom12.useLocation)();
6446
6486
  if (!puenteBPHabilitado()) {
6447
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_material30.Box, { sx: { p: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(FallbackWScreen, { screenName }) });
6487
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material30.Box, { sx: { p: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(FallbackWScreen, { screenName }) });
6448
6488
  }
6449
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_router_dom12.Navigate, { to: rutaDePantallaBP(screenName, search), replace: true });
6489
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_router_dom12.Navigate, { to: rutaDePantallaBP(screenName, search), replace: true });
6450
6490
  };
6451
6491
  var PaginaBP = () => {
6452
6492
  const { hash, search } = (0, import_react_router_dom12.useLocation)();
6453
6493
  const direccion = hash || search;
6454
6494
  const nombre = new URLSearchParams(direccion.replace(/^[#?]/, "")).get("w");
6455
- if (!puenteBPHabilitado()) return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react_router_dom12.Navigate, { to: "/", replace: true });
6456
- if (!nombre) return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_material30.Box, { sx: { p: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_material30.Alert, { severity: "warning", children: [
6495
+ if (!puenteBPHabilitado()) return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_router_dom12.Navigate, { to: "/", replace: true });
6496
+ if (!nombre) return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material30.Box, { sx: { p: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_material30.Alert, { severity: "warning", children: [
6457
6497
  "Falta la pantalla de backend-plus (",
6458
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("code", { children: "#w=..." }),
6498
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("code", { children: "#w=..." }),
6459
6499
  ")."
6460
6500
  ] }) });
6461
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PantallaBP, { nombre, direccion }, nombre);
6501
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PantallaBP, { nombre, direccion }, nombre);
6462
6502
  };
6463
6503
 
6464
6504
  // src/puente/GrillaBP.tsx
6465
- var import_react40 = require("react");
6505
+ var import_react41 = require("react");
6466
6506
  var import_react_router_dom13 = require("react-router-dom");
6467
6507
  var import_material31 = require("@mui/material");
6468
- var import_jsx_runtime37 = (
6508
+ var import_jsx_runtime38 = (
6469
6509
  // 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
6470
6510
  require("react/jsx-runtime")
6471
6511
  );
6472
6512
  var GrillaBP = ({ tabla, fixedFields }) => {
6473
- const contenedor = (0, import_react40.useRef)(null);
6474
- const [cargando, setCargando] = (0, import_react40.useState)(true);
6475
- const [error, setError] = (0, import_react40.useState)(null);
6513
+ const contenedor = (0, import_react41.useRef)(null);
6514
+ const [cargando, setCargando] = (0, import_react41.useState)(true);
6515
+ const [error, setError] = (0, import_react41.useState)(null);
6476
6516
  const clave = JSON.stringify(fixedFields ?? []);
6477
- (0, import_react40.useEffect)(() => {
6517
+ (0, import_react41.useEffect)(() => {
6478
6518
  const elemento = contenedor.current;
6479
6519
  if (!elemento) return;
6480
6520
  let vigente = true;
@@ -6495,20 +6535,20 @@ var GrillaBP = ({ tabla, fixedFields }) => {
6495
6535
  elemento.replaceChildren();
6496
6536
  };
6497
6537
  }, [tabla, clave]);
6498
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_material31.Box, { sx: { position: "relative" }, children: [
6499
- cargando && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material31.CircularProgress, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
6500
- error && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_material31.Alert, { severity: "error", sx: { m: 2 }, children: error }),
6501
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { ref: contenedor }),
6502
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ConsolaBP, {})
6538
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material31.Box, { sx: { position: "relative" }, children: [
6539
+ cargando && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material31.CircularProgress, { size: 24, sx: { position: "absolute", top: 16, left: 16 } }),
6540
+ error && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material31.Alert, { severity: "error", sx: { m: 2 }, children: error }),
6541
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { ref: contenedor }),
6542
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ConsolaBP, {})
6503
6543
  ] });
6504
6544
  };
6505
6545
  var PaginaGrillaBP = () => {
6506
6546
  const { tableName = "" } = (0, import_react_router_dom13.useParams)();
6507
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(GrillaBP, { tabla: tableName }, tableName);
6547
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(GrillaBP, { tabla: tableName }, tableName);
6508
6548
  };
6509
6549
 
6510
6550
  // src/puente/CapturaBP.tsx
6511
- var import_react41 = require("react");
6551
+ var import_react42 = require("react");
6512
6552
  var import_react_router_dom14 = require("react-router-dom");
6513
6553
 
6514
6554
  // src/puente/capturaDeNavegacion.ts
@@ -6555,61 +6595,61 @@ function capturarNavegacionBP(urlBackend, navegar) {
6555
6595
  // src/puente/CapturaBP.tsx
6556
6596
  var CapturaBP = () => {
6557
6597
  const navigate = (0, import_react_router_dom14.useNavigate)();
6558
- (0, import_react41.useEffect)(() => capturarNavegacionBP(envConfig.backendUrl, navigate), [navigate]);
6598
+ (0, import_react42.useEffect)(() => capturarNavegacionBP(envConfig.backendUrl, navigate), [navigate]);
6559
6599
  return null;
6560
6600
  };
6561
6601
 
6562
6602
  // src/App.tsx
6563
6603
  var import_type_store6 = __toESM(require("type-store"), 1);
6564
- var import_jsx_runtime38 = require("react/jsx-runtime");
6604
+ var import_jsx_runtime39 = require("react/jsx-runtime");
6565
6605
  var LocationTracker = () => {
6566
6606
  const location = (0, import_react_router_dom15.useLocation)();
6567
6607
  const dispatch = useAppDispatch();
6568
- (0, import_react42.useEffect)(() => {
6608
+ (0, import_react43.useEffect)(() => {
6569
6609
  dispatch(setCurrentPath(location.pathname + location.search));
6570
6610
  }, [location, dispatch]);
6571
6611
  return null;
6572
6612
  };
6573
6613
  function FrontendPlusReactRoutes({ myRoutes, myUnloggedRoutes, layout: Layout = MainLayout_default, unloggedLayout: UnloggedLayout }) {
6574
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
6575
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(InitialRedirectHandler_default, {}),
6576
- puenteBPHabilitado() && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CapturaBP, {}),
6577
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react_router_dom15.Routes, { children: [
6578
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react_router_dom15.Route, { element: UnloggedLayout ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(UnloggedLayout, {}) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Outlet, {}), children: [
6579
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Route, { path: "/login", element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(LoginPage_default, {}) }),
6580
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Route, { path: "/logout", element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(LogoutPage_default, {}) }),
6614
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
6615
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(InitialRedirectHandler_default, {}),
6616
+ puenteBPHabilitado() && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CapturaBP, {}),
6617
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_react_router_dom15.Routes, { children: [
6618
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_react_router_dom15.Route, { element: UnloggedLayout ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(UnloggedLayout, {}) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Outlet, {}), children: [
6619
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Route, { path: "/login", element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(LoginPage_default, {}) }),
6620
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Route, { path: "/logout", element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(LogoutPage_default, {}) }),
6581
6621
  myUnloggedRoutes
6582
6622
  ] }),
6583
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react_router_dom15.Route, { element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PrivateRoute_default, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Layout, {}) }), children: [
6584
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Route, { path: "/", element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PantallaInicial_default, {}) }),
6585
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Route, { path: "/table/:tableName", element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(GenericDataGridPage_default, {}) }),
6586
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Route, { path: "/menu/:menuName", element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(MenuTablePage_default, {}) }),
6587
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Route, { path: "/procedures/:procedureName", element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ProcedureForm_default, {}) }),
6588
- Object.keys(wScreens).map((screenName) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6623
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_react_router_dom15.Route, { element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PrivateRoute_default, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Layout, {}) }), children: [
6624
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Route, { path: "/", element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PantallaInicial_default, {}) }),
6625
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Route, { path: "/table/:tableName", element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(GenericDataGridPage_default, {}) }),
6626
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Route, { path: "/menu/:menuName", element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MenuTablePage_default, {}) }),
6627
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Route, { path: "/procedures/:procedureName", element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ProcedureForm_default, {}) }),
6628
+ Object.keys(wScreens).map((screenName) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
6589
6629
  import_react_router_dom15.Route,
6590
6630
  {
6591
6631
  path: `/wScreens/${screenName}`,
6592
- element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PantallaDeRuta, { screenName })
6632
+ element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PantallaDeRuta, { screenName })
6593
6633
  },
6594
6634
  screenName
6595
6635
  )),
6596
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Route, { path: "/wScreens-fallback/:screenName", element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PantallaDeRespaldo, {}) }),
6597
- puenteBPHabilitado() && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Route, { path: "/bp/menu", element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PaginaBP, {}) }),
6598
- puenteBPHabilitado() && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Route, { path: "/bp/table/:tableName", element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PaginaGrillaBP, {}) }),
6636
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Route, { path: "/wScreens-fallback/:screenName", element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PantallaDeRespaldo, {}) }),
6637
+ puenteBPHabilitado() && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Route, { path: "/bp/menu", element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PaginaBP, {}) }),
6638
+ puenteBPHabilitado() && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Route, { path: "/bp/table/:tableName", element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PaginaGrillaBP, {}) }),
6599
6639
  myRoutes,
6600
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Route, { path: "*", element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { style: { marginTop: "20px", marginLeft: "10px" }, children: "404 - Recurso No Encontrado" }) })
6640
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Route, { path: "*", element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { style: { marginTop: "20px", marginLeft: "10px" }, children: "404 - Recurso No Encontrado" }) })
6601
6641
  ] }),
6602
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Route, { path: "*", element: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_router_dom15.Navigate, { to: "/", replace: true }) })
6642
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Route, { path: "*", element: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_router_dom15.Navigate, { to: "/", replace: true }) })
6603
6643
  ] })
6604
6644
  ] });
6605
6645
  }
6606
6646
  var FrontendPlusProviders = ({ children, publicPaths }) => {
6607
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_redux5.Provider, { store, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react43.PersistGate, { loading: null, persistor, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react_router_dom15.BrowserRouter, { basename: rutaBase, children: [
6608
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(LocationTracker, {}),
6647
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_redux5.Provider, { store, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react44.PersistGate, { loading: null, persistor, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_react_router_dom15.BrowserRouter, { basename: rutaBase, children: [
6648
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(LocationTracker, {}),
6609
6649
  " ",
6610
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(AppProvider, { publicPaths, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(SnackbarProvider, { children: [
6650
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AppProvider, { publicPaths, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(SnackbarProvider, { children: [
6611
6651
  children,
6612
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SessionExpiredMessage_default, {})
6652
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(SessionExpiredMessage_default, {})
6613
6653
  ] }) })
6614
6654
  ] }) }) });
6615
6655
  };
@@ -6623,7 +6663,7 @@ var App = ({
6623
6663
  myConditions,
6624
6664
  puenteBP
6625
6665
  }) => {
6626
- (0, import_react42.useMemo)(() => {
6666
+ (0, import_react43.useMemo)(() => {
6627
6667
  if (myClientSides) {
6628
6668
  extendClientSides(myClientSides);
6629
6669
  }
@@ -6640,7 +6680,7 @@ var App = ({
6640
6680
  habilitarPuenteBP();
6641
6681
  }
6642
6682
  }, [myClientSides, myResultsOk, myWScreens, myConditions, puenteBP]);
6643
- (0, import_react42.useEffect)(() => {
6683
+ (0, import_react43.useEffect)(() => {
6644
6684
  import_type_store6.default.messages = import_type_store6.default.i18n.messages.es;
6645
6685
  import_type_store6.default.locale = import_type_store6.default.i18n.locale.es;
6646
6686
  const link = document.querySelector("link[rel*='icon']") || document.createElement("link");
@@ -6649,11 +6689,11 @@ var App = ({
6649
6689
  link.href = `${envConfig.backendUrl}/img/logo-128.png`;
6650
6690
  document.getElementsByTagName("head")[0].appendChild(link);
6651
6691
  }, []);
6652
- const safePaths = import_react42.default.useMemo(() => {
6692
+ const safePaths = import_react43.default.useMemo(() => {
6653
6693
  const extracted = extractPathsFromRoutes(myUnloggedRoutes);
6654
6694
  return ["/login", "/logout", ...extracted];
6655
6695
  }, [myUnloggedRoutes]);
6656
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(FrontendPlusProviders, { publicPaths: safePaths, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
6696
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(FrontendPlusProviders, { publicPaths: safePaths, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
6657
6697
  FrontendPlusReactRoutes,
6658
6698
  {
6659
6699
  myRoutes,