@formio/js 5.0.0-rc.51 → 5.0.0-rc.53
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 +561 -721
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +3 -49
- package/dist/formio.full.js +563 -693
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +3 -49
- package/dist/formio.js +11 -11
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +34 -194
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +11 -49
- package/lib/cjs/Form.d.ts +281 -10
- package/lib/cjs/Form.js +22 -35
- package/lib/cjs/FormBuilder.d.ts +187 -2
- package/lib/cjs/FormBuilder.js +29 -6
- package/lib/cjs/PDF.d.ts +0 -1
- package/lib/cjs/Webform.d.ts +6 -6
- package/lib/cjs/Webform.js +2 -2
- package/lib/cjs/Wizard.d.ts +1 -1
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +8 -6
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +6 -4
- package/lib/cjs/components/_classes/field/Field.d.ts +11 -2
- package/lib/cjs/components/_classes/field/Field.js +13 -1
- package/lib/cjs/components/_classes/input/Input.d.ts +4 -3
- package/lib/cjs/components/_classes/input/Input.js +2 -2
- package/lib/cjs/components/_classes/list/ListComponent.form.d.ts +4 -5
- package/lib/cjs/components/_classes/list/ListComponent.form.js +3 -2
- package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +42 -11
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +37 -3
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +127 -33
- package/lib/cjs/components/_classes/nested/NestedComponent.js +133 -15
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +6 -0
- package/lib/cjs/components/address/Address.d.ts +2 -1
- package/lib/cjs/components/button/Button.d.ts +1 -1
- package/lib/cjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/cjs/components/columns/Columns.d.ts +1 -1
- package/lib/cjs/components/container/Container.d.ts +1 -0
- package/lib/cjs/components/datagrid/DataGrid.d.ts +1 -1
- package/lib/cjs/components/day/Day.d.ts +1 -1
- package/lib/cjs/components/editgrid/EditGrid.d.ts +2 -0
- package/lib/cjs/components/file/File.d.ts +2 -2
- package/lib/cjs/components/number/Number.d.ts +1 -1
- package/lib/cjs/components/radio/Radio.d.ts +1 -1
- package/lib/cjs/components/radio/Radio.form.d.ts +1 -3
- package/lib/cjs/components/radio/Radio.js +3 -3
- package/lib/cjs/components/select/Select.d.ts +9 -14
- package/lib/cjs/components/select/Select.form.d.ts +1 -3
- package/lib/cjs/components/select/Select.js +11 -15
- package/lib/cjs/components/selectboxes/SelectBoxes.form.d.ts +1 -3
- package/lib/cjs/components/survey/Survey.d.ts +1 -1
- package/lib/cjs/components/table/Table.d.ts +1 -1
- package/lib/cjs/components/tabs/Tabs.d.ts +1 -1
- package/lib/cjs/components/textfield/TextField.d.ts +1 -1
- package/lib/cjs/providers/address/NominatimAddressProvider.d.ts +1 -1
- package/lib/cjs/providers/address/NominatimAddressProvider.js +5 -1
- package/lib/cjs/providers/processor/fileProcessor.d.ts +7 -1
- package/lib/cjs/providers/processor/fileProcessor.js +6 -0
- package/lib/cjs/providers/storage/azure.d.ts +4 -15
- package/lib/cjs/providers/storage/azure.js +3 -2
- package/lib/cjs/providers/storage/base64.d.ts +3 -7
- package/lib/cjs/providers/storage/base64.js +2 -1
- package/lib/cjs/providers/storage/dropbox.d.ts +4 -6
- package/lib/cjs/providers/storage/dropbox.js +3 -2
- package/lib/cjs/providers/storage/googleDrive.d.ts +4 -6
- package/lib/cjs/providers/storage/googleDrive.js +3 -1
- package/lib/cjs/providers/storage/indexeddb.d.ts +3 -8
- package/lib/cjs/providers/storage/indexeddb.js +2 -1
- package/lib/cjs/providers/storage/s3.d.ts +4 -22
- package/lib/cjs/providers/storage/s3.js +3 -2
- package/lib/cjs/providers/storage/url.d.ts +3 -8
- package/lib/cjs/providers/storage/url.js +4 -3
- package/lib/cjs/providers/storage/util.d.ts +22 -6
- package/lib/cjs/providers/storage/util.js +16 -5
- package/lib/cjs/utils/builder.d.ts +9 -7
- package/lib/cjs/utils/builder.js +10 -5
- package/lib/cjs/utils/calendarUtils.d.ts +6 -10
- package/lib/cjs/utils/calendarUtils.js +7 -11
- package/lib/cjs/utils/formUtils.d.ts +4 -4
- package/lib/cjs/utils/formUtils.js +3 -3
- package/lib/cjs/utils/utils.d.ts +123 -121
- package/lib/cjs/utils/utils.js +99 -94
- package/lib/mjs/Form.d.ts +281 -10
- package/lib/mjs/Form.js +112 -28
- package/lib/mjs/FormBuilder.d.ts +187 -2
- package/lib/mjs/FormBuilder.js +31 -6
- package/lib/mjs/PDF.d.ts +0 -1
- package/lib/mjs/Webform.d.ts +6 -6
- package/lib/mjs/Webform.js +3 -3
- package/lib/mjs/Wizard.d.ts +1 -1
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +8 -6
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +6 -4
- package/lib/mjs/components/_classes/field/Field.d.ts +11 -2
- package/lib/mjs/components/_classes/field/Field.js +13 -1
- package/lib/mjs/components/_classes/input/Input.d.ts +4 -3
- package/lib/mjs/components/_classes/input/Input.js +2 -2
- package/lib/mjs/components/_classes/list/ListComponent.form.d.ts +4 -5
- package/lib/mjs/components/_classes/list/ListComponent.form.js +3 -2
- package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +42 -11
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +37 -3
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +127 -33
- package/lib/mjs/components/_classes/nested/NestedComponent.js +133 -15
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +6 -0
- package/lib/mjs/components/address/Address.d.ts +2 -1
- package/lib/mjs/components/button/Button.d.ts +1 -1
- package/lib/mjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/mjs/components/columns/Columns.d.ts +1 -1
- package/lib/mjs/components/container/Container.d.ts +1 -0
- package/lib/mjs/components/datagrid/DataGrid.d.ts +1 -1
- package/lib/mjs/components/day/Day.d.ts +1 -1
- package/lib/mjs/components/editgrid/EditGrid.d.ts +2 -0
- package/lib/mjs/components/file/File.d.ts +2 -2
- package/lib/mjs/components/number/Number.d.ts +1 -1
- package/lib/mjs/components/radio/Radio.d.ts +1 -1
- package/lib/mjs/components/radio/Radio.form.d.ts +1 -3
- package/lib/mjs/components/radio/Radio.js +3 -3
- package/lib/mjs/components/select/Select.d.ts +9 -14
- package/lib/mjs/components/select/Select.form.d.ts +1 -3
- package/lib/mjs/components/select/Select.js +11 -15
- package/lib/mjs/components/selectboxes/SelectBoxes.form.d.ts +1 -3
- package/lib/mjs/components/survey/Survey.d.ts +1 -1
- package/lib/mjs/components/table/Table.d.ts +1 -1
- package/lib/mjs/components/tabs/Tabs.d.ts +1 -1
- package/lib/mjs/components/textfield/TextField.d.ts +1 -1
- package/lib/mjs/providers/address/NominatimAddressProvider.d.ts +1 -1
- package/lib/mjs/providers/address/NominatimAddressProvider.js +5 -1
- package/lib/mjs/providers/processor/fileProcessor.d.ts +7 -1
- package/lib/mjs/providers/processor/fileProcessor.js +6 -0
- package/lib/mjs/providers/storage/azure.d.ts +4 -15
- package/lib/mjs/providers/storage/azure.js +3 -2
- package/lib/mjs/providers/storage/base64.d.ts +3 -7
- package/lib/mjs/providers/storage/base64.js +2 -1
- package/lib/mjs/providers/storage/dropbox.d.ts +4 -6
- package/lib/mjs/providers/storage/dropbox.js +3 -2
- package/lib/mjs/providers/storage/googleDrive.d.ts +4 -6
- package/lib/mjs/providers/storage/googleDrive.js +3 -1
- package/lib/mjs/providers/storage/indexeddb.d.ts +3 -8
- package/lib/mjs/providers/storage/indexeddb.js +2 -1
- package/lib/mjs/providers/storage/s3.d.ts +4 -22
- package/lib/mjs/providers/storage/s3.js +3 -2
- package/lib/mjs/providers/storage/url.d.ts +3 -8
- package/lib/mjs/providers/storage/url.js +4 -3
- package/lib/mjs/providers/storage/util.d.ts +22 -6
- package/lib/mjs/providers/storage/util.js +16 -5
- package/lib/mjs/utils/builder.d.ts +9 -7
- package/lib/mjs/utils/builder.js +10 -5
- package/lib/mjs/utils/calendarUtils.d.ts +6 -10
- package/lib/mjs/utils/calendarUtils.js +7 -11
- package/lib/mjs/utils/formUtils.d.ts +4 -4
- package/lib/mjs/utils/formUtils.js +3 -3
- package/lib/mjs/utils/utils.d.ts +123 -121
- package/lib/mjs/utils/utils.js +99 -94
- package/package.json +11 -11
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 t{constructor(e,o={}){this.baseUrl=e||t.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,t){let i=e;return o&&(i+=`/${o}`),t&&"latest"!==t&&(i+=`/${t}`),i}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])}}t.defaultCDN="https://cdn.form.io",o.default=t},95413:function(e,o,t){var i,s=this&&this.__awaiter||function(e,o,t,i){return new(t||(t=Promise))((function(s,r){function n(e){try{a(i.next(e))}catch(e){r(e)}}function c(e){try{a(i.throw(e))}catch(e){r(e)}}function a(e){var o;e.done?s(e.value):(o=e.value,o instanceof t?o:new t((function(e){e(o)}))).then(n,c)}a((i=i.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(t(56036));class c{static setLicense(e,o=!1){i.license=e,!o&&i.FormioClass&&i.FormioClass.setLicense(e)}static setBaseUrl(e,o=!1){i.baseUrl=e,!o&&i.FormioClass&&i.FormioClass.setBaseUrl(e)}static setApiUrl(e,o=!1){i.baseUrl=e,!o&&i.FormioClass&&i.FormioClass.setApiUrl(e)}static setProjectUrl(e,o=!1){i.projectUrl=e,!o&&i.FormioClass&&i.FormioClass.setProjectUrl(e)}static setAppUrl(e,o=!1){i.projectUrl=e,!o&&i.FormioClass&&i.FormioClass.setAppUrl(e)}static setPathType(e,o=!1){i.pathType=e,!o&&i.FormioClass&&i.FormioClass.setPathType(e)}static debug(...e){i.config.debug&&console.log(...e)}static clearCache(){i.FormioClass&&i.FormioClass.clearCache()}static global(e,o=""){const t=window[e];return o&&t&&!t[o]?null:(i.debug(`Getting global ${e}`,t),t)}static use(e){i.FormioClass&&i.FormioClass.isRenderer?i.FormioClass.use(e):i.modules.push(e)}static createElement(e,o,t){const s=document.createElement(e);return Object.keys(o).forEach((e=>{s.setAttribute(e,o[e])})),(t||[]).forEach((e=>{s.appendChild(i.createElement(e.tag,e.attrs,e.children))})),s}static addScript(e,o,t,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=>i.addScript(e,o))));if(t&&i.global(t,r))return i.debug(`${t} already loaded.`),Promise.resolve(i.global(t));i.debug("Adding Script",o);try{e.appendChild(i.createElement("script",{src:o}))}catch(e){return i.debug(e),Promise.resolve()}return t?new Promise((e=>{i.debug(`Waiting to load ${t}`);const o=setInterval((()=>{i.global(t,r)&&(clearInterval(o),i.debug(`${t} loaded.`),e(i.global(t)))}),100)})):Promise.resolve()}))}static addStyles(e,o){return s(this,void 0,void 0,(function*(){o&&("string"!=typeof o&&o.length?o.forEach((o=>i.addStyles(e,o))):(i.debug("Adding Styles",o),e.appendChild(i.createElement("link",{rel:"stylesheet",href:o}))))}))}static submitDone(e,o){return s(this,void 0,void 0,(function*(){i.debug("Submision Complete",o);const t=(i.config.success||"").toString();t&&"false"!==t.toLowerCase()&&e.element&&(e.element.innerHTML=`<div class="alert-success" role="alert">${t}</div>`);let s=i.config.redirect;if(!s&&e._form&&e._form.settings&&(e._form.settings.returnUrl||e._form.settings.redirect)&&(i.debug("Return url found in form configuration"),s=e._form.settings.returnUrl||e._form.settings.redirect),s){const t=e.formio?e.formio.formUrl:"",r=!!s.match(/\?/),n=0===s.indexOf(location.origin);s+=r?"&":"?",s+=`sub=${o._id}`,!n&&t&&(s+=`&form=${encodeURIComponent(t)}`),i.debug("Return URL",s),window.location.href=s,n&&window.location.reload()}}))}static formioScript(e,o){return o=o||i.config.includeBuilder,i.fullAdded||o?(i.fullAdded=!0,e.replace("formio.form","formio.full")):e}static addLibrary(e,o,t){return s(this,void 0,void 0,(function*(){if(o){if(o.dependencies)for(let t=0;t<o.dependencies.length;t++)yield i.addLibrary(e,i.cdn.libs[o.dependencies[t]]);if(o.css&&(yield i.addStyles(e,o.css)),o.js){const s=yield i.addScript(e,o.js,!!o.use&&t);if(o.use){i.debug(`Using ${t}`);const e=o.options||{};!e.license&&i.license&&(e.license=i.license),i.use("function"==typeof o.use?o.use(s):s,e)}}}}))}static addLoader(e){return s(this,void 0,void 0,(function*(){e.appendChild(i.createElement("div",{class:"formio-loader"},[{tag:"div",attrs:{class:"loader-wrapper"},children:[{tag:"div",attrs:{class:"loader text-center"}}]}]))}))}static init(e,o={},t=!1){return s(this,void 0,void 0,(function*(){i.cdn=new n.default(i.config.cdn,i.config.cdnUrls||{}),i.config.libs=i.config.libs||{uswds:{dependencies:["fontawesome"],js:`${i.cdn.uswds}/uswds.min.js`,css:`${i.cdn.uswds}/uswds.min.css`,use:!0},fontawesome:{css:`${i.cdn["font-awesome"]}/css/font-awesome.min.css`},bootstrap4:{dependencies:["fontawesome"],css:`${i.cdn.bootstrap4}/css/bootstrap.min.css`},bootstrap:{dependencies:["bootstrap-icons"],css:`${i.cdn.bootstrap}/css/bootstrap.min.css`},"bootstrap-icons":{css:`${i.cdn["bootstrap-icons"]}/css/bootstrap-icons.css`}};const s=i.config.id||`formio-${Math.random().toString(36).substring(7)}`;let r=i.createElement("div",{id:`${s}-wrapper`});e.parentNode.insertBefore(r,e);const c=i.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 i.addStyles(a,i.config.embedCSS||`${i.cdn.js}/formio.embed.css`),i.addLoader(r);const d=i.config.full?"formio.full":"formio.form",l=i.config.debug?d:`${d}.min`;if(i.FormioClass=yield i.addScript(a,i.formioScript(i.config.script||`${i.cdn.js}/${l}.js`,t),"Formio",t?"isBuilder":"isRenderer"),i.FormioClass.cdn=i.cdn,i.FormioClass.setBaseUrl(o.baseUrl||i.baseUrl||i.config.base),i.FormioClass.setProjectUrl(o.projectUrl||i.projectUrl||i.config.project),i.FormioClass.language=i.language,i.setLicense(i.license||i.config.license||!1),i.modules.forEach((e=>{i.FormioClass.use(e)})),i.icons&&(i.FormioClass.icons=i.icons),i.pathType&&i.FormioClass.setPathType(i.pathType),i.config.template&&i.config.includeLibs&&(yield i.addLibrary(a,i.config.libs[i.config.template],i.config.template)),i.config.premium&&(i.config.modules.premium=i.config.premium),i.config.modules)for(const e in i.config.modules){const o=i.config.modules[e];o.use=o.use||!0,yield i.addLibrary(a,o,e)}return yield i.addStyles(a,i.formioScript(i.config.style||`${i.cdn.js}/${l}.css`,t)),i.config.before&&(yield i.config.before(i.FormioClass,e,i.config)),i.FormioClass.license=!0,i._formioReady(i.FormioClass),r}))}static afterCreate(e,o,t){return s(this,void 0,void 0,(function*(){const s=o.querySelector(".formio-loader");return s&&o.removeChild(s),i.FormioClass.events.emit(t,e),i.config.after&&(i.debug("Calling ready callback"),i.config.after(e,i.config)),e}))}static createForm(e,o,t={}){return s(this,void 0,void 0,(function*(){if(i.FormioClass)return i.FormioClass.createForm(e,o,Object.assign(Object.assign({},t),{noLoader:!0}));const s=yield i.init(e,t);return i.FormioClass.createForm(e,o,Object.assign(Object.assign({},t),{noLoader:!0})).then((e=>(i.config.submission&&(i.debug("Setting submission",i.config.submission),e.submission=i.config.submission),i.afterCreate(e,s,"formEmbedded"),e)))}))}static builder(e,o,t={}){var r;return s(this,void 0,void 0,(function*(){if(null===(r=i.FormioClass)||void 0===r?void 0:r.builder)return i.FormioClass.builder(e,o,t);const s=yield i.init(e,t,!0);return i.FormioClass.builder(e,o,t).then((e=>(i.afterCreate(e,s,"builderEmbedded"),e)))}))}}o.Formio=c,i=c,c.FormioClass=null,c.config={},c.modules=[],c.icons="",c.license="",c.formioReady=new Promise(((e,o)=>{i._formioReady=e,i._formioReadyReject=o})),c.version="5.0.0-rc.51",c.Report={create:(e,o,t={})=>s(void 0,void 0,void 0,(function*(){var s;if(null===(s=i.FormioClass)||void 0===s?void 0:s.Report)return i.FormioClass.Report.create(e,o,t);const r=yield i.init(e,t,!0);return i.FormioClass.Report.create(e,o,t).then((e=>(i.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,t){this.form=o,this.element=e,this.options=t||{},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 d extends a{create(){return c.builder(this.element,this.form,this.options)}}o.FormBuilder=d,c.Form=a,c.FormBuilder=d}},o={};function t(i){var s=o[i];if(void 0!==s)return s.exports;var r=o[i]={exports:{}};return e[i].call(r.exports,r,r.exports,t),r.exports}var i={};return function(){var e=i;e.Formio=void 0;const o=t(95413);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 a=r.scriptName||"formio.embed.";for(;c--;)if(s[c].src&&-1!==s[c].src.indexOf(a)){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 t=n.src.replace(/^([^?]+).*/,"$1").split("/");t.pop(),r.formioPath&&r.formioPath(t),t=t.join("/");const i="true"===e.debug||"1"===e.debug,s=i?"formio.form":"formio.form.min";o.Formio.config=Object.assign({script:e.script||`${r.updatePath?r.updatePath():t}/${s}.js`,style:e.styles||`${r.updatePath?r.updatePath():t}/${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:i,config:{},redirect:e.return||e.redirect,embedCSS:`${r.updatePath?r.updatePath():t}/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,t),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",(t=>{if(o.Formio.debug("on('submit')",t),o.Formio.config.submit){o.Formio.debug(`Sending submission to ${o.Formio.config.submit}`);const i={"content-type":"application/json"},s=o.Formio.FormioClass.getToken();s&&(i["x-jwt-token"]=s),o.Formio.FormioClass.fetch(o.Formio.config.submit,{body:JSON.stringify(t),headers:i,method:"POST",mode:"cors"}).then((e=>e.json())).then((t=>o.Formio.submitDone(e,t)))}else o.Formio.submitDone(e,t)}))}))}}else document.write("<span>Could not locate the Embedded form.</span>")}(),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 t{constructor(e,o={}){this.baseUrl=e||t.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,t){let i=e;return o&&(i+=`/${o}`),t&&"latest"!==t&&(i+=`/${t}`),i}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])}}t.defaultCDN="https://cdn.form.io",o.default=t},95413:function(e,o,t){var i,s=this&&this.__awaiter||function(e,o,t,i){return new(t||(t=Promise))((function(s,r){function n(e){try{a(i.next(e))}catch(e){r(e)}}function c(e){try{a(i.throw(e))}catch(e){r(e)}}function a(e){var o;e.done?s(e.value):(o=e.value,o instanceof t?o:new t((function(e){e(o)}))).then(n,c)}a((i=i.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(t(56036));class c{static setLicense(e,o=!1){i.license=e,!o&&i.FormioClass&&i.FormioClass.setLicense(e)}static setBaseUrl(e,o=!1){i.baseUrl=e,!o&&i.FormioClass&&i.FormioClass.setBaseUrl(e)}static setApiUrl(e,o=!1){i.baseUrl=e,!o&&i.FormioClass&&i.FormioClass.setApiUrl(e)}static setProjectUrl(e,o=!1){i.projectUrl=e,!o&&i.FormioClass&&i.FormioClass.setProjectUrl(e)}static setAppUrl(e,o=!1){i.projectUrl=e,!o&&i.FormioClass&&i.FormioClass.setAppUrl(e)}static setPathType(e,o=!1){i.pathType=e,!o&&i.FormioClass&&i.FormioClass.setPathType(e)}static debug(...e){i.config.debug&&console.log(...e)}static clearCache(){i.FormioClass&&i.FormioClass.clearCache()}static global(e,o=""){const t=window[e];return o&&t&&!t[o]?null:(i.debug(`Getting global ${e}`,t),t)}static use(e){i.FormioClass&&i.FormioClass.isRenderer?i.FormioClass.use(e):i.modules.push(e)}static createElement(e,o,t){const s=document.createElement(e);return Object.keys(o).forEach((e=>{s.setAttribute(e,o[e])})),(t||[]).forEach((e=>{s.appendChild(i.createElement(e.tag,e.attrs,e.children))})),s}static addScript(e,o,t,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=>i.addScript(e,o))));if(t&&i.global(t,r))return i.debug(`${t} already loaded.`),Promise.resolve(i.global(t));i.debug("Adding Script",o);try{e.appendChild(i.createElement("script",{src:o}))}catch(e){return i.debug(e),Promise.resolve()}return t?new Promise((e=>{i.debug(`Waiting to load ${t}`);const o=setInterval((()=>{i.global(t,r)&&(clearInterval(o),i.debug(`${t} loaded.`),e(i.global(t)))}),100)})):Promise.resolve()}))}static addStyles(e,o){return s(this,void 0,void 0,(function*(){o&&("string"!=typeof o&&o.length?o.forEach((o=>i.addStyles(e,o))):(i.debug("Adding Styles",o),e.appendChild(i.createElement("link",{rel:"stylesheet",href:o}))))}))}static submitDone(e,o){return s(this,void 0,void 0,(function*(){i.debug("Submision Complete",o);const t=(i.config.success||"").toString();t&&"false"!==t.toLowerCase()&&e.element&&(e.element.innerHTML=`<div class="alert-success" role="alert">${t}</div>`);let s=i.config.redirect;if(!s&&e._form&&e._form.settings&&(e._form.settings.returnUrl||e._form.settings.redirect)&&(i.debug("Return url found in form configuration"),s=e._form.settings.returnUrl||e._form.settings.redirect),s){const t=e.formio?e.formio.formUrl:"",r=!!s.match(/\?/),n=0===s.indexOf(location.origin);s+=r?"&":"?",s+=`sub=${o._id}`,!n&&t&&(s+=`&form=${encodeURIComponent(t)}`),i.debug("Return URL",s),window.location.href=s,n&&window.location.reload()}}))}static formioScript(e,o){return o=o||i.config.includeBuilder,i.fullAdded||o?(i.fullAdded=!0,e.replace("formio.form","formio.full")):e}static addLibrary(e,o,t){return s(this,void 0,void 0,(function*(){if(o){if(o.dependencies)for(let t=0;t<o.dependencies.length;t++)yield i.addLibrary(e,i.cdn.libs[o.dependencies[t]]);if(o.css&&(yield i.addStyles(e,o.css)),o.js){const s=yield i.addScript(e,o.js,!!o.use&&t);if(o.use){i.debug(`Using ${t}`);const e=o.options||{};!e.license&&i.license&&(e.license=i.license),i.use("function"==typeof o.use?o.use(s):s,e)}}}}))}static addLoader(e){return s(this,void 0,void 0,(function*(){e.appendChild(i.createElement("div",{class:"formio-loader"},[{tag:"div",attrs:{class:"loader-wrapper"},children:[{tag:"div",attrs:{class:"loader text-center"}}]}]))}))}static init(e,o={},t=!1){return s(this,void 0,void 0,(function*(){i.cdn=new n.default(i.config.cdn,i.config.cdnUrls||{}),i.config.libs=i.config.libs||{uswds:{dependencies:["fontawesome"],js:`${i.cdn.uswds}/uswds.min.js`,css:`${i.cdn.uswds}/uswds.min.css`,use:!0},fontawesome:{css:`${i.cdn["font-awesome"]}/css/font-awesome.min.css`},bootstrap4:{dependencies:["fontawesome"],css:`${i.cdn.bootstrap4}/css/bootstrap.min.css`},bootstrap:{dependencies:["bootstrap-icons"],css:`${i.cdn.bootstrap}/css/bootstrap.min.css`},"bootstrap-icons":{css:`${i.cdn["bootstrap-icons"]}/css/bootstrap-icons.css`}};const s=i.config.id||`formio-${Math.random().toString(36).substring(7)}`;let r=i.createElement("div",{id:`${s}-wrapper`});e.parentNode.insertBefore(r,e);const c=i.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 i.addStyles(a,i.config.embedCSS||`${i.cdn.js}/formio.embed.css`),i.addLoader(r);const d=i.config.full?"formio.full":"formio.form",l=i.config.debug?d:`${d}.min`;if(i.FormioClass=yield i.addScript(a,i.formioScript(i.config.script||`${i.cdn.js}/${l}.js`,t),"Formio",t?"isBuilder":"isRenderer"),i.FormioClass.cdn=i.cdn,i.FormioClass.setBaseUrl(o.baseUrl||i.baseUrl||i.config.base),i.FormioClass.setProjectUrl(o.projectUrl||i.projectUrl||i.config.project),i.FormioClass.language=i.language,i.setLicense(i.license||i.config.license||!1),i.modules.forEach((e=>{i.FormioClass.use(e)})),i.icons&&(i.FormioClass.icons=i.icons),i.pathType&&i.FormioClass.setPathType(i.pathType),i.config.template&&i.config.includeLibs&&(yield i.addLibrary(a,i.config.libs[i.config.template],i.config.template)),i.config.premium&&(i.config.modules.premium=i.config.premium),i.config.modules)for(const e in i.config.modules){const o=i.config.modules[e];o.use=o.use||!0,yield i.addLibrary(a,o,e)}return yield i.addStyles(a,i.formioScript(i.config.style||`${i.cdn.js}/${l}.css`,t)),i.config.before&&(yield i.config.before(i.FormioClass,e,i.config)),i.FormioClass.license=!0,i._formioReady(i.FormioClass),r}))}static afterCreate(e,o,t){return s(this,void 0,void 0,(function*(){const s=o.querySelector(".formio-loader");return s&&o.removeChild(s),i.FormioClass.events.emit(t,e),i.config.after&&(i.debug("Calling ready callback"),i.config.after(e,i.config)),e}))}static createForm(e,o,t={}){return s(this,void 0,void 0,(function*(){if(i.FormioClass)return i.FormioClass.createForm(e,o,Object.assign(Object.assign({},t),{noLoader:!0}));const s=yield i.init(e,t);return i.FormioClass.createForm(e,o,Object.assign(Object.assign({},t),{noLoader:!0})).then((e=>(i.config.submission&&(i.debug("Setting submission",i.config.submission),e.submission=i.config.submission),i.afterCreate(e,s,"formEmbedded"),e)))}))}static builder(e,o,t={}){var r;return s(this,void 0,void 0,(function*(){if(null===(r=i.FormioClass)||void 0===r?void 0:r.builder)return i.FormioClass.builder(e,o,t);const s=yield i.init(e,t,!0);return i.FormioClass.builder(e,o,t).then((e=>(i.afterCreate(e,s,"builderEmbedded"),e)))}))}}o.Formio=c,i=c,c.FormioClass=null,c.config={},c.modules=[],c.icons="",c.license="",c.formioReady=new Promise(((e,o)=>{i._formioReady=e,i._formioReadyReject=o})),c.version="5.0.0-rc.53",c.Report={create:(e,o,t={})=>s(void 0,void 0,void 0,(function*(){var s;if(null===(s=i.FormioClass)||void 0===s?void 0:s.Report)return i.FormioClass.Report.create(e,o,t);const r=yield i.init(e,t,!0);return i.FormioClass.Report.create(e,o,t).then((e=>(i.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,t){this.form=o,this.element=e,this.options=t||{},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 d extends a{create(){return c.builder(this.element,this.form,this.options)}}o.FormBuilder=d,c.Form=a,c.FormBuilder=d}},o={};function t(i){var s=o[i];if(void 0!==s)return s.exports;var r=o[i]={exports:{}};return e[i].call(r.exports,r,r.exports,t),r.exports}var i={};return function(){var e=i;e.Formio=void 0;const o=t(95413);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 a=r.scriptName||"formio.embed.";for(;c--;)if(s[c].src&&-1!==s[c].src.indexOf(a)){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 t=n.src.replace(/^([^?]+).*/,"$1").split("/");t.pop(),r.formioPath&&r.formioPath(t),t=t.join("/");const i="true"===e.debug||"1"===e.debug,s=i?"formio.form":"formio.form.min";o.Formio.config=Object.assign({script:e.script||`${r.updatePath?r.updatePath():t}/${s}.js`,style:e.styles||`${r.updatePath?r.updatePath():t}/${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:i,config:{},redirect:e.return||e.redirect,embedCSS:`${r.updatePath?r.updatePath():t}/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,t),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",(t=>{if(o.Formio.debug("on('submit')",t),o.Formio.config.submit){o.Formio.debug(`Sending submission to ${o.Formio.config.submit}`);const i={"content-type":"application/json"},s=o.Formio.FormioClass.getToken();s&&(i["x-jwt-token"]=s),o.Formio.FormioClass.fetch(o.Formio.config.submit,{body:JSON.stringify(t),headers:i,method:"POST",mode:"cors"}).then((e=>e.json())).then((t=>o.Formio.submitDone(e,t)))}else o.Formio.submitDone(e,t)}))}))}}else document.write("<span>Could not locate the Embedded form.</span>")}(),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 t{constructor(e,o={}){this.baseUrl=e||t.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,t){let i=e;return o&&(i+=`/${o}`),t&&"latest"!==t&&(i+=`/${t}`),i}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])}}t.defaultCDN="https://cdn.form.io",o.default=t},95413:function(e,o,t){var i,s=this&&this.__awaiter||function(e,o,t,i){return new(t||(t=Promise))((function(s,r){function n(e){try{a(i.next(e))}catch(e){r(e)}}function c(e){try{a(i.throw(e))}catch(e){r(e)}}function a(e){var o;e.done?s(e.value):(o=e.value,o instanceof t?o:new t((function(e){e(o)}))).then(n,c)}a((i=i.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(t(56036));class c{static setLicense(e,o=!1){i.license=e,!o&&i.FormioClass&&i.FormioClass.setLicense(e)}static setBaseUrl(e,o=!1){i.baseUrl=e,!o&&i.FormioClass&&i.FormioClass.setBaseUrl(e)}static setApiUrl(e,o=!1){i.baseUrl=e,!o&&i.FormioClass&&i.FormioClass.setApiUrl(e)}static setProjectUrl(e,o=!1){i.projectUrl=e,!o&&i.FormioClass&&i.FormioClass.setProjectUrl(e)}static setAppUrl(e,o=!1){i.projectUrl=e,!o&&i.FormioClass&&i.FormioClass.setAppUrl(e)}static setPathType(e,o=!1){i.pathType=e,!o&&i.FormioClass&&i.FormioClass.setPathType(e)}static debug(...e){i.config.debug&&console.log(...e)}static clearCache(){i.FormioClass&&i.FormioClass.clearCache()}static global(e,o=""){const t=window[e];return o&&t&&!t[o]?null:(i.debug(`Getting global ${e}`,t),t)}static use(e){i.FormioClass&&i.FormioClass.isRenderer?i.FormioClass.use(e):i.modules.push(e)}static createElement(e,o,t){const s=document.createElement(e);return Object.keys(o).forEach((e=>{s.setAttribute(e,o[e])})),(t||[]).forEach((e=>{s.appendChild(i.createElement(e.tag,e.attrs,e.children))})),s}static addScript(e,o,t,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=>i.addScript(e,o))));if(t&&i.global(t,r))return i.debug(`${t} already loaded.`),Promise.resolve(i.global(t));i.debug("Adding Script",o);try{e.appendChild(i.createElement("script",{src:o}))}catch(e){return i.debug(e),Promise.resolve()}return t?new Promise((e=>{i.debug(`Waiting to load ${t}`);const o=setInterval((()=>{i.global(t,r)&&(clearInterval(o),i.debug(`${t} loaded.`),e(i.global(t)))}),100)})):Promise.resolve()}))}static addStyles(e,o){return s(this,void 0,void 0,(function*(){o&&("string"!=typeof o&&o.length?o.forEach((o=>i.addStyles(e,o))):(i.debug("Adding Styles",o),e.appendChild(i.createElement("link",{rel:"stylesheet",href:o}))))}))}static submitDone(e,o){return s(this,void 0,void 0,(function*(){i.debug("Submision Complete",o);const t=(i.config.success||"").toString();t&&"false"!==t.toLowerCase()&&e.element&&(e.element.innerHTML=`<div class="alert-success" role="alert">${t}</div>`);let s=i.config.redirect;if(!s&&e._form&&e._form.settings&&(e._form.settings.returnUrl||e._form.settings.redirect)&&(i.debug("Return url found in form configuration"),s=e._form.settings.returnUrl||e._form.settings.redirect),s){const t=e.formio?e.formio.formUrl:"",r=!!s.match(/\?/),n=0===s.indexOf(location.origin);s+=r?"&":"?",s+=`sub=${o._id}`,!n&&t&&(s+=`&form=${encodeURIComponent(t)}`),i.debug("Return URL",s),window.location.href=s,n&&window.location.reload()}}))}static formioScript(e,o){return o=o||i.config.includeBuilder,i.fullAdded||o?(i.fullAdded=!0,e.replace("formio.form","formio.full")):e}static addLibrary(e,o,t){return s(this,void 0,void 0,(function*(){if(o){if(o.dependencies)for(let t=0;t<o.dependencies.length;t++)yield i.addLibrary(e,i.cdn.libs[o.dependencies[t]]);if(o.css&&(yield i.addStyles(e,o.css)),o.js){const s=yield i.addScript(e,o.js,!!o.use&&t);if(o.use){i.debug(`Using ${t}`);const e=o.options||{};!e.license&&i.license&&(e.license=i.license),i.use("function"==typeof o.use?o.use(s):s,e)}}}}))}static addLoader(e){return s(this,void 0,void 0,(function*(){e.appendChild(i.createElement("div",{class:"formio-loader"},[{tag:"div",attrs:{class:"loader-wrapper"},children:[{tag:"div",attrs:{class:"loader text-center"}}]}]))}))}static init(e,o={},t=!1){return s(this,void 0,void 0,(function*(){i.cdn=new n.default(i.config.cdn,i.config.cdnUrls||{}),i.config.libs=i.config.libs||{uswds:{dependencies:["fontawesome"],js:`${i.cdn.uswds}/uswds.min.js`,css:`${i.cdn.uswds}/uswds.min.css`,use:!0},fontawesome:{css:`${i.cdn["font-awesome"]}/css/font-awesome.min.css`},bootstrap4:{dependencies:["fontawesome"],css:`${i.cdn.bootstrap4}/css/bootstrap.min.css`},bootstrap:{dependencies:["bootstrap-icons"],css:`${i.cdn.bootstrap}/css/bootstrap.min.css`},"bootstrap-icons":{css:`${i.cdn["bootstrap-icons"]}/css/bootstrap-icons.css`}};const s=i.config.id||`formio-${Math.random().toString(36).substring(7)}`;let r=i.createElement("div",{id:`${s}-wrapper`});e.parentNode.insertBefore(r,e);const c=i.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 i.addStyles(a,i.config.embedCSS||`${i.cdn.js}/formio.embed.css`),i.addLoader(r);const d=i.config.full?"formio.full":"formio.form",l=i.config.debug?d:`${d}.min`;if(i.FormioClass=yield i.addScript(a,i.formioScript(i.config.script||`${i.cdn.js}/${l}.js`,t),"Formio",t?"isBuilder":"isRenderer"),i.FormioClass.cdn=i.cdn,i.FormioClass.setBaseUrl(o.baseUrl||i.baseUrl||i.config.base),i.FormioClass.setProjectUrl(o.projectUrl||i.projectUrl||i.config.project),i.FormioClass.language=i.language,i.setLicense(i.license||i.config.license||!1),i.modules.forEach((e=>{i.FormioClass.use(e)})),i.icons&&(i.FormioClass.icons=i.icons),i.pathType&&i.FormioClass.setPathType(i.pathType),i.config.template&&i.config.includeLibs&&(yield i.addLibrary(a,i.config.libs[i.config.template],i.config.template)),i.config.premium&&(i.config.modules.premium=i.config.premium),i.config.modules)for(const e in i.config.modules){const o=i.config.modules[e];o.use=o.use||!0,yield i.addLibrary(a,o,e)}return yield i.addStyles(a,i.formioScript(i.config.style||`${i.cdn.js}/${l}.css`,t)),i.config.before&&(yield i.config.before(i.FormioClass,e,i.config)),i.FormioClass.license=!0,i._formioReady(i.FormioClass),r}))}static afterCreate(e,o,t){return s(this,void 0,void 0,(function*(){const s=o.querySelector(".formio-loader");return s&&o.removeChild(s),i.FormioClass.events.emit(t,e),i.config.after&&(i.debug("Calling ready callback"),i.config.after(e,i.config)),e}))}static createForm(e,o,t={}){return s(this,void 0,void 0,(function*(){if(i.FormioClass)return i.FormioClass.createForm(e,o,Object.assign(Object.assign({},t),{noLoader:!0}));const s=yield i.init(e,t);return i.FormioClass.createForm(e,o,Object.assign(Object.assign({},t),{noLoader:!0})).then((e=>(i.config.submission&&(i.debug("Setting submission",i.config.submission),e.submission=i.config.submission),i.afterCreate(e,s,"formEmbedded"),e)))}))}static builder(e,o,t={}){var r;return s(this,void 0,void 0,(function*(){if(null===(r=i.FormioClass)||void 0===r?void 0:r.builder)return i.FormioClass.builder(e,o,t);const s=yield i.init(e,t,!0);return i.FormioClass.builder(e,o,t).then((e=>(i.afterCreate(e,s,"builderEmbedded"),e)))}))}}o.Formio=c,i=c,c.FormioClass=null,c.config={},c.modules=[],c.icons="",c.license="",c.formioReady=new Promise(((e,o)=>{i._formioReady=e,i._formioReadyReject=o})),c.version="5.0.0-rc.51",c.Report={create:(e,o,t={})=>s(void 0,void 0,void 0,(function*(){var s;if(null===(s=i.FormioClass)||void 0===s?void 0:s.Report)return i.FormioClass.Report.create(e,o,t);const r=yield i.init(e,t,!0);return i.FormioClass.Report.create(e,o,t).then((e=>(i.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,t){this.form=o,this.element=e,this.options=t||{},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 d extends a{create(){return c.builder(this.element,this.form,this.options)}}o.FormBuilder=d,c.Form=a,c.FormBuilder=d}},o={};function t(i){var s=o[i];if(void 0!==s)return s.exports;var r=o[i]={exports:{}};return e[i].call(r.exports,r,r.exports,t),r.exports}var i={};return function(){var e=i;e.Formio=void 0;const o=t(95413);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 a=r.scriptName||"formio.embed.";for(;c--;)if(s[c].src&&-1!==s[c].src.indexOf(a)){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 t=n.src.replace(/^([^?]+).*/,"$1").split("/");t.pop(),r.formioPath&&r.formioPath(t),t=t.join("/");const i="true"===e.debug||"1"===e.debug,s=i?"formio.form":"formio.form.min";o.Formio.config=Object.assign({script:e.script||`${r.updatePath?r.updatePath():t}/${s}.js`,style:e.styles||`${r.updatePath?r.updatePath():t}/${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:i,config:{},redirect:e.return||e.redirect,embedCSS:`${r.updatePath?r.updatePath():t}/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,t),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",(t=>{if(o.Formio.debug("on('submit')",t),o.Formio.config.submit){o.Formio.debug(`Sending submission to ${o.Formio.config.submit}`);const i={"content-type":"application/json"},s=o.Formio.FormioClass.getToken();s&&(i["x-jwt-token"]=s),o.Formio.FormioClass.fetch(o.Formio.config.submit,{body:JSON.stringify(t),headers:i,method:"POST",mode:"cors"}).then((e=>e.json())).then((t=>o.Formio.submitDone(e,t)))}else o.Formio.submitDone(e,t)}))}))}}else document.write("<span>Could not locate the Embedded form.</span>")}(),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 t{constructor(e,o={}){this.baseUrl=e||t.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,t){let i=e;return o&&(i+=`/${o}`),t&&"latest"!==t&&(i+=`/${t}`),i}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])}}t.defaultCDN="https://cdn.form.io",o.default=t},95413:function(e,o,t){var i,s=this&&this.__awaiter||function(e,o,t,i){return new(t||(t=Promise))((function(s,r){function n(e){try{a(i.next(e))}catch(e){r(e)}}function c(e){try{a(i.throw(e))}catch(e){r(e)}}function a(e){var o;e.done?s(e.value):(o=e.value,o instanceof t?o:new t((function(e){e(o)}))).then(n,c)}a((i=i.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(t(56036));class c{static setLicense(e,o=!1){i.license=e,!o&&i.FormioClass&&i.FormioClass.setLicense(e)}static setBaseUrl(e,o=!1){i.baseUrl=e,!o&&i.FormioClass&&i.FormioClass.setBaseUrl(e)}static setApiUrl(e,o=!1){i.baseUrl=e,!o&&i.FormioClass&&i.FormioClass.setApiUrl(e)}static setProjectUrl(e,o=!1){i.projectUrl=e,!o&&i.FormioClass&&i.FormioClass.setProjectUrl(e)}static setAppUrl(e,o=!1){i.projectUrl=e,!o&&i.FormioClass&&i.FormioClass.setAppUrl(e)}static setPathType(e,o=!1){i.pathType=e,!o&&i.FormioClass&&i.FormioClass.setPathType(e)}static debug(...e){i.config.debug&&console.log(...e)}static clearCache(){i.FormioClass&&i.FormioClass.clearCache()}static global(e,o=""){const t=window[e];return o&&t&&!t[o]?null:(i.debug(`Getting global ${e}`,t),t)}static use(e){i.FormioClass&&i.FormioClass.isRenderer?i.FormioClass.use(e):i.modules.push(e)}static createElement(e,o,t){const s=document.createElement(e);return Object.keys(o).forEach((e=>{s.setAttribute(e,o[e])})),(t||[]).forEach((e=>{s.appendChild(i.createElement(e.tag,e.attrs,e.children))})),s}static addScript(e,o,t,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=>i.addScript(e,o))));if(t&&i.global(t,r))return i.debug(`${t} already loaded.`),Promise.resolve(i.global(t));i.debug("Adding Script",o);try{e.appendChild(i.createElement("script",{src:o}))}catch(e){return i.debug(e),Promise.resolve()}return t?new Promise((e=>{i.debug(`Waiting to load ${t}`);const o=setInterval((()=>{i.global(t,r)&&(clearInterval(o),i.debug(`${t} loaded.`),e(i.global(t)))}),100)})):Promise.resolve()}))}static addStyles(e,o){return s(this,void 0,void 0,(function*(){o&&("string"!=typeof o&&o.length?o.forEach((o=>i.addStyles(e,o))):(i.debug("Adding Styles",o),e.appendChild(i.createElement("link",{rel:"stylesheet",href:o}))))}))}static submitDone(e,o){return s(this,void 0,void 0,(function*(){i.debug("Submision Complete",o);const t=(i.config.success||"").toString();t&&"false"!==t.toLowerCase()&&e.element&&(e.element.innerHTML=`<div class="alert-success" role="alert">${t}</div>`);let s=i.config.redirect;if(!s&&e._form&&e._form.settings&&(e._form.settings.returnUrl||e._form.settings.redirect)&&(i.debug("Return url found in form configuration"),s=e._form.settings.returnUrl||e._form.settings.redirect),s){const t=e.formio?e.formio.formUrl:"",r=!!s.match(/\?/),n=0===s.indexOf(location.origin);s+=r?"&":"?",s+=`sub=${o._id}`,!n&&t&&(s+=`&form=${encodeURIComponent(t)}`),i.debug("Return URL",s),window.location.href=s,n&&window.location.reload()}}))}static formioScript(e,o){return o=o||i.config.includeBuilder,i.fullAdded||o?(i.fullAdded=!0,e.replace("formio.form","formio.full")):e}static addLibrary(e,o,t){return s(this,void 0,void 0,(function*(){if(o){if(o.dependencies)for(let t=0;t<o.dependencies.length;t++)yield i.addLibrary(e,i.cdn.libs[o.dependencies[t]]);if(o.css&&(yield i.addStyles(e,o.css)),o.js){const s=yield i.addScript(e,o.js,!!o.use&&t);if(o.use){i.debug(`Using ${t}`);const e=o.options||{};!e.license&&i.license&&(e.license=i.license),i.use("function"==typeof o.use?o.use(s):s,e)}}}}))}static addLoader(e){return s(this,void 0,void 0,(function*(){e.appendChild(i.createElement("div",{class:"formio-loader"},[{tag:"div",attrs:{class:"loader-wrapper"},children:[{tag:"div",attrs:{class:"loader text-center"}}]}]))}))}static init(e,o={},t=!1){return s(this,void 0,void 0,(function*(){i.cdn=new n.default(i.config.cdn,i.config.cdnUrls||{}),i.config.libs=i.config.libs||{uswds:{dependencies:["fontawesome"],js:`${i.cdn.uswds}/uswds.min.js`,css:`${i.cdn.uswds}/uswds.min.css`,use:!0},fontawesome:{css:`${i.cdn["font-awesome"]}/css/font-awesome.min.css`},bootstrap4:{dependencies:["fontawesome"],css:`${i.cdn.bootstrap4}/css/bootstrap.min.css`},bootstrap:{dependencies:["bootstrap-icons"],css:`${i.cdn.bootstrap}/css/bootstrap.min.css`},"bootstrap-icons":{css:`${i.cdn["bootstrap-icons"]}/css/bootstrap-icons.css`}};const s=i.config.id||`formio-${Math.random().toString(36).substring(7)}`;let r=i.createElement("div",{id:`${s}-wrapper`});e.parentNode.insertBefore(r,e);const c=i.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 i.addStyles(a,i.config.embedCSS||`${i.cdn.js}/formio.embed.css`),i.addLoader(r);const d=i.config.full?"formio.full":"formio.form",l=i.config.debug?d:`${d}.min`;if(i.FormioClass=yield i.addScript(a,i.formioScript(i.config.script||`${i.cdn.js}/${l}.js`,t),"Formio",t?"isBuilder":"isRenderer"),i.FormioClass.cdn=i.cdn,i.FormioClass.setBaseUrl(o.baseUrl||i.baseUrl||i.config.base),i.FormioClass.setProjectUrl(o.projectUrl||i.projectUrl||i.config.project),i.FormioClass.language=i.language,i.setLicense(i.license||i.config.license||!1),i.modules.forEach((e=>{i.FormioClass.use(e)})),i.icons&&(i.FormioClass.icons=i.icons),i.pathType&&i.FormioClass.setPathType(i.pathType),i.config.template&&i.config.includeLibs&&(yield i.addLibrary(a,i.config.libs[i.config.template],i.config.template)),i.config.premium&&(i.config.modules.premium=i.config.premium),i.config.modules)for(const e in i.config.modules){const o=i.config.modules[e];o.use=o.use||!0,yield i.addLibrary(a,o,e)}return yield i.addStyles(a,i.formioScript(i.config.style||`${i.cdn.js}/${l}.css`,t)),i.config.before&&(yield i.config.before(i.FormioClass,e,i.config)),i.FormioClass.license=!0,i._formioReady(i.FormioClass),r}))}static afterCreate(e,o,t){return s(this,void 0,void 0,(function*(){const s=o.querySelector(".formio-loader");return s&&o.removeChild(s),i.FormioClass.events.emit(t,e),i.config.after&&(i.debug("Calling ready callback"),i.config.after(e,i.config)),e}))}static createForm(e,o,t={}){return s(this,void 0,void 0,(function*(){if(i.FormioClass)return i.FormioClass.createForm(e,o,Object.assign(Object.assign({},t),{noLoader:!0}));const s=yield i.init(e,t);return i.FormioClass.createForm(e,o,Object.assign(Object.assign({},t),{noLoader:!0})).then((e=>(i.config.submission&&(i.debug("Setting submission",i.config.submission),e.submission=i.config.submission),i.afterCreate(e,s,"formEmbedded"),e)))}))}static builder(e,o,t={}){var r;return s(this,void 0,void 0,(function*(){if(null===(r=i.FormioClass)||void 0===r?void 0:r.builder)return i.FormioClass.builder(e,o,t);const s=yield i.init(e,t,!0);return i.FormioClass.builder(e,o,t).then((e=>(i.afterCreate(e,s,"builderEmbedded"),e)))}))}}o.Formio=c,i=c,c.FormioClass=null,c.config={},c.modules=[],c.icons="",c.license="",c.formioReady=new Promise(((e,o)=>{i._formioReady=e,i._formioReadyReject=o})),c.version="5.0.0-rc.53",c.Report={create:(e,o,t={})=>s(void 0,void 0,void 0,(function*(){var s;if(null===(s=i.FormioClass)||void 0===s?void 0:s.Report)return i.FormioClass.Report.create(e,o,t);const r=yield i.init(e,t,!0);return i.FormioClass.Report.create(e,o,t).then((e=>(i.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,t){this.form=o,this.element=e,this.options=t||{},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 d extends a{create(){return c.builder(this.element,this.form,this.options)}}o.FormBuilder=d,c.Form=a,c.FormBuilder=d}},o={};function t(i){var s=o[i];if(void 0!==s)return s.exports;var r=o[i]={exports:{}};return e[i].call(r.exports,r,r.exports,t),r.exports}var i={};return function(){var e=i;e.Formio=void 0;const o=t(95413);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 a=r.scriptName||"formio.embed.";for(;c--;)if(s[c].src&&-1!==s[c].src.indexOf(a)){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 t=n.src.replace(/^([^?]+).*/,"$1").split("/");t.pop(),r.formioPath&&r.formioPath(t),t=t.join("/");const i="true"===e.debug||"1"===e.debug,s=i?"formio.form":"formio.form.min";o.Formio.config=Object.assign({script:e.script||`${r.updatePath?r.updatePath():t}/${s}.js`,style:e.styles||`${r.updatePath?r.updatePath():t}/${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:i,config:{},redirect:e.return||e.redirect,embedCSS:`${r.updatePath?r.updatePath():t}/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,t),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",(t=>{if(o.Formio.debug("on('submit')",t),o.Formio.config.submit){o.Formio.debug(`Sending submission to ${o.Formio.config.submit}`);const i={"content-type":"application/json"},s=o.Formio.FormioClass.getToken();s&&(i["x-jwt-token"]=s),o.Formio.FormioClass.fetch(o.Formio.config.submit,{body:JSON.stringify(t),headers:i,method:"POST",mode:"cors"}).then((e=>e.json())).then((t=>o.Formio.submitDone(e,t)))}else o.Formio.submitDone(e,t)}))}))}}else document.write("<span>Could not locate the Embedded form.</span>")}(),i.Formio}()}));
|
@@ -1 +1 @@
|
|
1
|
-
/*! formiojs v5.0.0-rc.
|
1
|
+
/*! formiojs v5.0.0-rc.53 | https://unpkg.com/formiojs@5.0.0-rc.53/LICENSE.txt */
|