@formio/js 5.0.0-rc.56 → 5.0.0-rc.57
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +2 -2
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +2 -2
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +2 -2
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/Embed.js +3 -0
- package/lib/cjs/InlineEmbed.js +20 -15
- package/lib/mjs/Embed.js +3 -0
- package/lib/mjs/InlineEmbed.js +20 -15
- package/package.json +1 -1
package/dist/formio.embed.js
CHANGED
@@ -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={56036:function(e,o){Object.defineProperty(o,"__esModule",{value:!0});class i{constructor(e,o={}){this.baseUrl=e||i.defaultCDN,this.overrides=o,this.libs={js:"",ace:"1.4.12",bootstrap:"5.3.2",bootstrap4:"4.6.2",bootstrap5:"5.3.2","bootstrap-icons":"1.11.1",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=e;return o&&(t+=`/${o}`),i&&"latest"!==i&&(t+=`/${i}`),t}updateUrls(){for(const e in this.libs)if(e in this.overrides)if("string"==typeof this.overrides[e])this[e]=this.buildUrl(this.overrides[e],e,this.libs[e]);else{const o=this.overrides[e];this[e]=this.buildUrl(o.cdn,o.lib||"",o.version||"")}else this[e]=this.buildUrl(this.baseUrl,e,this.libs[e])}}i.defaultCDN="https://cdn.form.io",o.default=i},96517:function(e,o,i){Object.defineProperty(o,"__esModule",{value:!0}),o.Formio=o.embed=void 0;const t=i(95413);Object.defineProperty(o,"Formio",{enumerable:!0,get:function(){return t.Formio}}),o.embed=function(e={}){const o=document.getElementsByTagName("script");e=Object.assign({},window.FormioConfig||{},e);let i=null,s=o.length;const r=e.scriptName||"formio.embed.";for(;s--;)if(o[s].src&&-1!==o[s].src.indexOf(r)){i=o[s];break}if(i){const o={};i.src.replace(/^[^?]+\??/,"").replace(/\?/g,"&").split("&").forEach((e=>{o[e.split("=")[0]]=e.split("=")[1]&&decodeURIComponent(e.split("=")[1])}));let s=i.src.replace(/^([^?]+).*/,"$1").split("/");s.pop(),e.formioPath&&e.formioPath(s),s=s.join("/");const r="true"===o.debug||"1"===o.debug,n=r?"formio.form":"formio.form.min";t.Formio.config=Object.assign({script:o.script||`${e.updatePath?e.updatePath():s}/${n}.js`,style:o.styles||`${e.updatePath?e.updatePath():s}/${n}.css`,cdn:o.cdn,class:o.class||"formio-form-wrapper",src:o.src,form:null,submission:null,project:o.project,base:o.base||"https://api.form.io",submit:o.submit,includeLibs:"true"===o.libs||"1"===o.libs,template:o.template,debug:r,config:{},redirect:o.return||o.redirect,embedCSS:`${e.updatePath?e.updatePath():s}/formio.embed.css`,success:o.success||"Thank you for your submission!",before:null,after:null},e);const c=t.Formio.config.form||t.Formio.config.src;if(c){t.Formio.debug("Embedding Configuration",e),t.Formio.config.addPremiumLib&&t.Formio.config.addPremiumLib(t.Formio.config,s),t.Formio.config.id=`formio-${Math.random().toString(36).substring(7)}`,t.Formio.debug("Creating form element");const o=t.Formio.createElement("div",{id:t.Formio.config.id,class:t.Formio.config.class});i.parentNode.insertBefore(o,i.parentNode.firstElementChild.nextSibling),t.Formio.createForm(o,c,t.Formio.config.config).then((e=>{t.Formio.config.submit&&(e.nosubmit=!0),e.on("submit",(o=>{if(t.Formio.debug("on('submit')",o),t.Formio.config.submit){t.Formio.debug(`Sending submission to ${t.Formio.config.submit}`);const i={"content-type":"application/json"},s=t.Formio.FormioClass.getToken();s&&(i["x-jwt-token"]=s),t.Formio.FormioClass.fetch(t.Formio.config.submit,{body:JSON.stringify(o),headers:i,method:"POST",mode:"cors"}).then((e=>e.json())).then((o=>t.Formio.submitDone(e,o)))}else t.Formio.submitDone(e,o)}))}))}}else document.write("<span>Could not locate the Embedded form.</span>")}},95413:function(e,o,i){var t,s=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 c(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,c)}a((t=t.apply(e,o||[])).next())}))},r=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 n=r(i(56036));class c{static setLicense(e,o=!1){t.license=e,!o&&t.FormioClass&&t.FormioClass.setLicense(e)}static setBaseUrl(e,o=!1){t.baseUrl=e,!o&&t.FormioClass&&t.FormioClass.setBaseUrl(e)}static setApiUrl(e,o=!1){t.baseUrl=e,!o&&t.FormioClass&&t.FormioClass.setApiUrl(e)}static setProjectUrl(e,o=!1){t.projectUrl=e,!o&&t.FormioClass&&t.FormioClass.setProjectUrl(e)}static setAppUrl(e,o=!1){t.projectUrl=e,!o&&t.FormioClass&&t.FormioClass.setAppUrl(e)}static setPathType(e,o=!1){t.pathType=e,!o&&t.FormioClass&&t.FormioClass.setPathType(e)}static debug(...e){t.config.debug&&console.log(...e)}static clearCache(){t.FormioClass&&t.FormioClass.clearCache()}static global(e,o=""){const i=window[e];return o&&i&&!i[o]?null:(t.debug(`Getting global ${e}`,i),i)}static use(e){t.FormioClass&&t.FormioClass.isRenderer?t.FormioClass.use(e):t.modules.push(e)}static createElement(e,o,i){const s=document.createElement(e);return Object.keys(o).forEach((e=>{s.setAttribute(e,o[e])})),(i||[]).forEach((e=>{s.appendChild(t.createElement(e.tag,e.attrs,e.children))})),s}static addScript(e,o,i,r=""){return s(this,void 0,void 0,(function*(){if(!o)return Promise.resolve();if("string"!=typeof o&&o.length)return Promise.all(o.map((o=>t.addScript(e,o))));if(i&&t.global(i,r))return t.debug(`${i} already loaded.`),Promise.resolve(t.global(i));t.debug("Adding Script",o);try{e.appendChild(t.createElement("script",{src:o}))}catch(e){return t.debug(e),Promise.resolve()}return i?new Promise((e=>{t.debug(`Waiting to load ${i}`);const o=setInterval((()=>{t.global(i,r)&&(clearInterval(o),t.debug(`${i} loaded.`),e(t.global(i)))}),100)})):Promise.resolve()}))}static addStyles(e,o){return s(this,void 0,void 0,(function*(){o&&("string"!=typeof o&&o.length?o.forEach((o=>t.addStyles(e,o))):(t.debug("Adding Styles",o),e.appendChild(t.createElement("link",{rel:"stylesheet",href:o}))))}))}static submitDone(e,o){return s(this,void 0,void 0,(function*(){t.debug("Submision Complete",o);const i=(t.config.success||"").toString();i&&"false"!==i.toLowerCase()&&e.element&&(e.element.innerHTML=`<div class="alert-success" role="alert">${i}</div>`);let s=t.config.redirect;if(!s&&e._form&&e._form.settings&&(e._form.settings.returnUrl||e._form.settings.redirect)&&(t.debug("Return url found in form configuration"),s=e._form.settings.returnUrl||e._form.settings.redirect),s){const i=e.formio?e.formio.formUrl:"",r=!!s.match(/\?/),n=0===s.indexOf(location.origin);s+=r?"&":"?",s+=`sub=${o._id}`,!n&&i&&(s+=`&form=${encodeURIComponent(i)}`),t.debug("Return URL",s),window.location.href=s,n&&window.location.reload()}}))}static formioScript(e,o){return o=o||t.config.includeBuilder,t.fullAdded||o?(t.fullAdded=!0,e.replace("formio.form","formio.full")):e}static addLibrary(e,o,i){return s(this,void 0,void 0,(function*(){if(o){if(o.dependencies)for(let i=0;i<o.dependencies.length;i++)yield t.addLibrary(e,t.cdn.libs[o.dependencies[i]]);if(o.css&&(yield t.addStyles(e,o.css)),o.js){const s=yield t.addScript(e,o.js,!!o.use&&i);if(o.use){t.debug(`Using ${i}`);const e=o.options||{};!e.license&&t.license&&(e.license=t.license),t.use("function"==typeof o.use?o.use(s):s,e)}}}}))}static addLoader(e){return s(this,void 0,void 0,(function*(){e.appendChild(t.createElement("div",{class:"formio-loader"},[{tag:"div",attrs:{class:"loader-wrapper"},children:[{tag:"div",attrs:{class:"loader text-center"}}]}]))}))}static init(e,o={},i=!1){return s(this,void 0,void 0,(function*(){t.cdn=new n.default(t.config.cdn,t.config.cdnUrls||{}),t.config.libs=t.config.libs||{uswds:{dependencies:["fontawesome"],js:`${t.cdn.uswds}/uswds.min.js`,css:`${t.cdn.uswds}/uswds.min.css`,use:!0},fontawesome:{css:`${t.cdn["font-awesome"]}/css/font-awesome.min.css`},bootstrap4:{dependencies:["fontawesome"],css:`${t.cdn.bootstrap4}/css/bootstrap.min.css`},bootstrap:{dependencies:["bootstrap-icons"],css:`${t.cdn.bootstrap}/css/bootstrap.min.css`},"bootstrap-icons":{css:`${t.cdn["bootstrap-icons"]}/css/bootstrap-icons.css`}};const s=t.config.id||`formio-${Math.random().toString(36).substring(7)}`;let r=t.createElement("div",{id:`${s}-wrapper`});e.parentNode.insertBefore(r,e);const c=t.config.includeLibs&&"function"==typeof r.attachShadow;c&&(r=r.attachShadow({mode:"open"}),o.shadowRoot=r),e.parentNode.removeChild(e),r.appendChild(e);const a=c?r:document.body;yield t.addStyles(a,t.config.embedCSS||`${t.cdn.js}/formio.embed.css`),t.addLoader(r);const l=t.config.full?"formio.full":"formio.form",d=t.config.debug?l:`${l}.min`;if(t.FormioClass=yield t.addScript(a,t.formioScript(t.config.script||`${t.cdn.js}/${d}.js`,i),"Formio",i?"isBuilder":"isRenderer"),t.FormioClass.cdn=t.cdn,t.FormioClass.setBaseUrl(o.baseUrl||t.baseUrl||t.config.base),t.FormioClass.setProjectUrl(o.projectUrl||t.projectUrl||t.config.project),t.FormioClass.language=t.language,t.setLicense(t.license||t.config.license||!1),t.modules.forEach((e=>{t.FormioClass.use(e)})),t.icons&&(t.FormioClass.icons=t.icons),t.pathType&&t.FormioClass.setPathType(t.pathType),t.config.template&&t.config.includeLibs&&(yield t.addLibrary(a,t.config.libs[t.config.template],t.config.template)),t.config.libraries||(t.config.libraries=t.config.modules||{}),t.config.premium&&(t.config.libraries.premium=t.config.premium),t.config.libraries)for(const e in t.config.libraries){const o=t.config.libraries[e];o.use=o.use||!0,yield t.addLibrary(a,o,e)}return yield t.addStyles(a,t.formioScript(t.config.style||`${t.cdn.js}/${d}.css`,i)),t.config.before&&(yield t.config.before(t.FormioClass,e,t.config)),t.FormioClass.license=!0,t._formioReady(t.FormioClass),r}))}static afterCreate(e,o,i){return s(this,void 0,void 0,(function*(){const s=o.querySelector(".formio-loader");return s&&o.removeChild(s),t.FormioClass.events.emit(i,e),t.config.after&&(t.debug("Calling ready callback"),t.config.after(e,t.config)),e}))}static createForm(e,o,i={}){return s(this,void 0,void 0,(function*(){if(t.FormioClass)return t.FormioClass.createForm(e,o,Object.assign(Object.assign({},i),{noLoader:!0}));const s=yield t.init(e,i);return t.FormioClass.createForm(e,o,Object.assign(Object.assign({},i),{noLoader:!0})).then((e=>(t.config.submission&&(t.debug("Setting submission",t.config.submission),e.submission=t.config.submission),t.afterCreate(e,s,"formEmbedded"),e)))}))}static builder(e,o,i={}){var r;return s(this,void 0,void 0,(function*(){if(null===(r=t.FormioClass)||void 0===r?void 0:r.builder)return t.FormioClass.builder(e,o,i);const s=yield t.init(e,i,!0);return t.FormioClass.builder(e,o,i).then((e=>(t.afterCreate(e,s,"builderEmbedded"),e)))}))}}o.Formio=c,t=c,c.FormioClass=null,c.config={},c.modules=[],c.icons="",c.license="",c.formioReady=new Promise(((e,o)=>{t._formioReady=e,t._formioReadyReject=o})),c.version="5.0.0-rc.56",c.Report={create:(e,o,i={})=>s(void 0,void 0,void 0,(function*(){var s;if(null===(s=t.FormioClass)||void 0===s?void 0:s.Report)return t.FormioClass.Report.create(e,o,i);const r=yield t.init(e,i,!0);return t.FormioClass.Report.create(e,o,i).then((e=>(t.afterCreate(e,r,"reportEmbedded"),e)))}))},n.default.defaultCDN=c.version.includes("rc")?"https://cdn.test-form.io":"https://cdn.form.io";class a{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.instance&&!this.instance.proxy&&this.instance.destroy(),this.element.innerHTML="",this.ready=this.create().then((e=>(this.instance=e,this.form=e.form,e)))}create(){return c.createForm(this.element,this.form,this.options)}setForm(e){this.form=e,this.instance&&this.instance.setForm(e)}setDisplay(e){return this.instance.proxy||(this.form.display=e,this.instance.destroy(),this.ready=this.create().then((e=>{this.instance=e,this.setForm(this.form)}))),this.ready}}o.Form=a;class l extends a{create(){return c.builder(this.element,this.form,this.options)}}o.FormBuilder=l,c.Form=a,c.FormBuilder=l}},o={};var i={};return(0,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}(96517).embed)(),i.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={56036:function(e,o){Object.defineProperty(o,"__esModule",{value:!0});class i{constructor(e,o={}){this.baseUrl=e||i.defaultCDN,this.overrides=o,this.libs={js:"",ace:"1.4.12",bootstrap:"5.3.2",bootstrap4:"4.6.2",bootstrap5:"5.3.2","bootstrap-icons":"1.11.1",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=e;return o&&(t+=`/${o}`),i&&"latest"!==i&&(t+=`/${i}`),t}updateUrls(){for(const e in this.libs)if(e in this.overrides)if("string"==typeof this.overrides[e])this[e]=this.buildUrl(this.overrides[e],e,this.libs[e]);else{const o=this.overrides[e];this[e]=this.buildUrl(o.cdn,o.lib||"",o.version||"")}else this[e]=this.buildUrl(this.baseUrl,e,this.libs[e])}}i.defaultCDN="https://cdn.form.io",o.default=i},96517:function(e,o,i){Object.defineProperty(o,"__esModule",{value:!0}),o.Formio=o.embed=void 0;const t=i(95413);Object.defineProperty(o,"Formio",{enumerable:!0,get:function(){return t.Formio}}),o.embed=function(e={}){const o=document.getElementsByTagName("script");e=Object.assign({},window.FormioConfig||{},e);let i=null,s=o.length;const r=e.scriptName||"formio.embed.";for(;s--;)if(o[s].src&&-1!==o[s].src.indexOf(r)){i=o[s];break}if(i){const o={};i.src.replace(/^[^?]+\??/,"").replace(/\?/g,"&").split("&").forEach((e=>{o[e.split("=")[0]]=e.split("=")[1]&&decodeURIComponent(e.split("=")[1])}));let s=i.src.replace(/^([^?]+).*/,"$1").split("/");s.pop();let r="";"js"===s[s.length-1]?(s.pop(),s=r=s.join("/")):s=s.join("/");const n="true"===o.debug||"1"===o.debug,c=n?"formio.form":"formio.form.min";t.Formio.config=Object.assign({script:o.script||`${s}/${c}.js`,style:o.styles||`${s}/${c}.css`,cdn:o.cdn||r,class:o.class||"formio-form-wrapper",src:o.src,form:null,submission:null,project:o.project,base:o.base||"https://api.form.io",submit:o.submit,includeLibs:"true"===o.libs||"1"===o.libs,template:o.template||"bootstrap",debug:n,config:{},redirect:o.return||o.redirect,embedCSS:`${s}/formio.embed.css`,success:o.success||"Thank you for your submission!",before:null,after:null},e),t.Formio.config.alter&&t.Formio.config.alter(t.Formio.config);const a=t.Formio.config.form||t.Formio.config.src;if(a){t.Formio.debug("Embedding Configuration",e),t.Formio.config.id=`formio-${Math.random().toString(36).substring(7)}`,t.Formio.debug("Creating form element");const o=t.Formio.createElement("div",{id:t.Formio.config.id,class:t.Formio.config.class});i.parentNode.insertBefore(o,i.parentNode.firstElementChild.nextSibling),t.Formio.createForm(o,a,t.Formio.config.config).then((e=>{t.Formio.config.submit&&(e.nosubmit=!0),e.on("submitDone",(o=>t.Formio.submitDone(e,o))),e.on("submit",(o=>{if(t.Formio.debug("on('submit')",o),t.Formio.config.submit){t.Formio.debug(`Sending submission to ${t.Formio.config.submit}`);const i={"content-type":"application/json"},s=t.Formio.FormioClass.getToken();s&&(i["x-jwt-token"]=s),t.Formio.FormioClass.fetch(t.Formio.config.submit,{body:JSON.stringify(o),headers:i,method:"POST",mode:"cors"}).then((e=>e.json())).then((o=>{t.Formio.submitDone(e,o)}))}}))}))}}else document.write("<span>Could not locate the Embedded form.</span>")}},95413:function(e,o,i){var t,s=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 c(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,c)}a((t=t.apply(e,o||[])).next())}))},r=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 n=r(i(56036));class c{static setLicense(e,o=!1){t.license=e,!o&&t.FormioClass&&t.FormioClass.setLicense(e)}static setBaseUrl(e,o=!1){t.baseUrl=e,!o&&t.FormioClass&&t.FormioClass.setBaseUrl(e)}static setApiUrl(e,o=!1){t.baseUrl=e,!o&&t.FormioClass&&t.FormioClass.setApiUrl(e)}static setProjectUrl(e,o=!1){t.projectUrl=e,!o&&t.FormioClass&&t.FormioClass.setProjectUrl(e)}static setAppUrl(e,o=!1){t.projectUrl=e,!o&&t.FormioClass&&t.FormioClass.setAppUrl(e)}static setPathType(e,o=!1){t.pathType=e,!o&&t.FormioClass&&t.FormioClass.setPathType(e)}static debug(...e){t.config.debug&&console.log(...e)}static clearCache(){t.FormioClass&&t.FormioClass.clearCache()}static global(e,o=""){const i=window[e];return o&&i&&!i[o]?null:(t.debug(`Getting global ${e}`,i),i)}static use(e){t.FormioClass&&t.FormioClass.isRenderer?t.FormioClass.use(e):t.modules.push(e)}static createElement(e,o,i){const s=document.createElement(e);return Object.keys(o).forEach((e=>{s.setAttribute(e,o[e])})),(i||[]).forEach((e=>{s.appendChild(t.createElement(e.tag,e.attrs,e.children))})),s}static addScript(e,o,i,r=""){return s(this,void 0,void 0,(function*(){if(!o)return Promise.resolve();if("string"!=typeof o&&o.length)return Promise.all(o.map((o=>t.addScript(e,o))));if(i&&t.global(i,r))return t.debug(`${i} already loaded.`),Promise.resolve(t.global(i));t.debug("Adding Script",o);try{e.appendChild(t.createElement("script",{src:o}))}catch(e){return t.debug(e),Promise.resolve()}return i?new Promise((e=>{t.debug(`Waiting to load ${i}`);const o=setInterval((()=>{t.global(i,r)&&(clearInterval(o),t.debug(`${i} loaded.`),e(t.global(i)))}),100)})):Promise.resolve()}))}static addStyles(e,o){return s(this,void 0,void 0,(function*(){o&&("string"!=typeof o&&o.length?o.forEach((o=>t.addStyles(e,o))):(t.debug("Adding Styles",o),e.appendChild(t.createElement("link",{rel:"stylesheet",href:o}))))}))}static submitDone(e,o){return s(this,void 0,void 0,(function*(){t.debug("Submision Complete",o),t.config.submitDone&&t.config.submitDone(o,e);const i=(t.config.success||"").toString();i&&"false"!==i.toLowerCase()&&e.element&&(e.element.innerHTML=`<div class="alert-success" role="alert">${i}</div>`);let s=t.config.redirect;if(!s&&e._form&&e._form.settings&&(e._form.settings.returnUrl||e._form.settings.redirect)&&(t.debug("Return url found in form configuration"),s=e._form.settings.returnUrl||e._form.settings.redirect),s){const i=e.formio?e.formio.formUrl:"",r=!!s.match(/\?/),n=0===s.indexOf(location.origin);s+=r?"&":"?",s+=`sub=${o._id}`,!n&&i&&(s+=`&form=${encodeURIComponent(i)}`),t.debug("Return URL",s),window.location.href=s,n&&window.location.reload()}}))}static formioScript(e,o){return o=o||t.config.includeBuilder,t.fullAdded||o?(t.fullAdded=!0,e.replace("formio.form","formio.full")):e}static addLibrary(e,o,i){return s(this,void 0,void 0,(function*(){if(o){if(o.dependencies)for(let i=0;i<o.dependencies.length;i++)yield t.addLibrary(e,t.cdn.libs[o.dependencies[i]]);if(o.css&&(yield t.addStyles(e,o.css)),o.js){const s=yield t.addScript(e,o.js,!!o.use&&i);if(o.use){t.debug(`Using ${i}`);const e=o.options||{};!e.license&&t.license&&(e.license=t.license),t.use("function"==typeof o.use?o.use(s):s,e)}}}}))}static addLoader(e){return s(this,void 0,void 0,(function*(){e.appendChild(t.createElement("div",{class:"formio-loader"},[{tag:"div",attrs:{class:"loader-wrapper"},children:[{tag:"div",attrs:{class:"loader text-center"}}]}]))}))}static init(e,o={},i=!1){return s(this,void 0,void 0,(function*(){t.cdn=new n.default(t.config.cdn,t.config.cdnUrls||{}),t.config.libs=t.config.libs||{uswds:{dependencies:["fontawesome"],js:`${t.cdn.uswds}/uswds.min.js`,css:`${t.cdn.uswds}/uswds.min.css`,use:!0},fontawesome:{css:`${t.cdn["font-awesome"]}/css/font-awesome.min.css`},bootstrap4:{dependencies:["fontawesome"],css:`${t.cdn.bootstrap4}/css/bootstrap.min.css`},bootstrap:{dependencies:["bootstrap-icons"],css:`${t.cdn.bootstrap}/css/bootstrap.min.css`},"bootstrap-icons":{css:`${t.cdn["bootstrap-icons"]}/css/bootstrap-icons.css`}};const s=t.config.id||`formio-${Math.random().toString(36).substring(7)}`;let r=t.createElement("div",{id:`${s}-wrapper`});e.parentNode.insertBefore(r,e);const c=t.config.includeLibs&&"function"==typeof r.attachShadow;c&&(r=r.attachShadow({mode:"open"}),o.shadowRoot=r),e.parentNode.removeChild(e),r.appendChild(e);const a=c?r:document.body;yield t.addStyles(a,t.config.embedCSS||`${t.cdn.js}/formio.embed.css`),t.addLoader(r);const l=t.config.full?"formio.full":"formio.form",d=t.config.debug?l:`${l}.min`;if(t.FormioClass=yield t.addScript(a,t.formioScript(t.config.script||`${t.cdn.js}/${d}.js`,i),"Formio",i?"isBuilder":"isRenderer"),t.FormioClass.cdn=t.cdn,t.FormioClass.setBaseUrl(o.baseUrl||t.baseUrl||t.config.base),t.FormioClass.setProjectUrl(o.projectUrl||t.projectUrl||t.config.project),t.FormioClass.language=t.language,t.setLicense(t.license||t.config.license||!1),t.modules.forEach((e=>{t.FormioClass.use(e)})),t.icons&&(t.FormioClass.icons=t.icons),t.pathType&&t.FormioClass.setPathType(t.pathType),t.config.template&&t.config.includeLibs&&(yield t.addLibrary(a,t.config.libs[t.config.template],t.config.template)),t.config.libraries||(t.config.libraries=t.config.modules||{}),t.config.premium&&(t.config.libraries.premium=t.config.premium),t.config.libraries)for(const e in t.config.libraries){const o=t.config.libraries[e];o.use=o.use||!0,yield t.addLibrary(a,o,e)}return yield t.addStyles(a,t.formioScript(t.config.style||`${t.cdn.js}/${d}.css`,i)),t.config.before&&(yield t.config.before(t.FormioClass,e,t.config)),t.FormioClass.license=!0,t._formioReady(t.FormioClass),r}))}static afterCreate(e,o,i){return s(this,void 0,void 0,(function*(){const s=o.querySelector(".formio-loader");return s&&o.removeChild(s),t.FormioClass.events.emit(i,e),t.config.after&&(t.debug("Calling ready callback"),t.config.after(e,t.config)),e}))}static createForm(e,o,i={}){return s(this,void 0,void 0,(function*(){if(t.FormioClass)return t.FormioClass.createForm(e,o,Object.assign(Object.assign({},i),{noLoader:!0}));const s=yield t.init(e,i);return t.FormioClass.createForm(e,o,Object.assign(Object.assign({},i),{noLoader:!0})).then((e=>(t.config.submission&&(t.debug("Setting submission",t.config.submission),e.submission=t.config.submission),t.afterCreate(e,s,"formEmbedded"),e)))}))}static builder(e,o,i={}){var r;return s(this,void 0,void 0,(function*(){if(null===(r=t.FormioClass)||void 0===r?void 0:r.builder)return t.FormioClass.builder(e,o,i);const s=yield t.init(e,i,!0);return t.FormioClass.builder(e,o,i).then((e=>(t.afterCreate(e,s,"builderEmbedded"),e)))}))}}o.Formio=c,t=c,c.FormioClass=null,c.config={},c.modules=[],c.icons="",c.license="",c.formioReady=new Promise(((e,o)=>{t._formioReady=e,t._formioReadyReject=o})),c.version="5.0.0-rc.57",c.Report={create:(e,o,i={})=>s(void 0,void 0,void 0,(function*(){var s;if(null===(s=t.FormioClass)||void 0===s?void 0:s.Report)return t.FormioClass.Report.create(e,o,i);const r=yield t.init(e,i,!0);return t.FormioClass.Report.create(e,o,i).then((e=>(t.afterCreate(e,r,"reportEmbedded"),e)))}))},n.default.defaultCDN=c.version.includes("rc")?"https://cdn.test-form.io":"https://cdn.form.io";class a{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.instance&&!this.instance.proxy&&this.instance.destroy(),this.element.innerHTML="",this.ready=this.create().then((e=>(this.instance=e,this.form=e.form,e)))}create(){return c.createForm(this.element,this.form,this.options)}setForm(e){this.form=e,this.instance&&this.instance.setForm(e)}setDisplay(e){return this.instance.proxy||(this.form.display=e,this.instance.destroy(),this.ready=this.create().then((e=>{this.instance=e,this.setForm(this.form)}))),this.ready}}o.Form=a;class l extends a{create(){return c.builder(this.element,this.form,this.options)}}o.FormBuilder=l,c.Form=a,c.FormBuilder=l}},o={};var i={};return(0,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}(96517).embed)(),i.Formio}()}));
|
package/dist/formio.embed.min.js
CHANGED
@@ -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={56036:function(e,o){Object.defineProperty(o,"__esModule",{value:!0});class i{constructor(e,o={}){this.baseUrl=e||i.defaultCDN,this.overrides=o,this.libs={js:"",ace:"1.4.12",bootstrap:"5.3.2",bootstrap4:"4.6.2",bootstrap5:"5.3.2","bootstrap-icons":"1.11.1",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=e;return o&&(t+=`/${o}`),i&&"latest"!==i&&(t+=`/${i}`),t}updateUrls(){for(const e in this.libs)if(e in this.overrides)if("string"==typeof this.overrides[e])this[e]=this.buildUrl(this.overrides[e],e,this.libs[e]);else{const o=this.overrides[e];this[e]=this.buildUrl(o.cdn,o.lib||"",o.version||"")}else this[e]=this.buildUrl(this.baseUrl,e,this.libs[e])}}i.defaultCDN="https://cdn.form.io",o.default=i},96517:function(e,o,i){Object.defineProperty(o,"__esModule",{value:!0}),o.Formio=o.embed=void 0;const t=i(95413);Object.defineProperty(o,"Formio",{enumerable:!0,get:function(){return t.Formio}}),o.embed=function(e={}){const o=document.getElementsByTagName("script");e=Object.assign({},window.FormioConfig||{},e);let i=null,s=o.length;const r=e.scriptName||"formio.embed.";for(;s--;)if(o[s].src&&-1!==o[s].src.indexOf(r)){i=o[s];break}if(i){const o={};i.src.replace(/^[^?]+\??/,"").replace(/\?/g,"&").split("&").forEach((e=>{o[e.split("=")[0]]=e.split("=")[1]&&decodeURIComponent(e.split("=")[1])}));let s=i.src.replace(/^([^?]+).*/,"$1").split("/");s.pop(),e.formioPath&&e.formioPath(s),s=s.join("/");const r="true"===o.debug||"1"===o.debug,n=r?"formio.form":"formio.form.min";t.Formio.config=Object.assign({script:o.script||`${e.updatePath?e.updatePath():s}/${n}.js`,style:o.styles||`${e.updatePath?e.updatePath():s}/${n}.css`,cdn:o.cdn,class:o.class||"formio-form-wrapper",src:o.src,form:null,submission:null,project:o.project,base:o.base||"https://api.form.io",submit:o.submit,includeLibs:"true"===o.libs||"1"===o.libs,template:o.template,debug:r,config:{},redirect:o.return||o.redirect,embedCSS:`${e.updatePath?e.updatePath():s}/formio.embed.css`,success:o.success||"Thank you for your submission!",before:null,after:null},e);const c=t.Formio.config.form||t.Formio.config.src;if(c){t.Formio.debug("Embedding Configuration",e),t.Formio.config.addPremiumLib&&t.Formio.config.addPremiumLib(t.Formio.config,s),t.Formio.config.id=`formio-${Math.random().toString(36).substring(7)}`,t.Formio.debug("Creating form element");const o=t.Formio.createElement("div",{id:t.Formio.config.id,class:t.Formio.config.class});i.parentNode.insertBefore(o,i.parentNode.firstElementChild.nextSibling),t.Formio.createForm(o,c,t.Formio.config.config).then((e=>{t.Formio.config.submit&&(e.nosubmit=!0),e.on("submit",(o=>{if(t.Formio.debug("on('submit')",o),t.Formio.config.submit){t.Formio.debug(`Sending submission to ${t.Formio.config.submit}`);const i={"content-type":"application/json"},s=t.Formio.FormioClass.getToken();s&&(i["x-jwt-token"]=s),t.Formio.FormioClass.fetch(t.Formio.config.submit,{body:JSON.stringify(o),headers:i,method:"POST",mode:"cors"}).then((e=>e.json())).then((o=>t.Formio.submitDone(e,o)))}else t.Formio.submitDone(e,o)}))}))}}else document.write("<span>Could not locate the Embedded form.</span>")}},95413:function(e,o,i){var t,s=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 c(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,c)}a((t=t.apply(e,o||[])).next())}))},r=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 n=r(i(56036));class c{static setLicense(e,o=!1){t.license=e,!o&&t.FormioClass&&t.FormioClass.setLicense(e)}static setBaseUrl(e,o=!1){t.baseUrl=e,!o&&t.FormioClass&&t.FormioClass.setBaseUrl(e)}static setApiUrl(e,o=!1){t.baseUrl=e,!o&&t.FormioClass&&t.FormioClass.setApiUrl(e)}static setProjectUrl(e,o=!1){t.projectUrl=e,!o&&t.FormioClass&&t.FormioClass.setProjectUrl(e)}static setAppUrl(e,o=!1){t.projectUrl=e,!o&&t.FormioClass&&t.FormioClass.setAppUrl(e)}static setPathType(e,o=!1){t.pathType=e,!o&&t.FormioClass&&t.FormioClass.setPathType(e)}static debug(...e){t.config.debug&&console.log(...e)}static clearCache(){t.FormioClass&&t.FormioClass.clearCache()}static global(e,o=""){const i=window[e];return o&&i&&!i[o]?null:(t.debug(`Getting global ${e}`,i),i)}static use(e){t.FormioClass&&t.FormioClass.isRenderer?t.FormioClass.use(e):t.modules.push(e)}static createElement(e,o,i){const s=document.createElement(e);return Object.keys(o).forEach((e=>{s.setAttribute(e,o[e])})),(i||[]).forEach((e=>{s.appendChild(t.createElement(e.tag,e.attrs,e.children))})),s}static addScript(e,o,i,r=""){return s(this,void 0,void 0,(function*(){if(!o)return Promise.resolve();if("string"!=typeof o&&o.length)return Promise.all(o.map((o=>t.addScript(e,o))));if(i&&t.global(i,r))return t.debug(`${i} already loaded.`),Promise.resolve(t.global(i));t.debug("Adding Script",o);try{e.appendChild(t.createElement("script",{src:o}))}catch(e){return t.debug(e),Promise.resolve()}return i?new Promise((e=>{t.debug(`Waiting to load ${i}`);const o=setInterval((()=>{t.global(i,r)&&(clearInterval(o),t.debug(`${i} loaded.`),e(t.global(i)))}),100)})):Promise.resolve()}))}static addStyles(e,o){return s(this,void 0,void 0,(function*(){o&&("string"!=typeof o&&o.length?o.forEach((o=>t.addStyles(e,o))):(t.debug("Adding Styles",o),e.appendChild(t.createElement("link",{rel:"stylesheet",href:o}))))}))}static submitDone(e,o){return s(this,void 0,void 0,(function*(){t.debug("Submision Complete",o);const i=(t.config.success||"").toString();i&&"false"!==i.toLowerCase()&&e.element&&(e.element.innerHTML=`<div class="alert-success" role="alert">${i}</div>`);let s=t.config.redirect;if(!s&&e._form&&e._form.settings&&(e._form.settings.returnUrl||e._form.settings.redirect)&&(t.debug("Return url found in form configuration"),s=e._form.settings.returnUrl||e._form.settings.redirect),s){const i=e.formio?e.formio.formUrl:"",r=!!s.match(/\?/),n=0===s.indexOf(location.origin);s+=r?"&":"?",s+=`sub=${o._id}`,!n&&i&&(s+=`&form=${encodeURIComponent(i)}`),t.debug("Return URL",s),window.location.href=s,n&&window.location.reload()}}))}static formioScript(e,o){return o=o||t.config.includeBuilder,t.fullAdded||o?(t.fullAdded=!0,e.replace("formio.form","formio.full")):e}static addLibrary(e,o,i){return s(this,void 0,void 0,(function*(){if(o){if(o.dependencies)for(let i=0;i<o.dependencies.length;i++)yield t.addLibrary(e,t.cdn.libs[o.dependencies[i]]);if(o.css&&(yield t.addStyles(e,o.css)),o.js){const s=yield t.addScript(e,o.js,!!o.use&&i);if(o.use){t.debug(`Using ${i}`);const e=o.options||{};!e.license&&t.license&&(e.license=t.license),t.use("function"==typeof o.use?o.use(s):s,e)}}}}))}static addLoader(e){return s(this,void 0,void 0,(function*(){e.appendChild(t.createElement("div",{class:"formio-loader"},[{tag:"div",attrs:{class:"loader-wrapper"},children:[{tag:"div",attrs:{class:"loader text-center"}}]}]))}))}static init(e,o={},i=!1){return s(this,void 0,void 0,(function*(){t.cdn=new n.default(t.config.cdn,t.config.cdnUrls||{}),t.config.libs=t.config.libs||{uswds:{dependencies:["fontawesome"],js:`${t.cdn.uswds}/uswds.min.js`,css:`${t.cdn.uswds}/uswds.min.css`,use:!0},fontawesome:{css:`${t.cdn["font-awesome"]}/css/font-awesome.min.css`},bootstrap4:{dependencies:["fontawesome"],css:`${t.cdn.bootstrap4}/css/bootstrap.min.css`},bootstrap:{dependencies:["bootstrap-icons"],css:`${t.cdn.bootstrap}/css/bootstrap.min.css`},"bootstrap-icons":{css:`${t.cdn["bootstrap-icons"]}/css/bootstrap-icons.css`}};const s=t.config.id||`formio-${Math.random().toString(36).substring(7)}`;let r=t.createElement("div",{id:`${s}-wrapper`});e.parentNode.insertBefore(r,e);const c=t.config.includeLibs&&"function"==typeof r.attachShadow;c&&(r=r.attachShadow({mode:"open"}),o.shadowRoot=r),e.parentNode.removeChild(e),r.appendChild(e);const a=c?r:document.body;yield t.addStyles(a,t.config.embedCSS||`${t.cdn.js}/formio.embed.css`),t.addLoader(r);const l=t.config.full?"formio.full":"formio.form",d=t.config.debug?l:`${l}.min`;if(t.FormioClass=yield t.addScript(a,t.formioScript(t.config.script||`${t.cdn.js}/${d}.js`,i),"Formio",i?"isBuilder":"isRenderer"),t.FormioClass.cdn=t.cdn,t.FormioClass.setBaseUrl(o.baseUrl||t.baseUrl||t.config.base),t.FormioClass.setProjectUrl(o.projectUrl||t.projectUrl||t.config.project),t.FormioClass.language=t.language,t.setLicense(t.license||t.config.license||!1),t.modules.forEach((e=>{t.FormioClass.use(e)})),t.icons&&(t.FormioClass.icons=t.icons),t.pathType&&t.FormioClass.setPathType(t.pathType),t.config.template&&t.config.includeLibs&&(yield t.addLibrary(a,t.config.libs[t.config.template],t.config.template)),t.config.libraries||(t.config.libraries=t.config.modules||{}),t.config.premium&&(t.config.libraries.premium=t.config.premium),t.config.libraries)for(const e in t.config.libraries){const o=t.config.libraries[e];o.use=o.use||!0,yield t.addLibrary(a,o,e)}return yield t.addStyles(a,t.formioScript(t.config.style||`${t.cdn.js}/${d}.css`,i)),t.config.before&&(yield t.config.before(t.FormioClass,e,t.config)),t.FormioClass.license=!0,t._formioReady(t.FormioClass),r}))}static afterCreate(e,o,i){return s(this,void 0,void 0,(function*(){const s=o.querySelector(".formio-loader");return s&&o.removeChild(s),t.FormioClass.events.emit(i,e),t.config.after&&(t.debug("Calling ready callback"),t.config.after(e,t.config)),e}))}static createForm(e,o,i={}){return s(this,void 0,void 0,(function*(){if(t.FormioClass)return t.FormioClass.createForm(e,o,Object.assign(Object.assign({},i),{noLoader:!0}));const s=yield t.init(e,i);return t.FormioClass.createForm(e,o,Object.assign(Object.assign({},i),{noLoader:!0})).then((e=>(t.config.submission&&(t.debug("Setting submission",t.config.submission),e.submission=t.config.submission),t.afterCreate(e,s,"formEmbedded"),e)))}))}static builder(e,o,i={}){var r;return s(this,void 0,void 0,(function*(){if(null===(r=t.FormioClass)||void 0===r?void 0:r.builder)return t.FormioClass.builder(e,o,i);const s=yield t.init(e,i,!0);return t.FormioClass.builder(e,o,i).then((e=>(t.afterCreate(e,s,"builderEmbedded"),e)))}))}}o.Formio=c,t=c,c.FormioClass=null,c.config={},c.modules=[],c.icons="",c.license="",c.formioReady=new Promise(((e,o)=>{t._formioReady=e,t._formioReadyReject=o})),c.version="5.0.0-rc.56",c.Report={create:(e,o,i={})=>s(void 0,void 0,void 0,(function*(){var s;if(null===(s=t.FormioClass)||void 0===s?void 0:s.Report)return t.FormioClass.Report.create(e,o,i);const r=yield t.init(e,i,!0);return t.FormioClass.Report.create(e,o,i).then((e=>(t.afterCreate(e,r,"reportEmbedded"),e)))}))},n.default.defaultCDN=c.version.includes("rc")?"https://cdn.test-form.io":"https://cdn.form.io";class a{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.instance&&!this.instance.proxy&&this.instance.destroy(),this.element.innerHTML="",this.ready=this.create().then((e=>(this.instance=e,this.form=e.form,e)))}create(){return c.createForm(this.element,this.form,this.options)}setForm(e){this.form=e,this.instance&&this.instance.setForm(e)}setDisplay(e){return this.instance.proxy||(this.form.display=e,this.instance.destroy(),this.ready=this.create().then((e=>{this.instance=e,this.setForm(this.form)}))),this.ready}}o.Form=a;class l extends a{create(){return c.builder(this.element,this.form,this.options)}}o.FormBuilder=l,c.Form=a,c.FormBuilder=l}},o={};var i={};return(0,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}(96517).embed)(),i.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={56036:function(e,o){Object.defineProperty(o,"__esModule",{value:!0});class i{constructor(e,o={}){this.baseUrl=e||i.defaultCDN,this.overrides=o,this.libs={js:"",ace:"1.4.12",bootstrap:"5.3.2",bootstrap4:"4.6.2",bootstrap5:"5.3.2","bootstrap-icons":"1.11.1",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=e;return o&&(t+=`/${o}`),i&&"latest"!==i&&(t+=`/${i}`),t}updateUrls(){for(const e in this.libs)if(e in this.overrides)if("string"==typeof this.overrides[e])this[e]=this.buildUrl(this.overrides[e],e,this.libs[e]);else{const o=this.overrides[e];this[e]=this.buildUrl(o.cdn,o.lib||"",o.version||"")}else this[e]=this.buildUrl(this.baseUrl,e,this.libs[e])}}i.defaultCDN="https://cdn.form.io",o.default=i},96517:function(e,o,i){Object.defineProperty(o,"__esModule",{value:!0}),o.Formio=o.embed=void 0;const t=i(95413);Object.defineProperty(o,"Formio",{enumerable:!0,get:function(){return t.Formio}}),o.embed=function(e={}){const o=document.getElementsByTagName("script");e=Object.assign({},window.FormioConfig||{},e);let i=null,s=o.length;const r=e.scriptName||"formio.embed.";for(;s--;)if(o[s].src&&-1!==o[s].src.indexOf(r)){i=o[s];break}if(i){const o={};i.src.replace(/^[^?]+\??/,"").replace(/\?/g,"&").split("&").forEach((e=>{o[e.split("=")[0]]=e.split("=")[1]&&decodeURIComponent(e.split("=")[1])}));let s=i.src.replace(/^([^?]+).*/,"$1").split("/");s.pop();let r="";"js"===s[s.length-1]?(s.pop(),s=r=s.join("/")):s=s.join("/");const n="true"===o.debug||"1"===o.debug,c=n?"formio.form":"formio.form.min";t.Formio.config=Object.assign({script:o.script||`${s}/${c}.js`,style:o.styles||`${s}/${c}.css`,cdn:o.cdn||r,class:o.class||"formio-form-wrapper",src:o.src,form:null,submission:null,project:o.project,base:o.base||"https://api.form.io",submit:o.submit,includeLibs:"true"===o.libs||"1"===o.libs,template:o.template||"bootstrap",debug:n,config:{},redirect:o.return||o.redirect,embedCSS:`${s}/formio.embed.css`,success:o.success||"Thank you for your submission!",before:null,after:null},e),t.Formio.config.alter&&t.Formio.config.alter(t.Formio.config);const a=t.Formio.config.form||t.Formio.config.src;if(a){t.Formio.debug("Embedding Configuration",e),t.Formio.config.id=`formio-${Math.random().toString(36).substring(7)}`,t.Formio.debug("Creating form element");const o=t.Formio.createElement("div",{id:t.Formio.config.id,class:t.Formio.config.class});i.parentNode.insertBefore(o,i.parentNode.firstElementChild.nextSibling),t.Formio.createForm(o,a,t.Formio.config.config).then((e=>{t.Formio.config.submit&&(e.nosubmit=!0),e.on("submitDone",(o=>t.Formio.submitDone(e,o))),e.on("submit",(o=>{if(t.Formio.debug("on('submit')",o),t.Formio.config.submit){t.Formio.debug(`Sending submission to ${t.Formio.config.submit}`);const i={"content-type":"application/json"},s=t.Formio.FormioClass.getToken();s&&(i["x-jwt-token"]=s),t.Formio.FormioClass.fetch(t.Formio.config.submit,{body:JSON.stringify(o),headers:i,method:"POST",mode:"cors"}).then((e=>e.json())).then((o=>{t.Formio.submitDone(e,o)}))}}))}))}}else document.write("<span>Could not locate the Embedded form.</span>")}},95413:function(e,o,i){var t,s=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 c(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,c)}a((t=t.apply(e,o||[])).next())}))},r=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 n=r(i(56036));class c{static setLicense(e,o=!1){t.license=e,!o&&t.FormioClass&&t.FormioClass.setLicense(e)}static setBaseUrl(e,o=!1){t.baseUrl=e,!o&&t.FormioClass&&t.FormioClass.setBaseUrl(e)}static setApiUrl(e,o=!1){t.baseUrl=e,!o&&t.FormioClass&&t.FormioClass.setApiUrl(e)}static setProjectUrl(e,o=!1){t.projectUrl=e,!o&&t.FormioClass&&t.FormioClass.setProjectUrl(e)}static setAppUrl(e,o=!1){t.projectUrl=e,!o&&t.FormioClass&&t.FormioClass.setAppUrl(e)}static setPathType(e,o=!1){t.pathType=e,!o&&t.FormioClass&&t.FormioClass.setPathType(e)}static debug(...e){t.config.debug&&console.log(...e)}static clearCache(){t.FormioClass&&t.FormioClass.clearCache()}static global(e,o=""){const i=window[e];return o&&i&&!i[o]?null:(t.debug(`Getting global ${e}`,i),i)}static use(e){t.FormioClass&&t.FormioClass.isRenderer?t.FormioClass.use(e):t.modules.push(e)}static createElement(e,o,i){const s=document.createElement(e);return Object.keys(o).forEach((e=>{s.setAttribute(e,o[e])})),(i||[]).forEach((e=>{s.appendChild(t.createElement(e.tag,e.attrs,e.children))})),s}static addScript(e,o,i,r=""){return s(this,void 0,void 0,(function*(){if(!o)return Promise.resolve();if("string"!=typeof o&&o.length)return Promise.all(o.map((o=>t.addScript(e,o))));if(i&&t.global(i,r))return t.debug(`${i} already loaded.`),Promise.resolve(t.global(i));t.debug("Adding Script",o);try{e.appendChild(t.createElement("script",{src:o}))}catch(e){return t.debug(e),Promise.resolve()}return i?new Promise((e=>{t.debug(`Waiting to load ${i}`);const o=setInterval((()=>{t.global(i,r)&&(clearInterval(o),t.debug(`${i} loaded.`),e(t.global(i)))}),100)})):Promise.resolve()}))}static addStyles(e,o){return s(this,void 0,void 0,(function*(){o&&("string"!=typeof o&&o.length?o.forEach((o=>t.addStyles(e,o))):(t.debug("Adding Styles",o),e.appendChild(t.createElement("link",{rel:"stylesheet",href:o}))))}))}static submitDone(e,o){return s(this,void 0,void 0,(function*(){t.debug("Submision Complete",o),t.config.submitDone&&t.config.submitDone(o,e);const i=(t.config.success||"").toString();i&&"false"!==i.toLowerCase()&&e.element&&(e.element.innerHTML=`<div class="alert-success" role="alert">${i}</div>`);let s=t.config.redirect;if(!s&&e._form&&e._form.settings&&(e._form.settings.returnUrl||e._form.settings.redirect)&&(t.debug("Return url found in form configuration"),s=e._form.settings.returnUrl||e._form.settings.redirect),s){const i=e.formio?e.formio.formUrl:"",r=!!s.match(/\?/),n=0===s.indexOf(location.origin);s+=r?"&":"?",s+=`sub=${o._id}`,!n&&i&&(s+=`&form=${encodeURIComponent(i)}`),t.debug("Return URL",s),window.location.href=s,n&&window.location.reload()}}))}static formioScript(e,o){return o=o||t.config.includeBuilder,t.fullAdded||o?(t.fullAdded=!0,e.replace("formio.form","formio.full")):e}static addLibrary(e,o,i){return s(this,void 0,void 0,(function*(){if(o){if(o.dependencies)for(let i=0;i<o.dependencies.length;i++)yield t.addLibrary(e,t.cdn.libs[o.dependencies[i]]);if(o.css&&(yield t.addStyles(e,o.css)),o.js){const s=yield t.addScript(e,o.js,!!o.use&&i);if(o.use){t.debug(`Using ${i}`);const e=o.options||{};!e.license&&t.license&&(e.license=t.license),t.use("function"==typeof o.use?o.use(s):s,e)}}}}))}static addLoader(e){return s(this,void 0,void 0,(function*(){e.appendChild(t.createElement("div",{class:"formio-loader"},[{tag:"div",attrs:{class:"loader-wrapper"},children:[{tag:"div",attrs:{class:"loader text-center"}}]}]))}))}static init(e,o={},i=!1){return s(this,void 0,void 0,(function*(){t.cdn=new n.default(t.config.cdn,t.config.cdnUrls||{}),t.config.libs=t.config.libs||{uswds:{dependencies:["fontawesome"],js:`${t.cdn.uswds}/uswds.min.js`,css:`${t.cdn.uswds}/uswds.min.css`,use:!0},fontawesome:{css:`${t.cdn["font-awesome"]}/css/font-awesome.min.css`},bootstrap4:{dependencies:["fontawesome"],css:`${t.cdn.bootstrap4}/css/bootstrap.min.css`},bootstrap:{dependencies:["bootstrap-icons"],css:`${t.cdn.bootstrap}/css/bootstrap.min.css`},"bootstrap-icons":{css:`${t.cdn["bootstrap-icons"]}/css/bootstrap-icons.css`}};const s=t.config.id||`formio-${Math.random().toString(36).substring(7)}`;let r=t.createElement("div",{id:`${s}-wrapper`});e.parentNode.insertBefore(r,e);const c=t.config.includeLibs&&"function"==typeof r.attachShadow;c&&(r=r.attachShadow({mode:"open"}),o.shadowRoot=r),e.parentNode.removeChild(e),r.appendChild(e);const a=c?r:document.body;yield t.addStyles(a,t.config.embedCSS||`${t.cdn.js}/formio.embed.css`),t.addLoader(r);const l=t.config.full?"formio.full":"formio.form",d=t.config.debug?l:`${l}.min`;if(t.FormioClass=yield t.addScript(a,t.formioScript(t.config.script||`${t.cdn.js}/${d}.js`,i),"Formio",i?"isBuilder":"isRenderer"),t.FormioClass.cdn=t.cdn,t.FormioClass.setBaseUrl(o.baseUrl||t.baseUrl||t.config.base),t.FormioClass.setProjectUrl(o.projectUrl||t.projectUrl||t.config.project),t.FormioClass.language=t.language,t.setLicense(t.license||t.config.license||!1),t.modules.forEach((e=>{t.FormioClass.use(e)})),t.icons&&(t.FormioClass.icons=t.icons),t.pathType&&t.FormioClass.setPathType(t.pathType),t.config.template&&t.config.includeLibs&&(yield t.addLibrary(a,t.config.libs[t.config.template],t.config.template)),t.config.libraries||(t.config.libraries=t.config.modules||{}),t.config.premium&&(t.config.libraries.premium=t.config.premium),t.config.libraries)for(const e in t.config.libraries){const o=t.config.libraries[e];o.use=o.use||!0,yield t.addLibrary(a,o,e)}return yield t.addStyles(a,t.formioScript(t.config.style||`${t.cdn.js}/${d}.css`,i)),t.config.before&&(yield t.config.before(t.FormioClass,e,t.config)),t.FormioClass.license=!0,t._formioReady(t.FormioClass),r}))}static afterCreate(e,o,i){return s(this,void 0,void 0,(function*(){const s=o.querySelector(".formio-loader");return s&&o.removeChild(s),t.FormioClass.events.emit(i,e),t.config.after&&(t.debug("Calling ready callback"),t.config.after(e,t.config)),e}))}static createForm(e,o,i={}){return s(this,void 0,void 0,(function*(){if(t.FormioClass)return t.FormioClass.createForm(e,o,Object.assign(Object.assign({},i),{noLoader:!0}));const s=yield t.init(e,i);return t.FormioClass.createForm(e,o,Object.assign(Object.assign({},i),{noLoader:!0})).then((e=>(t.config.submission&&(t.debug("Setting submission",t.config.submission),e.submission=t.config.submission),t.afterCreate(e,s,"formEmbedded"),e)))}))}static builder(e,o,i={}){var r;return s(this,void 0,void 0,(function*(){if(null===(r=t.FormioClass)||void 0===r?void 0:r.builder)return t.FormioClass.builder(e,o,i);const s=yield t.init(e,i,!0);return t.FormioClass.builder(e,o,i).then((e=>(t.afterCreate(e,s,"builderEmbedded"),e)))}))}}o.Formio=c,t=c,c.FormioClass=null,c.config={},c.modules=[],c.icons="",c.license="",c.formioReady=new Promise(((e,o)=>{t._formioReady=e,t._formioReadyReject=o})),c.version="5.0.0-rc.57",c.Report={create:(e,o,i={})=>s(void 0,void 0,void 0,(function*(){var s;if(null===(s=t.FormioClass)||void 0===s?void 0:s.Report)return t.FormioClass.Report.create(e,o,i);const r=yield t.init(e,i,!0);return t.FormioClass.Report.create(e,o,i).then((e=>(t.afterCreate(e,r,"reportEmbedded"),e)))}))},n.default.defaultCDN=c.version.includes("rc")?"https://cdn.test-form.io":"https://cdn.form.io";class a{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.instance&&!this.instance.proxy&&this.instance.destroy(),this.element.innerHTML="",this.ready=this.create().then((e=>(this.instance=e,this.form=e.form,e)))}create(){return c.createForm(this.element,this.form,this.options)}setForm(e){this.form=e,this.instance&&this.instance.setForm(e)}setDisplay(e){return this.instance.proxy||(this.form.display=e,this.instance.destroy(),this.ready=this.create().then((e=>{this.instance=e,this.setForm(this.form)}))),this.ready}}o.Form=a;class l extends a{create(){return c.builder(this.element,this.form,this.options)}}o.FormBuilder=l,c.Form=a,c.FormBuilder=l}},o={};var i={};return(0,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}(96517).embed)(),i.Formio}()}));
|
@@ -1 +1 @@
|
|
1
|
-
/*! formiojs v5.0.0-rc.
|
1
|
+
/*! formiojs v5.0.0-rc.57 | https://unpkg.com/formiojs@5.0.0-rc.57/LICENSE.txt */
|
package/dist/formio.form.js
CHANGED
@@ -8734,7 +8734,7 @@ eval("\nvar parent = __webpack_require__(/*! ../../es/object/from-entries */ \".
|
|
8734
8734
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
8735
8735
|
|
8736
8736
|
"use strict";
|
8737
|
-
eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nvar _a;\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.FormBuilder = exports.Form = exports.Formio = void 0;\nconst CDN_js_1 = __importDefault(__webpack_require__(/*! ./CDN.js */ \"./lib/cjs/CDN.js\"));\nclass Formio {\n static setLicense(license, norecurse = false) {\n _a.license = license;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setLicense(license);\n }\n }\n static setBaseUrl(url, norecurse = false) {\n _a.baseUrl = url;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setBaseUrl(url);\n }\n }\n static setApiUrl(url, norecurse = false) {\n _a.baseUrl = url;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setApiUrl(url);\n }\n }\n static setProjectUrl(url, norecurse = false) {\n _a.projectUrl = url;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setProjectUrl(url);\n }\n }\n static setAppUrl(url, norecurse = false) {\n _a.projectUrl = url;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setAppUrl(url);\n }\n }\n static setPathType(type, norecurse = false) {\n _a.pathType = type;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setPathType(type);\n }\n }\n static debug(...args) {\n if (_a.config.debug) {\n console.log(...args);\n }\n }\n static clearCache() {\n if (_a.FormioClass) {\n _a.FormioClass.clearCache();\n }\n }\n static global(prop, flag = '') {\n const globalValue = window[prop];\n if (flag && globalValue && !globalValue[flag]) {\n return null;\n }\n _a.debug(`Getting global ${prop}`, globalValue);\n return globalValue;\n }\n static use(module) {\n if (_a.FormioClass && _a.FormioClass.isRenderer) {\n _a.FormioClass.use(module);\n }\n else {\n _a.modules.push(module);\n }\n }\n static createElement(type, attrs, children) {\n const element = document.createElement(type);\n Object.keys(attrs).forEach(key => {\n element.setAttribute(key, attrs[key]);\n });\n (children || []).forEach(child => {\n element.appendChild(_a.createElement(child.tag, child.attrs, child.children));\n });\n return element;\n }\n static addScript(wrapper, src, name, flag = '') {\n return __awaiter(this, void 0, void 0, function* () {\n if (!src) {\n return Promise.resolve();\n }\n if (typeof src !== 'string' && src.length) {\n return Promise.all(src.map(ref => _a.addScript(wrapper, ref)));\n }\n if (name && _a.global(name, flag)) {\n _a.debug(`${name} already loaded.`);\n return Promise.resolve(_a.global(name));\n }\n _a.debug('Adding Script', src);\n try {\n wrapper.appendChild(_a.createElement('script', {\n src\n }));\n }\n catch (err) {\n _a.debug(err);\n return Promise.resolve();\n }\n if (!name) {\n return Promise.resolve();\n }\n return new Promise((resolve) => {\n _a.debug(`Waiting to load ${name}`);\n const wait = setInterval(() => {\n if (_a.global(name, flag)) {\n clearInterval(wait);\n _a.debug(`${name} loaded.`);\n resolve(_a.global(name));\n }\n }, 100);\n });\n });\n }\n static addStyles(wrapper, href) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!href) {\n return;\n }\n if (typeof href !== 'string' && href.length) {\n href.forEach(ref => _a.addStyles(wrapper, ref));\n return;\n }\n _a.debug('Adding Styles', href);\n wrapper.appendChild(_a.createElement('link', {\n rel: 'stylesheet',\n href\n }));\n });\n }\n static submitDone(instance, submission) {\n return __awaiter(this, void 0, void 0, function* () {\n _a.debug('Submision Complete', submission);\n const successMessage = (_a.config.success || '').toString();\n if (successMessage && successMessage.toLowerCase() !== 'false' && instance.element) {\n instance.element.innerHTML = `<div class=\"alert-success\" role=\"alert\">${successMessage}</div>`;\n }\n let returnUrl = _a.config.redirect;\n // Allow form based configuration for return url.\n if (!returnUrl &&\n (instance._form &&\n instance._form.settings &&\n (instance._form.settings.returnUrl ||\n instance._form.settings.redirect))) {\n _a.debug('Return url found in form configuration');\n returnUrl = instance._form.settings.returnUrl || instance._form.settings.redirect;\n }\n if (returnUrl) {\n const formSrc = instance.formio ? instance.formio.formUrl : '';\n const hasQuery = !!returnUrl.match(/\\?/);\n const isOrigin = returnUrl.indexOf(location.origin) === 0;\n returnUrl += hasQuery ? '&' : '?';\n returnUrl += `sub=${submission._id}`;\n if (!isOrigin && formSrc) {\n returnUrl += `&form=${encodeURIComponent(formSrc)}`;\n }\n _a.debug('Return URL', returnUrl);\n window.location.href = returnUrl;\n if (isOrigin) {\n window.location.reload();\n }\n }\n });\n }\n // Return the full script if the builder is being used.\n static formioScript(script, builder) {\n builder = builder || _a.config.includeBuilder;\n if (_a.fullAdded || builder) {\n _a.fullAdded = true;\n return script.replace('formio.form', 'formio.full');\n }\n return script;\n }\n static addLibrary(wrapper, lib, name) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!lib) {\n return;\n }\n if (lib.dependencies) {\n for (let i = 0; i < lib.dependencies.length; i++) {\n yield _a.addLibrary(wrapper, _a.cdn.libs[lib.dependencies[i]]);\n }\n }\n if (lib.css) {\n yield _a.addStyles(wrapper, lib.css);\n }\n if (lib.js) {\n const module = yield _a.addScript(wrapper, lib.js, lib.use ? name : false);\n if (lib.use) {\n _a.debug(`Using ${name}`);\n const options = lib.options || {};\n if (!options.license && _a.license) {\n options.license = _a.license;\n }\n _a.use((typeof lib.use === 'function' ? lib.use(module) : module), options);\n }\n }\n });\n }\n static addLoader(wrapper) {\n return __awaiter(this, void 0, void 0, function* () {\n wrapper.appendChild(_a.createElement('div', {\n 'class': 'formio-loader'\n }, [{\n tag: 'div',\n attrs: {\n class: 'loader-wrapper'\n },\n children: [{\n tag: 'div',\n attrs: {\n class: 'loader text-center'\n }\n }]\n }]));\n });\n }\n // eslint-disable-next-line max-statements\n static init(element, options = {}, builder = false) {\n return __awaiter(this, void 0, void 0, function* () {\n _a.cdn = new CDN_js_1.default(_a.config.cdn, _a.config.cdnUrls || {});\n _a.config.libs = _a.config.libs || {\n uswds: {\n dependencies: ['fontawesome'],\n js: `${_a.cdn.uswds}/uswds.min.js`,\n css: `${_a.cdn.uswds}/uswds.min.css`,\n use: true\n },\n fontawesome: {\n css: `${_a.cdn['font-awesome']}/css/font-awesome.min.css`\n },\n bootstrap4: {\n dependencies: ['fontawesome'],\n css: `${_a.cdn.bootstrap4}/css/bootstrap.min.css`\n },\n bootstrap: {\n dependencies: ['bootstrap-icons'],\n css: `${_a.cdn.bootstrap}/css/bootstrap.min.css`\n },\n 'bootstrap-icons': {\n css: `${_a.cdn['bootstrap-icons']}/css/bootstrap-icons.css`\n }\n };\n const id = _a.config.id || `formio-${Math.random().toString(36).substring(7)}`;\n // Create a new wrapper and add the element inside of a new wrapper.\n let wrapper = _a.createElement('div', {\n 'id': `${id}-wrapper`\n });\n element.parentNode.insertBefore(wrapper, element);\n // If we include the libraries, then we will attempt to run this in shadow dom.\n const useShadowDom = _a.config.includeLibs && (typeof wrapper.attachShadow === 'function');\n if (useShadowDom) {\n wrapper = wrapper.attachShadow({\n mode: 'open'\n });\n options.shadowRoot = wrapper;\n }\n element.parentNode.removeChild(element);\n wrapper.appendChild(element);\n // If this is inside of shadow dom, then we need to add the styles and scripts to the shadow dom.\n const libWrapper = useShadowDom ? wrapper : document.body;\n // Load the renderer styles.\n yield _a.addStyles(libWrapper, _a.config.embedCSS || `${_a.cdn.js}/formio.embed.css`);\n // Add a loader.\n _a.addLoader(wrapper);\n const formioSrc = _a.config.full ? 'formio.full' : 'formio.form';\n const renderer = _a.config.debug ? formioSrc : `${formioSrc}.min`;\n _a.FormioClass = yield _a.addScript(libWrapper, _a.formioScript(_a.config.script || `${_a.cdn.js}/${renderer}.js`, builder), 'Formio', builder ? 'isBuilder' : 'isRenderer');\n _a.FormioClass.cdn = _a.cdn;\n _a.FormioClass.setBaseUrl(options.baseUrl || _a.baseUrl || _a.config.base);\n _a.FormioClass.setProjectUrl(options.projectUrl || _a.projectUrl || _a.config.project);\n _a.FormioClass.language = _a.language;\n _a.setLicense(_a.license || _a.config.license || false);\n _a.modules.forEach((module) => {\n _a.FormioClass.use(module);\n });\n if (_a.icons) {\n _a.FormioClass.icons = _a.icons;\n }\n if (_a.pathType) {\n _a.FormioClass.setPathType(_a.pathType);\n }\n // Add libraries if they wish to include the libs.\n if (_a.config.template && _a.config.includeLibs) {\n yield _a.addLibrary(libWrapper, _a.config.libs[_a.config.template], _a.config.template);\n }\n if (!_a.config.libraries) {\n _a.config.libraries = _a.config.modules || {};\n }\n // Adding premium if it is provided via the config.\n if (_a.config.premium) {\n _a.config.libraries.premium = _a.config.premium;\n }\n // Allow adding dynamic modules.\n if (_a.config.libraries) {\n for (const name in _a.config.libraries) {\n const lib = _a.config.libraries[name];\n lib.use = lib.use || true;\n yield _a.addLibrary(libWrapper, lib, name);\n }\n }\n yield _a.addStyles(libWrapper, _a.formioScript(_a.config.style || `${_a.cdn.js}/${renderer}.css`, builder));\n if (_a.config.before) {\n yield _a.config.before(_a.FormioClass, element, _a.config);\n }\n _a.FormioClass.license = true;\n _a._formioReady(_a.FormioClass);\n return wrapper;\n });\n }\n // Called after an instance has been created.\n static afterCreate(instance, wrapper, readyEvent) {\n return __awaiter(this, void 0, void 0, function* () {\n const loader = wrapper.querySelector('.formio-loader');\n if (loader) {\n wrapper.removeChild(loader);\n }\n _a.FormioClass.events.emit(readyEvent, instance);\n if (_a.config.after) {\n _a.debug('Calling ready callback');\n _a.config.after(instance, _a.config);\n }\n return instance;\n });\n }\n // Create a new form.\n static createForm(element, form, options = {}) {\n return __awaiter(this, void 0, void 0, function* () {\n if (_a.FormioClass) {\n return _a.FormioClass.createForm(element, form, Object.assign(Object.assign({}, options), { noLoader: true }));\n }\n const wrapper = yield _a.init(element, options);\n return _a.FormioClass.createForm(element, form, Object.assign(Object.assign({}, options), { noLoader: true })).then((instance) => {\n // Set the default submission data.\n if (_a.config.submission) {\n _a.debug('Setting submission', _a.config.submission);\n instance.submission = _a.config.submission;\n }\n // Call the after create method.\n _a.afterCreate(instance, wrapper, 'formEmbedded');\n return instance;\n });\n });\n }\n // Create a form builder.\n static builder(element, form, options = {}) {\n var _b;\n return __awaiter(this, void 0, void 0, function* () {\n if ((_b = _a.FormioClass) === null || _b === void 0 ? void 0 : _b.builder) {\n return _a.FormioClass.builder(element, form, options);\n }\n const wrapper = yield _a.init(element, options, true);\n return _a.FormioClass.builder(element, form, options).then((instance) => {\n _a.afterCreate(instance, wrapper, 'builderEmbedded');\n return instance;\n });\n });\n }\n}\nexports.Formio = Formio;\n_a = Formio;\nFormio.FormioClass = null;\nFormio.config = {};\nFormio.modules = [];\nFormio.icons = '';\nFormio.license = '';\nFormio.formioReady = new Promise((ready, reject) => {\n _a._formioReady = ready;\n _a._formioReadyReject = reject;\n});\nFormio.version = '5.0.0-rc.56';\n// Create a report.\nFormio.Report = {\n create: (element, submission, options = {}) => __awaiter(void 0, void 0, void 0, function* () {\n var _b;\n if ((_b = _a.FormioClass) === null || _b === void 0 ? void 0 : _b.Report) {\n return _a.FormioClass.Report.create(element, submission, options);\n }\n const wrapper = yield _a.init(element, options, true);\n return _a.FormioClass.Report.create(element, submission, options).then((instance) => {\n _a.afterCreate(instance, wrapper, 'reportEmbedded');\n return instance;\n });\n })\n};\nCDN_js_1.default.defaultCDN = Formio.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';\nclass Form {\n constructor(element, form, options) {\n this.form = form;\n this.element = element;\n this.options = options || {};\n this.init();\n this.instance = {\n proxy: true,\n ready: this.ready,\n destroy: () => { }\n };\n }\n init() {\n if (this.instance && !this.instance.proxy) {\n this.instance.destroy();\n }\n this.element.innerHTML = '';\n this.ready = this.create().then((instance) => {\n this.instance = instance;\n this.form = instance.form;\n return instance;\n });\n }\n create() {\n return Formio.createForm(this.element, this.form, this.options);\n }\n setForm(form) {\n this.form = form;\n if (this.instance) {\n this.instance.setForm(form);\n }\n }\n setDisplay(display) {\n if (this.instance.proxy) {\n return this.ready;\n }\n this.form.display = display;\n this.instance.destroy();\n this.ready = this.create().then((instance) => {\n this.instance = instance;\n this.setForm(this.form);\n });\n return this.ready;\n }\n}\nexports.Form = Form;\nclass FormBuilder extends Form {\n create() {\n return Formio.builder(this.element, this.form, this.options);\n }\n}\nexports.FormBuilder = FormBuilder;\nFormio.Form = Form;\nFormio.FormBuilder = FormBuilder;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/Embed.js?");
|
8737
|
+
eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nvar _a;\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.FormBuilder = exports.Form = exports.Formio = void 0;\nconst CDN_js_1 = __importDefault(__webpack_require__(/*! ./CDN.js */ \"./lib/cjs/CDN.js\"));\nclass Formio {\n static setLicense(license, norecurse = false) {\n _a.license = license;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setLicense(license);\n }\n }\n static setBaseUrl(url, norecurse = false) {\n _a.baseUrl = url;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setBaseUrl(url);\n }\n }\n static setApiUrl(url, norecurse = false) {\n _a.baseUrl = url;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setApiUrl(url);\n }\n }\n static setProjectUrl(url, norecurse = false) {\n _a.projectUrl = url;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setProjectUrl(url);\n }\n }\n static setAppUrl(url, norecurse = false) {\n _a.projectUrl = url;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setAppUrl(url);\n }\n }\n static setPathType(type, norecurse = false) {\n _a.pathType = type;\n if (!norecurse && _a.FormioClass) {\n _a.FormioClass.setPathType(type);\n }\n }\n static debug(...args) {\n if (_a.config.debug) {\n console.log(...args);\n }\n }\n static clearCache() {\n if (_a.FormioClass) {\n _a.FormioClass.clearCache();\n }\n }\n static global(prop, flag = '') {\n const globalValue = window[prop];\n if (flag && globalValue && !globalValue[flag]) {\n return null;\n }\n _a.debug(`Getting global ${prop}`, globalValue);\n return globalValue;\n }\n static use(module) {\n if (_a.FormioClass && _a.FormioClass.isRenderer) {\n _a.FormioClass.use(module);\n }\n else {\n _a.modules.push(module);\n }\n }\n static createElement(type, attrs, children) {\n const element = document.createElement(type);\n Object.keys(attrs).forEach(key => {\n element.setAttribute(key, attrs[key]);\n });\n (children || []).forEach(child => {\n element.appendChild(_a.createElement(child.tag, child.attrs, child.children));\n });\n return element;\n }\n static addScript(wrapper, src, name, flag = '') {\n return __awaiter(this, void 0, void 0, function* () {\n if (!src) {\n return Promise.resolve();\n }\n if (typeof src !== 'string' && src.length) {\n return Promise.all(src.map(ref => _a.addScript(wrapper, ref)));\n }\n if (name && _a.global(name, flag)) {\n _a.debug(`${name} already loaded.`);\n return Promise.resolve(_a.global(name));\n }\n _a.debug('Adding Script', src);\n try {\n wrapper.appendChild(_a.createElement('script', {\n src\n }));\n }\n catch (err) {\n _a.debug(err);\n return Promise.resolve();\n }\n if (!name) {\n return Promise.resolve();\n }\n return new Promise((resolve) => {\n _a.debug(`Waiting to load ${name}`);\n const wait = setInterval(() => {\n if (_a.global(name, flag)) {\n clearInterval(wait);\n _a.debug(`${name} loaded.`);\n resolve(_a.global(name));\n }\n }, 100);\n });\n });\n }\n static addStyles(wrapper, href) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!href) {\n return;\n }\n if (typeof href !== 'string' && href.length) {\n href.forEach(ref => _a.addStyles(wrapper, ref));\n return;\n }\n _a.debug('Adding Styles', href);\n wrapper.appendChild(_a.createElement('link', {\n rel: 'stylesheet',\n href\n }));\n });\n }\n static submitDone(instance, submission) {\n return __awaiter(this, void 0, void 0, function* () {\n _a.debug('Submision Complete', submission);\n if (_a.config.submitDone) {\n _a.config.submitDone(submission, instance);\n }\n const successMessage = (_a.config.success || '').toString();\n if (successMessage && successMessage.toLowerCase() !== 'false' && instance.element) {\n instance.element.innerHTML = `<div class=\"alert-success\" role=\"alert\">${successMessage}</div>`;\n }\n let returnUrl = _a.config.redirect;\n // Allow form based configuration for return url.\n if (!returnUrl &&\n (instance._form &&\n instance._form.settings &&\n (instance._form.settings.returnUrl ||\n instance._form.settings.redirect))) {\n _a.debug('Return url found in form configuration');\n returnUrl = instance._form.settings.returnUrl || instance._form.settings.redirect;\n }\n if (returnUrl) {\n const formSrc = instance.formio ? instance.formio.formUrl : '';\n const hasQuery = !!returnUrl.match(/\\?/);\n const isOrigin = returnUrl.indexOf(location.origin) === 0;\n returnUrl += hasQuery ? '&' : '?';\n returnUrl += `sub=${submission._id}`;\n if (!isOrigin && formSrc) {\n returnUrl += `&form=${encodeURIComponent(formSrc)}`;\n }\n _a.debug('Return URL', returnUrl);\n window.location.href = returnUrl;\n if (isOrigin) {\n window.location.reload();\n }\n }\n });\n }\n // Return the full script if the builder is being used.\n static formioScript(script, builder) {\n builder = builder || _a.config.includeBuilder;\n if (_a.fullAdded || builder) {\n _a.fullAdded = true;\n return script.replace('formio.form', 'formio.full');\n }\n return script;\n }\n static addLibrary(wrapper, lib, name) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!lib) {\n return;\n }\n if (lib.dependencies) {\n for (let i = 0; i < lib.dependencies.length; i++) {\n yield _a.addLibrary(wrapper, _a.cdn.libs[lib.dependencies[i]]);\n }\n }\n if (lib.css) {\n yield _a.addStyles(wrapper, lib.css);\n }\n if (lib.js) {\n const module = yield _a.addScript(wrapper, lib.js, lib.use ? name : false);\n if (lib.use) {\n _a.debug(`Using ${name}`);\n const options = lib.options || {};\n if (!options.license && _a.license) {\n options.license = _a.license;\n }\n _a.use((typeof lib.use === 'function' ? lib.use(module) : module), options);\n }\n }\n });\n }\n static addLoader(wrapper) {\n return __awaiter(this, void 0, void 0, function* () {\n wrapper.appendChild(_a.createElement('div', {\n 'class': 'formio-loader'\n }, [{\n tag: 'div',\n attrs: {\n class: 'loader-wrapper'\n },\n children: [{\n tag: 'div',\n attrs: {\n class: 'loader text-center'\n }\n }]\n }]));\n });\n }\n // eslint-disable-next-line max-statements\n static init(element, options = {}, builder = false) {\n return __awaiter(this, void 0, void 0, function* () {\n _a.cdn = new CDN_js_1.default(_a.config.cdn, _a.config.cdnUrls || {});\n _a.config.libs = _a.config.libs || {\n uswds: {\n dependencies: ['fontawesome'],\n js: `${_a.cdn.uswds}/uswds.min.js`,\n css: `${_a.cdn.uswds}/uswds.min.css`,\n use: true\n },\n fontawesome: {\n css: `${_a.cdn['font-awesome']}/css/font-awesome.min.css`\n },\n bootstrap4: {\n dependencies: ['fontawesome'],\n css: `${_a.cdn.bootstrap4}/css/bootstrap.min.css`\n },\n bootstrap: {\n dependencies: ['bootstrap-icons'],\n css: `${_a.cdn.bootstrap}/css/bootstrap.min.css`\n },\n 'bootstrap-icons': {\n css: `${_a.cdn['bootstrap-icons']}/css/bootstrap-icons.css`\n }\n };\n const id = _a.config.id || `formio-${Math.random().toString(36).substring(7)}`;\n // Create a new wrapper and add the element inside of a new wrapper.\n let wrapper = _a.createElement('div', {\n 'id': `${id}-wrapper`\n });\n element.parentNode.insertBefore(wrapper, element);\n // If we include the libraries, then we will attempt to run this in shadow dom.\n const useShadowDom = _a.config.includeLibs && (typeof wrapper.attachShadow === 'function');\n if (useShadowDom) {\n wrapper = wrapper.attachShadow({\n mode: 'open'\n });\n options.shadowRoot = wrapper;\n }\n element.parentNode.removeChild(element);\n wrapper.appendChild(element);\n // If this is inside of shadow dom, then we need to add the styles and scripts to the shadow dom.\n const libWrapper = useShadowDom ? wrapper : document.body;\n // Load the renderer styles.\n yield _a.addStyles(libWrapper, _a.config.embedCSS || `${_a.cdn.js}/formio.embed.css`);\n // Add a loader.\n _a.addLoader(wrapper);\n const formioSrc = _a.config.full ? 'formio.full' : 'formio.form';\n const renderer = _a.config.debug ? formioSrc : `${formioSrc}.min`;\n _a.FormioClass = yield _a.addScript(libWrapper, _a.formioScript(_a.config.script || `${_a.cdn.js}/${renderer}.js`, builder), 'Formio', builder ? 'isBuilder' : 'isRenderer');\n _a.FormioClass.cdn = _a.cdn;\n _a.FormioClass.setBaseUrl(options.baseUrl || _a.baseUrl || _a.config.base);\n _a.FormioClass.setProjectUrl(options.projectUrl || _a.projectUrl || _a.config.project);\n _a.FormioClass.language = _a.language;\n _a.setLicense(_a.license || _a.config.license || false);\n _a.modules.forEach((module) => {\n _a.FormioClass.use(module);\n });\n if (_a.icons) {\n _a.FormioClass.icons = _a.icons;\n }\n if (_a.pathType) {\n _a.FormioClass.setPathType(_a.pathType);\n }\n // Add libraries if they wish to include the libs.\n if (_a.config.template && _a.config.includeLibs) {\n yield _a.addLibrary(libWrapper, _a.config.libs[_a.config.template], _a.config.template);\n }\n if (!_a.config.libraries) {\n _a.config.libraries = _a.config.modules || {};\n }\n // Adding premium if it is provided via the config.\n if (_a.config.premium) {\n _a.config.libraries.premium = _a.config.premium;\n }\n // Allow adding dynamic modules.\n if (_a.config.libraries) {\n for (const name in _a.config.libraries) {\n const lib = _a.config.libraries[name];\n lib.use = lib.use || true;\n yield _a.addLibrary(libWrapper, lib, name);\n }\n }\n yield _a.addStyles(libWrapper, _a.formioScript(_a.config.style || `${_a.cdn.js}/${renderer}.css`, builder));\n if (_a.config.before) {\n yield _a.config.before(_a.FormioClass, element, _a.config);\n }\n _a.FormioClass.license = true;\n _a._formioReady(_a.FormioClass);\n return wrapper;\n });\n }\n // Called after an instance has been created.\n static afterCreate(instance, wrapper, readyEvent) {\n return __awaiter(this, void 0, void 0, function* () {\n const loader = wrapper.querySelector('.formio-loader');\n if (loader) {\n wrapper.removeChild(loader);\n }\n _a.FormioClass.events.emit(readyEvent, instance);\n if (_a.config.after) {\n _a.debug('Calling ready callback');\n _a.config.after(instance, _a.config);\n }\n return instance;\n });\n }\n // Create a new form.\n static createForm(element, form, options = {}) {\n return __awaiter(this, void 0, void 0, function* () {\n if (_a.FormioClass) {\n return _a.FormioClass.createForm(element, form, Object.assign(Object.assign({}, options), { noLoader: true }));\n }\n const wrapper = yield _a.init(element, options);\n return _a.FormioClass.createForm(element, form, Object.assign(Object.assign({}, options), { noLoader: true })).then((instance) => {\n // Set the default submission data.\n if (_a.config.submission) {\n _a.debug('Setting submission', _a.config.submission);\n instance.submission = _a.config.submission;\n }\n // Call the after create method.\n _a.afterCreate(instance, wrapper, 'formEmbedded');\n return instance;\n });\n });\n }\n // Create a form builder.\n static builder(element, form, options = {}) {\n var _b;\n return __awaiter(this, void 0, void 0, function* () {\n if ((_b = _a.FormioClass) === null || _b === void 0 ? void 0 : _b.builder) {\n return _a.FormioClass.builder(element, form, options);\n }\n const wrapper = yield _a.init(element, options, true);\n return _a.FormioClass.builder(element, form, options).then((instance) => {\n _a.afterCreate(instance, wrapper, 'builderEmbedded');\n return instance;\n });\n });\n }\n}\nexports.Formio = Formio;\n_a = Formio;\nFormio.FormioClass = null;\nFormio.config = {};\nFormio.modules = [];\nFormio.icons = '';\nFormio.license = '';\nFormio.formioReady = new Promise((ready, reject) => {\n _a._formioReady = ready;\n _a._formioReadyReject = reject;\n});\nFormio.version = '5.0.0-rc.57';\n// Create a report.\nFormio.Report = {\n create: (element, submission, options = {}) => __awaiter(void 0, void 0, void 0, function* () {\n var _b;\n if ((_b = _a.FormioClass) === null || _b === void 0 ? void 0 : _b.Report) {\n return _a.FormioClass.Report.create(element, submission, options);\n }\n const wrapper = yield _a.init(element, options, true);\n return _a.FormioClass.Report.create(element, submission, options).then((instance) => {\n _a.afterCreate(instance, wrapper, 'reportEmbedded');\n return instance;\n });\n })\n};\nCDN_js_1.default.defaultCDN = Formio.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';\nclass Form {\n constructor(element, form, options) {\n this.form = form;\n this.element = element;\n this.options = options || {};\n this.init();\n this.instance = {\n proxy: true,\n ready: this.ready,\n destroy: () => { }\n };\n }\n init() {\n if (this.instance && !this.instance.proxy) {\n this.instance.destroy();\n }\n this.element.innerHTML = '';\n this.ready = this.create().then((instance) => {\n this.instance = instance;\n this.form = instance.form;\n return instance;\n });\n }\n create() {\n return Formio.createForm(this.element, this.form, this.options);\n }\n setForm(form) {\n this.form = form;\n if (this.instance) {\n this.instance.setForm(form);\n }\n }\n setDisplay(display) {\n if (this.instance.proxy) {\n return this.ready;\n }\n this.form.display = display;\n this.instance.destroy();\n this.ready = this.create().then((instance) => {\n this.instance = instance;\n this.setForm(this.form);\n });\n return this.ready;\n }\n}\nexports.Form = Form;\nclass FormBuilder extends Form {\n create() {\n return Formio.builder(this.element, this.form, this.options);\n }\n}\nexports.FormBuilder = FormBuilder;\nFormio.Form = Form;\nFormio.FormBuilder = FormBuilder;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/Embed.js?");
|
8738
8738
|
|
8739
8739
|
/***/ }),
|
8740
8740
|
|
@@ -8745,7 +8745,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
8745
8745
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
8746
8746
|
|
8747
8747
|
"use strict";
|
8748
|
-
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Formio = void 0;\nconst sdk_1 = __webpack_require__(/*! @formio/core/sdk */ \"./node_modules/@formio/core/lib/sdk/index.js\");\nObject.defineProperty(exports, \"Formio\", ({ enumerable: true, get: function () { return sdk_1.Formio; } }));\nconst Embed_1 = __webpack_require__(/*! ./Embed */ \"./lib/cjs/Embed.js\");\nconst CDN_1 = __importDefault(__webpack_require__(/*! ./CDN */ \"./lib/cjs/CDN.js\"));\nconst providers_1 = __importDefault(__webpack_require__(/*! ./providers */ \"./lib/cjs/providers/index.js\"));\nsdk_1.Formio.cdn = new CDN_1.default();\nsdk_1.Formio.Providers = providers_1.default;\nsdk_1.Formio.version = '5.0.0-rc.
|
8748
|
+
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Formio = void 0;\nconst sdk_1 = __webpack_require__(/*! @formio/core/sdk */ \"./node_modules/@formio/core/lib/sdk/index.js\");\nObject.defineProperty(exports, \"Formio\", ({ enumerable: true, get: function () { return sdk_1.Formio; } }));\nconst Embed_1 = __webpack_require__(/*! ./Embed */ \"./lib/cjs/Embed.js\");\nconst CDN_1 = __importDefault(__webpack_require__(/*! ./CDN */ \"./lib/cjs/CDN.js\"));\nconst providers_1 = __importDefault(__webpack_require__(/*! ./providers */ \"./lib/cjs/providers/index.js\"));\nsdk_1.Formio.cdn = new CDN_1.default();\nsdk_1.Formio.Providers = providers_1.default;\nsdk_1.Formio.version = '5.0.0-rc.57';\nCDN_1.default.defaultCDN = sdk_1.Formio.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';\nconst isNil = (val) => val === null || val === undefined;\nsdk_1.Formio.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {\n const requestArgs = {\n provider: storage,\n method: 'upload',\n file: file,\n fileName: fileName,\n dir: dir\n };\n fileKey = fileKey || 'file';\n const request = sdk_1.Formio.pluginWait('preRequest', requestArgs)\n .then(() => {\n return sdk_1.Formio.pluginGet('fileRequest', requestArgs)\n .then((result) => {\n if (storage && isNil(result)) {\n const Provider = providers_1.default.getProvider('storage', storage);\n if (Provider) {\n const provider = new Provider(this);\n if (uploadStartCallback) {\n uploadStartCallback();\n }\n return provider.uploadFile(file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, abortCallback, multipartOptions);\n }\n else {\n throw ('Storage provider not found');\n }\n }\n return result || { url: '' };\n });\n });\n return sdk_1.Formio.pluginAlter('wrapFileRequestPromise', request, requestArgs);\n};\nsdk_1.Formio.prototype.downloadFile = function (file, options) {\n const requestArgs = {\n method: 'download',\n file: file\n };\n const request = sdk_1.Formio.pluginWait('preRequest', requestArgs)\n .then(() => {\n return sdk_1.Formio.pluginGet('fileRequest', requestArgs)\n .then((result) => {\n if (file.storage && isNil(result)) {\n const Provider = providers_1.default.getProvider('storage', file.storage);\n if (Provider) {\n const provider = new Provider(this);\n return provider.downloadFile(file, options);\n }\n else {\n throw ('Storage provider not found');\n }\n }\n return result || { url: '' };\n });\n });\n return sdk_1.Formio.pluginAlter('wrapFileRequestPromise', request, requestArgs);\n};\nsdk_1.Formio.prototype.deleteFile = function (file, options) {\n const requestArgs = {\n method: 'delete',\n file: file\n };\n const request = sdk_1.Formio.pluginWait('preRequest', requestArgs)\n .then(() => {\n return sdk_1.Formio.pluginGet('fileRequest', requestArgs)\n .then((result) => {\n if (file.storage && isNil(result)) {\n const Provider = providers_1.default.getProvider('storage', file.storage);\n if (Provider) {\n const provider = new Provider(this);\n return provider.deleteFile(file, options);\n }\n else {\n throw ('Storage provider not found');\n }\n }\n return result || { url: '' };\n });\n });\n return sdk_1.Formio.pluginAlter('wrapFileRequestPromise', request, requestArgs);\n};\n// Esnure we proxy the following methods to the FormioEmbed class.\n['setBaseUrl', 'setApiUrl', 'setAppUrl', 'setProjectUrl', 'setPathType', 'setLicense'].forEach((fn) => {\n const baseFn = sdk_1.Formio[fn];\n sdk_1.Formio[fn] = function (arg) {\n const retVal = Embed_1.Formio[fn](arg, true);\n return baseFn ? baseFn.call(this, arg) : retVal;\n };\n});\n// For reverse compatability.\nsdk_1.Formio.Promise = Promise;\nsdk_1.Formio.formioReady = Embed_1.Formio.formioReady;\nsdk_1.Formio.config = Embed_1.Formio.config;\nsdk_1.Formio.builder = Embed_1.Formio.builder;\nsdk_1.Formio.Report = Embed_1.Formio.Report;\nsdk_1.Formio.Form = Embed_1.Formio.Form;\nsdk_1.Formio.FormBuilder = Embed_1.Formio.FormBuilder;\nsdk_1.Formio.use = Embed_1.Formio.use;\nsdk_1.Formio.createForm = Embed_1.Formio.createForm;\nsdk_1.Formio.submitDone = Embed_1.Formio.submitDone;\nsdk_1.Formio.addLibrary = Embed_1.Formio.addLibrary;\nsdk_1.Formio.addLoader = Embed_1.Formio.addLoader;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/Formio.js?");
|
8749
8749
|
|
8750
8750
|
/***/ }),
|
8751
8751
|
|