dmencu 2.2.5 → 2.2.7
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.
|
@@ -98,6 +98,15 @@ function breakeableText(text: string | null, diccionario?: { [clave: string]: Re
|
|
|
98
98
|
*/
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
export function getBFVarNames(salto: string | null) {
|
|
102
|
+
const armoNomSalto = salto?.substring(0, 2) == 'F:' ? salto.slice(2) : salto;
|
|
103
|
+
return {
|
|
104
|
+
listo: '$B.F:' + armoNomSalto as IdVariable,
|
|
105
|
+
agregar: '$B.F:' + armoNomSalto + '_agregar' as IdVariable,
|
|
106
|
+
idFormulario: 'F:' + armoNomSalto as IdFormulario
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
101
110
|
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
|
|
102
111
|
// 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"
|
|
103
112
|
|
|
@@ -1116,12 +1125,9 @@ var botonFormularioConResumen = (
|
|
|
1116
1125
|
if (defBoton.esConfirmar) {
|
|
1117
1126
|
if (defBoton.num != null) {
|
|
1118
1127
|
if (casillero.salto) {
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable:
|
|
1122
|
-
|
|
1123
|
-
var BF_varname_agregar = '$B.F:' + armoNomSalto + '_agregar' as IdVariable;
|
|
1124
|
-
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: BF_varname_agregar, respuesta: 1 as Valor });
|
|
1128
|
+
const { listo, agregar } = getBFVarNames(casillero.salto);
|
|
1129
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: listo, respuesta: defBoton.num as Valor });
|
|
1130
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: agregar, respuesta: 1 as Valor });
|
|
1125
1131
|
}
|
|
1126
1132
|
if (casillero.expresion_habilitar) {
|
|
1127
1133
|
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: casillero.expresion_habilitar as IdVariable, respuesta: defBoton.num as Valor });
|
|
@@ -1154,13 +1160,11 @@ var botonFormularioConResumen = (
|
|
|
1154
1160
|
]),
|
|
1155
1161
|
onClick: () => {
|
|
1156
1162
|
accion_borrar_formulario({ forPk, forPkPadre });
|
|
1157
|
-
|
|
1158
|
-
var BF_varname_agregar = '$B.F:' + armoNomSalto + '_agregar' as IdVariable;
|
|
1159
|
-
var BF_varname_listo = '$B.F:' + armoNomSalto as IdVariable;
|
|
1163
|
+
const { listo, agregar } = getBFVarNames(casillero.salto);
|
|
1160
1164
|
if (defBoton.num === 1) {
|
|
1161
|
-
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable:
|
|
1165
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: agregar, respuesta: null as unknown as Valor });
|
|
1162
1166
|
}
|
|
1163
|
-
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable:
|
|
1167
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: listo, respuesta: null as unknown as Valor });
|
|
1164
1168
|
if (casillero.expresion_habilitar) {
|
|
1165
1169
|
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: casillero.expresion_habilitar as IdVariable, respuesta: null as unknown as Valor });
|
|
1166
1170
|
}
|
|
@@ -1180,11 +1184,9 @@ var botonFormularioConResumen = (
|
|
|
1180
1184
|
]),
|
|
1181
1185
|
],
|
|
1182
1186
|
onClick: () => {
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: BF_varname_agregar, respuesta: null as unknown as Valor });
|
|
1187
|
-
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: BF_varname_listo, respuesta: null as unknown as Valor });
|
|
1187
|
+
const { listo, agregar } = getBFVarNames(casillero.salto);
|
|
1188
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: agregar, respuesta: null as unknown as Valor });
|
|
1189
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: listo, respuesta: null as unknown as Valor });
|
|
1188
1190
|
if (casillero.expresion_habilitar) {
|
|
1189
1191
|
dispatchByPass(accion_registrar_respuesta, { forPk: forPkPadre, variable: casillero.expresion_habilitar as IdVariable, respuesta: null as unknown as Valor });
|
|
1190
1192
|
}
|
|
@@ -1236,10 +1238,7 @@ function BotonFormularioDespliegue(props: { casillero: BotonFormulario, formular
|
|
|
1236
1238
|
var { casillero, forPk } = props;
|
|
1237
1239
|
var habilitador = casillero.expresion_habilitar_js ? getFuncionHabilitar(casillero.expresion_habilitar_js) : () => true;
|
|
1238
1240
|
var { opciones } = useSelectorVivienda(forPk);
|
|
1239
|
-
|
|
1240
|
-
var armoNomSalto = casillero.salto?.substring(0, 2) == 'F:' ? casillero.salto.slice(2) : casillero.salto;
|
|
1241
|
-
//console.log('BotonFormularioDespliegue armoNomSalto ' +armoNomSalto);
|
|
1242
|
-
var idFormularioDestino = 'F:' + armoNomSalto! as IdFormulario;
|
|
1241
|
+
var { listo: BF_listo, agregar: BF_agregar, idFormulario: idFormularioDestino } = getBFVarNames(casillero.salto);
|
|
1243
1242
|
var estructura = getEstructura();
|
|
1244
1243
|
var { formularioAAbrir } = useSelector((_state: CasoState) => ({
|
|
1245
1244
|
formularioAAbrir: estructura.formularios[idFormularioDestino].casilleros,
|
|
@@ -1264,10 +1263,9 @@ function BotonFormularioDespliegue(props: { casillero: BotonFormulario, formular
|
|
|
1264
1263
|
var multipleFormularios = formularioAAbrir.unidad_analisis != props.formulario.unidad_analisis;
|
|
1265
1264
|
var nuevoCampoPk = defOperativo.defUA[formularioAAbrir.unidad_analisis].pk;
|
|
1266
1265
|
// var var_name='$B.'+casillero.salto; //original
|
|
1267
|
-
var
|
|
1268
|
-
var idSeccion = `seccion-boton-formulario-${var_name}`;
|
|
1266
|
+
var idSeccion = `seccion-boton-formulario-${BF_listo}`;
|
|
1269
1267
|
var idButton = `special-button-${idSeccion}`;
|
|
1270
|
-
var var_name_registro = multipleFormularios ?
|
|
1268
|
+
var var_name_registro = multipleFormularios ? BF_agregar : BF_listo;
|
|
1271
1269
|
registrarElemento<HTMLDivElement>({
|
|
1272
1270
|
id: idSeccion,
|
|
1273
1271
|
variable: var_name_registro,
|
|
@@ -1279,25 +1277,25 @@ function BotonFormularioDespliegue(props: { casillero: BotonFormulario, formular
|
|
|
1279
1277
|
}
|
|
1280
1278
|
) => {
|
|
1281
1279
|
try {
|
|
1282
|
-
var estado_listo = feedbackRow.feedback[
|
|
1283
|
-
var estado_agregar = multipleFormularios ? (feedbackRow.feedback[
|
|
1280
|
+
var estado_listo = feedbackRow.feedback[BF_listo]?.estado || 'valida';
|
|
1281
|
+
var estado_agregar = multipleFormularios ? (feedbackRow.feedback[BF_agregar]?.estado || 'valida') : 'valida';
|
|
1284
1282
|
var estado_general = estado_agregar !== 'valida' ? estado_agregar : estado_listo;
|
|
1285
1283
|
setAttrDistinto(div, 'nuestro-validator', estado_general);
|
|
1286
1284
|
setAttrDistinto(div, 'tiene-valor', estado_general === 'valida' ? 'valido' : 'NO');
|
|
1287
1285
|
|
|
1288
1286
|
var listaDeBotonesAbrir: DefinicionFormularioAbrir[] = [];
|
|
1289
1287
|
// var esVarActual = feedbackRow.actual == '$B.F:'+casillero.salto; //original
|
|
1290
|
-
var esVarActual = !!feedbackRow.actual?.startsWith(
|
|
1288
|
+
var esVarActual = !!feedbackRow.actual?.startsWith(BF_listo);
|
|
1291
1289
|
// console.log('BotonFormularioDespliegue esVarActual ' +esVarActual );
|
|
1292
1290
|
if (multipleFormularios && casillero.salto != null) {
|
|
1293
1291
|
// let defFormulario:InfoFormulario = estructura.formularios['F:'+casillero.salto as IdFormulario]; //original
|
|
1294
|
-
let defFormulario: InfoFormulario = estructura.formularios[
|
|
1292
|
+
let defFormulario: InfoFormulario = estructura.formularios[idFormularioDestino];
|
|
1295
1293
|
let defUA = estructura.unidades_analisis[defFormulario.casilleros.unidad_analisis!];
|
|
1296
1294
|
let conjunto = respuestasAumentadas[defFormulario.casilleros.unidad_analisis!];
|
|
1297
1295
|
let cantidadEsperada = respuestasAumentadas[casillero.expresion_habilitar as IdVariable];
|
|
1298
1296
|
var numActual: number | null = null;
|
|
1299
1297
|
// var estadoDelBoton = feedbackRow.feedback['$B.F:'+casillero.salto as IdVariable].estado //original
|
|
1300
|
-
var estadoDelBoton = feedbackRow.feedback[
|
|
1298
|
+
var estadoDelBoton = feedbackRow.feedback[BF_listo].estado
|
|
1301
1299
|
// console.log('BotonFormularioDespliegue estadoDelBoton ' +estadoDelBoton );
|
|
1302
1300
|
var configSorteoFormulario = estructura.configSorteo ? estructura.configSorteo[getMainFormForVivienda(forPk[estructura.pkAgregadaUaPpal])] : null
|
|
1303
1301
|
var habilitacionBotonFormulario = estructura.habilitacionBotonFormulario;
|
|
@@ -1324,8 +1322,12 @@ function BotonFormularioDespliegue(props: { casillero: BotonFormulario, formular
|
|
|
1324
1322
|
if ("puede agregar //TODO VER ESTO" && (conjunto instanceof Array || conjunto == null)) {
|
|
1325
1323
|
let nuevoValorPk = (conjunto == null ? 0 : conjunto.length) + 1;
|
|
1326
1324
|
let forPk = { ...props.forPk, formulario: idFormularioDestino, [nuevoCampoPk]: nuevoValorPk };
|
|
1327
|
-
let
|
|
1328
|
-
|
|
1325
|
+
let listoPresionado = respuestasAumentadas[BF_listo] != null;
|
|
1326
|
+
let debeAgregarOlisto = numActual == null &&
|
|
1327
|
+
(casillero.expresion_habilitar ?
|
|
1328
|
+
(cantidadEsperada == null || cantidadEsperada != (conjunto != null && conjunto.length))
|
|
1329
|
+
: !listoPresionado
|
|
1330
|
+
) && (estadoDelBoton == 'valida' || esVarActual);
|
|
1329
1331
|
listaDeBotonesAbrir.push({
|
|
1330
1332
|
forPk,
|
|
1331
1333
|
num: nuevoValorPk,
|
|
@@ -1382,33 +1384,32 @@ function BotonFormularioDespliegue(props: { casillero: BotonFormulario, formular
|
|
|
1382
1384
|
dispatch(dispatchers.VOLVER_HDR({}));
|
|
1383
1385
|
} else {
|
|
1384
1386
|
var nuevaForPk = { ...forPk, formulario: idFormularioDestino };
|
|
1385
|
-
var
|
|
1387
|
+
var { listo: BF_listo, agregar: BF_agregar } = getBFVarNames(casillero.salto);
|
|
1386
1388
|
if (multipleFormularios) {
|
|
1387
1389
|
// @ts-ignore forPk y sus componentes
|
|
1388
1390
|
nuevaForPk[nuevoCampoPk] = defBoton.num
|
|
1389
1391
|
if (defBoton.esAgregar) {
|
|
1390
1392
|
dispatchByPass(accion_agregar_formulario, { forPk: nuevaForPk });
|
|
1391
|
-
|
|
1392
|
-
dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable:
|
|
1393
|
-
dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable: BF_varname, respuesta: null as unknown as Valor });
|
|
1393
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable: BF_agregar, respuesta: 1 as Valor });
|
|
1394
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable: BF_listo, respuesta: null as unknown as Valor });
|
|
1394
1395
|
if (casillero.expresion_habilitar) {
|
|
1395
1396
|
dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable: casillero.expresion_habilitar as IdVariable, respuesta: null as unknown as Valor });
|
|
1396
1397
|
}
|
|
1397
1398
|
} else {
|
|
1398
1399
|
dispatchByPass(accion_abrir_formulario, { forPk: nuevaForPk });
|
|
1399
1400
|
// Si abro uno existente, también reseteo el listo para forzar que vuelvan a apretarlo si cambian algo
|
|
1400
|
-
dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable:
|
|
1401
|
+
//dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable: BF_listo, respuesta: null as unknown as Valor });
|
|
1401
1402
|
}
|
|
1402
1403
|
} else {
|
|
1403
|
-
dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable:
|
|
1404
|
+
dispatchByPass(accion_registrar_respuesta, { forPk: props.forPk, variable: BF_listo, respuesta: 1 as Valor });
|
|
1404
1405
|
}
|
|
1405
1406
|
dispatch(dispatchers.CAMBIAR_FORMULARIO({ forPk: nuevaForPk, apilarVuelta: true }));
|
|
1406
1407
|
}
|
|
1407
1408
|
if (confirmarForzarIr) { setConfirmarForzarIr(false) }
|
|
1408
1409
|
};
|
|
1409
1410
|
return <DesplegarCasillero casillero={casillero}>
|
|
1410
|
-
{multipleFormularios && <span id={'var-' +
|
|
1411
|
-
<span id={'var-' +
|
|
1411
|
+
{multipleFormularios && <span id={'var-' + BF_agregar} style={{ position: 'absolute', marginTop: '-60px' }}></span>}
|
|
1412
|
+
<span id={'var-' + BF_listo} style={{ position: 'absolute', marginTop: '-60px' }}></span>
|
|
1412
1413
|
<div id={idSeccion}>
|
|
1413
1414
|
</div>
|
|
1414
1415
|
<Button className="special-button" id={idButton}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { CasoState, EstadoCarga, ForPk, ForPkRaiz, Formulario, IdFormulario, IdVariable, PlainForPk, Respuestas, RespuestaLasUA, RespuestasRaiz, Valor, TEM, IdCarga, Carga, IdFin, InformacionHdr, IdOperativo, IdEnc, Libre } from "./tipos";
|
|
3
3
|
import { FormStructureState } from "row-validator";
|
|
4
|
+
export declare function getBFVarNames(salto: string | null): {
|
|
5
|
+
listo: IdVariable;
|
|
6
|
+
agregar: IdVariable;
|
|
7
|
+
idFormulario: IdFormulario;
|
|
8
|
+
};
|
|
4
9
|
type CommonAttributes = {
|
|
5
10
|
className?: string;
|
|
6
11
|
style?: React.CSSProperties;
|