@formio/js 5.0.0-rc.28 → 5.0.0-rc.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. package/dist/formio.embed.js +1 -1
  2. package/dist/formio.embed.min.js +1 -1
  3. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  4. package/dist/formio.form.js +730 -2064
  5. package/dist/formio.form.min.js +1 -1
  6. package/dist/formio.form.min.js.LICENSE.txt +3 -1
  7. package/dist/formio.full.js +741 -1999
  8. package/dist/formio.full.min.js +1 -1
  9. package/dist/formio.full.min.js.LICENSE.txt +3 -1
  10. package/dist/formio.js +98 -2358
  11. package/dist/formio.min.js +1 -1
  12. package/dist/formio.min.js.LICENSE.txt +1 -3
  13. package/dist/formio.utils.js +131 -111
  14. package/dist/formio.utils.min.js +1 -1
  15. package/dist/formio.utils.min.js.LICENSE.txt +3 -1
  16. package/lib/cjs/CDN.d.ts +1 -1
  17. package/lib/cjs/CDN.js +2 -2
  18. package/lib/cjs/Embed.d.ts +15 -6
  19. package/lib/cjs/Embed.js +63 -19
  20. package/lib/cjs/Formio.d.ts +0 -1
  21. package/lib/cjs/Formio.js +27 -19
  22. package/lib/cjs/Webform.d.ts +3 -4
  23. package/lib/cjs/WebformBuilder.js +6 -6
  24. package/lib/cjs/Wizard.d.ts +3 -4
  25. package/lib/cjs/components/_classes/component/Component.d.ts +1 -1
  26. package/lib/cjs/components/_classes/component/Component.js +6 -6
  27. package/lib/cjs/components/_classes/nested/NestedComponent.js +2 -2
  28. package/lib/cjs/components/editgrid/EditGrid.js +2 -2
  29. package/lib/cjs/formio.form.js +1 -0
  30. package/lib/cjs/index.js +1 -0
  31. package/lib/cjs/templates/Templates.d.ts +1 -11
  32. package/lib/cjs/templates/Templates.js +4 -41
  33. package/lib/cjs/utils/index.d.ts +1 -0
  34. package/lib/cjs/utils/index.js +2 -0
  35. package/lib/mjs/CDN.d.ts +1 -1
  36. package/lib/mjs/CDN.js +2 -2
  37. package/lib/mjs/Embed.d.ts +15 -6
  38. package/lib/mjs/Embed.js +62 -13
  39. package/lib/mjs/Formio.d.ts +0 -1
  40. package/lib/mjs/Formio.js +11 -3
  41. package/lib/mjs/Webform.d.ts +3 -4
  42. package/lib/mjs/WebformBuilder.js +3 -3
  43. package/lib/mjs/Wizard.d.ts +3 -4
  44. package/lib/mjs/components/_classes/component/Component.d.ts +1 -1
  45. package/lib/mjs/components/_classes/component/Component.js +1 -1
  46. package/lib/mjs/components/_classes/nested/NestedComponent.js +1 -1
  47. package/lib/mjs/components/editgrid/EditGrid.js +1 -1
  48. package/lib/mjs/formio.form.js +1 -0
  49. package/lib/mjs/index.js +1 -0
  50. package/lib/mjs/templates/Templates.d.ts +1 -11
  51. package/lib/mjs/templates/Templates.js +4 -40
  52. package/lib/mjs/utils/index.d.ts +1 -0
  53. package/lib/mjs/utils/index.js +1 -0
  54. package/package.json +10 -10
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see formio.embed.min.js.LICENSE.txt */
2
- !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.Formio=o():e.Formio=o()}(self,(function(){return function(){"use strict";var e={36310:function(e,o){Object.defineProperty(o,"__esModule",{value:!0}),o.default=class{constructor(e){this.baseUrl=e||"https://cdn.form.io",this.overrides={},this.libs={js:"",ace:"1.4.12",bootstrap:"4.6.2",ckeditor:"19.0.0",flatpickr:"4.6.8","flatpickr-formio":"4.6.13-formio.3","font-awesome":"4.7.0",grid:"latest","moment-timezone":"latest",quill:"2.0.0-dev.3","shortcut-buttons-flatpickr":"0.4.0",uswds:"2.4.8",core:""},this.updateUrls()}getVersion(e){return this.libs[e]}setVersion(e,o){this.libs[e]=o,this.updateUrls()}setBaseUrl(e){this.baseUrl=e,this.updateUrls()}setOverrideUrl(e,o){this.overrides[e]=o,this.updateUrls()}removeOverride(e){delete this.overrides[e],this.updateUrls()}removeOverrides(){this.overrides={},this.updateUrls()}buildUrl(e,o,i){let t;return t="latest"===i||""===i?`${e}/${o}`:`${e}/${o}/${i}`,t}updateUrls(){for(const e in this.libs)e in this.overrides?this[e]=this.buildUrl(this.overrides[e],e,this.libs[e]):this[e]=this.buildUrl(this.baseUrl,e,this.libs[e])}}},4481:function(e,o,i){var t=this&&this.__awaiter||function(e,o,i,t){return new(i||(i=Promise))((function(s,r){function n(e){try{l(t.next(e))}catch(e){r(e)}}function c(e){try{l(t.throw(e))}catch(e){r(e)}}function l(e){var o;e.done?s(e.value):(o=e.value,o instanceof i?o:new i((function(e){e(o)}))).then(n,c)}l((t=t.apply(e,o||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(o,"__esModule",{value:!0}),o.FormBuilder=o.Form=o.Formio=void 0;const r=s(i(36310));class n{static setBaseUrl(e){return t(this,void 0,void 0,(function*(){n.baseUrl=e}))}static setProjectUrl(e){return t(this,void 0,void 0,(function*(){n.projectUrl=e}))}static debug(...e){n.config.debug&&console.log(...e)}static clearCache(){n.FormioClass&&n.FormioClass.clearCache()}static global(e){const o=window[e];return o&&o.proxy?null:(n.debug(`Getting global ${e}`,o),o)}static createElement(e,o,i){const t=document.createElement(e);return Object.keys(o).forEach((e=>{t.setAttribute(e,o[e])})),(i||[]).forEach((e=>{t.appendChild(n.createElement(e.tag,e.attrs,e.children))})),t}static addScript(e,o,i){return t(this,void 0,void 0,(function*(){return o?"string"!=typeof o&&o.length?Promise.all(o.map((o=>n.addScript(e,o)))):i&&n.global(i)?(n.debug(`${i} already loaded.`),Promise.resolve(n.global(i))):(n.debug("Adding Script",o),e.appendChild(n.createElement("script",{src:o})),i?new Promise((e=>{n.debug(`Waiting to load ${i}`);const o=setInterval((()=>{n.global(i)&&(clearInterval(o),n.debug(`${i} loaded.`),e(n.global(i)))}),100)})):Promise.resolve()):Promise.resolve()}))}static addStyles(e,o){return t(this,void 0,void 0,(function*(){o&&("string"!=typeof o&&o.length?o.forEach((o=>n.addStyles(e,o))):(n.debug("Adding Styles",o),e.appendChild(n.createElement("link",{rel:"stylesheet",href:o}))))}))}static submitDone(e,o){return t(this,void 0,void 0,(function*(){n.debug("Submision Complete",o);const i=(n.config.success||"").toString();i&&"false"!==i.toLowerCase()&&e.element&&(e.element.innerHTML=`<div class="alert-success" role="alert">${i}</div>`);let t=n.config.redirect;if(!t&&e._form&&e._form.settings&&(e._form.settings.returnUrl||e._form.settings.redirect)&&(n.debug("Return url found in form configuration"),t=e._form.settings.returnUrl||e._form.settings.redirect),t){const i=e.formio?e.formio.formUrl:"",s=!!t.match(/\?/),r=0===t.indexOf(location.origin);t+=s?"&":"?",t+=`sub=${o._id}`,!r&&i&&(t+=`&form=${encodeURIComponent(i)}`),n.debug("Return URL",t),window.location.href=t,r&&window.location.reload()}}))}static formioScript(e,o){return n.fullAdded||o?(n.fullAdded=!0,e.replace("formio.form","formio.full")):e}static init(e,o={},i=!1){return t(this,void 0,void 0,(function*(){n.cdn=new r.default(n.config.cdn),n.config.libs=n.config.libs||{uswds:{fa:!0,js:`${n.cdn.uswds}/uswds.min.js`,css:`${n.cdn.uswds}/uswds.min.css`},fontawesome:{css:`${n.cdn["font-awesome"]}/css/font-awesome.min.css`},bootstrap:{css:`${n.cdn.bootstrap}/css/bootstrap.min.css`}};const t=n.config.id||`formio-${Math.random().toString(36).substring(7)}`;let s=n.createElement("div",{id:`"${t}-wrapper"`});e.parentNode.insertBefore(s,e),n.config.includeLibs&&"function"==typeof s.attachShadow&&!n.config.premium&&(s=s.attachShadow({mode:"open"}),o.shadowRoot=s),e.parentNode.removeChild(e),s.appendChild(e),yield n.addStyles(s,n.config.embedCSS||`${n.cdn.js}/formio.embed.css`),s.appendChild(n.createElement("div",{class:"formio-loader"},[{tag:"div",attrs:{class:"loader-wrapper"},children:[{tag:"div",attrs:{class:"loader text-center"}}]}]));const c=n.config.debug?"formio.form":"formio.form.min";if(n.FormioClass=yield n.addScript(s,n.formioScript(n.config.script||`${n.cdn.js}/${c}.js`,i),"Formio"),n.FormioClass.setBaseUrl(n.baseUrl||n.config.base),n.FormioClass.setProjectUrl(n.projectUrl||n.config.project),n.FormioClass.language=n.language,n.global("premium")&&(n.debug("Using premium module."),n.FormioClass.use(n.global("premium"))),n.global("vpat")&&(n.debug("Using vpat module."),n.FormioClass.use(n.global("vpat"))),n.config.template){if(n.config.includeLibs&&(yield n.addStyles(s,n.config.libs[n.config.template].css),yield n.addScript(s,n.config.libs[n.config.template].js),n.config.libs[n.config.template].fa&&(yield n.addStyles(s,n.config.libs.fontawesome.css))),n.cdn[n.config.template]){const e=`${n.cdn[n.config.template]}/${n.config.template}.min`;yield n.addStyles(s,`${e}.css`),n.debug(`Using ${n.config.template}`),n.FormioClass.use(yield n.addScript(s,`${e}.js`,n.config.template))}}else n.global("uswds")?(n.debug("Using uswds module."),n.FormioClass.use(n.global("uswds"))):n.config.includeLibs&&(yield n.addStyles(s,n.config.libs.fontawesome.css),yield n.addStyles(s,n.config.libs.bootstrap.css));return n.config.premium&&(yield n.addStyles(s,n.config.premium.css),n.debug("Using premium"),n.FormioClass.use(yield n.addScript(s,n.config.premium.js,"premium"))),yield n.addStyles(s,n.formioScript(n.config.style||`${n.cdn.js}/${c}.css`,i)),n.config.before&&(yield n.config.before(n.FormioClass,e,n.config)),n.FormioClass.license=!0,s}))}static createForm(e,o,i){return t(this,void 0,void 0,(function*(){const t=yield n.init(e,i);return n.FormioClass.createForm(e,o,Object.assign(Object.assign({},i),{noLoader:!0})).then((e=>(n.debug("Form created",e),n.debug("Removing loader"),t.removeChild(t.querySelector(".formio-loader")),n.config.submission&&(n.debug("Setting submission",n.config.submission),e.submission=n.config.submission),n.debug("Triggering embed event"),n.FormioClass.events.emit("formEmbedded",e),n.config.after&&(n.debug("Calling ready callback"),n.config.after(e,n.config)),e)))}))}static builder(e,o,i){return t(this,void 0,void 0,(function*(){const t=yield n.init(e,i,!0);return n.FormioClass.builder(e,o,i).then((e=>(n.debug("Builder created",e),n.debug("Removing loader"),t.removeChild(t.querySelector(".formio-loader")),n.debug("Triggering embed event"),n.FormioClass.events.emit("builderEmbedded",e),n.config.after&&(n.debug("Calling ready callback"),n.config.after(e,n.config)),e)))}))}}n.config={},n.cdn=null,n.proxy=!0,n.version="5.0.0-rc.28",o.Formio=n;class c{constructor(e,o,i){this.form=o,this.element=e,this.options=i||{},this.init(),this.instance={proxy:!0,ready:this.ready,destroy:()=>{}}}init(){this.element.innerHTML="",this.ready=this.create().then((e=>(this.instance=e,this.form=e.form,e)))}create(){return n.createForm(this.element,this.form,this.options)}setDisplay(e){return this.instance.proxy||(this.form.display=e,this.init()),this.ready}}o.Form=c;class l extends c{create(){return n.builder(this.element,this.form,this.options)}}o.FormBuilder=l,n.Form=c,n.FormBuilder=l}},o={};function i(t){var s=o[t];if(void 0!==s)return s.exports;var r=o[t]={exports:{}};return e[t].call(r.exports,r,r.exports,i),r.exports}var t={};return function(){var e=t;e.Formio=void 0;const o=i(4481);Object.defineProperty(e,"Formio",{enumerable:!0,get:function(){return o.Formio}});const s=document.getElementsByTagName("script"),r=window.FormioConfig||{};let n=null,c=s.length;const l=r.scriptName||"formio.embed.";for(;c--;)if(s[c].src&&-1!==s[c].src.indexOf(l)){n=s[c];break}if(n){const e={};n.src.replace(/^[^?]+\??/,"").replace(/\?/g,"&").split("&").forEach((o=>{e[o.split("=")[0]]=o.split("=")[1]&&decodeURIComponent(o.split("=")[1])}));let i=n.src.replace(/^([^?]+).*/,"$1").split("/");i.pop(),r.formioPath&&r.formioPath(i),i=i.join("/");const t="true"===e.debug||"1"===e.debug,s=t?"formio.form":"formio.form.min";o.Formio.config=Object.assign({script:e.script||`${r.updatePath?r.updatePath():i}/${s}.js`,style:e.styles||`${r.updatePath?r.updatePath():i}/${s}.css`,cdn:e.cdn,class:e.class||"formio-form-wrapper",src:e.src,form:null,submission:null,project:e.project,base:e.base||"https://api.form.io",submit:e.submit,includeLibs:"true"===e.libs||"1"===e.libs,template:e.template,debug:t,config:{},redirect:e.return||e.redirect,embedCSS:`${r.updatePath?r.updatePath():i}/formio.embed.css`,success:e.success||"Thank you for your submission!",before:null,after:null},r);const c=o.Formio.config.form||o.Formio.config.src;if(c){o.Formio.debug("Embedding Configuration",r),o.Formio.config.addPremiumLib&&o.Formio.config.addPremiumLib(o.Formio.config,i),o.Formio.config.id=`formio-${Math.random().toString(36).substring(7)}`,o.Formio.debug("Creating form element");const e=o.Formio.createElement("div",{id:o.Formio.config.id,class:o.Formio.config.class});n.parentNode.insertBefore(e,n.parentNode.firstElementChild.nextSibling),o.Formio.createForm(e,c,o.Formio.config.config).then((e=>{o.Formio.config.submit&&(e.nosubmit=!0),e.on("submit",(i=>{if(o.Formio.debug("on('submit')",i),o.Formio.config.submit){o.Formio.debug(`Sending submission to ${o.Formio.config.submit}`);const t={"content-type":"application/json"},s=o.Formio.FormioClass.getToken();s&&(t["x-jwt-token"]=s),o.Formio.FormioClass.fetch(o.Formio.config.submit,{body:JSON.stringify(i),headers:t,method:"POST",mode:"cors"}).then((e=>e.json())).then((i=>o.Formio.submitDone(e,i)))}else o.Formio.submitDone(e,i)}))}))}}else document.write("<span>Could not locate the Embedded form.</span>")}(),t.Formio}()}));
2
+ !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.Formio=o():e.Formio=o()}(self,(function(){return function(){"use strict";var e={36310:function(e,o){Object.defineProperty(o,"__esModule",{value:!0}),o.default=class{constructor(e,o={}){this.baseUrl=e||"https://cdn.form.io",this.overrides=o,this.libs={js:"",ace:"1.4.12",bootstrap:"4.6.2",ckeditor:"19.0.0",flatpickr:"4.6.8","flatpickr-formio":"4.6.13-formio.3","font-awesome":"4.7.0",grid:"latest","moment-timezone":"latest",quill:"2.0.0-dev.3","shortcut-buttons-flatpickr":"0.4.0",uswds:"2.4.8",core:""},this.updateUrls()}getVersion(e){return this.libs[e]}setVersion(e,o){this.libs[e]=o,this.updateUrls()}setBaseUrl(e){this.baseUrl=e,this.updateUrls()}setOverrideUrl(e,o){this.overrides[e]=o,this.updateUrls()}removeOverride(e){delete this.overrides[e],this.updateUrls()}removeOverrides(){this.overrides={},this.updateUrls()}buildUrl(e,o,i){let t;return t="latest"===i||""===i?`${e}/${o}`:`${e}/${o}/${i}`,t}updateUrls(){for(const e in this.libs)e in this.overrides?this[e]=this.buildUrl(this.overrides[e],e,this.libs[e]):this[e]=this.buildUrl(this.baseUrl,e,this.libs[e])}}},4481:function(e,o,i){var t=this&&this.__awaiter||function(e,o,i,t){return new(i||(i=Promise))((function(s,r){function n(e){try{a(t.next(e))}catch(e){r(e)}}function l(e){try{a(t.throw(e))}catch(e){r(e)}}function a(e){var o;e.done?s(e.value):(o=e.value,o instanceof i?o:new i((function(e){e(o)}))).then(n,l)}a((t=t.apply(e,o||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(o,"__esModule",{value:!0}),o.FormBuilder=o.Form=o.Formio=void 0;const r=s(i(36310));class n{static setBaseUrl(e,o){n.baseUrl=e,!o&&n.FormioClass&&n.FormioClass.setBaseUrl(e)}static setApiUrl(e,o){n.baseUrl=e,!o&&n.FormioClass&&n.FormioClass.setApiUrl(e)}static setProjectUrl(e,o){n.projectUrl=e,!o&&n.FormioClass&&n.FormioClass.setProjectUrl(e)}static setAppUrl(e,o){n.projectUrl=e,!o&&n.FormioClass&&n.FormioClass.setAppUrl(e)}static setPathType(e,o){n.pathType=e,!o&&n.FormioClass&&n.FormioClass.setPathType(e)}static debug(...e){n.config.debug&&console.log(...e)}static clearCache(){n.FormioClass&&n.FormioClass.clearCache()}static global(e,o=""){const i=window[e];return o&&i&&!i[o]?null:(n.debug(`Getting global ${e}`,i),i)}static use(e){n.FormioClass&&n.FormioClass.isRenderer?n.FormioClass.use(e):n.modules.push(e)}static createElement(e,o,i){const t=document.createElement(e);return Object.keys(o).forEach((e=>{t.setAttribute(e,o[e])})),(i||[]).forEach((e=>{t.appendChild(n.createElement(e.tag,e.attrs,e.children))})),t}static addScript(e,o,i,s=""){return t(this,void 0,void 0,(function*(){return o?"string"!=typeof o&&o.length?Promise.all(o.map((o=>n.addScript(e,o)))):i&&n.global(i,s)?(n.debug(`${i} already loaded.`),Promise.resolve(n.global(i))):(n.debug("Adding Script",o),e.appendChild(n.createElement("script",{src:o})),i?new Promise((e=>{n.debug(`Waiting to load ${i}`);const o=setInterval((()=>{n.global(i,s)&&(clearInterval(o),n.debug(`${i} loaded.`),e(n.global(i)))}),100)})):Promise.resolve()):Promise.resolve()}))}static addStyles(e,o){return t(this,void 0,void 0,(function*(){o&&("string"!=typeof o&&o.length?o.forEach((o=>n.addStyles(e,o))):(n.debug("Adding Styles",o),e.appendChild(n.createElement("link",{rel:"stylesheet",href:o}))))}))}static submitDone(e,o){return t(this,void 0,void 0,(function*(){n.debug("Submision Complete",o);const i=(n.config.success||"").toString();i&&"false"!==i.toLowerCase()&&e.element&&(e.element.innerHTML=`<div class="alert-success" role="alert">${i}</div>`);let t=n.config.redirect;if(!t&&e._form&&e._form.settings&&(e._form.settings.returnUrl||e._form.settings.redirect)&&(n.debug("Return url found in form configuration"),t=e._form.settings.returnUrl||e._form.settings.redirect),t){const i=e.formio?e.formio.formUrl:"",s=!!t.match(/\?/),r=0===t.indexOf(location.origin);t+=s?"&":"?",t+=`sub=${o._id}`,!r&&i&&(t+=`&form=${encodeURIComponent(i)}`),n.debug("Return URL",t),window.location.href=t,r&&window.location.reload()}}))}static formioScript(e,o){return n.fullAdded||o?(n.fullAdded=!0,e.replace("formio.form","formio.full")):e}static init(e,o={},i=!1){return t(this,void 0,void 0,(function*(){n.cdn=new r.default(n.config.cdn,n.config.cdnUrls||{}),n.config.libs=n.config.libs||{uswds:{fa:!0,js:`${n.cdn.uswds}/uswds.min.js`,css:`${n.cdn.uswds}/uswds.min.css`},fontawesome:{css:`${n.cdn["font-awesome"]}/css/font-awesome.min.css`},bootstrap:{css:`${n.cdn.bootstrap}/css/bootstrap.min.css`}};const t=n.config.id||`formio-${Math.random().toString(36).substring(7)}`;let s=n.createElement("div",{id:`"${t}-wrapper"`});e.parentNode.insertBefore(s,e),n.config.includeLibs&&"function"==typeof s.attachShadow&&!n.config.premium&&(s=s.attachShadow({mode:"open"}),o.shadowRoot=s),e.parentNode.removeChild(e),s.appendChild(e),yield n.addStyles(s,n.config.embedCSS||`${n.cdn.js}/formio.embed.css`),s.appendChild(n.createElement("div",{class:"formio-loader"},[{tag:"div",attrs:{class:"loader-wrapper"},children:[{tag:"div",attrs:{class:"loader text-center"}}]}]));const l=n.config.debug?"formio.form":"formio.form.min";if(n.FormioClass=yield n.addScript(s,n.formioScript(n.config.script||`${n.cdn.js}/${l}.js`,i),"Formio",i?"isBuilder":"isRenderer"),n.FormioClass.setBaseUrl(o.baseUrl||n.baseUrl||n.config.base),n.FormioClass.setProjectUrl(o.projectUrl||n.projectUrl||n.config.project),n.FormioClass.language=n.language,n.modules.forEach((e=>{n.FormioClass.use(e)})),n.icons&&(n.FormioClass.icons=n.icons),n.pathType&&n.FormioClass.setPathType(n.pathType),n.global("premium")&&(n.debug("Using premium module."),n.FormioClass.use(n.global("premium"))),n.global("vpat")&&(n.debug("Using vpat module."),n.FormioClass.use(n.global("vpat"))),n.config.template){if(n.config.includeLibs&&(yield n.addStyles(s,n.config.libs[n.config.template].css),yield n.addScript(s,n.config.libs[n.config.template].js),n.config.libs[n.config.template].fa&&(yield n.addStyles(s,n.config.libs.fontawesome.css))),n.cdn[n.config.template]){const e=`${n.cdn[n.config.template]}/${n.config.template}.min`;yield n.addStyles(s,`${e}.css`),n.debug(`Using ${n.config.template}`),n.FormioClass.use(yield n.addScript(s,`${e}.js`,n.config.template))}}else n.global("uswds")?(n.debug("Using uswds module."),n.FormioClass.use(n.global("uswds"))):n.config.includeLibs&&(yield n.addStyles(s,n.config.libs.fontawesome.css),yield n.addStyles(s,n.config.libs.bootstrap.css));return n.config.premium&&(yield n.addStyles(s,n.config.premium.css),n.debug("Using premium"),n.FormioClass.use(yield n.addScript(s,n.config.premium.js,"premium"))),yield n.addStyles(s,n.formioScript(n.config.style||`${n.cdn.js}/${l}.css`,i)),n.config.before&&(yield n.config.before(n.FormioClass,e,n.config)),n.FormioClass.license=!0,n._formioReady(n.FormioClass),s}))}static createForm(e,o,i){return t(this,void 0,void 0,(function*(){const t=yield n.init(e,i);return n.FormioClass.createForm(e,o,Object.assign(Object.assign({},i),{noLoader:!0})).then((e=>(n.debug("Form created",e),n.debug("Removing loader"),t.removeChild(t.querySelector(".formio-loader")),n.config.submission&&(n.debug("Setting submission",n.config.submission),e.submission=n.config.submission),n.debug("Triggering embed event"),n.FormioClass.events.emit("formEmbedded",e),n.config.after&&(n.debug("Calling ready callback"),n.config.after(e,n.config)),e)))}))}static builder(e,o,i){return t(this,void 0,void 0,(function*(){const t=yield n.init(e,i,!0);return n.FormioClass.builder(e,o,i).then((e=>(n.debug("Builder created",e),n.debug("Removing loader"),t.removeChild(t.querySelector(".formio-loader")),n.debug("Triggering embed event"),n.FormioClass.events.emit("builderEmbedded",e),n.config.after&&(n.debug("Calling ready callback"),n.config.after(e,n.config)),e)))}))}}n.FormioClass=null,n.config={},n.cdn=new r.default,n.modules=[],n.icons="",n.formioReady=new Promise(((e,o)=>{n._formioReady=e,n._formioReadyReject=o})),n.version="5.0.0-rc.29",o.Formio=n;class l{constructor(e,o,i){this.form=o,this.element=e,this.options=i||{},this.init(),this.instance={proxy:!0,ready:this.ready,destroy:()=>{}}}init(){this.element.innerHTML="",this.ready=this.create().then((e=>(this.instance=e,this.form=e.form,e)))}create(){return n.createForm(this.element,this.form,this.options)}setDisplay(e){return this.instance.proxy||(this.form.display=e,this.init()),this.ready}}o.Form=l;class a extends l{create(){return n.builder(this.element,this.form,this.options)}}o.FormBuilder=a,n.Form=l,n.FormBuilder=a}},o={};function i(t){var s=o[t];if(void 0!==s)return s.exports;var r=o[t]={exports:{}};return e[t].call(r.exports,r,r.exports,i),r.exports}var t={};return function(){var e=t;e.Formio=void 0;const o=i(4481);Object.defineProperty(e,"Formio",{enumerable:!0,get:function(){return o.Formio}});const s=document.getElementsByTagName("script"),r=window.FormioConfig||{};let n=null,l=s.length;const a=r.scriptName||"formio.embed.";for(;l--;)if(s[l].src&&-1!==s[l].src.indexOf(a)){n=s[l];break}if(n){const e={};n.src.replace(/^[^?]+\??/,"").replace(/\?/g,"&").split("&").forEach((o=>{e[o.split("=")[0]]=o.split("=")[1]&&decodeURIComponent(o.split("=")[1])}));let i=n.src.replace(/^([^?]+).*/,"$1").split("/");i.pop(),r.formioPath&&r.formioPath(i),i=i.join("/");const t="true"===e.debug||"1"===e.debug,s=t?"formio.form":"formio.form.min";o.Formio.config=Object.assign({script:e.script||`${r.updatePath?r.updatePath():i}/${s}.js`,style:e.styles||`${r.updatePath?r.updatePath():i}/${s}.css`,cdn:e.cdn,class:e.class||"formio-form-wrapper",src:e.src,form:null,submission:null,project:e.project,base:e.base||"https://api.form.io",submit:e.submit,includeLibs:"true"===e.libs||"1"===e.libs,template:e.template,debug:t,config:{},redirect:e.return||e.redirect,embedCSS:`${r.updatePath?r.updatePath():i}/formio.embed.css`,success:e.success||"Thank you for your submission!",before:null,after:null},r);const l=o.Formio.config.form||o.Formio.config.src;if(l){o.Formio.debug("Embedding Configuration",r),o.Formio.config.addPremiumLib&&o.Formio.config.addPremiumLib(o.Formio.config,i),o.Formio.config.id=`formio-${Math.random().toString(36).substring(7)}`,o.Formio.debug("Creating form element");const e=o.Formio.createElement("div",{id:o.Formio.config.id,class:o.Formio.config.class});n.parentNode.insertBefore(e,n.parentNode.firstElementChild.nextSibling),o.Formio.createForm(e,l,o.Formio.config.config).then((e=>{o.Formio.config.submit&&(e.nosubmit=!0),e.on("submit",(i=>{if(o.Formio.debug("on('submit')",i),o.Formio.config.submit){o.Formio.debug(`Sending submission to ${o.Formio.config.submit}`);const t={"content-type":"application/json"},s=o.Formio.FormioClass.getToken();s&&(t["x-jwt-token"]=s),o.Formio.FormioClass.fetch(o.Formio.config.submit,{body:JSON.stringify(i),headers:t,method:"POST",mode:"cors"}).then((e=>e.json())).then((i=>o.Formio.submitDone(e,i)))}else o.Formio.submitDone(e,i)}))}))}}else document.write("<span>Could not locate the Embedded form.</span>")}(),t.Formio}()}));
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see formio.embed.min.js.LICENSE.txt */
2
- !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.Formio=o():e.Formio=o()}(self,(function(){return function(){"use strict";var e={36310:function(e,o){Object.defineProperty(o,"__esModule",{value:!0}),o.default=class{constructor(e){this.baseUrl=e||"https://cdn.form.io",this.overrides={},this.libs={js:"",ace:"1.4.12",bootstrap:"4.6.2",ckeditor:"19.0.0",flatpickr:"4.6.8","flatpickr-formio":"4.6.13-formio.3","font-awesome":"4.7.0",grid:"latest","moment-timezone":"latest",quill:"2.0.0-dev.3","shortcut-buttons-flatpickr":"0.4.0",uswds:"2.4.8",core:""},this.updateUrls()}getVersion(e){return this.libs[e]}setVersion(e,o){this.libs[e]=o,this.updateUrls()}setBaseUrl(e){this.baseUrl=e,this.updateUrls()}setOverrideUrl(e,o){this.overrides[e]=o,this.updateUrls()}removeOverride(e){delete this.overrides[e],this.updateUrls()}removeOverrides(){this.overrides={},this.updateUrls()}buildUrl(e,o,i){let t;return t="latest"===i||""===i?`${e}/${o}`:`${e}/${o}/${i}`,t}updateUrls(){for(const e in this.libs)e in this.overrides?this[e]=this.buildUrl(this.overrides[e],e,this.libs[e]):this[e]=this.buildUrl(this.baseUrl,e,this.libs[e])}}},4481:function(e,o,i){var t=this&&this.__awaiter||function(e,o,i,t){return new(i||(i=Promise))((function(s,r){function n(e){try{l(t.next(e))}catch(e){r(e)}}function c(e){try{l(t.throw(e))}catch(e){r(e)}}function l(e){var o;e.done?s(e.value):(o=e.value,o instanceof i?o:new i((function(e){e(o)}))).then(n,c)}l((t=t.apply(e,o||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(o,"__esModule",{value:!0}),o.FormBuilder=o.Form=o.Formio=void 0;const r=s(i(36310));class n{static setBaseUrl(e){return t(this,void 0,void 0,(function*(){n.baseUrl=e}))}static setProjectUrl(e){return t(this,void 0,void 0,(function*(){n.projectUrl=e}))}static debug(...e){n.config.debug&&console.log(...e)}static clearCache(){n.FormioClass&&n.FormioClass.clearCache()}static global(e){const o=window[e];return o&&o.proxy?null:(n.debug(`Getting global ${e}`,o),o)}static createElement(e,o,i){const t=document.createElement(e);return Object.keys(o).forEach((e=>{t.setAttribute(e,o[e])})),(i||[]).forEach((e=>{t.appendChild(n.createElement(e.tag,e.attrs,e.children))})),t}static addScript(e,o,i){return t(this,void 0,void 0,(function*(){return o?"string"!=typeof o&&o.length?Promise.all(o.map((o=>n.addScript(e,o)))):i&&n.global(i)?(n.debug(`${i} already loaded.`),Promise.resolve(n.global(i))):(n.debug("Adding Script",o),e.appendChild(n.createElement("script",{src:o})),i?new Promise((e=>{n.debug(`Waiting to load ${i}`);const o=setInterval((()=>{n.global(i)&&(clearInterval(o),n.debug(`${i} loaded.`),e(n.global(i)))}),100)})):Promise.resolve()):Promise.resolve()}))}static addStyles(e,o){return t(this,void 0,void 0,(function*(){o&&("string"!=typeof o&&o.length?o.forEach((o=>n.addStyles(e,o))):(n.debug("Adding Styles",o),e.appendChild(n.createElement("link",{rel:"stylesheet",href:o}))))}))}static submitDone(e,o){return t(this,void 0,void 0,(function*(){n.debug("Submision Complete",o);const i=(n.config.success||"").toString();i&&"false"!==i.toLowerCase()&&e.element&&(e.element.innerHTML=`<div class="alert-success" role="alert">${i}</div>`);let t=n.config.redirect;if(!t&&e._form&&e._form.settings&&(e._form.settings.returnUrl||e._form.settings.redirect)&&(n.debug("Return url found in form configuration"),t=e._form.settings.returnUrl||e._form.settings.redirect),t){const i=e.formio?e.formio.formUrl:"",s=!!t.match(/\?/),r=0===t.indexOf(location.origin);t+=s?"&":"?",t+=`sub=${o._id}`,!r&&i&&(t+=`&form=${encodeURIComponent(i)}`),n.debug("Return URL",t),window.location.href=t,r&&window.location.reload()}}))}static formioScript(e,o){return n.fullAdded||o?(n.fullAdded=!0,e.replace("formio.form","formio.full")):e}static init(e,o={},i=!1){return t(this,void 0,void 0,(function*(){n.cdn=new r.default(n.config.cdn),n.config.libs=n.config.libs||{uswds:{fa:!0,js:`${n.cdn.uswds}/uswds.min.js`,css:`${n.cdn.uswds}/uswds.min.css`},fontawesome:{css:`${n.cdn["font-awesome"]}/css/font-awesome.min.css`},bootstrap:{css:`${n.cdn.bootstrap}/css/bootstrap.min.css`}};const t=n.config.id||`formio-${Math.random().toString(36).substring(7)}`;let s=n.createElement("div",{id:`"${t}-wrapper"`});e.parentNode.insertBefore(s,e),n.config.includeLibs&&"function"==typeof s.attachShadow&&!n.config.premium&&(s=s.attachShadow({mode:"open"}),o.shadowRoot=s),e.parentNode.removeChild(e),s.appendChild(e),yield n.addStyles(s,n.config.embedCSS||`${n.cdn.js}/formio.embed.css`),s.appendChild(n.createElement("div",{class:"formio-loader"},[{tag:"div",attrs:{class:"loader-wrapper"},children:[{tag:"div",attrs:{class:"loader text-center"}}]}]));const c=n.config.debug?"formio.form":"formio.form.min";if(n.FormioClass=yield n.addScript(s,n.formioScript(n.config.script||`${n.cdn.js}/${c}.js`,i),"Formio"),n.FormioClass.setBaseUrl(n.baseUrl||n.config.base),n.FormioClass.setProjectUrl(n.projectUrl||n.config.project),n.FormioClass.language=n.language,n.global("premium")&&(n.debug("Using premium module."),n.FormioClass.use(n.global("premium"))),n.global("vpat")&&(n.debug("Using vpat module."),n.FormioClass.use(n.global("vpat"))),n.config.template){if(n.config.includeLibs&&(yield n.addStyles(s,n.config.libs[n.config.template].css),yield n.addScript(s,n.config.libs[n.config.template].js),n.config.libs[n.config.template].fa&&(yield n.addStyles(s,n.config.libs.fontawesome.css))),n.cdn[n.config.template]){const e=`${n.cdn[n.config.template]}/${n.config.template}.min`;yield n.addStyles(s,`${e}.css`),n.debug(`Using ${n.config.template}`),n.FormioClass.use(yield n.addScript(s,`${e}.js`,n.config.template))}}else n.global("uswds")?(n.debug("Using uswds module."),n.FormioClass.use(n.global("uswds"))):n.config.includeLibs&&(yield n.addStyles(s,n.config.libs.fontawesome.css),yield n.addStyles(s,n.config.libs.bootstrap.css));return n.config.premium&&(yield n.addStyles(s,n.config.premium.css),n.debug("Using premium"),n.FormioClass.use(yield n.addScript(s,n.config.premium.js,"premium"))),yield n.addStyles(s,n.formioScript(n.config.style||`${n.cdn.js}/${c}.css`,i)),n.config.before&&(yield n.config.before(n.FormioClass,e,n.config)),n.FormioClass.license=!0,s}))}static createForm(e,o,i){return t(this,void 0,void 0,(function*(){const t=yield n.init(e,i);return n.FormioClass.createForm(e,o,Object.assign(Object.assign({},i),{noLoader:!0})).then((e=>(n.debug("Form created",e),n.debug("Removing loader"),t.removeChild(t.querySelector(".formio-loader")),n.config.submission&&(n.debug("Setting submission",n.config.submission),e.submission=n.config.submission),n.debug("Triggering embed event"),n.FormioClass.events.emit("formEmbedded",e),n.config.after&&(n.debug("Calling ready callback"),n.config.after(e,n.config)),e)))}))}static builder(e,o,i){return t(this,void 0,void 0,(function*(){const t=yield n.init(e,i,!0);return n.FormioClass.builder(e,o,i).then((e=>(n.debug("Builder created",e),n.debug("Removing loader"),t.removeChild(t.querySelector(".formio-loader")),n.debug("Triggering embed event"),n.FormioClass.events.emit("builderEmbedded",e),n.config.after&&(n.debug("Calling ready callback"),n.config.after(e,n.config)),e)))}))}}n.config={},n.cdn=null,n.proxy=!0,n.version="5.0.0-rc.28",o.Formio=n;class c{constructor(e,o,i){this.form=o,this.element=e,this.options=i||{},this.init(),this.instance={proxy:!0,ready:this.ready,destroy:()=>{}}}init(){this.element.innerHTML="",this.ready=this.create().then((e=>(this.instance=e,this.form=e.form,e)))}create(){return n.createForm(this.element,this.form,this.options)}setDisplay(e){return this.instance.proxy||(this.form.display=e,this.init()),this.ready}}o.Form=c;class l extends c{create(){return n.builder(this.element,this.form,this.options)}}o.FormBuilder=l,n.Form=c,n.FormBuilder=l}},o={};function i(t){var s=o[t];if(void 0!==s)return s.exports;var r=o[t]={exports:{}};return e[t].call(r.exports,r,r.exports,i),r.exports}var t={};return function(){var e=t;e.Formio=void 0;const o=i(4481);Object.defineProperty(e,"Formio",{enumerable:!0,get:function(){return o.Formio}});const s=document.getElementsByTagName("script"),r=window.FormioConfig||{};let n=null,c=s.length;const l=r.scriptName||"formio.embed.";for(;c--;)if(s[c].src&&-1!==s[c].src.indexOf(l)){n=s[c];break}if(n){const e={};n.src.replace(/^[^?]+\??/,"").replace(/\?/g,"&").split("&").forEach((o=>{e[o.split("=")[0]]=o.split("=")[1]&&decodeURIComponent(o.split("=")[1])}));let i=n.src.replace(/^([^?]+).*/,"$1").split("/");i.pop(),r.formioPath&&r.formioPath(i),i=i.join("/");const t="true"===e.debug||"1"===e.debug,s=t?"formio.form":"formio.form.min";o.Formio.config=Object.assign({script:e.script||`${r.updatePath?r.updatePath():i}/${s}.js`,style:e.styles||`${r.updatePath?r.updatePath():i}/${s}.css`,cdn:e.cdn,class:e.class||"formio-form-wrapper",src:e.src,form:null,submission:null,project:e.project,base:e.base||"https://api.form.io",submit:e.submit,includeLibs:"true"===e.libs||"1"===e.libs,template:e.template,debug:t,config:{},redirect:e.return||e.redirect,embedCSS:`${r.updatePath?r.updatePath():i}/formio.embed.css`,success:e.success||"Thank you for your submission!",before:null,after:null},r);const c=o.Formio.config.form||o.Formio.config.src;if(c){o.Formio.debug("Embedding Configuration",r),o.Formio.config.addPremiumLib&&o.Formio.config.addPremiumLib(o.Formio.config,i),o.Formio.config.id=`formio-${Math.random().toString(36).substring(7)}`,o.Formio.debug("Creating form element");const e=o.Formio.createElement("div",{id:o.Formio.config.id,class:o.Formio.config.class});n.parentNode.insertBefore(e,n.parentNode.firstElementChild.nextSibling),o.Formio.createForm(e,c,o.Formio.config.config).then((e=>{o.Formio.config.submit&&(e.nosubmit=!0),e.on("submit",(i=>{if(o.Formio.debug("on('submit')",i),o.Formio.config.submit){o.Formio.debug(`Sending submission to ${o.Formio.config.submit}`);const t={"content-type":"application/json"},s=o.Formio.FormioClass.getToken();s&&(t["x-jwt-token"]=s),o.Formio.FormioClass.fetch(o.Formio.config.submit,{body:JSON.stringify(i),headers:t,method:"POST",mode:"cors"}).then((e=>e.json())).then((i=>o.Formio.submitDone(e,i)))}else o.Formio.submitDone(e,i)}))}))}}else document.write("<span>Could not locate the Embedded form.</span>")}(),t.Formio}()}));
2
+ !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.Formio=o():e.Formio=o()}(self,(function(){return function(){"use strict";var e={36310:function(e,o){Object.defineProperty(o,"__esModule",{value:!0}),o.default=class{constructor(e,o={}){this.baseUrl=e||"https://cdn.form.io",this.overrides=o,this.libs={js:"",ace:"1.4.12",bootstrap:"4.6.2",ckeditor:"19.0.0",flatpickr:"4.6.8","flatpickr-formio":"4.6.13-formio.3","font-awesome":"4.7.0",grid:"latest","moment-timezone":"latest",quill:"2.0.0-dev.3","shortcut-buttons-flatpickr":"0.4.0",uswds:"2.4.8",core:""},this.updateUrls()}getVersion(e){return this.libs[e]}setVersion(e,o){this.libs[e]=o,this.updateUrls()}setBaseUrl(e){this.baseUrl=e,this.updateUrls()}setOverrideUrl(e,o){this.overrides[e]=o,this.updateUrls()}removeOverride(e){delete this.overrides[e],this.updateUrls()}removeOverrides(){this.overrides={},this.updateUrls()}buildUrl(e,o,i){let t;return t="latest"===i||""===i?`${e}/${o}`:`${e}/${o}/${i}`,t}updateUrls(){for(const e in this.libs)e in this.overrides?this[e]=this.buildUrl(this.overrides[e],e,this.libs[e]):this[e]=this.buildUrl(this.baseUrl,e,this.libs[e])}}},4481:function(e,o,i){var t=this&&this.__awaiter||function(e,o,i,t){return new(i||(i=Promise))((function(s,r){function n(e){try{a(t.next(e))}catch(e){r(e)}}function l(e){try{a(t.throw(e))}catch(e){r(e)}}function a(e){var o;e.done?s(e.value):(o=e.value,o instanceof i?o:new i((function(e){e(o)}))).then(n,l)}a((t=t.apply(e,o||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(o,"__esModule",{value:!0}),o.FormBuilder=o.Form=o.Formio=void 0;const r=s(i(36310));class n{static setBaseUrl(e,o){n.baseUrl=e,!o&&n.FormioClass&&n.FormioClass.setBaseUrl(e)}static setApiUrl(e,o){n.baseUrl=e,!o&&n.FormioClass&&n.FormioClass.setApiUrl(e)}static setProjectUrl(e,o){n.projectUrl=e,!o&&n.FormioClass&&n.FormioClass.setProjectUrl(e)}static setAppUrl(e,o){n.projectUrl=e,!o&&n.FormioClass&&n.FormioClass.setAppUrl(e)}static setPathType(e,o){n.pathType=e,!o&&n.FormioClass&&n.FormioClass.setPathType(e)}static debug(...e){n.config.debug&&console.log(...e)}static clearCache(){n.FormioClass&&n.FormioClass.clearCache()}static global(e,o=""){const i=window[e];return o&&i&&!i[o]?null:(n.debug(`Getting global ${e}`,i),i)}static use(e){n.FormioClass&&n.FormioClass.isRenderer?n.FormioClass.use(e):n.modules.push(e)}static createElement(e,o,i){const t=document.createElement(e);return Object.keys(o).forEach((e=>{t.setAttribute(e,o[e])})),(i||[]).forEach((e=>{t.appendChild(n.createElement(e.tag,e.attrs,e.children))})),t}static addScript(e,o,i,s=""){return t(this,void 0,void 0,(function*(){return o?"string"!=typeof o&&o.length?Promise.all(o.map((o=>n.addScript(e,o)))):i&&n.global(i,s)?(n.debug(`${i} already loaded.`),Promise.resolve(n.global(i))):(n.debug("Adding Script",o),e.appendChild(n.createElement("script",{src:o})),i?new Promise((e=>{n.debug(`Waiting to load ${i}`);const o=setInterval((()=>{n.global(i,s)&&(clearInterval(o),n.debug(`${i} loaded.`),e(n.global(i)))}),100)})):Promise.resolve()):Promise.resolve()}))}static addStyles(e,o){return t(this,void 0,void 0,(function*(){o&&("string"!=typeof o&&o.length?o.forEach((o=>n.addStyles(e,o))):(n.debug("Adding Styles",o),e.appendChild(n.createElement("link",{rel:"stylesheet",href:o}))))}))}static submitDone(e,o){return t(this,void 0,void 0,(function*(){n.debug("Submision Complete",o);const i=(n.config.success||"").toString();i&&"false"!==i.toLowerCase()&&e.element&&(e.element.innerHTML=`<div class="alert-success" role="alert">${i}</div>`);let t=n.config.redirect;if(!t&&e._form&&e._form.settings&&(e._form.settings.returnUrl||e._form.settings.redirect)&&(n.debug("Return url found in form configuration"),t=e._form.settings.returnUrl||e._form.settings.redirect),t){const i=e.formio?e.formio.formUrl:"",s=!!t.match(/\?/),r=0===t.indexOf(location.origin);t+=s?"&":"?",t+=`sub=${o._id}`,!r&&i&&(t+=`&form=${encodeURIComponent(i)}`),n.debug("Return URL",t),window.location.href=t,r&&window.location.reload()}}))}static formioScript(e,o){return n.fullAdded||o?(n.fullAdded=!0,e.replace("formio.form","formio.full")):e}static init(e,o={},i=!1){return t(this,void 0,void 0,(function*(){n.cdn=new r.default(n.config.cdn,n.config.cdnUrls||{}),n.config.libs=n.config.libs||{uswds:{fa:!0,js:`${n.cdn.uswds}/uswds.min.js`,css:`${n.cdn.uswds}/uswds.min.css`},fontawesome:{css:`${n.cdn["font-awesome"]}/css/font-awesome.min.css`},bootstrap:{css:`${n.cdn.bootstrap}/css/bootstrap.min.css`}};const t=n.config.id||`formio-${Math.random().toString(36).substring(7)}`;let s=n.createElement("div",{id:`"${t}-wrapper"`});e.parentNode.insertBefore(s,e),n.config.includeLibs&&"function"==typeof s.attachShadow&&!n.config.premium&&(s=s.attachShadow({mode:"open"}),o.shadowRoot=s),e.parentNode.removeChild(e),s.appendChild(e),yield n.addStyles(s,n.config.embedCSS||`${n.cdn.js}/formio.embed.css`),s.appendChild(n.createElement("div",{class:"formio-loader"},[{tag:"div",attrs:{class:"loader-wrapper"},children:[{tag:"div",attrs:{class:"loader text-center"}}]}]));const l=n.config.debug?"formio.form":"formio.form.min";if(n.FormioClass=yield n.addScript(s,n.formioScript(n.config.script||`${n.cdn.js}/${l}.js`,i),"Formio",i?"isBuilder":"isRenderer"),n.FormioClass.setBaseUrl(o.baseUrl||n.baseUrl||n.config.base),n.FormioClass.setProjectUrl(o.projectUrl||n.projectUrl||n.config.project),n.FormioClass.language=n.language,n.modules.forEach((e=>{n.FormioClass.use(e)})),n.icons&&(n.FormioClass.icons=n.icons),n.pathType&&n.FormioClass.setPathType(n.pathType),n.global("premium")&&(n.debug("Using premium module."),n.FormioClass.use(n.global("premium"))),n.global("vpat")&&(n.debug("Using vpat module."),n.FormioClass.use(n.global("vpat"))),n.config.template){if(n.config.includeLibs&&(yield n.addStyles(s,n.config.libs[n.config.template].css),yield n.addScript(s,n.config.libs[n.config.template].js),n.config.libs[n.config.template].fa&&(yield n.addStyles(s,n.config.libs.fontawesome.css))),n.cdn[n.config.template]){const e=`${n.cdn[n.config.template]}/${n.config.template}.min`;yield n.addStyles(s,`${e}.css`),n.debug(`Using ${n.config.template}`),n.FormioClass.use(yield n.addScript(s,`${e}.js`,n.config.template))}}else n.global("uswds")?(n.debug("Using uswds module."),n.FormioClass.use(n.global("uswds"))):n.config.includeLibs&&(yield n.addStyles(s,n.config.libs.fontawesome.css),yield n.addStyles(s,n.config.libs.bootstrap.css));return n.config.premium&&(yield n.addStyles(s,n.config.premium.css),n.debug("Using premium"),n.FormioClass.use(yield n.addScript(s,n.config.premium.js,"premium"))),yield n.addStyles(s,n.formioScript(n.config.style||`${n.cdn.js}/${l}.css`,i)),n.config.before&&(yield n.config.before(n.FormioClass,e,n.config)),n.FormioClass.license=!0,n._formioReady(n.FormioClass),s}))}static createForm(e,o,i){return t(this,void 0,void 0,(function*(){const t=yield n.init(e,i);return n.FormioClass.createForm(e,o,Object.assign(Object.assign({},i),{noLoader:!0})).then((e=>(n.debug("Form created",e),n.debug("Removing loader"),t.removeChild(t.querySelector(".formio-loader")),n.config.submission&&(n.debug("Setting submission",n.config.submission),e.submission=n.config.submission),n.debug("Triggering embed event"),n.FormioClass.events.emit("formEmbedded",e),n.config.after&&(n.debug("Calling ready callback"),n.config.after(e,n.config)),e)))}))}static builder(e,o,i){return t(this,void 0,void 0,(function*(){const t=yield n.init(e,i,!0);return n.FormioClass.builder(e,o,i).then((e=>(n.debug("Builder created",e),n.debug("Removing loader"),t.removeChild(t.querySelector(".formio-loader")),n.debug("Triggering embed event"),n.FormioClass.events.emit("builderEmbedded",e),n.config.after&&(n.debug("Calling ready callback"),n.config.after(e,n.config)),e)))}))}}n.FormioClass=null,n.config={},n.cdn=new r.default,n.modules=[],n.icons="",n.formioReady=new Promise(((e,o)=>{n._formioReady=e,n._formioReadyReject=o})),n.version="5.0.0-rc.29",o.Formio=n;class l{constructor(e,o,i){this.form=o,this.element=e,this.options=i||{},this.init(),this.instance={proxy:!0,ready:this.ready,destroy:()=>{}}}init(){this.element.innerHTML="",this.ready=this.create().then((e=>(this.instance=e,this.form=e.form,e)))}create(){return n.createForm(this.element,this.form,this.options)}setDisplay(e){return this.instance.proxy||(this.form.display=e,this.init()),this.ready}}o.Form=l;class a extends l{create(){return n.builder(this.element,this.form,this.options)}}o.FormBuilder=a,n.Form=l,n.FormBuilder=a}},o={};function i(t){var s=o[t];if(void 0!==s)return s.exports;var r=o[t]={exports:{}};return e[t].call(r.exports,r,r.exports,i),r.exports}var t={};return function(){var e=t;e.Formio=void 0;const o=i(4481);Object.defineProperty(e,"Formio",{enumerable:!0,get:function(){return o.Formio}});const s=document.getElementsByTagName("script"),r=window.FormioConfig||{};let n=null,l=s.length;const a=r.scriptName||"formio.embed.";for(;l--;)if(s[l].src&&-1!==s[l].src.indexOf(a)){n=s[l];break}if(n){const e={};n.src.replace(/^[^?]+\??/,"").replace(/\?/g,"&").split("&").forEach((o=>{e[o.split("=")[0]]=o.split("=")[1]&&decodeURIComponent(o.split("=")[1])}));let i=n.src.replace(/^([^?]+).*/,"$1").split("/");i.pop(),r.formioPath&&r.formioPath(i),i=i.join("/");const t="true"===e.debug||"1"===e.debug,s=t?"formio.form":"formio.form.min";o.Formio.config=Object.assign({script:e.script||`${r.updatePath?r.updatePath():i}/${s}.js`,style:e.styles||`${r.updatePath?r.updatePath():i}/${s}.css`,cdn:e.cdn,class:e.class||"formio-form-wrapper",src:e.src,form:null,submission:null,project:e.project,base:e.base||"https://api.form.io",submit:e.submit,includeLibs:"true"===e.libs||"1"===e.libs,template:e.template,debug:t,config:{},redirect:e.return||e.redirect,embedCSS:`${r.updatePath?r.updatePath():i}/formio.embed.css`,success:e.success||"Thank you for your submission!",before:null,after:null},r);const l=o.Formio.config.form||o.Formio.config.src;if(l){o.Formio.debug("Embedding Configuration",r),o.Formio.config.addPremiumLib&&o.Formio.config.addPremiumLib(o.Formio.config,i),o.Formio.config.id=`formio-${Math.random().toString(36).substring(7)}`,o.Formio.debug("Creating form element");const e=o.Formio.createElement("div",{id:o.Formio.config.id,class:o.Formio.config.class});n.parentNode.insertBefore(e,n.parentNode.firstElementChild.nextSibling),o.Formio.createForm(e,l,o.Formio.config.config).then((e=>{o.Formio.config.submit&&(e.nosubmit=!0),e.on("submit",(i=>{if(o.Formio.debug("on('submit')",i),o.Formio.config.submit){o.Formio.debug(`Sending submission to ${o.Formio.config.submit}`);const t={"content-type":"application/json"},s=o.Formio.FormioClass.getToken();s&&(t["x-jwt-token"]=s),o.Formio.FormioClass.fetch(o.Formio.config.submit,{body:JSON.stringify(i),headers:t,method:"POST",mode:"cors"}).then((e=>e.json())).then((i=>o.Formio.submitDone(e,i)))}else o.Formio.submitDone(e,i)}))}))}}else document.write("<span>Could not locate the Embedded form.</span>")}(),t.Formio}()}));
@@ -1 +1 @@
1
- /*! formiojs v5.0.0-rc.28 | https://unpkg.com/formiojs@5.0.0-rc.28/LICENSE.txt */
1
+ /*! formiojs v5.0.0-rc.29 | https://unpkg.com/formiojs@5.0.0-rc.29/LICENSE.txt */