@formio/js 5.0.0-rc.20 → 5.0.0-rc.21
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/formio.embed.css +1 -39
- package/dist/formio.embed.js +2 -90
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +57 -35
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +58 -36
- 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.js +1 -1
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/CDN.d.ts +1 -0
- package/lib/cjs/CDN.js +1 -0
- package/lib/cjs/Embed.d.ts +21 -1
- package/lib/cjs/Embed.js +211 -308
- package/lib/cjs/Form.d.ts +1 -1
- package/lib/cjs/Form.js +1 -1
- package/lib/cjs/Webform.d.ts +6 -6
- package/lib/cjs/Webform.js +6 -6
- package/lib/cjs/WebformBuilder.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +16 -6
- package/lib/cjs/components/_classes/component/Component.js +26 -6
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +4 -0
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +4 -0
- package/lib/cjs/components/address/Address.js +5 -0
- package/lib/cjs/components/button/Button.d.ts +1 -0
- package/lib/cjs/components/button/Button.js +3 -0
- package/lib/cjs/components/checkbox/Checkbox.d.ts +28 -0
- package/lib/cjs/components/checkbox/Checkbox.js +17 -2
- package/lib/cjs/components/columns/Columns.d.ts +1 -0
- package/lib/cjs/components/columns/Columns.js +3 -0
- package/lib/cjs/components/container/Container.js +3 -0
- package/lib/cjs/components/content/Content.d.ts +1 -0
- package/lib/cjs/components/content/Content.js +3 -0
- package/lib/cjs/components/datamap/DataMap.d.ts +1 -0
- package/lib/cjs/components/datamap/DataMap.js +3 -0
- package/lib/cjs/components/datetime/DateTime.d.ts +19 -0
- package/lib/cjs/components/datetime/DateTime.js +9 -10
- package/lib/cjs/components/day/Day.d.ts +21 -0
- package/lib/cjs/components/day/Day.js +8 -10
- package/lib/cjs/components/fieldset/Fieldset.d.ts +1 -0
- package/lib/cjs/components/fieldset/Fieldset.js +3 -0
- package/lib/cjs/components/file/File.d.ts +21 -1
- package/lib/cjs/components/file/File.js +15 -7
- package/lib/cjs/components/form/Form.d.ts +1 -0
- package/lib/cjs/components/form/Form.js +3 -0
- package/lib/cjs/components/html/HTML.d.ts +1 -0
- package/lib/cjs/components/html/HTML.js +3 -0
- package/lib/cjs/components/number/Number.d.ts +20 -1
- package/lib/cjs/components/number/Number.js +10 -15
- package/lib/cjs/components/panel/Panel.d.ts +1 -0
- package/lib/cjs/components/panel/Panel.js +3 -0
- package/lib/cjs/components/radio/Radio.d.ts +19 -0
- package/lib/cjs/components/radio/Radio.js +30 -0
- package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -0
- package/lib/cjs/components/recaptcha/ReCaptcha.js +3 -0
- package/lib/cjs/components/select/Select.d.ts +19 -1
- package/lib/cjs/components/select/Select.js +37 -3
- package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +26 -1
- package/lib/cjs/components/selectboxes/SelectBoxes.js +8 -1
- package/lib/cjs/components/signature/Signature.d.ts +21 -0
- package/lib/cjs/components/signature/Signature.js +9 -1
- package/lib/cjs/components/survey/Survey.d.ts +21 -0
- package/lib/cjs/components/survey/Survey.js +7 -1
- package/lib/cjs/components/table/Table.d.ts +1 -0
- package/lib/cjs/components/table/Table.js +3 -0
- package/lib/cjs/components/tabs/Tabs.d.ts +1 -0
- package/lib/cjs/components/tabs/Tabs.js +3 -0
- package/lib/cjs/components/tags/Tags.d.ts +21 -0
- package/lib/cjs/components/tags/Tags.js +9 -1
- package/lib/cjs/components/textfield/TextField.d.ts +21 -0
- package/lib/cjs/components/textfield/TextField.js +7 -1
- package/lib/cjs/components/time/Time.d.ts +8 -1
- package/lib/cjs/components/well/Well.d.ts +1 -0
- package/lib/cjs/components/well/Well.js +3 -0
- package/lib/cjs/formio.embed.d.ts +2 -1
- package/lib/cjs/formio.embed.js +96 -1
- package/lib/cjs/formio.form.d.ts +4 -3
- package/lib/cjs/formio.form.js +17 -8
- package/lib/cjs/licenses/Licenses.d.ts +7 -0
- package/lib/cjs/licenses/Licenses.js +22 -0
- package/lib/cjs/licenses/index.d.ts +2 -0
- package/lib/cjs/licenses/index.js +7 -0
- package/lib/cjs/utils/utils.d.ts +10 -0
- package/lib/cjs/utils/utils.js +21 -1
- package/lib/mjs/CDN.d.ts +1 -0
- package/lib/mjs/CDN.js +1 -0
- package/lib/mjs/Embed.d.ts +21 -1
- package/lib/mjs/Embed.js +208 -322
- package/lib/mjs/Form.d.ts +1 -1
- package/lib/mjs/Form.js +1 -1
- package/lib/mjs/Webform.d.ts +6 -6
- package/lib/mjs/Webform.js +6 -6
- package/lib/mjs/WebformBuilder.js +1 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +16 -6
- package/lib/mjs/components/_classes/component/Component.js +26 -6
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +4 -0
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +4 -0
- package/lib/mjs/components/address/Address.js +5 -0
- package/lib/mjs/components/button/Button.d.ts +1 -0
- package/lib/mjs/components/button/Button.js +4 -1
- package/lib/mjs/components/checkbox/Checkbox.d.ts +28 -0
- package/lib/mjs/components/checkbox/Checkbox.js +18 -3
- package/lib/mjs/components/columns/Columns.d.ts +1 -0
- package/lib/mjs/components/columns/Columns.js +3 -0
- package/lib/mjs/components/container/Container.js +4 -1
- package/lib/mjs/components/content/Content.d.ts +1 -0
- package/lib/mjs/components/content/Content.js +3 -0
- package/lib/mjs/components/datamap/DataMap.d.ts +1 -0
- package/lib/mjs/components/datamap/DataMap.js +4 -1
- package/lib/mjs/components/datetime/DateTime.d.ts +19 -0
- package/lib/mjs/components/datetime/DateTime.js +11 -12
- package/lib/mjs/components/day/Day.d.ts +21 -0
- package/lib/mjs/components/day/Day.js +12 -14
- package/lib/mjs/components/fieldset/Fieldset.d.ts +1 -0
- package/lib/mjs/components/fieldset/Fieldset.js +3 -0
- package/lib/mjs/components/file/File.d.ts +21 -1
- package/lib/mjs/components/file/File.js +16 -8
- package/lib/mjs/components/form/Form.d.ts +1 -0
- package/lib/mjs/components/form/Form.js +4 -1
- package/lib/mjs/components/html/HTML.d.ts +1 -0
- package/lib/mjs/components/html/HTML.js +3 -0
- package/lib/mjs/components/number/Number.d.ts +20 -1
- package/lib/mjs/components/number/Number.js +11 -12
- package/lib/mjs/components/panel/Panel.d.ts +1 -0
- package/lib/mjs/components/panel/Panel.js +3 -0
- package/lib/mjs/components/radio/Radio.d.ts +19 -0
- package/lib/mjs/components/radio/Radio.js +34 -1
- package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -0
- package/lib/mjs/components/recaptcha/ReCaptcha.js +3 -0
- package/lib/mjs/components/select/Select.d.ts +19 -1
- package/lib/mjs/components/select/Select.js +39 -5
- package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +26 -1
- package/lib/mjs/components/selectboxes/SelectBoxes.js +8 -1
- package/lib/mjs/components/signature/Signature.d.ts +21 -0
- package/lib/mjs/components/signature/Signature.js +9 -1
- package/lib/mjs/components/survey/Survey.d.ts +21 -0
- package/lib/mjs/components/survey/Survey.js +8 -2
- package/lib/mjs/components/table/Table.d.ts +1 -0
- package/lib/mjs/components/table/Table.js +3 -0
- package/lib/mjs/components/tabs/Tabs.d.ts +1 -0
- package/lib/mjs/components/tabs/Tabs.js +3 -0
- package/lib/mjs/components/tags/Tags.d.ts +21 -0
- package/lib/mjs/components/tags/Tags.js +10 -2
- package/lib/mjs/components/textfield/TextField.d.ts +21 -0
- package/lib/mjs/components/textfield/TextField.js +8 -2
- package/lib/mjs/components/time/Time.d.ts +8 -1
- package/lib/mjs/components/well/Well.d.ts +1 -0
- package/lib/mjs/components/well/Well.js +3 -0
- package/lib/mjs/formio.embed.d.ts +2 -1
- package/lib/mjs/formio.embed.js +96 -2
- package/lib/mjs/formio.form.d.ts +4 -3
- package/lib/mjs/formio.form.js +16 -8
- package/lib/mjs/licenses/Licenses.d.ts +7 -0
- package/lib/mjs/licenses/Licenses.js +17 -0
- package/lib/mjs/licenses/index.d.ts +2 -0
- package/lib/mjs/licenses/index.js +2 -0
- package/lib/mjs/utils/utils.d.ts +10 -0
- package/lib/mjs/utils/utils.js +19 -0
- package/package.json +5 -1
- package/types/index.d.ts +1 -0
- package/types/licenses.d.ts +7 -0
- package/types/utils.d.ts +2 -0
package/dist/formio.embed.css
CHANGED
@@ -1,39 +1 @@
|
|
1
|
-
.formio-loader {
|
2
|
-
position: relative;
|
3
|
-
min-height: 100px;
|
4
|
-
}
|
5
|
-
|
6
|
-
.loader-wrapper {
|
7
|
-
z-index: 1000;
|
8
|
-
position: absolute;
|
9
|
-
top: 0px;
|
10
|
-
left: 0px;
|
11
|
-
bottom: 0px;
|
12
|
-
right: 0px;
|
13
|
-
background-color: rgba(0, 0, 0, 0);
|
14
|
-
}
|
15
|
-
|
16
|
-
.loader {
|
17
|
-
position: absolute;
|
18
|
-
left: 50%;
|
19
|
-
top: 50%;
|
20
|
-
margin-left: -30px;
|
21
|
-
margin-top: -30px;
|
22
|
-
z-index: 10000;
|
23
|
-
display: inline-block;
|
24
|
-
border: 6px solid #f3f3f3; /* Light grey */
|
25
|
-
border-top: 6px solid #3498db; /* Blue */
|
26
|
-
border-radius: 50%;
|
27
|
-
width: 60px;
|
28
|
-
height: 60px;
|
29
|
-
animation: spin 2s linear infinite;
|
30
|
-
}
|
31
|
-
|
32
|
-
@keyframes spin {
|
33
|
-
0% {
|
34
|
-
transform: rotate(0deg);
|
35
|
-
}
|
36
|
-
100% {
|
37
|
-
transform: rotate(360deg);
|
38
|
-
}
|
39
|
-
}
|
1
|
+
.formio-loader{position:relative;min-height:100px}.loader-wrapper{z-index:1000;position:absolute;top:0;left:0;bottom:0;right:0;background-color:rgba(0,0,0,0)}.loader{position:absolute;left:50%;top:50%;margin-left:-30px;margin-top:-30px;z-index:10000;display:inline-block;border:6px solid #f3f3f3;border-top:6px solid #3498db;border-radius:50%;width:60px;height:60px;animation:spin 2s linear infinite}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}
|
package/dist/formio.embed.js
CHANGED
@@ -1,90 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
* This devtool is neither made for production nor for readable output files.
|
4
|
-
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
5
|
-
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
6
|
-
* or disable the default devtool with "devtool: false".
|
7
|
-
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
8
|
-
*/
|
9
|
-
(function webpackUniversalModuleDefinition(root, factory) {
|
10
|
-
if(typeof exports === 'object' && typeof module === 'object')
|
11
|
-
module.exports = factory();
|
12
|
-
else if(typeof define === 'function' && define.amd)
|
13
|
-
define([], factory);
|
14
|
-
else if(typeof exports === 'object')
|
15
|
-
exports["Formio"] = factory();
|
16
|
-
else
|
17
|
-
root["Formio"] = factory();
|
18
|
-
})(self, function() {
|
19
|
-
return /******/ (function() { // webpackBootstrap
|
20
|
-
/******/ "use strict";
|
21
|
-
/******/ var __webpack_modules__ = ({
|
22
|
-
|
23
|
-
/***/ "./lib/cjs/CDN.js":
|
24
|
-
/*!************************!*\
|
25
|
-
!*** ./lib/cjs/CDN.js ***!
|
26
|
-
\************************/
|
27
|
-
/***/ (function(__unused_webpack_module, exports) {
|
28
|
-
|
29
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n// All external libs URLs should be injected through this class.\n// CDN libs URLs are accessible throuh CDN object properties\n// like Formio.cdn.ace === 'http://cdn.form.io/ace/1.4.12'.\n// For latest version use empty string\nclass CDN {\n constructor(baseUrl) {\n this.baseUrl = baseUrl || 'https://cdn.form.io';\n this.overrides = {};\n this.libs = {\n 'ace': '1.4.12',\n 'bootstrap': '4.6.2',\n 'ckeditor': '19.0.0',\n 'flatpickr': '4.6.8',\n 'flatpickr-formio': '4.6.13-formio.3',\n 'font-awesome': '4.7.0',\n 'grid': 'latest',\n 'moment-timezone': 'latest',\n 'quill': '2.0.0-dev.3',\n 'shortcut-buttons-flatpickr': '0.4.0',\n 'uswds': '2.4.8',\n 'core': ''\n };\n this.updateUrls();\n }\n getVersion(lib) {\n return this.libs[lib];\n }\n // Sets a specific library version\n setVersion(lib, version) {\n this.libs[lib] = version;\n this.updateUrls();\n }\n // Sets base CDN url for all libraries\n setBaseUrl(url) {\n this.baseUrl = url;\n this.updateUrls();\n }\n // Allows to override CDN url for a specific library\n setOverrideUrl(lib, url) {\n this.overrides[lib] = url;\n this.updateUrls();\n }\n // Removes override for a specific library\n removeOverride(lib) {\n delete this.overrides[lib];\n this.updateUrls();\n }\n // Removes all overrides\n removeOverrides() {\n this.overrides = {};\n this.updateUrls();\n }\n buildUrl(cdnUrl, lib, version) {\n let url;\n if (version === 'latest' || version === '') {\n url = `${cdnUrl}/${lib}`;\n }\n else {\n url = `${cdnUrl}/${lib}/${version}`;\n }\n return url;\n }\n updateUrls() {\n for (const lib in this.libs) {\n if (lib in this.overrides) {\n this[lib] = this.buildUrl(this.overrides[lib], lib, this.libs[lib]);\n }\n else {\n this[lib] = this.buildUrl(this.baseUrl, lib, this.libs[lib]);\n }\n }\n }\n}\nexports[\"default\"] = CDN;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/CDN.js?");
|
30
|
-
|
31
|
-
/***/ }),
|
32
|
-
|
33
|
-
/***/ "./lib/cjs/Embed.js":
|
34
|
-
/*!**************************!*\
|
35
|
-
!*** ./lib/cjs/Embed.js ***!
|
36
|
-
\**************************/
|
37
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
38
|
-
|
39
|
-
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.embed = void 0;\nconst CDN_1 = __importDefault(__webpack_require__(/*! ./CDN */ \"./lib/cjs/CDN.js\"));\n// eslint-disable-next-line max-statements\nfunction embed(config = {}) {\n const scripts = document.getElementsByTagName('script');\n config = Object.assign(config, window.FormioConfig);\n let thisScript = null;\n let i = scripts.length;\n const scriptName = config.scriptName || 'formio.embed.';\n while (i--) {\n if (scripts[i].src && (scripts[i].src.indexOf(scriptName) !== -1)) {\n thisScript = scripts[i];\n break;\n }\n }\n if (thisScript) {\n const query = {};\n const queryString = thisScript.src.replace(/^[^?]+\\??/, '');\n queryString.replace(/\\?/g, '&').split('&').forEach((item) => {\n query[item.split('=')[0]] = item.split('=')[1] && decodeURIComponent(item.split('=')[1]);\n });\n let scriptSrc = thisScript.src.replace(/^([^?]+).*/, '$1').split('/');\n scriptSrc.pop();\n if (config.formioPath) {\n config.formioPath(scriptSrc);\n }\n scriptSrc = scriptSrc.join('/');\n query.script = query.script || (`${config.updatePath ? config.updatePath() : scriptSrc}/formio.form.min.js`);\n query.styles = query.styles || (`${config.updatePath ? config.updatePath() : scriptSrc}/formio.form.min.css`);\n const cdn = query.cdn || 'https://cdn.jsdelivr.net/npm';\n const resolveLibs = (cdn) => {\n const libs = {\n uswds: {\n fa: true,\n js: `${cdn}/uswds@2.10.0/dist/js/uswds.min.js`,\n css: `${cdn}/uswds@2.10.0/dist/css/uswds.min.css`\n },\n fontawesome: {\n css: `${cdn}/font-awesome@4.7.0/css/font-awesome.min.css`\n },\n bootstrap: {\n css: `${cdn}/bootstrap@4.6.0/dist/css/bootstrap.min.css`\n }\n };\n // Check if using cdn.form.io standart folders format\n if (cdn instanceof CDN_1.default) {\n const url = cdn.baseUrl;\n libs.uswds.js = `${url}/uswds/${cdn.getVersion('uswds')}/uswds.min.js`;\n libs.uswds.css = `${url}/uswds/${cdn.getVersion('uswds')}/uswds.min.css`;\n libs.fontawesome.css = `${url}/font-awesome/${cdn.getVersion('font-awesome')}/css/font-awesome.min.css`;\n libs.bootstrap.css = `${url}/bootstrap/${cdn.getVersion('bootstrap')}/css/bootstrap.min.css`;\n }\n return libs;\n };\n config = Object.assign({\n script: query.script,\n style: query.styles,\n class: (query.class || 'formio-form-wrapper'),\n src: query.src,\n form: null,\n submission: null,\n project: query.project,\n base: query.base,\n submit: query.submit,\n includeLibs: (query.libs === 'true' || query.libs === '1'),\n template: query.template,\n debug: (query.debug === 'true' || query.debug === '1'),\n config: {},\n redirect: (query.return || query.redirect),\n before: () => { },\n after: () => { }\n }, config);\n /**\n * Print debug statements.\n *\n * @param {...any} args Arguments to pass to the console.log method.\n */\n const debug = (...args) => {\n if (config.debug) {\n console.log(...args);\n }\n };\n /**\n * Creates a new DOM element.\n *\n * @param {string} tag The HTMLElement to add to the wrapper or shadow dom.\n * @param {Object} attrs The attributes to add to this element.\n * @param {Array<Object>} children The children attached to this element.\n */\n const createElement = (tag, attrs, children) => {\n const element = document.createElement(tag);\n for (const attr in attrs) {\n if (attrs.hasOwnProperty(attr)) {\n element.setAttribute(attr, attrs[attr]);\n }\n }\n (children || []).forEach(child => {\n element.appendChild(createElement(child.tag, child.attrs, child.children));\n });\n return element;\n };\n debug('Embedding Configuration', config);\n if (config.addPremiumLib) {\n config.addPremiumLib(config, scriptSrc);\n }\n // The id for this embedded form.\n const id = `formio-${Math.random().toString(36).substring(7)}`;\n config.id = id;\n debug('Creating form wrapper');\n let wrapper = createElement('div', {\n 'id': `\"${id}-wrapper\"`\n });\n // insertAfter doesn't exist, but effect is identical.\n thisScript.parentNode.insertBefore(wrapper, thisScript.parentNode.firstElementChild.nextSibling);\n // If we include the libraries, then we will attempt to run this in shadow dom.\n if (config.includeLibs && (typeof wrapper.attachShadow === 'function') && !config.premium) {\n wrapper = wrapper.attachShadow({\n mode: 'open'\n });\n config.config.shadowRoot = wrapper;\n }\n const global = (name) => {\n const globalValue = window[name];\n debug(`Getting global ${name}`, globalValue);\n return globalValue;\n };\n const addStyles = (href, global) => {\n if (!href) {\n return;\n }\n if (typeof href !== 'string' && href.length) {\n href.forEach(ref => addStyles(ref));\n return;\n }\n debug('Adding Styles', href);\n const link = createElement('link', {\n rel: 'stylesheet',\n href\n });\n if (global) {\n // Add globally as well.\n document.head.appendChild(link);\n }\n wrapper.appendChild(createElement('link', {\n rel: 'stylesheet',\n href\n }));\n };\n const addScript = (src, globalProp, onReady) => {\n if (!src) {\n return;\n }\n if (typeof src !== 'string' && src.length) {\n src.forEach(ref => addScript(ref));\n return;\n }\n if (globalProp && global(globalProp)) {\n debug(`${globalProp} already loaded.`);\n return global(globalProp);\n }\n debug('Adding Script', src);\n wrapper.appendChild(createElement('script', {\n src\n }));\n if (globalProp && onReady) {\n debug(`Waiting to load ${globalProp}`);\n const wait = setInterval(() => {\n if (global(globalProp)) {\n clearInterval(wait);\n debug(`${globalProp} loaded.`);\n onReady(global(globalProp));\n }\n }, 100);\n }\n };\n // Create a loader\n addStyles(`${config.updatePath ? config.updatePath() : scriptSrc}/formio.embed.min.css`);\n debug('Creating loader');\n const loader = 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 wrapper.appendChild(loader);\n // Add the wrapper for the rendered form.\n debug('Creating form element');\n const formElement = createElement('div', {\n class: config.class\n });\n wrapper.appendChild(formElement);\n // Add the main formio script.\n addScript(config.script, 'Formio', (Formio) => {\n const renderForm = () => {\n addStyles(config.style);\n const isReady = config.before(Formio, formElement, config) || Formio.Promise.resolve();\n const form = (config.form || config.src);\n debug('Creating form', form, config.config);\n isReady.then(() => {\n Formio.license = true;\n Formio.createForm(formElement, form, Object.assign(Object.assign({}, config.config), { noLoader: true })).then((instance) => {\n const submitDone = (submission) => {\n debug('Submision Complete', submission);\n let returnUrl = 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 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 debug('Return URL', returnUrl);\n window.location.href = returnUrl;\n if (isOrigin) {\n window.location.reload();\n }\n }\n };\n if (config.submit) {\n instance.nosubmit = true;\n }\n debug('Form created', instance);\n // Remove the loader.\n debug('Removing loader');\n wrapper.removeChild(loader);\n // Set the default submission data.\n if (config.submission) {\n debug('Setting submission', config.submission);\n instance.submission = config.submission;\n }\n // Allow them to provide additional configs.\n debug('Triggering embed event');\n Formio.events.emit('formEmbedded', instance);\n debug('Calling ready callback');\n config.after(instance, config);\n // Configure a redirect.\n instance.on('submit', (submission) => {\n debug(\"on('submit')\", submission);\n if (config.submit) {\n debug(`Sending submission to ${config.submit}`);\n const headers = {\n 'content-type': 'application/json'\n };\n const token = Formio.getToken();\n if (token) {\n headers['x-jwt-token'] = token;\n }\n Formio.fetch(config.submit, {\n body: JSON.stringify(submission),\n headers: headers,\n method: 'POST',\n mode: 'cors',\n })\n .then(resp => resp.json())\n .then(submission => submitDone(submission));\n }\n else {\n submitDone(submission);\n }\n });\n });\n });\n };\n if (config.base) {\n Formio.setBaseUrl(config.base);\n }\n if (config.project) {\n Formio.setProjectUrl(config.project);\n }\n // Add premium modules\n if (global('premium')) {\n debug('Using premium module.');\n Formio.use(global('premium'));\n }\n if (global('vpat')) {\n debug('Using vpat module.');\n Formio.use(global('vpat'));\n }\n if (config.template) {\n if (config.includeLibs) {\n addStyles(config.libs[config.template].css);\n addScript(config.libs[config.template].js);\n if (config.libs[config.template].fa) {\n addStyles(config.libs.fontawesome.css, true);\n }\n }\n let templateSrc;\n if (cdn instanceof CDN_1.default) {\n templateSrc = `${cdn[config.template]}/${config.template}.min`;\n }\n else {\n templateSrc = `${cdn}/@formio/${config.template}@latest/dist/${config.template}.min`;\n }\n addStyles(`${templateSrc}.css`);\n addScript(`${templateSrc}.js`, config.template, (template) => {\n debug(`Using ${config.template}`);\n Formio.use(template);\n renderForm();\n });\n }\n else if (global('uswds')) {\n debug('Using uswds module.');\n Formio.use(global('uswds'));\n }\n // Default bootstrap + fontawesome.\n else if (config.includeLibs) {\n Formio.cdn = new CDN_1.default();\n config.libs = resolveLibs(query.cdn || Formio.cdn);\n addStyles(config.libs.fontawesome.css, true);\n addStyles(config.libs.bootstrap.css);\n }\n if (config.premium) {\n addStyles(config.premium.css);\n addScript(config.premium.js, 'premium', (premium) => {\n debug('Using premium');\n Formio.use(premium);\n renderForm();\n });\n }\n // Render the form if no template is provided.\n if (!config.template && !config.premium) {\n renderForm();\n }\n });\n }\n else {\n // Show an error if the script cannot be found.\n document.write('<span>Could not locate the Embedded form.</span>');\n }\n}\nexports.embed = embed;\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/Embed.js?");
|
40
|
-
|
41
|
-
/***/ }),
|
42
|
-
|
43
|
-
/***/ "./lib/cjs/formio.embed.js":
|
44
|
-
/*!*********************************!*\
|
45
|
-
!*** ./lib/cjs/formio.embed.js ***!
|
46
|
-
\*********************************/
|
47
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
48
|
-
|
49
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst Embed_1 = __webpack_require__(/*! ./Embed */ \"./lib/cjs/Embed.js\");\n(0, Embed_1.embed)();\n\n\n//# sourceURL=webpack://Formio/./lib/cjs/formio.embed.js?");
|
50
|
-
|
51
|
-
/***/ })
|
52
|
-
|
53
|
-
/******/ });
|
54
|
-
/************************************************************************/
|
55
|
-
/******/ // The module cache
|
56
|
-
/******/ var __webpack_module_cache__ = {};
|
57
|
-
/******/
|
58
|
-
/******/ // The require function
|
59
|
-
/******/ function __webpack_require__(moduleId) {
|
60
|
-
/******/ // Check if module is in cache
|
61
|
-
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
62
|
-
/******/ if (cachedModule !== undefined) {
|
63
|
-
/******/ return cachedModule.exports;
|
64
|
-
/******/ }
|
65
|
-
/******/ // Create a new module (and put it into the cache)
|
66
|
-
/******/ var module = __webpack_module_cache__[moduleId] = {
|
67
|
-
/******/ // no module.id needed
|
68
|
-
/******/ // no module.loaded needed
|
69
|
-
/******/ exports: {}
|
70
|
-
/******/ };
|
71
|
-
/******/
|
72
|
-
/******/ // Execute the module function
|
73
|
-
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
74
|
-
/******/
|
75
|
-
/******/ // Return the exports of the module
|
76
|
-
/******/ return module.exports;
|
77
|
-
/******/ }
|
78
|
-
/******/
|
79
|
-
/************************************************************************/
|
80
|
-
/******/
|
81
|
-
/******/ // startup
|
82
|
-
/******/ // Load entry module and return exports
|
83
|
-
/******/ // This entry module can't be inlined because the eval devtool is used.
|
84
|
-
/******/ var __webpack_exports__ = __webpack_require__("./lib/cjs/formio.embed.js");
|
85
|
-
/******/ __webpack_exports__ = __webpack_exports__.Formio;
|
86
|
-
/******/
|
87
|
-
/******/ return __webpack_exports__;
|
88
|
-
/******/ })()
|
89
|
-
;
|
90
|
-
});
|
1
|
+
/*! For license information please see formio.embed.min.js.LICENSE.txt */
|
2
|
+
!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.Formio=o():e.Formio=o()}(self,(function(){return function(){"use strict";var e={36310:function(e,o){Object.defineProperty(o,"__esModule",{value:!0}),o.default=class{constructor(e){this.baseUrl=e||"https://cdn.form.io",this.overrides={},this.libs={js:"",ace:"1.4.12",bootstrap:"4.6.2",ckeditor:"19.0.0",flatpickr:"4.6.8","flatpickr-formio":"4.6.13-formio.3","font-awesome":"4.7.0",grid:"latest","moment-timezone":"latest",quill:"2.0.0-dev.3","shortcut-buttons-flatpickr":"0.4.0",uswds:"2.4.8",core:""},this.updateUrls()}getVersion(e){return this.libs[e]}setVersion(e,o){this.libs[e]=o,this.updateUrls()}setBaseUrl(e){this.baseUrl=e,this.updateUrls()}setOverrideUrl(e,o){this.overrides[e]=o,this.updateUrls()}removeOverride(e){delete this.overrides[e],this.updateUrls()}removeOverrides(){this.overrides={},this.updateUrls()}buildUrl(e,o,i){let t;return t="latest"===i||""===i?`${e}/${o}`:`${e}/${o}/${i}`,t}updateUrls(){for(const e in this.libs)e in this.overrides?this[e]=this.buildUrl(this.overrides[e],e,this.libs[e]):this[e]=this.buildUrl(this.baseUrl,e,this.libs[e])}}},3805:function(e,o,i){var t=this&&this.__awaiter||function(e,o,i,t){return new(i||(i=Promise))((function(r,s){function n(e){try{l(t.next(e))}catch(e){s(e)}}function d(e){try{l(t.throw(e))}catch(e){s(e)}}function l(e){var o;e.done?r(e.value):(o=e.value,o instanceof i?o:new i((function(e){e(o)}))).then(n,d)}l((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.Formio=void 0;const s=r(i(36310));class n{static setBaseUrl(e){return t(this,void 0,void 0,(function*(){n.baseUrl=e}))}static setProjectUrl(e){return t(this,void 0,void 0,(function*(){n.projectUrl=e}))}static debug(...e){n.config.debug&&console.log(...e)}static global(e){const o=window[e];return o&&o.proxy?null:(n.debug(`Getting global ${e}`,o),o)}static createElement(e,o,i){const t=document.createElement(e);return Object.keys(o).forEach((e=>{t.setAttribute(e,o[e])})),(i||[]).forEach((e=>{t.appendChild(n.createElement(e.tag,e.attrs,e.children))})),t}static addScript(e,o){return t(this,void 0,void 0,(function*(){return e?"string"!=typeof e&&e.length?Promise.all(e.map((e=>n.addScript(e)))):o&&n.global(o)?(n.debug(`${o} already loaded.`),Promise.resolve(n.global(o))):(n.debug("Adding Script",e),n.wrapper.appendChild(n.createElement("script",{src:e})),o?new Promise((e=>{n.debug(`Waiting to load ${o}`);const i=setInterval((()=>{n.global(o)&&(clearInterval(i),n.debug(`${o} loaded.`),e(n.global(o)))}),100)})):Promise.resolve()):Promise.resolve()}))}static addStyles(e,o=!1){return t(this,void 0,void 0,(function*(){if(!e)return;if("string"!=typeof e&&e.length)return void e.forEach((e=>n.addStyles(e)));n.debug("Adding Styles",e);const i=n.createElement("link",{rel:"stylesheet",href:e});o&&document.head.appendChild(i),n.wrapper.appendChild(n.createElement("link",{rel:"stylesheet",href:e}))}))}static submitDone(e,o){return t(this,void 0,void 0,(function*(){n.debug("Submision Complete",o);let i=n.config.redirect;if(!i&&e._form&&e._form.settings&&(e._form.settings.returnUrl||e._form.settings.redirect)&&(n.debug("Return url found in form configuration"),i=e._form.settings.returnUrl||e._form.settings.redirect),i){const t=e.formio?e.formio.formUrl:"",r=!!i.match(/\?/),s=0===i.indexOf(location.origin);i+=r?"&":"?",i+=`sub=${o._id}`,!s&&t&&(i+=`&form=${encodeURIComponent(t)}`),n.debug("Return URL",i),window.location.href=i,s&&window.location.reload()}}))}static renderForm(e,o){return t(this,void 0,void 0,(function*(){return n.config.before&&(yield n.config.before(n.FormioClass,n.element,n.config)),n.FormioClass.license=!0,n.FormioClass.createForm(n.element,e,Object.assign(Object.assign({},o),{noLoader:!0})).then((e=>(n.debug("Form created",e),n.debug("Removing loader"),n.wrapper.removeChild(n.loader),n.config.submission&&(n.debug("Setting submission",n.config.submission),e.submission=n.config.submission),n.debug("Triggering embed event"),n.FormioClass.events.emit("formEmbedded",e),n.config.after&&(n.debug("Calling ready callback"),n.config.after(e,n.config)),e)))}))}static createForm(e,o,i){return t(this,void 0,void 0,(function*(){if(n.element=e,n.cdn=new s.default(n.config.cdn),n.config.libs=n.config.libs||{uswds:{fa:!0,js:`${n.cdn.uswds}/uswds.min.js`,css:`${n.cdn.uswds}/uswds.min.css`},fontawesome:{css:`${n.cdn["font-awesome"]}/css/font-awesome.min.css`},bootstrap:{css:`${n.cdn.bootstrap}/css/bootstrap.min.css`}},n.config.id=n.config.id||`formio-${Math.random().toString(36).substring(7)}`,n.wrapper=n.createElement("div",{id:`"${n.config.id}-wrapper"`}),e.parentNode.insertBefore(n.wrapper,e),e.parentNode.removeChild(e),n.wrapper.appendChild(e),yield n.addStyles(n.config.embedCSS||`${n.cdn.js}/formio.embed.css`),n.loader=n.createElement("div",{class:"formio-loader"},[{tag:"div",attrs:{class:"loader-wrapper"},children:[{tag:"div",attrs:{class:"loader text-center"}}]}]),n.wrapper.appendChild(n.loader),n.FormioClass=yield n.addScript(n.config.script||`${n.cdn.js}/formio.form.min.js`,"Formio"),n.FormioClass.setBaseUrl(n.baseUrl||n.config.base),n.FormioClass.setProjectUrl(n.projectUrl||n.config.project),n.FormioClass.language=n.language,n.global("premium")&&(n.debug("Using premium module."),n.FormioClass.use(n.global("premium"))),n.global("vpat")&&(n.debug("Using vpat module."),n.FormioClass.use(n.global("vpat"))),n.config.template){if(n.config.includeLibs&&(yield n.addStyles(n.config.libs[n.config.template].css),yield n.addScript(n.config.libs[n.config.template].js),n.config.libs[n.config.template].fa&&(yield n.addStyles(n.config.libs.fontawesome.css,!0))),n.cdn[n.config.template]){const e=`${n.cdn[n.config.template]}/${n.config.template}.min`;yield n.addStyles(`${e}.css`),n.debug(`Using ${n.config.template}`),n.FormioClass.use(yield n.addScript(`${e}.js`,n.config.template))}}else n.global("uswds")?(n.debug("Using uswds module."),n.FormioClass.use(n.global("uswds"))):n.config.includeLibs&&(yield n.addStyles(n.config.libs.fontawesome.css,!0),yield n.addStyles(n.config.libs.bootstrap.css));return n.config.premium&&(yield n.addStyles(n.config.premium.css),n.debug("Using premium"),n.FormioClass.use(yield n.addScript(n.config.premium.js,"premium"))),yield n.addStyles(n.config.style||`${n.cdn.js}/formio.form.min.css`),yield n.renderForm(o,i)}))}}n.config={},n.loader=null,n.cdn=null,n.proxy=!0,o.Formio=n}},o={};function i(t){var r=o[t];if(void 0!==r)return r.exports;var s=o[t]={exports:{}};return e[t].call(s.exports,s,s.exports,i),s.exports}var t={};return function(){var e=t;e.Formio=void 0;const o=i(3805);Object.defineProperty(e,"Formio",{enumerable:!0,get:function(){return o.Formio}});const r=document.getElementsByTagName("script"),s=window.FormioConfig||{};let n=null,d=r.length;const l=s.scriptName||"formio.embed.";for(;d--;)if(r[d].src&&-1!==r[d].src.indexOf(l)){n=r[d];break}if(n){const e={};n.src.replace(/^[^?]+\??/,"").replace(/\?/g,"&").split("&").forEach((o=>{e[o.split("=")[0]]=o.split("=")[1]&&decodeURIComponent(o.split("=")[1])}));let i=n.src.replace(/^([^?]+).*/,"$1").split("/");i.pop(),s.formioPath&&s.formioPath(i),i=i.join("/"),o.Formio.config=Object.assign({script:e.script||`${s.updatePath?s.updatePath():i}/formio.form.min.js`,style:e.styles||`${s.updatePath?s.updatePath():i}/formio.form.min.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:"true"===e.debug||"1"===e.debug,config:{},redirect:e.return||e.redirect,embedCSS:`${s.updatePath?s.updatePath():i}/formio.embed.css`,before:null,after:null},s);const t=o.Formio.config.form||o.Formio.config.src;if(t){o.Formio.debug("Embedding Configuration",s),o.Formio.config.addPremiumLib&&o.Formio.config.addPremiumLib(o.Formio.config,i),o.Formio.config.id=`formio-${Math.random().toString(36).substring(7)}`,o.Formio.debug("Creating form element");const e=o.Formio.createElement("div",{id:o.Formio.config.id,class:o.Formio.config.class});n.parentNode.insertBefore(e,n.parentNode.firstElementChild.nextSibling),o.Formio.createForm(e,t,o.Formio.config.config).then((e=>{o.Formio.config.submit&&(e.nosubmit=!0),e.on("submit",(i=>{if(o.Formio.debug("on('submit')",i),o.Formio.config.submit){o.Formio.debug(`Sending submission to ${o.Formio.config.submit}`);const t={"content-type":"application/json"},r=o.Formio.FormioClass.getToken();r&&(t["x-jwt-token"]=r),o.Formio.FormioClass.fetch(o.Formio.config.submit,{body:JSON.stringify(i),headers:t,method:"POST",mode:"cors"}).then((e=>e.json())).then((i=>o.Formio.submitDone(e,i)))}else o.Formio.submitDone(e,i)}))}))}}else document.write("<span>Could not locate the Embedded form.</span>")}(),t.Formio}()}));
|
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,
|
2
|
+
!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.Formio=o():e.Formio=o()}(self,(function(){return function(){"use strict";var e={36310:function(e,o){Object.defineProperty(o,"__esModule",{value:!0}),o.default=class{constructor(e){this.baseUrl=e||"https://cdn.form.io",this.overrides={},this.libs={js:"",ace:"1.4.12",bootstrap:"4.6.2",ckeditor:"19.0.0",flatpickr:"4.6.8","flatpickr-formio":"4.6.13-formio.3","font-awesome":"4.7.0",grid:"latest","moment-timezone":"latest",quill:"2.0.0-dev.3","shortcut-buttons-flatpickr":"0.4.0",uswds:"2.4.8",core:""},this.updateUrls()}getVersion(e){return this.libs[e]}setVersion(e,o){this.libs[e]=o,this.updateUrls()}setBaseUrl(e){this.baseUrl=e,this.updateUrls()}setOverrideUrl(e,o){this.overrides[e]=o,this.updateUrls()}removeOverride(e){delete this.overrides[e],this.updateUrls()}removeOverrides(){this.overrides={},this.updateUrls()}buildUrl(e,o,i){let t;return t="latest"===i||""===i?`${e}/${o}`:`${e}/${o}/${i}`,t}updateUrls(){for(const e in this.libs)e in this.overrides?this[e]=this.buildUrl(this.overrides[e],e,this.libs[e]):this[e]=this.buildUrl(this.baseUrl,e,this.libs[e])}}},3805:function(e,o,i){var t=this&&this.__awaiter||function(e,o,i,t){return new(i||(i=Promise))((function(r,s){function n(e){try{l(t.next(e))}catch(e){s(e)}}function d(e){try{l(t.throw(e))}catch(e){s(e)}}function l(e){var o;e.done?r(e.value):(o=e.value,o instanceof i?o:new i((function(e){e(o)}))).then(n,d)}l((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.Formio=void 0;const s=r(i(36310));class n{static setBaseUrl(e){return t(this,void 0,void 0,(function*(){n.baseUrl=e}))}static setProjectUrl(e){return t(this,void 0,void 0,(function*(){n.projectUrl=e}))}static debug(...e){n.config.debug&&console.log(...e)}static global(e){const o=window[e];return o&&o.proxy?null:(n.debug(`Getting global ${e}`,o),o)}static createElement(e,o,i){const t=document.createElement(e);return Object.keys(o).forEach((e=>{t.setAttribute(e,o[e])})),(i||[]).forEach((e=>{t.appendChild(n.createElement(e.tag,e.attrs,e.children))})),t}static addScript(e,o){return t(this,void 0,void 0,(function*(){return e?"string"!=typeof e&&e.length?Promise.all(e.map((e=>n.addScript(e)))):o&&n.global(o)?(n.debug(`${o} already loaded.`),Promise.resolve(n.global(o))):(n.debug("Adding Script",e),n.wrapper.appendChild(n.createElement("script",{src:e})),o?new Promise((e=>{n.debug(`Waiting to load ${o}`);const i=setInterval((()=>{n.global(o)&&(clearInterval(i),n.debug(`${o} loaded.`),e(n.global(o)))}),100)})):Promise.resolve()):Promise.resolve()}))}static addStyles(e,o=!1){return t(this,void 0,void 0,(function*(){if(!e)return;if("string"!=typeof e&&e.length)return void e.forEach((e=>n.addStyles(e)));n.debug("Adding Styles",e);const i=n.createElement("link",{rel:"stylesheet",href:e});o&&document.head.appendChild(i),n.wrapper.appendChild(n.createElement("link",{rel:"stylesheet",href:e}))}))}static submitDone(e,o){return t(this,void 0,void 0,(function*(){n.debug("Submision Complete",o);let i=n.config.redirect;if(!i&&e._form&&e._form.settings&&(e._form.settings.returnUrl||e._form.settings.redirect)&&(n.debug("Return url found in form configuration"),i=e._form.settings.returnUrl||e._form.settings.redirect),i){const t=e.formio?e.formio.formUrl:"",r=!!i.match(/\?/),s=0===i.indexOf(location.origin);i+=r?"&":"?",i+=`sub=${o._id}`,!s&&t&&(i+=`&form=${encodeURIComponent(t)}`),n.debug("Return URL",i),window.location.href=i,s&&window.location.reload()}}))}static renderForm(e,o){return t(this,void 0,void 0,(function*(){return n.config.before&&(yield n.config.before(n.FormioClass,n.element,n.config)),n.FormioClass.license=!0,n.FormioClass.createForm(n.element,e,Object.assign(Object.assign({},o),{noLoader:!0})).then((e=>(n.debug("Form created",e),n.debug("Removing loader"),n.wrapper.removeChild(n.loader),n.config.submission&&(n.debug("Setting submission",n.config.submission),e.submission=n.config.submission),n.debug("Triggering embed event"),n.FormioClass.events.emit("formEmbedded",e),n.config.after&&(n.debug("Calling ready callback"),n.config.after(e,n.config)),e)))}))}static createForm(e,o,i){return t(this,void 0,void 0,(function*(){if(n.element=e,n.cdn=new s.default(n.config.cdn),n.config.libs=n.config.libs||{uswds:{fa:!0,js:`${n.cdn.uswds}/uswds.min.js`,css:`${n.cdn.uswds}/uswds.min.css`},fontawesome:{css:`${n.cdn["font-awesome"]}/css/font-awesome.min.css`},bootstrap:{css:`${n.cdn.bootstrap}/css/bootstrap.min.css`}},n.config.id=n.config.id||`formio-${Math.random().toString(36).substring(7)}`,n.wrapper=n.createElement("div",{id:`"${n.config.id}-wrapper"`}),e.parentNode.insertBefore(n.wrapper,e),e.parentNode.removeChild(e),n.wrapper.appendChild(e),yield n.addStyles(n.config.embedCSS||`${n.cdn.js}/formio.embed.css`),n.loader=n.createElement("div",{class:"formio-loader"},[{tag:"div",attrs:{class:"loader-wrapper"},children:[{tag:"div",attrs:{class:"loader text-center"}}]}]),n.wrapper.appendChild(n.loader),n.FormioClass=yield n.addScript(n.config.script||`${n.cdn.js}/formio.form.min.js`,"Formio"),n.FormioClass.setBaseUrl(n.baseUrl||n.config.base),n.FormioClass.setProjectUrl(n.projectUrl||n.config.project),n.FormioClass.language=n.language,n.global("premium")&&(n.debug("Using premium module."),n.FormioClass.use(n.global("premium"))),n.global("vpat")&&(n.debug("Using vpat module."),n.FormioClass.use(n.global("vpat"))),n.config.template){if(n.config.includeLibs&&(yield n.addStyles(n.config.libs[n.config.template].css),yield n.addScript(n.config.libs[n.config.template].js),n.config.libs[n.config.template].fa&&(yield n.addStyles(n.config.libs.fontawesome.css,!0))),n.cdn[n.config.template]){const e=`${n.cdn[n.config.template]}/${n.config.template}.min`;yield n.addStyles(`${e}.css`),n.debug(`Using ${n.config.template}`),n.FormioClass.use(yield n.addScript(`${e}.js`,n.config.template))}}else n.global("uswds")?(n.debug("Using uswds module."),n.FormioClass.use(n.global("uswds"))):n.config.includeLibs&&(yield n.addStyles(n.config.libs.fontawesome.css,!0),yield n.addStyles(n.config.libs.bootstrap.css));return n.config.premium&&(yield n.addStyles(n.config.premium.css),n.debug("Using premium"),n.FormioClass.use(yield n.addScript(n.config.premium.js,"premium"))),yield n.addStyles(n.config.style||`${n.cdn.js}/formio.form.min.css`),yield n.renderForm(o,i)}))}}n.config={},n.loader=null,n.cdn=null,n.proxy=!0,o.Formio=n}},o={};function i(t){var r=o[t];if(void 0!==r)return r.exports;var s=o[t]={exports:{}};return e[t].call(s.exports,s,s.exports,i),s.exports}var t={};return function(){var e=t;e.Formio=void 0;const o=i(3805);Object.defineProperty(e,"Formio",{enumerable:!0,get:function(){return o.Formio}});const r=document.getElementsByTagName("script"),s=window.FormioConfig||{};let n=null,d=r.length;const l=s.scriptName||"formio.embed.";for(;d--;)if(r[d].src&&-1!==r[d].src.indexOf(l)){n=r[d];break}if(n){const e={};n.src.replace(/^[^?]+\??/,"").replace(/\?/g,"&").split("&").forEach((o=>{e[o.split("=")[0]]=o.split("=")[1]&&decodeURIComponent(o.split("=")[1])}));let i=n.src.replace(/^([^?]+).*/,"$1").split("/");i.pop(),s.formioPath&&s.formioPath(i),i=i.join("/"),o.Formio.config=Object.assign({script:e.script||`${s.updatePath?s.updatePath():i}/formio.form.min.js`,style:e.styles||`${s.updatePath?s.updatePath():i}/formio.form.min.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:"true"===e.debug||"1"===e.debug,config:{},redirect:e.return||e.redirect,embedCSS:`${s.updatePath?s.updatePath():i}/formio.embed.css`,before:null,after:null},s);const t=o.Formio.config.form||o.Formio.config.src;if(t){o.Formio.debug("Embedding Configuration",s),o.Formio.config.addPremiumLib&&o.Formio.config.addPremiumLib(o.Formio.config,i),o.Formio.config.id=`formio-${Math.random().toString(36).substring(7)}`,o.Formio.debug("Creating form element");const e=o.Formio.createElement("div",{id:o.Formio.config.id,class:o.Formio.config.class});n.parentNode.insertBefore(e,n.parentNode.firstElementChild.nextSibling),o.Formio.createForm(e,t,o.Formio.config.config).then((e=>{o.Formio.config.submit&&(e.nosubmit=!0),e.on("submit",(i=>{if(o.Formio.debug("on('submit')",i),o.Formio.config.submit){o.Formio.debug(`Sending submission to ${o.Formio.config.submit}`);const t={"content-type":"application/json"},r=o.Formio.FormioClass.getToken();r&&(t["x-jwt-token"]=r),o.Formio.FormioClass.fetch(o.Formio.config.submit,{body:JSON.stringify(i),headers:t,method:"POST",mode:"cors"}).then((e=>e.json())).then((i=>o.Formio.submitDone(e,i)))}else o.Formio.submitDone(e,i)}))}))}}else document.write("<span>Could not locate the Embedded form.</span>")}(),t.Formio}()}));
|
@@ -1 +1 @@
|
|
1
|
-
/*! formiojs v5.0.0-rc.
|
1
|
+
/*! formiojs v5.0.0-rc.21 | https://unpkg.com/formiojs@5.0.0-rc.21/LICENSE.txt */
|