dmencu 3.2.15 → 3.2.17
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/bypass-formulario.d.ts +10 -0
- package/dist/client/unlogged/bypass-formulario.js +77 -41
- package/dist/client/unlogged/render-formulario.d.ts +9 -0
- package/dist/client/unlogged/render-formulario.js +74 -42
- package/dist/client/unlogged/render-formulario.tsx +87 -49
- package/dist/unlogged/unlogged/bypass-formulario.d.ts +10 -0
- package/dist/unlogged/unlogged/bypass-formulario.js +77 -41
- package/dist/unlogged/unlogged/render-formulario.d.ts +9 -0
- package/dist/unlogged/unlogged/render-formulario.js +74 -42
- package/dist/unlogged/unlogged/render-formulario.tsx +87 -49
- package/package.json +1 -1
|
@@ -87,6 +87,7 @@ import {
|
|
|
87
87
|
numberOrStringIncIfArray,
|
|
88
88
|
calcularElementoEnfocado,
|
|
89
89
|
accion_registrar_respuesta,
|
|
90
|
+
accion_registrar_respuestas,
|
|
90
91
|
accion_id_pregunta,
|
|
91
92
|
accion_agregar_formulario,
|
|
92
93
|
NO_CAMBIAR__VERIFICAR_SI_ES_NECESARIO,
|
|
@@ -142,6 +143,9 @@ function obtenerPorPath<T = unknown>(objeto: Record<string, any>, path: string):
|
|
|
142
143
|
};
|
|
143
144
|
}
|
|
144
145
|
|
|
146
|
+
const NO_CARGADO_AUN = '........';
|
|
147
|
+
const SIN_VALOR_EN_OBJETO_TEM = '';
|
|
148
|
+
|
|
145
149
|
function breakeableText(text: string | null): string | null;
|
|
146
150
|
function breakeableText(text: string | null, diccionario?: { [clave: string]: React.ReactNode }) {
|
|
147
151
|
if (typeof text != "string") return null;
|
|
@@ -153,6 +157,10 @@ function breakeableText(text: string | null, diccionario?: { [clave: string]: Re
|
|
|
153
157
|
*/
|
|
154
158
|
}
|
|
155
159
|
|
|
160
|
+
export function formatearResultadoComodin(valor: string): string {
|
|
161
|
+
return `[${valor}]`;
|
|
162
|
+
}
|
|
163
|
+
|
|
156
164
|
// ==========================================
|
|
157
165
|
// 1. HELPERS PUROS Y EXPRESIONES REGULARES
|
|
158
166
|
// ==========================================
|
|
@@ -238,7 +246,7 @@ function useVariablesEscuchadas(text: string, forPk: ForPk) {
|
|
|
238
246
|
|
|
239
247
|
// Getter expuesto para mantener tu sintaxis
|
|
240
248
|
return (nombreVar: string): string => {
|
|
241
|
-
return mapaVariables[nombreVar] ??
|
|
249
|
+
return mapaVariables[nombreVar] ?? NO_CARGADO_AUN;
|
|
242
250
|
};
|
|
243
251
|
}
|
|
244
252
|
|
|
@@ -248,7 +256,7 @@ function obtenerValoresActuales(variables: string[], forPk: ForPk): Record<strin
|
|
|
248
256
|
const { respuestasAumentadas } = respuestasForPk(forPk, true);
|
|
249
257
|
for (const v of variables) {
|
|
250
258
|
const val = respuestasAumentadas?.[v as IdVariable];
|
|
251
|
-
mapa[v] = String(val ??
|
|
259
|
+
mapa[v] = String(val ?? NO_CARGADO_AUN);
|
|
252
260
|
}
|
|
253
261
|
return mapa;
|
|
254
262
|
}
|
|
@@ -303,17 +311,16 @@ export const BreakeableText = React.memo(function BreakeableText(props: {
|
|
|
303
311
|
const path = matchTem[1];
|
|
304
312
|
const {encontrado, valor} = obtenerPorPath(infoHdr[idEnc], path)
|
|
305
313
|
|
|
306
|
-
return encontrado ? String(valor ??
|
|
314
|
+
return encontrado ? formatearResultadoComodin(String(valor ?? SIN_VALOR_EN_OBJETO_TEM)):
|
|
307
315
|
<span key={index} style={{ color: 'red' }}>
|
|
308
316
|
{`No se encontró ${parte}`}
|
|
309
|
-
</span>
|
|
310
|
-
);
|
|
317
|
+
</span>
|
|
311
318
|
}
|
|
312
319
|
|
|
313
320
|
// CASO 2: Variable dinámica con Hash (@#variable@)
|
|
314
321
|
const matchVarHash = parte.match(IS_VARIABLE_HASH_PATTERN);
|
|
315
322
|
if (matchVarHash) {
|
|
316
|
-
return obtenerValorVariable(matchVarHash[1]);
|
|
323
|
+
return formatearResultadoComodin(obtenerValorVariable(matchVarHash[1]));
|
|
317
324
|
}
|
|
318
325
|
|
|
319
326
|
// CASO 3: Comodín global de Redux (@comodin@)
|
|
@@ -324,7 +331,7 @@ export const BreakeableText = React.memo(function BreakeableText(props: {
|
|
|
324
331
|
? comodinesValores[nombreComodin]
|
|
325
332
|
: comodinesIniciales[nombreComodin as IdComodin];
|
|
326
333
|
|
|
327
|
-
return valor ??
|
|
334
|
+
return formatearResultadoComodin(valor) ??
|
|
328
335
|
<span key={index} style={{ color: 'red' }}>
|
|
329
336
|
{`No se encontró ${parte}`}
|
|
330
337
|
</span>
|
|
@@ -346,6 +353,32 @@ export function getBFVarNames(salto: string | null) {
|
|
|
346
353
|
};
|
|
347
354
|
}
|
|
348
355
|
|
|
356
|
+
export function registrarRespuestasBotonFormulario(opts: {
|
|
357
|
+
forPkPadre: ForPk,
|
|
358
|
+
salto: string | null,
|
|
359
|
+
expresionHabilitar?: string,
|
|
360
|
+
listoValor?: Valor,
|
|
361
|
+
agregarValor?: Valor,
|
|
362
|
+
habilitarValor?: Valor
|
|
363
|
+
}) {
|
|
364
|
+
var respuestasABypasear: { variable: IdVariable, respuesta: Valor }[] = [];
|
|
365
|
+
if (opts.salto) {
|
|
366
|
+
const { listo, agregar } = getBFVarNames(opts.salto);
|
|
367
|
+
if (opts.listoValor !== undefined) {
|
|
368
|
+
respuestasABypasear.push({ variable: listo, respuesta: opts.listoValor });
|
|
369
|
+
}
|
|
370
|
+
if (opts.agregarValor !== undefined) {
|
|
371
|
+
respuestasABypasear.push({ variable: agregar, respuesta: opts.agregarValor });
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
if (opts.expresionHabilitar && opts.habilitarValor !== undefined) {
|
|
375
|
+
respuestasABypasear.push({ variable: opts.expresionHabilitar as IdVariable, respuesta: opts.habilitarValor });
|
|
376
|
+
}
|
|
377
|
+
if (respuestasABypasear.length > 0) {
|
|
378
|
+
dispatchByPass(accion_registrar_respuestas, { forPk: opts.forPkPadre, respuestas: respuestasABypasear });
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
349
382
|
const VER_DOMINIO = false; // el encuestador no necesita ver el dominio en cada encuesta porque el dominio depende del área y se deduce del primer dígito del número de encuesta
|
|
350
383
|
// no poner VER_DOMINIO en true, cambiar por una variable que se fije si el DM está en modo prueba o en modo "diseño conceptual"
|
|
351
384
|
|
|
@@ -1459,14 +1492,14 @@ var botonFormularioConResumen = (
|
|
|
1459
1492
|
onClick: () => {
|
|
1460
1493
|
if (defBoton.esConfirmar) {
|
|
1461
1494
|
if (defBoton.num != null) {
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
}
|
|
1495
|
+
registrarRespuestasBotonFormulario({
|
|
1496
|
+
forPkPadre,
|
|
1497
|
+
salto: casillero.salto,
|
|
1498
|
+
expresionHabilitar: casillero.expresion_habilitar,
|
|
1499
|
+
listoValor: defBoton.num as Valor,
|
|
1500
|
+
agregarValor: 1 as Valor,
|
|
1501
|
+
habilitarValor: defBoton.num as Valor
|
|
1502
|
+
});
|
|
1470
1503
|
}
|
|
1471
1504
|
} else {
|
|
1472
1505
|
var button = document.getElementById(idButton)! as HTMLButtonElement;
|
|
@@ -1497,14 +1530,14 @@ var botonFormularioConResumen = (
|
|
|
1497
1530
|
onClick: () => {
|
|
1498
1531
|
if (defBoton.permiteBorrar) {
|
|
1499
1532
|
accion_borrar_formulario({ forPk, forPkPadre });
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
}
|
|
1533
|
+
registrarRespuestasBotonFormulario({
|
|
1534
|
+
forPkPadre,
|
|
1535
|
+
salto: casillero.salto,
|
|
1536
|
+
expresionHabilitar: casillero.expresion_habilitar,
|
|
1537
|
+
listoValor: null as unknown as Valor,
|
|
1538
|
+
agregarValor: defBoton.num === 1 ? (null as unknown as Valor) : undefined,
|
|
1539
|
+
habilitarValor: null as unknown as Valor
|
|
1540
|
+
});
|
|
1508
1541
|
} else if (defBoton.permiteBorrarGabinete && pedirConfirmacionBorrado) {
|
|
1509
1542
|
pedirConfirmacionBorrado(defBoton, forPkPadre);
|
|
1510
1543
|
}
|
|
@@ -1524,12 +1557,14 @@ var botonFormularioConResumen = (
|
|
|
1524
1557
|
]),
|
|
1525
1558
|
],
|
|
1526
1559
|
onClick: () => {
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1560
|
+
registrarRespuestasBotonFormulario({
|
|
1561
|
+
forPkPadre,
|
|
1562
|
+
salto: casillero.salto,
|
|
1563
|
+
expresionHabilitar: casillero.expresion_habilitar,
|
|
1564
|
+
listoValor: null as unknown as Valor,
|
|
1565
|
+
agregarValor: null as unknown as Valor,
|
|
1566
|
+
habilitarValor: null as unknown as Valor
|
|
1567
|
+
});
|
|
1533
1568
|
}
|
|
1534
1569
|
})
|
|
1535
1570
|
: null)
|
|
@@ -1745,11 +1780,14 @@ function BotonFormularioDespliegue(props: { casillero: BotonFormulario, formular
|
|
|
1745
1780
|
(nuevaForPk as any)[nuevoCampoPk] = defBoton.num
|
|
1746
1781
|
if (defBoton.esAgregar) {
|
|
1747
1782
|
dispatchByPass(accion_agregar_formulario, { forPk: nuevaForPk });
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1783
|
+
registrarRespuestasBotonFormulario({
|
|
1784
|
+
forPkPadre: props.forPk,
|
|
1785
|
+
salto: casillero.salto,
|
|
1786
|
+
expresionHabilitar: casillero.expresion_habilitar,
|
|
1787
|
+
listoValor: null as unknown as Valor,
|
|
1788
|
+
agregarValor: 1 as Valor,
|
|
1789
|
+
habilitarValor: null as unknown as Valor
|
|
1790
|
+
});
|
|
1753
1791
|
} else {
|
|
1754
1792
|
dispatchByPass(accion_abrir_formulario, { forPk: nuevaForPk });
|
|
1755
1793
|
// Si abro uno existente, también reseteo el listo para forzar que vuelvan a apretarlo si cambian algo
|
|
@@ -1850,14 +1888,14 @@ function BotonFormularioDespliegue(props: { casillero: BotonFormulario, formular
|
|
|
1850
1888
|
const {defBoton, forPkPadre} = confirmacionBorrado;
|
|
1851
1889
|
const forPk = defBoton.forPk;
|
|
1852
1890
|
accion_borrar_formulario({ forPk, forPkPadre });
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
}
|
|
1891
|
+
registrarRespuestasBotonFormulario({
|
|
1892
|
+
forPkPadre,
|
|
1893
|
+
salto: casillero.salto,
|
|
1894
|
+
expresionHabilitar: casillero.expresion_habilitar,
|
|
1895
|
+
listoValor: null as unknown as Valor,
|
|
1896
|
+
agregarValor: defBoton.num === 1 ? (null as unknown as Valor) : undefined,
|
|
1897
|
+
habilitarValor: null as unknown as Valor
|
|
1898
|
+
});
|
|
1861
1899
|
setConfirmacionBorrado(null);
|
|
1862
1900
|
setFraseBorrado('');
|
|
1863
1901
|
setErrorFraseBorrado(false);
|
|
@@ -3309,13 +3347,13 @@ function calcularComodines(forPk: ForPk) {
|
|
|
3309
3347
|
const fRealiz = respuestasAumentadas?.['f_realiz_o' as IdVariable];
|
|
3310
3348
|
const comodinesCalculados: Record<IdComodin, string> = {
|
|
3311
3349
|
...comodinesIniciales,
|
|
3312
|
-
canti_hogares: totalH != null ? String(totalH) :
|
|
3313
|
-
frealiz: fRealiz != null ? String(fRealiz) :
|
|
3314
|
-
resps1: (esEntrea && nombrer) ? String(nombrer) :
|
|
3315
|
-
parents1: (esEntrea && parentResp) ? parentResp :
|
|
3316
|
-
respi1: (esEntrea && personaRespi?.nombre) ? String(personaRespi.nombre) :
|
|
3317
|
-
parenti1: (esEntrea && parentRespi) ? parentRespi :
|
|
3318
|
-
njefe: (esEntrea && jefe?.nombre) ? String(jefe.nombre) :
|
|
3350
|
+
canti_hogares: totalH != null ? String(totalH) : NO_CARGADO_AUN,
|
|
3351
|
+
frealiz: fRealiz != null ? String(fRealiz) : NO_CARGADO_AUN,
|
|
3352
|
+
resps1: (esEntrea && nombrer) ? String(nombrer) : NO_CARGADO_AUN,
|
|
3353
|
+
parents1: (esEntrea && parentResp) ? parentResp : NO_CARGADO_AUN,
|
|
3354
|
+
respi1: (esEntrea && personaRespi?.nombre) ? String(personaRespi.nombre) : NO_CARGADO_AUN,
|
|
3355
|
+
parenti1: (esEntrea && parentRespi) ? parentRespi : NO_CARGADO_AUN,
|
|
3356
|
+
njefe: (esEntrea && jefe?.nombre) ? String(jefe.nombre) : NO_CARGADO_AUN,
|
|
3319
3357
|
...(semRef && { SEM_REF: semRef }),
|
|
3320
3358
|
...(d30Ref && { D30_REF: d30Ref }),
|
|
3321
3359
|
...(semanaObj?.mes_referencia && { MES_REF: mesReferencia(semanaObj.mes_referencia) }),
|
|
@@ -92,6 +92,16 @@ export declare function accion_registrar_respuesta(payload: {
|
|
|
92
92
|
siguienteVariable: IdVariable | "fin" | null | undefined;
|
|
93
93
|
variableActual: IdVariable | null;
|
|
94
94
|
};
|
|
95
|
+
export type RegistroRespuestaSimple = {
|
|
96
|
+
variable: IdVariable;
|
|
97
|
+
respuesta: Valor;
|
|
98
|
+
};
|
|
99
|
+
export declare function accion_registrar_respuestas(payload: {
|
|
100
|
+
forPk: ForPk;
|
|
101
|
+
respuestas: RegistroRespuestaSimple[];
|
|
102
|
+
}, _datosByPass: DatosByPass): {
|
|
103
|
+
recentModified: boolean;
|
|
104
|
+
};
|
|
95
105
|
export declare function accion_registrar_nota(payload: {
|
|
96
106
|
forPkRaiz: ForPkRaiz;
|
|
97
107
|
tarea: IdTarea;
|