PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.5
JetFormBuilder — Dynamic Blocks Form Builder v3.6.5
3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / modules / advanced-choices / assets / build / frontend / choices.field.js
jetformbuilder / modules / advanced-choices / assets / build / frontend Last commit date
choices.field.asset.php 2 months ago choices.field.js 2 months ago
choices.field.js
1 lines
1 (()=>{"use strict";function t(t){return t?.classList?.contains("jet-form-builder-choice")}function e(t){return t.closest(".jet-form-builder-choice--item")}const{InputData:i,ReactiveSet:n,ReactiveHook:o}=JetFormBuilderAbstract,{getParsedName:s}=JetFormBuilderFunctions;function r(){i.call(this),this.isSupported=t,this.setNode=function(t){t.jfbSync=this,this.nodes=Array.from(t.querySelectorAll(".jet-form-builder-choice--item input")),this.rawName=this.nodes[0].name,this.name=s(this.rawName),this.inputType="choice"},this.setValue=function(){this.value.current=this.isArray()?this.getMultipleValue():this.getSingleValue()},this.addListeners=function(){for(const t of this.nodes)t.addEventListener("change",()=>this.setValue()),this.addListenerForChoice(t);this.isArray()&&this.sanitize(t=>Array.isArray(t)?t:[t])},this.getMultipleValue=function(){return Array.from(this.nodes).filter(t=>t.checked).map(t=>t.value)},this.getSingleValue=function(){for(const t of this.nodes)if(t.checked)return t.value;return""},this.addListenerForChoice=function(t){const i=e(t);i.addEventListener("click",e=>this.toggleChoice(t,e)),this.enterKey=new o,this.isNativeControl(t)?t.addEventListener("keydown",this.handleEnterKey.bind(this)):i.addEventListener("keydown",e=>{this.handleEnterKey(e),this.handleSpaceKey(e,t),this.isArray()||(this.handleNextKey(e,t),this.handlePrevKey(e,t))})},this.toggleChoice=function(t,e){e.target.closest(".jet-form-builder-choice--item-control label")||(this.isArray()?this.value.toggle(t.value):this.value.current!==t.value?this.value.current=t.value:this.value.current="")},this.hasAutoScroll=function(){return this.isNativeControl(this.nodes[0])},this.focusRaw=function(){const[t]=this.nodes;this.isNativeControl(t)?i.prototype.focusRaw.call(this):e(t).focus({preventScroll:!0})}}r.prototype=Object.create(i.prototype),r.prototype.getReactive=function(){return new n},r.prototype.isNativeControl=function(t){return t.classList.contains("jet-form-builder-choice--item-control-input")},r.prototype.handleNextKey=function(t,e){if(!["ArrowRight","ArrowDown"].includes(t.key))return;t.preventDefault();const i=this.nextNode(e);this.switchChoice(t,i)},r.prototype.handlePrevKey=function(t,e){if(!["ArrowUp","ArrowLeft"].includes(t.key))return;t.preventDefault();const i=this.prevNode(e);this.switchChoice(t,i)},r.prototype.handleSpaceKey=function(t,e){["Spacebar"," "].includes(t.key)&&(t.preventDefault(),this.toggleChoice(e,t))},r.prototype.switchChoice=function(t,i){const n=e(i);this.toggleChoice(i,t),n.focus({preventScroll:!0})},r.prototype.nextNode=function(t){for(const[e,i]of this.nodes.entries())if(i===t)return this.nodes.hasOwnProperty(+e+1)?this.nodes[+e+1]:this.nodes[0]},r.prototype.prevNode=function(t){for(const[e,i]of this.nodes.entries())if(i===t)return this.nodes.at(e-1)};const c=r,{BaseSignal:a}=JetFormBuilderAbstract,{isEmpty:h}=JetFormBuilderFunctions;function u(){a.call(this),this.isRadio=null,this.indexedFirst=!1,this.isSupported=function(t,i){return!!e(t)},this.runSignal=function(){this.input.calcValue=0,this.indexedFirst=!1;for(const i of this.input.nodes){var t;i.checked=this.isRadio?this.input.value.current===i.value:this.input.value.current?.includes(i.value);const n=e(i);this.toggleTabIndex(i,n),n.classList.toggle("is-checked",i.checked),n.ariaChecked=i.checked,this.toggleImageControl(n,i.checked),i.checked&&(this.input.calcValue+=parseFloat(null!==(t=i.dataset?.calculate)&&void 0!==t?t:i.value))}},this.setInput=function(t){a.prototype.setInput.call(this,t),this.isRadio=!this.input.isArray()}}u.prototype=Object.create(a.prototype),u.prototype.toggleImageControl=function(t,e){const i=t.querySelectorAll(".jet-form-builder-choice--item-control-img");for(const t of i)t.style.display=e?t.classList.contains("checked")?"":"none":t.classList.contains("checked")?"none":""},u.prototype.toggleTabIndex=function(t,e){if(this.isRadio&&!this.input.isNativeControl(t))return h(this.input.value.current)?(this.setRawTabIndex(e,this.indexedFirst?-1:0),void(this.indexedFirst=!0)):void this.setRawTabIndex(e,t.checked?0:-1)},u.prototype.setRawTabIndex=function(t,e){e!==t.tabIndex&&(t.tabIndex=e)};const l=u,{addFilter:d}=JetPlugins.hooks;d("jet.fb.inputs","jet-form-builder/choices-field",function(t){return[c,...t]}),d("jet.fb.signals","jet-form-builder/choices-field",function(t){return[l,...t]},20)})();