PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / V_3.0.0
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder vV_3.0.0
3.3.1 V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 All 138 releases
bit-form / assets / bf-214-231.js

bf-214-231.js in Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder V_3.0.0, at assets/bf-214-231.js

11 lines 14.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var te=Object.defineProperty,oe=Object.defineProperties;var se=Object.getOwnPropertyDescriptors;var G=Object.getOwnPropertySymbols;var re=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable;var M=(s,n,t)=>n in s?te(s,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[n]=t,I=(s,n)=>{for(var t in n||(n={}))re.call(n,t)&&M(s,t,n[t]);if(G)for(var t of G(n))ne.call(n,t)&&M(s,t,n[t]);return s},O=(s,n)=>oe(s,se(n));import{ac as ae,aH as ie,e1 as Q,r as v,a as W,g as X,cZ as J,j as e,h as b,d3 as le,d0 as K,d1 as q,c9 as ce,bt as de,be as me,z as ue,i as he,aq as pe,c as z,_ as D,dp as be,b6 as fe,cd as xe,I as ve,ce as ge,b9 as ye,V as we}from"./main-294.js";import"./bf-636-181.js";import{_ as U}from"./bf-729-273.js";import{D as Se,B as je}from"./bf-487-72.js";import{l as Ce,C as Ee}from"./bf-176-80.js";import{C as Y}from"./bf-383-274.js";import{F as Ne}from"./bf-112-250.js";import{S as Fe}from"./bf-934-246.js";import{G as Z}from"./bf-22-244.js";import"./bf-867-113.js";const $e=ae(ie),Ie=s=>s.lbl||s.adminLbl||s.txt,ee=()=>Object.entries($e).map(([s,n])=>({lbl:Ie(n)||s,val:`${s}`})),_e=()=>Ce.map(({name:s,label:n})=>({lbl:n,val:`bfVars["${s}"]`})),ke=s=>`/* On Field ${Q(s)}*/
2 document.querySelector(\`#form-\${bfContentId}\`).querySelector(\`#fieldKey-\${bfSlNo}\`).addEventListener('${s}', event => {
3 /* Write your code here*/
4 })`,p=s=>({lbl:`On ${Q(s)}`,val:ke(s)}),Le=[{type:"group-opts",name:"Global Variables/Property",childs:[{lbl:"Form ID",val:"bf_globals[bfContentId].formId"},..._e(),{lbl:"Dummy Data",val:"window.bf_dummy_data = { /* Overwrite Dummy Data */};"}]},{type:"group-opts",name:"Field Keys",childs:[...ee()]},{type:"group-opts",name:"Form Events",childs:[{lbl:"On Form Submit Success",val:"/* On Form Submit Success */\ndocument.querySelector(`#form-${bfContentId}`).addEventListener('bf-form-submit-success', ({detail:{formId, entryId, formData}}) => {\n /* Write your code here... */\n})"},{lbl:"On Form Submit Error",val:"/* On Form Submit Error */\ndocument.querySelector(`#form-${bfContentId}`).addEventListener('bf-form-submit-error', ({detail:{formId, errors}}) => {\n /* Write your code here... */\n})"},{lbl:"On Form Reset",val:"/* On Form Reset */\ndocument.querySelector(`#form-${bfContentId}`).addEventListener('bf-form-reset', ({detail:{formId}}) => {\n /* Write your code here... */\n})"},{lbl:"On Form Validation Error",val:"/* On Form Validation Error */\ndocument.querySelector(`#form-${bfContentId}`).addEventListener('bf-form-validation-error', ({detail:{formId, fieldId, error}}) => {\n /* Write your code here... */\n})"}]},{type:"group-title",name:"Field Events"},{type:"group-accordion",name:"Text Field",childs:[p("change"),p("input"),p("blur"),p("focus")]},{type:"group-accordion",name:"Textarea Field",childs:[p("change"),p("input"),p("blur"),p("focus")]},{type:"group-accordion",name:"Email Field",childs:[p("change"),p("input"),p("blur"),p("focus")]},{type:"group-accordion",name:"Checkbox",childs:[p("change")]},{type:"group-accordion",name:"Select",childs:[p("change")]},{type:"group-accordion",name:"Button",childs:[p("click")]},{type:"group-opts",name:"Filter Functions",childs:[{lbl:"Filter Logic status",val:`function bf_modify_workflow_logic_status(logicStatus, logics, fieldValues, rowIndex, condIndx, props) {
5 /* write your code here */
6 return logicStatus
7 }`},{lbl:"Filter Razorpay Notes",val:`function bf_modify_razorpay_notes(notes) {
8 /* write your code here */
9 return notes
10 }`}]}],Be=[{type:"group-opts",name:"Field Keys",childs:[...ee()]}];function Te({className:s,route:n,title:t,children:u,childrenAccodin:F=!1,fldData:r,open:C=!1,actionComponent:E,offset:y=0,tag:h,highlightSelector:i,onClick:d,styleOverride:w}){const[S,f]=v.useState(C),[j,N]=v.useState(C?"auto":0),_=v.useRef(null),{css:m}=W(),{"*":H}=X(),[B,P]=H.split("/"),R=`${h?`${h}-`:""}${J(t)}-acc`,V=`${h?`${h}-`:""}${J(t)}-acc-focus`;v.useEffect(()=>{f(C)},[C]);let T;B==="theme-customize"&&P===n&&(T=!0);const k=l=>{if(l.type==="keypress"&&(l.code==="Space"||l.code==="Enter")){f(c=>!c);return}if(l.type==="keyup"&&l.code==="Escape"){f(!1);return}l.type==="click"&&f(c=>!c)},$=l=>l.stopPropagation(),o=l=>{const c=window.getComputedStyle(l),L=parseFloat(c.marginTop)+parseFloat(c.marginBottom);return Math.ceil(l.offsetHeight+L)},a=()=>N(o(_.current));return e.jsxs("div",{role:"button",tabIndex:0,onKeyUp:k,onKeyDown:k,className:`${s} ${S&&m(g.active)} ${m(g.accordionLbl)}`,onClick:d,"data-testid":R,children:[e.jsx("div",{className:`btgl ${m({w:"100%"},T&&g.navBtnActive)}`,tabIndex:"-1",role:"button",onClick:k,onKeyDown:k,children:e.jsxs("div",{className:`${m(b.flxc,g.titlebar)} ${m(T&&{bd:"hsl(233deg 36% 95%)"})}`,style:{paddingLeft:y*2},children:[e.jsx("div",{children:e.jsx(le,{className:`toggle-icn ${m(g.icn)} `,size:"9",style:{transform:`rotate(${S?180:90}deg)`}})}),e.jsxs("div",{className:m(g.flxbwn),children:[e.jsxs("div",{className:m(b.flxc,b.mr2),children:[e.jsx("span",{className:`title ${m(g.dflx,!F&&b.fw500)}`,children:t}),h&&e.jsx("span",{title:`Field key: ${h}`,className:m(g.titleTag),children:h}),w&&e.jsx("span",{className:m(g.overrideIndicator),title:"Theme styles override"}),r&&e.jsx(Ee,{width:150,icnSize:15,className:`${m(b.mr2)} hovertip`,children:e.jsx("div",{className:m(g.tipBody),children:((r==null?void 0:r.lbl)||(r==null?void 0:r.txt)||(r==null?void 0:r.adminLbl))&&(r.lbl||r.txt||r.adminLbl)})}),e.jsx("div",{className:m(g.navActionBtn),"data-action-btn-lbl":!0,children:i&&e.jsx("div",{onMouseEnter:()=>K(i),onFocus:()=>K(i),onMouseLeave:()=>q(),onBlur:()=>q(),role:"button",tabIndex:"0",className:m(g.highlightBtn),title:"Highlight Element in Builder","data-testid":V,children:e.jsx(Ne,{size:15,stroke:"2.5"})})})]}),e.jsx("div",{onClick:$,onKeyDown:$,role:"button",tabIndex:"-1",children:E&&E})]})]})}),e.jsx("div",{style:{height:j,transition:"height 300ms",overflow:j==="auto"?"auto":"hidden"},children:e.jsx(ce,{nodeRef:_,in:S,timeout:300,onEntering:a,onEntered:()=>N("auto"),onExit:()=>N(_.current.offsetHeight),onExiting:()=>N(0),unmountOnExit:!0,style:{overflow:S?"auto":"hidden"},children:e.jsx("div",{ref:_,className:`body ${m(g.body)}`,onClick:$,onKeyDown:$,style:{paddingLeft:y*4},children:u})})})]})}const g={flxbwn:{flx:"between"},titlebar:{ws:"nowrap",fw:500,ow:"hidden",":hover":{bd:"#eeeff7"},"& .hovertip":{oy:0}},dflx:{flx:"align-center",fw:400,fs:13,lh:2,curp:1,"& .hover-tip":{oy:0}},":hover":{bd:"var(--b-50-95)"},icn:{cr:"#c6c6c6",mr:4,ml:4,mt:-1,tn:"transform 250ms"},body:{fs:12},titleTag:{p:"1px 5px",bd:"#EDF2F7",brs:5,cr:"gray",fs:11,fw:400,b:"1px solid #d8dde2",ml:"7px",curp:1},tipBody:{lh:"1.1",fs:"12.5px",fw:100,ff:'"Roboto", sans-serif'},accordionLbl:{":focus-within":{"& div[data-action-btn-lbl]":{dy:"flex"}},":focus-visible":{focusShadow:1,"& div[data-action-btn-lbl]":{dy:"flex"}},":hover":{bd:"#f8f8f8","& div[data-action-btn-lbl]":{dy:"flex"}}},highlightBtn:{flx:"center",brs:5,h:20,w:20,curp:1,":focus-visible":{focusShadow:1},":hover":{bd:"#d3d3d3"}},navActionBtn:{b:"none",pn:"absolute",rt:10,jc:"center",ai:"center",dy:"none",pl:15},overrideIndicator:{w:"5px",h:"5px",brs:"50%",bc:"#ffd64f",ml:"3px",px:2},active:{bd:"hsl(0deg 13% 97%)"},navBtnActive:{bd:"#eeeff7"}},Oe=s=>{let n=0;return s.reduce((t,u)=>(u.type?(t.push(u),n=0):(n||(t.push({type:"no-group",childs:[]}),n=1),t[t.length-1].childs.push(u)),t),[])};function Ae({options:s,action:n}){var h;const{css:t}=W(),u=Oe(s),[F,r]=v.useState(u);v.useEffect(()=>{r(u)},[s]);const C=i=>{const d=i.target.value.toLowerCase().trim();if(!d)return r(u);const S=ue(u).reduce((f,j)=>(j.type!=="group-title"&&(f.push(j),j.childs&&(f[f.length-1].childs=j.childs.filter(N=>N.lbl.toLowerCase().includes(d)),f[f.length-1].childs.length===0&&f.pop())),f),[]);r(S)},E=()=>{y.current.value="",r(u)},y=v.useRef(null);return e.jsxs("div",{className:t(x.main),children:[e.jsxs("div",{className:t(x.fields_search),children:[e.jsx("input",{ref:y,title:"Search Field","aria-label":"Search Field",autoComplete:"off","data-testid":"tlbr-srch-inp",placeholder:"Search...",id:"search-icon",type:"search",name:"searchIcn",onChange:C,className:t(x.search_field)}),((h=y==null?void 0:y.current)==null?void 0:h.value)&&e.jsx("span",{title:"clear",className:t(x.clear_icn),role:"button",tabIndex:"-1",onClick:E,onKeyDown:E,children:" "}),e.jsx("span",{title:"search",className:t(x.search_icn),children:e.jsx(de,{size:"20"})})]}),e.jsx(me,{style:{height:"92%"},autoHide:!0,children:e.jsx("div",{className:t(x.groupList),children:F.map(i=>e.jsxs(v.Fragment,{children:[i.type==="group-accordion"&&e.jsx(Te,{title:i.name,children:e.jsx("ul",{className:t(x.ul),children:"childs"in i&&i.childs.map(d=>e.jsx("li",{className:t(x.li),children:e.jsx("button",{type:"button",className:`${t(x.button)} btnHover`,title:d.lbl,onClick:()=>n(d.val),children:d.lbl})},`childs-${d.val}`))})},`group-accordion-${i.name}`),i.type==="group-opts"&&e.jsxs("ul",{className:t(x.ul),children:[i.type.match(/group-opts|group-title/)&&e.jsx("h4",{className:t(x.title),children:i.name}),"childs"in i&&i.childs.map(d=>e.jsx("li",{className:t(x.li),children:e.jsx("button",{type:"button",className:`${t(x.button)} btnHover`,title:d.lbl,onClick:()=>n(d.val),children:d.lbl})},`group-child-${d.val}`))]}),i.type==="group-title"&&e.jsx("h4",{className:t(x.title),children:i.name})]},`group-acc-${i.name}`))})})]})}const x={main:{h:300,w:200,py:3,ow:"hidden"},title:{m:0,pt:7,pb:5,pn:"sticky",tp:0,bd:"#fff",zx:9},fields_search:{pn:"relative",tn:"width .2s"},search_field:{mx:2,w:"98%",oe:"none",b:"none !important",brs:"9px !important",pl:"27px !important",pr:"5px !important",bd:"var(--white-0-97) !important",":focus":{oe:"none",bs:"0px 0px 0px 1.5px var(--b-50) !important",pr:"0px !important","& ~ .shortcut":{dy:"none"},"& ~ span svg":{cr:"var(--b-50)"}},"::placeholder":{fs:12},"::-webkit-search-cancel-button":{appearance:"none"}},search_icn:{pn:"absolute",tp:"50%",mx:6,lt:0,tm:"translateY(-50%)",cr:"var(--white-0-50)",curp:1,"& svg":{dy:"block"}},clear_icn:{pn:"absolute",tp:"50%",mx:6,rt:0,tm:"translateY(-50%)",cr:"var(--white-0-50)",curp:1,w:14,h:14,bd:"var(--white-0-83)",brs:20,backgroundPosition:"54% 50% !important",bi:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='Black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E")`},groupList:{mt:10},ul:{mt:0,mb:10},li:{mb:0,mt:5,ml:5},button:{fw:"normal",brs:5,dy:"block",w:"100%",ta:"left",b:0,bd:"none",p:3,curp:1,"&:hover":{bd:"var(--white-0-95)",cr:"var(--black-0)"},fs:11}};function Ue({width:s="100%",height:n="330px"}){const{css:t}=W(),{formType:u,formID:F}=X(),[r,C]=v.useState("JavaScript"),[E,y]=v.useState(localStorage.getItem("bf-editor-theme")||"tomorrow"),[h,i]=v.useState(localStorage.getItem("bf-enable-editor")||"on"),d=v.useRef({}),[w,S]=he(fe),f=pe(xe),[j,N]=v.useState(He),_=["JavaScript","CSS"],m=[{label:"Light Theme",value:"tomorrow"},{label:"Dark Theme",value:"twilight"}],H=o=>{o&&!(o in d.current)&&(d.current[r]=o)},B=o=>{S(a=>O(I({},a),{[r]:o}))},P=o=>{const a=d.current[r],{editor:l}=a;l.session.insert(l.getCursorPosition(),o);const c=l.getValue();S(L=>O(I({},L),{[r]:c})),a.editor.renderer.scrollBarV.scrollTop!==a.editor.renderer.scrollBarV.maxScrollTop&&a.editor.gotoLine(a.editor.session.getLength()+1)},R=o=>{localStorage.setItem("bf-editor-theme",o),y(o)},V=o=>{const{checked:a}=o.target;a?(i("on"),localStorage.setItem("bf-enable-editor","on")):(i("off"),localStorage.setItem("bf-enable-editor","off"))},T=o=>{if(!ve){f(I({show:!0},ge.customCode));return}if(u==="new"){ye("#update-btn").click();return}const l=z({form_id:F,customCodes:w},"bitforms_add_custom_code").then(c=>c);we.promise(l,{loading:D("Updating..."),success:c=>{var L;return((L=c==null?void 0:c.data)==null?void 0:L.message)||(c==null?void 0:c.data)},error:D("Error occurred, Please try again.")}),o.preventDefault()},k=()=>{if(r==="JavaScript")return Le;if(r==="CSS")return Be},$={mode:r.toLowerCase(),theme:E,name:r,value:w[r]||"",onChange:o=>{B(o)},height:n,width:s,placeholder:'Write your code here...(Note: Do not use single line"//" comment)',setOptions:j,ref:H};return v.useEffect(()=>{u==="edit"&&!(w.JavaScript||w.CSS)?z({form_id:F},"bitforms_get_custom_code").then(a=>{var l,c;return S({JavaScript:(l=a==null?void 0:a.data)==null?void 0:l.JavaScript,CSS:(c=a==null?void 0:a.data)==null?void 0:c.CSS,isFetched:!0}),a}):u==="new"&&z({form_id:F,customCodes:w},"bitforms_add_custom_code").then(a=>a)},[]),e.jsxs("div",{children:[e.jsxs("div",{className:t({flx:"between"}),children:[e.jsx("div",{className:t(b.w10,{flx:"center",my:2,ml:27}),children:e.jsx(Fe,{width:300,options:_.map(o=>({label:o})),onChange:o=>C(o),defaultActive:"JavaScript",actionValue:r,wideTab:!0})}),e.jsx("div",{className:t(b.flxc),children:e.jsxs(Se,{place:"bottom-end",children:[e.jsx("button",{"data-testid":"titl-mor-opt-btn","data-close":!0,type:"button",className:t(A.btn),unselectable:"on",draggable:"false",style:{cursor:"pointer"},title:D("Snippets"),children:e.jsx(je,{size:"16"})}),e.jsx(Ae,{options:k(),action:P})]})})]}),e.jsx(Z,{open:r==="JavaScript",children:e.jsx("div",{className:"pos-rel",children:h==="on"?e.jsx(U,O(I({},$),{onLoad:o=>{var a;(a=o==null?void 0:o.session)!=null&&a.$worker&&o.session.$worker.send("changeOptions",[{asi:!0}])}})):e.jsx("textarea",{className:t(A.editor,{h:n}),onChange:o=>B(o.target.value),value:w[r]||"",rows:"18"})})}),e.jsx(Z,{open:r==="CSS",children:e.jsx("div",{className:"pos-rel",children:h==="on"?e.jsx(U,I({},$)):e.jsx("textarea",{className:t(A.editor,{h:n}),onChange:o=>B(o.target.value),value:w[r]||"",rows:"18"})})}),e.jsxs("div",{className:t(b.flxb,b.mt1,b.mb1,{jc:"between"}),children:[e.jsxs("div",{className:t(b.flxc,b.w10,A.editorBtn),children:[e.jsx(Y,{className:t(b.mr2),title:"Editor Mode",checked:h==="on",onChange:V}),h==="on"&&e.jsxs(e.Fragment,{children:[e.jsx(be,{onChange:R,value:E,options:m,size:"sm",className:t({w:150})}),e.jsx(Y,{className:t(b.ml4),title:"Word Wrap",checked:j.wrap,onChange:()=>N(o=>O(I({},o),{wrap:!o.wrap}))})]})]}),e.jsx("button",{onClick:T,type:"button",className:t(b.btn,A.saveBtn),children:"Save"})]})]})}const A={editor:{w:"99%"},btn:{b:0,brs:5,curp:1,flx:"center-between"},theme:{dy:"flex",jc:"flex-end"},editorBtn:{fs:12,pr:5},saveBtn:{bc:"var(--b-50)",brs:4,fs:13,fw:800,px:15,py:8,cr:"var(--white-100)",":hover":{bd:"var(--b-36)"}}},He={autoScrollEditorIntoView:!0,enableBasicAutocompletion:!0,enableLiveAutocompletion:!0,enableSnippets:!0,showLineNumbers:!0,tabSize:2,animatedScroll:!0,showFoldWidgets:!0,displayIndentGuides:!0,enableEmmet:!0,enableMultiselect:!0,highlightSelectedWord:!0,fontSize:15,useSoftTabs:!0,showPrintMargin:!0,showGutter:!0,highlightActiveLine:!0};export{Ue as default};
11