From 8bf3614fa0a7bef3c7cace090a532d1d69917b63 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Tue, 23 Jun 2026 23:35:03 -0500 Subject: [PATCH] =?UTF-8?q?feat:=20condici=C3=B3n=20multi-valor=20en=20vis?= =?UTF-8?q?ibilidad=20condicional=20de=20formularios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Builder: - Picker de valor ahora es ${optsCampos} - ${optsValores} +
Ctrl+clic para marcar varios valores.
`; } else if (c.tipo === 'linked') { html += `
@@ -913,12 +916,19 @@ function abrirEditorCampo(idx) { function actualizarOpcionesCondicion(campoId) { const selValor = document.getElementById('ce-cond-valor'); if (!selValor) return; - if (!campoId) { selValor.innerHTML = ''; selValor.disabled = true; return; } + if (!campoId) { + selValor.innerHTML = ''; + selValor.disabled = true; + selValor.style.opacity = '.4'; + selValor.style.pointerEvents = 'none'; + return; + } const campo = _campos.find(f => f.id === campoId); const opts = campo?.options || []; - selValor.innerHTML = '' + - opts.map(o => ``).join(''); + selValor.innerHTML = opts.map(o => ``).join(''); selValor.disabled = false; + selValor.style.opacity = ''; + selValor.style.pointerEvents = ''; } function _insertarKey(key) { @@ -967,8 +977,12 @@ function aplicarCampo() { const condCampo = document.getElementById('ce-cond-campo'); const condValor = document.getElementById('ce-cond-valor'); if (condCampo !== null) { - if (condCampo.value && condValor.value) { - c.condicion = { campo_id: condCampo.value, valor: condValor.value }; + const selVals = condValor + ? [...condValor.selectedOptions].map(o => o.value).filter(Boolean) + : []; + if (condCampo.value && selVals.length) { + // ponytail: valores[] siempre, forma unificada + c.condicion = { campo_id: condCampo.value, valores: selVals }; } else { delete c.condicion; }