PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.5.6.3
JetFormBuilder — Dynamic Blocks Form Builder v3.5.6.3
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 / assets / build / frontend / calculated.field.js
jetformbuilder / assets / build / frontend Last commit date
advanced.reporting.asset.php 4 months ago advanced.reporting.js 4 months ago calculated.field.asset.php 8 months ago calculated.field.js 8 months ago conditional.block.asset.php 8 months ago conditional.block.js 8 months ago dynamic.value.asset.php 1 year ago dynamic.value.js 1 year ago main.asset.php 6 months ago main.css 7 months ago main.js 6 months ago media.field.asset.php 8 months ago media.field.js 8 months ago media.field.restrictions.asset.php 1 year ago media.field.restrictions.js 1 year ago multi.step.asset.php 1 year ago multi.step.js 1 year ago
calculated.field.js
1 lines
1 (()=>{"use strict";var __webpack_modules__={7889:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{function getCalculatedWrapper(e){return e.closest(".jet-form-builder__calculated-field")}function isCalculated(e){var t;return!(null===(t=getCalculatedWrapper(e)?.dataset?.formula?.length)||void 0===t||!t)}function convertMillisToDateString(millisInput,format="YYYY-MM-DD"){const millis=eval(millisInput);if(!millis||isNaN(millis)||null===millis||0===millis)return 0;const date=new Date(millis),monthsFull=["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort=monthsFull.map((e=>e.slice(0,3))),daysFull=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort=daysFull.map((e=>e.slice(0,3))),hours12=date.getHours()%12||12,ampm=date.getHours()>=12?"PM":"AM",map={YYYY:date.getFullYear(),MM:String(date.getMonth()+1).padStart(2,"0"),M:date.getMonth()+1,MMM:monthsShort[date.getMonth()],MMMM:monthsFull[date.getMonth()],DD:String(date.getDate()).padStart(2,"0"),D:date.getDate(),HH:String(date.getHours()).padStart(2,"0"),H:date.getHours(),hh:String(hours12).padStart(2,"0"),h:hours12,mm:String(date.getMinutes()).padStart(2,"0"),m:date.getMinutes(),ss:String(date.getSeconds()).padStart(2,"0"),s:date.getSeconds(),dddd:daysFull[date.getDay()],ddd:daysShort[date.getDay()],A:ampm},sortedKeys=Object.keys(map).sort(((e,t)=>t.length-e.length));let formatted=format;const placeholders={};sortedKeys.forEach(((e,t)=>{const a=`\0${t}\0`;placeholders[a]=String(map[e]);const i=e.length<=2&&/^[a-zA-Z]+$/.test(e)?new RegExp(`\\b${e}\\b`,"g"):new RegExp(e,"g");formatted=formatted.replace(i,a)}));for(const[e,t]of Object.entries(placeholders))formatted=formatted.split(e).join(t);return formatted}__webpack_require__.d(__webpack_exports__,{eN:()=>convertMillisToDateString,u3:()=>getCalculatedWrapper,vf:()=>isCalculated})}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var a=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](a,a.exports,__webpack_require__),a.exports}__webpack_require__.d=(e,t)=>{for(var a in t)__webpack_require__.o(t,a)&&!__webpack_require__.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var __webpack_exports__={},functions=__webpack_require__(7889),_window$JetFormBuilde;const{InputData,CalculatedFormula}=window.JetFormBuilderAbstract,{applyFilters}=JetPlugins.hooks,{applyFilters:deprecatedApplyFilters=!1}=null!==(_window$JetFormBuilde=window?.JetFormBuilderMain?.filters)&&void 0!==_window$JetFormBuilde?_window$JetFormBuilde:{};function CalculatedData(){InputData.call(this),this.formula="",this.precision=0,this.sepDecimal="",this.sepThousands="",this.visibleValNode=null,this.valueTypeProp="number",this.isSupported=function(e){return(0,functions.vf)(e)},this.setValue=function(){const e=new CalculatedFormula(this,{forceFunction:!0});e.observe(this.formula),e.setResult=()=>{if("date"===this.valueTypeProp){const t=e.calculate();this.value.current=(0,functions.eN)(t,this.dateFormat)}else this.value.current=e.calculate()},e.relatedCallback=e=>{const t=applyFilters("jet.fb.calculated.callback",!1,e,this);if(!1!==t)return t;const a="number"===this.valueTypeProp?e.calcValue:e.value.current;if(!1===deprecatedApplyFilters)return a;const i=deprecatedApplyFilters("forms/calculated-field-value",e.value.current,jQuery(e.nodes[0]));return i===e.value.current?a:i},e.emptyValue=()=>"number"===this.valueTypeProp?0:"",e.setResult(),this.value.current=this.value.applySanitizers(this.value.current),this.beforeSubmit((t=>{this.value.silence(),this.value.current=null,this.value.silence(),e.setResult(),t()}),this)},this.setNode=function(e){InputData.prototype.setNode.call(this,e),InputData.prototype.reQueryValue=()=>{};const{formula:t,precision:a,sepDecimal:i,valueType:r,sepThousands:l,dateFormat:s}=(0,functions.u3)(e).dataset;this.formula=t,this.precision=+a,this.sepDecimal=null!=i?i:"",this.sepThousands=null!=l?l:"",this.visibleValNode=e.nextElementSibling,this.valueTypeProp=r,this.dateFormat=s,this.inputType="calculated"},this.addListeners=function(){},this.report=()=>{},this.reQueryValue=()=>{},this.revertValue=()=>{}}CalculatedData.prototype=Object.create(InputData.prototype);const input=CalculatedData,{BaseSignal}=window.JetFormBuilderAbstract;function SignalCalculated(){BaseSignal.call(this),this.isSupported=function(e){return(0,functions.vf)(e)},this.baseSignal=function(){const[e]=this.input.nodes,t="number"===this.input.valueTypeProp;this.input.calcValue=t?this.withPrecision():this.input.value.current,this.input.value.silence(),this.input.value.current=t?this.convertValue():this.input.value.current,this.input.value.silence(),this.input.visibleValNode.textContent=this.input.value.current,e.value=this.input.calcValue},this.runSignal=function(){this.baseSignal();const[e]=this.input.nodes;this.triggerJQuery(e)}}SignalCalculated.prototype=Object.create(BaseSignal.prototype),SignalCalculated.prototype.convertValue=function(){const e=this.input.value.current;if(Number.isNaN(Number(e)))return 0;const t=this.withPrecision().toString().split(".");return this.input.sepThousands&&(t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.input.sepThousands)),t.join(this.input.sepDecimal)},SignalCalculated.prototype.withPrecision=function(){return Number(this.input.value.current).toFixed(this.input.precision)};const signal=SignalCalculated,{addFilter}=JetPlugins.hooks;addFilter("jet.fb.inputs","jet-form-builder/calculated-field",(function(e){return[input,...e]})),addFilter("jet.fb.signals","jet-form-builder/calculated-field",(function(e){return[signal,...e]}))})();