@formio/js 5.0.0-rc.20 → 5.0.0-rc.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (198) hide show
  1. package/dist/formio.embed.css +1 -39
  2. package/dist/formio.embed.js +2 -90
  3. package/dist/formio.embed.min.js +1 -1
  4. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  5. package/dist/formio.form.js +58 -36
  6. package/dist/formio.form.min.js +1 -1
  7. package/dist/formio.form.min.js.LICENSE.txt +1 -1
  8. package/dist/formio.full.js +59 -37
  9. package/dist/formio.full.min.js +1 -1
  10. package/dist/formio.full.min.js.LICENSE.txt +1 -1
  11. package/dist/formio.js +2 -2
  12. package/dist/formio.min.js +1 -1
  13. package/dist/formio.min.js.LICENSE.txt +1 -1
  14. package/dist/formio.utils.js +1 -1
  15. package/dist/formio.utils.min.js +1 -1
  16. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  17. package/lib/cjs/CDN.d.ts +1 -0
  18. package/lib/cjs/CDN.js +1 -0
  19. package/lib/cjs/Element.js +5 -0
  20. package/lib/cjs/Embed.d.ts +21 -1
  21. package/lib/cjs/Embed.js +211 -308
  22. package/lib/cjs/Form.d.ts +1 -1
  23. package/lib/cjs/Form.js +1 -1
  24. package/lib/cjs/Webform.d.ts +6 -6
  25. package/lib/cjs/Webform.js +6 -6
  26. package/lib/cjs/WebformBuilder.js +1 -1
  27. package/lib/cjs/components/_classes/component/Component.d.ts +16 -6
  28. package/lib/cjs/components/_classes/component/Component.js +26 -6
  29. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
  30. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +4 -0
  31. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
  32. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +4 -0
  33. package/lib/cjs/components/address/Address.js +5 -0
  34. package/lib/cjs/components/button/Button.d.ts +1 -0
  35. package/lib/cjs/components/button/Button.js +3 -0
  36. package/lib/cjs/components/checkbox/Checkbox.d.ts +28 -0
  37. package/lib/cjs/components/checkbox/Checkbox.js +17 -2
  38. package/lib/cjs/components/columns/Columns.d.ts +1 -0
  39. package/lib/cjs/components/columns/Columns.js +3 -0
  40. package/lib/cjs/components/container/Container.js +3 -0
  41. package/lib/cjs/components/content/Content.d.ts +1 -0
  42. package/lib/cjs/components/content/Content.js +3 -0
  43. package/lib/cjs/components/datamap/DataMap.d.ts +1 -0
  44. package/lib/cjs/components/datamap/DataMap.js +3 -0
  45. package/lib/cjs/components/datetime/DateTime.d.ts +19 -0
  46. package/lib/cjs/components/datetime/DateTime.js +9 -10
  47. package/lib/cjs/components/day/Day.d.ts +21 -0
  48. package/lib/cjs/components/day/Day.js +12 -10
  49. package/lib/cjs/components/day/fixtures/comp5.d.ts +29 -0
  50. package/lib/cjs/components/day/fixtures/comp5.js +32 -0
  51. package/lib/cjs/components/day/fixtures/index.d.ts +2 -1
  52. package/lib/cjs/components/day/fixtures/index.js +3 -1
  53. package/lib/cjs/components/fieldset/Fieldset.d.ts +1 -0
  54. package/lib/cjs/components/fieldset/Fieldset.js +3 -0
  55. package/lib/cjs/components/file/File.d.ts +21 -1
  56. package/lib/cjs/components/file/File.js +15 -7
  57. package/lib/cjs/components/form/Form.d.ts +1 -0
  58. package/lib/cjs/components/form/Form.js +5 -1
  59. package/lib/cjs/components/html/HTML.d.ts +1 -0
  60. package/lib/cjs/components/html/HTML.js +3 -0
  61. package/lib/cjs/components/number/Number.d.ts +20 -1
  62. package/lib/cjs/components/number/Number.js +10 -15
  63. package/lib/cjs/components/panel/Panel.d.ts +1 -0
  64. package/lib/cjs/components/panel/Panel.js +3 -0
  65. package/lib/cjs/components/radio/Radio.d.ts +19 -0
  66. package/lib/cjs/components/radio/Radio.js +30 -0
  67. package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -0
  68. package/lib/cjs/components/recaptcha/ReCaptcha.js +3 -0
  69. package/lib/cjs/components/select/Select.d.ts +19 -1
  70. package/lib/cjs/components/select/Select.js +39 -4
  71. package/lib/cjs/components/select/fixtures/comp19.d.ts +23 -0
  72. package/lib/cjs/components/select/fixtures/comp19.js +36 -0
  73. package/lib/cjs/components/select/fixtures/index.d.ts +2 -1
  74. package/lib/cjs/components/select/fixtures/index.js +3 -1
  75. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +26 -1
  76. package/lib/cjs/components/selectboxes/SelectBoxes.js +8 -1
  77. package/lib/cjs/components/signature/Signature.d.ts +21 -0
  78. package/lib/cjs/components/signature/Signature.js +9 -1
  79. package/lib/cjs/components/survey/Survey.d.ts +21 -0
  80. package/lib/cjs/components/survey/Survey.js +7 -1
  81. package/lib/cjs/components/table/Table.d.ts +1 -0
  82. package/lib/cjs/components/table/Table.js +3 -0
  83. package/lib/cjs/components/tabs/Tabs.d.ts +1 -0
  84. package/lib/cjs/components/tabs/Tabs.js +3 -0
  85. package/lib/cjs/components/tags/Tags.d.ts +21 -0
  86. package/lib/cjs/components/tags/Tags.js +11 -1
  87. package/lib/cjs/components/tags/fixtures/comp6.d.ts +17 -0
  88. package/lib/cjs/components/tags/fixtures/comp6.js +20 -0
  89. package/lib/cjs/components/tags/fixtures/index.d.ts +2 -1
  90. package/lib/cjs/components/tags/fixtures/index.js +3 -1
  91. package/lib/cjs/components/textfield/TextField.d.ts +21 -0
  92. package/lib/cjs/components/textfield/TextField.js +7 -1
  93. package/lib/cjs/components/time/Time.d.ts +8 -1
  94. package/lib/cjs/components/well/Well.d.ts +1 -0
  95. package/lib/cjs/components/well/Well.js +3 -0
  96. package/lib/cjs/formio.embed.d.ts +2 -1
  97. package/lib/cjs/formio.embed.js +96 -1
  98. package/lib/cjs/formio.form.d.ts +4 -3
  99. package/lib/cjs/formio.form.js +17 -8
  100. package/lib/cjs/licenses/Licenses.d.ts +7 -0
  101. package/lib/cjs/licenses/Licenses.js +22 -0
  102. package/lib/cjs/licenses/index.d.ts +2 -0
  103. package/lib/cjs/licenses/index.js +7 -0
  104. package/lib/cjs/utils/utils.d.ts +10 -0
  105. package/lib/cjs/utils/utils.js +21 -1
  106. package/lib/mjs/CDN.d.ts +1 -0
  107. package/lib/mjs/CDN.js +1 -0
  108. package/lib/mjs/Element.js +5 -0
  109. package/lib/mjs/Embed.d.ts +21 -1
  110. package/lib/mjs/Embed.js +208 -322
  111. package/lib/mjs/Form.d.ts +1 -1
  112. package/lib/mjs/Form.js +1 -1
  113. package/lib/mjs/Webform.d.ts +6 -6
  114. package/lib/mjs/Webform.js +6 -6
  115. package/lib/mjs/WebformBuilder.js +1 -1
  116. package/lib/mjs/components/_classes/component/Component.d.ts +16 -6
  117. package/lib/mjs/components/_classes/component/Component.js +26 -6
  118. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
  119. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +4 -0
  120. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
  121. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +4 -0
  122. package/lib/mjs/components/address/Address.js +5 -0
  123. package/lib/mjs/components/button/Button.d.ts +1 -0
  124. package/lib/mjs/components/button/Button.js +4 -1
  125. package/lib/mjs/components/checkbox/Checkbox.d.ts +28 -0
  126. package/lib/mjs/components/checkbox/Checkbox.js +18 -3
  127. package/lib/mjs/components/columns/Columns.d.ts +1 -0
  128. package/lib/mjs/components/columns/Columns.js +3 -0
  129. package/lib/mjs/components/container/Container.js +4 -1
  130. package/lib/mjs/components/content/Content.d.ts +1 -0
  131. package/lib/mjs/components/content/Content.js +3 -0
  132. package/lib/mjs/components/datamap/DataMap.d.ts +1 -0
  133. package/lib/mjs/components/datamap/DataMap.js +4 -1
  134. package/lib/mjs/components/datetime/DateTime.d.ts +19 -0
  135. package/lib/mjs/components/datetime/DateTime.js +11 -12
  136. package/lib/mjs/components/day/Day.d.ts +21 -0
  137. package/lib/mjs/components/day/Day.js +16 -14
  138. package/lib/mjs/components/day/fixtures/comp5.d.ts +29 -0
  139. package/lib/mjs/components/day/fixtures/comp5.js +30 -0
  140. package/lib/mjs/components/day/fixtures/index.d.ts +2 -1
  141. package/lib/mjs/components/day/fixtures/index.js +2 -1
  142. package/lib/mjs/components/fieldset/Fieldset.d.ts +1 -0
  143. package/lib/mjs/components/fieldset/Fieldset.js +3 -0
  144. package/lib/mjs/components/file/File.d.ts +21 -1
  145. package/lib/mjs/components/file/File.js +16 -8
  146. package/lib/mjs/components/form/Form.d.ts +1 -0
  147. package/lib/mjs/components/form/Form.js +6 -2
  148. package/lib/mjs/components/html/HTML.d.ts +1 -0
  149. package/lib/mjs/components/html/HTML.js +3 -0
  150. package/lib/mjs/components/number/Number.d.ts +20 -1
  151. package/lib/mjs/components/number/Number.js +11 -12
  152. package/lib/mjs/components/panel/Panel.d.ts +1 -0
  153. package/lib/mjs/components/panel/Panel.js +3 -0
  154. package/lib/mjs/components/radio/Radio.d.ts +19 -0
  155. package/lib/mjs/components/radio/Radio.js +34 -1
  156. package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -0
  157. package/lib/mjs/components/recaptcha/ReCaptcha.js +3 -0
  158. package/lib/mjs/components/select/Select.d.ts +19 -1
  159. package/lib/mjs/components/select/Select.js +41 -6
  160. package/lib/mjs/components/select/fixtures/comp19.d.ts +23 -0
  161. package/lib/mjs/components/select/fixtures/comp19.js +34 -0
  162. package/lib/mjs/components/select/fixtures/index.d.ts +2 -1
  163. package/lib/mjs/components/select/fixtures/index.js +2 -1
  164. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +26 -1
  165. package/lib/mjs/components/selectboxes/SelectBoxes.js +8 -1
  166. package/lib/mjs/components/signature/Signature.d.ts +21 -0
  167. package/lib/mjs/components/signature/Signature.js +9 -1
  168. package/lib/mjs/components/survey/Survey.d.ts +21 -0
  169. package/lib/mjs/components/survey/Survey.js +8 -2
  170. package/lib/mjs/components/table/Table.d.ts +1 -0
  171. package/lib/mjs/components/table/Table.js +3 -0
  172. package/lib/mjs/components/tabs/Tabs.d.ts +1 -0
  173. package/lib/mjs/components/tabs/Tabs.js +3 -0
  174. package/lib/mjs/components/tags/Tags.d.ts +21 -0
  175. package/lib/mjs/components/tags/Tags.js +12 -2
  176. package/lib/mjs/components/tags/fixtures/comp6.d.ts +17 -0
  177. package/lib/mjs/components/tags/fixtures/comp6.js +18 -0
  178. package/lib/mjs/components/tags/fixtures/index.d.ts +2 -1
  179. package/lib/mjs/components/tags/fixtures/index.js +2 -1
  180. package/lib/mjs/components/textfield/TextField.d.ts +21 -0
  181. package/lib/mjs/components/textfield/TextField.js +8 -2
  182. package/lib/mjs/components/time/Time.d.ts +8 -1
  183. package/lib/mjs/components/well/Well.d.ts +1 -0
  184. package/lib/mjs/components/well/Well.js +3 -0
  185. package/lib/mjs/formio.embed.d.ts +2 -1
  186. package/lib/mjs/formio.embed.js +96 -2
  187. package/lib/mjs/formio.form.d.ts +4 -3
  188. package/lib/mjs/formio.form.js +16 -8
  189. package/lib/mjs/licenses/Licenses.d.ts +7 -0
  190. package/lib/mjs/licenses/Licenses.js +17 -0
  191. package/lib/mjs/licenses/index.d.ts +2 -0
  192. package/lib/mjs/licenses/index.js +2 -0
  193. package/lib/mjs/utils/utils.d.ts +10 -0
  194. package/lib/mjs/utils/utils.js +19 -0
  195. package/package.json +5 -1
  196. package/types/index.d.ts +1 -0
  197. package/types/licenses.d.ts +7 -0
  198. package/types/utils.d.ts +2 -0
@@ -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)}}
@@ -1,90 +1,2 @@
1
- /*
2
- * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
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}()}));
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see formio.embed.min.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Formio=t():e.Formio=t()}(self,(function(){return function(){"use strict";var e={36310:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e){this.baseUrl=e||"https://cdn.form.io",this.overrides={},this.libs={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,t){this.libs[e]=t,this.updateUrls()}setBaseUrl(e){this.baseUrl=e,this.updateUrls()}setOverrideUrl(e,t){this.overrides[e]=t,this.updateUrls()}removeOverride(e){delete this.overrides[e],this.updateUrls()}removeOverrides(){this.overrides={},this.updateUrls()}buildUrl(e,t,s){let i;return i="latest"===s||""===s?`${e}/${t}`:`${e}/${t}/${s}`,i}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,t,s){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.embed=void 0;const o=i(s(36310));t.embed=function(e={}){const t=document.getElementsByTagName("script");e=Object.assign(e,window.FormioConfig);let s=null,i=t.length;const r=e.scriptName||"formio.embed.";for(;i--;)if(t[i].src&&-1!==t[i].src.indexOf(r)){s=t[i];break}if(s){const t={};s.src.replace(/^[^?]+\??/,"").replace(/\?/g,"&").split("&").forEach((e=>{t[e.split("=")[0]]=e.split("=")[1]&&decodeURIComponent(e.split("=")[1])}));let i=s.src.replace(/^([^?]+).*/,"$1").split("/");i.pop(),e.formioPath&&e.formioPath(i),i=i.join("/"),t.script=t.script||`${e.updatePath?e.updatePath():i}/formio.form.min.js`,t.styles=t.styles||`${e.updatePath?e.updatePath():i}/formio.form.min.css`;const r=t.cdn||"https://cdn.jsdelivr.net/npm",n=e=>{const t={uswds:{fa:!0,js:`${e}/uswds@2.10.0/dist/js/uswds.min.js`,css:`${e}/uswds@2.10.0/dist/css/uswds.min.css`},fontawesome:{css:`${e}/font-awesome@4.7.0/css/font-awesome.min.css`},bootstrap:{css:`${e}/bootstrap@4.6.0/dist/css/bootstrap.min.css`}};if(e instanceof o.default){const s=e.baseUrl;t.uswds.js=`${s}/uswds/${e.getVersion("uswds")}/uswds.min.js`,t.uswds.css=`${s}/uswds/${e.getVersion("uswds")}/uswds.min.css`,t.fontawesome.css=`${s}/font-awesome/${e.getVersion("font-awesome")}/css/font-awesome.min.css`,t.bootstrap.css=`${s}/bootstrap/${e.getVersion("bootstrap")}/css/bootstrap.min.css`}return t};e=Object.assign({script:t.script,style:t.styles,class:t.class||"formio-form-wrapper",src:t.src,form:null,submission:null,project:t.project,base:t.base,submit:t.submit,includeLibs:"true"===t.libs||"1"===t.libs,template:t.template,debug:"true"===t.debug||"1"===t.debug,config:{},redirect:t.return||t.redirect,before:()=>{},after:()=>{}},e);const a=(...t)=>{e.debug&&console.log(...t)},d=(e,t,s)=>{const i=document.createElement(e);for(const e in t)t.hasOwnProperty(e)&&i.setAttribute(e,t[e]);return(s||[]).forEach((e=>{i.appendChild(d(e.tag,e.attrs,e.children))})),i};a("Embedding Configuration",e),e.addPremiumLib&&e.addPremiumLib(e,i);const l=`formio-${Math.random().toString(36).substring(7)}`;e.id=l,a("Creating form wrapper");let c=d("div",{id:`"${l}-wrapper"`});s.parentNode.insertBefore(c,s.parentNode.firstElementChild.nextSibling),e.includeLibs&&"function"==typeof c.attachShadow&&!e.premium&&(c=c.attachShadow({mode:"open"}),e.config.shadowRoot=c);const m=e=>{const t=window[e];return a(`Getting global ${e}`,t),t},u=(e,t)=>{if(!e)return;if("string"!=typeof e&&e.length)return void e.forEach((e=>u(e)));a("Adding Styles",e);const s=d("link",{rel:"stylesheet",href:e});t&&document.head.appendChild(s),c.appendChild(d("link",{rel:"stylesheet",href:e}))},p=(e,t,s)=>{if(e)if("string"!=typeof e&&e.length)e.forEach((e=>p(e)));else{if(t&&m(t))return a(`${t} already loaded.`),m(t);if(a("Adding Script",e),c.appendChild(d("script",{src:e})),t&&s){a(`Waiting to load ${t}`);const e=setInterval((()=>{m(t)&&(clearInterval(e),a(`${t} loaded.`),s(m(t)))}),100)}}};u(`${e.updatePath?e.updatePath():i}/formio.embed.min.css`),a("Creating loader");const f=d("div",{class:"formio-loader"},[{tag:"div",attrs:{class:"loader-wrapper"},children:[{tag:"div",attrs:{class:"loader text-center"}}]}]);c.appendChild(f),a("Creating form element");const b=d("div",{class:e.class});c.appendChild(b),p(e.script,"Formio",(s=>{const i=()=>{u(e.style);const t=e.before(s,b,e)||s.Promise.resolve(),i=e.form||e.src;a("Creating form",i,e.config),t.then((()=>{s.license=!0,s.createForm(b,i,Object.assign(Object.assign({},e.config),{noLoader:!0})).then((t=>{const i=s=>{a("Submision Complete",s);let i=e.redirect;if(!i&&t._form&&t._form.settings&&(t._form.settings.returnUrl||t._form.settings.redirect)&&(a("Return url found in form configuration"),i=t._form.settings.returnUrl||t._form.settings.redirect),i){const e=t.formio?t.formio.formUrl:"",o=!!i.match(/\?/),r=0===i.indexOf(location.origin);i+=o?"&":"?",i+=`sub=${s._id}`,!r&&e&&(i+=`&form=${encodeURIComponent(e)}`),a("Return URL",i),window.location.href=i,r&&window.location.reload()}};e.submit&&(t.nosubmit=!0),a("Form created",t),a("Removing loader"),c.removeChild(f),e.submission&&(a("Setting submission",e.submission),t.submission=e.submission),a("Triggering embed event"),s.events.emit("formEmbedded",t),a("Calling ready callback"),e.after(t,e),t.on("submit",(t=>{if(a("on('submit')",t),e.submit){a(`Sending submission to ${e.submit}`);const o={"content-type":"application/json"},r=s.getToken();r&&(o["x-jwt-token"]=r),s.fetch(e.submit,{body:JSON.stringify(t),headers:o,method:"POST",mode:"cors"}).then((e=>e.json())).then((e=>i(e)))}else i(t)}))}))}))};if(e.base&&s.setBaseUrl(e.base),e.project&&s.setProjectUrl(e.project),m("premium")&&(a("Using premium module."),s.use(m("premium"))),m("vpat")&&(a("Using vpat module."),s.use(m("vpat"))),e.template){let t;e.includeLibs&&(u(e.libs[e.template].css),p(e.libs[e.template].js),e.libs[e.template].fa&&u(e.libs.fontawesome.css,!0)),t=r instanceof o.default?`${r[e.template]}/${e.template}.min`:`${r}/@formio/${e.template}@latest/dist/${e.template}.min`,u(`${t}.css`),p(`${t}.js`,e.template,(t=>{a(`Using ${e.template}`),s.use(t),i()}))}else m("uswds")?(a("Using uswds module."),s.use(m("uswds"))):e.includeLibs&&(s.cdn=new o.default,e.libs=n(t.cdn||s.cdn),u(e.libs.fontawesome.css,!0),u(e.libs.bootstrap.css));e.premium&&(u(e.premium.css),p(e.premium.js,"premium",(e=>{a("Using premium"),s.use(e),i()}))),e.template||e.premium||i()}))}else document.write("<span>Could not locate the Embedded form.</span>")}}},t={};var s={};return(0,function s(i){var o=t[i];if(void 0!==o)return o.exports;var r=t[i]={exports:{}};return e[i].call(r.exports,r,r.exports,s),r.exports}(3805).embed)(),s.Formio}()}));
2
+ !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.Formio=o():e.Formio=o()}(self,(function(){return function(){"use strict";var e={36310:function(e,o){Object.defineProperty(o,"__esModule",{value:!0}),o.default=class{constructor(e){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.20 | https://unpkg.com/formiojs@5.0.0-rc.20/LICENSE.txt */
1
+ /*! formiojs v5.0.0-rc.22 | https://unpkg.com/formiojs@5.0.0-rc.22/LICENSE.txt */