dmencu 3.2.8 → 3.2.9
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 +6 -1
- package/dist/client/unlogged/render-formulario.js +56 -5
- package/dist/client/unlogged/render-formulario.tsx +79 -4
- package/dist/server/server/table-tem.js +2 -2
- package/dist/unlogged/unlogged/render-formulario.d.ts +6 -1
- package/dist/unlogged/unlogged/render-formulario.js +56 -5
- package/dist/unlogged/unlogged/render-formulario.tsx +79 -4
- package/package.json +1 -1
|
@@ -2419,13 +2419,88 @@ export function DesplegarCitaPactada(props: { respuestas: Respuestas }) {
|
|
|
2419
2419
|
</div>
|
|
2420
2420
|
}
|
|
2421
2421
|
|
|
2422
|
+
let ordenPorDefectoGlobal: string[] | null = null;
|
|
2423
|
+
|
|
2424
|
+
/**
|
|
2425
|
+
* Permite a la app final (ej. ggs) definir el orden por defecto
|
|
2426
|
+
* para los atributos de la cita/seleccionado anterior.
|
|
2427
|
+
*/
|
|
2428
|
+
export function setOrdenPorDefectoAtributos(orden: string[]) {
|
|
2429
|
+
ordenPorDefectoGlobal = orden;
|
|
2430
|
+
}
|
|
2431
|
+
|
|
2422
2432
|
export function DesplegarCitaPactadaYSeleccionadoAnteriorTem(props: { tem: TEM }) {
|
|
2423
|
-
const {
|
|
2424
|
-
|
|
2433
|
+
const { cita } = props.tem;
|
|
2434
|
+
|
|
2435
|
+
if (!cita) return null;
|
|
2436
|
+
|
|
2437
|
+
let citaObjeto: Record<string, any> | null = null;
|
|
2438
|
+
|
|
2439
|
+
if (typeof cita === 'string' && (cita.startsWith('{') || cita.startsWith('['))) {
|
|
2440
|
+
try {
|
|
2441
|
+
const parsed = JSON.parse(cita);
|
|
2442
|
+
if (typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)) {
|
|
2443
|
+
citaObjeto = parsed;
|
|
2444
|
+
}
|
|
2445
|
+
} catch (e) {
|
|
2446
|
+
// No era un JSON válido
|
|
2447
|
+
}
|
|
2448
|
+
} else if (typeof cita === 'object' && cita !== null) {
|
|
2449
|
+
citaObjeto = cita;
|
|
2450
|
+
}
|
|
2451
|
+
|
|
2452
|
+
let claves: string[] = [];
|
|
2453
|
+
|
|
2454
|
+
if (citaObjeto) {
|
|
2455
|
+
const todasLasClaves = Object.keys(citaObjeto).filter((k) => k !== 'orden');
|
|
2456
|
+
|
|
2457
|
+
// Priority 1: 'orden' dentro del JSON individual
|
|
2458
|
+
// Priority 2: 'orden' global inyectado por la app final
|
|
2459
|
+
// Priority 3: null (orden no determinístico / tal como vienen las keys)
|
|
2460
|
+
const ordenEspecifico = Array.isArray(citaObjeto.orden) ? citaObjeto.orden : null;
|
|
2461
|
+
const ordenAplicar = ordenEspecifico || ordenPorDefectoGlobal;
|
|
2462
|
+
|
|
2463
|
+
if (ordenAplicar && ordenAplicar.length > 0) {
|
|
2464
|
+
claves = todasLasClaves.sort((a, b) => {
|
|
2465
|
+
const idxA = ordenAplicar.indexOf(a);
|
|
2466
|
+
const idxB = ordenAplicar.indexOf(b);
|
|
2467
|
+
|
|
2468
|
+
const posA = idxA !== -1 ? idxA : Number.MAX_SAFE_INTEGER;
|
|
2469
|
+
const posB = idxB !== -1 ? idxB : Number.MAX_SAFE_INTEGER;
|
|
2470
|
+
|
|
2471
|
+
return posA - posB;
|
|
2472
|
+
});
|
|
2473
|
+
} else {
|
|
2474
|
+
claves = todasLasClaves;
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
|
|
2478
|
+
return (
|
|
2425
2479
|
<div className="tem-cita">
|
|
2426
|
-
|
|
2480
|
+
{citaObjeto ? (
|
|
2481
|
+
<div
|
|
2482
|
+
className="tem-cita-grid"
|
|
2483
|
+
style={{
|
|
2484
|
+
display: 'flex',
|
|
2485
|
+
flexWrap: 'wrap',
|
|
2486
|
+
gap: '8px 16px',
|
|
2487
|
+
alignItems: 'center'
|
|
2488
|
+
}}
|
|
2489
|
+
>
|
|
2490
|
+
{claves.map((clave) => (
|
|
2491
|
+
<div key={clave} style={{ display: 'inline-flex', alignItems: 'center' }}>
|
|
2492
|
+
<Atributo
|
|
2493
|
+
nombre={`${clave}:`}
|
|
2494
|
+
valor={citaObjeto![clave]}
|
|
2495
|
+
/>
|
|
2496
|
+
</div>
|
|
2497
|
+
))}
|
|
2498
|
+
</div>
|
|
2499
|
+
) : (
|
|
2500
|
+
<Atributo nombre="Cita:" valor={cita} />
|
|
2501
|
+
)}
|
|
2427
2502
|
</div>
|
|
2428
|
-
|
|
2503
|
+
);
|
|
2429
2504
|
}
|
|
2430
2505
|
|
|
2431
2506
|
export function DesplegarTem(props: { tem: TEM }) {
|
package/package.json
CHANGED