dmencu 3.2.13 → 3.2.14
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/client/unlogged/render-formulario.d.ts +4 -0
- package/dist/client/unlogged/render-formulario.js +22 -10
- package/dist/client/unlogged/render-formulario.tsx +31 -9
- package/dist/unlogged/unlogged/render-formulario.d.ts +4 -0
- package/dist/unlogged/unlogged/render-formulario.js +22 -10
- package/dist/unlogged/unlogged/render-formulario.tsx +31 -9
- package/package.json +1 -1
|
@@ -110,14 +110,36 @@ registrarCargarMotor(async function cargarEstructuraYDatosEnMemoria() {
|
|
|
110
110
|
|
|
111
111
|
const DELAY_SCROLL_3 = 50;
|
|
112
112
|
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
export type ResultadoPath<T = unknown> = {
|
|
114
|
+
encontrado: boolean;
|
|
115
|
+
valor: T | null;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
function obtenerPorPath<T = unknown>(objeto: Record<string, any>, path: string): ResultadoPath<T> {
|
|
119
|
+
const noEncontrado: ResultadoPath<T> = { encontrado: false, valor: null };
|
|
120
|
+
|
|
121
|
+
if (!objeto || typeof path !== 'string' || path.trim() === '') {
|
|
122
|
+
return noEncontrado;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const claves = path.split('.');
|
|
126
|
+
let actual: any = objeto;
|
|
115
127
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}, objeto);
|
|
128
|
+
for (let i = 0; i < claves.length; i++) {
|
|
129
|
+
const clave = claves[i];
|
|
119
130
|
|
|
120
|
-
|
|
131
|
+
// Si el nivel actual no es un objeto/array o la clave NO existe en él
|
|
132
|
+
if (actual === null || typeof actual !== 'object' || !(clave in actual)) {
|
|
133
|
+
return noEncontrado;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
actual = actual[clave];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return {
|
|
140
|
+
encontrado: true,
|
|
141
|
+
valor: (actual ?? null) as T | null,
|
|
142
|
+
};
|
|
121
143
|
}
|
|
122
144
|
|
|
123
145
|
function breakeableText(text: string | null): string | null;
|
|
@@ -277,11 +299,11 @@ export const BreakeableText = React.memo(function BreakeableText(props: {
|
|
|
277
299
|
if (matchTem) {
|
|
278
300
|
const infoHdr = getDatosByPass().informacionHdr;
|
|
279
301
|
const estructura = getEstructura();
|
|
280
|
-
const idEnc = forPk
|
|
302
|
+
const idEnc = forPk![estructura.pkAgregadaUaPpal];
|
|
281
303
|
const path = matchTem[1];
|
|
282
|
-
const valor =
|
|
304
|
+
const {encontrado, valor} = obtenerPorPath(infoHdr[idEnc], path)
|
|
283
305
|
|
|
284
|
-
return
|
|
306
|
+
return encontrado ? String(valor): (
|
|
285
307
|
<span key={index} style={{ color: 'red' }}>
|
|
286
308
|
{`No se encontró ${parte}`}
|
|
287
309
|
</span>
|
|
@@ -2,6 +2,10 @@ import * as React from "react";
|
|
|
2
2
|
import { EstadoCarga, ForPk, ForPkRaiz, Formulario, IdFormulario, IdVariable, PlainForPk, Respuestas, RespuestaLasUA, RespuestasRaiz, Valor, TEM, IdCarga, Carga, IdFin, InformacionHdr, IdEnc, Libre, ModoDM } from "./tipos";
|
|
3
3
|
import { FormStructureState } from "row-validator";
|
|
4
4
|
import { FormRenderer } from "./render-config";
|
|
5
|
+
export type ResultadoPath<T = unknown> = {
|
|
6
|
+
encontrado: boolean;
|
|
7
|
+
valor: T | null;
|
|
8
|
+
};
|
|
5
9
|
export declare const BreakeableText: React.NamedExoticComponent<{
|
|
6
10
|
text: string | null | undefined;
|
|
7
11
|
className?: string;
|