diff --git a/assets/js/demo.min.js b/assets/js/demo.min.js index 6c07d2204..2195337e9 100644 --- a/assets/js/demo.min.js +++ b/assets/js/demo.min.js @@ -1,2 +1,2 @@ /*! For license information please see demo.min.js.LICENSE.txt */ -!function(e){"use strict";!function(){var t={359:function(e,t,r){r.r(t);var o=r(933),a=r.n(o),n=r(476),i=r.n(n),l=r(678),s=r.n(l),c=new URL(r(285),r.b),d=i()(a()),u=s()(c);d.push([e.id,"html,body{height:100%}body{background-color:#f2f2f2;background-image:url("+u+');font-family:Helvetica,"Helvetica Neue",Arial,sans-serif}.form-rendered .build-wrap,.form-rendered .formbuilder-title,.form-rendered .formbuilder-actions{display:none}.render-wrap,.formrender-title,.formrender-actions{display:none}.form-rendered .render-wrap,.form-rendered .formrender-title,.form-rendered .formrender-actions{display:block}.api-table{width:100%;border-collapse:collapse}.api-table td{border:1px solid #aaa;padding:16px}.api-table td:last-child{text-align:center}.api-table thead{background-color:#fff}.api-table tbody{background-color:#fff}.api-table tbody tr:nth-child(odd){background-color:#ddd}.api-table textarea{width:100%;height:24px;transition:height 333ms ease-in-out}.api-table textarea:focus{height:160px}.demo-header{display:flex;align-items:center;justify-content:space-between}#setData-value{background-color:rgba(0,0,0,0);border:0 none;color:#fff;padding:0}.form-builder-dialog{overflow-y:auto}',""]),t.default=d},476:function(e){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r="",o=void 0!==t[5];return t[4]&&(r+="@supports (".concat(t[4],") {")),t[2]&&(r+="@media ".concat(t[2]," {")),o&&(r+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),r+=e(t),o&&(r+="}"),t[2]&&(r+="}"),t[4]&&(r+="}"),r})).join("")},t.i=function(e,r,o,a,n){"string"==typeof e&&(e=[[null,e,void 0]]);var i={};if(o)for(var l=0;l0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=n),r&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=r):d[2]=r),a&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=a):d[4]="".concat(a)),t.push(d))}},t}},678:function(e){e.exports=function(e,t){return t||(t={}),e?(e=String(e.__esModule?e.default:e),/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),t.hash&&(e+=t.hash),/["'() \t\n]|(%20)/.test(e)||t.needQuotes?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e):e}},933:function(e){e.exports=function(e){return e[1]}},225:function(e,t,r){var o=r(892),a=r(359);"string"==typeof(a=a.__esModule?a.default:a)&&(a=[[e.id,a,""]]);o(a,{attributes:{class:"formBuilder-injected-style"},insert:"head",singleton:!1}),e.exports=a.locals||{}},892:function(e,t,r){var o,a=function(){var e={};return function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}e[t]=r}return e[t]}}(),n=[];function i(e){for(var t=-1,r=0;re}};var r;const a=(e,r)=>{if(0===t.backendOrder.length)return!1;const o=e.toLowerCase();return r=r?r+"":"",o.startsWith("on")||["form","formaction"].includes(o)||r.trim().toLowerCase().startsWith("javascript:")};t.backends.fallback=function(t){const r=document.implementation.createHTMLDocument(""),o=r.createElement("base");o.href=document.location.href,r.head.appendChild(o);const n=["applet","comment","embed","iframe","link","listing","meta","noscript","object","plaintext","script","style","xmp"],i=e.parseHTML(t,r,!1);e(i).find("*").addBack().each(((t,r)=>{"#text"!==r.nodeName&&(r.tagName&&n.includes(r.tagName.toLowerCase())?r.parentElement?r.parentElement.removeChild(r):i.includes(r)&&i.splice(i.indexOf(r),1):r.attributes&&Array.from(r.attributes).forEach((t=>{a(t.name,t.value)&&e(r).removeAttr(t.name)})))}));const l=r.createElement("div");return e(l).html(i),l.innerHTML};const n=e=>{const r=!!t.clobberingProtection.document&&document,o=!!t.clobberingProtection.form&&document.createElement("form");return r&&e in r||o&&e in o?t.clobberingProtection.namespaceAttributes?"user-content-"+e:void 0:e},i={fallback:(e,r)=>{const o=t.backends.fallback,a="function"==typeof o;return a&&(r=o(r)),e.innerHTML=r,a},dompurify:(e,r)=>{const o=t.backends.dompurify;return!(!1===o||!o.isSupported||(e.innerHTML=o.sanitize(r),0))},sanitizer:(e,r)=>{const o=t.backends.sanitizer;return!!o&&(e.setHTML(r,{sanitizer:o}),!0)}},l=["events"],s=["tag","content"];function c(e,t){if(null==e)return{};var r,o,a=function(e,t){if(null==e)return{};var r,o,a={},n=Object.keys(e);for(o=0;o=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}window.fbLoaded={js:[],css:[]},window.fbEditors={quill:{},tinymce:{}};const d=e=>({className:"class"}[e]||u(e)),u=e=>(e=(e=e.replace(/[^\w\s\-]/gi,"")).replace(/([A-Z])/g,(function(e){return"-"+e.toLowerCase()}))).replace(/\s/g,"-").replace(/^-+/g,""),m=e=>void 0===e?e:[["array",e=>Array.isArray(e)],["node",e=>e instanceof window.Node||e instanceof window.HTMLElement],["component",()=>e&&e.dom],[typeof e,()=>!0]].find((t=>t[1](e)))[0],p=function(r,o,u){void 0===o&&(o=""),void 0===u&&(u={});let b=m(o);const{events:g}=u,y=c(u,l),h=document.createElement(r),v={string:r=>{!function(r,o,a){if(void 0===a&&(a=!1),!a){const a=document.createElement(r.tagName);return void 0!==t.backendOrder.find((e=>i[e](a,o)))?((t=>{e(t).find("*").each(((e,t)=>{["embed","form","iframe","image","img","object"].includes(t.tagName.toLowerCase())&&t.removeAttribute("name"),["id","name"].forEach((e=>{if(t.hasAttribute(e)){const r=n(t.getAttribute(e));void 0===r?t.removeAttribute(e):t.setAttribute(e,r)}}))}))})(a),r.innerHTML=a.innerHTML,r):(r.innerHTML=o,r)}r.textContent=o}(h,h.innerHTML+r)},object:e=>{const{tag:t,content:r}=e,o=c(e,s);return h.appendChild(p(t,r,o))},node:e=>h.appendChild(e),array:e=>{for(let t=0;t{e=e(),b=m(e),v[b](e)},undefined:()=>{}};for(const e in y)if(y.hasOwnProperty(e)){const t=d(e);let r=Array.isArray(y[e])?f(y[e].join(" ").split(" ")).join(" "):y[e];if(a(t,r))continue;if("boolean"==typeof r){if(!0===r){const e="contenteditable"===t||t;h.setAttribute(t,e)}}else"id"!==t&&"name"!==t||(r=n(r)),void 0!==r&&h.setAttribute(t,r)}return o&&v[b](o),((e,t)=>{if(t)for(const r in t)t.hasOwnProperty(r)&&e.addEventListener(r,(e=>t[r](e)))})(h,g),h},f=e=>e.filter(((e,t,r)=>r.indexOf(e)===t));function b(e){const t=["a","an","and","as","at","but","by","for","for","from","in","into","near","nor","of","on","onto","or","the","to","with"].map((e=>`\\s${e}\\s`)),r=new RegExp(`(?!${t.join("|")})\\w\\S*`,"g");return`${e}`.replace(r,(e=>e.charAt(0).toUpperCase()+e.slice(1).replace(/[A-Z]/g,(e=>` ${e}`))))}function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function y(e){for(var t=1;t");return r.before(a),o.before(r),a.before(o).remove(),r};const h=e=>{document.querySelectorAll(".current-field-id").forEach((t=>{t.value=e}))},v='[{"type":"autocomplete","label":"Autocomplete","className":"form-control","name":"autocomplete-1526094918549","requireValidOption":true,"values":[{"label":"Option 1","value":"option-1"},{"label":"Option 2","value":"option-2"},{"label":"Option 3","value":"option-3"}],"userData":["option-1"]},{"type":"checkbox-group","label":"Checkbox Group","name":"checkbox-group-1526095813035","other":true,"values":[{"label":"Option 1","value":"option-1"},{"label":"Option 2","value":"option-2"}],"userData":["option-1","Bilbo \\"baggins\\""]},{"type":"text","label":"Color Field","name":"text-1526099104236","subtype":"color","userData":["#00ff00"]},{"type":"text","label":"Text Field","name":"text-1526099104236","subtype":"tel","userData":["123-456-7890"]},{"type":"date","label":"Date Field","className":"form-control","name":"date-1526096579821","userData":["2018-01-01"]},{"type":"number","label":"Number","className":"form-control","name":"number-1526099204594","min":"1","max":"3","step":".2","userData":["1.1"]},{"type":"textarea","label":"Text Area","className":"form-control","name":"textarea-1526099273610","subtype":"textarea","userData":["Tennessee Welcomes You!"]},{"type":"textarea","subtype":"tinymce","label":"TinyMCE","className":"form-control","name":"textarea-1526099273610","userData":["<p><span style="color: #339966;">It's a great place</span></p>"]}]',w={loadUserForm:()=>{const t={controlConfig:{"textarea.tinymce":{branding:!1,encoding:"xml",menubar:"edit insert format table",plugins:"preview searchreplace autolink link table lists textcolor colorpicker",toolbar:["formatselect","bold italic forecolor backcolor","link","alignleft aligncenter alignright alignjustify","numlist bullist outdent indent","preview"].join(" | ")}},formData:v};e(".render-wrap").formRender(t)},clearUserForm:()=>{e(".render-wrap").formRender("clear")},renderUserForm:()=>{e(".render-wrap").formRender("render",'[{"type":"text","label":"Color picker","name":"text-1526099104236","subtype":"color","userData":["#00ff00"]},{"type":"text","label":"Text Field","name":"text-1526099104236","subtype":"tel","userData":["123-456-7890"]},{"type":"date","label":"Date Field","className":"form-control","name":"date-1526096579821","userData":["2018-01-01"]},{"type":"number","label":"Number","className":"form-control","name":"number-1526099204594","min":"1","max":"3","step":".2","userData":["1.1"]},{"type":"textarea","label":"Text Area","className":"form-control","name":"textarea-1526099273610","subtype":"textarea","userData":["Tennessee Welcomes You!"]},{"type":"textarea","subtype":"tinymce","label":"TinyMCE","className":"form-control","name":"textarea-1526099273610","userData":["<p><span style="color: #339966;">It's a great place</span></p>"]}]')},getHTML:()=>{console.log(e(".render-wrap").formRender("html"))},setData:()=>{e(".render-wrap").formRender("setData",v)},render:()=>{e(".render-wrap").formRender("render")},showUserData:()=>{alert(JSON.stringify(e(".render-wrap").formRender("userData")))}},x={testSubmit:()=>{const e=document.querySelector(".render-wrap"),t=new FormData(e);for(var r of(console.log("Can submit: ",e.checkValidity()),console.log("FormData:"),t.entries()))console.log(`${r[0]}: ${r[1]}`)},resetDemo:()=>{window.sessionStorage.removeItem("formData"),location.reload()}},A=function(e,t){return void 0===t&&(t=!1),e.reduce(((e,r)=>{const o=(e=>{let t=e;return"string"==typeof t&&(t={attrs:{scope:"col"},content:b(e)}),"string"==typeof t.content&&(t.content=document.createTextNode(t.content)),y({attrs:{}},t)})(r),a=t?"th":"td",n=document.createElement(a);return n.appendChild(o.content),Object.entries(o.attrs).forEach((e=>{let[t,r]=e;n.setAttribute(t,r)})),e.appendChild(n),e}),document.createElement("tr"))},D=y(y(y({},{showData:()=>e(".build-wrap").formBuilder("showData"),clearFields:()=>e(".build-wrap").formBuilder("clearFields"),getData:()=>{console.log(e(".build-wrap").formBuilder("getData"))},setData:()=>{const t=e(".build-wrap").formBuilder,r=t("markup","textarea",t("getData","json",!0),{id:"setData-value",rows:30,style:"width: 100%"}),o=t("markup","button","Set Data",{events:{click:()=>e(".build-wrap").formBuilder("setData",r.value)}}),a=t("markup","div",[r,o]);t("showDialog",a,null,"data-dialog")},save:()=>{e(".build-wrap").formBuilder("save")},addField:()=>{const t={type:"text",class:"form-control",label:"Text Field added at: "+(new Date).getTime()};e(".build-wrap").formBuilder("addField",t)},removeField:()=>{const t=e(".build-wrap").formBuilder("getCurrentFieldId");h(""),e(".build-wrap").formBuilder("removeField",t)},getXML:()=>{alert(e(".build-wrap").formBuilder("getData","xml"))},getJSON:()=>{alert(e(".build-wrap").formBuilder("getData","json",!0))},getJS:()=>{alert("check console"),console.log(e(".build-wrap").formBuilder("getData"))},toggleEdit:()=>{const t=e(".build-wrap").formBuilder("getCurrentFieldId");e(".build-wrap").formBuilder("toggleFieldEdit",t)},toggleAllEdit:()=>e(".build-wrap").formBuilder("toggleAllFieldEdit"),getFieldTypes:()=>console.log(e(".build-wrap").formBuilder("getFieldTypes"))}),w),x),S=(e,t)=>{const r=document.createDocumentFragment(),o=document.createElement("thead");o.appendChild(A(t,!0));const a=Object.entries(e).reduce(((e,t)=>{let[r,o]=t;const a={content:o},n=document.createElement("code");n.appendChild(document.createTextNode(r));const i={content:n};let l=document.getElementById(r);if(l){const e=l.querySelector(".trigger");e&&e.addEventListener("click",(e=>D[r]&&D[r](e)))}else l=document.createElement("button"),l.id=r,l.textContent=b(r),l.addEventListener("click",(e=>D[r]&&D[r](e)));const s={content:l};return e.appendChild(A([i,a,s])),e}),document.createDocumentFragment()),n=document.createElement("tbody");return n.appendChild(a),r.appendChild(o),r.appendChild(n),r},E="formBuilder-locale",O="en-US",T=document.querySelectorAll(".demo-dataType"),k=window.sessionStorage.getItem("dataType")||"json",B=e=>{let{target:t}=e;window.sessionStorage.setItem("dataType",t.value),x.resetDemo()};for(let e=0;e{let{target:t}=e;t.checked?(e=>{const t=(e=Array.isArray(e)?e:[e]).map((e=>{let{src:t,id:r}=e;return new Promise((e=>{if(window.fbLoaded.css.includes(t))return e(t);const o=p("link",null,{href:t,rel:"stylesheet",id:r});document.head.insertBefore(o,document.head.firstChild)}))}));Promise.all(t)})({src:"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css",id:"bootstrap"}):(e=>{const t=document.getElementById("bootstrap");t.parentElement.removeChild(t)})()}),!1),jQuery((function(e){const t={starRating:function(t){return{field:'',onRender:()=>{e(document.getElementById(t.name)).rateYo({rating:3.6})}}}},r={defaultFields:[{className:"form-control",label:"Default Field",placeholder:"Enter your default field value",name:"default-field-1",type:"text"}],persistDefaultFields:!0,disabledSubtypes:{text:["password"]},disabledAttrs:["placeholder","name"],dataType:k,subtypes:{text:["datetime-local"],"checkbox-group":["custom-group"]},onSave:n,onAddField:e=>{h(e)},onAddOption:(e,t)=>{let{index:r}=t;return e.label=e.label||`Option ${r+1}`,e.value=e.value||`option-${r+1}`,e},onClearAll:()=>window.sessionStorage.removeItem("formData"),stickyControls:{enable:!0},sortableControls:!0,fields:[{type:"autocomplete",label:"Custom Autocomplete",required:!0,values:[{label:"SQL"},{label:"C#"},{label:"JavaScript"},{label:"Java"},{label:"Python"},{label:"C++"},{label:"PHP"},{label:"Swift"},{label:"Ruby"}]},{label:"Star Rating",attrs:{type:"starRating"},icon:"🌟"},{type:"checkbox-group",subtype:"custom-group",label:"Custom Checkbox Group w/Sub Type",required:!0,values:[{label:"Option 1"},{label:"Option 2"}]}],templates:t,inputSets:[{label:"User Details",icon:"👨",name:"user-details",showHeader:!0,fields:[{type:"text",label:"First Name",className:"form-control"},{type:"select",label:"Profession",className:"form-control",values:[{label:"Street Sweeper",value:"option-2",selected:!1},{label:"Brain Surgeon",value:"option-3",selected:!1}]},{type:"textarea",label:"Short Bio:",className:"form-control"}]},{label:"User Agreement",fields:[{type:"header",subtype:"h3",label:"Terms & Conditions",className:"header"},{type:"paragraph",label:"Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment."},{type:"paragraph",label:"Bring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring."},{type:"checkbox",label:"Do you agree to the terms and conditions?"}]}],typeUserDisabledAttrs:{autocomplete:["access"]},typeUserAttrs:{text:{shape:{label:"Class",multiple:!0,options:{"red form-control":"Red","green form-control":"Green","blue form-control":"Blue"},style:"border: 1px solid red"},readonly:{label:"readonly",value:!1}},number:{volume:{label:"Volume Level",value:1,max:11}},"checkbox-group":{"custom-group":{customInput:{label:"Custom Text Field",value:"This field is added only to checkbox with specific subtype",type:"text"}}}},disableInjectedStyle:!1,actionButtons:[{id:"smile",className:"btn btn-success",label:"😁",type:"button",events:{click:()=>{alert("😁😁😁 !SMILE! 😁😁😁")}}},"save"],disableFields:["autocomplete","custom-tinymce"],replaceFields:[{type:"textarea",subtype:"tinymce",datatype:"custom-tinymce",label:"tinyMCE",required:!0}],disabledFieldButtons:{text:["copy"]},controlPosition:"right",i18n:{override:{[O]:{number:"Big Numbers"}}},scrollToFieldOnAdd:!1},o=window.sessionStorage.getItem("formData");let a=!0;function n(){if(document.body.classList.toggle("form-rendered",a),a){const r=e(".build-wrap").formBuilder("getData",k);e(".render-wrap").formRender({formData:r,templates:t,dataType:k}),window.sessionStorage.setItem("formData",r)}else e(".build-wrap").formBuilder("setData",e(".render-wrap").formRender("userData"));return a=!a}o&&(r.formData=o),e(".build-wrap").formBuilder(r).promise.then((function(e){document.querySelectorAll(".editForm").forEach((e=>e.addEventListener("click",n)),!1);const t=document.getElementById("setLanguage"),r=window.sessionStorage.getItem(E)||O;t.value=r,e.actions.setLang(r);const a=["action","description","demo"];if(document.getElementById("action-api").appendChild(S({getFieldTypes:"Get the registered field types for the form.",showData:"Trigger a modal to appear that shows the current formData value",clearFields:"Removes all the fields from the template editor",getData:"Read the current formData",getXML:"Get the current formData in XML format",getJSON:"Get the current formData in JSON format",getJS:"Get the current formData in JS object format",setData:"set the current formData value for the editor",save:"call save from the api",toggleAllEdit:"toggle the edit mode for all fields",toggleEdit:"toggle a specific field edit mode by index or id",addField:"programmatically add a field to the template editor",removeField:"remove a field by its index or id from the editor stage",resetDemo:"reset the demo to default state"},a)),document.getElementById("demo-api").appendChild(S({loadUserForm:"Load user form",showUserData:"Show user form",renderUserForm:"Render user form",getHTML:"Get HTML",clearUserForm:"Clear user form",testSubmit:"Test Submit",setData:"Set template data",render:"Render data that was set"},a)),o&&"[]"!==o){const e=document.getElementById("setData-value");e&&(e.value=window.JSON.stringify(JSON.parse(o),null," "))}t.addEventListener("change",(t=>{let{target:{value:r}}=t;window.sessionStorage.setItem(E,r),e.actions.setLang(r)}),!1)}))}))}()}()}(jQuery); \ No newline at end of file +!function(e){"use strict";!function(){var t={359:function(e,t,r){r.r(t);var o=r(933),n=r.n(o),a=r(476),i=r.n(a),l=r(678),s=r.n(l),c=new URL(r(285),r.b),d=i()(n()),u=s()(c);d.push([e.id,"html,body{height:100%}body{background-color:#f2f2f2;background-image:url("+u+');font-family:Helvetica,"Helvetica Neue",Arial,sans-serif}.form-rendered .build-wrap,.form-rendered .formbuilder-title,.form-rendered .formbuilder-actions{display:none}.render-wrap,.formrender-title,.formrender-actions{display:none}.form-rendered .render-wrap,.form-rendered .formrender-title,.form-rendered .formrender-actions{display:block}.api-table{width:100%;border-collapse:collapse}.api-table td{border:1px solid #aaa;padding:16px}.api-table td:last-child{text-align:center}.api-table thead{background-color:#fff}.api-table tbody{background-color:#fff}.api-table tbody tr:nth-child(odd){background-color:#ddd}.api-table textarea{width:100%;height:24px;transition:height 333ms ease-in-out}.api-table textarea:focus{height:160px}.demo-header{display:flex;align-items:center;justify-content:space-between}#setData-value{background-color:rgba(0,0,0,0);border:0 none;color:#fff;padding:0}.form-builder-dialog{overflow-y:auto}label[for=toggleEnhancedBootstrapEnabled]{margin-left:1rem;display:none}',""]),t.default=d},476:function(e){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r="",o=void 0!==t[5];return t[4]&&(r+="@supports (".concat(t[4],") {")),t[2]&&(r+="@media ".concat(t[2]," {")),o&&(r+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),r+=e(t),o&&(r+="}"),t[2]&&(r+="}"),t[4]&&(r+="}"),r})).join("")},t.i=function(e,r,o,n,a){"string"==typeof e&&(e=[[null,e,void 0]]);var i={};if(o)for(var l=0;l0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=a),r&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=r):d[2]=r),n&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=n):d[4]="".concat(n)),t.push(d))}},t}},678:function(e){e.exports=function(e,t){return t||(t={}),e?(e=String(e.__esModule?e.default:e),/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),t.hash&&(e+=t.hash),/["'() \t\n]|(%20)/.test(e)||t.needQuotes?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e):e}},933:function(e){e.exports=function(e){return e[1]}},225:function(e,t,r){var o=r(892),n=r(359);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.id,n,""]]);o(n,{attributes:{class:"formBuilder-injected-style"},insert:"head",singleton:!1}),e.exports=n.locals||{}},892:function(e,t,r){var o,n=function(){var e={};return function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}e[t]=r}return e[t]}}(),a=[];function i(e){for(var t=-1,r=0;re}};var r;const n=(e,r)=>{if(0===t.backendOrder.length)return!1;const o=e.toLowerCase();return r=r?r+"":"",o.startsWith("on")||["form","formaction"].includes(o)||r.trim().toLowerCase().startsWith("javascript:")};t.backends.fallback=function(t){const r=document.implementation.createHTMLDocument(""),o=r.createElement("base");o.href=document.location.href,r.head.appendChild(o);const a=["applet","comment","embed","iframe","link","listing","meta","noscript","object","plaintext","script","style","xmp"],i=e.parseHTML(t,r,!1);e(i).find("*").addBack().each(((t,r)=>{"#text"!==r.nodeName&&(r.tagName&&a.includes(r.tagName.toLowerCase())?r.parentElement?r.parentElement.removeChild(r):i.includes(r)&&i.splice(i.indexOf(r),1):r.attributes&&Array.from(r.attributes).forEach((t=>{n(t.name,t.value)&&e(r).removeAttr(t.name)})))}));const l=r.createElement("div");return e(l).html(i),l.innerHTML};const a=e=>{const r=!!t.clobberingProtection.document&&document,o=!!t.clobberingProtection.form&&document.createElement("form");return r&&e in r||o&&e in o?t.clobberingProtection.namespaceAttributes?"user-content-"+e:void 0:e},i={fallback:(e,r)=>{const o=t.backends.fallback,n="function"==typeof o;return n&&(r=o(r)),e.innerHTML=r,n},dompurify:(e,r)=>{const o=t.backends.dompurify;return!(!1===o||!o.isSupported||(e.innerHTML=o.sanitize(r),0))},sanitizer:(e,r)=>{const o=t.backends.sanitizer;return!!o&&(e.setHTML(r,{sanitizer:o}),!0)}},l=["events"],s=["tag","content"];function c(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}window.fbLoaded={js:[],css:[]},window.fbEditors={quill:{},tinymce:{}};const d=e=>({className:"class"}[e]||u(e)),u=e=>(e=(e=e.replace(/[^\w\s\-]/gi,"")).replace(/([A-Z])/g,(function(e){return"-"+e.toLowerCase()}))).replace(/\s/g,"-").replace(/^-+/g,""),m=e=>void 0===e?e:[["array",e=>Array.isArray(e)],["node",e=>e instanceof window.Node||e instanceof window.HTMLElement],["component",()=>e&&e.dom],[typeof e,()=>!0]].find((t=>t[1](e)))[0],p=function(r,o,u){void 0===o&&(o=""),void 0===u&&(u={});let b=m(o);const{events:g}=u,y=c(u,l),h=document.createElement(r),v={string:r=>{!function(r,o,n){if(void 0===n&&(n=!1),!n){const n=document.createElement(r.tagName);return void 0!==t.backendOrder.find((e=>i[e](n,o)))?((t=>{e(t).find("*").each(((e,t)=>{["embed","form","iframe","image","img","object"].includes(t.tagName.toLowerCase())&&t.removeAttribute("name"),["id","name"].forEach((e=>{if(t.hasAttribute(e)){const r=a(t.getAttribute(e));void 0===r?t.removeAttribute(e):t.setAttribute(e,r)}}))}))})(n),r.innerHTML=n.innerHTML,r):(r.innerHTML=o,r)}r.textContent=o}(h,h.innerHTML+r)},object:e=>{const{tag:t,content:r}=e,o=c(e,s);return h.appendChild(p(t,r,o))},node:e=>h.appendChild(e),array:e=>{for(let t=0;t{e=e(),b=m(e),v[b](e)},undefined:()=>{}};for(const e in y)if(y.hasOwnProperty(e)){const t=d(e);let r=Array.isArray(y[e])?f(y[e].join(" ").split(" ")).join(" "):y[e];if(n(t,r))continue;if("boolean"==typeof r){if(!0===r){const e="contenteditable"===t||t;h.setAttribute(t,e)}}else"id"!==t&&"name"!==t||(r=a(r)),void 0!==r&&h.setAttribute(t,r)}return o&&v[b](o),((e,t)=>{if(t)for(const r in t)t.hasOwnProperty(r)&&e.addEventListener(r,(e=>t[r](e)))})(h,g),h},f=e=>e.filter(((e,t,r)=>r.indexOf(e)===t));function b(e){const t=["a","an","and","as","at","but","by","for","for","from","in","into","near","nor","of","on","onto","or","the","to","with"].map((e=>`\\s${e}\\s`)),r=new RegExp(`(?!${t.join("|")})\\w\\S*`,"g");return`${e}`.replace(r,(e=>e.charAt(0).toUpperCase()+e.slice(1).replace(/[A-Z]/g,(e=>` ${e}`))))}function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function y(e){for(var t=1;t");return r.before(n),o.before(r),n.before(o).remove(),r};const h=e=>{document.querySelectorAll(".current-field-id").forEach((t=>{t.value=e}))},v='[{"type":"autocomplete","label":"Autocomplete","className":"form-control","name":"autocomplete-1526094918549","requireValidOption":true,"values":[{"label":"Option 1","value":"option-1"},{"label":"Option 2","value":"option-2"},{"label":"Option 3","value":"option-3"}],"userData":["option-1"]},{"type":"checkbox-group","label":"Checkbox Group","name":"checkbox-group-1526095813035","other":true,"values":[{"label":"Option 1","value":"option-1"},{"label":"Option 2","value":"option-2"}],"userData":["option-1","Bilbo \\"baggins\\""]},{"type":"text","label":"Color Field","name":"text-1526099104236","subtype":"color","userData":["#00ff00"]},{"type":"text","label":"Text Field","name":"text-1526099104236","subtype":"tel","userData":["123-456-7890"]},{"type":"date","label":"Date Field","className":"form-control","name":"date-1526096579821","userData":["2018-01-01"]},{"type":"number","label":"Number","className":"form-control","name":"number-1526099204594","min":"1","max":"3","step":".2","userData":["1.1"]},{"type":"textarea","label":"Text Area","className":"form-control","name":"textarea-1526099273610","subtype":"textarea","userData":["Tennessee Welcomes You!"]},{"type":"textarea","subtype":"tinymce","label":"TinyMCE","className":"form-control","name":"textarea-1526099273610","userData":["<p><span style="color: #339966;">It's a great place</span></p>"]}]',w={loadUserForm:()=>{const t={controlConfig:{"textarea.tinymce":{branding:!1,encoding:"xml",menubar:"edit insert format table",plugins:"preview searchreplace autolink link table lists textcolor colorpicker",toolbar:["formatselect","bold italic forecolor backcolor","link","alignleft aligncenter alignright alignjustify","numlist bullist outdent indent","preview"].join(" | ")}},formData:v};e(".render-wrap").formRender(t)},clearUserForm:()=>{e(".render-wrap").formRender("clear")},renderUserForm:()=>{e(".render-wrap").formRender("render",'[{"type":"text","label":"Color picker","name":"text-1526099104236","subtype":"color","userData":["#00ff00"]},{"type":"text","label":"Text Field","name":"text-1526099104236","subtype":"tel","userData":["123-456-7890"]},{"type":"date","label":"Date Field","className":"form-control","name":"date-1526096579821","userData":["2018-01-01"]},{"type":"number","label":"Number","className":"form-control","name":"number-1526099204594","min":"1","max":"3","step":".2","userData":["1.1"]},{"type":"textarea","label":"Text Area","className":"form-control","name":"textarea-1526099273610","subtype":"textarea","userData":["Tennessee Welcomes You!"]},{"type":"textarea","subtype":"tinymce","label":"TinyMCE","className":"form-control","name":"textarea-1526099273610","userData":["<p><span style="color: #339966;">It's a great place</span></p>"]}]')},getHTML:()=>{console.log(e(".render-wrap").formRender("html"))},setData:()=>{e(".render-wrap").formRender("setData",v)},render:()=>{e(".render-wrap").formRender("render")},showUserData:()=>{alert(JSON.stringify(e(".render-wrap").formRender("userData")))}},x={testSubmit:()=>{const e=document.querySelector(".render-wrap"),t=new FormData(e);console.log("Can submit: ",e.checkValidity()),console.log("FormData:");for(const[e,r]of t.entries())console.log(`${e}: ${r}`)},resetDemo:()=>{window.sessionStorage.removeItem("formData"),location.reload()}},A=function(e,t){return void 0===t&&(t=!1),e.reduce(((e,r)=>{const o=(e=>{let t=e;return"string"==typeof t&&(t={attrs:{scope:"col"},content:b(e)}),"string"==typeof t.content&&(t.content=document.createTextNode(t.content)),y({attrs:{}},t)})(r),n=t?"th":"td",a=document.createElement(n);return a.appendChild(o.content),Object.entries(o.attrs).forEach((e=>{let[t,r]=e;a.setAttribute(t,r)})),e.appendChild(a),e}),document.createElement("tr"))},O=y(y(y({},{showData:()=>e(".build-wrap").formBuilder("showData"),clearFields:()=>e(".build-wrap").formBuilder("clearFields"),getData:()=>{console.log(e(".build-wrap").formBuilder("getData"))},setData:()=>{const t=e(".build-wrap").formBuilder,r=t("markup","textarea",t("getData","json",!0),{id:"setData-value",rows:30,style:"width: 100%"}),o=t("markup","button","Set Data",{events:{click:()=>e(".build-wrap").formBuilder("setData",r.value)}}),n=t("markup","div",[r,o]);t("showDialog",n,null,"data-dialog")},save:()=>{e(".build-wrap").formBuilder("save")},addField:()=>{const t={type:"text",class:"form-control",label:"Text Field added at: "+(new Date).getTime()};e(".build-wrap").formBuilder("addField",t)},removeField:()=>{const t=e(".build-wrap").formBuilder("getCurrentFieldId");h(""),e(".build-wrap").formBuilder("removeField",t)},getXML:()=>{alert(e(".build-wrap").formBuilder("getData","xml"))},getJSON:()=>{alert(e(".build-wrap").formBuilder("getData","json",!0))},getJS:()=>{alert("check console"),console.log(e(".build-wrap").formBuilder("getData"))},toggleEdit:()=>{const t=e(".build-wrap").formBuilder("getCurrentFieldId");e(".build-wrap").formBuilder("toggleFieldEdit",t)},toggleAllEdit:()=>e(".build-wrap").formBuilder("toggleAllFieldEdit"),getFieldTypes:()=>console.log(e(".build-wrap").formBuilder("getFieldTypes"))}),w),x),D=(e,t)=>{const r=document.createDocumentFragment(),o=document.createElement("thead");o.appendChild(A(t,!0));const n=Object.entries(e).reduce(((e,t)=>{let[r,o]=t;const n={content:o},a=document.createElement("code");a.appendChild(document.createTextNode(r));const i={content:a};let l=document.getElementById(r);if(!l&&O[r])l=document.createElement("button"),l.id=r,l.textContent=b(r),l.addEventListener("click",(e=>O[r](e)));else{const e=l.querySelector(".trigger");e&&O[r]&&e.addEventListener("click",(e=>O[r](e)))}const s={content:l};return e.appendChild(A([i,n,s])),e}),document.createDocumentFragment()),a=document.createElement("tbody");return a.appendChild(n),r.appendChild(o),r.appendChild(a),r};function S(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function E(e){for(var t=1;t{let{target:t}=e;window.sessionStorage.setItem("dataType",t.value),x.resetDemo()};for(const e of j)e.value===e&&(e.checked=!0),e.addEventListener("click",F,!1);jQuery((function(e){const t={starRating:function(t){return{field:'',onRender:()=>{e(document.getElementById(t.name)).rateYo({rating:3.6})}}}},r={defaultFields:[{className:"form-control",label:"Default Field",placeholder:"Enter your default field value",name:"default-field-1",type:"text"}],persistDefaultFields:!0,disabledSubtypes:{text:["password"]},disabledAttrs:["placeholder","name"],dataType:B,subtypes:{text:["datetime-local"],"checkbox-group":["custom-group"]},onSave:c,onAddField:e=>{h(e)},onAddOption:(e,t)=>{let{index:r}=t;return e.label=e.label||`Option ${r+1}`,e.value=e.value||`option-${r+1}`,e},onClearAll:()=>window.sessionStorage.removeItem("formData"),stickyControls:{enable:!0},sortableControls:!0,fields:[{type:"autocomplete",label:"Custom Autocomplete",required:!0,values:[{label:"SQL"},{label:"C#"},{label:"JavaScript"},{label:"Java"},{label:"Python"},{label:"C++"},{label:"PHP"},{label:"Swift"},{label:"Ruby"}]},{label:"Star Rating",attrs:{type:"starRating"},icon:"🌟"},{type:"checkbox-group",subtype:"custom-group",label:"Custom Checkbox Group w/Sub Type",required:!0,values:[{label:"Option 1"},{label:"Option 2"}]}],templates:t,inputSets:[{label:"User Details",icon:"👨",name:"user-details",showHeader:!0,fields:[{type:"text",label:"First Name",className:"form-control"},{type:"select",label:"Profession",className:"form-control",values:[{label:"Street Sweeper",value:"option-2",selected:!1},{label:"Brain Surgeon",value:"option-3",selected:!1}]},{type:"textarea",label:"Short Bio:",className:"form-control"}]},{label:"User Agreement",fields:[{type:"header",subtype:"h3",label:"Terms & Conditions",className:"header"},{type:"paragraph",label:"Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment."},{type:"paragraph",label:"Bring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring."},{type:"checkbox",label:"Do you agree to the terms and conditions?"}]}],typeUserDisabledAttrs:{autocomplete:["access"]},typeUserAttrs:{text:{shape:{label:"Class",multiple:!0,options:{"red form-control":"Red","green form-control":"Green","blue form-control":"Blue"},style:"border: 1px solid red"},readonly:{label:"readonly",value:!1}},number:{volume:{label:"Volume Level",value:1,max:11}},"checkbox-group":{"custom-group":{customInput:{label:"Custom Text Field",value:"This field is added only to checkbox with specific subtype",type:"text"}}}},disableInjectedStyle:!1,actionButtons:[{id:"smile",className:"btn btn-success",label:"😁",type:"button",events:{click:()=>{alert("😁😁😁 !SMILE! 😁😁😁")}}},"save"],disableFields:["autocomplete","custom-tinymce"],replaceFields:[{type:"textarea",subtype:"tinymce",datatype:"custom-tinymce",label:"tinyMCE",required:!0}],disabledFieldButtons:{text:["copy"]},controlPosition:"right",i18n:{override:{[k]:{number:"Big Numbers"}}},scrollToFieldOnAdd:!1},o=window.sessionStorage.getItem("formData");let n=!0;o&&(r.formData=o);const a=document.querySelector(".build-wrap"),i=e(a),l=document.querySelector(".render-wrap"),s=e(l);function c(){if(document.body.classList.toggle("form-rendered",n),n){const e=i.formBuilder("getData",B);s.formRender({formData:e,templates:t,dataType:B}),window.sessionStorage.setItem("formData",e)}else i.formBuilder("setData",s.formRender("userData"));return n=!n,n}let d=i.formBuilder(r);const u=document.getElementById("toggleEnhancedBootstrapEnabled");document.getElementById("toggleBootstrap").addEventListener("click",(e=>{let{target:t}=e;u.parentElement.style.display=t.checked?"inline-block":"none",t.checked?(e=>{const t=(e=Array.isArray(e)?e:[e]).map((e=>{let{src:t,id:r}=e;return new Promise((e=>{if(window.fbLoaded.css.includes(t))return e(t);const o=p("link",null,{href:t,rel:"stylesheet",id:r});document.head.insertBefore(o,document.head.firstChild)}))}));Promise.all(t)})({src:"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css",id:"bootstrap"}):(e=>{const t=document.getElementById("bootstrap");t.parentElement.removeChild(t)})()}),!1),u.addEventListener("change",(e=>{let{target:t}=e;i.empty(),d=i.formBuilder(E(E({},r),{},{formData:d.formData,enableEnhancedBootstrapGrid:t.checked}))}),!1),d.promise.then((function(e){document.querySelectorAll(".editForm").forEach((e=>e.addEventListener("click",c)),!1);const t=document.getElementById("setLanguage"),r=window.sessionStorage.getItem(T)||k;t.value=r,e.actions.setLang(r);const n=["action","description","demo"];if(document.getElementById("action-api").appendChild(D({getFieldTypes:"Get the registered field types for the form.",showData:"Trigger a modal to appear that shows the current formData value",clearFields:"Removes all the fields from the template editor",getData:"Read the current formData",getXML:"Get the current formData in XML format",getJSON:"Get the current formData in JSON format",getJS:"Get the current formData in JS object format",setData:"set the current formData value for the editor",save:"call save from the api",toggleAllEdit:"toggle the edit mode for all fields",toggleEdit:"toggle a specific field edit mode by index or id",addField:"programmatically add a field to the template editor",removeField:"remove a field by its index or id from the editor stage",resetDemo:"reset the demo to default state"},n)),document.getElementById("demo-api").appendChild(D({loadUserForm:"Load user form",showUserData:"Show user form",renderUserForm:"Render user form",getHTML:"Get HTML",clearUserForm:"Clear user form",testSubmit:"Test Submit",setData:"Set template data",render:"Render data that was set"},n)),o&&"[]"!==o){const e=document.getElementById("setData-value");e&&(e.value=window.JSON.stringify(JSON.parse(o),null," "))}t.addEventListener("change",(t=>{let{target:{value:r}}=t;window.sessionStorage.setItem(T,r),e.actions.setLang(r)}),!1)}))}))}()}()}(jQuery); \ No newline at end of file diff --git a/assets/js/demo.min.js.LICENSE.txt b/assets/js/demo.min.js.LICENSE.txt index 0e337fce0..99bc65646 100644 --- a/assets/js/demo.min.js.LICENSE.txt +++ b/assets/js/demo.min.js.LICENSE.txt @@ -1,5 +1,5 @@ /*! * jQuery demo: https://formbuilder.online/ - * Version: 3.19.6 + * Version: 3.19.7 * Author: Kevin Chappell */ diff --git a/assets/js/demo.min.js.gz b/assets/js/demo.min.js.gz index 7e14ac8c6..3c4c1a53c 100644 Binary files a/assets/js/demo.min.js.gz and b/assets/js/demo.min.js.gz differ diff --git a/assets/js/form-builder.min.js.LICENSE.txt b/assets/js/form-builder.min.js.LICENSE.txt index 29384bb69..44b4c791a 100644 --- a/assets/js/form-builder.min.js.LICENSE.txt +++ b/assets/js/form-builder.min.js.LICENSE.txt @@ -7,7 +7,7 @@ /*! * jQuery formBuilder: https://formbuilder.online/ - * Version: 3.19.6 + * Version: 3.19.7 * Author: Kevin Chappell */ diff --git a/assets/js/form-render.min.js.LICENSE.txt b/assets/js/form-render.min.js.LICENSE.txt index 9dd25d661..b381e27ad 100644 --- a/assets/js/form-render.min.js.LICENSE.txt +++ b/assets/js/form-render.min.js.LICENSE.txt @@ -7,7 +7,7 @@ /*! * jQuery formRender: https://formbuilder.online/ - * Version: 3.19.6 + * Version: 3.19.7 * Author: Kevin Chappell */ diff --git a/index.html b/index.html index 2a2c92995..261519f5c 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -jQuery formBuilder/formRender Demo
dataType:
Language:

jQuery formBuilder -

jQuery formRender -

Actions

Actions

\ No newline at end of file +jQuery formBuilder/formRender Demo
dataType:
Language:

jQuery formBuilder -

jQuery formRender -

Actions

Actions

\ No newline at end of file