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 / option-field / assets / build / checkbox.js
jetformbuilder / modules / option-field / assets / build Last commit date
auto-update.asset.php 2 months ago auto-update.css 3 months ago auto-update.js 2 months ago checkbox.asset.php 2 months ago checkbox.css 2 years ago checkbox.js 2 months ago custom.options.restrictions.asset.php 2 months ago custom.options.restrictions.js 2 months ago editor.asset.php 2 months ago editor.css 3 months ago editor.js 2 months ago radio.asset.php 2 months ago radio.css 2 years ago radio.js 2 months ago select.asset.php 2 months ago select.css 2 years ago select.js 2 months ago
checkbox.js
1 lines
1 (()=>{var t={554(){const{CalculatedFormula:t}=JetFormBuilderAbstract,{addAction:e}=JetPlugins.hooks,r="__JFB_OPTION_FIELD_DEFAULT_VALUE_OBSERVER__";function n(t){if("string"!=typeof t||t.length<2)return t;const e=t.charAt(0),r=t.charAt(t.length-1);return"'"===e&&"'"===r||'"'===e&&'"'===r?t.slice(1,-1):t}function o(t){return Array.isArray(t)?t.some(o):"string"==typeof t&&t.includes("%")}function s(t){return!(""===t||null===t||Array.isArray(t)&&!t.length)}function i(e,r){const i=Array.isArray(r)?r:[r],a=[],u=new Array(i.length);i.forEach((c,l)=>{const d=new t(e);d.observe(function(t){if("string"!=typeof t)return t;const e=t.trim();return!o(e)||function(t){if("string"!=typeof t||t.length<2)return!1;const e=t.charAt(0),r=t.charAt(t.length-1);return"'"===e&&"'"===r||'"'===e&&'"'===r}(e)?e:`'${e.replace(/'/g,"\\'")}'`}(c)),d.setResult=()=>{const t=d.calculate();s(t)&&(u[l]=t,Object.keys(u).length===i.length&&u.every(s)&&(function(t,e){if(Array.isArray(e))return void t.value.setIfEmpty(e.map(t=>n(""+t)));const r=n(""+e);if(!t.isArray())return function(t){if(t.isArray()||"select"!==t.inputType)return!1;const[e]=t.nodes;if(!e||"select-one"!==e.type||e.multiple||!e.options?.length)return!1;const r=Array.from(e.options),[n]=r;return!!n&&!r.some(t=>""===t.value)&&!r.some(t=>t.defaultSelected)&&0===e.selectedIndex&&e.value===n.value}(t)?void(t.value.current=r):void t.value.setIfEmpty(r);const o=function(t){if("string"!=typeof t)return t;const e=t.trim();try{const r=JSON.parse(e);return Array.isArray(r)?r:t}catch(r){if(e.startsWith("[")&&e.endsWith("]")&&e.includes("'"))try{const r=e.replace(/'((?:\\'|[^'])*)'/g,(t,e)=>`"${e.replace(/"/g,'\\"')}"`),n=JSON.parse(r);return Array.isArray(n)?n:t}catch(e){return t}return t}}(r);t.value.setIfEmpty(Array.isArray(o)?o.map(t=>n(""+t)):[r])}(e,Array.isArray(r)?u:u[0]),a.forEach(t=>t.clearWatchers())))},d.setResult(),a.push(d)})}function a(t){var e,r,n;const[s]=t.nodes,a=null!==(e=t.wrapper)&&void 0!==e?e:s,u=null!==(r=null!==(n=a?.dataset?.defaultVal)&&void 0!==n?n:s?.dataset?.defaultVal)&&void 0!==r?r:"",c=function(t){if("string"!=typeof t)return t;const e=t.trim();try{const t=JSON.parse(e);return Array.isArray(t)?t:e}catch(t){if(e.startsWith("[")&&e.endsWith("]")&&e.includes("'"))try{const t=e.replace(/'((?:\\'|[^'])*)'/g,(t,e)=>`"${e.replace(/"/g,'\\"')}"`),r=JSON.parse(t);return Array.isArray(r)?r:e}catch(t){return e}return e}}(u);(function(t,e){if(Array.isArray(e))return e.length>0;if("string"!=typeof t)return o(e);const r=t.trim();return o(e)||r.startsWith("[")&&r.endsWith("]")})(u,c)&&i(t,c)}window[r]||(window[r]=!0,e("jet.fb.observe.after","jet-form-builder/option-field-default-value",function(t){for(const e of t.getInputs()){const[t]=e.nodes;t&&["select","radio","checkbox"].includes(e.inputType)&&a(e)}}))}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var s=e[n]={exports:{}};return t[n](s,s.exports,r),s.exports}(()=>{"use strict";const t=function(t){return t.nextElementSibling.querySelector("input.text-field")},e=function(t,e,r){var n;if(t.checked=e?.includes(t.value),!t.checked)return;if(r.calcValue+=parseFloat(null!==(n=t.dataset?.calculate)&&void 0!==n?n:t.value),!r.isArray())return;const o=e.indexOf(t.value);e.splice(o,1)},{isEmpty:n}=JetFormBuilderFunctions,{InputData:o,ReactiveHook:s}=JetFormBuilderAbstract,{getParsedName:i}=JetFormBuilderFunctions;function a(){o.call(this),this.wrapper=null,this.isResetCalcValue=!1}a.prototype=Object.create(o.prototype),a.prototype.wrapper=null,a.prototype.isSupported=function(t){return t.classList.contains("checkradio-wrap")&&t.querySelector(".checkboxes-wrap")},a.prototype.addListeners=function(){this.enterKey=new s,this.wrapper.addEventListener("change",this.onChangeValue.bind(this)),this.wrapper.addEventListener("keydown",this.handleEnterKey.bind(this)),this.wrapper.addEventListener("focusout",t=>{[...this.nodes].includes(t?.relatedTarget)||t?.relatedTarget?.closest?.(".jet-form-builder__field-wrap.custom-option")||this.reportOnBlur()}),this.addNewButton&&this.wrapper.addEventListener("click",t=>{t?.target&&!this.addNewButton.isEqualNode(t.target)||(this.silenceSet([...this.value.current,!0]),this.getCustomNodes().at(-1).closest(".jet-form-builder__field-wrap").querySelector("span input.jet-form-builder__field").focus())}),this.isArray()&&this.sanitize(t=>function(t,e){return Array.isArray(t)?(!e?.keepCommas&&1===t.length&&t[0]&&1!=t[0]&&String(t[0]).includes(",")&&(t=(t=String(t[0]).split(",")).map(t=>"true"===t?"":"false"===t?null:t)),t):[t].filter(Boolean)}(t,this)),this.callable=null,this.sanitize(r=>function(r,o){o.calcValue=0;const s=o.isArray()?[...r]:r;for(const t of o.nodes)!t.dataset.custom&&e(t,s,o);if(!o.addNewButton)return r;const i=o.getCustomNodes();if(!i.length||s.length){for(let e=Math.max(i.length,s.length)-1;e>=0;e--){let r=i[e];const a=s[e];if(null==a){r&&r.closest(".custom-option").remove();continue}if(void 0===r){if(!1===a)continue;o.addCustomOption(),r=o.nodes[o.nodes.length-1]}const u=t(r);u.disabled=!1===a,u.disabled||n(a)||!0===a||(o.calcValue+=1),u.value!==a&&"boolean"!=typeof a&&(u.value=a)}return r.filter(t=>null!==t)}for(let t=Math.max(i.length,s.length)-1;t>=0;t--)if(i[t]){let e=i[t];void 0===s[t]&&e.closest(".custom-option").remove()}}(r,this))},a.prototype.onChangeValue=function(t){this.value.current=this.getActiveValue()},a.prototype.setValue=function(){this.value.current=this.getActiveValue(),this.value.applySanitizers(this.value.current)},a.prototype.setNode=function(t){t.jfbSync=this,this.nodes=t.getElementsByClassName("jet-form-builder__field checkboxes-field"),this.rawName=this.nodes[0].name,this.name=i(this.rawName),this.inputType="checkbox",this.wrapper=t,this.addNewButton=t.querySelector(".jet-form-builder__field-wrap.custom-option .add-custom-option")},a.prototype.getActiveValue=function(){var t;const e=[];this.keepCommas=!1;for(const t of this.nodes)t.checked&&"1"===t.dataset.keepCommas&&(this.keepCommas=!0),this.processValueFormSingleChoice(t,e);return this.isArray()?e:null!==(t=e?.[0])&&void 0!==t?t:""},a.prototype.processValueFormSingleChoice=function(e,r){if(!e.dataset.custom&&!e.checked)return;if(!e.dataset.custom)return void r.push(e.value);const n=t(e);e.checked||n.value?n.value||!e.checked?n.value&&r.push(!!e.checked&&n.value):r.push(!0):r.push(null)},a.prototype.isArray=function(){return Boolean(this.addNewButton)||this.nodes.item&&this.nodes.item(0)?.name?.includes?.("[]")},a.prototype.addCustomOption=function(){const t=this.addNewButton.closest(".custom-option");return this.wrapper.insertBefore(this.getCustomOptionNode(),t)},a.prototype.getCustomOptionNode=function(){if(!this.addNewButton)return!1;const t=this.addNewButton.querySelector("template"),e=document.createElement("template");return e.innerHTML=t.innerHTML.trim(),e.content.firstChild},a.prototype.getCustomNodes=function(){return[...this.nodes].filter(t=>t.dataset.custom&&t.nextElementSibling)};const u=a;r(554);const{addFilter:c}=JetPlugins.hooks;window.JetFormBuilderAbstract={...window.JetFormBuilderAbstract,CheckboxData:u},c("jet.fb.inputs","jet-form-builder/checkbox-field",function(t){return[u,...t]})})()})();