formiojs-eorion 0.1.21 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/Formio.js +1 -1
  2. package/components/Chart/Chart.js +9 -16
  3. package/components/CustomCheckBox/CustomCheckBox.js +7 -14
  4. package/components/CustomFile/CustomFile.js +65 -72
  5. package/components/CustomRadio/CustomRadio.js +13 -21
  6. package/components/CustomSelect/CustomSelect.js +32 -40
  7. package/components/CustomTable/CustomTable.js +7 -15
  8. package/components/CustomTextArea/CustomTextArea.js +4 -3
  9. package/components/CustomTextField/CustomTextField.js +7 -14
  10. package/components/Data/Data.js +15 -23
  11. package/components/DataChinaGrid/Data.js +2 -1
  12. package/components/DataChinaGridRow/Data.js +2 -1
  13. package/components/DataSource/DataSource.js +2 -1
  14. package/components/Department/Department.js +10 -17
  15. package/components/LocationInputTextField/LocationInputTextField.js +7 -14
  16. package/components/NocodbFile/NocodbFile.js +65 -72
  17. package/components/QrCode/QrCode.js +6 -13
  18. package/components/ScanInputTextField/ScanInputTextField.js +7 -14
  19. package/components/TaskCalendar/TaskCalendar.js +8 -16
  20. package/components/_classes/Department/Department.js +10 -17
  21. package/components/button/Button.js +2 -1
  22. package/components/echarts/ECharts.js +2 -1
  23. package/components/file/File.js +63 -71
  24. package/components/iconButton/IconButton.js +2 -1
  25. package/components/map/Map.js +14 -22
  26. package/components/progress/Progress.js +2 -1
  27. package/components/radio/Radio.js +45 -53
  28. package/components/select/Select.js +102 -110
  29. package/components/tree/Tree.js +10 -17
  30. package/dist/formio.contrib.js +2 -2
  31. package/dist/formio.contrib.min.js +1 -1
  32. package/dist/formio.contrib.min.js.LICENSE.txt +1 -1
  33. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  34. package/dist/formio.form.js +27 -27
  35. package/dist/formio.form.min.js +1 -1
  36. package/dist/formio.form.min.js.LICENSE.txt +1 -1
  37. package/dist/formio.full.js +27 -27
  38. package/dist/formio.full.min.js +1 -1
  39. package/dist/formio.full.min.js.LICENSE.txt +1 -1
  40. package/dist/formio.js +1 -1
  41. package/dist/formio.min.js +1 -1
  42. package/dist/formio.min.js.LICENSE.txt +1 -1
  43. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  44. package/package.json +1 -1
@@ -81,7 +81,7 @@ eval("\n\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js
81
81
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
82
82
 
83
83
  "use strict";
84
- eval("\n\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.array.slice.js */ \"./node_modules/core-js/modules/es.array.slice.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.array.from.js */ \"./node_modules/core-js/modules/es.array.from.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = exports.GlobalFormio = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.match.js */ \"./node_modules/core-js/modules/es.string.match.js\");\n__webpack_require__(/*! core-js/modules/es.string.search.js */ \"./node_modules/core-js/modules/es.string.search.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.constructor.js */ \"./node_modules/core-js/modules/es.regexp.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.array.join.js */ \"./node_modules/core-js/modules/es.array.join.js\");\n__webpack_require__(/*! core-js/modules/es.array.includes.js */ \"./node_modules/core-js/modules/es.array.includes.js\");\n__webpack_require__(/*! core-js/modules/es.string.includes.js */ \"./node_modules/core-js/modules/es.string.includes.js\");\n__webpack_require__(/*! core-js/modules/es.object.assign.js */ \"./node_modules/core-js/modules/es.object.assign.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.array.filter.js */ \"./node_modules/core-js/modules/es.array.filter.js\");\n__webpack_require__(/*! core-js/modules/es.array.sort.js */ \"./node_modules/core-js/modules/es.array.sort.js\");\n__webpack_require__(/*! core-js/modules/es.array.map.js */ \"./node_modules/core-js/modules/es.array.map.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nvar _nativePromiseOnly = _interopRequireDefault(__webpack_require__(/*! native-promise-only */ \"./node_modules/native-promise-only/lib/npo.src.js\"));\nvar _fetchPonyfill2 = _interopRequireDefault(__webpack_require__(/*! fetch-ponyfill */ \"./node_modules/fetch-ponyfill/build/fetch-browser.js\"));\nvar _EventEmitter = _interopRequireDefault(__webpack_require__(/*! ./EventEmitter */ \"./lib/EventEmitter.js\"));\nvar _browserCookies = _interopRequireDefault(__webpack_require__(/*! browser-cookies */ \"./node_modules/browser-cookies/src/browser-cookies.js\"));\nvar _providers = _interopRequireDefault(__webpack_require__(/*! ./providers */ \"./lib/providers/index.js\"));\nvar _intersection2 = _interopRequireDefault(__webpack_require__(/*! lodash/intersection */ \"./node_modules/lodash/intersection.js\"));\nvar _get2 = _interopRequireDefault(__webpack_require__(/*! lodash/get */ \"./node_modules/lodash/get.js\"));\nvar _cloneDeep2 = _interopRequireDefault(__webpack_require__(/*! lodash/cloneDeep */ \"./node_modules/lodash/cloneDeep.js\"));\nvar _defaults2 = _interopRequireDefault(__webpack_require__(/*! lodash/defaults */ \"./node_modules/lodash/defaults.js\"));\nvar _utils = __webpack_require__(/*! ./utils/utils */ \"./lib/utils/utils.js\");\nvar _jwtDecode = _interopRequireDefault(__webpack_require__(/*! jwt-decode */ \"./node_modules/jwt-decode/build/jwt-decode.esm.js\"));\n__webpack_require__(/*! ./polyfills */ \"./lib/polyfills/index.js\");\nvar _CDN = _interopRequireDefault(__webpack_require__(/*! ./CDN */ \"./lib/CDN.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : \"undefined\" != typeof Symbol && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nvar _fetchPonyfill = (0, _fetchPonyfill2.default)({\n Promise: _nativePromiseOnly.default\n }),\n fetch = _fetchPonyfill.fetch,\n Headers = _fetchPonyfill.Headers;\nvar isBoolean = function isBoolean(val) {\n return _typeof(val) === _typeof(true);\n};\nvar isNil = function isNil(val) {\n return val === null || val === undefined;\n};\nvar isObject = function isObject(val) {\n return val && _typeof(val) === 'object';\n};\nfunction cloneResponse(response) {\n var copy = (0, _cloneDeep2.default)(response);\n if (Array.isArray(response)) {\n copy.skip = response.skip;\n copy.limit = response.limit;\n copy.serverCount = response.serverCount;\n }\n return copy;\n}\n\n/**\n * The Formio interface class.\n *\n * let formio = new Formio('https://examples.form.io/example');\n */\nvar Formio = /*#__PURE__*/function () {\n /* eslint-disable max-statements */\n function Formio(path) {\n var _this = this;\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n _classCallCheck(this, Formio);\n // Ensure we have an instance of Formio.\n if (!(this instanceof Formio)) {\n return new Formio(path);\n }\n\n // Initialize our variables.\n this.base = '';\n this.projectsUrl = '';\n this.projectUrl = '';\n this.projectId = '';\n this.roleUrl = '';\n this.rolesUrl = '';\n this.roleId = '';\n this.formUrl = '';\n this.formsUrl = '';\n this.formId = '';\n this.submissionsUrl = '';\n this.submissionUrl = '';\n this.submissionId = '';\n this.actionsUrl = '';\n this.actionId = '';\n this.actionUrl = '';\n this.vsUrl = '';\n this.vId = '';\n this.vUrl = '';\n this.query = '';\n\n // Store the original path and options.\n this.path = path;\n this.options = options;\n if (options.useSessionToken) {\n Formio.useSessionToken(options);\n }\n if (options.hasOwnProperty('base')) {\n this.base = options.base;\n } else if (Formio.baseUrl) {\n this.base = Formio.baseUrl;\n } else if (typeof window !== 'undefined') {\n this.base = window.location.href.match(/http[s]?:\\/\\/api./)[0];\n }\n if (!path) {\n // Allow user to create new projects if this was instantiated without\n // a url\n this.projectUrl = Formio.projectUrl || \"\".concat(this.base, \"/project\");\n this.projectsUrl = \"\".concat(this.base, \"/project\");\n this.projectId = false;\n this.query = '';\n return;\n }\n if (options.hasOwnProperty('project')) {\n this.projectUrl = options.project;\n }\n var project = this.projectUrl || Formio.projectUrl;\n var projectRegEx = /(^|\\/)(project)($|\\/[^/]+)/;\n var isProjectUrl = path.search(projectRegEx) !== -1;\n\n // The baseURL is the same as the projectUrl, and does not contain \"/project/MONGO_ID\" in\n // its domain. This is almost certainly against the Open Source server.\n if (project && this.base === project && !isProjectUrl) {\n this.noProject = true;\n this.projectUrl = this.base;\n }\n\n // Normalize to an absolute path.\n if (path.indexOf('http') !== 0 && path.indexOf('//') !== 0) {\n path = this.base + path;\n }\n var hostparts = this.getUrlParts(path);\n var parts = [];\n var hostName = hostparts[1] + hostparts[2];\n path = hostparts.length > 3 ? hostparts[3] : '';\n var queryparts = path.split('?');\n if (queryparts.length > 1) {\n path = queryparts[0];\n this.query = \"?\".concat(queryparts[1]);\n }\n\n // Register a specific path.\n var registerPath = function registerPath(name, base) {\n _this[\"\".concat(name, \"sUrl\")] = \"\".concat(base, \"/\").concat(name);\n var regex = new RegExp(\"/\".concat(name, \"/([^/]+)\"));\n if (path.search(regex) !== -1) {\n parts = path.match(regex);\n _this[\"\".concat(name, \"Url\")] = parts ? base + parts[0] : '';\n _this[\"\".concat(name, \"Id\")] = parts.length > 1 ? parts[1] : '';\n base += parts[0];\n }\n return base;\n };\n\n // Register an array of items.\n var registerItems = function registerItems(items, base, staticBase) {\n for (var i in items) {\n if (items.hasOwnProperty(i)) {\n var item = items[i];\n if (Array.isArray(item)) {\n registerItems(item, base, true);\n } else {\n var newBase = registerPath(item, base);\n base = staticBase ? base : newBase;\n }\n }\n }\n };\n if (!this.projectUrl || this.projectUrl === this.base) {\n // If a project uses Subdirectories path type, we need to specify a projectUrl\n if (!this.projectUrl && !isProjectUrl && Formio.pathType === 'Subdirectories') {\n var regex = \"^\".concat(hostName.replace(/\\//g, '\\\\/'), \".[^/]+\");\n var match = project.match(new RegExp(regex));\n this.projectUrl = match ? match[0] : hostName;\n } else {\n this.projectUrl = hostName;\n }\n }\n // Check if we have a specified path type.\n var isNotSubdomainType = false;\n if (Formio.pathType) {\n isNotSubdomainType = Formio.pathType !== 'Subdomains';\n }\n if (!this.noProject) {\n // Determine the projectUrl and projectId\n if (isProjectUrl) {\n // Get project id as project/:projectId.\n registerItems(['project'], hostName);\n path = path.replace(projectRegEx, '');\n } else if (hostName === this.base) {\n // Get project id as first part of path (subdirectory).\n if (hostparts.length > 3 && path.split('/').length > 1) {\n var isFile = path.match(/.json/);\n var pathParts = path.split('/');\n if (isFile) {\n this.projectUrl = hostName;\n } else {\n pathParts.shift(); // Throw away the first /.\n this.projectId = pathParts.shift();\n path = \"/\".concat(pathParts.join('/'));\n this.projectUrl = \"\".concat(hostName, \"/\").concat(this.projectId);\n }\n }\n } else {\n // Get project id from subdomain.\n if (hostparts.length > 2 && (hostparts[2].split('.').length > 2 || hostName.includes('localhost')) && !isNotSubdomainType) {\n this.projectUrl = hostName;\n this.projectId = hostparts[2].split('.')[0];\n }\n }\n this.projectsUrl = this.projectsUrl || \"\".concat(this.base, \"/project\");\n }\n\n // Configure Role urls and role ids.\n registerItems(['role'], this.projectUrl);\n\n // Configure Form urls and form ids.\n if (/(^|\\/)(form)($|\\/)/.test(path)) {\n registerItems(['form', ['submission', 'action', 'v']], this.projectUrl);\n } else {\n var subRegEx = new RegExp('/(submission|action|v)($|/.*)');\n var subs = path.match(subRegEx);\n this.pathType = subs && subs.length > 1 ? subs[1] : '';\n path = path.replace(subRegEx, '');\n path = path.replace(/\\/$/, '');\n this.formsUrl = \"\".concat(this.projectUrl, \"/form\");\n this.formUrl = path ? this.projectUrl + path : '';\n this.formId = path.replace(/^\\/+|\\/+$/g, '');\n var items = ['submission', 'action', 'v'];\n for (var i in items) {\n if (items.hasOwnProperty(i)) {\n var item = items[i];\n this[\"\".concat(item, \"sUrl\")] = \"\".concat(this.projectUrl + path, \"/\").concat(item);\n if (this.pathType === item && subs.length > 2 && subs[2]) {\n this[\"\".concat(item, \"Id\")] = subs[2].replace(/^\\/+|\\/+$/g, '');\n this[\"\".concat(item, \"Url\")] = this.projectUrl + path + subs[0];\n }\n }\n }\n }\n\n // Set the app url if it is not set.\n if (!Formio.projectUrlSet) {\n Formio.projectUrl = this.projectUrl;\n }\n }\n /* eslint-enable max-statements */\n _createClass(Formio, [{\n key: \"delete\",\n value: function _delete(type, opts) {\n var _id = \"\".concat(type, \"Id\");\n var _url = \"\".concat(type, \"Url\");\n if (!this[_id]) {\n return _nativePromiseOnly.default.reject('Nothing to delete');\n }\n Formio.cache = {};\n return this.makeRequest(type, this[_url], 'delete', null, opts);\n }\n }, {\n key: \"index\",\n value: function index(type, query, opts) {\n var _url = \"\".concat(type, \"Url\");\n query = query || '';\n if (query && isObject(query)) {\n query = \"?\".concat(Formio.serialize(query.params));\n }\n return this.makeRequest(type, this[_url] + query, 'get', null, opts);\n }\n }, {\n key: \"save\",\n value: function save(type, data, opts) {\n var _id = \"\".concat(type, \"Id\");\n var _url = \"\".concat(type, \"Url\");\n var method = this[_id] || data._id ? 'put' : 'post';\n var reqUrl = this[_id] ? this[_url] : this[\"\".concat(type, \"sUrl\")];\n if (!this[_id] && data._id && method === 'put' && !reqUrl.includes(data._id)) {\n reqUrl += \"/\".concat(data._id);\n }\n Formio.cache = {};\n return this.makeRequest(type, reqUrl + this.query, method, data, opts);\n }\n }, {\n key: \"load\",\n value: function load(type, query, opts) {\n var _id = \"\".concat(type, \"Id\");\n var _url = \"\".concat(type, \"Url\");\n if (query && isObject(query)) {\n query = Formio.serialize(query.params);\n }\n if (query) {\n query = this.query ? \"\".concat(this.query, \"&\").concat(query) : \"?\".concat(query);\n } else {\n query = this.query;\n }\n if (!this[_id]) {\n return _nativePromiseOnly.default.reject(\"Missing \".concat(_id));\n }\n var url = this[_url] + query;\n if (type === 'form' && !isNaN(parseInt(this.vId)) && parseInt(this.vId) !== 0) {\n url += url.match(/\\?/) ? '&' : '?';\n url += \"formRevision=\".concat(this.vId);\n }\n return this.makeRequest(type, url, 'get', null, opts);\n }\n }, {\n key: \"makeRequest\",\n value: function makeRequest() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return Formio.makeRequest.apply(Formio, [this].concat(args));\n }\n }, {\n key: \"loadProject\",\n value: function loadProject(query, opts) {\n return this.load('project', query, opts);\n }\n }, {\n key: \"saveProject\",\n value: function saveProject(data, opts) {\n return this.save('project', data, opts);\n }\n }, {\n key: \"deleteProject\",\n value: function deleteProject(opts) {\n return this.delete('project', opts);\n }\n }, {\n key: \"loadRole\",\n value: function loadRole(opts) {\n return this.load('role', null, opts);\n }\n }, {\n key: \"saveRole\",\n value: function saveRole(data, opts) {\n return this.save('role', data, opts);\n }\n }, {\n key: \"deleteRole\",\n value: function deleteRole(opts) {\n return this.delete('role', opts);\n }\n }, {\n key: \"loadRoles\",\n value: function loadRoles(opts) {\n return this.index('roles', null, opts);\n }\n }, {\n key: \"loadForm\",\n value: function loadForm(query, opts) {\n var _this2 = this;\n return this.load('form', query, opts).then(function (currentForm) {\n // Check to see if there isn't a number in vId.\n if (!currentForm.revisions || isNaN(parseInt(_this2.vId))) {\n return currentForm;\n }\n // If a submission already exists but form is marked to load current version of form.\n if (currentForm.revisions === 'current' && _this2.submissionId) {\n return currentForm;\n }\n // eslint-disable-next-line eqeqeq\n if (currentForm._vid == _this2.vId || currentForm.revisionId === _this2.vId) {\n return currentForm;\n }\n // If they specified a revision form, load the revised form components.\n if (query && isObject(query)) {\n query = Formio.serialize(query.params);\n }\n if (query) {\n query = _this2.query ? \"\".concat(_this2.query, \"&\").concat(query) : \"?\".concat(query);\n } else {\n query = _this2.query;\n }\n return _this2.makeRequest('form', _this2.vUrl + query, 'get', null, opts).then(function (revisionForm) {\n currentForm._vid = revisionForm._vid;\n currentForm.components = revisionForm.components;\n currentForm.settings = revisionForm.settings;\n currentForm.revisionId = revisionForm.revisionId;\n // Using object.assign so we don't cross polinate multiple form loads.\n return Object.assign({}, currentForm);\n })\n // If we couldn't load the revision, just return the original form.\n .catch(function () {\n return Object.assign({}, currentForm);\n });\n });\n }\n }, {\n key: \"saveForm\",\n value: function saveForm(data, opts) {\n return this.save('form', data, opts);\n }\n }, {\n key: \"deleteForm\",\n value: function deleteForm(opts) {\n return this.delete('form', opts);\n }\n }, {\n key: \"loadForms\",\n value: function loadForms(query, opts) {\n return this.index('forms', query, opts);\n }\n }, {\n key: \"loadSubmission\",\n value: function loadSubmission(query, opts) {\n var _this3 = this;\n return this.load('submission', query, opts).then(function (submission) {\n _this3.vId = submission._frid || submission._fvid;\n _this3.vUrl = \"\".concat(_this3.formUrl, \"/v/\").concat(_this3.vId);\n return submission;\n });\n }\n }, {\n key: \"saveSubmission\",\n value: function saveSubmission(data, opts) {\n if (!isNaN(parseInt(this.vId))) {\n data._fvid = this.vId;\n }\n return this.save('submission', data, opts);\n }\n }, {\n key: \"deleteSubmission\",\n value: function deleteSubmission(opts) {\n return this.delete('submission', opts);\n }\n }, {\n key: \"loadSubmissions\",\n value: function loadSubmissions(query, opts) {\n return this.index('submissions', query, opts);\n }\n }, {\n key: \"loadAction\",\n value: function loadAction(query, opts) {\n return this.load('action', query, opts);\n }\n }, {\n key: \"saveAction\",\n value: function saveAction(data, opts) {\n return this.save('action', data, opts);\n }\n }, {\n key: \"deleteAction\",\n value: function deleteAction(opts) {\n return this.delete('action', opts);\n }\n }, {\n key: \"loadActions\",\n value: function loadActions(query, opts) {\n return this.index('actions', query, opts);\n }\n }, {\n key: \"availableActions\",\n value: function availableActions() {\n return this.makeRequest('availableActions', \"\".concat(this.formUrl, \"/actions\"));\n }\n }, {\n key: \"actionInfo\",\n value: function actionInfo(name) {\n return this.makeRequest('actionInfo', \"\".concat(this.formUrl, \"/actions/\").concat(name));\n }\n }, {\n key: \"isObjectId\",\n value: function isObjectId(id) {\n var checkForHexRegExp = new RegExp('^[0-9a-fA-F]{24}$');\n return checkForHexRegExp.test(id);\n }\n }, {\n key: \"getProjectId\",\n value: function getProjectId() {\n if (!this.projectId) {\n return _nativePromiseOnly.default.resolve('');\n }\n if (this.isObjectId(this.projectId)) {\n return _nativePromiseOnly.default.resolve(this.projectId);\n } else {\n return this.loadProject().then(function (project) {\n return project._id;\n });\n }\n }\n }, {\n key: \"getFormId\",\n value: function getFormId() {\n if (!this.formId) {\n return _nativePromiseOnly.default.resolve('');\n }\n if (this.isObjectId(this.formId)) {\n return _nativePromiseOnly.default.resolve(this.formId);\n } else {\n return this.loadForm().then(function (form) {\n return form._id;\n });\n }\n }\n }, {\n key: \"currentUser\",\n value: function currentUser(options) {\n return Formio.currentUser(this, options);\n }\n }, {\n key: \"accessInfo\",\n value: function accessInfo() {\n return Formio.accessInfo(this);\n }\n\n /**\n * Returns the JWT token for this instance.\n *\n * @return {*}\n */\n }, {\n key: \"getToken\",\n value: function getToken(options) {\n return Formio.getToken(Object.assign({\n formio: this\n }, this.options, options));\n }\n\n /**\n * Sets the JWT token for this instance.\n *\n * @return {*}\n */\n }, {\n key: \"setToken\",\n value: function setToken(token, options) {\n return Formio.setToken(token, Object.assign({\n formio: this\n }, this.options, options));\n }\n\n /**\n * Returns a temporary authentication token for single purpose token generation.\n */\n }, {\n key: \"getTempToken\",\n value: function getTempToken(expire, allowed, options) {\n var token = Formio.getToken(options);\n if (!token) {\n return _nativePromiseOnly.default.reject('You must be authenticated to generate a temporary auth token.');\n }\n var authUrl = Formio.authUrl || this.projectUrl;\n return this.makeRequest('tempToken', \"\".concat(authUrl, \"/token\"), 'GET', null, {\n ignoreCache: true,\n header: new Headers({\n 'x-expire': expire,\n 'x-allow': allowed\n })\n });\n }\n\n /**\n * Get a download url for a submission PDF of this submission.\n *\n * @return {*}\n */\n }, {\n key: \"getDownloadUrl\",\n value: function getDownloadUrl(form) {\n var _this4 = this;\n if (!this.submissionId) {\n return _nativePromiseOnly.default.resolve('');\n }\n if (!form) {\n // Make sure to load the form first.\n return this.loadForm().then(function (_form) {\n if (!_form) {\n return '';\n }\n return _this4.getDownloadUrl(_form);\n });\n }\n var apiUrl = \"/project/\".concat(form.project);\n apiUrl += \"/form/\".concat(form._id);\n apiUrl += \"/submission/\".concat(this.submissionId);\n var postfix = form.submissionRevisions && form.settings.changeLog ? '/download/changelog' : '/download';\n apiUrl += postfix;\n var download = this.base + apiUrl;\n return new _nativePromiseOnly.default(function (resolve, reject) {\n _this4.getTempToken(3600, \"GET:\".concat(apiUrl)).then(function (tempToken) {\n download += \"?token=\".concat(tempToken.key);\n resolve(download);\n }, function () {\n resolve(download);\n }).catch(reject);\n });\n }\n }, {\n key: \"uploadFile\",\n value: function uploadFile(storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback) {\n var _this5 = this;\n var requestArgs = {\n provider: storage,\n method: 'upload',\n file: file,\n fileName: fileName,\n dir: dir\n };\n fileKey = fileKey || 'file';\n var request = Formio.pluginWait('preRequest', requestArgs).then(function () {\n return Formio.pluginGet('fileRequest', requestArgs).then(function (result) {\n if (storage && isNil(result)) {\n var Provider = _providers.default.getProvider('storage', storage);\n if (Provider) {\n var provider = new Provider(_this5);\n if (uploadStartCallback) {\n uploadStartCallback();\n }\n return provider.uploadFile(file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, abortCallback);\n } else {\n throw 'Storage provider not found';\n }\n }\n return result || {\n url: ''\n };\n });\n });\n return Formio.pluginAlter('wrapFileRequestPromise', request, requestArgs);\n }\n }, {\n key: \"downloadFile\",\n value: function downloadFile(file, options) {\n var _this6 = this;\n var requestArgs = {\n method: 'download',\n file: file\n };\n var request = Formio.pluginWait('preRequest', requestArgs).then(function () {\n return Formio.pluginGet('fileRequest', requestArgs).then(function (result) {\n if (file.storage && isNil(result)) {\n var Provider = _providers.default.getProvider('storage', file.storage);\n if (Provider) {\n var provider = new Provider(_this6);\n return provider.downloadFile(file, options);\n } else {\n throw 'Storage provider not found';\n }\n }\n return result || {\n url: ''\n };\n });\n });\n return Formio.pluginAlter('wrapFileRequestPromise', request, requestArgs);\n }\n }, {\n key: \"deleteFile\",\n value: function deleteFile(file, options) {\n var _this7 = this;\n var requestArgs = {\n method: 'delete',\n file: file\n };\n var request = Formio.pluginWait('preRequest', requestArgs).then(function () {\n return Formio.pluginGet('fileRequest', requestArgs).then(function (result) {\n if (file.storage && isNil(result)) {\n var Provider = _providers.default.getProvider('storage', file.storage);\n if (Provider) {\n var provider = new Provider(_this7);\n return provider.deleteFile(file, options);\n } else {\n throw 'Storage provider not found';\n }\n }\n return result || {\n url: ''\n };\n });\n });\n return Formio.pluginAlter('wrapFileRequestPromise', request, requestArgs);\n }\n\n /**\n * Returns the user permissions to a form and submission.\n *\n * @param user - The user or current user if undefined. For anonymous, use \"null\"\n * @param form - The form or current form if undefined. For no form check, use \"null\"\n * @param submission - The submisison or \"index\" if undefined.\n *\n * @return {create: boolean, read: boolean, edit: boolean, delete: boolean}\n */\n }, {\n key: \"userPermissions\",\n value: function userPermissions(user, form, submission) {\n return _nativePromiseOnly.default.all([form !== undefined ? _nativePromiseOnly.default.resolve(form) : this.loadForm(), user !== undefined ? _nativePromiseOnly.default.resolve(user) : this.currentUser(), submission !== undefined || !this.submissionId ? _nativePromiseOnly.default.resolve(submission) : this.loadSubmission(), this.accessInfo()]).then(function (results) {\n var form = results.shift();\n var user = results.shift() || {\n _id: false,\n roles: []\n };\n var submission = results.shift();\n var access = results.shift();\n var permMap = {\n create: 'create',\n read: 'read',\n update: 'edit',\n delete: 'delete'\n };\n var perms = {\n user: user,\n form: form,\n access: access,\n create: false,\n read: false,\n edit: false,\n delete: false\n };\n for (var roleName in access.roles) {\n if (access.roles.hasOwnProperty(roleName)) {\n var role = access.roles[roleName];\n if (role.default && user._id === false) {\n // User is anonymous. Add the anonymous role.\n user.roles.push(role._id);\n } else if (role.admin && user.roles.indexOf(role._id) !== -1) {\n perms.create = true;\n perms.read = true;\n perms.delete = true;\n perms.edit = true;\n return perms;\n }\n }\n }\n if (form && form.submissionAccess) {\n for (var i = 0; i < form.submissionAccess.length; i++) {\n var permission = form.submissionAccess[i];\n var _permission$type$spli = permission.type.split('_'),\n _permission$type$spli2 = _slicedToArray(_permission$type$spli, 2),\n perm = _permission$type$spli2[0],\n scope = _permission$type$spli2[1];\n if (['create', 'read', 'update', 'delete'].includes(perm)) {\n if ((0, _intersection2.default)(permission.roles, user.roles).length) {\n perms[permMap[perm]] = scope === 'all' || !submission || user._id === submission.owner;\n }\n }\n }\n }\n // check for Group Permissions\n if (submission) {\n // we would anyway need to loop through components for create permission, so we'll do that for all of them\n (0, _utils.eachComponent)(form.components, function (component, path) {\n if (component && component.defaultPermission) {\n var value = (0, _get2.default)(submission.data, path);\n // make it work for single-select Group and multi-select Group\n var groups = Array.isArray(value) ? value : [value];\n groups.forEach(function (group) {\n if (group && group._id &&\n // group id is present\n user.roles.indexOf(group._id) > -1 // user has group id in his roles\n ) {\n if (component.defaultPermission === 'read') {\n perms[permMap.read] = true;\n }\n if (component.defaultPermission === 'create') {\n perms[permMap.create] = true;\n perms[permMap.read] = true;\n }\n if (component.defaultPermission === 'write') {\n perms[permMap.create] = true;\n perms[permMap.read] = true;\n perms[permMap.update] = true;\n }\n if (component.defaultPermission === 'admin') {\n perms[permMap.create] = true;\n perms[permMap.read] = true;\n perms[permMap.update] = true;\n perms[permMap.delete] = true;\n }\n }\n });\n }\n });\n }\n return perms;\n });\n }\n\n /**\n * Determine if the current user can submit a form.\n * @return {*}\n */\n }, {\n key: \"canSubmit\",\n value: function canSubmit() {\n var _this8 = this;\n return this.userPermissions().then(function (perms) {\n // If there is user and they cannot create, then check anonymous user permissions.\n if (!perms.create && Formio.getUser()) {\n return _this8.userPermissions(null).then(function (anonPerms) {\n if (anonPerms.create) {\n Formio.setUser(null);\n return true;\n }\n return false;\n });\n }\n return perms.create;\n });\n }\n }, {\n key: \"getUrlParts\",\n value: function getUrlParts(url) {\n return Formio.getUrlParts(url, this);\n }\n }], [{\n key: \"useSessionToken\",\n value: function useSessionToken(options) {\n var tokenName = \"\".concat(options.namespace || Formio.namespace || 'formio', \"Token\");\n var token = localStorage.getItem(tokenName);\n if (token) {\n localStorage.removeItem(tokenName);\n sessionStorage.setItem(tokenName, token);\n }\n var userName = \"\".concat(options.namespace || Formio.namespace || 'formio', \"User\");\n var user = localStorage.getItem(userName);\n if (user) {\n localStorage.removeItem(userName);\n sessionStorage.setItem(userName, user);\n }\n localStorage.setItem('useSessionToken', true);\n }\n }, {\n key: \"loadProjects\",\n value: function loadProjects(query, opts) {\n query = query || '';\n if (isObject(query)) {\n query = \"?\".concat(Formio.serialize(query.params));\n }\n return Formio.makeStaticRequest(\"\".concat(Formio.baseUrl, \"/project\").concat(query), 'GET', null, opts);\n }\n }, {\n key: \"getUrlParts\",\n value: function getUrlParts(url, formio) {\n var base = formio && formio.base ? formio.base : Formio.baseUrl;\n var regex = '^(http[s]?:\\\\/\\\\/)';\n if (base && url.indexOf(base) === 0) {\n regex += \"(\".concat(base.replace(/^http[s]?:\\/\\//, ''), \")\");\n } else {\n regex += '([^/]+)';\n }\n regex += '($|\\\\/.*)';\n return url.match(new RegExp(regex));\n }\n }, {\n key: \"serialize\",\n value: function serialize(obj, _interpolate) {\n var str = [];\n var interpolate = function interpolate(item) {\n return _interpolate ? _interpolate(item) : item;\n };\n for (var p in obj) {\n if (obj.hasOwnProperty(p)) {\n str.push(\"\".concat(encodeURIComponent(p), \"=\").concat(encodeURIComponent(interpolate(obj[p]))));\n }\n }\n return str.join('&');\n }\n }, {\n key: \"getRequestArgs\",\n value: function getRequestArgs(formio, type, url, method, data, opts) {\n method = (method || 'GET').toUpperCase();\n if (!opts || !isObject(opts)) {\n opts = {};\n }\n var requestArgs = {\n url: url,\n method: method,\n data: data || null,\n opts: opts\n };\n if (type) {\n requestArgs.type = type;\n }\n if (formio) {\n requestArgs.formio = formio;\n }\n return requestArgs;\n }\n }, {\n key: \"makeStaticRequest\",\n value: function makeStaticRequest(url, method, data, opts) {\n var requestArgs = Formio.getRequestArgs(null, '', url, method, data, opts);\n var request = Formio.pluginWait('preRequest', requestArgs).then(function () {\n return Formio.pluginGet('staticRequest', requestArgs).then(function (result) {\n if (isNil(result)) {\n return Formio.request(requestArgs.url, requestArgs.method, requestArgs.data, requestArgs.opts.header, requestArgs.opts);\n }\n return result;\n });\n });\n return Formio.pluginAlter('wrapStaticRequestPromise', request, requestArgs);\n }\n }, {\n key: \"makeRequest\",\n value: function makeRequest(formio, type, url, method, data, opts) {\n if (!formio) {\n return Formio.makeStaticRequest(url, method, data, opts);\n }\n var requestArgs = Formio.getRequestArgs(formio, type, url, method, data, opts);\n requestArgs.opts = requestArgs.opts || {};\n requestArgs.opts.formio = formio;\n\n //for Formio requests default Accept and Content-type headers\n if (!requestArgs.opts.headers) {\n requestArgs.opts.headers = {};\n }\n requestArgs.opts.headers = (0, _defaults2.default)(requestArgs.opts.headers, {\n 'Accept': 'application/json',\n 'Content-type': 'application/json'\n });\n var request = Formio.pluginWait('preRequest', requestArgs).then(function () {\n return Formio.pluginGet('request', requestArgs).then(function (result) {\n if (isNil(result)) {\n return Formio.request(requestArgs.url, requestArgs.method, requestArgs.data, requestArgs.opts.header, requestArgs.opts);\n }\n return result;\n });\n });\n return Formio.pluginAlter('wrapRequestPromise', request, requestArgs);\n }\n }, {\n key: \"request\",\n value: function request(url, method, data, header, opts) {\n if (!url) {\n return _nativePromiseOnly.default.reject('No url provided');\n }\n var _Formio = Formio;\n method = (method || 'GET').toUpperCase();\n\n // For reverse compatibility, if they provided the ignoreCache parameter,\n // then change it back to the options format where that is a parameter.\n if (isBoolean(opts)) {\n opts = {\n ignoreCache: opts\n };\n }\n if (!opts || !isObject(opts)) {\n opts = {};\n }\n\n // Generate a cachekey.\n var cacheKey = btoa(encodeURI(url));\n\n // Get the cached promise to save multiple loads.\n if (!opts.ignoreCache && method === 'GET' && _Formio.cache.hasOwnProperty(cacheKey)) {\n return _nativePromiseOnly.default.resolve(cloneResponse(_Formio.cache[cacheKey]));\n }\n\n // Set up and fetch request\n var headers = header || new Headers(opts.headers || {\n 'Accept': 'application/json',\n 'Content-type': 'application/json'\n });\n var token = _Formio.getToken(opts);\n if (token && !opts.noToken) {\n headers.append('x-jwt-token', token);\n }\n\n // The fetch-ponyfill can't handle a proper Headers class anymore. Change it back to an object.\n var headerObj = {};\n headers.forEach(function (value, name) {\n headerObj[name] = value;\n });\n var options = {\n method: method,\n headers: headerObj,\n mode: 'cors'\n };\n if (data) {\n options.body = JSON.stringify(data);\n if (method === \"POST\") {\n options.body = data;\n }\n }\n\n // Allow plugins to alter the options.\n options = _Formio.pluginAlter('requestOptions', options, url);\n if (options.namespace || _Formio.namespace) {\n opts.namespace = options.namespace || _Formio.namespace;\n }\n var requestToken = options.headers['x-jwt-token'];\n var result = _Formio.pluginAlter('wrapFetchRequestPromise', _Formio.fetch(url, options), {\n url: url,\n method: method,\n data: data,\n opts: opts\n }).then(function (response) {\n // Allow plugins to respond.\n response = _Formio.pluginAlter('requestResponse', response, _Formio, data);\n if (!response.ok) {\n if (response.status === 440) {\n _Formio.setToken(null, opts);\n _Formio.events.emit('formio.sessionExpired', response.body);\n } else if (response.status === 401) {\n _Formio.events.emit('formio.unauthorized', response.body);\n } else if (response.status === 416) {\n _Formio.events.emit('formio.rangeIsNotSatisfiable', response.body);\n } else if (response.status === 504) {\n return _nativePromiseOnly.default.reject(new Error('Network request failed'));\n }\n\n // Parse and return the error as a rejected promise to reject this promise\n return (response.headers.get('content-type').includes('application/json') ? response.json() : response.text()).then(function (error) {\n return _nativePromiseOnly.default.reject(error);\n });\n }\n\n // Handle fetch results\n var token = response.headers.get('x-jwt-token');\n\n // In some strange cases, the fetch library will return an x-jwt-token without sending\n // one to the server. This has even been debugged on the server to verify that no token\n // was introduced with the request, but the response contains a token. This is an Invalid\n // case where we do not send an x-jwt-token and get one in return for any GET request.\n var tokenIntroduced = false;\n if (method === 'GET' && !requestToken && token && !opts.external && !url.includes('token=') && !url.includes('x-jwt-token=')) {\n console.warn('Token was introduced in request.');\n tokenIntroduced = true;\n }\n if (response.status >= 200 && response.status < 300 && token && token !== '' && !tokenIntroduced) {\n _Formio.setToken(token, opts);\n }\n // 204 is no content. Don't try to .json() it.\n if (response.status === 204) {\n return {};\n }\n var getResult = response.headers.get('content-type').includes('application/json') ? response.json() : response.text();\n return getResult.then(function (result) {\n // Add some content-range metadata to the result here\n var range = response.headers.get('content-range');\n if (range && isObject(result)) {\n range = range.split('/');\n if (range[0] !== '*') {\n var skipLimit = range[0].split('-');\n result.skip = Number(skipLimit[0]);\n result.limit = skipLimit[1] - skipLimit[0] + 1;\n }\n result.serverCount = range[1] === '*' ? range[1] : Number(range[1]);\n }\n if (!opts.getHeaders) {\n return result;\n }\n var headers = {};\n response.headers.forEach(function (item, key) {\n headers[key] = item;\n });\n\n // Return the result with the headers.\n return {\n result: result,\n headers: headers\n };\n });\n }).then(function (result) {\n if (opts.getHeaders) {\n return result;\n }\n\n // Cache the response.\n if (method === 'GET') {\n _Formio.cache[cacheKey] = result;\n }\n return cloneResponse(result);\n }).catch(function (err) {\n if (err === 'Bad Token') {\n _Formio.setToken(null, opts);\n _Formio.events.emit('formio.badToken', err);\n }\n if (err.message) {\n err = new Error(\"Could not connect to API server (\".concat(err.message, \"): \").concat(url));\n err.networkError = true;\n }\n if (method === 'GET') {\n delete _Formio.cache[cacheKey];\n }\n return _nativePromiseOnly.default.reject(err);\n });\n return result;\n }\n\n // Needed to maintain reverse compatability...\n }, {\n key: \"token\",\n get: function get() {\n if (!Formio.tokens) {\n Formio.tokens = {};\n }\n return Formio.tokens.formioToken || '';\n }\n\n // Needed to maintain reverse compatability...\n ,\n set: function set(token) {\n if (!Formio.tokens) {\n Formio.tokens = {};\n }\n Formio.tokens.formioToken = token || '';\n }\n }, {\n key: \"setToken\",\n value: function setToken() {\n var token = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var opts = arguments.length > 1 ? arguments[1] : undefined;\n token = token || '';\n opts = typeof opts === 'string' ? {\n namespace: opts\n } : opts || {};\n var tokenName = \"\".concat(opts.namespace || Formio.namespace || 'formio', \"Token\");\n if (!Formio.tokens) {\n Formio.tokens = {};\n }\n var storage = localStorage.getItem('useSessionToken') ? sessionStorage : localStorage;\n if (!token) {\n if (!opts.fromUser) {\n opts.fromToken = true;\n Formio.setUser(null, opts);\n }\n // iOS in private browse mode will throw an error but we can't detect ahead of time that we are in private mode.\n try {\n storage.removeItem(tokenName);\n } catch (err) {\n _browserCookies.default.erase(tokenName, {\n path: '/'\n });\n }\n Formio.tokens[tokenName] = token;\n return _nativePromiseOnly.default.resolve(null);\n }\n if (Formio.tokens[tokenName] !== token) {\n Formio.tokens[tokenName] = token;\n // iOS in private browse mode will throw an error but we can't detect ahead of time that we are in private mode.\n try {\n storage.setItem(tokenName, token);\n } catch (err) {\n _browserCookies.default.set(tokenName, token, {\n path: '/'\n });\n }\n }\n // Return or updates the current user\n return this.currentUserResolved ? Formio.currentUser(opts.formio, opts) : _nativePromiseOnly.default.resolve(null);\n }\n }, {\n key: \"getToken\",\n value: function getToken(options) {\n options = typeof options === 'string' ? {\n namespace: options\n } : options || {};\n var tokenName = \"\".concat(options.namespace || Formio.namespace || 'formio', \"Token\");\n var decodedTokenName = options.decode ? \"\".concat(tokenName, \"Decoded\") : tokenName;\n if (!Formio.tokens) {\n Formio.tokens = {};\n }\n if (Formio.tokens[decodedTokenName]) {\n return Formio.tokens[decodedTokenName];\n }\n try {\n var token = localStorage.getItem('useSessionToken') ? sessionStorage.getItem(tokenName) : localStorage.getItem(tokenName);\n Formio.tokens[tokenName] = token || '';\n if (options.decode) {\n Formio.tokens[decodedTokenName] = Formio.tokens[tokenName] ? (0, _jwtDecode.default)(Formio.tokens[tokenName]) : {};\n return Formio.tokens[decodedTokenName];\n }\n return Formio.tokens[tokenName];\n } catch (e) {\n Formio.tokens[tokenName] = _browserCookies.default.get(tokenName);\n return Formio.tokens[tokenName];\n }\n }\n }, {\n key: \"setUser\",\n value: function setUser(user) {\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var userName = \"\".concat(opts.namespace || Formio.namespace || 'formio', \"User\");\n var storage = localStorage.getItem('useSessionToken') ? sessionStorage : localStorage;\n if (!user) {\n if (!opts.fromToken) {\n opts.fromUser = true;\n Formio.setToken(null, opts);\n }\n\n // Emit an event on the cleared user.\n Formio.events.emit('formio.user', null);\n\n // iOS in private browse mode will throw an error but we can't detect ahead of time that we are in private mode.\n try {\n return storage.removeItem(userName);\n } catch (err) {\n return _browserCookies.default.erase(userName, {\n path: '/'\n });\n }\n }\n // iOS in private browse mode will throw an error but we can't detect ahead of time that we are in private mode.\n try {\n storage.setItem(userName, JSON.stringify(user));\n } catch (err) {\n _browserCookies.default.set(userName, JSON.stringify(user), {\n path: '/'\n });\n }\n\n // Emit an event on the authenticated user.\n Formio.events.emit('formio.user', user);\n }\n }, {\n key: \"getUser\",\n value: function getUser(options) {\n options = options || {};\n var userName = \"\".concat(options.namespace || Formio.namespace || 'formio', \"User\");\n try {\n return JSON.parse((localStorage.getItem('useSessionToken') ? sessionStorage : localStorage).getItem(userName) || null);\n } catch (e) {\n return JSON.parse(_browserCookies.default.get(userName));\n }\n }\n }, {\n key: \"setBaseUrl\",\n value: function setBaseUrl(url) {\n Formio.baseUrl = url;\n if (!Formio.projectUrlSet) {\n Formio.projectUrl = url;\n }\n }\n }, {\n key: \"getBaseUrl\",\n value: function getBaseUrl() {\n return Formio.baseUrl;\n }\n }, {\n key: \"setApiUrl\",\n value: function setApiUrl(url) {\n return Formio.setBaseUrl(url);\n }\n }, {\n key: \"getApiUrl\",\n value: function getApiUrl() {\n return Formio.getBaseUrl();\n }\n }, {\n key: \"setAppUrl\",\n value: function setAppUrl(url) {\n console.warn('Formio.setAppUrl() is deprecated. Use Formio.setProjectUrl instead.');\n Formio.projectUrl = url;\n Formio.projectUrlSet = true;\n }\n }, {\n key: \"setProjectUrl\",\n value: function setProjectUrl(url) {\n Formio.projectUrl = url;\n Formio.projectUrlSet = true;\n }\n }, {\n key: \"setAuthUrl\",\n value: function setAuthUrl(url) {\n Formio.authUrl = url;\n }\n }, {\n key: \"getAppUrl\",\n value: function getAppUrl() {\n console.warn('Formio.getAppUrl() is deprecated. Use Formio.getProjectUrl instead.');\n return Formio.projectUrl;\n }\n }, {\n key: \"getProjectUrl\",\n value: function getProjectUrl() {\n return Formio.projectUrl;\n }\n }, {\n key: \"clearCache\",\n value: function clearCache() {\n Formio.cache = {};\n }\n }, {\n key: \"noop\",\n value: function noop() {}\n }, {\n key: \"identity\",\n value: function identity(value) {\n return value;\n }\n }, {\n key: \"deregisterPlugin\",\n value: function deregisterPlugin(plugin) {\n var beforeLength = Formio.plugins.length;\n Formio.plugins = Formio.plugins.filter(function (p) {\n if (p !== plugin && p.__name !== plugin) {\n return true;\n }\n (p.deregister || Formio.noop).call(plugin, Formio);\n return false;\n });\n return beforeLength !== Formio.plugins.length;\n }\n }, {\n key: \"registerPlugin\",\n value: function registerPlugin(plugin, name) {\n var __Formio = Formio;\n __Formio.plugins.push(plugin);\n __Formio.plugins.sort(function (a, b) {\n return (b.priority || 0) - (a.priority || 0);\n });\n plugin.__name = name;\n (plugin.init || __Formio.noop).call(plugin, __Formio);\n }\n }, {\n key: \"getPlugin\",\n value: function getPlugin(name) {\n var _iterator = _createForOfIteratorHelper(Formio.plugins),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var plugin = _step.value;\n if (plugin.__name === name) {\n return plugin;\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n return null;\n }\n }, {\n key: \"pluginWait\",\n value: function pluginWait(pluginFn) {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n return _nativePromiseOnly.default.all(Formio.plugins.map(function (plugin) {\n var _ref;\n return (_ref = plugin[pluginFn] || Formio.noop).call.apply(_ref, [plugin].concat(args));\n }));\n }\n }, {\n key: \"pluginGet\",\n value: function pluginGet(pluginFn) {\n for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {\n args[_key3 - 1] = arguments[_key3];\n }\n var callPlugin = function callPlugin(index) {\n var _ref2;\n var plugin = Formio.plugins[index];\n if (!plugin) {\n return _nativePromiseOnly.default.resolve(null);\n }\n return _nativePromiseOnly.default.resolve((_ref2 = plugin[pluginFn] || Formio.noop).call.apply(_ref2, [plugin].concat(args))).then(function (result) {\n if (!isNil(result)) {\n return result;\n }\n return callPlugin(index + 1);\n });\n };\n return callPlugin(0);\n }\n }, {\n key: \"pluginAlter\",\n value: function pluginAlter(pluginFn, value) {\n for (var _len4 = arguments.length, args = new Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) {\n args[_key4 - 2] = arguments[_key4];\n }\n return Formio.plugins.reduce(function (value, plugin) {\n return (plugin[pluginFn] || Formio.identity).apply(void 0, [value].concat(args));\n }, value);\n }\n }, {\n key: \"accessInfo\",\n value: function accessInfo(formio) {\n var projectUrl = formio ? formio.projectUrl : Formio.projectUrl;\n return Formio.makeRequest(formio, 'accessInfo', \"\".concat(projectUrl, \"/access\"));\n }\n }, {\n key: \"projectRoles\",\n value: function projectRoles(formio) {\n var projectUrl = formio ? formio.projectUrl : Formio.projectUrl;\n return Formio.makeRequest(formio, 'projectRoles', \"\".concat(projectUrl, \"/role\"));\n }\n }, {\n key: \"currentUser\",\n value: function currentUser(formio, options) {\n var _this9 = this;\n var authUrl = Formio.authUrl;\n if (!authUrl) {\n authUrl = formio ? formio.projectUrl : Formio.projectUrl || Formio.baseUrl;\n }\n authUrl += '/current';\n var user = Formio.getUser(options);\n if (user) {\n return Formio.pluginAlter('wrapStaticRequestPromise', _nativePromiseOnly.default.resolve(user), {\n url: authUrl,\n method: 'GET',\n options: options\n });\n }\n var token = Formio.getToken(options);\n if ((!options || !options.external) && !token) {\n return Formio.pluginAlter('wrapStaticRequestPromise', _nativePromiseOnly.default.resolve(null), {\n url: authUrl,\n method: 'GET',\n options: options\n });\n }\n authUrl = \"\".concat(Formio.baseUrl, \"/current\");\n this.currentUserResolved = false;\n return Formio.makeRequest(formio, 'currentUser', authUrl, 'GET', null, options).then(function (response) {\n _this9.currentUserResolved = true;\n Formio.setUser(response, options);\n return response;\n });\n }\n }, {\n key: \"logout\",\n value: function logout(formio, options) {\n options = options || {};\n options.formio = formio;\n var projectUrl = Formio.authUrl ? Formio.authUrl : formio ? formio.projectUrl : Formio.baseUrl;\n var logout = function logout() {\n Formio.setToken(null, options);\n Formio.setUser(null, options);\n Formio.clearCache();\n localStorage.removeItem('useSessionToken');\n };\n return Formio.makeRequest(formio, 'logout', \"\".concat(projectUrl, \"/logout\")).then(function (result) {\n logout();\n return result;\n }).catch(function (err) {\n logout();\n throw err;\n });\n }\n }, {\n key: \"pageQuery\",\n value: function pageQuery() {\n var pageQuery = {};\n pageQuery.paths = [];\n var hashes = location.hash.substr(1).replace(/\\?/g, '&').split('&');\n var parts = [];\n location.search.substr(1).split('&').forEach(function (item) {\n parts = item.split('=');\n if (parts.length > 1) {\n pageQuery[parts[0]] = parts[1] && decodeURIComponent(parts[1]);\n }\n });\n hashes.forEach(function (item) {\n parts = item.split('=');\n if (parts.length > 1) {\n pageQuery[parts[0]] = parts[1] && decodeURIComponent(parts[1]);\n } else if (item.indexOf('/') === 0) {\n pageQuery.paths = item.substr(1).split('/');\n }\n });\n return pageQuery;\n }\n }, {\n key: \"oAuthCurrentUser\",\n value: function oAuthCurrentUser(formio, token) {\n return Formio.currentUser(formio, {\n external: true,\n headers: {\n Authorization: \"Bearer \".concat(token)\n }\n });\n }\n }, {\n key: \"samlInit\",\n value: function samlInit(options) {\n options = options || {};\n var query = Formio.pageQuery();\n if (query.saml) {\n Formio.setUser(null);\n var retVal = Formio.setToken(query.saml);\n var uri = window.location.toString();\n uri = uri.substring(0, uri.indexOf('?'));\n if (window.location.hash) {\n uri += window.location.hash;\n }\n window.history.replaceState({}, document.title, uri);\n return retVal;\n }\n\n // Set the relay if not provided.\n if (!options.relay) {\n options.relay = window.location.href;\n }\n\n // go to the saml sso endpoint for this project.\n var authUrl = Formio.authUrl || Formio.projectUrl;\n window.location.href = \"\".concat(authUrl, \"/saml/sso?relay=\").concat(encodeURI(options.relay));\n return false;\n }\n }, {\n key: \"oktaInit\",\n value: function oktaInit(options) {\n options = options || {};\n if ((typeof OktaAuth === \"undefined\" ? \"undefined\" : _typeof(OktaAuth)) !== undefined) {\n options.OktaAuth = OktaAuth;\n }\n if (_typeof(options.OktaAuth) === undefined) {\n var errorMessage = 'Cannot find OktaAuth. Please include the Okta JavaScript SDK within your application. See https://developer.okta.com/code/javascript/okta_auth_sdk for an example.';\n console.warn(errorMessage);\n return _nativePromiseOnly.default.reject(errorMessage);\n }\n return new _nativePromiseOnly.default(function (resolve, reject) {\n var Okta = options.OktaAuth;\n delete options.OktaAuth;\n var authClient = new Okta(options);\n authClient.tokenManager.get('accessToken').then(function (accessToken) {\n if (accessToken) {\n resolve(Formio.oAuthCurrentUser(options.formio, accessToken.accessToken));\n } else if (location.hash) {\n authClient.token.parseFromUrl().then(function (token) {\n authClient.tokenManager.add('accessToken', token);\n resolve(Formio.oAuthCurrentUser(options.formio, token.accessToken));\n }).catch(function (err) {\n console.warn(err);\n reject(err);\n });\n } else {\n authClient.token.getWithRedirect({\n responseType: 'token',\n scopes: options.scopes\n });\n resolve(false);\n }\n }).catch(function (error) {\n reject(error);\n });\n });\n }\n }, {\n key: \"ssoInit\",\n value: function ssoInit(type, options) {\n switch (type) {\n case 'saml':\n return Formio.samlInit(options);\n case 'okta':\n return Formio.oktaInit(options);\n default:\n console.warn('Unknown SSO type');\n return _nativePromiseOnly.default.reject('Unknown SSO type');\n }\n }\n }, {\n key: \"requireLibrary\",\n value: function requireLibrary(name, property, src, polling, onload) {\n if (!Formio.libraries.hasOwnProperty(name)) {\n Formio.libraries[name] = {};\n Formio.libraries[name].ready = new _nativePromiseOnly.default(function (resolve, reject) {\n Formio.libraries[name].resolve = resolve;\n Formio.libraries[name].reject = reject;\n });\n var callbackName = \"\".concat(name, \"Callback\");\n if (!polling && !window[callbackName]) {\n window[callbackName] = function () {\n return Formio.libraries[name].resolve();\n };\n }\n\n // See if the plugin already exists.\n var plugin = (0, _get2.default)(window, property);\n if (plugin) {\n Formio.libraries[name].resolve(plugin);\n } else {\n src = Array.isArray(src) ? src : [src];\n src.forEach(function (lib) {\n var attrs = {};\n var elementType = '';\n if (typeof lib === 'string') {\n lib = {\n type: 'script',\n src: lib\n };\n }\n switch (lib.type) {\n case 'script':\n elementType = 'script';\n attrs = {\n src: lib.src,\n type: 'text/javascript',\n defer: true,\n async: true,\n referrerpolicy: 'origin'\n };\n break;\n case 'styles':\n elementType = 'link';\n attrs = {\n href: lib.src,\n rel: 'stylesheet'\n };\n break;\n }\n\n // Add the script to the top of the page.\n var element = document.createElement(elementType);\n if (element.setAttribute) {\n for (var attr in attrs) {\n element.setAttribute(attr, attrs[attr]);\n }\n }\n if (onload) {\n element.addEventListener('load', function () {\n Formio.libraries[name].loaded = true;\n onload(Formio.libraries[name].ready);\n });\n }\n var _document = document,\n head = _document.head;\n if (head) {\n head.appendChild(element);\n }\n });\n\n // if no callback is provided, then check periodically for the script.\n if (polling) {\n var interval = setInterval(function () {\n var plugin = (0, _get2.default)(window, property);\n if (plugin) {\n clearInterval(interval);\n Formio.libraries[name].resolve(plugin);\n }\n }, 200);\n }\n }\n }\n var lib = Formio.libraries[name];\n return onload && lib.loaded ? onload(lib.ready) : lib.ready;\n }\n }, {\n key: \"libraryReady\",\n value: function libraryReady(name) {\n if (Formio.libraries.hasOwnProperty(name) && Formio.libraries[name].ready) {\n return Formio.libraries[name].ready;\n }\n return _nativePromiseOnly.default.reject(\"\".concat(name, \" library was not required.\"));\n }\n }, {\n key: \"addToGlobal\",\n value: function addToGlobal(global) {\n if (_typeof(global) === 'object' && !global.Formio) {\n global.Formio = Formio;\n }\n }\n }, {\n key: \"setPathType\",\n value: function setPathType(type) {\n if (typeof type === 'string') {\n Formio.pathType = type;\n }\n }\n }, {\n key: \"getPathType\",\n value: function getPathType() {\n return Formio.pathType;\n }\n }, {\n key: \"rulesEntities\",\n get: function get() {\n return {\n ValueSources: Formio.ValueSources,\n Conjunctions: Formio.Conjunctions,\n Operators: Formio.Operators,\n Transformers: Formio.Transformers,\n QuickRules: Formio.QuickRules,\n Rules: Formio.Rules\n };\n }\n }, {\n key: \"GlobalFormio\",\n get: function get() {\n if (typeof __webpack_require__.g !== 'undefined' && __webpack_require__.g.Formio) {\n return __webpack_require__.g.Formio;\n } else if (typeof window !== 'undefined' && window.Formio) {\n return window.Formio;\n }\n return Formio;\n }\n }]);\n return Formio;\n}(); // Define all the static properties.\n_defineProperty(Formio, \"currentUserResolved\", true);\nFormio.libraries = {};\nFormio.Promise = _nativePromiseOnly.default;\nFormio.fetch = fetch;\nFormio.Headers = Headers;\nFormio.baseUrl = 'https://api.form.io';\nFormio.projectUrl = Formio.baseUrl;\nFormio.authUrl = '';\nFormio.projectUrlSet = false;\nFormio.plugins = [];\nFormio.cache = {};\nFormio.Providers = _providers.default;\nFormio.version = '0.1.21';\nFormio.pathType = '';\nFormio.events = new _EventEmitter.default();\nFormio.cdn = new _CDN.default();\nif ((Formio.version || '').includes('rc')) {\n Formio.cdn.setBaseUrl('https://cdn.test-form.io');\n}\nif (typeof __webpack_require__.g !== 'undefined') {\n Formio.addToGlobal(__webpack_require__.g);\n}\nif (typeof window !== 'undefined') {\n Formio.addToGlobal(window);\n}\nvar GlobalFormio = Formio.GlobalFormio;\nexports.GlobalFormio = GlobalFormio;\nvar _default = Formio;\nexports[\"default\"] = _default;\n\n//# sourceURL=webpack://Formio/./lib/Formio.js?");
84
+ eval("\n\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.array.slice.js */ \"./node_modules/core-js/modules/es.array.slice.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.array.from.js */ \"./node_modules/core-js/modules/es.array.from.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = exports.GlobalFormio = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.match.js */ \"./node_modules/core-js/modules/es.string.match.js\");\n__webpack_require__(/*! core-js/modules/es.string.search.js */ \"./node_modules/core-js/modules/es.string.search.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.constructor.js */ \"./node_modules/core-js/modules/es.regexp.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.array.join.js */ \"./node_modules/core-js/modules/es.array.join.js\");\n__webpack_require__(/*! core-js/modules/es.array.includes.js */ \"./node_modules/core-js/modules/es.array.includes.js\");\n__webpack_require__(/*! core-js/modules/es.string.includes.js */ \"./node_modules/core-js/modules/es.string.includes.js\");\n__webpack_require__(/*! core-js/modules/es.object.assign.js */ \"./node_modules/core-js/modules/es.object.assign.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.array.filter.js */ \"./node_modules/core-js/modules/es.array.filter.js\");\n__webpack_require__(/*! core-js/modules/es.array.sort.js */ \"./node_modules/core-js/modules/es.array.sort.js\");\n__webpack_require__(/*! core-js/modules/es.array.map.js */ \"./node_modules/core-js/modules/es.array.map.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nvar _nativePromiseOnly = _interopRequireDefault(__webpack_require__(/*! native-promise-only */ \"./node_modules/native-promise-only/lib/npo.src.js\"));\nvar _fetchPonyfill2 = _interopRequireDefault(__webpack_require__(/*! fetch-ponyfill */ \"./node_modules/fetch-ponyfill/build/fetch-browser.js\"));\nvar _EventEmitter = _interopRequireDefault(__webpack_require__(/*! ./EventEmitter */ \"./lib/EventEmitter.js\"));\nvar _browserCookies = _interopRequireDefault(__webpack_require__(/*! browser-cookies */ \"./node_modules/browser-cookies/src/browser-cookies.js\"));\nvar _providers = _interopRequireDefault(__webpack_require__(/*! ./providers */ \"./lib/providers/index.js\"));\nvar _intersection2 = _interopRequireDefault(__webpack_require__(/*! lodash/intersection */ \"./node_modules/lodash/intersection.js\"));\nvar _get2 = _interopRequireDefault(__webpack_require__(/*! lodash/get */ \"./node_modules/lodash/get.js\"));\nvar _cloneDeep2 = _interopRequireDefault(__webpack_require__(/*! lodash/cloneDeep */ \"./node_modules/lodash/cloneDeep.js\"));\nvar _defaults2 = _interopRequireDefault(__webpack_require__(/*! lodash/defaults */ \"./node_modules/lodash/defaults.js\"));\nvar _utils = __webpack_require__(/*! ./utils/utils */ \"./lib/utils/utils.js\");\nvar _jwtDecode = _interopRequireDefault(__webpack_require__(/*! jwt-decode */ \"./node_modules/jwt-decode/build/jwt-decode.esm.js\"));\n__webpack_require__(/*! ./polyfills */ \"./lib/polyfills/index.js\");\nvar _CDN = _interopRequireDefault(__webpack_require__(/*! ./CDN */ \"./lib/CDN.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : \"undefined\" != typeof Symbol && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nvar _fetchPonyfill = (0, _fetchPonyfill2.default)({\n Promise: _nativePromiseOnly.default\n }),\n fetch = _fetchPonyfill.fetch,\n Headers = _fetchPonyfill.Headers;\nvar isBoolean = function isBoolean(val) {\n return _typeof(val) === _typeof(true);\n};\nvar isNil = function isNil(val) {\n return val === null || val === undefined;\n};\nvar isObject = function isObject(val) {\n return val && _typeof(val) === 'object';\n};\nfunction cloneResponse(response) {\n var copy = (0, _cloneDeep2.default)(response);\n if (Array.isArray(response)) {\n copy.skip = response.skip;\n copy.limit = response.limit;\n copy.serverCount = response.serverCount;\n }\n return copy;\n}\n\n/**\n * The Formio interface class.\n *\n * let formio = new Formio('https://examples.form.io/example');\n */\nvar Formio = /*#__PURE__*/function () {\n /* eslint-disable max-statements */\n function Formio(path) {\n var _this = this;\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n _classCallCheck(this, Formio);\n // Ensure we have an instance of Formio.\n if (!(this instanceof Formio)) {\n return new Formio(path);\n }\n\n // Initialize our variables.\n this.base = '';\n this.projectsUrl = '';\n this.projectUrl = '';\n this.projectId = '';\n this.roleUrl = '';\n this.rolesUrl = '';\n this.roleId = '';\n this.formUrl = '';\n this.formsUrl = '';\n this.formId = '';\n this.submissionsUrl = '';\n this.submissionUrl = '';\n this.submissionId = '';\n this.actionsUrl = '';\n this.actionId = '';\n this.actionUrl = '';\n this.vsUrl = '';\n this.vId = '';\n this.vUrl = '';\n this.query = '';\n\n // Store the original path and options.\n this.path = path;\n this.options = options;\n if (options.useSessionToken) {\n Formio.useSessionToken(options);\n }\n if (options.hasOwnProperty('base')) {\n this.base = options.base;\n } else if (Formio.baseUrl) {\n this.base = Formio.baseUrl;\n } else if (typeof window !== 'undefined') {\n this.base = window.location.href.match(/http[s]?:\\/\\/api./)[0];\n }\n if (!path) {\n // Allow user to create new projects if this was instantiated without\n // a url\n this.projectUrl = Formio.projectUrl || \"\".concat(this.base, \"/project\");\n this.projectsUrl = \"\".concat(this.base, \"/project\");\n this.projectId = false;\n this.query = '';\n return;\n }\n if (options.hasOwnProperty('project')) {\n this.projectUrl = options.project;\n }\n var project = this.projectUrl || Formio.projectUrl;\n var projectRegEx = /(^|\\/)(project)($|\\/[^/]+)/;\n var isProjectUrl = path.search(projectRegEx) !== -1;\n\n // The baseURL is the same as the projectUrl, and does not contain \"/project/MONGO_ID\" in\n // its domain. This is almost certainly against the Open Source server.\n if (project && this.base === project && !isProjectUrl) {\n this.noProject = true;\n this.projectUrl = this.base;\n }\n\n // Normalize to an absolute path.\n if (path.indexOf('http') !== 0 && path.indexOf('//') !== 0) {\n path = this.base + path;\n }\n var hostparts = this.getUrlParts(path);\n var parts = [];\n var hostName = hostparts[1] + hostparts[2];\n path = hostparts.length > 3 ? hostparts[3] : '';\n var queryparts = path.split('?');\n if (queryparts.length > 1) {\n path = queryparts[0];\n this.query = \"?\".concat(queryparts[1]);\n }\n\n // Register a specific path.\n var registerPath = function registerPath(name, base) {\n _this[\"\".concat(name, \"sUrl\")] = \"\".concat(base, \"/\").concat(name);\n var regex = new RegExp(\"/\".concat(name, \"/([^/]+)\"));\n if (path.search(regex) !== -1) {\n parts = path.match(regex);\n _this[\"\".concat(name, \"Url\")] = parts ? base + parts[0] : '';\n _this[\"\".concat(name, \"Id\")] = parts.length > 1 ? parts[1] : '';\n base += parts[0];\n }\n return base;\n };\n\n // Register an array of items.\n var registerItems = function registerItems(items, base, staticBase) {\n for (var i in items) {\n if (items.hasOwnProperty(i)) {\n var item = items[i];\n if (Array.isArray(item)) {\n registerItems(item, base, true);\n } else {\n var newBase = registerPath(item, base);\n base = staticBase ? base : newBase;\n }\n }\n }\n };\n if (!this.projectUrl || this.projectUrl === this.base) {\n // If a project uses Subdirectories path type, we need to specify a projectUrl\n if (!this.projectUrl && !isProjectUrl && Formio.pathType === 'Subdirectories') {\n var regex = \"^\".concat(hostName.replace(/\\//g, '\\\\/'), \".[^/]+\");\n var match = project.match(new RegExp(regex));\n this.projectUrl = match ? match[0] : hostName;\n } else {\n this.projectUrl = hostName;\n }\n }\n // Check if we have a specified path type.\n var isNotSubdomainType = false;\n if (Formio.pathType) {\n isNotSubdomainType = Formio.pathType !== 'Subdomains';\n }\n if (!this.noProject) {\n // Determine the projectUrl and projectId\n if (isProjectUrl) {\n // Get project id as project/:projectId.\n registerItems(['project'], hostName);\n path = path.replace(projectRegEx, '');\n } else if (hostName === this.base) {\n // Get project id as first part of path (subdirectory).\n if (hostparts.length > 3 && path.split('/').length > 1) {\n var isFile = path.match(/.json/);\n var pathParts = path.split('/');\n if (isFile) {\n this.projectUrl = hostName;\n } else {\n pathParts.shift(); // Throw away the first /.\n this.projectId = pathParts.shift();\n path = \"/\".concat(pathParts.join('/'));\n this.projectUrl = \"\".concat(hostName, \"/\").concat(this.projectId);\n }\n }\n } else {\n // Get project id from subdomain.\n if (hostparts.length > 2 && (hostparts[2].split('.').length > 2 || hostName.includes('localhost')) && !isNotSubdomainType) {\n this.projectUrl = hostName;\n this.projectId = hostparts[2].split('.')[0];\n }\n }\n this.projectsUrl = this.projectsUrl || \"\".concat(this.base, \"/project\");\n }\n\n // Configure Role urls and role ids.\n registerItems(['role'], this.projectUrl);\n\n // Configure Form urls and form ids.\n if (/(^|\\/)(form)($|\\/)/.test(path)) {\n registerItems(['form', ['submission', 'action', 'v']], this.projectUrl);\n } else {\n var subRegEx = new RegExp('/(submission|action|v)($|/.*)');\n var subs = path.match(subRegEx);\n this.pathType = subs && subs.length > 1 ? subs[1] : '';\n path = path.replace(subRegEx, '');\n path = path.replace(/\\/$/, '');\n this.formsUrl = \"\".concat(this.projectUrl, \"/form\");\n this.formUrl = path ? this.projectUrl + path : '';\n this.formId = path.replace(/^\\/+|\\/+$/g, '');\n var items = ['submission', 'action', 'v'];\n for (var i in items) {\n if (items.hasOwnProperty(i)) {\n var item = items[i];\n this[\"\".concat(item, \"sUrl\")] = \"\".concat(this.projectUrl + path, \"/\").concat(item);\n if (this.pathType === item && subs.length > 2 && subs[2]) {\n this[\"\".concat(item, \"Id\")] = subs[2].replace(/^\\/+|\\/+$/g, '');\n this[\"\".concat(item, \"Url\")] = this.projectUrl + path + subs[0];\n }\n }\n }\n }\n\n // Set the app url if it is not set.\n if (!Formio.projectUrlSet) {\n Formio.projectUrl = this.projectUrl;\n }\n }\n /* eslint-enable max-statements */\n _createClass(Formio, [{\n key: \"delete\",\n value: function _delete(type, opts) {\n var _id = \"\".concat(type, \"Id\");\n var _url = \"\".concat(type, \"Url\");\n if (!this[_id]) {\n return _nativePromiseOnly.default.reject('Nothing to delete');\n }\n Formio.cache = {};\n return this.makeRequest(type, this[_url], 'delete', null, opts);\n }\n }, {\n key: \"index\",\n value: function index(type, query, opts) {\n var _url = \"\".concat(type, \"Url\");\n query = query || '';\n if (query && isObject(query)) {\n query = \"?\".concat(Formio.serialize(query.params));\n }\n return this.makeRequest(type, this[_url] + query, 'get', null, opts);\n }\n }, {\n key: \"save\",\n value: function save(type, data, opts) {\n var _id = \"\".concat(type, \"Id\");\n var _url = \"\".concat(type, \"Url\");\n var method = this[_id] || data._id ? 'put' : 'post';\n var reqUrl = this[_id] ? this[_url] : this[\"\".concat(type, \"sUrl\")];\n if (!this[_id] && data._id && method === 'put' && !reqUrl.includes(data._id)) {\n reqUrl += \"/\".concat(data._id);\n }\n Formio.cache = {};\n return this.makeRequest(type, reqUrl + this.query, method, data, opts);\n }\n }, {\n key: \"load\",\n value: function load(type, query, opts) {\n var _id = \"\".concat(type, \"Id\");\n var _url = \"\".concat(type, \"Url\");\n if (query && isObject(query)) {\n query = Formio.serialize(query.params);\n }\n if (query) {\n query = this.query ? \"\".concat(this.query, \"&\").concat(query) : \"?\".concat(query);\n } else {\n query = this.query;\n }\n if (!this[_id]) {\n return _nativePromiseOnly.default.reject(\"Missing \".concat(_id));\n }\n var url = this[_url] + query;\n if (type === 'form' && !isNaN(parseInt(this.vId)) && parseInt(this.vId) !== 0) {\n url += url.match(/\\?/) ? '&' : '?';\n url += \"formRevision=\".concat(this.vId);\n }\n return this.makeRequest(type, url, 'get', null, opts);\n }\n }, {\n key: \"makeRequest\",\n value: function makeRequest() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return Formio.makeRequest.apply(Formio, [this].concat(args));\n }\n }, {\n key: \"loadProject\",\n value: function loadProject(query, opts) {\n return this.load('project', query, opts);\n }\n }, {\n key: \"saveProject\",\n value: function saveProject(data, opts) {\n return this.save('project', data, opts);\n }\n }, {\n key: \"deleteProject\",\n value: function deleteProject(opts) {\n return this.delete('project', opts);\n }\n }, {\n key: \"loadRole\",\n value: function loadRole(opts) {\n return this.load('role', null, opts);\n }\n }, {\n key: \"saveRole\",\n value: function saveRole(data, opts) {\n return this.save('role', data, opts);\n }\n }, {\n key: \"deleteRole\",\n value: function deleteRole(opts) {\n return this.delete('role', opts);\n }\n }, {\n key: \"loadRoles\",\n value: function loadRoles(opts) {\n return this.index('roles', null, opts);\n }\n }, {\n key: \"loadForm\",\n value: function loadForm(query, opts) {\n var _this2 = this;\n return this.load('form', query, opts).then(function (currentForm) {\n // Check to see if there isn't a number in vId.\n if (!currentForm.revisions || isNaN(parseInt(_this2.vId))) {\n return currentForm;\n }\n // If a submission already exists but form is marked to load current version of form.\n if (currentForm.revisions === 'current' && _this2.submissionId) {\n return currentForm;\n }\n // eslint-disable-next-line eqeqeq\n if (currentForm._vid == _this2.vId || currentForm.revisionId === _this2.vId) {\n return currentForm;\n }\n // If they specified a revision form, load the revised form components.\n if (query && isObject(query)) {\n query = Formio.serialize(query.params);\n }\n if (query) {\n query = _this2.query ? \"\".concat(_this2.query, \"&\").concat(query) : \"?\".concat(query);\n } else {\n query = _this2.query;\n }\n return _this2.makeRequest('form', _this2.vUrl + query, 'get', null, opts).then(function (revisionForm) {\n currentForm._vid = revisionForm._vid;\n currentForm.components = revisionForm.components;\n currentForm.settings = revisionForm.settings;\n currentForm.revisionId = revisionForm.revisionId;\n // Using object.assign so we don't cross polinate multiple form loads.\n return Object.assign({}, currentForm);\n })\n // If we couldn't load the revision, just return the original form.\n .catch(function () {\n return Object.assign({}, currentForm);\n });\n });\n }\n }, {\n key: \"saveForm\",\n value: function saveForm(data, opts) {\n return this.save('form', data, opts);\n }\n }, {\n key: \"deleteForm\",\n value: function deleteForm(opts) {\n return this.delete('form', opts);\n }\n }, {\n key: \"loadForms\",\n value: function loadForms(query, opts) {\n return this.index('forms', query, opts);\n }\n }, {\n key: \"loadSubmission\",\n value: function loadSubmission(query, opts) {\n var _this3 = this;\n return this.load('submission', query, opts).then(function (submission) {\n _this3.vId = submission._frid || submission._fvid;\n _this3.vUrl = \"\".concat(_this3.formUrl, \"/v/\").concat(_this3.vId);\n return submission;\n });\n }\n }, {\n key: \"saveSubmission\",\n value: function saveSubmission(data, opts) {\n if (!isNaN(parseInt(this.vId))) {\n data._fvid = this.vId;\n }\n return this.save('submission', data, opts);\n }\n }, {\n key: \"deleteSubmission\",\n value: function deleteSubmission(opts) {\n return this.delete('submission', opts);\n }\n }, {\n key: \"loadSubmissions\",\n value: function loadSubmissions(query, opts) {\n return this.index('submissions', query, opts);\n }\n }, {\n key: \"loadAction\",\n value: function loadAction(query, opts) {\n return this.load('action', query, opts);\n }\n }, {\n key: \"saveAction\",\n value: function saveAction(data, opts) {\n return this.save('action', data, opts);\n }\n }, {\n key: \"deleteAction\",\n value: function deleteAction(opts) {\n return this.delete('action', opts);\n }\n }, {\n key: \"loadActions\",\n value: function loadActions(query, opts) {\n return this.index('actions', query, opts);\n }\n }, {\n key: \"availableActions\",\n value: function availableActions() {\n return this.makeRequest('availableActions', \"\".concat(this.formUrl, \"/actions\"));\n }\n }, {\n key: \"actionInfo\",\n value: function actionInfo(name) {\n return this.makeRequest('actionInfo', \"\".concat(this.formUrl, \"/actions/\").concat(name));\n }\n }, {\n key: \"isObjectId\",\n value: function isObjectId(id) {\n var checkForHexRegExp = new RegExp('^[0-9a-fA-F]{24}$');\n return checkForHexRegExp.test(id);\n }\n }, {\n key: \"getProjectId\",\n value: function getProjectId() {\n if (!this.projectId) {\n return _nativePromiseOnly.default.resolve('');\n }\n if (this.isObjectId(this.projectId)) {\n return _nativePromiseOnly.default.resolve(this.projectId);\n } else {\n return this.loadProject().then(function (project) {\n return project._id;\n });\n }\n }\n }, {\n key: \"getFormId\",\n value: function getFormId() {\n if (!this.formId) {\n return _nativePromiseOnly.default.resolve('');\n }\n if (this.isObjectId(this.formId)) {\n return _nativePromiseOnly.default.resolve(this.formId);\n } else {\n return this.loadForm().then(function (form) {\n return form._id;\n });\n }\n }\n }, {\n key: \"currentUser\",\n value: function currentUser(options) {\n return Formio.currentUser(this, options);\n }\n }, {\n key: \"accessInfo\",\n value: function accessInfo() {\n return Formio.accessInfo(this);\n }\n\n /**\n * Returns the JWT token for this instance.\n *\n * @return {*}\n */\n }, {\n key: \"getToken\",\n value: function getToken(options) {\n return Formio.getToken(Object.assign({\n formio: this\n }, this.options, options));\n }\n\n /**\n * Sets the JWT token for this instance.\n *\n * @return {*}\n */\n }, {\n key: \"setToken\",\n value: function setToken(token, options) {\n return Formio.setToken(token, Object.assign({\n formio: this\n }, this.options, options));\n }\n\n /**\n * Returns a temporary authentication token for single purpose token generation.\n */\n }, {\n key: \"getTempToken\",\n value: function getTempToken(expire, allowed, options) {\n var token = Formio.getToken(options);\n if (!token) {\n return _nativePromiseOnly.default.reject('You must be authenticated to generate a temporary auth token.');\n }\n var authUrl = Formio.authUrl || this.projectUrl;\n return this.makeRequest('tempToken', \"\".concat(authUrl, \"/token\"), 'GET', null, {\n ignoreCache: true,\n header: new Headers({\n 'x-expire': expire,\n 'x-allow': allowed\n })\n });\n }\n\n /**\n * Get a download url for a submission PDF of this submission.\n *\n * @return {*}\n */\n }, {\n key: \"getDownloadUrl\",\n value: function getDownloadUrl(form) {\n var _this4 = this;\n if (!this.submissionId) {\n return _nativePromiseOnly.default.resolve('');\n }\n if (!form) {\n // Make sure to load the form first.\n return this.loadForm().then(function (_form) {\n if (!_form) {\n return '';\n }\n return _this4.getDownloadUrl(_form);\n });\n }\n var apiUrl = \"/project/\".concat(form.project);\n apiUrl += \"/form/\".concat(form._id);\n apiUrl += \"/submission/\".concat(this.submissionId);\n var postfix = form.submissionRevisions && form.settings.changeLog ? '/download/changelog' : '/download';\n apiUrl += postfix;\n var download = this.base + apiUrl;\n return new _nativePromiseOnly.default(function (resolve, reject) {\n _this4.getTempToken(3600, \"GET:\".concat(apiUrl)).then(function (tempToken) {\n download += \"?token=\".concat(tempToken.key);\n resolve(download);\n }, function () {\n resolve(download);\n }).catch(reject);\n });\n }\n }, {\n key: \"uploadFile\",\n value: function uploadFile(storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback) {\n var _this5 = this;\n var requestArgs = {\n provider: storage,\n method: 'upload',\n file: file,\n fileName: fileName,\n dir: dir\n };\n fileKey = fileKey || 'file';\n var request = Formio.pluginWait('preRequest', requestArgs).then(function () {\n return Formio.pluginGet('fileRequest', requestArgs).then(function (result) {\n if (storage && isNil(result)) {\n var Provider = _providers.default.getProvider('storage', storage);\n if (Provider) {\n var provider = new Provider(_this5);\n if (uploadStartCallback) {\n uploadStartCallback();\n }\n return provider.uploadFile(file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, abortCallback);\n } else {\n throw 'Storage provider not found';\n }\n }\n return result || {\n url: ''\n };\n });\n });\n return Formio.pluginAlter('wrapFileRequestPromise', request, requestArgs);\n }\n }, {\n key: \"downloadFile\",\n value: function downloadFile(file, options) {\n var _this6 = this;\n var requestArgs = {\n method: 'download',\n file: file\n };\n var request = Formio.pluginWait('preRequest', requestArgs).then(function () {\n return Formio.pluginGet('fileRequest', requestArgs).then(function (result) {\n if (file.storage && isNil(result)) {\n var Provider = _providers.default.getProvider('storage', file.storage);\n if (Provider) {\n var provider = new Provider(_this6);\n return provider.downloadFile(file, options);\n } else {\n throw 'Storage provider not found';\n }\n }\n return result || {\n url: ''\n };\n });\n });\n return Formio.pluginAlter('wrapFileRequestPromise', request, requestArgs);\n }\n }, {\n key: \"deleteFile\",\n value: function deleteFile(file, options) {\n var _this7 = this;\n var requestArgs = {\n method: 'delete',\n file: file\n };\n var request = Formio.pluginWait('preRequest', requestArgs).then(function () {\n return Formio.pluginGet('fileRequest', requestArgs).then(function (result) {\n if (file.storage && isNil(result)) {\n var Provider = _providers.default.getProvider('storage', file.storage);\n if (Provider) {\n var provider = new Provider(_this7);\n return provider.deleteFile(file, options);\n } else {\n throw 'Storage provider not found';\n }\n }\n return result || {\n url: ''\n };\n });\n });\n return Formio.pluginAlter('wrapFileRequestPromise', request, requestArgs);\n }\n\n /**\n * Returns the user permissions to a form and submission.\n *\n * @param user - The user or current user if undefined. For anonymous, use \"null\"\n * @param form - The form or current form if undefined. For no form check, use \"null\"\n * @param submission - The submisison or \"index\" if undefined.\n *\n * @return {create: boolean, read: boolean, edit: boolean, delete: boolean}\n */\n }, {\n key: \"userPermissions\",\n value: function userPermissions(user, form, submission) {\n return _nativePromiseOnly.default.all([form !== undefined ? _nativePromiseOnly.default.resolve(form) : this.loadForm(), user !== undefined ? _nativePromiseOnly.default.resolve(user) : this.currentUser(), submission !== undefined || !this.submissionId ? _nativePromiseOnly.default.resolve(submission) : this.loadSubmission(), this.accessInfo()]).then(function (results) {\n var form = results.shift();\n var user = results.shift() || {\n _id: false,\n roles: []\n };\n var submission = results.shift();\n var access = results.shift();\n var permMap = {\n create: 'create',\n read: 'read',\n update: 'edit',\n delete: 'delete'\n };\n var perms = {\n user: user,\n form: form,\n access: access,\n create: false,\n read: false,\n edit: false,\n delete: false\n };\n for (var roleName in access.roles) {\n if (access.roles.hasOwnProperty(roleName)) {\n var role = access.roles[roleName];\n if (role.default && user._id === false) {\n // User is anonymous. Add the anonymous role.\n user.roles.push(role._id);\n } else if (role.admin && user.roles.indexOf(role._id) !== -1) {\n perms.create = true;\n perms.read = true;\n perms.delete = true;\n perms.edit = true;\n return perms;\n }\n }\n }\n if (form && form.submissionAccess) {\n for (var i = 0; i < form.submissionAccess.length; i++) {\n var permission = form.submissionAccess[i];\n var _permission$type$spli = permission.type.split('_'),\n _permission$type$spli2 = _slicedToArray(_permission$type$spli, 2),\n perm = _permission$type$spli2[0],\n scope = _permission$type$spli2[1];\n if (['create', 'read', 'update', 'delete'].includes(perm)) {\n if ((0, _intersection2.default)(permission.roles, user.roles).length) {\n perms[permMap[perm]] = scope === 'all' || !submission || user._id === submission.owner;\n }\n }\n }\n }\n // check for Group Permissions\n if (submission) {\n // we would anyway need to loop through components for create permission, so we'll do that for all of them\n (0, _utils.eachComponent)(form.components, function (component, path) {\n if (component && component.defaultPermission) {\n var value = (0, _get2.default)(submission.data, path);\n // make it work for single-select Group and multi-select Group\n var groups = Array.isArray(value) ? value : [value];\n groups.forEach(function (group) {\n if (group && group._id &&\n // group id is present\n user.roles.indexOf(group._id) > -1 // user has group id in his roles\n ) {\n if (component.defaultPermission === 'read') {\n perms[permMap.read] = true;\n }\n if (component.defaultPermission === 'create') {\n perms[permMap.create] = true;\n perms[permMap.read] = true;\n }\n if (component.defaultPermission === 'write') {\n perms[permMap.create] = true;\n perms[permMap.read] = true;\n perms[permMap.update] = true;\n }\n if (component.defaultPermission === 'admin') {\n perms[permMap.create] = true;\n perms[permMap.read] = true;\n perms[permMap.update] = true;\n perms[permMap.delete] = true;\n }\n }\n });\n }\n });\n }\n return perms;\n });\n }\n\n /**\n * Determine if the current user can submit a form.\n * @return {*}\n */\n }, {\n key: \"canSubmit\",\n value: function canSubmit() {\n var _this8 = this;\n return this.userPermissions().then(function (perms) {\n // If there is user and they cannot create, then check anonymous user permissions.\n if (!perms.create && Formio.getUser()) {\n return _this8.userPermissions(null).then(function (anonPerms) {\n if (anonPerms.create) {\n Formio.setUser(null);\n return true;\n }\n return false;\n });\n }\n return perms.create;\n });\n }\n }, {\n key: \"getUrlParts\",\n value: function getUrlParts(url) {\n return Formio.getUrlParts(url, this);\n }\n }], [{\n key: \"useSessionToken\",\n value: function useSessionToken(options) {\n var tokenName = \"\".concat(options.namespace || Formio.namespace || 'formio', \"Token\");\n var token = localStorage.getItem(tokenName);\n if (token) {\n localStorage.removeItem(tokenName);\n sessionStorage.setItem(tokenName, token);\n }\n var userName = \"\".concat(options.namespace || Formio.namespace || 'formio', \"User\");\n var user = localStorage.getItem(userName);\n if (user) {\n localStorage.removeItem(userName);\n sessionStorage.setItem(userName, user);\n }\n localStorage.setItem('useSessionToken', true);\n }\n }, {\n key: \"loadProjects\",\n value: function loadProjects(query, opts) {\n query = query || '';\n if (isObject(query)) {\n query = \"?\".concat(Formio.serialize(query.params));\n }\n return Formio.makeStaticRequest(\"\".concat(Formio.baseUrl, \"/project\").concat(query), 'GET', null, opts);\n }\n }, {\n key: \"getUrlParts\",\n value: function getUrlParts(url, formio) {\n var base = formio && formio.base ? formio.base : Formio.baseUrl;\n var regex = '^(http[s]?:\\\\/\\\\/)';\n if (base && url.indexOf(base) === 0) {\n regex += \"(\".concat(base.replace(/^http[s]?:\\/\\//, ''), \")\");\n } else {\n regex += '([^/]+)';\n }\n regex += '($|\\\\/.*)';\n return url.match(new RegExp(regex));\n }\n }, {\n key: \"serialize\",\n value: function serialize(obj, _interpolate) {\n var str = [];\n var interpolate = function interpolate(item) {\n return _interpolate ? _interpolate(item) : item;\n };\n for (var p in obj) {\n if (obj.hasOwnProperty(p)) {\n str.push(\"\".concat(encodeURIComponent(p), \"=\").concat(encodeURIComponent(interpolate(obj[p]))));\n }\n }\n return str.join('&');\n }\n }, {\n key: \"getRequestArgs\",\n value: function getRequestArgs(formio, type, url, method, data, opts) {\n method = (method || 'GET').toUpperCase();\n if (!opts || !isObject(opts)) {\n opts = {};\n }\n var requestArgs = {\n url: url,\n method: method,\n data: data || null,\n opts: opts\n };\n if (type) {\n requestArgs.type = type;\n }\n if (formio) {\n requestArgs.formio = formio;\n }\n return requestArgs;\n }\n }, {\n key: \"makeStaticRequest\",\n value: function makeStaticRequest(url, method, data, opts) {\n var requestArgs = Formio.getRequestArgs(null, '', url, method, data, opts);\n var request = Formio.pluginWait('preRequest', requestArgs).then(function () {\n return Formio.pluginGet('staticRequest', requestArgs).then(function (result) {\n if (isNil(result)) {\n return Formio.request(requestArgs.url, requestArgs.method, requestArgs.data, requestArgs.opts.header, requestArgs.opts);\n }\n return result;\n });\n });\n return Formio.pluginAlter('wrapStaticRequestPromise', request, requestArgs);\n }\n }, {\n key: \"makeRequest\",\n value: function makeRequest(formio, type, url, method, data, opts) {\n if (!formio) {\n return Formio.makeStaticRequest(url, method, data, opts);\n }\n var requestArgs = Formio.getRequestArgs(formio, type, url, method, data, opts);\n requestArgs.opts = requestArgs.opts || {};\n requestArgs.opts.formio = formio;\n\n //for Formio requests default Accept and Content-type headers\n if (!requestArgs.opts.headers) {\n requestArgs.opts.headers = {};\n }\n requestArgs.opts.headers = (0, _defaults2.default)(requestArgs.opts.headers, {\n 'Accept': 'application/json',\n 'Content-type': 'application/json'\n });\n var request = Formio.pluginWait('preRequest', requestArgs).then(function () {\n return Formio.pluginGet('request', requestArgs).then(function (result) {\n if (isNil(result)) {\n return Formio.request(requestArgs.url, requestArgs.method, requestArgs.data, requestArgs.opts.header, requestArgs.opts);\n }\n return result;\n });\n });\n return Formio.pluginAlter('wrapRequestPromise', request, requestArgs);\n }\n }, {\n key: \"request\",\n value: function request(url, method, data, header, opts) {\n if (!url) {\n return _nativePromiseOnly.default.reject('No url provided');\n }\n var _Formio = Formio;\n method = (method || 'GET').toUpperCase();\n\n // For reverse compatibility, if they provided the ignoreCache parameter,\n // then change it back to the options format where that is a parameter.\n if (isBoolean(opts)) {\n opts = {\n ignoreCache: opts\n };\n }\n if (!opts || !isObject(opts)) {\n opts = {};\n }\n\n // Generate a cachekey.\n var cacheKey = btoa(encodeURI(url));\n\n // Get the cached promise to save multiple loads.\n if (!opts.ignoreCache && method === 'GET' && _Formio.cache.hasOwnProperty(cacheKey)) {\n return _nativePromiseOnly.default.resolve(cloneResponse(_Formio.cache[cacheKey]));\n }\n\n // Set up and fetch request\n var headers = header || new Headers(opts.headers || {\n 'Accept': 'application/json',\n 'Content-type': 'application/json'\n });\n var token = _Formio.getToken(opts);\n if (token && !opts.noToken) {\n headers.append('x-jwt-token', token);\n }\n\n // The fetch-ponyfill can't handle a proper Headers class anymore. Change it back to an object.\n var headerObj = {};\n headers.forEach(function (value, name) {\n headerObj[name] = value;\n });\n var options = {\n method: method,\n headers: headerObj,\n mode: 'cors'\n };\n if (data) {\n options.body = JSON.stringify(data);\n if (method === \"POST\") {\n options.body = data;\n }\n }\n\n // Allow plugins to alter the options.\n options = _Formio.pluginAlter('requestOptions', options, url);\n if (options.namespace || _Formio.namespace) {\n opts.namespace = options.namespace || _Formio.namespace;\n }\n var requestToken = options.headers['x-jwt-token'];\n var result = _Formio.pluginAlter('wrapFetchRequestPromise', _Formio.fetch(url, options), {\n url: url,\n method: method,\n data: data,\n opts: opts\n }).then(function (response) {\n // Allow plugins to respond.\n response = _Formio.pluginAlter('requestResponse', response, _Formio, data);\n if (!response.ok) {\n if (response.status === 440) {\n _Formio.setToken(null, opts);\n _Formio.events.emit('formio.sessionExpired', response.body);\n } else if (response.status === 401) {\n _Formio.events.emit('formio.unauthorized', response.body);\n } else if (response.status === 416) {\n _Formio.events.emit('formio.rangeIsNotSatisfiable', response.body);\n } else if (response.status === 504) {\n return _nativePromiseOnly.default.reject(new Error('Network request failed'));\n }\n\n // Parse and return the error as a rejected promise to reject this promise\n return (response.headers.get('content-type').includes('application/json') ? response.json() : response.text()).then(function (error) {\n return _nativePromiseOnly.default.reject(error);\n });\n }\n\n // Handle fetch results\n var token = response.headers.get('x-jwt-token');\n\n // In some strange cases, the fetch library will return an x-jwt-token without sending\n // one to the server. This has even been debugged on the server to verify that no token\n // was introduced with the request, but the response contains a token. This is an Invalid\n // case where we do not send an x-jwt-token and get one in return for any GET request.\n var tokenIntroduced = false;\n if (method === 'GET' && !requestToken && token && !opts.external && !url.includes('token=') && !url.includes('x-jwt-token=')) {\n console.warn('Token was introduced in request.');\n tokenIntroduced = true;\n }\n if (response.status >= 200 && response.status < 300 && token && token !== '' && !tokenIntroduced) {\n _Formio.setToken(token, opts);\n }\n // 204 is no content. Don't try to .json() it.\n if (response.status === 204) {\n return {};\n }\n var getResult = response.headers.get('content-type').includes('application/json') ? response.json() : response.text();\n return getResult.then(function (result) {\n // Add some content-range metadata to the result here\n var range = response.headers.get('content-range');\n if (range && isObject(result)) {\n range = range.split('/');\n if (range[0] !== '*') {\n var skipLimit = range[0].split('-');\n result.skip = Number(skipLimit[0]);\n result.limit = skipLimit[1] - skipLimit[0] + 1;\n }\n result.serverCount = range[1] === '*' ? range[1] : Number(range[1]);\n }\n if (!opts.getHeaders) {\n return result;\n }\n var headers = {};\n response.headers.forEach(function (item, key) {\n headers[key] = item;\n });\n\n // Return the result with the headers.\n return {\n result: result,\n headers: headers\n };\n });\n }).then(function (result) {\n if (opts.getHeaders) {\n return result;\n }\n\n // Cache the response.\n if (method === 'GET') {\n _Formio.cache[cacheKey] = result;\n }\n return cloneResponse(result);\n }).catch(function (err) {\n if (err === 'Bad Token') {\n _Formio.setToken(null, opts);\n _Formio.events.emit('formio.badToken', err);\n }\n if (err.message) {\n err = new Error(\"Could not connect to API server (\".concat(err.message, \"): \").concat(url));\n err.networkError = true;\n }\n if (method === 'GET') {\n delete _Formio.cache[cacheKey];\n }\n return _nativePromiseOnly.default.reject(err);\n });\n return result;\n }\n\n // Needed to maintain reverse compatability...\n }, {\n key: \"token\",\n get: function get() {\n if (!Formio.tokens) {\n Formio.tokens = {};\n }\n return Formio.tokens.formioToken || '';\n }\n\n // Needed to maintain reverse compatability...\n ,\n set: function set(token) {\n if (!Formio.tokens) {\n Formio.tokens = {};\n }\n Formio.tokens.formioToken = token || '';\n }\n }, {\n key: \"setToken\",\n value: function setToken() {\n var token = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var opts = arguments.length > 1 ? arguments[1] : undefined;\n token = token || '';\n opts = typeof opts === 'string' ? {\n namespace: opts\n } : opts || {};\n var tokenName = \"\".concat(opts.namespace || Formio.namespace || 'formio', \"Token\");\n if (!Formio.tokens) {\n Formio.tokens = {};\n }\n var storage = localStorage.getItem('useSessionToken') ? sessionStorage : localStorage;\n if (!token) {\n if (!opts.fromUser) {\n opts.fromToken = true;\n Formio.setUser(null, opts);\n }\n // iOS in private browse mode will throw an error but we can't detect ahead of time that we are in private mode.\n try {\n storage.removeItem(tokenName);\n } catch (err) {\n _browserCookies.default.erase(tokenName, {\n path: '/'\n });\n }\n Formio.tokens[tokenName] = token;\n return _nativePromiseOnly.default.resolve(null);\n }\n if (Formio.tokens[tokenName] !== token) {\n Formio.tokens[tokenName] = token;\n // iOS in private browse mode will throw an error but we can't detect ahead of time that we are in private mode.\n try {\n storage.setItem(tokenName, token);\n } catch (err) {\n _browserCookies.default.set(tokenName, token, {\n path: '/'\n });\n }\n }\n // Return or updates the current user\n return this.currentUserResolved ? Formio.currentUser(opts.formio, opts) : _nativePromiseOnly.default.resolve(null);\n }\n }, {\n key: \"getToken\",\n value: function getToken(options) {\n options = typeof options === 'string' ? {\n namespace: options\n } : options || {};\n var tokenName = \"\".concat(options.namespace || Formio.namespace || 'formio', \"Token\");\n var decodedTokenName = options.decode ? \"\".concat(tokenName, \"Decoded\") : tokenName;\n if (!Formio.tokens) {\n Formio.tokens = {};\n }\n if (Formio.tokens[decodedTokenName]) {\n return Formio.tokens[decodedTokenName];\n }\n try {\n var token = localStorage.getItem('useSessionToken') ? sessionStorage.getItem(tokenName) : localStorage.getItem(tokenName);\n Formio.tokens[tokenName] = token || '';\n if (options.decode) {\n Formio.tokens[decodedTokenName] = Formio.tokens[tokenName] ? (0, _jwtDecode.default)(Formio.tokens[tokenName]) : {};\n return Formio.tokens[decodedTokenName];\n }\n return Formio.tokens[tokenName];\n } catch (e) {\n Formio.tokens[tokenName] = _browserCookies.default.get(tokenName);\n return Formio.tokens[tokenName];\n }\n }\n }, {\n key: \"setUser\",\n value: function setUser(user) {\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var userName = \"\".concat(opts.namespace || Formio.namespace || 'formio', \"User\");\n var storage = localStorage.getItem('useSessionToken') ? sessionStorage : localStorage;\n if (!user) {\n if (!opts.fromToken) {\n opts.fromUser = true;\n Formio.setToken(null, opts);\n }\n\n // Emit an event on the cleared user.\n Formio.events.emit('formio.user', null);\n\n // iOS in private browse mode will throw an error but we can't detect ahead of time that we are in private mode.\n try {\n return storage.removeItem(userName);\n } catch (err) {\n return _browserCookies.default.erase(userName, {\n path: '/'\n });\n }\n }\n // iOS in private browse mode will throw an error but we can't detect ahead of time that we are in private mode.\n try {\n storage.setItem(userName, JSON.stringify(user));\n } catch (err) {\n _browserCookies.default.set(userName, JSON.stringify(user), {\n path: '/'\n });\n }\n\n // Emit an event on the authenticated user.\n Formio.events.emit('formio.user', user);\n }\n }, {\n key: \"getUser\",\n value: function getUser(options) {\n options = options || {};\n var userName = \"\".concat(options.namespace || Formio.namespace || 'formio', \"User\");\n try {\n return JSON.parse((localStorage.getItem('useSessionToken') ? sessionStorage : localStorage).getItem(userName) || null);\n } catch (e) {\n return JSON.parse(_browserCookies.default.get(userName));\n }\n }\n }, {\n key: \"setBaseUrl\",\n value: function setBaseUrl(url) {\n Formio.baseUrl = url;\n if (!Formio.projectUrlSet) {\n Formio.projectUrl = url;\n }\n }\n }, {\n key: \"getBaseUrl\",\n value: function getBaseUrl() {\n return Formio.baseUrl;\n }\n }, {\n key: \"setApiUrl\",\n value: function setApiUrl(url) {\n return Formio.setBaseUrl(url);\n }\n }, {\n key: \"getApiUrl\",\n value: function getApiUrl() {\n return Formio.getBaseUrl();\n }\n }, {\n key: \"setAppUrl\",\n value: function setAppUrl(url) {\n console.warn('Formio.setAppUrl() is deprecated. Use Formio.setProjectUrl instead.');\n Formio.projectUrl = url;\n Formio.projectUrlSet = true;\n }\n }, {\n key: \"setProjectUrl\",\n value: function setProjectUrl(url) {\n Formio.projectUrl = url;\n Formio.projectUrlSet = true;\n }\n }, {\n key: \"setAuthUrl\",\n value: function setAuthUrl(url) {\n Formio.authUrl = url;\n }\n }, {\n key: \"getAppUrl\",\n value: function getAppUrl() {\n console.warn('Formio.getAppUrl() is deprecated. Use Formio.getProjectUrl instead.');\n return Formio.projectUrl;\n }\n }, {\n key: \"getProjectUrl\",\n value: function getProjectUrl() {\n return Formio.projectUrl;\n }\n }, {\n key: \"clearCache\",\n value: function clearCache() {\n Formio.cache = {};\n }\n }, {\n key: \"noop\",\n value: function noop() {}\n }, {\n key: \"identity\",\n value: function identity(value) {\n return value;\n }\n }, {\n key: \"deregisterPlugin\",\n value: function deregisterPlugin(plugin) {\n var beforeLength = Formio.plugins.length;\n Formio.plugins = Formio.plugins.filter(function (p) {\n if (p !== plugin && p.__name !== plugin) {\n return true;\n }\n (p.deregister || Formio.noop).call(plugin, Formio);\n return false;\n });\n return beforeLength !== Formio.plugins.length;\n }\n }, {\n key: \"registerPlugin\",\n value: function registerPlugin(plugin, name) {\n var __Formio = Formio;\n __Formio.plugins.push(plugin);\n __Formio.plugins.sort(function (a, b) {\n return (b.priority || 0) - (a.priority || 0);\n });\n plugin.__name = name;\n (plugin.init || __Formio.noop).call(plugin, __Formio);\n }\n }, {\n key: \"getPlugin\",\n value: function getPlugin(name) {\n var _iterator = _createForOfIteratorHelper(Formio.plugins),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var plugin = _step.value;\n if (plugin.__name === name) {\n return plugin;\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n return null;\n }\n }, {\n key: \"pluginWait\",\n value: function pluginWait(pluginFn) {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n return _nativePromiseOnly.default.all(Formio.plugins.map(function (plugin) {\n var _ref;\n return (_ref = plugin[pluginFn] || Formio.noop).call.apply(_ref, [plugin].concat(args));\n }));\n }\n }, {\n key: \"pluginGet\",\n value: function pluginGet(pluginFn) {\n for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {\n args[_key3 - 1] = arguments[_key3];\n }\n var callPlugin = function callPlugin(index) {\n var _ref2;\n var plugin = Formio.plugins[index];\n if (!plugin) {\n return _nativePromiseOnly.default.resolve(null);\n }\n return _nativePromiseOnly.default.resolve((_ref2 = plugin[pluginFn] || Formio.noop).call.apply(_ref2, [plugin].concat(args))).then(function (result) {\n if (!isNil(result)) {\n return result;\n }\n return callPlugin(index + 1);\n });\n };\n return callPlugin(0);\n }\n }, {\n key: \"pluginAlter\",\n value: function pluginAlter(pluginFn, value) {\n for (var _len4 = arguments.length, args = new Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) {\n args[_key4 - 2] = arguments[_key4];\n }\n return Formio.plugins.reduce(function (value, plugin) {\n return (plugin[pluginFn] || Formio.identity).apply(void 0, [value].concat(args));\n }, value);\n }\n }, {\n key: \"accessInfo\",\n value: function accessInfo(formio) {\n var projectUrl = formio ? formio.projectUrl : Formio.projectUrl;\n return Formio.makeRequest(formio, 'accessInfo', \"\".concat(projectUrl, \"/access\"));\n }\n }, {\n key: \"projectRoles\",\n value: function projectRoles(formio) {\n var projectUrl = formio ? formio.projectUrl : Formio.projectUrl;\n return Formio.makeRequest(formio, 'projectRoles', \"\".concat(projectUrl, \"/role\"));\n }\n }, {\n key: \"currentUser\",\n value: function currentUser(formio, options) {\n var _this9 = this;\n var authUrl = Formio.authUrl;\n if (!authUrl) {\n authUrl = formio ? formio.projectUrl : Formio.projectUrl || Formio.baseUrl;\n }\n authUrl += '/current';\n var user = Formio.getUser(options);\n if (user) {\n return Formio.pluginAlter('wrapStaticRequestPromise', _nativePromiseOnly.default.resolve(user), {\n url: authUrl,\n method: 'GET',\n options: options\n });\n }\n var token = Formio.getToken(options);\n if ((!options || !options.external) && !token) {\n return Formio.pluginAlter('wrapStaticRequestPromise', _nativePromiseOnly.default.resolve(null), {\n url: authUrl,\n method: 'GET',\n options: options\n });\n }\n authUrl = \"\".concat(Formio.baseUrl, \"/current\");\n this.currentUserResolved = false;\n return Formio.makeRequest(formio, 'currentUser', authUrl, 'GET', null, options).then(function (response) {\n _this9.currentUserResolved = true;\n Formio.setUser(response, options);\n return response;\n });\n }\n }, {\n key: \"logout\",\n value: function logout(formio, options) {\n options = options || {};\n options.formio = formio;\n var projectUrl = Formio.authUrl ? Formio.authUrl : formio ? formio.projectUrl : Formio.baseUrl;\n var logout = function logout() {\n Formio.setToken(null, options);\n Formio.setUser(null, options);\n Formio.clearCache();\n localStorage.removeItem('useSessionToken');\n };\n return Formio.makeRequest(formio, 'logout', \"\".concat(projectUrl, \"/logout\")).then(function (result) {\n logout();\n return result;\n }).catch(function (err) {\n logout();\n throw err;\n });\n }\n }, {\n key: \"pageQuery\",\n value: function pageQuery() {\n var pageQuery = {};\n pageQuery.paths = [];\n var hashes = location.hash.substr(1).replace(/\\?/g, '&').split('&');\n var parts = [];\n location.search.substr(1).split('&').forEach(function (item) {\n parts = item.split('=');\n if (parts.length > 1) {\n pageQuery[parts[0]] = parts[1] && decodeURIComponent(parts[1]);\n }\n });\n hashes.forEach(function (item) {\n parts = item.split('=');\n if (parts.length > 1) {\n pageQuery[parts[0]] = parts[1] && decodeURIComponent(parts[1]);\n } else if (item.indexOf('/') === 0) {\n pageQuery.paths = item.substr(1).split('/');\n }\n });\n return pageQuery;\n }\n }, {\n key: \"oAuthCurrentUser\",\n value: function oAuthCurrentUser(formio, token) {\n return Formio.currentUser(formio, {\n external: true,\n headers: {\n Authorization: \"Bearer \".concat(token)\n }\n });\n }\n }, {\n key: \"samlInit\",\n value: function samlInit(options) {\n options = options || {};\n var query = Formio.pageQuery();\n if (query.saml) {\n Formio.setUser(null);\n var retVal = Formio.setToken(query.saml);\n var uri = window.location.toString();\n uri = uri.substring(0, uri.indexOf('?'));\n if (window.location.hash) {\n uri += window.location.hash;\n }\n window.history.replaceState({}, document.title, uri);\n return retVal;\n }\n\n // Set the relay if not provided.\n if (!options.relay) {\n options.relay = window.location.href;\n }\n\n // go to the saml sso endpoint for this project.\n var authUrl = Formio.authUrl || Formio.projectUrl;\n window.location.href = \"\".concat(authUrl, \"/saml/sso?relay=\").concat(encodeURI(options.relay));\n return false;\n }\n }, {\n key: \"oktaInit\",\n value: function oktaInit(options) {\n options = options || {};\n if ((typeof OktaAuth === \"undefined\" ? \"undefined\" : _typeof(OktaAuth)) !== undefined) {\n options.OktaAuth = OktaAuth;\n }\n if (_typeof(options.OktaAuth) === undefined) {\n var errorMessage = 'Cannot find OktaAuth. Please include the Okta JavaScript SDK within your application. See https://developer.okta.com/code/javascript/okta_auth_sdk for an example.';\n console.warn(errorMessage);\n return _nativePromiseOnly.default.reject(errorMessage);\n }\n return new _nativePromiseOnly.default(function (resolve, reject) {\n var Okta = options.OktaAuth;\n delete options.OktaAuth;\n var authClient = new Okta(options);\n authClient.tokenManager.get('accessToken').then(function (accessToken) {\n if (accessToken) {\n resolve(Formio.oAuthCurrentUser(options.formio, accessToken.accessToken));\n } else if (location.hash) {\n authClient.token.parseFromUrl().then(function (token) {\n authClient.tokenManager.add('accessToken', token);\n resolve(Formio.oAuthCurrentUser(options.formio, token.accessToken));\n }).catch(function (err) {\n console.warn(err);\n reject(err);\n });\n } else {\n authClient.token.getWithRedirect({\n responseType: 'token',\n scopes: options.scopes\n });\n resolve(false);\n }\n }).catch(function (error) {\n reject(error);\n });\n });\n }\n }, {\n key: \"ssoInit\",\n value: function ssoInit(type, options) {\n switch (type) {\n case 'saml':\n return Formio.samlInit(options);\n case 'okta':\n return Formio.oktaInit(options);\n default:\n console.warn('Unknown SSO type');\n return _nativePromiseOnly.default.reject('Unknown SSO type');\n }\n }\n }, {\n key: \"requireLibrary\",\n value: function requireLibrary(name, property, src, polling, onload) {\n if (!Formio.libraries.hasOwnProperty(name)) {\n Formio.libraries[name] = {};\n Formio.libraries[name].ready = new _nativePromiseOnly.default(function (resolve, reject) {\n Formio.libraries[name].resolve = resolve;\n Formio.libraries[name].reject = reject;\n });\n var callbackName = \"\".concat(name, \"Callback\");\n if (!polling && !window[callbackName]) {\n window[callbackName] = function () {\n return Formio.libraries[name].resolve();\n };\n }\n\n // See if the plugin already exists.\n var plugin = (0, _get2.default)(window, property);\n if (plugin) {\n Formio.libraries[name].resolve(plugin);\n } else {\n src = Array.isArray(src) ? src : [src];\n src.forEach(function (lib) {\n var attrs = {};\n var elementType = '';\n if (typeof lib === 'string') {\n lib = {\n type: 'script',\n src: lib\n };\n }\n switch (lib.type) {\n case 'script':\n elementType = 'script';\n attrs = {\n src: lib.src,\n type: 'text/javascript',\n defer: true,\n async: true,\n referrerpolicy: 'origin'\n };\n break;\n case 'styles':\n elementType = 'link';\n attrs = {\n href: lib.src,\n rel: 'stylesheet'\n };\n break;\n }\n\n // Add the script to the top of the page.\n var element = document.createElement(elementType);\n if (element.setAttribute) {\n for (var attr in attrs) {\n element.setAttribute(attr, attrs[attr]);\n }\n }\n if (onload) {\n element.addEventListener('load', function () {\n Formio.libraries[name].loaded = true;\n onload(Formio.libraries[name].ready);\n });\n }\n var _document = document,\n head = _document.head;\n if (head) {\n head.appendChild(element);\n }\n });\n\n // if no callback is provided, then check periodically for the script.\n if (polling) {\n var interval = setInterval(function () {\n var plugin = (0, _get2.default)(window, property);\n if (plugin) {\n clearInterval(interval);\n Formio.libraries[name].resolve(plugin);\n }\n }, 200);\n }\n }\n }\n var lib = Formio.libraries[name];\n return onload && lib.loaded ? onload(lib.ready) : lib.ready;\n }\n }, {\n key: \"libraryReady\",\n value: function libraryReady(name) {\n if (Formio.libraries.hasOwnProperty(name) && Formio.libraries[name].ready) {\n return Formio.libraries[name].ready;\n }\n return _nativePromiseOnly.default.reject(\"\".concat(name, \" library was not required.\"));\n }\n }, {\n key: \"addToGlobal\",\n value: function addToGlobal(global) {\n if (_typeof(global) === 'object' && !global.Formio) {\n global.Formio = Formio;\n }\n }\n }, {\n key: \"setPathType\",\n value: function setPathType(type) {\n if (typeof type === 'string') {\n Formio.pathType = type;\n }\n }\n }, {\n key: \"getPathType\",\n value: function getPathType() {\n return Formio.pathType;\n }\n }, {\n key: \"rulesEntities\",\n get: function get() {\n return {\n ValueSources: Formio.ValueSources,\n Conjunctions: Formio.Conjunctions,\n Operators: Formio.Operators,\n Transformers: Formio.Transformers,\n QuickRules: Formio.QuickRules,\n Rules: Formio.Rules\n };\n }\n }, {\n key: \"GlobalFormio\",\n get: function get() {\n if (typeof __webpack_require__.g !== 'undefined' && __webpack_require__.g.Formio) {\n return __webpack_require__.g.Formio;\n } else if (typeof window !== 'undefined' && window.Formio) {\n return window.Formio;\n }\n return Formio;\n }\n }]);\n return Formio;\n}(); // Define all the static properties.\n_defineProperty(Formio, \"currentUserResolved\", true);\nFormio.libraries = {};\nFormio.Promise = _nativePromiseOnly.default;\nFormio.fetch = fetch;\nFormio.Headers = Headers;\nFormio.baseUrl = 'https://api.form.io';\nFormio.projectUrl = Formio.baseUrl;\nFormio.authUrl = '';\nFormio.projectUrlSet = false;\nFormio.plugins = [];\nFormio.cache = {};\nFormio.Providers = _providers.default;\nFormio.version = '0.1.22';\nFormio.pathType = '';\nFormio.events = new _EventEmitter.default();\nFormio.cdn = new _CDN.default();\nif ((Formio.version || '').includes('rc')) {\n Formio.cdn.setBaseUrl('https://cdn.test-form.io');\n}\nif (typeof __webpack_require__.g !== 'undefined') {\n Formio.addToGlobal(__webpack_require__.g);\n}\nif (typeof window !== 'undefined') {\n Formio.addToGlobal(window);\n}\nvar GlobalFormio = Formio.GlobalFormio;\nexports.GlobalFormio = GlobalFormio;\nvar _default = Formio;\nexports[\"default\"] = _default;\n\n//# sourceURL=webpack://Formio/./lib/Formio.js?");
85
85
 
86
86
  /***/ }),
87
87
 
@@ -268,7 +268,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
268
268
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
269
269
 
270
270
  "use strict";
271
- eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n/**\n * Here we will derive from the base component which all Form.io form components derive from.\n *\n * @param component\n * @param options\n * @param data\n * @constructor\n */\nvar Data = /*#__PURE__*/function (_Component) {\n _inherits(Data, _Component);\n var _super = _createSuper(Data);\n function Data(component, options, data) {\n _classCallCheck(this, Data);\n return _super.call(this, component, options, data);\n }\n _createClass(Data, [{\n key: \"get\",\n value: function get(path, obj) {\n var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : \"${\".concat(path, \"}\");\n return path.split('.').reduce(function (res, key) {\n return res[key] || fb;\n }, obj);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map, fallback) {\n var _this = this;\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n return _this.get(path, map, fallback);\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n return _get(_getPrototypeOf(Data.prototype), \"render\", this).call(this, this.renderTemplate('chart'));\n }\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this2 = this;\n var refs = {};\n this.loadRefs(element, refs);\n setTimeout(function () {\n _this2.setValue();\n }, 100);\n return _get(_getPrototypeOf(Data.prototype), \"attach\", this).call(this, element);\n }\n\n /**\n * Get the value of the component from the dom elements.\n *\n * @returns {Array}\n */\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.component.url;\n }\n\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n }, {\n key: \"setValue\",\n value: function setValue() {\n var self = this;\n var container = this.element.querySelector('.chart-container');\n var header = this.component.header;\n var element;\n if (header && header.length > 0) {\n element = container.querySelector('p');\n element.textContent = this.component.header;\n }\n element = container.querySelector('iframe');\n var url;\n url = JSON.parse(this.parseTpl(JSON.stringify({\n url: this.component.url\n }), {\n data: this.rootValue\n }, null)).url;\n if (element) {\n element.src = url;\n element.height = this.component.height + \"\";\n } else {\n var tag = '<iframe style=\"border-radius:6px\" width=\"100%\" height=\"' + this.component.height + '\" src=\"' + url + '\" frameborder=\"0\"></iframe>';\n container.innerHTML += tag;\n element = container.querySelector(\"iframe\");\n }\n if (this.interval) {\n window.clearInterval(this.interval);\n this.interval = null;\n }\n var isSetting = this.element.parentElement.parentElement.parentElement.className === 'component-preview';\n if (!isSetting && this.component.interval && this.component.interval.trim().length > 0 && this.component.interval !== \"0\") {\n var interval = window.setInterval(function () {\n element.src = JSON.parse(self.parseTpl(JSON.stringify({\n url: self.component.url\n }), {\n data: self.rootValue\n }, null)).url;\n }, this.component.interval * 1000);\n this.interval = interval;\n }\n return true;\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _Field.default.schema({\n type: 'chart',\n header: '',\n url: '',\n height: 500,\n interval: 0\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Iframe Content',\n group: 'advanced',\n icon: 'rectangle-code',\n weight: 70,\n documentation: 'http://help.form.io/userguide/#table',\n schema: Data.schema()\n };\n }\n }]);\n return Data;\n}(_Field.default);\nexports[\"default\"] = Data;\n\n//# sourceURL=webpack://Formio/./lib/components/Chart/Chart.js?");
271
+ eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n/**\n * Here we will derive from the base component which all Form.io form components derive from.\n *\n * @param component\n * @param options\n * @param data\n * @constructor\n */\nvar Data = /*#__PURE__*/function (_Component) {\n _inherits(Data, _Component);\n var _super = _createSuper(Data);\n function Data(component, options, data) {\n _classCallCheck(this, Data);\n return _super.call(this, component, options, data);\n }\n _createClass(Data, [{\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n return _get(_getPrototypeOf(Data.prototype), \"render\", this).call(this, this.renderTemplate('chart'));\n }\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this = this;\n var refs = {};\n this.loadRefs(element, refs);\n setTimeout(function () {\n _this.setValue();\n }, 100);\n return _get(_getPrototypeOf(Data.prototype), \"attach\", this).call(this, element);\n }\n\n /**\n * Get the value of the component from the dom elements.\n *\n * @returns {Array}\n */\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.component.url;\n }\n\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n }, {\n key: \"setValue\",\n value: function setValue() {\n var self = this;\n var container = this.element.querySelector('.chart-container');\n var header = this.component.header;\n var element;\n if (header && header.length > 0) {\n element = container.querySelector('p');\n element.textContent = this.component.header;\n }\n element = container.querySelector('iframe');\n var url;\n url = JSON.parse(this.parseTpl(JSON.stringify({\n url: this.component.url\n }), {\n data: this.rootValue\n })).url;\n if (element) {\n element.src = url;\n element.height = this.component.height + \"\";\n } else {\n var tag = '<iframe style=\"border-radius:6px\" width=\"100%\" height=\"' + this.component.height + '\" src=\"' + url + '\" frameborder=\"0\"></iframe>';\n container.innerHTML += tag;\n element = container.querySelector(\"iframe\");\n }\n if (this.interval) {\n window.clearInterval(this.interval);\n this.interval = null;\n }\n var isSetting = this.element.parentElement.parentElement.parentElement.className === 'component-preview';\n if (!isSetting && this.component.interval && this.component.interval.trim().length > 0 && this.component.interval !== \"0\") {\n var interval = window.setInterval(function () {\n element.src = JSON.parse(self.parseTpl(JSON.stringify({\n url: self.component.url\n }), {\n data: self.rootValue\n })).url;\n }, this.component.interval * 1000);\n this.interval = interval;\n }\n return true;\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _Field.default.schema({\n type: 'chart',\n header: '',\n url: '',\n height: 500,\n interval: 0\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Iframe Content',\n group: 'advanced',\n icon: 'rectangle-code',\n weight: 70,\n documentation: 'http://help.form.io/userguide/#table',\n schema: Data.schema()\n };\n }\n }]);\n return Data;\n}(_Field.default);\nexports[\"default\"] = Data;\n\n//# sourceURL=webpack://Formio/./lib/components/Chart/Chart.js?");
272
272
 
273
273
  /***/ }),
274
274
 
@@ -312,7 +312,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
312
312
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
313
313
 
314
314
  "use strict";
315
- eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _Formio = __webpack_require__(/*! ../../Formio */ \"./lib/Formio.js\");\nvar _Checkbox = _interopRequireDefault(__webpack_require__(/*! ../checkbox/Checkbox */ \"./lib/components/checkbox/Checkbox.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar CustomCheckBox = /*#__PURE__*/function (_CheckboxComponent) {\n _inherits(CustomCheckBox, _CheckboxComponent);\n var _super = _createSuper(CustomCheckBox);\n function CustomCheckBox(component, options, data) {\n _classCallCheck(this, CustomCheckBox);\n return _super.call(this, component, options, data);\n }\n _createClass(CustomCheckBox, [{\n key: \"get\",\n value: function get(path, obj) {\n var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : \"${\".concat(path, \"}\");\n return path.split('.').reduce(function (res, key) {\n return res[key] || fb;\n }, obj);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map, fallback) {\n var _this = this;\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n return _this.get(path, map, fallback);\n });\n }\n }, {\n key: \"init\",\n value: function init() {\n _get(_getPrototypeOf(CustomCheckBox.prototype), \"init\", this).call(this);\n var self = this;\n if (self.component.defaultValueSrc === 'url' && self.component.url) {\n var _this$component = this.component,\n _this$component$optio = _this$component.options,\n options = _this$component$optio === void 0 ? '{\"headers\":{}}' : _this$component$optio,\n _this$component$body = _this$component.body,\n body = _this$component$body === void 0 ? '{}' : _this$component$body;\n var parsedOptions = {\n ignoreCache: true\n };\n var parsedBody = {};\n try {\n parsedOptions = JSON.parse(this.parseTpl(options || '{\"headers\":{}}', {\n data: this.rootValue\n }, null));\n parsedBody = JSON.parse(this.parseTpl(body || '{}', {\n data: this.rootValue\n }, null));\n } catch (e) {\n console.log(e);\n }\n // 取消请求缓存\n parsedOptions.ignoreCache = true;\n _Formio.GlobalFormio.request(this.component.url, this.component.method, this.component.method !== 'GET' ? parsedBody : null, null, parsedOptions).then(function (response) {\n if (!self.hasSetValue || self.getValue() === self.component.defaultValue) {\n self.setValue(response === 'true', {\n resetValue: true\n });\n }\n })\n // eslint-disable-next-line no-unused-vars\n .catch(function (e) {});\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _Checkbox.default.schema({\n label: 'Custom CheckBox',\n 'key': 'customCheckBox',\n 'type': 'customCheckBox'\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Custom CheckBox',\n icon: 'check-square',\n weight: 50,\n group: 'basic',\n schema: CustomCheckBox.schema()\n };\n }\n }]);\n return CustomCheckBox;\n}(_Checkbox.default);\nexports[\"default\"] = CustomCheckBox;\n\n//# sourceURL=webpack://Formio/./lib/components/CustomCheckBox/CustomCheckBox.js?");
315
+ eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _Formio = __webpack_require__(/*! ../../Formio */ \"./lib/Formio.js\");\nvar _Checkbox = _interopRequireDefault(__webpack_require__(/*! ../checkbox/Checkbox */ \"./lib/components/checkbox/Checkbox.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar CustomCheckBox = /*#__PURE__*/function (_CheckboxComponent) {\n _inherits(CustomCheckBox, _CheckboxComponent);\n var _super = _createSuper(CustomCheckBox);\n function CustomCheckBox(component, options, data) {\n _classCallCheck(this, CustomCheckBox);\n return _super.call(this, component, options, data);\n }\n _createClass(CustomCheckBox, [{\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n });\n }\n }, {\n key: \"init\",\n value: function init() {\n _get(_getPrototypeOf(CustomCheckBox.prototype), \"init\", this).call(this);\n var self = this;\n if (self.component.defaultValueSrc === 'url' && self.component.url) {\n var _this$component = this.component,\n _this$component$optio = _this$component.options,\n options = _this$component$optio === void 0 ? '{\"headers\":{}}' : _this$component$optio,\n _this$component$body = _this$component.body,\n body = _this$component$body === void 0 ? '{}' : _this$component$body;\n var parsedOptions = {\n ignoreCache: true\n };\n var parsedBody = {};\n try {\n parsedOptions = JSON.parse(this.parseTpl(options || '{\"headers\":{}}', {\n data: this.rootValue\n }));\n parsedBody = JSON.parse(this.parseTpl(body || '{}', {\n data: this.rootValue\n }));\n } catch (e) {\n console.log(e);\n }\n // 取消请求缓存\n parsedOptions.ignoreCache = true;\n _Formio.GlobalFormio.request(this.component.url, this.component.method, this.component.method !== 'GET' ? parsedBody : null, null, parsedOptions).then(function (response) {\n if (!self.hasSetValue || self.getValue() === self.component.defaultValue) {\n self.setValue(response === 'true', {\n resetValue: true\n });\n }\n })\n // eslint-disable-next-line no-unused-vars\n .catch(function (e) {});\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _Checkbox.default.schema({\n label: 'Custom CheckBox',\n 'key': 'customCheckBox',\n 'type': 'customCheckBox'\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Custom CheckBox',\n icon: 'check-square',\n weight: 50,\n group: 'basic',\n schema: CustomCheckBox.schema()\n };\n }\n }]);\n return CustomCheckBox;\n}(_Checkbox.default);\nexports[\"default\"] = CustomCheckBox;\n\n//# sourceURL=webpack://Formio/./lib/components/CustomCheckBox/CustomCheckBox.js?");
316
316
 
317
317
  /***/ }),
318
318
 
@@ -367,7 +367,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
367
367
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
368
368
 
369
369
  "use strict";
370
- eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.async-iterator.js */ \"./node_modules/core-js/modules/es.symbol.async-iterator.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-string-tag.js */ \"./node_modules/core-js/modules/es.symbol.to-string-tag.js\");\n__webpack_require__(/*! core-js/modules/es.json.to-string-tag.js */ \"./node_modules/core-js/modules/es.json.to-string-tag.js\");\n__webpack_require__(/*! core-js/modules/es.math.to-string-tag.js */ \"./node_modules/core-js/modules/es.math.to-string-tag.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.array.find-index.js */ \"./node_modules/core-js/modules/es.array.find-index.js\");\n__webpack_require__(/*! core-js/modules/es.string.ends-with.js */ \"./node_modules/core-js/modules/es.string.ends-with.js\");\n__webpack_require__(/*! core-js/modules/es.object.keys.js */ \"./node_modules/core-js/modules/es.object.keys.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.url.js */ \"./node_modules/core-js/modules/web.url.js\");\n__webpack_require__(/*! core-js/modules/web.url-search-params.js */ \"./node_modules/core-js/modules/web.url-search-params.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.slice.js */ \"./node_modules/core-js/modules/es.array.slice.js\");\n__webpack_require__(/*! core-js/modules/es.promise.js */ \"./node_modules/core-js/modules/es.promise.js\");\n__webpack_require__(/*! core-js/modules/es.array.splice.js */ \"./node_modules/core-js/modules/es.array.splice.js\");\n__webpack_require__(/*! core-js/modules/es.array.includes.js */ \"./node_modules/core-js/modules/es.array.includes.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _utils = __webpack_require__(/*! ../../utils/utils */ \"./lib/utils/utils.js\");\nvar _File = _interopRequireDefault(__webpack_require__(/*! ../file/File */ \"./lib/components/file/File.js\"));\nvar _fileProcessor = _interopRequireDefault(__webpack_require__(/*! ../../providers/processor/fileProcessor */ \"./lib/providers/processor/fileProcessor.js\"));\nvar _browserMd5File = _interopRequireDefault(__webpack_require__(/*! browser-md5-file */ \"./node_modules/browser-md5-file/dist/index.umd.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, \"throw\" === methodName && delegate.iterator.return && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method) || \"return\" !== methodName && (context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a '\" + methodName + \"' method\")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar CustomFile = /*#__PURE__*/function (_FileComponent) {\n _inherits(CustomFile, _FileComponent);\n var _super = _createSuper(CustomFile);\n function CustomFile(component, options, data) {\n _classCallCheck(this, CustomFile);\n return _super.call(this, component, options, data);\n }\n _createClass(CustomFile, [{\n key: \"attach\",\n value:\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n function attach(element) {\n var _this = this;\n var refs = {\n fileLinkDiv: 'multi'\n };\n this.loadRefs(element, refs);\n this.refs.fileLinkDiv.forEach(function (fileLink) {\n // 点击事件\n fileLink.addEventListener('click', function (event) {\n var currentIndex = _this.dataValue.findIndex(function (item) {\n return fileLink.href.endsWith(encodeURI(item.url));\n });\n var file = _this.dataValue[currentIndex];\n var _this$component$optio = _this.component.options,\n options = _this$component$optio === void 0 ? {} : _this$component$optio;\n try {\n options = JSON.parse(_this.parseTpl(options, {\n data: _this.rootValue\n }, null));\n } catch (e) {\n console.log(e);\n }\n var xhr = new XMLHttpRequest();\n xhr.open('GET', fileLink.href, true);\n //设置请求头参数的方式,如果没有可忽略此行代码\n if (options && options.headers) {\n Object.keys(options.headers).forEach(function (headerKey) {\n xhr.setRequestHeader(headerKey, options.headers[\"\".concat(headerKey)]);\n });\n }\n //设置响应类型为 blob xhr.open必须为 异步\n xhr.responseType = 'blob';\n xhr.setRequestHeader(\"Access-Control-Allow-Origin\", \"*\");\n //关键部分\n xhr.onload = function (e) {\n //如果请求执行成功\n if (this.status == 200) {\n var blob = this.response;\n var a = document.createElement('a');\n // blob.type = \"application/octet-stream\";\n var url = window.URL.createObjectURL(blob);\n a.href = url;\n a.download = file.originalName || file.name;\n document.body.appendChild(a); // 火狐浏览器 必须把元素插入body中\n a.click();\n document.body.removeChild(a);\n //释放之前创建的URL对象\n window.URL.revokeObjectURL(url);\n }\n };\n xhr.send(); // 发送ajax请求\n event.returnValue = false;\n });\n });\n // Allow basic component functionality to attach like field logic and tooltips.\n return _get(_getPrototypeOf(CustomFile.prototype), \"attach\", this).call(this, element);\n }\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.component.value;\n }\n }, {\n key: \"get\",\n value: function get(path, obj) {\n var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : \"${\".concat(path, \"}\");\n return path.split('.').reduce(function (res, key) {\n return res[key] || fb;\n }, obj);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map, fallback) {\n var _this2 = this;\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n return _this2.get(path, map, fallback);\n });\n }\n }, {\n key: \"upload\",\n value: function upload(files) {\n var _this3 = this;\n // Only allow one upload if not multiple.\n if (!this.component.multiple) {\n if (this.statuses.length) {\n this.statuses = [];\n }\n files = Array.prototype.slice.call(files, 0, 1);\n }\n if (this.component.storage && files && files.length) {\n this.fileDropHidden = true;\n\n // files is not really an array and does not have a forEach method, so fake it.\n /* eslint-disable max-statements */\n Array.prototype.forEach.call(files, /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {\n var bmf, hash, fileName, fileUpload, fileWithSameNameUploaded, fileWithSameNameUploadedWithError, dir, fileService, storage, _this3$component$opti, options, url, groupKey, groupPermissions, fileKey, groupResourceId, processedFile, fileProcessorHandler, filePromise;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n bmf = new _browserMd5File.default();\n _context.next = 3;\n return new Promise(function (resolve, reject) {\n bmf.md5(file, function (err, md5) {\n if (err) {\n return reject(err);\n }\n return resolve(md5);\n });\n });\n case 3:\n hash = _context.sent;\n fileName = (0, _utils.uniqueName)(file.name, _this3.component.fileNameTemplate, _this3.evalContext());\n fileUpload = {\n originalName: file.name,\n name: fileName,\n size: file.size,\n status: 'info',\n message: _this3.t('Processing file. Please wait...'),\n hash: hash,\n progress: 0\n }; // Check if file with the same name is being uploaded\n fileWithSameNameUploaded = _this3.dataValue.some(function (fileStatus) {\n return fileStatus.originalName === file.name;\n });\n fileWithSameNameUploadedWithError = _this3.statuses.findIndex(function (fileStatus) {\n return fileStatus.originalName === file.name && fileStatus.status === 'error';\n });\n if (fileWithSameNameUploaded) {\n fileUpload.status = 'error';\n fileUpload.message = _this3.t('File with the same name is already uploaded');\n }\n if (fileWithSameNameUploadedWithError !== -1) {\n _this3.statuses.splice(fileWithSameNameUploadedWithError, 1);\n _this3.redraw();\n }\n\n // Check file pattern\n if (_this3.component.filePattern && !_this3.validatePattern(file, _this3.component.filePattern)) {\n fileUpload.status = 'error';\n fileUpload.message = _this3.t('File is the wrong type; it must be {{ pattern }}', {\n pattern: _this3.component.filePattern\n });\n }\n\n // Check file minimum size\n if (_this3.component.fileMinSize && !_this3.validateMinSize(file, _this3.component.fileMinSize)) {\n fileUpload.status = 'error';\n fileUpload.message = _this3.t('File is too small; it must be at least {{ size }}', {\n size: _this3.component.fileMinSize\n });\n }\n\n // Check file maximum size\n if (_this3.component.fileMaxSize && !_this3.validateMaxSize(file, _this3.component.fileMaxSize)) {\n fileUpload.status = 'error';\n fileUpload.message = _this3.t('File is too big; it must be at most {{ size }}', {\n size: _this3.component.fileMaxSize\n });\n }\n\n // Get a unique name for this file to keep file collisions from occurring.\n dir = _this3.interpolate(_this3.component.dir || '');\n fileService = _this3.fileService;\n if (!fileService) {\n fileUpload.status = 'error';\n fileUpload.message = _this3.t('File Service not provided.');\n }\n _this3.statuses.push(fileUpload);\n _this3.redraw();\n if (!(fileUpload.status !== 'error')) {\n _context.next = 52;\n break;\n }\n if (_this3.component.privateDownload) {\n file.private = true;\n }\n storage = _this3.component.storage;\n _this3$component$opti = _this3.component.options, options = _this3$component$opti === void 0 ? {} : _this3$component$opti;\n try {\n options = JSON.parse(_this3.parseTpl(options, {\n data: _this3.rootValue\n }, null));\n } catch (e) {\n console.log(e);\n }\n // 解析options变量\n url = _this3.interpolate(_this3.component.url, {\n file: fileUpload\n });\n groupKey = null;\n groupPermissions = null; // Iterate through form components to find group resource if one exists\n _this3.root.everyComponent(function (element) {\n var _element$component, _element$component2;\n if ((_element$component = element.component) !== null && _element$component !== void 0 && _element$component.submissionAccess || (_element$component2 = element.component) !== null && _element$component2 !== void 0 && _element$component2.defaultPermission) {\n groupPermissions = !element.component.submissionAccess ? [{\n type: element.component.defaultPermission,\n roles: []\n }] : element.component.submissionAccess;\n groupPermissions.forEach(function (permission) {\n groupKey = ['admin', 'write', 'create'].includes(permission.type) ? element.component.key : null;\n });\n }\n });\n fileKey = _this3.component.fileKey || 'file';\n groupResourceId = groupKey ? _this3.currentForm.submission.data[groupKey]._id : null;\n processedFile = null;\n if (!_this3.root.options.fileProcessor) {\n _context.next = 49;\n break;\n }\n _context.prev = 31;\n if (_this3.refs.fileProcessingLoader) {\n _this3.refs.fileProcessingLoader.style.display = 'block';\n }\n fileProcessorHandler = (0, _fileProcessor.default)(_this3.fileService, _this3.root.options.fileProcessor);\n _context.next = 36;\n return fileProcessorHandler(file, _this3.component.properties);\n case 36:\n processedFile = _context.sent;\n _context.next = 46;\n break;\n case 39:\n _context.prev = 39;\n _context.t0 = _context[\"catch\"](31);\n fileUpload.status = 'error';\n fileUpload.message = _this3.t('File processing has been failed.');\n _this3.fileDropHidden = false;\n _this3.redraw();\n return _context.abrupt(\"return\");\n case 46:\n _context.prev = 46;\n if (_this3.refs.fileProcessingLoader) {\n _this3.refs.fileProcessingLoader.style.display = 'none';\n }\n return _context.finish(46);\n case 49:\n fileUpload.message = _this3.t('Starting upload.');\n _this3.redraw();\n filePromise = fileService.uploadFile(storage, processedFile || file, fileName, dir,\n // Progress callback\n function (evt) {\n fileUpload.status = 'progress';\n fileUpload.progress = parseInt(String(100.0 * evt.loaded / evt.total));\n delete fileUpload.message;\n _this3.redraw();\n }, url, options, fileKey, groupPermissions, groupResourceId,\n // Upload start callback\n function () {\n _this3.emit('fileUploadingStart', filePromise);\n },\n // Abort upload callback\n function (abort) {\n return _this3.abortUpload = abort;\n }).then(function (fileInfo) {\n var index = _this3.statuses.indexOf(fileUpload);\n if (index !== -1) {\n _this3.statuses.splice(index, 1);\n }\n fileInfo.originalName = file.name;\n fileInfo.hash = fileUpload.hash;\n fileInfo.url = \"\".concat(url, \"/\").concat(fileInfo.name);\n if (!_this3.hasValue()) {\n _this3.dataValue = [];\n }\n _this3.dataValue.push(fileInfo);\n _this3.fileDropHidden = false;\n _this3.redraw();\n _this3.triggerChange();\n _this3.emit('fileUploadingEnd', filePromise);\n }).catch(function (response) {\n fileUpload.status = 'error';\n fileUpload.message = typeof response === 'string' ? response : response.toString();\n delete fileUpload.progress;\n _this3.fileDropHidden = false;\n _this3.redraw();\n _this3.emit('fileUploadingEnd', filePromise);\n });\n case 52:\n case \"end\":\n return _context.stop();\n }\n }, _callee, null, [[31, 39, 46, 49]]);\n }));\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n }());\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _File.default.schema({\n label: 'Custom File',\n 'key': 'customFile',\n 'type': 'customFile'\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Custom File',\n icon: 'file',\n weight: 100,\n group: 'advanced',\n schema: CustomFile.schema()\n };\n }\n }]);\n return CustomFile;\n}(_File.default);\nexports[\"default\"] = CustomFile;\n\n//# sourceURL=webpack://Formio/./lib/components/CustomFile/CustomFile.js?");
370
+ eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.async-iterator.js */ \"./node_modules/core-js/modules/es.symbol.async-iterator.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-string-tag.js */ \"./node_modules/core-js/modules/es.symbol.to-string-tag.js\");\n__webpack_require__(/*! core-js/modules/es.json.to-string-tag.js */ \"./node_modules/core-js/modules/es.json.to-string-tag.js\");\n__webpack_require__(/*! core-js/modules/es.math.to-string-tag.js */ \"./node_modules/core-js/modules/es.math.to-string-tag.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.array.find-index.js */ \"./node_modules/core-js/modules/es.array.find-index.js\");\n__webpack_require__(/*! core-js/modules/es.string.ends-with.js */ \"./node_modules/core-js/modules/es.string.ends-with.js\");\n__webpack_require__(/*! core-js/modules/es.object.keys.js */ \"./node_modules/core-js/modules/es.object.keys.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.url.js */ \"./node_modules/core-js/modules/web.url.js\");\n__webpack_require__(/*! core-js/modules/web.url-search-params.js */ \"./node_modules/core-js/modules/web.url-search-params.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.slice.js */ \"./node_modules/core-js/modules/es.array.slice.js\");\n__webpack_require__(/*! core-js/modules/es.promise.js */ \"./node_modules/core-js/modules/es.promise.js\");\n__webpack_require__(/*! core-js/modules/es.array.splice.js */ \"./node_modules/core-js/modules/es.array.splice.js\");\n__webpack_require__(/*! core-js/modules/es.array.includes.js */ \"./node_modules/core-js/modules/es.array.includes.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _utils = __webpack_require__(/*! ../../utils/utils */ \"./lib/utils/utils.js\");\nvar _File = _interopRequireDefault(__webpack_require__(/*! ../file/File */ \"./lib/components/file/File.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nvar _fileProcessor = _interopRequireDefault(__webpack_require__(/*! ../../providers/processor/fileProcessor */ \"./lib/providers/processor/fileProcessor.js\"));\nvar _browserMd5File = _interopRequireDefault(__webpack_require__(/*! browser-md5-file */ \"./node_modules/browser-md5-file/dist/index.umd.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, \"throw\" === methodName && delegate.iterator.return && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method) || \"return\" !== methodName && (context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a '\" + methodName + \"' method\")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar CustomFile = /*#__PURE__*/function (_FileComponent) {\n _inherits(CustomFile, _FileComponent);\n var _super = _createSuper(CustomFile);\n function CustomFile(component, options, data) {\n _classCallCheck(this, CustomFile);\n return _super.call(this, component, options, data);\n }\n _createClass(CustomFile, [{\n key: \"attach\",\n value:\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n function attach(element) {\n var _this = this;\n var refs = {\n fileLinkDiv: 'multi'\n };\n this.loadRefs(element, refs);\n this.refs.fileLinkDiv.forEach(function (fileLink) {\n // 点击事件\n fileLink.addEventListener('click', function (event) {\n var currentIndex = _this.dataValue.findIndex(function (item) {\n return fileLink.href.endsWith(encodeURI(item.url));\n });\n var file = _this.dataValue[currentIndex];\n var _this$component$optio = _this.component.options,\n options = _this$component$optio === void 0 ? {} : _this$component$optio;\n try {\n options = JSON.parse(_this.parseTpl(options, {\n data: _this.rootValue\n }));\n } catch (e) {\n console.log(e);\n }\n var xhr = new XMLHttpRequest();\n xhr.open('GET', fileLink.href, true);\n //设置请求头参数的方式,如果没有可忽略此行代码\n if (options && options.headers) {\n Object.keys(options.headers).forEach(function (headerKey) {\n xhr.setRequestHeader(headerKey, options.headers[\"\".concat(headerKey)]);\n });\n }\n //设置响应类型为 blob xhr.open必须为 异步\n xhr.responseType = 'blob';\n xhr.setRequestHeader(\"Access-Control-Allow-Origin\", \"*\");\n //关键部分\n xhr.onload = function (e) {\n //如果请求执行成功\n if (this.status == 200) {\n var blob = this.response;\n var a = document.createElement('a');\n // blob.type = \"application/octet-stream\";\n var url = window.URL.createObjectURL(blob);\n a.href = url;\n a.download = file.originalName || file.name;\n document.body.appendChild(a); // 火狐浏览器 必须把元素插入body中\n a.click();\n document.body.removeChild(a);\n //释放之前创建的URL对象\n window.URL.revokeObjectURL(url);\n }\n };\n xhr.send(); // 发送ajax请求\n event.returnValue = false;\n });\n });\n // Allow basic component functionality to attach like field logic and tooltips.\n return _get(_getPrototypeOf(CustomFile.prototype), \"attach\", this).call(this, element);\n }\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.component.value;\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n });\n }\n }, {\n key: \"upload\",\n value: function upload(files) {\n var _this2 = this;\n // Only allow one upload if not multiple.\n if (!this.component.multiple) {\n if (this.statuses.length) {\n this.statuses = [];\n }\n files = Array.prototype.slice.call(files, 0, 1);\n }\n if (this.component.storage && files && files.length) {\n this.fileDropHidden = true;\n\n // files is not really an array and does not have a forEach method, so fake it.\n /* eslint-disable max-statements */\n Array.prototype.forEach.call(files, /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {\n var bmf, hash, fileName, fileUpload, fileWithSameNameUploaded, fileWithSameNameUploadedWithError, dir, fileService, storage, _this2$component$opti, options, url, groupKey, groupPermissions, fileKey, groupResourceId, processedFile, fileProcessorHandler, filePromise;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n bmf = new _browserMd5File.default();\n _context.next = 3;\n return new Promise(function (resolve, reject) {\n bmf.md5(file, function (err, md5) {\n if (err) {\n return reject(err);\n }\n return resolve(md5);\n });\n });\n case 3:\n hash = _context.sent;\n fileName = (0, _utils.uniqueName)(file.name, _this2.component.fileNameTemplate, _this2.evalContext());\n fileUpload = {\n originalName: file.name,\n name: fileName,\n size: file.size,\n status: 'info',\n message: _this2.t('Processing file. Please wait...'),\n hash: hash,\n progress: 0\n }; // Check if file with the same name is being uploaded\n fileWithSameNameUploaded = _this2.dataValue.some(function (fileStatus) {\n return fileStatus.originalName === file.name;\n });\n fileWithSameNameUploadedWithError = _this2.statuses.findIndex(function (fileStatus) {\n return fileStatus.originalName === file.name && fileStatus.status === 'error';\n });\n if (fileWithSameNameUploaded) {\n fileUpload.status = 'error';\n fileUpload.message = _this2.t('File with the same name is already uploaded');\n }\n if (fileWithSameNameUploadedWithError !== -1) {\n _this2.statuses.splice(fileWithSameNameUploadedWithError, 1);\n _this2.redraw();\n }\n\n // Check file pattern\n if (_this2.component.filePattern && !_this2.validatePattern(file, _this2.component.filePattern)) {\n fileUpload.status = 'error';\n fileUpload.message = _this2.t('File is the wrong type; it must be {{ pattern }}', {\n pattern: _this2.component.filePattern\n });\n }\n\n // Check file minimum size\n if (_this2.component.fileMinSize && !_this2.validateMinSize(file, _this2.component.fileMinSize)) {\n fileUpload.status = 'error';\n fileUpload.message = _this2.t('File is too small; it must be at least {{ size }}', {\n size: _this2.component.fileMinSize\n });\n }\n\n // Check file maximum size\n if (_this2.component.fileMaxSize && !_this2.validateMaxSize(file, _this2.component.fileMaxSize)) {\n fileUpload.status = 'error';\n fileUpload.message = _this2.t('File is too big; it must be at most {{ size }}', {\n size: _this2.component.fileMaxSize\n });\n }\n\n // Get a unique name for this file to keep file collisions from occurring.\n dir = _this2.interpolate(_this2.component.dir || '');\n fileService = _this2.fileService;\n if (!fileService) {\n fileUpload.status = 'error';\n fileUpload.message = _this2.t('File Service not provided.');\n }\n _this2.statuses.push(fileUpload);\n _this2.redraw();\n if (!(fileUpload.status !== 'error')) {\n _context.next = 52;\n break;\n }\n if (_this2.component.privateDownload) {\n file.private = true;\n }\n storage = _this2.component.storage;\n _this2$component$opti = _this2.component.options, options = _this2$component$opti === void 0 ? {} : _this2$component$opti;\n try {\n options = JSON.parse(_this2.parseTpl(options, {\n data: _this2.rootValue\n }));\n } catch (e) {\n console.log(e);\n }\n // 解析options变量\n url = _this2.interpolate(_this2.component.url, {\n file: fileUpload\n });\n groupKey = null;\n groupPermissions = null; // Iterate through form components to find group resource if one exists\n _this2.root.everyComponent(function (element) {\n var _element$component, _element$component2;\n if ((_element$component = element.component) !== null && _element$component !== void 0 && _element$component.submissionAccess || (_element$component2 = element.component) !== null && _element$component2 !== void 0 && _element$component2.defaultPermission) {\n groupPermissions = !element.component.submissionAccess ? [{\n type: element.component.defaultPermission,\n roles: []\n }] : element.component.submissionAccess;\n groupPermissions.forEach(function (permission) {\n groupKey = ['admin', 'write', 'create'].includes(permission.type) ? element.component.key : null;\n });\n }\n });\n fileKey = _this2.component.fileKey || 'file';\n groupResourceId = groupKey ? _this2.currentForm.submission.data[groupKey]._id : null;\n processedFile = null;\n if (!_this2.root.options.fileProcessor) {\n _context.next = 49;\n break;\n }\n _context.prev = 31;\n if (_this2.refs.fileProcessingLoader) {\n _this2.refs.fileProcessingLoader.style.display = 'block';\n }\n fileProcessorHandler = (0, _fileProcessor.default)(_this2.fileService, _this2.root.options.fileProcessor);\n _context.next = 36;\n return fileProcessorHandler(file, _this2.component.properties);\n case 36:\n processedFile = _context.sent;\n _context.next = 46;\n break;\n case 39:\n _context.prev = 39;\n _context.t0 = _context[\"catch\"](31);\n fileUpload.status = 'error';\n fileUpload.message = _this2.t('File processing has been failed.');\n _this2.fileDropHidden = false;\n _this2.redraw();\n return _context.abrupt(\"return\");\n case 46:\n _context.prev = 46;\n if (_this2.refs.fileProcessingLoader) {\n _this2.refs.fileProcessingLoader.style.display = 'none';\n }\n return _context.finish(46);\n case 49:\n fileUpload.message = _this2.t('Starting upload.');\n _this2.redraw();\n filePromise = fileService.uploadFile(storage, processedFile || file, fileName, dir,\n // Progress callback\n function (evt) {\n fileUpload.status = 'progress';\n fileUpload.progress = parseInt(String(100.0 * evt.loaded / evt.total));\n delete fileUpload.message;\n _this2.redraw();\n }, url, options, fileKey, groupPermissions, groupResourceId,\n // Upload start callback\n function () {\n _this2.emit('fileUploadingStart', filePromise);\n },\n // Abort upload callback\n function (abort) {\n return _this2.abortUpload = abort;\n }).then(function (fileInfo) {\n var index = _this2.statuses.indexOf(fileUpload);\n if (index !== -1) {\n _this2.statuses.splice(index, 1);\n }\n fileInfo.originalName = file.name;\n fileInfo.hash = fileUpload.hash;\n fileInfo.url = \"\".concat(url, \"/\").concat(fileInfo.name);\n if (!_this2.hasValue()) {\n _this2.dataValue = [];\n }\n _this2.dataValue.push(fileInfo);\n _this2.fileDropHidden = false;\n _this2.redraw();\n _this2.triggerChange();\n _this2.emit('fileUploadingEnd', filePromise);\n }).catch(function (response) {\n fileUpload.status = 'error';\n fileUpload.message = typeof response === 'string' ? response : response.toString();\n delete fileUpload.progress;\n _this2.fileDropHidden = false;\n _this2.redraw();\n _this2.emit('fileUploadingEnd', filePromise);\n });\n case 52:\n case \"end\":\n return _context.stop();\n }\n }, _callee, null, [[31, 39, 46, 49]]);\n }));\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n }());\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _File.default.schema({\n label: 'Custom File',\n 'key': 'customFile',\n 'type': 'customFile'\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Custom File',\n icon: 'file',\n weight: 100,\n group: 'advanced',\n schema: CustomFile.schema()\n };\n }\n }]);\n return CustomFile;\n}(_File.default);\nexports[\"default\"] = CustomFile;\n\n//# sourceURL=webpack://Formio/./lib/components/CustomFile/CustomFile.js?");
371
371
 
372
372
  /***/ }),
373
373
 
@@ -400,7 +400,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
400
400
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
401
401
 
402
402
  "use strict";
403
- eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _Formio = __webpack_require__(/*! ../../Formio */ \"./lib/Formio.js\");\nvar _Radio = _interopRequireDefault(__webpack_require__(/*! ../radio/Radio */ \"./lib/components/radio/Radio.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar CustomRadio = /*#__PURE__*/function (_RadioComponent) {\n _inherits(CustomRadio, _RadioComponent);\n var _super = _createSuper(CustomRadio);\n function CustomRadio(component, options, data) {\n _classCallCheck(this, CustomRadio);\n return _super.call(this, component, options, data);\n }\n _createClass(CustomRadio, [{\n key: \"init\",\n value: function init() {\n _get(_getPrototypeOf(CustomRadio.prototype), \"init\", this).call(this);\n var self = this;\n if (self.component.defaultValueSrc === 'url' && self.component.defaultValueUrl) {\n var _this$component = this.component,\n _this$component$defau = _this$component.defaultValueOptions,\n defaultValueOptions = _this$component$defau === void 0 ? '{\"headers\":{}}' : _this$component$defau,\n _this$component$defau2 = _this$component.defaultValueBody,\n defaultValueBody = _this$component$defau2 === void 0 ? '{}' : _this$component$defau2;\n var parsedOptions = {\n ignoreCache: true\n };\n var parsedBody = {};\n try {\n parsedOptions = JSON.parse(this.parseTpl(defaultValueOptions || '{\"headers\":{}}', {\n data: this.rootValue\n }, null));\n parsedBody = JSON.parse(this.parseTpl(defaultValueBody || '{}', {\n data: this.rootValue\n }, null));\n } catch (e) {\n console.log(e);\n }\n // 取消请求缓存\n parsedOptions.ignoreCache = true;\n _Formio.GlobalFormio.request(this.component.defaultValueUrl, this.component.defaultValueMethod, this.component.defaultValueMethod !== 'GET' ? parsedBody : null, null, parsedOptions).then(function (response) {\n if (!self.hasSetValue || _lodash.default.isEqual(self.component.defaultValue, self.getValue())) {\n self.updateValue(response[self.component.valueProperty], {\n resetValue: true\n });\n }\n }).catch(function (e) {\n console.log(e);\n });\n }\n }\n }, {\n key: \"setSelectedClasses\",\n value: function setSelectedClasses() {\n var _this = this;\n if (this.refs.wrapper) {\n // add/remove selected option class\n var value = this.dataValue;\n this.refs.wrapper.forEach(function (wrapper, index) {\n var input = _this.refs.input[index];\n var checked = input.type === 'checkbox' ? value[input.value] : input.value.toString() === value.toString();\n if (checked) {\n // add class to container when selected\n _this.addClass(wrapper, _this.optionSelectedClass);\n // change \"checked\" attribute\n // input.setAttribute('checked', 'true');\n if (!input.checked) {\n input.click();\n }\n input.setAttribute('checked', 'true');\n } else {\n _this.removeClass(wrapper, _this.optionSelectedClass);\n input.removeAttribute('checked');\n }\n });\n }\n }\n }, {\n key: \"get\",\n value: function get(path, obj) {\n var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : \"${\".concat(path, \"}\");\n return path.split('.').reduce(function (res, key) {\n return res[key] || fb;\n }, obj);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map, fallback) {\n var _this2 = this;\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n return _this2.get(path, map, fallback);\n });\n }\n }, {\n key: \"loadItems\",\n value: function loadItems(url, search, headers, options, method, body) {\n var _this3 = this;\n // Ensure we have a method and remove any body if method is get\n method = method || 'GET';\n if (method.toUpperCase() === 'GET') {\n body = null;\n }\n\n // Set ignoreCache if it is\n options.ignoreCache = this.component.ignoreCache;\n var parsedOptions = {\n header: null\n };\n var parsedBody = {};\n try {\n parsedOptions = JSON.parse(this.parseTpl(JSON.stringify(options), {\n data: this.rootValue\n }, null));\n parsedBody = JSON.parse(this.parseTpl(JSON.stringify(body), {\n data: this.rootValue\n }, null));\n }\n // eslint-disable-next-line no-empty\n catch (e) {}\n // Make the request.\n var self = this;\n headers.forEach(function (value, name) {\n headers.set(name, self.parseTpl(value, {\n data: self.rootValue\n }, null));\n });\n parsedOptions.header = headers;\n if (this.shouldLoad) {\n this.loading = true;\n _Formio.GlobalFormio.makeRequest(this.options.formio, 'select', url, method, parsedBody, parsedOptions).then(function (response) {\n _this3.loading = false;\n _this3.error = null;\n _this3.setItems(response);\n _this3.shouldLoad = false;\n _this3.redraw();\n }).catch(function (err) {\n _this3.handleLoadingError(err);\n });\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _Radio.default.schema({\n label: 'Custom Radio',\n 'key': 'customRadio',\n 'type': 'customRadio'\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Custom Radio',\n icon: 'dot-circle-o',\n weight: 70,\n group: 'basic',\n schema: CustomRadio.schema()\n };\n }\n }]);\n return CustomRadio;\n}(_Radio.default);\nexports[\"default\"] = CustomRadio;\n\n//# sourceURL=webpack://Formio/./lib/components/CustomRadio/CustomRadio.js?");
403
+ eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _Formio = __webpack_require__(/*! ../../Formio */ \"./lib/Formio.js\");\nvar _Radio = _interopRequireDefault(__webpack_require__(/*! ../radio/Radio */ \"./lib/components/radio/Radio.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar CustomRadio = /*#__PURE__*/function (_RadioComponent) {\n _inherits(CustomRadio, _RadioComponent);\n var _super = _createSuper(CustomRadio);\n function CustomRadio(component, options, data) {\n _classCallCheck(this, CustomRadio);\n return _super.call(this, component, options, data);\n }\n _createClass(CustomRadio, [{\n key: \"init\",\n value: function init() {\n _get(_getPrototypeOf(CustomRadio.prototype), \"init\", this).call(this);\n var self = this;\n if (self.component.defaultValueSrc === 'url' && self.component.defaultValueUrl) {\n var _this$component = this.component,\n _this$component$defau = _this$component.defaultValueOptions,\n defaultValueOptions = _this$component$defau === void 0 ? '{\"headers\":{}}' : _this$component$defau,\n _this$component$defau2 = _this$component.defaultValueBody,\n defaultValueBody = _this$component$defau2 === void 0 ? '{}' : _this$component$defau2;\n var parsedOptions = {\n ignoreCache: true\n };\n var parsedBody = {};\n try {\n parsedOptions = JSON.parse(this.parseTpl(defaultValueOptions || '{\"headers\":{}}', {\n data: this.rootValue\n }, null));\n parsedBody = JSON.parse(this.parseTpl(defaultValueBody || '{}', {\n data: this.rootValue\n }, null));\n } catch (e) {\n console.log(e);\n }\n // 取消请求缓存\n parsedOptions.ignoreCache = true;\n _Formio.GlobalFormio.request(this.component.defaultValueUrl, this.component.defaultValueMethod, this.component.defaultValueMethod !== 'GET' ? parsedBody : null, null, parsedOptions).then(function (response) {\n if (!self.hasSetValue || _lodash.default.isEqual(self.component.defaultValue, self.getValue())) {\n self.updateValue(response[self.component.valueProperty], {\n resetValue: true\n });\n }\n }).catch(function (e) {\n console.log(e);\n });\n }\n }\n }, {\n key: \"setSelectedClasses\",\n value: function setSelectedClasses() {\n var _this = this;\n if (this.refs.wrapper) {\n // add/remove selected option class\n var value = this.dataValue;\n this.refs.wrapper.forEach(function (wrapper, index) {\n var input = _this.refs.input[index];\n var checked = input.type === 'checkbox' ? value[input.value] : input.value.toString() === value.toString();\n if (checked) {\n // add class to container when selected\n _this.addClass(wrapper, _this.optionSelectedClass);\n // change \"checked\" attribute\n // input.setAttribute('checked', 'true');\n if (!input.checked) {\n input.click();\n }\n input.setAttribute('checked', 'true');\n } else {\n _this.removeClass(wrapper, _this.optionSelectedClass);\n input.removeAttribute('checked');\n }\n });\n }\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n });\n }\n }, {\n key: \"loadItems\",\n value: function loadItems(url, search, headers, options, method, body) {\n var _this2 = this;\n // Ensure we have a method and remove any body if method is get\n method = method || 'GET';\n if (method.toUpperCase() === 'GET') {\n body = null;\n }\n\n // Set ignoreCache if it is\n options.ignoreCache = this.component.ignoreCache;\n var parsedOptions = {\n header: null\n };\n var parsedBody = {};\n try {\n parsedOptions = JSON.parse(this.parseTpl(JSON.stringify(options), {\n data: this.rootValue\n }));\n parsedBody = JSON.parse(this.parseTpl(JSON.stringify(body), {\n data: this.rootValue\n }));\n }\n // eslint-disable-next-line no-empty\n catch (e) {}\n // Make the request.\n var self = this;\n headers.forEach(function (value, name) {\n headers.set(name, self.parseTpl(value, {\n data: self.rootValue\n }));\n });\n parsedOptions.header = headers;\n if (this.shouldLoad) {\n this.loading = true;\n _Formio.GlobalFormio.makeRequest(this.options.formio, 'select', url, method, parsedBody, parsedOptions).then(function (response) {\n _this2.loading = false;\n _this2.error = null;\n _this2.setItems(response);\n _this2.shouldLoad = false;\n _this2.redraw();\n }).catch(function (err) {\n _this2.handleLoadingError(err);\n });\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _Radio.default.schema({\n label: 'Custom Radio',\n 'key': 'customRadio',\n 'type': 'customRadio'\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Custom Radio',\n icon: 'dot-circle-o',\n weight: 70,\n group: 'basic',\n schema: CustomRadio.schema()\n };\n }\n }]);\n return CustomRadio;\n}(_Radio.default);\nexports[\"default\"] = CustomRadio;\n\n//# sourceURL=webpack://Formio/./lib/components/CustomRadio/CustomRadio.js?");
404
404
 
405
405
  /***/ }),
406
406
 
@@ -433,7 +433,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
433
433
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
434
434
 
435
435
  "use strict";
436
- eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.join.js */ \"./node_modules/core-js/modules/es.array.join.js\");\n__webpack_require__(/*! core-js/modules/es.array.sort.js */ \"./node_modules/core-js/modules/es.array.sort.js\");\n__webpack_require__(/*! core-js/modules/es.array.includes.js */ \"./node_modules/core-js/modules/es.array.includes.js\");\n__webpack_require__(/*! core-js/modules/es.string.includes.js */ \"./node_modules/core-js/modules/es.string.includes.js\");\n__webpack_require__(/*! core-js/modules/es.array.filter.js */ \"./node_modules/core-js/modules/es.array.filter.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.object.keys.js */ \"./node_modules/core-js/modules/es.object.keys.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.number.is-nan.js */ \"./node_modules/core-js/modules/es.number.is-nan.js\");\n__webpack_require__(/*! core-js/modules/es.number.is-finite.js */ \"./node_modules/core-js/modules/es.number.is-finite.js\");\n__webpack_require__(/*! core-js/modules/es.array.find.js */ \"./node_modules/core-js/modules/es.array.find.js\");\n__webpack_require__(/*! core-js/modules/es.array.map.js */ \"./node_modules/core-js/modules/es.array.map.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nvar _Select = _interopRequireDefault(__webpack_require__(/*! ../select/Select */ \"./lib/components/select/Select.js\"));\nvar _Formio = __webpack_require__(/*! ../../Formio */ \"./lib/Formio.js\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar CustomSelect = /*#__PURE__*/function (_SelectComponent) {\n _inherits(CustomSelect, _SelectComponent);\n var _super = _createSuper(CustomSelect);\n function CustomSelect(component, options, data) {\n _classCallCheck(this, CustomSelect);\n return _super.call(this, component, options, data);\n }\n _createClass(CustomSelect, [{\n key: \"get\",\n value: function get(path, obj) {\n var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : \"${\".concat(path, \"}\");\n return path.split('.').reduce(function (res, key) {\n return res[key] || fb;\n }, obj);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map, fallback) {\n var _this = this;\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n return _this.get(path, map, fallback);\n });\n }\n }, {\n key: \"loadItems\",\n value: function loadItems(url, search, headers, options, method, body) {\n var _this2 = this;\n options = options || {};\n\n // See if we should load items or not.\n if (!this.shouldLoad || !this.itemsFromUrl && this.options.readOnly) {\n this.isScrollLoading = false;\n this.loading = false;\n this.itemsLoadedResolve();\n return;\n }\n\n // See if they have not met the minimum search requirements.\n var minSearch = parseInt(this.component.minSearch, 10);\n if (this.component.searchField && minSearch > 0 && (!search || search.length < minSearch)) {\n // Set empty items.\n return this.setItems([], null);\n }\n\n // Ensure we have a method and remove any body if method is get\n method = method || 'GET';\n if (method.toUpperCase() === 'GET') {\n body = null;\n }\n var limit = this.component.limit || 100;\n var skip = this.isScrollLoading ? this.selectOptions.length : 0;\n var query = this.component.disableLimit ? {} : {\n limit: limit,\n skip: skip\n };\n\n // Allow for url interpolation.\n url = this.interpolate(url, {\n formioBase: _Formio.GlobalFormio.getBaseUrl(),\n search: search,\n limit: limit,\n skip: skip,\n page: Math.abs(Math.floor(skip / limit))\n });\n\n // Add search capability.\n if (this.component.searchField && search) {\n if (Array.isArray(search)) {\n query[\"\".concat(this.component.searchField)] = search.join(',');\n } else {\n query[\"\".concat(this.component.searchField)] = search;\n }\n }\n\n // If they wish to return only some fields.\n if (this.component.selectFields) {\n // @ts-ignore\n query.select = this.component.selectFields;\n }\n\n // Add sort capability\n if (this.component.sort) {\n // @ts-ignore\n query.sort = this.component.sort;\n }\n if (!_lodash.default.isEmpty(query)) {\n // Add the query string.\n url += (!url.includes('?') ? '?' : '&') + _Formio.GlobalFormio.serialize(query, function (item) {\n return _this2.interpolate(item);\n });\n }\n\n // Add filter capability\n if (this.component.filter) {\n url += (!url.includes('?') ? '?' : '&') + this.interpolate(this.component.filter);\n }\n\n // Set ignoreCache if it is\n options.ignoreCache = this.component.ignoreCache;\n var parsedOptions = {\n header: null\n };\n var parsedBody = {};\n try {\n parsedOptions = JSON.parse(this.parseTpl(JSON.stringify(options), {\n data: this.rootValue\n }, null));\n parsedBody = JSON.parse(this.parseTpl(JSON.stringify(body), {\n data: this.rootValue\n }, null));\n }\n // eslint-disable-next-line no-empty\n catch (e) {}\n // Make the request.\n var self = this;\n headers.forEach(function (value, name) {\n headers.set(name, self.parseTpl(value, {\n data: self.rootValue\n }, null));\n });\n parsedOptions.header = headers;\n this.loading = true;\n try {\n url = JSON.parse(this.parseTpl(JSON.stringify({\n url: url\n }), {\n data: this.rootValue\n }, null)).url;\n } catch (e) {}\n _Formio.GlobalFormio.makeRequest(this.options.formio, 'select', url, method, parsedBody, parsedOptions).then(function (response) {\n _this2.loading = false;\n _this2.error = null;\n _this2.setItems(response, !!search);\n }).catch(function (err) {\n console.log(err);\n if (_this2.itemsFromUrl) {\n console.log('err');\n _this2.setItems([], null);\n _this2.disableInfiniteScroll();\n }\n _this2.isScrollLoading = false;\n _this2.handleLoadingError(err);\n });\n }\n }, {\n key: \"normalizeSingleValue\",\n value: function normalizeSingleValue(value, retainObject) {\n var _this$root,\n _this3 = this;\n if (_lodash.default.isNil(value)) {\n return;\n }\n var valueIsObject = _lodash.default.isObject(value);\n //check if value equals to default emptyValue\n if (valueIsObject && Object.keys(value).length === 0) {\n return value;\n }\n // Check to see if we need to save off the template data into our metadata.\n if (value && !valueIsObject && this.templateData && this.templateData[value] && (_this$root = this.root) !== null && _this$root !== void 0 && _this$root.submission) {\n var submission = this.root.submission;\n if (!submission.metadata) {\n submission.metadata = {};\n }\n if (!submission.metadata.selectData) {\n submission.metadata.selectData = {};\n }\n var selectedTemplateData = _lodash.default.pickBy(this.templateData, function (value, key) {\n var dataValues = _lodash.default.isArray(_this3.dataValue) ? _this3.dataValue : [_this3.dataValue];\n return _lodash.default.includes(dataValues, key);\n });\n _lodash.default.set(submission.metadata.selectData, this.path, _lodash.default.cloneDeep(selectedTemplateData));\n }\n var displayEntireObject = this.isEntireObjectDisplay();\n var dataType = this.component.dataType || 'auto';\n var normalize = {\n value: value,\n number: function number() {\n var numberValue = Number(this.value);\n var isEquivalent = value.toString() === numberValue.toString();\n if (!Number.isNaN(numberValue) && Number.isFinite(numberValue) && value !== '' && isEquivalent) {\n this.value = numberValue;\n }\n return this;\n },\n boolean: function boolean() {\n if (_lodash.default.isString(this.value) && (this.value.toLowerCase() === 'true' || this.value.toLowerCase() === 'false')) {\n this.value = this.value.toLowerCase() === 'true';\n }\n return this;\n },\n string: function string() {\n this.value = String(this.value);\n return this;\n },\n stringarray: function stringarray() {\n this.value = String(this.value);\n return this;\n },\n object: function object() {\n if (_lodash.default.isObject(this.value) && displayEntireObject && !retainObject) {\n this.value = JSON.stringify(this.value);\n }\n return this;\n },\n auto: function auto() {\n if (_lodash.default.isObject(this.value)) {\n this.value = this.object().value;\n } else {\n this.value = this.string().number().boolean().value;\n }\n return this;\n }\n };\n try {\n return normalize[dataType]().value;\n } catch (err) {\n console.warn('Failed to normalize value', err);\n return value;\n }\n }\n }, {\n key: \"itemTemplate\",\n value: function itemTemplate(data, value) {\n if (!_lodash.default.isNumber(data) && _lodash.default.isEmpty(data)) {\n return '';\n }\n\n // If they wish to show the value in read only mode, then just return the itemValue here.\n if (this.options.readOnly && this.component.readOnlyValue) {\n return this.itemValue(data);\n }\n // Perform a fast interpretation if we should not use the template.\n if (data && !this.component.template) {\n var itemLabel = data.label || data;\n var _value = typeof itemLabel === 'string' ? this.t(itemLabel, {\n _userInput: true\n }) : itemLabel;\n return this.sanitize(_value, this.shouldSanitizeValue);\n }\n if (this.component.multiple ? Array.isArray(this.dataValue) && this.dataValue.find(function (val) {\n return value === val;\n }) : this.dataValue === value) {\n var selectData = this.selectData;\n if (selectData) {\n var templateValue = this.component.reference && value !== null && value !== void 0 && value._id ? value._id.toString() : value;\n if (!this.templateData || !this.templateData[templateValue]) {\n this.getOptionTemplate(data, value);\n }\n if (this.component.multiple) {\n if (selectData[templateValue]) {\n data = selectData[templateValue];\n }\n } else {\n data = selectData;\n }\n }\n }\n if (typeof data === 'string' || typeof data === 'number') {\n return this.sanitize(this.t(data, {\n _userInput: true\n }), this.shouldSanitizeValue);\n }\n if (data.data) {\n // checking additional fields in the template for the selected Entire Object option\n var hasNestedFields = /item\\.data\\.\\w*/g.test(this.component.template);\n data.data = this.isEntireObjectDisplay() && _lodash.default.isObject(data.data) && !hasNestedFields ? JSON.stringify(data.data) : data.data;\n }\n return _get(_getPrototypeOf(CustomSelect.prototype), \"itemTemplate\", this).call(this, data, value);\n }\n }, {\n key: \"normalizeValue\",\n value: function normalizeValue(value) {\n var _this4 = this;\n if (this.component.multiple && Array.isArray(value)) {\n var dataType = this.component.dataType || 'auto';\n if (dataType === 'stringarray') {\n return value.map(function (singleValue) {\n return _this4.normalizeSingleValue(singleValue, true);\n }).join(',');\n } else {\n return value.map(function (singleValue) {\n return _this4.normalizeSingleValue(singleValue, true);\n });\n }\n }\n return _get(_getPrototypeOf(CustomSelect.prototype), \"normalizeValue\", this).call(this, this.normalizeSingleValue(value, true));\n }\n }, {\n key: \"getValue\",\n value: function getValue() {\n // If the widget isn't active.\n if (this.viewOnly || this.loading || !this.component.lazyLoad && !this.selectOptions.length || !this.element) {\n return this.dataValue;\n }\n var value = this.emptyValue;\n if (this.choices) {\n value = this.choices.getValue(true);\n\n // Make sure we don't get the placeholder\n if (!this.component.multiple && this.component.placeholder && value === this.t(this.component.placeholder, {\n _userInput: true\n })) {\n value = this.emptyValue;\n }\n } else if (this.refs.selectContainer) {\n value = this.refs.selectContainer.value;\n if (this.valueProperty === '') {\n if (value === '') {\n return {};\n }\n var option = this.selectOptions[value];\n if (option && _lodash.default.isObject(option.value)) {\n value = option.value;\n }\n }\n } else {\n value = this.dataValue;\n }\n // Choices will return undefined if nothing is selected. We really want '' to be empty.\n if (value === undefined || value === null) {\n value = '';\n }\n return value;\n }\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var _this5 = this;\n var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n fromSubmission: false,\n noUpdateEvent: false\n };\n var previousValue = this.dataValue;\n if (this.component.widget === 'html5' && (_lodash.default.isEqual(value, previousValue) || _lodash.default.isEqual(previousValue, {}) && _lodash.default.isEqual(flags, {}))) {\n return false;\n }\n var dataType = this.component.dataType || 'auto';\n if (dataType === 'stringarray' && value.length > 0) {\n if (value.includes(',')) {\n value = value.split(',');\n } else {\n value = [value];\n }\n }\n var changed = this.updateValue(value, flags);\n value = this.dataValue;\n if (dataType === 'stringarray' && value.length > 0) {\n if (value.includes(',')) {\n value = value.split(',');\n } else {\n value = [value];\n }\n }\n var hasPreviousValue = !this.isEmpty(previousValue);\n var hasValue = !this.isEmpty(value);\n\n // Undo typing when searching to set the value.\n if (this.component.multiple && Array.isArray(value)) {\n value = value.map(function (value) {\n if (typeof value === 'boolean' || typeof value === 'number') {\n return value.toString();\n }\n return value;\n });\n } else {\n if (typeof value === 'boolean' || typeof value === 'number') {\n value = value.toString();\n }\n }\n if (this.isHtmlRenderMode() && flags && flags.fromSubmission && changed) {\n this.itemsLoaded.then(function () {\n _this5.redraw();\n });\n return changed;\n }\n\n // Do not set the value if we are loading... that will happen after it is done.\n if (this.loading) {\n return changed;\n }\n\n // Determine if we need to perform an initial lazyLoad api call if searchField is provided.\n if (this.isInitApiCallNeeded(hasValue)) {\n this.loading = true;\n this.lazyLoadInit = true;\n var searchProperty = this.component.searchField || this.component.valueProperty;\n this.triggerUpdate(_lodash.default.get(value.data || value, searchProperty, value), true);\n return changed;\n }\n\n // Add the value options.\n this.itemsLoaded.then(function () {\n _this5.addValueOptions();\n _this5.setChoicesValue(value, hasPreviousValue, flags);\n });\n return changed;\n }\n\n // eslint-disable-next-line max-statements\n }, {\n key: \"setItems\",\n value: function setItems(items, fromSearch) {\n var _this6 = this,\n _this$choices,\n _this$choices$input;\n // If the items is a string, then parse as JSON.\n if (typeof items == 'string') {\n try {\n items = JSON.parse(items);\n } catch (err) {\n console.warn(err.message);\n items = [];\n }\n }\n\n // Allow js processing (needed for form builder)\n if (this.component.onSetItems && typeof this.component.onSetItems === 'function') {\n var newItems = this.component.onSetItems(this, items);\n if (newItems) {\n items = newItems;\n }\n }\n if (!this.choices && this.refs.selectContainer) {\n this.empty(this.refs.selectContainer);\n }\n\n // If they provided select values, then we need to get them instead.\n if (this.component.selectValues) {\n items = _lodash.default.get(items, this.component.selectValues, items) || [];\n }\n var areItemsEqual;\n if (this.itemsFromUrl) {\n areItemsEqual = this.isSelectURL ? _lodash.default.isEqual(items, this.downloadedResources) : false;\n var areItemsEnded = this.component.limit > items.length;\n var areItemsDownloaded = areItemsEqual && this.downloadedResources && this.downloadedResources.length === items.length;\n if (areItemsEnded) {\n this.disableInfiniteScroll();\n } else if (areItemsDownloaded) {\n this.selectOptions = [];\n } else {\n this.serverCount = items.serverCount;\n }\n }\n if (this.isScrollLoading && items) {\n if (!areItemsEqual) {\n this.downloadedResources = this.downloadedResources ? this.downloadedResources.concat(items) : items;\n }\n this.downloadedResources.serverCount = items.serverCount || this.downloadedResources.serverCount;\n } else {\n this.downloadedResources = items || [];\n this.selectOptions = [];\n // If there is new select option with same id as already selected, set the new one\n if (!_lodash.default.isEmpty(this.dataValue) && this.component.idPath) {\n var selectedOptionId = _lodash.default.get(this.dataValue, this.component.idPath, null);\n var newOptionWithSameId = !_lodash.default.isNil(selectedOptionId) && items.find(function (item) {\n var itemId = _lodash.default.get(item, _this6.component.idPath);\n return itemId === selectedOptionId;\n });\n if (newOptionWithSameId) {\n this.setValue(newOptionWithSameId);\n }\n }\n }\n\n // Add the value options.\n if (!fromSearch) {\n this.addValueOptions(items);\n }\n if (this.component.widget === 'html5' && !this.component.placeholder) {\n this.addOption(null, '');\n }\n\n // Iterate through each of the items.\n _lodash.default.each(items, function (item, index) {\n // preventing references of the components inside the form to the parent form when building forms\n if (_this6.root && _this6.root.options.editForm && _this6.root.options.editForm._id && _this6.root.options.editForm._id === item._id) return;\n var itemValueAndLabel = _this6.selectValueAndLabel(item);\n _this6.addOption(itemValueAndLabel.value, itemValueAndLabel.label, {}, _lodash.default.get(item, _this6.component.idPath, String(index)));\n });\n if (this.choices) {\n this.choices.setChoices(this.selectOptions.filter(function (option) {\n if (_lodash.default.isObject(option)) {\n return true;\n } else {\n try {\n return !option.value.includes(',');\n } catch (e) {\n return true;\n }\n }\n }), 'value', 'label', true);\n } else if (this.loading) {\n // Re-attach select input.\n // this.appendTo(this.refs.input[0], this.selectContainer);\n }\n\n // We are no longer loading.\n this.isScrollLoading = false;\n this.loading = false;\n var searching = fromSearch && ((_this$choices = this.choices) === null || _this$choices === void 0 ? void 0 : (_this$choices$input = _this$choices.input) === null || _this$choices$input === void 0 ? void 0 : _this$choices$input.isFocussed);\n if (!searching) {\n // If a value is provided, then select it.\n if (!this.isEmpty()) {\n this.setValue(this.dataValue, {\n fromSubmission: false,\n noUpdateEvent: true\n });\n } else if (this.shouldAddDefaultValue && !this.options.readOnly) {\n // If a default value is provided then select it.\n var defaultValue = this.defaultValue;\n if (!this.isEmpty(defaultValue)) {\n this.setValue(defaultValue);\n }\n }\n }\n\n // Say we are done loading the items.\n this.itemsLoadedResolve();\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _Select.default.schema({\n label: 'Custom Select',\n 'key': 'customSelect',\n 'type': 'customSelect'\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Custom Select',\n icon: 'th-list',\n weight: 70,\n group: 'basic',\n schema: CustomSelect.schema()\n };\n }\n }]);\n return CustomSelect;\n}(_Select.default);\nexports[\"default\"] = CustomSelect;\n\n//# sourceURL=webpack://Formio/./lib/components/CustomSelect/CustomSelect.js?");
436
+ eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.join.js */ \"./node_modules/core-js/modules/es.array.join.js\");\n__webpack_require__(/*! core-js/modules/es.array.sort.js */ \"./node_modules/core-js/modules/es.array.sort.js\");\n__webpack_require__(/*! core-js/modules/es.array.includes.js */ \"./node_modules/core-js/modules/es.array.includes.js\");\n__webpack_require__(/*! core-js/modules/es.string.includes.js */ \"./node_modules/core-js/modules/es.string.includes.js\");\n__webpack_require__(/*! core-js/modules/es.array.filter.js */ \"./node_modules/core-js/modules/es.array.filter.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.object.keys.js */ \"./node_modules/core-js/modules/es.object.keys.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.number.is-nan.js */ \"./node_modules/core-js/modules/es.number.is-nan.js\");\n__webpack_require__(/*! core-js/modules/es.number.is-finite.js */ \"./node_modules/core-js/modules/es.number.is-finite.js\");\n__webpack_require__(/*! core-js/modules/es.array.find.js */ \"./node_modules/core-js/modules/es.array.find.js\");\n__webpack_require__(/*! core-js/modules/es.array.map.js */ \"./node_modules/core-js/modules/es.array.map.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nvar _Select = _interopRequireDefault(__webpack_require__(/*! ../select/Select */ \"./lib/components/select/Select.js\"));\nvar _Formio = __webpack_require__(/*! ../../Formio */ \"./lib/Formio.js\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar CustomSelect = /*#__PURE__*/function (_SelectComponent) {\n _inherits(CustomSelect, _SelectComponent);\n var _super = _createSuper(CustomSelect);\n function CustomSelect(component, options, data) {\n _classCallCheck(this, CustomSelect);\n return _super.call(this, component, options, data);\n }\n _createClass(CustomSelect, [{\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n });\n }\n }, {\n key: \"loadItems\",\n value: function loadItems(url, search, headers, options, method, body) {\n var _this = this;\n options = options || {};\n\n // See if we should load items or not.\n if (!this.shouldLoad || !this.itemsFromUrl && this.options.readOnly) {\n this.isScrollLoading = false;\n this.loading = false;\n this.itemsLoadedResolve();\n return;\n }\n\n // See if they have not met the minimum search requirements.\n var minSearch = parseInt(this.component.minSearch, 10);\n if (this.component.searchField && minSearch > 0 && (!search || search.length < minSearch)) {\n // Set empty items.\n return this.setItems([], null);\n }\n\n // Ensure we have a method and remove any body if method is get\n method = method || 'GET';\n if (method.toUpperCase() === 'GET') {\n body = null;\n }\n var limit = this.component.limit || 100;\n var skip = this.isScrollLoading ? this.selectOptions.length : 0;\n var query = this.component.disableLimit ? {} : {\n limit: limit,\n skip: skip\n };\n\n // Allow for url interpolation.\n url = this.interpolate(url, {\n formioBase: _Formio.GlobalFormio.getBaseUrl(),\n search: search,\n limit: limit,\n skip: skip,\n page: Math.abs(Math.floor(skip / limit))\n });\n\n // Add search capability.\n if (this.component.searchField && search) {\n if (Array.isArray(search)) {\n query[\"\".concat(this.component.searchField)] = search.join(',');\n } else {\n query[\"\".concat(this.component.searchField)] = search;\n }\n }\n\n // If they wish to return only some fields.\n if (this.component.selectFields) {\n // @ts-ignore\n query.select = this.component.selectFields;\n }\n\n // Add sort capability\n if (this.component.sort) {\n // @ts-ignore\n query.sort = this.component.sort;\n }\n if (!_lodash.default.isEmpty(query)) {\n // Add the query string.\n url += (!url.includes('?') ? '?' : '&') + _Formio.GlobalFormio.serialize(query, function (item) {\n return _this.interpolate(item);\n });\n }\n\n // Add filter capability\n if (this.component.filter) {\n url += (!url.includes('?') ? '?' : '&') + this.interpolate(this.component.filter);\n }\n\n // Set ignoreCache if it is\n options.ignoreCache = this.component.ignoreCache;\n var parsedOptions = {\n header: null\n };\n var parsedBody = {};\n try {\n parsedOptions = JSON.parse(this.parseTpl(JSON.stringify(options), {\n data: this.rootValue\n }));\n parsedBody = JSON.parse(this.parseTpl(JSON.stringify(body), {\n data: this.rootValue\n }));\n }\n // eslint-disable-next-line no-empty\n catch (e) {}\n // Make the request.\n var self = this;\n headers.forEach(function (value, name) {\n headers.set(name, self.parseTpl(value, {\n data: self.rootValue\n }));\n });\n parsedOptions.header = headers;\n this.loading = true;\n try {\n url = JSON.parse(this.parseTpl(JSON.stringify({\n url: url\n }), {\n data: this.rootValue\n })).url;\n } catch (e) {}\n _Formio.GlobalFormio.makeRequest(this.options.formio, 'select', url, method, parsedBody, parsedOptions).then(function (response) {\n _this.loading = false;\n _this.error = null;\n _this.setItems(response, !!search);\n }).catch(function (err) {\n console.log(err);\n if (_this.itemsFromUrl) {\n console.log('err');\n _this.setItems([], null);\n _this.disableInfiniteScroll();\n }\n _this.isScrollLoading = false;\n _this.handleLoadingError(err);\n });\n }\n }, {\n key: \"normalizeSingleValue\",\n value: function normalizeSingleValue(value, retainObject) {\n var _this$root,\n _this2 = this;\n if (_lodash.default.isNil(value)) {\n return;\n }\n var valueIsObject = _lodash.default.isObject(value);\n //check if value equals to default emptyValue\n if (valueIsObject && Object.keys(value).length === 0) {\n return value;\n }\n // Check to see if we need to save off the template data into our metadata.\n if (value && !valueIsObject && this.templateData && this.templateData[value] && (_this$root = this.root) !== null && _this$root !== void 0 && _this$root.submission) {\n var submission = this.root.submission;\n if (!submission.metadata) {\n submission.metadata = {};\n }\n if (!submission.metadata.selectData) {\n submission.metadata.selectData = {};\n }\n var selectedTemplateData = _lodash.default.pickBy(this.templateData, function (value, key) {\n var dataValues = _lodash.default.isArray(_this2.dataValue) ? _this2.dataValue : [_this2.dataValue];\n return _lodash.default.includes(dataValues, key);\n });\n _lodash.default.set(submission.metadata.selectData, this.path, _lodash.default.cloneDeep(selectedTemplateData));\n }\n var displayEntireObject = this.isEntireObjectDisplay();\n var dataType = this.component.dataType || 'auto';\n var normalize = {\n value: value,\n number: function number() {\n var numberValue = Number(this.value);\n var isEquivalent = value.toString() === numberValue.toString();\n if (!Number.isNaN(numberValue) && Number.isFinite(numberValue) && value !== '' && isEquivalent) {\n this.value = numberValue;\n }\n return this;\n },\n boolean: function boolean() {\n if (_lodash.default.isString(this.value) && (this.value.toLowerCase() === 'true' || this.value.toLowerCase() === 'false')) {\n this.value = this.value.toLowerCase() === 'true';\n }\n return this;\n },\n string: function string() {\n this.value = String(this.value);\n return this;\n },\n stringarray: function stringarray() {\n this.value = String(this.value);\n return this;\n },\n object: function object() {\n if (_lodash.default.isObject(this.value) && displayEntireObject && !retainObject) {\n this.value = JSON.stringify(this.value);\n }\n return this;\n },\n auto: function auto() {\n if (_lodash.default.isObject(this.value)) {\n this.value = this.object().value;\n } else {\n this.value = this.string().number().boolean().value;\n }\n return this;\n }\n };\n try {\n return normalize[dataType]().value;\n } catch (err) {\n console.warn('Failed to normalize value', err);\n return value;\n }\n }\n }, {\n key: \"itemTemplate\",\n value: function itemTemplate(data, value) {\n if (!_lodash.default.isNumber(data) && _lodash.default.isEmpty(data)) {\n return '';\n }\n\n // If they wish to show the value in read only mode, then just return the itemValue here.\n if (this.options.readOnly && this.component.readOnlyValue) {\n return this.itemValue(data);\n }\n // Perform a fast interpretation if we should not use the template.\n if (data && !this.component.template) {\n var itemLabel = data.label || data;\n var _value = typeof itemLabel === 'string' ? this.t(itemLabel, {\n _userInput: true\n }) : itemLabel;\n return this.sanitize(_value, this.shouldSanitizeValue);\n }\n if (this.component.multiple ? Array.isArray(this.dataValue) && this.dataValue.find(function (val) {\n return value === val;\n }) : this.dataValue === value) {\n var selectData = this.selectData;\n if (selectData) {\n var templateValue = this.component.reference && value !== null && value !== void 0 && value._id ? value._id.toString() : value;\n if (!this.templateData || !this.templateData[templateValue]) {\n this.getOptionTemplate(data, value);\n }\n if (this.component.multiple) {\n if (selectData[templateValue]) {\n data = selectData[templateValue];\n }\n } else {\n data = selectData;\n }\n }\n }\n if (typeof data === 'string' || typeof data === 'number') {\n return this.sanitize(this.t(data, {\n _userInput: true\n }), this.shouldSanitizeValue);\n }\n if (data.data) {\n // checking additional fields in the template for the selected Entire Object option\n var hasNestedFields = /item\\.data\\.\\w*/g.test(this.component.template);\n data.data = this.isEntireObjectDisplay() && _lodash.default.isObject(data.data) && !hasNestedFields ? JSON.stringify(data.data) : data.data;\n }\n return _get(_getPrototypeOf(CustomSelect.prototype), \"itemTemplate\", this).call(this, data, value);\n }\n }, {\n key: \"normalizeValue\",\n value: function normalizeValue(value) {\n var _this3 = this;\n if (this.component.multiple && Array.isArray(value)) {\n var dataType = this.component.dataType || 'auto';\n if (dataType === 'stringarray') {\n return value.map(function (singleValue) {\n return _this3.normalizeSingleValue(singleValue, true);\n }).join(',');\n } else {\n return value.map(function (singleValue) {\n return _this3.normalizeSingleValue(singleValue, true);\n });\n }\n }\n return _get(_getPrototypeOf(CustomSelect.prototype), \"normalizeValue\", this).call(this, this.normalizeSingleValue(value, true));\n }\n }, {\n key: \"getValue\",\n value: function getValue() {\n // If the widget isn't active.\n if (this.viewOnly || this.loading || !this.component.lazyLoad && !this.selectOptions.length || !this.element) {\n return this.dataValue;\n }\n var value = this.emptyValue;\n if (this.choices) {\n value = this.choices.getValue(true);\n\n // Make sure we don't get the placeholder\n if (!this.component.multiple && this.component.placeholder && value === this.t(this.component.placeholder, {\n _userInput: true\n })) {\n value = this.emptyValue;\n }\n } else if (this.refs.selectContainer) {\n value = this.refs.selectContainer.value;\n if (this.valueProperty === '') {\n if (value === '') {\n return {};\n }\n var option = this.selectOptions[value];\n if (option && _lodash.default.isObject(option.value)) {\n value = option.value;\n }\n }\n } else {\n value = this.dataValue;\n }\n // Choices will return undefined if nothing is selected. We really want '' to be empty.\n if (value === undefined || value === null) {\n value = '';\n }\n return value;\n }\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var _this4 = this;\n var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n fromSubmission: false,\n noUpdateEvent: false\n };\n var previousValue = this.dataValue;\n if (this.component.widget === 'html5' && (_lodash.default.isEqual(value, previousValue) || _lodash.default.isEqual(previousValue, {}) && _lodash.default.isEqual(flags, {}))) {\n return false;\n }\n var dataType = this.component.dataType || 'auto';\n if (dataType === 'stringarray' && value.length > 0) {\n if (value.includes(',')) {\n value = value.split(',');\n } else {\n value = [value];\n }\n }\n var changed = this.updateValue(value, flags);\n value = this.dataValue;\n if (dataType === 'stringarray' && value.length > 0) {\n if (value.includes(',')) {\n value = value.split(',');\n } else {\n value = [value];\n }\n }\n var hasPreviousValue = !this.isEmpty(previousValue);\n var hasValue = !this.isEmpty(value);\n\n // Undo typing when searching to set the value.\n if (this.component.multiple && Array.isArray(value)) {\n value = value.map(function (value) {\n if (typeof value === 'boolean' || typeof value === 'number') {\n return value.toString();\n }\n return value;\n });\n } else {\n if (typeof value === 'boolean' || typeof value === 'number') {\n value = value.toString();\n }\n }\n if (this.isHtmlRenderMode() && flags && flags.fromSubmission && changed) {\n this.itemsLoaded.then(function () {\n _this4.redraw();\n });\n return changed;\n }\n\n // Do not set the value if we are loading... that will happen after it is done.\n if (this.loading) {\n return changed;\n }\n\n // Determine if we need to perform an initial lazyLoad api call if searchField is provided.\n if (this.isInitApiCallNeeded(hasValue)) {\n this.loading = true;\n this.lazyLoadInit = true;\n var searchProperty = this.component.searchField || this.component.valueProperty;\n this.triggerUpdate(_lodash.default.get(value.data || value, searchProperty, value), true);\n return changed;\n }\n\n // Add the value options.\n this.itemsLoaded.then(function () {\n _this4.addValueOptions();\n _this4.setChoicesValue(value, hasPreviousValue, flags);\n });\n return changed;\n }\n\n // eslint-disable-next-line max-statements\n }, {\n key: \"setItems\",\n value: function setItems(items, fromSearch) {\n var _this5 = this,\n _this$choices,\n _this$choices$input;\n // If the items is a string, then parse as JSON.\n if (typeof items == 'string') {\n try {\n items = JSON.parse(items);\n } catch (err) {\n console.warn(err.message);\n items = [];\n }\n }\n\n // Allow js processing (needed for form builder)\n if (this.component.onSetItems && typeof this.component.onSetItems === 'function') {\n var newItems = this.component.onSetItems(this, items);\n if (newItems) {\n items = newItems;\n }\n }\n if (!this.choices && this.refs.selectContainer) {\n this.empty(this.refs.selectContainer);\n }\n\n // If they provided select values, then we need to get them instead.\n if (this.component.selectValues) {\n items = _lodash.default.get(items, this.component.selectValues, items) || [];\n }\n var areItemsEqual;\n if (this.itemsFromUrl) {\n areItemsEqual = this.isSelectURL ? _lodash.default.isEqual(items, this.downloadedResources) : false;\n var areItemsEnded = this.component.limit > items.length;\n var areItemsDownloaded = areItemsEqual && this.downloadedResources && this.downloadedResources.length === items.length;\n if (areItemsEnded) {\n this.disableInfiniteScroll();\n } else if (areItemsDownloaded) {\n this.selectOptions = [];\n } else {\n this.serverCount = items.serverCount;\n }\n }\n if (this.isScrollLoading && items) {\n if (!areItemsEqual) {\n this.downloadedResources = this.downloadedResources ? this.downloadedResources.concat(items) : items;\n }\n this.downloadedResources.serverCount = items.serverCount || this.downloadedResources.serverCount;\n } else {\n this.downloadedResources = items || [];\n this.selectOptions = [];\n // If there is new select option with same id as already selected, set the new one\n if (!_lodash.default.isEmpty(this.dataValue) && this.component.idPath) {\n var selectedOptionId = _lodash.default.get(this.dataValue, this.component.idPath, null);\n var newOptionWithSameId = !_lodash.default.isNil(selectedOptionId) && items.find(function (item) {\n var itemId = _lodash.default.get(item, _this5.component.idPath);\n return itemId === selectedOptionId;\n });\n if (newOptionWithSameId) {\n this.setValue(newOptionWithSameId);\n }\n }\n }\n\n // Add the value options.\n if (!fromSearch) {\n this.addValueOptions(items);\n }\n if (this.component.widget === 'html5' && !this.component.placeholder) {\n this.addOption(null, '');\n }\n\n // Iterate through each of the items.\n _lodash.default.each(items, function (item, index) {\n // preventing references of the components inside the form to the parent form when building forms\n if (_this5.root && _this5.root.options.editForm && _this5.root.options.editForm._id && _this5.root.options.editForm._id === item._id) return;\n var itemValueAndLabel = _this5.selectValueAndLabel(item);\n _this5.addOption(itemValueAndLabel.value, itemValueAndLabel.label, {}, _lodash.default.get(item, _this5.component.idPath, String(index)));\n });\n if (this.choices) {\n this.choices.setChoices(this.selectOptions.filter(function (option) {\n if (_lodash.default.isObject(option)) {\n return true;\n } else {\n try {\n return !option.value.includes(',');\n } catch (e) {\n return true;\n }\n }\n }), 'value', 'label', true);\n } else if (this.loading) {\n // Re-attach select input.\n // this.appendTo(this.refs.input[0], this.selectContainer);\n }\n\n // We are no longer loading.\n this.isScrollLoading = false;\n this.loading = false;\n var searching = fromSearch && ((_this$choices = this.choices) === null || _this$choices === void 0 ? void 0 : (_this$choices$input = _this$choices.input) === null || _this$choices$input === void 0 ? void 0 : _this$choices$input.isFocussed);\n if (!searching) {\n // If a value is provided, then select it.\n if (!this.isEmpty()) {\n this.setValue(this.dataValue, {\n fromSubmission: false,\n noUpdateEvent: true\n });\n } else if (this.shouldAddDefaultValue && !this.options.readOnly) {\n // If a default value is provided then select it.\n var defaultValue = this.defaultValue;\n if (!this.isEmpty(defaultValue)) {\n this.setValue(defaultValue);\n }\n }\n }\n\n // Say we are done loading the items.\n this.itemsLoadedResolve();\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _Select.default.schema({\n label: 'Custom Select',\n 'key': 'customSelect',\n 'type': 'customSelect'\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Custom Select',\n icon: 'th-list',\n weight: 70,\n group: 'basic',\n schema: CustomSelect.schema()\n };\n }\n }]);\n return CustomSelect;\n}(_Select.default);\nexports[\"default\"] = CustomSelect;\n\n//# sourceURL=webpack://Formio/./lib/components/CustomSelect/CustomSelect.js?");
437
437
 
438
438
  /***/ }),
439
439
 
@@ -499,7 +499,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
499
499
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
500
500
 
501
501
  "use strict";
502
- eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _Formio = __webpack_require__(/*! ../../Formio */ \"./lib/Formio.js\");\nvar _TextArea = _interopRequireDefault(__webpack_require__(/*! ../textarea/TextArea */ \"./lib/components/textarea/TextArea.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar CustomTextArea = /*#__PURE__*/function (_TextAreaComponent) {\n _inherits(CustomTextArea, _TextAreaComponent);\n var _super = _createSuper(CustomTextArea);\n function CustomTextArea(component, options, data) {\n _classCallCheck(this, CustomTextArea);\n return _super.call(this, component, options, data);\n }\n _createClass(CustomTextArea, [{\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n return _lodash.default.get(map, path);\n });\n }\n }, {\n key: \"init\",\n value: function init() {\n var _this = this;\n _get(_getPrototypeOf(CustomTextArea.prototype), \"init\", this).call(this);\n var self = this;\n setTimeout(function () {\n if (self.component.defaultValueSrc === 'value' && self.component.defaultValue) {\n var defaultValue = _this.parseTpl(self.component.defaultValue, {\n data: _this.rootValue\n });\n if (!self.hasSetValue || self.getValue() === self.component.defaultValue) {\n self.setValue(defaultValue, {\n resetValue: true\n });\n }\n }\n }, 200);\n if (self.component.defaultValueSrc === 'url' && self.component.url) {\n var _this$component = this.component,\n _this$component$optio = _this$component.options,\n options = _this$component$optio === void 0 ? '{\"headers\":{}}' : _this$component$optio,\n _this$component$body = _this$component.body,\n body = _this$component$body === void 0 ? '{}' : _this$component$body;\n var parsedOptions = {\n ignoreCache: true\n };\n var parsedBody = {};\n try {\n parsedOptions = JSON.parse(this.parseTpl(options || '{\"headers\":{}}', {\n data: this.rootValue\n }, null));\n parsedBody = JSON.parse(this.parseTpl(body || '{}', {\n data: this.rootValue\n }, null));\n } catch (e) {\n console.log(e);\n }\n // 取消请求缓存\n parsedOptions.ignoreCache = true;\n _Formio.GlobalFormio.request(this.component.url, this.component.methods, this.component.methods !== 'GET' ? parsedBody : null, null, parsedOptions).then(function (response) {\n if (!self.hasSetValue || self.getValue() === self.component.defaultValue) {\n self.setValue(response, {\n resetValue: true\n });\n }\n })\n // eslint-disable-next-line no-unused-vars\n .catch(function (e) {});\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _TextArea.default.schema({\n label: 'Custom TextArea',\n 'key': 'customTextArea',\n 'type': 'customTextArea'\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Custom TextArea',\n icon: 'font',\n weight: 20,\n group: 'basic',\n schema: CustomTextArea.schema()\n };\n }\n }]);\n return CustomTextArea;\n}(_TextArea.default);\nexports[\"default\"] = CustomTextArea;\n\n//# sourceURL=webpack://Formio/./lib/components/CustomTextArea/CustomTextArea.js?");
502
+ eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _Formio = __webpack_require__(/*! ../../Formio */ \"./lib/Formio.js\");\nvar _TextArea = _interopRequireDefault(__webpack_require__(/*! ../textarea/TextArea */ \"./lib/components/textarea/TextArea.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar CustomTextArea = /*#__PURE__*/function (_TextAreaComponent) {\n _inherits(CustomTextArea, _TextAreaComponent);\n var _super = _createSuper(CustomTextArea);\n function CustomTextArea(component, options, data) {\n _classCallCheck(this, CustomTextArea);\n return _super.call(this, component, options, data);\n }\n _createClass(CustomTextArea, [{\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n });\n }\n }, {\n key: \"init\",\n value: function init() {\n var _this = this;\n _get(_getPrototypeOf(CustomTextArea.prototype), \"init\", this).call(this);\n var self = this;\n setTimeout(function () {\n if (self.component.defaultValueSrc === 'value' && self.component.defaultValue) {\n var defaultValue = _this.parseTpl(self.component.defaultValue, {\n data: _this.rootValue\n });\n if (!self.hasSetValue || self.getValue() === self.component.defaultValue) {\n self.setValue(defaultValue, {\n resetValue: true\n });\n }\n }\n }, 200);\n if (self.component.defaultValueSrc === 'url' && self.component.url) {\n var _this$component = this.component,\n _this$component$optio = _this$component.options,\n options = _this$component$optio === void 0 ? '{\"headers\":{}}' : _this$component$optio,\n _this$component$body = _this$component.body,\n body = _this$component$body === void 0 ? '{}' : _this$component$body;\n var parsedOptions = {\n ignoreCache: true\n };\n var parsedBody = {};\n try {\n parsedOptions = JSON.parse(this.parseTpl(options || '{\"headers\":{}}', {\n data: this.rootValue\n }));\n parsedBody = JSON.parse(this.parseTpl(body || '{}', {\n data: this.rootValue\n }));\n } catch (e) {\n console.log(e);\n }\n // 取消请求缓存\n parsedOptions.ignoreCache = true;\n _Formio.GlobalFormio.request(this.component.url, this.component.methods, this.component.methods !== 'GET' ? parsedBody : null, null, parsedOptions).then(function (response) {\n if (!self.hasSetValue || self.getValue() === self.component.defaultValue) {\n self.setValue(response, {\n resetValue: true\n });\n }\n })\n // eslint-disable-next-line no-unused-vars\n .catch(function (e) {});\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _TextArea.default.schema({\n label: 'Custom TextArea',\n 'key': 'customTextArea',\n 'type': 'customTextArea'\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Custom TextArea',\n icon: 'font',\n weight: 20,\n group: 'basic',\n schema: CustomTextArea.schema()\n };\n }\n }]);\n return CustomTextArea;\n}(_TextArea.default);\nexports[\"default\"] = CustomTextArea;\n\n//# sourceURL=webpack://Formio/./lib/components/CustomTextArea/CustomTextArea.js?");
503
503
 
504
504
  /***/ }),
505
505
 
@@ -532,7 +532,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
532
532
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
533
533
 
534
534
  "use strict";
535
- eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _Formio = __webpack_require__(/*! ../../Formio */ \"./lib/Formio.js\");\nvar _TextField = _interopRequireDefault(__webpack_require__(/*! ../textfield/TextField */ \"./lib/components/textfield/TextField.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar CustomTextField = /*#__PURE__*/function (_TextFieldComponent) {\n _inherits(CustomTextField, _TextFieldComponent);\n var _super = _createSuper(CustomTextField);\n function CustomTextField(component, options, data) {\n _classCallCheck(this, CustomTextField);\n return _super.call(this, component, options, data);\n }\n _createClass(CustomTextField, [{\n key: \"get\",\n value: function get(path, obj) {\n var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : \"${\".concat(path, \"}\");\n return path.split('.').reduce(function (res, key) {\n return res[key] || fb;\n }, obj);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map, fallback) {\n var _this = this;\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n return _this.get(path, map, fallback);\n });\n }\n }, {\n key: \"init\",\n value: function init() {\n _get(_getPrototypeOf(CustomTextField.prototype), \"init\", this).call(this);\n var self = this;\n if (self.component.defaultValueSrc === 'url' && self.component.url) {\n var _this$component = this.component,\n _this$component$optio = _this$component.options,\n options = _this$component$optio === void 0 ? '{\"headers\":{}}' : _this$component$optio,\n _this$component$body = _this$component.body,\n body = _this$component$body === void 0 ? '{}' : _this$component$body;\n var parsedOptions = {\n ignoreCache: true\n };\n var parsedBody = {};\n try {\n parsedOptions = JSON.parse(this.parseTpl(options || '{\"headers\":{}}', {\n data: this.rootValue\n }, null));\n parsedBody = JSON.parse(this.parseTpl(body || '{}', {\n data: this.rootValue\n }, null));\n } catch (e) {\n console.log(e);\n }\n // 取消请求缓存\n parsedOptions.ignoreCache = true;\n _Formio.GlobalFormio.request(this.component.url, this.component.methods, this.component.methods !== 'GET' ? parsedBody : null, null, parsedOptions).then(function (response) {\n if (!self.hasSetValue || self.getValue() === self.component.defaultValue) {\n self.setValue(response, {\n resetValue: true\n });\n }\n })\n // eslint-disable-next-line no-unused-vars\n .catch(function (e) {});\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _TextField.default.schema({\n label: 'Custom TextField',\n 'key': 'customTextField',\n 'type': 'customTextField'\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Custom TextField',\n icon: 'terminal',\n weight: 0,\n group: 'basic',\n schema: CustomTextField.schema()\n };\n }\n }]);\n return CustomTextField;\n}(_TextField.default);\nexports[\"default\"] = CustomTextField;\n\n//# sourceURL=webpack://Formio/./lib/components/CustomTextField/CustomTextField.js?");
535
+ eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _Formio = __webpack_require__(/*! ../../Formio */ \"./lib/Formio.js\");\nvar _TextField = _interopRequireDefault(__webpack_require__(/*! ../textfield/TextField */ \"./lib/components/textfield/TextField.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar CustomTextField = /*#__PURE__*/function (_TextFieldComponent) {\n _inherits(CustomTextField, _TextFieldComponent);\n var _super = _createSuper(CustomTextField);\n function CustomTextField(component, options, data) {\n _classCallCheck(this, CustomTextField);\n return _super.call(this, component, options, data);\n }\n _createClass(CustomTextField, [{\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n });\n }\n }, {\n key: \"init\",\n value: function init() {\n _get(_getPrototypeOf(CustomTextField.prototype), \"init\", this).call(this);\n var self = this;\n if (self.component.defaultValueSrc === 'url' && self.component.url) {\n var _this$component = this.component,\n _this$component$optio = _this$component.options,\n options = _this$component$optio === void 0 ? '{\"headers\":{}}' : _this$component$optio,\n _this$component$body = _this$component.body,\n body = _this$component$body === void 0 ? '{}' : _this$component$body;\n var parsedOptions = {\n ignoreCache: true\n };\n var parsedBody = {};\n try {\n parsedOptions = JSON.parse(this.parseTpl(options || '{\"headers\":{}}', {\n data: this.rootValue\n }));\n parsedBody = JSON.parse(this.parseTpl(body || '{}', {\n data: this.rootValue\n }));\n } catch (e) {\n console.log(e);\n }\n // 取消请求缓存\n parsedOptions.ignoreCache = true;\n _Formio.GlobalFormio.request(this.component.url, this.component.methods, this.component.methods !== 'GET' ? parsedBody : null, null, parsedOptions).then(function (response) {\n if (!self.hasSetValue || self.getValue() === self.component.defaultValue) {\n self.setValue(response, {\n resetValue: true\n });\n }\n })\n // eslint-disable-next-line no-unused-vars\n .catch(function (e) {});\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _TextField.default.schema({\n label: 'Custom TextField',\n 'key': 'customTextField',\n 'type': 'customTextField'\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Custom TextField',\n icon: 'terminal',\n weight: 0,\n group: 'basic',\n schema: CustomTextField.schema()\n };\n }\n }]);\n return CustomTextField;\n}(_TextField.default);\nexports[\"default\"] = CustomTextField;\n\n//# sourceURL=webpack://Formio/./lib/components/CustomTextField/CustomTextField.js?");
536
536
 
537
537
  /***/ }),
538
538
 
@@ -587,7 +587,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
587
587
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
588
588
 
589
589
  "use strict";
590
- eval("\n\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.object.keys.js */ \"./node_modules/core-js/modules/es.object.keys.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.join.js */ \"./node_modules/core-js/modules/es.array.join.js\");\n__webpack_require__(/*! core-js/modules/es.array.map.js */ \"./node_modules/core-js/modules/es.array.map.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.string.ends-with.js */ \"./node_modules/core-js/modules/es.string.ends-with.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.array.find.js */ \"./node_modules/core-js/modules/es.array.find.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _jquery = _interopRequireDefault(__webpack_require__(/*! jquery */ \"./node_modules/jquery/dist/jquery.js\"));\n__webpack_require__(/*! peity */ \"./node_modules/peity/jquery.peity.js\");\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\n/**\n * Here we will derive from the base component which all Form.io form components derive from.\n *\n * @param component\n * @param options\n * @param data\n * @constructor\n */\nvar Data = /*#__PURE__*/function (_Component) {\n _inherits(Data, _Component);\n var _super = _createSuper(Data);\n function Data(component, options, data) {\n var _this;\n _classCallCheck(this, Data);\n _this = _super.call(this, component, options, data);\n _defineProperty(_assertThisInitialized(_this), \"getField\", function (url, path, callback, headers, arrayKey) {\n var xhr = new XMLHttpRequest();\n xhr.open('GET', url, true);\n xhr.responseType = 'json';\n if (headers) {\n Object.keys(headers).forEach(function (key) {\n xhr.setRequestHeader(key, headers[\"\".concat(key)]);\n });\n }\n xhr.onload = function () {\n var status = xhr.status;\n var result = xhr.response;\n result = _lodash.default.get(result, path);\n if (arrayKey && arrayKey.trim().length > 0) {\n // result是数组,需要组合数组\n result = result.map(function (item) {\n return _lodash.default.get(item, arrayKey);\n }).join(',');\n }\n var value = \"\".concat(result);\n try {\n if (!isNaN(Number(value))) {\n value = Number(value).toLocaleString();\n } else {\n value = result;\n }\n } catch (e) {\n console.log(e);\n }\n if (status === 200) {\n callback(value);\n } else {\n callback(value, status);\n }\n };\n xhr.send();\n });\n _this.isLoadingSparkLine = false;\n return _this;\n }\n _createClass(Data, [{\n key: \"render\",\n value: function render() {\n return _get(_getPrototypeOf(Data.prototype), \"render\", this).call(this, this.renderTemplate('data'));\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this2 = this;\n var self = this;\n var refs = {\n dataContainer: 'single'\n };\n this.loadRefs(element, refs);\n var dataContainer = this.refs.dataContainer;\n if (dataContainer) {\n var clickEventType = this.component['click-event-type'];\n if (clickEventType) {\n var clickEventUrl;\n var url = window.location.href;\n url = url.split('/index.html')[0];\n if (url.endsWith('/design')) {\n url = url.substring(0, url.length - '/design'.length);\n } else if (url.endsWith('/task')) {\n url = url.substring(0, url.length - '/task'.length);\n } else if (url.endsWith('/admin')) {\n url = url.substring(0, url.length - '/admin'.length);\n } else if (url.endsWith('/automation')) {\n url = url.substring(0, url.length - '/automation'.length);\n }\n switch (clickEventType) {\n case 'url':\n clickEventUrl = this.component['click-event-url'];\n break;\n case 'processDefList':\n clickEventUrl = \"\".concat(url, \"/task/index.html#/application/list?defaultSearchProcessDefinitionKeyIn=\").concat(this.component['click-event-process-def-keys']);\n break;\n case 'taskList':\n clickEventUrl = \"\".concat(url, \"/task/index.html#/task/list?defaultSearchProcessDefinitionKeyIn=\").concat(this.component['click-event-task-keys']);\n break;\n }\n this.addEventListener(dataContainer, 'click', function (event) {\n // 点击事件\n switch (clickEventType) {\n case 'newProcessInstance':\n window.startProcessByDrawer({\n processKey: self.component['click-event-process-def-key'],\n label: '启动',\n field: self.component['key'],\n lockDrawer: self.component['click-event-lock-drawer']\n });\n break;\n case 'taskListPanel':\n window.openTaskListByDrawer({\n processKey: self.component['click-event-process-def-keys'],\n label: '',\n field: self.component['key']\n });\n break;\n case 'newTab':\n window.openNewTab({\n formId: self.component['click-event-form-id'],\n label: '',\n field: self.component['key']\n });\n break;\n default:\n window.open(clickEventUrl, '_blank');\n break;\n }\n });\n }\n }\n setTimeout(function () {\n _this2.setValue('');\n }, 100);\n return _get(_getPrototypeOf(Data.prototype), \"attach\", this).call(this, element);\n }\n }, {\n key: \"get\",\n value: function get(path, obj) {\n var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : \"${\".concat(path, \"}\");\n return path.split('.').reduce(function (res, key) {\n return res[key] || fb;\n }, obj);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map, fallback) {\n var _this3 = this;\n if (template && template.length > 0) {\n try {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n return _this3.get(path, map, fallback);\n });\n } catch (e) {\n console.log(e);\n }\n }\n return '{}';\n }\n }, {\n key: \"getValue\",\n value:\n /**\n * Get the value of the component from the dom elements.\n *\n * @returns {Array}\n */\n function getValue() {\n return this.component.field;\n }\n\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var _this4 = this;\n var self = this;\n try {\n var _this$component$icon, _this$component$icon2, _this$component$value, _this$component$value2;\n var container = this.element.querySelector('.data-container');\n this.component['icon-field'] = (_this$component$icon = this.component['icon-field']) !== null && _this$component$icon !== void 0 ? _this$component$icon : this.component.icon;\n this.component['icon-color'] = (_this$component$icon2 = this.component['icon-color']) !== null && _this$component$icon2 !== void 0 ? _this$component$icon2 : this.component.color;\n this.component['value-field'] = (_this$component$value = this.component['value-field']) !== null && _this$component$value !== void 0 ? _this$component$value : this.component.field;\n this.component['value-url'] = (_this$component$value2 = this.component['value-url']) !== null && _this$component$value2 !== void 0 ? _this$component$value2 : this.component.url;\n var sparkLineType = this.component['sparkLine-type'] || 'line';\n var fillColor;\n if (self.component['sparkLine-fill-color']) {\n switch (sparkLineType) {\n case 'line':\n fillColor = self.component['sparkLine-fill-color'].split(',')[0];\n break;\n case 'pie':\n case 'donut':\n case 'bar':\n fillColor = self.component['sparkLine-fill-color'].split(',');\n break;\n }\n }\n var element = container.querySelector('h2');\n if (this.component['value-url']) {\n var url = this.parseTpl(this.component['value-url'], {\n data: this.rootValue\n }, null);\n var headers = {};\n try {\n headers = this.parseTpl(this.component['value-headers'], {\n data: this.rootValue\n }, null);\n if (typeof headers === 'string') {\n headers = JSON.parse(headers);\n }\n } catch (e) {\n headers = {};\n console.log(e);\n }\n if (this.component['new-value-headers']) {\n var newValueHeaders = this.component['new-value-headers'];\n newValueHeaders.forEach(function (header) {\n if (header.key && header.key.length > 0 && header.value && header.value.length > 0) {\n headers[\"\".concat(header.key)] = _this4.parseTpl(header.value, {\n data: _this4.rootValue\n }, null);\n }\n });\n }\n this.getField(url, this.component['value-field'], function (field) {\n container.querySelector('h2').textContent = field;\n }, headers);\n } else {\n element.textContent = this.component['value-field'];\n }\n element = container.querySelector('.unit-container');\n if (this.component['subValue-url']) {\n var _url = this.parseTpl(this.component['subValue-url'], {\n data: this.rootValue\n }, null);\n this.getField(_url, this.component['subValue-field'], function (field) {\n container.querySelector('.unit-container').textContent = field;\n }, {});\n } else {\n element.textContent = this.component['subValue-field'];\n }\n if (self.isLoadingSparkLine) {\n return true;\n }\n self.isLoadingSparkLine = true;\n if (self.component['sparkLine-dataSrc'] === 'values' && self.component['sparkLine-const-field'] && self.component['sparkLine-const-field'].length > 0) {\n // values\n container.querySelector('.sparkline-container').innerHTML = \"<span class=\\\"line\\\">\".concat(self.component['sparkLine-const-field'], \"</span>\");\n // @ts-ignore\n (0, _jquery.default)(container).find('.line').peity(sparkLineType, {\n fill: fillColor,\n height: self.component['sparkLine-height'],\n max: _lodash.default.toNumber(self.parseTpl(\"\".concat(self.component['sparkLine-max-value-count']), {\n data: self.rootValue\n })),\n min: 0,\n stroke: self.component['sparkLine-stroke-color'],\n strokeWidth: 2,\n width: self.component['sparkLine-width']\n });\n self.isLoadingSparkLine = false;\n } else if (self.component['sparkLine-dataSrc'] === 'url' && self.component['sparkLine-url'] && self.component['sparkLine-url'].length > 0) {\n // url\n var _url2 = this.parseTpl(this.component['sparkLine-url'], {\n data: this.rootValue\n }, null);\n var _headers = {};\n try {\n _headers = self.parseTpl(self.component['sparkLine-headers'], {\n data: self.rootValue\n }, null);\n if (typeof _headers === 'string') {\n _headers = JSON.parse(_headers);\n }\n } catch (e) {\n _headers = {};\n console.log(e);\n }\n if (this.component['new-sparkLine-headers']) {\n var _newValueHeaders = this.component['new-sparkLine-headers'];\n _newValueHeaders.forEach(function (header) {\n if (header.key && header.key.length > 0 && header.value && header.value.length > 0) {\n _headers[\"\".concat(header.key)] = _this4.parseTpl(header.value, {\n data: _this4.rootValue\n }, null);\n }\n });\n }\n self.getField(_url2, self.component['sparkLine-field'], function (field) {\n container.querySelector('.sparkline-container').innerHTML = \"<span class=\\\"line\\\">\".concat(field, \"</span>\");\n\n // @ts-ignore\n (0, _jquery.default)(container).find('.line').peity(sparkLineType, {\n fill: fillColor,\n height: self.component['sparkLine-height'],\n max: _lodash.default.toNumber(self.parseTpl(\"\".concat(self.component['sparkLine-max-value-count']), {\n data: self.rootValue\n })),\n min: 0,\n stroke: self.component['sparkLine-stroke-color'],\n strokeWidth: 2,\n width: self.component['sparkLine-width']\n });\n self.isLoadingSparkLine = false;\n }, _headers, self.component['sparkLine-array-field']);\n }\n } catch (e) {\n console.log(e);\n }\n return true;\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Field.default.schema.apply(_Field.default, [{\n type: 'data',\n icon: '',\n color: '#ff7754',\n header: '',\n url: '',\n field: ''\n }].concat(extend));\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Info Block',\n group: 'advanced',\n icon: 'square-info',\n weight: 70,\n documentation: 'http://help.form.io/userguide/#table',\n schema: Data.schema()\n };\n }\n }]);\n return Data;\n}(_Field.default);\nexports[\"default\"] = Data;\n\n//# sourceURL=webpack://Formio/./lib/components/Data/Data.js?");
590
+ eval("\n\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.object.keys.js */ \"./node_modules/core-js/modules/es.object.keys.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.join.js */ \"./node_modules/core-js/modules/es.array.join.js\");\n__webpack_require__(/*! core-js/modules/es.array.map.js */ \"./node_modules/core-js/modules/es.array.map.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.string.ends-with.js */ \"./node_modules/core-js/modules/es.string.ends-with.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.array.find.js */ \"./node_modules/core-js/modules/es.array.find.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _jquery = _interopRequireDefault(__webpack_require__(/*! jquery */ \"./node_modules/jquery/dist/jquery.js\"));\n__webpack_require__(/*! peity */ \"./node_modules/peity/jquery.peity.js\");\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\n/**\n * Here we will derive from the base component which all Form.io form components derive from.\n *\n * @param component\n * @param options\n * @param data\n * @constructor\n */\nvar Data = /*#__PURE__*/function (_Component) {\n _inherits(Data, _Component);\n var _super = _createSuper(Data);\n function Data(component, options, data) {\n var _this;\n _classCallCheck(this, Data);\n _this = _super.call(this, component, options, data);\n _defineProperty(_assertThisInitialized(_this), \"getField\", function (url, path, callback, headers, arrayKey) {\n var xhr = new XMLHttpRequest();\n xhr.open('GET', url, true);\n xhr.responseType = 'json';\n if (headers) {\n Object.keys(headers).forEach(function (key) {\n xhr.setRequestHeader(key, headers[\"\".concat(key)]);\n });\n }\n xhr.onload = function () {\n var status = xhr.status;\n var result = xhr.response;\n result = _lodash.default.get(result, path);\n if (arrayKey && arrayKey.trim().length > 0) {\n // result是数组,需要组合数组\n result = result.map(function (item) {\n return _lodash.default.get(item, arrayKey);\n }).join(',');\n }\n var value = \"\".concat(result);\n try {\n if (!isNaN(Number(value))) {\n value = Number(value).toLocaleString();\n } else {\n value = result;\n }\n } catch (e) {\n console.log(e);\n }\n if (status === 200) {\n callback(value);\n } else {\n callback(value, status);\n }\n };\n xhr.send();\n });\n _this.isLoadingSparkLine = false;\n return _this;\n }\n _createClass(Data, [{\n key: \"render\",\n value: function render() {\n return _get(_getPrototypeOf(Data.prototype), \"render\", this).call(this, this.renderTemplate('data'));\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this2 = this;\n var self = this;\n var refs = {\n dataContainer: 'single'\n };\n this.loadRefs(element, refs);\n var dataContainer = this.refs.dataContainer;\n if (dataContainer) {\n var clickEventType = this.component['click-event-type'];\n if (clickEventType) {\n var clickEventUrl;\n var url = window.location.href;\n url = url.split('/index.html')[0];\n if (url.endsWith('/design')) {\n url = url.substring(0, url.length - '/design'.length);\n } else if (url.endsWith('/task')) {\n url = url.substring(0, url.length - '/task'.length);\n } else if (url.endsWith('/admin')) {\n url = url.substring(0, url.length - '/admin'.length);\n } else if (url.endsWith('/automation')) {\n url = url.substring(0, url.length - '/automation'.length);\n }\n switch (clickEventType) {\n case 'url':\n clickEventUrl = this.component['click-event-url'];\n break;\n case 'processDefList':\n clickEventUrl = \"\".concat(url, \"/task/index.html#/application/list?defaultSearchProcessDefinitionKeyIn=\").concat(this.component['click-event-process-def-keys']);\n break;\n case 'taskList':\n clickEventUrl = \"\".concat(url, \"/task/index.html#/task/list?defaultSearchProcessDefinitionKeyIn=\").concat(this.component['click-event-task-keys']);\n break;\n }\n this.addEventListener(dataContainer, 'click', function (event) {\n // 点击事件\n switch (clickEventType) {\n case 'newProcessInstance':\n window.startProcessByDrawer({\n processKey: self.component['click-event-process-def-key'],\n label: '启动',\n field: self.component['key'],\n lockDrawer: self.component['click-event-lock-drawer']\n });\n break;\n case 'taskListPanel':\n window.openTaskListByDrawer({\n processKey: self.component['click-event-process-def-keys'],\n label: '',\n field: self.component['key']\n });\n break;\n case 'newTab':\n window.openNewTab({\n formId: self.component['click-event-form-id'],\n label: '',\n field: self.component['key']\n });\n break;\n default:\n window.open(clickEventUrl, '_blank');\n break;\n }\n });\n }\n }\n setTimeout(function () {\n _this2.setValue('');\n }, 100);\n return _get(_getPrototypeOf(Data.prototype), \"attach\", this).call(this, element);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n if (template && template.length > 0) {\n try {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n });\n } catch (e) {\n console.log(e);\n }\n }\n return '{}';\n }\n }, {\n key: \"getValue\",\n value:\n /**\n * Get the value of the component from the dom elements.\n *\n * @returns {Array}\n */\n function getValue() {\n return this.component.field;\n }\n\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var _this3 = this;\n var self = this;\n try {\n var _this$component$icon, _this$component$icon2, _this$component$value, _this$component$value2;\n var container = this.element.querySelector('.data-container');\n this.component['icon-field'] = (_this$component$icon = this.component['icon-field']) !== null && _this$component$icon !== void 0 ? _this$component$icon : this.component.icon;\n this.component['icon-color'] = (_this$component$icon2 = this.component['icon-color']) !== null && _this$component$icon2 !== void 0 ? _this$component$icon2 : this.component.color;\n this.component['value-field'] = (_this$component$value = this.component['value-field']) !== null && _this$component$value !== void 0 ? _this$component$value : this.component.field;\n this.component['value-url'] = (_this$component$value2 = this.component['value-url']) !== null && _this$component$value2 !== void 0 ? _this$component$value2 : this.component.url;\n var sparkLineType = this.component['sparkLine-type'] || 'line';\n var fillColor;\n if (self.component['sparkLine-fill-color']) {\n switch (sparkLineType) {\n case 'line':\n fillColor = self.component['sparkLine-fill-color'].split(',')[0];\n break;\n case 'pie':\n case 'donut':\n case 'bar':\n fillColor = self.component['sparkLine-fill-color'].split(',');\n break;\n }\n }\n var element = container.querySelector('h2');\n if (this.component['value-url']) {\n var url = this.parseTpl(this.component['value-url'], {\n data: this.rootValue\n });\n var headers = {};\n try {\n headers = this.parseTpl(this.component['value-headers'], {\n data: this.rootValue\n });\n if (typeof headers === 'string') {\n headers = JSON.parse(headers);\n }\n } catch (e) {\n headers = {};\n console.log(e);\n }\n if (this.component['new-value-headers']) {\n var newValueHeaders = this.component['new-value-headers'];\n newValueHeaders.forEach(function (header) {\n if (header.key && header.key.length > 0 && header.value && header.value.length > 0) {\n headers[\"\".concat(header.key)] = _this3.parseTpl(header.value, {\n data: _this3.rootValue\n });\n }\n });\n }\n this.getField(url, this.component['value-field'], function (field) {\n container.querySelector('h2').textContent = field;\n }, headers);\n } else {\n element.textContent = this.component['value-field'];\n }\n element = container.querySelector('.unit-container');\n if (this.component['subValue-url']) {\n var _url = this.parseTpl(this.component['subValue-url'], {\n data: this.rootValue\n });\n this.getField(_url, this.component['subValue-field'], function (field) {\n container.querySelector('.unit-container').textContent = field;\n }, {});\n } else {\n element.textContent = this.component['subValue-field'];\n }\n if (self.isLoadingSparkLine) {\n return true;\n }\n self.isLoadingSparkLine = true;\n if (self.component['sparkLine-dataSrc'] === 'values' && self.component['sparkLine-const-field'] && self.component['sparkLine-const-field'].length > 0) {\n // values\n container.querySelector('.sparkline-container').innerHTML = \"<span class=\\\"line\\\">\".concat(self.component['sparkLine-const-field'], \"</span>\");\n // @ts-ignore\n (0, _jquery.default)(container).find('.line').peity(sparkLineType, {\n fill: fillColor,\n height: self.component['sparkLine-height'],\n max: _lodash.default.toNumber(self.parseTpl(\"\".concat(self.component['sparkLine-max-value-count']), {\n data: self.rootValue\n })),\n min: 0,\n stroke: self.component['sparkLine-stroke-color'],\n strokeWidth: 2,\n width: self.component['sparkLine-width']\n });\n self.isLoadingSparkLine = false;\n } else if (self.component['sparkLine-dataSrc'] === 'url' && self.component['sparkLine-url'] && self.component['sparkLine-url'].length > 0) {\n // url\n var _url2 = this.parseTpl(this.component['sparkLine-url'], {\n data: this.rootValue\n });\n var _headers = {};\n try {\n _headers = self.parseTpl(self.component['sparkLine-headers'], {\n data: self.rootValue\n });\n if (typeof _headers === 'string') {\n _headers = JSON.parse(_headers);\n }\n } catch (e) {\n _headers = {};\n console.log(e);\n }\n if (this.component['new-sparkLine-headers']) {\n var _newValueHeaders = this.component['new-sparkLine-headers'];\n _newValueHeaders.forEach(function (header) {\n if (header.key && header.key.length > 0 && header.value && header.value.length > 0) {\n _headers[\"\".concat(header.key)] = _this3.parseTpl(header.value, {\n data: _this3.rootValue\n });\n }\n });\n }\n self.getField(_url2, self.component['sparkLine-field'], function (field) {\n container.querySelector('.sparkline-container').innerHTML = \"<span class=\\\"line\\\">\".concat(field, \"</span>\");\n\n // @ts-ignore\n (0, _jquery.default)(container).find('.line').peity(sparkLineType, {\n fill: fillColor,\n height: self.component['sparkLine-height'],\n max: _lodash.default.toNumber(self.parseTpl(\"\".concat(self.component['sparkLine-max-value-count']), {\n data: self.rootValue\n })),\n min: 0,\n stroke: self.component['sparkLine-stroke-color'],\n strokeWidth: 2,\n width: self.component['sparkLine-width']\n });\n self.isLoadingSparkLine = false;\n }, _headers, self.component['sparkLine-array-field']);\n }\n } catch (e) {\n console.log(e);\n }\n return true;\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Field.default.schema.apply(_Field.default, [{\n type: 'data',\n icon: '',\n color: '#ff7754',\n header: '',\n url: '',\n field: ''\n }].concat(extend));\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Info Block',\n group: 'advanced',\n icon: 'square-info',\n weight: 70,\n documentation: 'http://help.form.io/userguide/#table',\n schema: Data.schema()\n };\n }\n }]);\n return Data;\n}(_Field.default);\nexports[\"default\"] = Data;\n\n//# sourceURL=webpack://Formio/./lib/components/Data/Data.js?");
591
591
 
592
592
  /***/ }),
593
593
 
@@ -620,7 +620,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
620
620
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
621
621
 
622
622
  "use strict";
623
- eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.find.js */ \"./node_modules/core-js/modules/es.array.find.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\n__webpack_require__(/*! peity */ \"./node_modules/peity/jquery.peity.js\");\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n/**\n * Here we will derive from the base component which all Form.io form components derive from.\n *\n * @param component\n * @param options\n * @param data\n * @constructor\n */\nvar DataChinaGrid = /*#__PURE__*/function (_Component) {\n _inherits(DataChinaGrid, _Component);\n var _super = _createSuper(DataChinaGrid);\n function DataChinaGrid(component, options, data) {\n var _this;\n _classCallCheck(this, DataChinaGrid);\n _this = _super.call(this, component, options, data);\n _this.isLoadingSparkLine = false;\n return _this;\n }\n _createClass(DataChinaGrid, [{\n key: \"render\",\n value: function render() {\n return _get(_getPrototypeOf(DataChinaGrid.prototype), \"render\", this).call(this, this.renderTemplate('dataChinaGrid'));\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this2 = this;\n var self = this;\n var refs = {\n dataContainer: 'single'\n };\n this.loadRefs(element, refs);\n var dataContainer = this.refs.dataContainer;\n if (dataContainer) {\n var clickEventType = this.component['click-event-type'];\n if (clickEventType) {\n this.addEventListener(dataContainer, 'click', function (event) {\n // 点击事件\n var params;\n switch (clickEventType) {\n case 'newPage':\n try {\n params = JSON.parse(_this2.parseTpl(_this2.component['page_params'], {\n data: _this2.rootValue\n }));\n } catch (e) {\n console.log(\"json\\u8F6C\\u6362\\u5931\\u8D25:\".concat(e));\n }\n window.openNewPage(_this2.component['click-event-form-id'], params);\n break;\n case 'bottomSheet':\n try {\n params = JSON.parse(_this2.parseTpl(_this2.component['page_params'], {\n data: _this2.rootValue\n }));\n } catch (e) {\n console.log(\"json\\u8F6C\\u6362\\u5931\\u8D25:\".concat(e));\n }\n window.openBottomSheet(_this2.component['click-event-form-id'], params);\n break;\n case 'setTab':\n // 切换tab\n Formio.forms[_this2.currentForm.id].getComponent(_this2.component['click-event-tab-id']).setTabByKey(_this2.component['click-event-tab-key']);\n break;\n }\n });\n }\n }\n setTimeout(function () {\n _this2.setValue('');\n }, 100);\n return _get(_getPrototypeOf(DataChinaGrid.prototype), \"attach\", this).call(this, element);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n if (template && template.length > 0) {\n try {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n return _lodash.default.get(map, path);\n });\n } catch (e) {\n console.log(e);\n }\n }\n return '{}';\n }\n\n /**\n * Get the value of the component from the dom elements.\n *\n * @returns {Array}\n */\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.component.field;\n }\n }, {\n key: \"resetSparkLine\",\n value: function resetSparkLine() {\n var self = this;\n var container = this.element.querySelector('.data-container');\n if (self.component['enable-sparkline']) {\n if (self.isLoadingSparkLine) {\n return true;\n }\n self.isLoadingSparkLine = true;\n var sparkLineType = this.component['sparkLine-type'] || 'line';\n var fillColor;\n if (self.component['sparkLine-fill-color']) {\n switch (sparkLineType) {\n case 'line':\n fillColor = self.component['sparkLine-fill-color'].split(',')[0];\n break;\n case 'pie':\n case 'donut':\n case 'bar':\n fillColor = self.component['sparkLine-fill-color'].split(',');\n break;\n }\n }\n // values\n container.querySelector('.sparkline-container').innerHTML = \"<span class=\\\"line\\\">\".concat(self.parseTpl(self.component['sparkLine-value'], {\n data: self.rootValue\n }), \"</span>\");\n try {\n // @ts-ignore\n $(container).find('.line').peity(sparkLineType, {\n fill: fillColor,\n height: self.component['sparkLine-height'],\n max: _lodash.default.toNumber(self.parseTpl(\"\".concat(self.component['sparkLine-max-value-count']), {\n data: self.rootValue\n })),\n min: 0,\n stroke: self.component['sparkLine-stroke-color'],\n strokeWidth: 2,\n width: self.component['sparkLine-width']\n });\n self.isLoadingSparkLine = false;\n } catch (e) {\n container.querySelectorAll(\".line\").forEach(function (e) {\n return peity(e, sparkLineType, {\n fill: fillColor,\n height: self.component['sparkLine-height'],\n max: _lodash.default.toNumber(self.parseTpl(\"\".concat(self.component['sparkLine-max-value-count']), {\n data: self.rootValue\n })),\n min: 0,\n stroke: self.component['sparkLine-stroke-color'],\n strokeWidth: 2,\n width: self.component['sparkLine-width']\n });\n });\n self.isLoadingSparkLine = false;\n }\n }\n }\n\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var _this3 = this;\n var self = this;\n try {\n var container = this.element.querySelector('.data-container');\n try {\n var customStyle = JSON.parse(this.component[\"custom-style\"] || {});\n _lodash.default.forEach(customStyle, function (value, key) {\n _this3.refs.dataContainer.style[key] = value;\n });\n } catch (e) {}\n // 标题设置\n var element = container.querySelector('.title-container');\n element.innerHTML = self.parseTpl(self.component['title-content'], {\n data: self.rootValue\n });\n element = container.querySelector('.value-container');\n element.innerHTML = self.parseTpl(self.component['value-content'], {\n data: self.rootValue\n });\n element = container.querySelector('.footer-container-value1');\n element.innerHTML = self.parseTpl(self.component['footer-content1'], {\n data: self.rootValue\n });\n element = container.querySelector('.footer-container-value2');\n element.innerHTML = self.parseTpl(self.component['footer-content2'], {\n data: self.rootValue\n });\n element = container.querySelector('.footer-container-value3');\n if (element) {\n element.innerHTML = self.parseTpl(self.component['footer-content3'], {\n data: self.rootValue\n });\n }\n // 图标\n self.resetSparkLine();\n } catch (e) {\n console.log(e);\n }\n return true;\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Field.default.schema.apply(_Field.default, [{\n type: 'data_china_grid',\n \"title-content\": \"低压问题综合治理率 <i class=\\\"fa fa-info-circle\\\" aria-hidden=\\\"true\\\"></i>\",\n \"value-content\": \"160 <i style='font-size: 10px;color: #0a6ebd'>%</i>\",\n \"footer-content1\": \"name\",\n \"footer-content2\": \"<div style='color:red'>up</div>\",\n \"footer-content3\": \"info\",\n \"footer-content\": \"开始时间\"\n }].concat(extend));\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Info Block ChinaFrid',\n group: 'advanced',\n icon: 'square-info',\n weight: 70,\n documentation: 'http://help.form.io/userguide/#table',\n schema: DataChinaGrid.schema()\n };\n }\n }]);\n return DataChinaGrid;\n}(_Field.default);\nexports[\"default\"] = DataChinaGrid;\n\n//# sourceURL=webpack://Formio/./lib/components/DataChinaGrid/Data.js?");
623
+ eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.find.js */ \"./node_modules/core-js/modules/es.array.find.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\n__webpack_require__(/*! peity */ \"./node_modules/peity/jquery.peity.js\");\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n/**\n * Here we will derive from the base component which all Form.io form components derive from.\n *\n * @param component\n * @param options\n * @param data\n * @constructor\n */\nvar DataChinaGrid = /*#__PURE__*/function (_Component) {\n _inherits(DataChinaGrid, _Component);\n var _super = _createSuper(DataChinaGrid);\n function DataChinaGrid(component, options, data) {\n var _this;\n _classCallCheck(this, DataChinaGrid);\n _this = _super.call(this, component, options, data);\n _this.isLoadingSparkLine = false;\n return _this;\n }\n _createClass(DataChinaGrid, [{\n key: \"render\",\n value: function render() {\n return _get(_getPrototypeOf(DataChinaGrid.prototype), \"render\", this).call(this, this.renderTemplate('dataChinaGrid'));\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this2 = this;\n var self = this;\n var refs = {\n dataContainer: 'single'\n };\n this.loadRefs(element, refs);\n var dataContainer = this.refs.dataContainer;\n if (dataContainer) {\n var clickEventType = this.component['click-event-type'];\n if (clickEventType) {\n this.addEventListener(dataContainer, 'click', function (event) {\n // 点击事件\n var params;\n switch (clickEventType) {\n case 'newPage':\n try {\n params = JSON.parse(_this2.parseTpl(_this2.component['page_params'], {\n data: _this2.rootValue\n }));\n } catch (e) {\n console.log(\"json\\u8F6C\\u6362\\u5931\\u8D25:\".concat(e));\n }\n window.openNewPage(_this2.component['click-event-form-id'], params);\n break;\n case 'bottomSheet':\n try {\n params = JSON.parse(_this2.parseTpl(_this2.component['page_params'], {\n data: _this2.rootValue\n }));\n } catch (e) {\n console.log(\"json\\u8F6C\\u6362\\u5931\\u8D25:\".concat(e));\n }\n window.openBottomSheet(_this2.component['click-event-form-id'], params);\n break;\n case 'setTab':\n // 切换tab\n Formio.forms[_this2.currentForm.id].getComponent(_this2.component['click-event-tab-id']).setTabByKey(_this2.component['click-event-tab-key']);\n break;\n }\n });\n }\n }\n setTimeout(function () {\n _this2.setValue('');\n }, 100);\n return _get(_getPrototypeOf(DataChinaGrid.prototype), \"attach\", this).call(this, element);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n if (template && template.length > 0) {\n try {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n });\n } catch (e) {\n console.log(e);\n }\n }\n return '{}';\n }\n\n /**\n * Get the value of the component from the dom elements.\n *\n * @returns {Array}\n */\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.component.field;\n }\n }, {\n key: \"resetSparkLine\",\n value: function resetSparkLine() {\n var self = this;\n var container = this.element.querySelector('.data-container');\n if (self.component['enable-sparkline']) {\n if (self.isLoadingSparkLine) {\n return true;\n }\n self.isLoadingSparkLine = true;\n var sparkLineType = this.component['sparkLine-type'] || 'line';\n var fillColor;\n if (self.component['sparkLine-fill-color']) {\n switch (sparkLineType) {\n case 'line':\n fillColor = self.component['sparkLine-fill-color'].split(',')[0];\n break;\n case 'pie':\n case 'donut':\n case 'bar':\n fillColor = self.component['sparkLine-fill-color'].split(',');\n break;\n }\n }\n // values\n container.querySelector('.sparkline-container').innerHTML = \"<span class=\\\"line\\\">\".concat(self.parseTpl(self.component['sparkLine-value'], {\n data: self.rootValue\n }), \"</span>\");\n try {\n // @ts-ignore\n $(container).find('.line').peity(sparkLineType, {\n fill: fillColor,\n height: self.component['sparkLine-height'],\n max: _lodash.default.toNumber(self.parseTpl(\"\".concat(self.component['sparkLine-max-value-count']), {\n data: self.rootValue\n })),\n min: 0,\n stroke: self.component['sparkLine-stroke-color'],\n strokeWidth: 2,\n width: self.component['sparkLine-width']\n });\n self.isLoadingSparkLine = false;\n } catch (e) {\n container.querySelectorAll(\".line\").forEach(function (e) {\n return peity(e, sparkLineType, {\n fill: fillColor,\n height: self.component['sparkLine-height'],\n max: _lodash.default.toNumber(self.parseTpl(\"\".concat(self.component['sparkLine-max-value-count']), {\n data: self.rootValue\n })),\n min: 0,\n stroke: self.component['sparkLine-stroke-color'],\n strokeWidth: 2,\n width: self.component['sparkLine-width']\n });\n });\n self.isLoadingSparkLine = false;\n }\n }\n }\n\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var _this3 = this;\n var self = this;\n try {\n var container = this.element.querySelector('.data-container');\n try {\n var customStyle = JSON.parse(this.component[\"custom-style\"] || {});\n _lodash.default.forEach(customStyle, function (value, key) {\n _this3.refs.dataContainer.style[key] = value;\n });\n } catch (e) {}\n // 标题设置\n var element = container.querySelector('.title-container');\n element.innerHTML = self.parseTpl(self.component['title-content'], {\n data: self.rootValue\n });\n element = container.querySelector('.value-container');\n element.innerHTML = self.parseTpl(self.component['value-content'], {\n data: self.rootValue\n });\n element = container.querySelector('.footer-container-value1');\n element.innerHTML = self.parseTpl(self.component['footer-content1'], {\n data: self.rootValue\n });\n element = container.querySelector('.footer-container-value2');\n element.innerHTML = self.parseTpl(self.component['footer-content2'], {\n data: self.rootValue\n });\n element = container.querySelector('.footer-container-value3');\n if (element) {\n element.innerHTML = self.parseTpl(self.component['footer-content3'], {\n data: self.rootValue\n });\n }\n // 图标\n self.resetSparkLine();\n } catch (e) {\n console.log(e);\n }\n return true;\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Field.default.schema.apply(_Field.default, [{\n type: 'data_china_grid',\n \"title-content\": \"低压问题综合治理率 <i class=\\\"fa fa-info-circle\\\" aria-hidden=\\\"true\\\"></i>\",\n \"value-content\": \"160 <i style='font-size: 10px;color: #0a6ebd'>%</i>\",\n \"footer-content1\": \"name\",\n \"footer-content2\": \"<div style='color:red'>up</div>\",\n \"footer-content3\": \"info\",\n \"footer-content\": \"开始时间\"\n }].concat(extend));\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Info Block ChinaFrid',\n group: 'advanced',\n icon: 'square-info',\n weight: 70,\n documentation: 'http://help.form.io/userguide/#table',\n schema: DataChinaGrid.schema()\n };\n }\n }]);\n return DataChinaGrid;\n}(_Field.default);\nexports[\"default\"] = DataChinaGrid;\n\n//# sourceURL=webpack://Formio/./lib/components/DataChinaGrid/Data.js?");
624
624
 
625
625
  /***/ }),
626
626
 
@@ -653,7 +653,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
653
653
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
654
654
 
655
655
  "use strict";
656
- eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.find.js */ \"./node_modules/core-js/modules/es.array.find.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _jquery = _interopRequireDefault(__webpack_require__(/*! jquery */ \"./node_modules/jquery/dist/jquery.js\"));\n__webpack_require__(/*! peity */ \"./node_modules/peity/jquery.peity.js\");\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n/**\n * Here we will derive from the base component which all Form.io form components derive from.\n *\n * @param component\n * @param options\n * @param data\n * @constructor\n */\nvar DataChinaGridRow = /*#__PURE__*/function (_Component) {\n _inherits(DataChinaGridRow, _Component);\n var _super = _createSuper(DataChinaGridRow);\n function DataChinaGridRow(component, options, data) {\n var _this;\n _classCallCheck(this, DataChinaGridRow);\n _this = _super.call(this, component, options, data);\n _this.isLoadingSparkLine = false;\n return _this;\n }\n _createClass(DataChinaGridRow, [{\n key: \"render\",\n value: function render() {\n return _get(_getPrototypeOf(DataChinaGridRow.prototype), \"render\", this).call(this, this.renderTemplate('dataChinaGridRow'));\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this2 = this;\n var self = this;\n var refs = {\n dataContainer: 'single'\n };\n this.loadRefs(element, refs);\n var dataContainer = this.refs.dataContainer;\n if (dataContainer) {\n var clickEventType = this.component['click-event-type'];\n if (clickEventType) {\n this.addEventListener(dataContainer, 'click', function (event) {\n // 点击事件\n var params;\n switch (clickEventType) {\n case 'newPage':\n try {\n params = JSON.parse(_this2.parseTpl(_this2.component['page_params'], {\n data: _this2.rootValue\n }));\n } catch (e) {\n console.log(\"json\\u8F6C\\u6362\\u5931\\u8D25:\".concat(e));\n }\n window.openNewPage(_this2.component['click-event-form-id'], params);\n break;\n case 'bottomSheet':\n try {\n params = JSON.parse(_this2.parseTpl(_this2.component['page_params'], {\n data: _this2.rootValue\n }));\n } catch (e) {\n console.log(\"json\\u8F6C\\u6362\\u5931\\u8D25:\".concat(e));\n }\n window.openBottomSheet(_this2.component['click-event-form-id'], params);\n break;\n case 'setTab':\n // 切换tab\n Formio.forms[_this2.currentForm.id].getComponent(_this2.component['click-event-tab-id']).setTabByKey(_this2.component['click-event-tab-key']);\n break;\n }\n });\n }\n }\n setTimeout(function () {\n _this2.setValue('');\n }, 100);\n return _get(_getPrototypeOf(DataChinaGridRow.prototype), \"attach\", this).call(this, element);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n if (template && template.length > 0) {\n try {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n return _lodash.default.get(map, path);\n });\n } catch (e) {\n console.log(e);\n }\n }\n return '{}';\n }\n\n /**\n * Get the value of the component from the dom elements.\n *\n * @returns {Array}\n */\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.component.field;\n }\n }, {\n key: \"resetSparkLine\",\n value: function resetSparkLine() {\n var self = this;\n var container = this.element.querySelector('.data-container');\n if (self.component['enable-sparkline']) {\n if (self.isLoadingSparkLine) {\n return true;\n }\n self.isLoadingSparkLine = true;\n var sparkLineType = this.component['sparkLine-type'] || 'line';\n var fillColor;\n if (self.component['sparkLine-fill-color']) {\n switch (sparkLineType) {\n case 'line':\n fillColor = self.component['sparkLine-fill-color'].split(',')[0];\n break;\n case 'pie':\n case 'donut':\n case 'bar':\n fillColor = self.component['sparkLine-fill-color'].split(',');\n break;\n }\n }\n // values\n container.querySelector('.sparkline-container').innerHTML = \"<span class=\\\"line\\\">\".concat(self.parseTpl(self.component['sparkLine-value'], {\n data: self.rootValue\n }), \"</span>\");\n // 宽度计算\n var parentWidth = container.querySelector('#sparkline-container-parent').offsetWidth;\n parentWidth = parentWidth * self.component['sparkLine-width'];\n try {\n // @ts-ignore\n (0, _jquery.default)(container).find('.line').peity(sparkLineType, {\n fill: fillColor,\n height: self.component['sparkLine-height'],\n max: _lodash.default.toNumber(self.parseTpl(\"\".concat(self.component['sparkLine-max-value-count']), {\n data: self.rootValue\n })),\n min: 0,\n stroke: self.component['sparkLine-stroke-color'],\n strokeWidth: 2,\n width: parentWidth\n });\n self.isLoadingSparkLine = false;\n } catch (e) {\n container.querySelectorAll(\".line\").forEach(function (e) {\n return peity(e, sparkLineType, {\n fill: fillColor,\n height: self.component['sparkLine-height'],\n max: _lodash.default.toNumber(self.parseTpl(\"\".concat(self.component['sparkLine-max-value-count']), {\n data: self.rootValue\n })),\n min: 0,\n stroke: self.component['sparkLine-stroke-color'],\n strokeWidth: 2,\n width: parentWidth\n });\n });\n self.isLoadingSparkLine = false;\n }\n }\n }\n\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var _this3 = this;\n var self = this;\n try {\n var container = this.element.querySelector('.data-container');\n try {\n var customStyle = JSON.parse(this.component[\"custom-style\"] || {});\n _lodash.default.forEach(customStyle, function (value, key) {\n _this3.refs.dataContainer.style[key] = value;\n });\n } catch (e) {}\n // 标题设置\n var element = container.querySelector('.title-container');\n element.innerHTML = self.parseTpl(self.component['title-content'], {\n data: self.rootValue\n });\n element = container.querySelector('.value-container');\n element.innerHTML = self.parseTpl(self.component['value-content'], {\n data: self.rootValue\n });\n element = container.querySelector('.footer-container-value1');\n element.innerHTML = self.parseTpl(self.component['footer-content1'], {\n data: self.rootValue\n });\n element = container.querySelector('.footer-container-value2');\n element.innerHTML = self.parseTpl(self.component['footer-content2'], {\n data: self.rootValue\n });\n element = container.querySelector('.footer-container-value3');\n if (element) {\n element.innerHTML = self.parseTpl(self.component['footer-content3'], {\n data: self.rootValue\n });\n }\n // 图标\n self.resetSparkLine();\n } catch (e) {\n console.log(e);\n }\n return true;\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Field.default.schema.apply(_Field.default, [{\n type: 'data_china_grid_row',\n color: '#ff7754',\n \"title-content\": \"低压问题综合治理率 <i class=\\\"fa fa-info-circle\\\" aria-hidden=\\\"true\\\"></i>\",\n \"value-content\": \"160 <i style='font-size: 10px;color: #0a6ebd'>%</i>\",\n \"footer-content1\": \"name\",\n \"footer-content2\": \"<div style='color:red'>up</div>\",\n \"footer-content3\": \"info\",\n \"footer-content\": \"开始时间\"\n }].concat(extend));\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Info Block ChinaFrid Row',\n group: 'advanced',\n icon: 'square-info',\n weight: 70,\n documentation: 'http://help.form.io/userguide/#table',\n schema: DataChinaGridRow.schema()\n };\n }\n }]);\n return DataChinaGridRow;\n}(_Field.default);\nexports[\"default\"] = DataChinaGridRow;\n\n//# sourceURL=webpack://Formio/./lib/components/DataChinaGridRow/Data.js?");
656
+ eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.find.js */ \"./node_modules/core-js/modules/es.array.find.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _jquery = _interopRequireDefault(__webpack_require__(/*! jquery */ \"./node_modules/jquery/dist/jquery.js\"));\n__webpack_require__(/*! peity */ \"./node_modules/peity/jquery.peity.js\");\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n/**\n * Here we will derive from the base component which all Form.io form components derive from.\n *\n * @param component\n * @param options\n * @param data\n * @constructor\n */\nvar DataChinaGridRow = /*#__PURE__*/function (_Component) {\n _inherits(DataChinaGridRow, _Component);\n var _super = _createSuper(DataChinaGridRow);\n function DataChinaGridRow(component, options, data) {\n var _this;\n _classCallCheck(this, DataChinaGridRow);\n _this = _super.call(this, component, options, data);\n _this.isLoadingSparkLine = false;\n return _this;\n }\n _createClass(DataChinaGridRow, [{\n key: \"render\",\n value: function render() {\n return _get(_getPrototypeOf(DataChinaGridRow.prototype), \"render\", this).call(this, this.renderTemplate('dataChinaGridRow'));\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this2 = this;\n var self = this;\n var refs = {\n dataContainer: 'single'\n };\n this.loadRefs(element, refs);\n var dataContainer = this.refs.dataContainer;\n if (dataContainer) {\n var clickEventType = this.component['click-event-type'];\n if (clickEventType) {\n this.addEventListener(dataContainer, 'click', function (event) {\n // 点击事件\n var params;\n switch (clickEventType) {\n case 'newPage':\n try {\n params = JSON.parse(_this2.parseTpl(_this2.component['page_params'], {\n data: _this2.rootValue\n }));\n } catch (e) {\n console.log(\"json\\u8F6C\\u6362\\u5931\\u8D25:\".concat(e));\n }\n window.openNewPage(_this2.component['click-event-form-id'], params);\n break;\n case 'bottomSheet':\n try {\n params = JSON.parse(_this2.parseTpl(_this2.component['page_params'], {\n data: _this2.rootValue\n }));\n } catch (e) {\n console.log(\"json\\u8F6C\\u6362\\u5931\\u8D25:\".concat(e));\n }\n window.openBottomSheet(_this2.component['click-event-form-id'], params);\n break;\n case 'setTab':\n // 切换tab\n Formio.forms[_this2.currentForm.id].getComponent(_this2.component['click-event-tab-id']).setTabByKey(_this2.component['click-event-tab-key']);\n break;\n }\n });\n }\n }\n setTimeout(function () {\n _this2.setValue('');\n }, 100);\n return _get(_getPrototypeOf(DataChinaGridRow.prototype), \"attach\", this).call(this, element);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n if (template && template.length > 0) {\n try {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n });\n } catch (e) {\n console.log(e);\n }\n }\n return '{}';\n }\n\n /**\n * Get the value of the component from the dom elements.\n *\n * @returns {Array}\n */\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.component.field;\n }\n }, {\n key: \"resetSparkLine\",\n value: function resetSparkLine() {\n var self = this;\n var container = this.element.querySelector('.data-container');\n if (self.component['enable-sparkline']) {\n if (self.isLoadingSparkLine) {\n return true;\n }\n self.isLoadingSparkLine = true;\n var sparkLineType = this.component['sparkLine-type'] || 'line';\n var fillColor;\n if (self.component['sparkLine-fill-color']) {\n switch (sparkLineType) {\n case 'line':\n fillColor = self.component['sparkLine-fill-color'].split(',')[0];\n break;\n case 'pie':\n case 'donut':\n case 'bar':\n fillColor = self.component['sparkLine-fill-color'].split(',');\n break;\n }\n }\n // values\n container.querySelector('.sparkline-container').innerHTML = \"<span class=\\\"line\\\">\".concat(self.parseTpl(self.component['sparkLine-value'], {\n data: self.rootValue\n }), \"</span>\");\n // 宽度计算\n var parentWidth = container.querySelector('#sparkline-container-parent').offsetWidth;\n parentWidth = parentWidth * self.component['sparkLine-width'];\n try {\n // @ts-ignore\n (0, _jquery.default)(container).find('.line').peity(sparkLineType, {\n fill: fillColor,\n height: self.component['sparkLine-height'],\n max: _lodash.default.toNumber(self.parseTpl(\"\".concat(self.component['sparkLine-max-value-count']), {\n data: self.rootValue\n })),\n min: 0,\n stroke: self.component['sparkLine-stroke-color'],\n strokeWidth: 2,\n width: parentWidth\n });\n self.isLoadingSparkLine = false;\n } catch (e) {\n container.querySelectorAll(\".line\").forEach(function (e) {\n return peity(e, sparkLineType, {\n fill: fillColor,\n height: self.component['sparkLine-height'],\n max: _lodash.default.toNumber(self.parseTpl(\"\".concat(self.component['sparkLine-max-value-count']), {\n data: self.rootValue\n })),\n min: 0,\n stroke: self.component['sparkLine-stroke-color'],\n strokeWidth: 2,\n width: parentWidth\n });\n });\n self.isLoadingSparkLine = false;\n }\n }\n }\n\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var _this3 = this;\n var self = this;\n try {\n var container = this.element.querySelector('.data-container');\n try {\n var customStyle = JSON.parse(this.component[\"custom-style\"] || {});\n _lodash.default.forEach(customStyle, function (value, key) {\n _this3.refs.dataContainer.style[key] = value;\n });\n } catch (e) {}\n // 标题设置\n var element = container.querySelector('.title-container');\n element.innerHTML = self.parseTpl(self.component['title-content'], {\n data: self.rootValue\n });\n element = container.querySelector('.value-container');\n element.innerHTML = self.parseTpl(self.component['value-content'], {\n data: self.rootValue\n });\n element = container.querySelector('.footer-container-value1');\n element.innerHTML = self.parseTpl(self.component['footer-content1'], {\n data: self.rootValue\n });\n element = container.querySelector('.footer-container-value2');\n element.innerHTML = self.parseTpl(self.component['footer-content2'], {\n data: self.rootValue\n });\n element = container.querySelector('.footer-container-value3');\n if (element) {\n element.innerHTML = self.parseTpl(self.component['footer-content3'], {\n data: self.rootValue\n });\n }\n // 图标\n self.resetSparkLine();\n } catch (e) {\n console.log(e);\n }\n return true;\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Field.default.schema.apply(_Field.default, [{\n type: 'data_china_grid_row',\n color: '#ff7754',\n \"title-content\": \"低压问题综合治理率 <i class=\\\"fa fa-info-circle\\\" aria-hidden=\\\"true\\\"></i>\",\n \"value-content\": \"160 <i style='font-size: 10px;color: #0a6ebd'>%</i>\",\n \"footer-content1\": \"name\",\n \"footer-content2\": \"<div style='color:red'>up</div>\",\n \"footer-content3\": \"info\",\n \"footer-content\": \"开始时间\"\n }].concat(extend));\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Info Block ChinaFrid Row',\n group: 'advanced',\n icon: 'square-info',\n weight: 70,\n documentation: 'http://help.form.io/userguide/#table',\n schema: DataChinaGridRow.schema()\n };\n }\n }]);\n return DataChinaGridRow;\n}(_Field.default);\nexports[\"default\"] = DataChinaGridRow;\n\n//# sourceURL=webpack://Formio/./lib/components/DataChinaGridRow/Data.js?");
657
657
 
658
658
  /***/ }),
659
659
 
@@ -686,7 +686,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
686
686
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
687
687
 
688
688
  "use strict";
689
- eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.weak-map.js */ \"./node_modules/core-js/modules/es.weak-map.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.uint8-array.js */ \"./node_modules/core-js/modules/es.typed-array.uint8-array.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.copy-within.js */ \"./node_modules/core-js/modules/es.typed-array.copy-within.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.every.js */ \"./node_modules/core-js/modules/es.typed-array.every.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.fill.js */ \"./node_modules/core-js/modules/es.typed-array.fill.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.filter.js */ \"./node_modules/core-js/modules/es.typed-array.filter.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.find.js */ \"./node_modules/core-js/modules/es.typed-array.find.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.find-index.js */ \"./node_modules/core-js/modules/es.typed-array.find-index.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.for-each.js */ \"./node_modules/core-js/modules/es.typed-array.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.includes.js */ \"./node_modules/core-js/modules/es.typed-array.includes.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.index-of.js */ \"./node_modules/core-js/modules/es.typed-array.index-of.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.iterator.js */ \"./node_modules/core-js/modules/es.typed-array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.join.js */ \"./node_modules/core-js/modules/es.typed-array.join.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.last-index-of.js */ \"./node_modules/core-js/modules/es.typed-array.last-index-of.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.map.js */ \"./node_modules/core-js/modules/es.typed-array.map.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.reduce.js */ \"./node_modules/core-js/modules/es.typed-array.reduce.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.reduce-right.js */ \"./node_modules/core-js/modules/es.typed-array.reduce-right.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.reverse.js */ \"./node_modules/core-js/modules/es.typed-array.reverse.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.set.js */ \"./node_modules/core-js/modules/es.typed-array.set.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.slice.js */ \"./node_modules/core-js/modules/es.typed-array.slice.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.some.js */ \"./node_modules/core-js/modules/es.typed-array.some.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.sort.js */ \"./node_modules/core-js/modules/es.typed-array.sort.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.subarray.js */ \"./node_modules/core-js/modules/es.typed-array.subarray.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.to-locale-string.js */ \"./node_modules/core-js/modules/es.typed-array.to-locale-string.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.to-string.js */ \"./node_modules/core-js/modules/es.typed-array.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.string.starts-with.js */ \"./node_modules/core-js/modules/es.string.starts-with.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.url.js */ \"./node_modules/core-js/modules/web.url.js\");\n__webpack_require__(/*! core-js/modules/web.url-search-params.js */ \"./node_modules/core-js/modules/web.url-search-params.js\");\n__webpack_require__(/*! core-js/modules/es.string.search.js */ \"./node_modules/core-js/modules/es.string.search.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.object.keys.js */ \"./node_modules/core-js/modules/es.object.keys.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _DataSource = _interopRequireDefault(__webpack_require__(/*! ./DataSource.form */ \"./lib/components/DataSource/DataSource.form.js\"));\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nvar _papaparse = _interopRequireDefault(__webpack_require__(/*! papaparse */ \"./node_modules/papaparse/papaparse.min.js\"));\nvar XLSX = _interopRequireWildcard(__webpack_require__(/*! xlsx/xlsx.mjs */ \"./node_modules/xlsx/xlsx.mjs\"));\nfunction _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== \"function\") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }\nfunction _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== \"object\" && typeof obj !== \"function\") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== \"default\" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar DataSourceComponent = /*#__PURE__*/function (_FieldComponent) {\n _inherits(DataSourceComponent, _FieldComponent);\n var _super = _createSuper(DataSourceComponent);\n function DataSourceComponent() {\n _classCallCheck(this, DataSourceComponent);\n return _super.apply(this, arguments);\n }\n _createClass(DataSourceComponent, [{\n key: \"render\",\n value: function render(children) {\n return _get(_getPrototypeOf(DataSourceComponent.prototype), \"render\", this).call(this, this.renderTemplate('dataSource'));\n }\n }, {\n key: \"setDataValueByManal\",\n value: function setDataValueByManal(data) {\n var self = this;\n self.dataValue = data;\n self.getRoot().triggerChange({\n fromBlur: false\n }, {\n instance: self,\n component: self.component,\n value: self.dataValue,\n flags: {\n fromBlur: false\n }\n });\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this = this;\n var self = this;\n var refs = {\n csvFileInput: \"single\"\n };\n this.loadRefs(element, refs);\n if (this.refs.csvFileInput) {\n this.refs.csvFileInput.addEventListener(\"change\", function (event) {\n var files = event.target.files;\n if (files.length > 0) {\n if (files[0].type === \"text/csv\") {\n _papaparse.default.parse(files[0], {\n header: true,\n complete: function complete(results) {\n self.setDataValueByManal(results.data);\n },\n error: function error() {\n alert(\"解析csv文件失败\");\n }\n });\n }\n if (files[0].type === \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\") {\n // excel\n var reader = new FileReader();\n reader.onload = function (eventRead) {\n try {\n var data = new Uint8Array(eventRead.target.result);\n var workbook = XLSX.read(data, {\n type: 'array'\n });\n var firstSheetName = workbook.SheetNames[0];\n var worksheet = workbook.Sheets[firstSheetName];\n var jsonData = XLSX.utils.sheet_to_json(worksheet);\n self.setDataValueByManal(jsonData);\n } catch (e) {\n alert(\"解析表格文件失败\");\n }\n };\n reader.readAsArrayBuffer(files[0]);\n }\n }\n });\n }\n if (this.component.dataSource !== \"file\") {\n setTimeout(function () {\n _this.setValue(null);\n }, 100);\n }\n return _get(_getPrototypeOf(DataSourceComponent.prototype), \"attach\", this).call(this, element);\n }\n\n /**\n * Get the value of the component from the dom elements.\n *\n * @returns {Array}\n */\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.dataValue;\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n if (template && template.length > 0) {\n try {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n return _lodash.default.get(map, path);\n });\n } catch (e) {\n console.log(e);\n }\n }\n return '{}';\n }\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var self = this;\n if (value) {\n _get(_getPrototypeOf(DataSourceComponent.prototype), \"setValue\", this).call(this, value, {\n noUpdateEvent: true,\n noValidate: true,\n resetValue: true\n });\n } else {\n if (self.component['dataSource'] === 'file') {\n return true;\n }\n if (self.component['data-source-url']) {\n var url = self.parseTpl(self.component['data-source-url'], {\n data: self.rootValue\n });\n if (url.startsWith('http')) {\n url = new URL(url);\n } else {\n url = new URL(url, window.location.origin);\n }\n var searchParams = new URLSearchParams(url.search);\n var params = {};\n var headers = {};\n self.component.request['headers'].forEach(function (header) {\n headers[\"\".concat(header.key)] = self.parseTpl(header.value, {\n data: self.rootValue\n });\n });\n // 搜索\n if (self.component['dataSource'] === 'url') {} else if (self.component['dataSource'] === 'noco_db') {\n if (self.component.data['noco_db_conditions']) {\n var where = '';\n self.component.data['noco_db_conditions'].forEach(function (item, index) {\n if (item.value && item.value.length > 0) {\n var conditionVal = self.parseTpl(item.value, {\n data: self.rootValue\n });\n if (index === 0 && item.logical_operator === '~not') {\n where += \"(\".concat(item.name, \",\").concat(item.operator, \",\").concat(conditionVal, \")\");\n } else {\n where += \"\".concat(item.logical_operator, \"(\").concat(item.name, \",\").concat(item.operator, \",\").concat(conditionVal, \")\");\n }\n }\n });\n params.where = where;\n }\n }\n Object.keys(params).forEach(function (key) {\n searchParams.set(key, params[\"\".concat(key)]);\n });\n try {\n var lastestReqTime = new Date().getTime();\n self.lastestReqTime = lastestReqTime;\n var xhr = new XMLHttpRequest();\n var reqMethod = self.component.request['method'];\n if (reqMethod === 'GET') {\n xhr.open('GET', \"\".concat(url.origin).concat(url.pathname, \"?\").concat(searchParams.toString()), true);\n xhr.responseType = 'json';\n Object.keys(headers).forEach(function (key) {\n xhr.setRequestHeader(key, headers[\"\".concat(key)]);\n });\n } else if (reqMethod === 'POST') {\n xhr.open('POST', \"\".concat(url.origin).concat(url.pathname, \"?\").concat(searchParams.toString()), true);\n xhr.setRequestHeader('Content-Type', 'application/json');\n xhr.responseType = 'json';\n Object.keys(headers).forEach(function (key) {\n xhr.setRequestHeader(key, headers[\"\".concat(key)]);\n });\n }\n xhr.onload = function () {\n var status = xhr.status;\n if (status === 200) {\n // 确保最后更新的数据是最新一次请求的接口数据\n if (lastestReqTime - self.lastestReqTime === 0) {\n var dataPath = self.component.request['dataPath'];\n if (dataPath && dataPath.length > 0) {\n self.dataValue = _lodash.default.get(xhr.response, dataPath);\n } else {\n self.dataValue = xhr.response;\n }\n self.getRoot().triggerChange({\n fromBlur: false\n }, {\n instance: self,\n component: self.component,\n value: self.dataValue,\n flags: {\n fromBlur: false\n }\n });\n }\n }\n };\n if (reqMethod === 'GET') {\n xhr.send();\n } else if (reqMethod === 'POST') {\n if (self.component.request['body'] && self.component.request['body'].length > 0) {\n try {\n var reqData = JSON.parse(this.parseTpl(self.component.request['body'], {\n data: self.rootValue\n }));\n xhr.send(JSON.stringify(reqData));\n } catch (e) {\n console.log(\"request.body.JSON.parse\\u5931\\u8D25:\".concat(e));\n }\n } else {\n xhr.send();\n }\n }\n } catch (e) {\n console.log(e);\n }\n }\n return true;\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Field.default.schema.apply(_Field.default, [{\n label: 'Data Source',\n key: 'dataSource',\n type: 'dataSource',\n clearOnHide: false,\n hidden: false,\n hideLabel: true\n }].concat(extend));\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Data Source',\n icon: 'database',\n group: 'data',\n documentation: '/userguide/forms/data-components#data-source',\n weight: 20,\n schema: DataSourceComponent.schema()\n };\n }\n }]);\n return DataSourceComponent;\n}(_Field.default);\nexports[\"default\"] = DataSourceComponent;\nDataSourceComponent.editForm = _DataSource.default;\n\n//# sourceURL=webpack://Formio/./lib/components/DataSource/DataSource.js?");
689
+ eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.weak-map.js */ \"./node_modules/core-js/modules/es.weak-map.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.uint8-array.js */ \"./node_modules/core-js/modules/es.typed-array.uint8-array.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.copy-within.js */ \"./node_modules/core-js/modules/es.typed-array.copy-within.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.every.js */ \"./node_modules/core-js/modules/es.typed-array.every.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.fill.js */ \"./node_modules/core-js/modules/es.typed-array.fill.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.filter.js */ \"./node_modules/core-js/modules/es.typed-array.filter.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.find.js */ \"./node_modules/core-js/modules/es.typed-array.find.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.find-index.js */ \"./node_modules/core-js/modules/es.typed-array.find-index.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.for-each.js */ \"./node_modules/core-js/modules/es.typed-array.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.includes.js */ \"./node_modules/core-js/modules/es.typed-array.includes.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.index-of.js */ \"./node_modules/core-js/modules/es.typed-array.index-of.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.iterator.js */ \"./node_modules/core-js/modules/es.typed-array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.join.js */ \"./node_modules/core-js/modules/es.typed-array.join.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.last-index-of.js */ \"./node_modules/core-js/modules/es.typed-array.last-index-of.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.map.js */ \"./node_modules/core-js/modules/es.typed-array.map.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.reduce.js */ \"./node_modules/core-js/modules/es.typed-array.reduce.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.reduce-right.js */ \"./node_modules/core-js/modules/es.typed-array.reduce-right.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.reverse.js */ \"./node_modules/core-js/modules/es.typed-array.reverse.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.set.js */ \"./node_modules/core-js/modules/es.typed-array.set.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.slice.js */ \"./node_modules/core-js/modules/es.typed-array.slice.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.some.js */ \"./node_modules/core-js/modules/es.typed-array.some.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.sort.js */ \"./node_modules/core-js/modules/es.typed-array.sort.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.subarray.js */ \"./node_modules/core-js/modules/es.typed-array.subarray.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.to-locale-string.js */ \"./node_modules/core-js/modules/es.typed-array.to-locale-string.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.to-string.js */ \"./node_modules/core-js/modules/es.typed-array.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.string.starts-with.js */ \"./node_modules/core-js/modules/es.string.starts-with.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.url.js */ \"./node_modules/core-js/modules/web.url.js\");\n__webpack_require__(/*! core-js/modules/web.url-search-params.js */ \"./node_modules/core-js/modules/web.url-search-params.js\");\n__webpack_require__(/*! core-js/modules/es.string.search.js */ \"./node_modules/core-js/modules/es.string.search.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.object.keys.js */ \"./node_modules/core-js/modules/es.object.keys.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _DataSource = _interopRequireDefault(__webpack_require__(/*! ./DataSource.form */ \"./lib/components/DataSource/DataSource.form.js\"));\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nvar _papaparse = _interopRequireDefault(__webpack_require__(/*! papaparse */ \"./node_modules/papaparse/papaparse.min.js\"));\nvar XLSX = _interopRequireWildcard(__webpack_require__(/*! xlsx/xlsx.mjs */ \"./node_modules/xlsx/xlsx.mjs\"));\nfunction _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== \"function\") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }\nfunction _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== \"object\" && typeof obj !== \"function\") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== \"default\" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar DataSourceComponent = /*#__PURE__*/function (_FieldComponent) {\n _inherits(DataSourceComponent, _FieldComponent);\n var _super = _createSuper(DataSourceComponent);\n function DataSourceComponent() {\n _classCallCheck(this, DataSourceComponent);\n return _super.apply(this, arguments);\n }\n _createClass(DataSourceComponent, [{\n key: \"render\",\n value: function render(children) {\n return _get(_getPrototypeOf(DataSourceComponent.prototype), \"render\", this).call(this, this.renderTemplate('dataSource'));\n }\n }, {\n key: \"setDataValueByManal\",\n value: function setDataValueByManal(data) {\n var self = this;\n self.dataValue = data;\n self.getRoot().triggerChange({\n fromBlur: false\n }, {\n instance: self,\n component: self.component,\n value: self.dataValue,\n flags: {\n fromBlur: false\n }\n });\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this = this;\n var self = this;\n var refs = {\n csvFileInput: \"single\"\n };\n this.loadRefs(element, refs);\n if (this.refs.csvFileInput) {\n this.refs.csvFileInput.addEventListener(\"change\", function (event) {\n var files = event.target.files;\n if (files.length > 0) {\n if (files[0].type === \"text/csv\") {\n _papaparse.default.parse(files[0], {\n header: true,\n complete: function complete(results) {\n self.setDataValueByManal(results.data);\n },\n error: function error() {\n alert(\"解析csv文件失败\");\n }\n });\n }\n if (files[0].type === \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\") {\n // excel\n var reader = new FileReader();\n reader.onload = function (eventRead) {\n try {\n var data = new Uint8Array(eventRead.target.result);\n var workbook = XLSX.read(data, {\n type: 'array'\n });\n var firstSheetName = workbook.SheetNames[0];\n var worksheet = workbook.Sheets[firstSheetName];\n var jsonData = XLSX.utils.sheet_to_json(worksheet);\n self.setDataValueByManal(jsonData);\n } catch (e) {\n alert(\"解析表格文件失败\");\n }\n };\n reader.readAsArrayBuffer(files[0]);\n }\n }\n });\n }\n if (this.component.dataSource !== \"file\") {\n setTimeout(function () {\n _this.setValue(null);\n }, 100);\n }\n return _get(_getPrototypeOf(DataSourceComponent.prototype), \"attach\", this).call(this, element);\n }\n\n /**\n * Get the value of the component from the dom elements.\n *\n * @returns {Array}\n */\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.dataValue;\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n if (template && template.length > 0) {\n try {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n });\n } catch (e) {\n console.log(e);\n }\n }\n return '{}';\n }\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var self = this;\n if (value) {\n _get(_getPrototypeOf(DataSourceComponent.prototype), \"setValue\", this).call(this, value, {\n noUpdateEvent: true,\n noValidate: true,\n resetValue: true\n });\n } else {\n if (self.component['dataSource'] === 'file') {\n return true;\n }\n if (self.component['data-source-url']) {\n var url = self.parseTpl(self.component['data-source-url'], {\n data: self.rootValue\n });\n if (url.startsWith('http')) {\n url = new URL(url);\n } else {\n url = new URL(url, window.location.origin);\n }\n var searchParams = new URLSearchParams(url.search);\n var params = {};\n var headers = {};\n self.component.request['headers'].forEach(function (header) {\n headers[\"\".concat(header.key)] = self.parseTpl(header.value, {\n data: self.rootValue\n });\n });\n // 搜索\n if (self.component['dataSource'] === 'url') {} else if (self.component['dataSource'] === 'noco_db') {\n if (self.component.data['noco_db_conditions']) {\n var where = '';\n self.component.data['noco_db_conditions'].forEach(function (item, index) {\n if (item.value && item.value.length > 0) {\n var conditionVal = self.parseTpl(item.value, {\n data: self.rootValue\n });\n if (index === 0 && item.logical_operator === '~not') {\n where += \"(\".concat(item.name, \",\").concat(item.operator, \",\").concat(conditionVal, \")\");\n } else {\n where += \"\".concat(item.logical_operator, \"(\").concat(item.name, \",\").concat(item.operator, \",\").concat(conditionVal, \")\");\n }\n }\n });\n params.where = where;\n }\n }\n Object.keys(params).forEach(function (key) {\n searchParams.set(key, params[\"\".concat(key)]);\n });\n try {\n var lastestReqTime = new Date().getTime();\n self.lastestReqTime = lastestReqTime;\n var xhr = new XMLHttpRequest();\n var reqMethod = self.component.request['method'];\n if (reqMethod === 'GET') {\n xhr.open('GET', \"\".concat(url.origin).concat(url.pathname, \"?\").concat(searchParams.toString()), true);\n xhr.responseType = 'json';\n Object.keys(headers).forEach(function (key) {\n xhr.setRequestHeader(key, headers[\"\".concat(key)]);\n });\n } else if (reqMethod === 'POST') {\n xhr.open('POST', \"\".concat(url.origin).concat(url.pathname, \"?\").concat(searchParams.toString()), true);\n xhr.setRequestHeader('Content-Type', 'application/json');\n xhr.responseType = 'json';\n Object.keys(headers).forEach(function (key) {\n xhr.setRequestHeader(key, headers[\"\".concat(key)]);\n });\n }\n xhr.onload = function () {\n var status = xhr.status;\n if (status === 200) {\n // 确保最后更新的数据是最新一次请求的接口数据\n if (lastestReqTime - self.lastestReqTime === 0) {\n var dataPath = self.component.request['dataPath'];\n if (dataPath && dataPath.length > 0) {\n self.dataValue = _lodash.default.get(xhr.response, dataPath);\n } else {\n self.dataValue = xhr.response;\n }\n self.getRoot().triggerChange({\n fromBlur: false\n }, {\n instance: self,\n component: self.component,\n value: self.dataValue,\n flags: {\n fromBlur: false\n }\n });\n }\n }\n };\n if (reqMethod === 'GET') {\n xhr.send();\n } else if (reqMethod === 'POST') {\n if (self.component.request['body'] && self.component.request['body'].length > 0) {\n try {\n var reqData = JSON.parse(this.parseTpl(self.component.request['body'], {\n data: self.rootValue\n }));\n xhr.send(JSON.stringify(reqData));\n } catch (e) {\n console.log(\"request.body.JSON.parse\\u5931\\u8D25:\".concat(e));\n }\n } else {\n xhr.send();\n }\n }\n } catch (e) {\n console.log(e);\n }\n }\n return true;\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Field.default.schema.apply(_Field.default, [{\n label: 'Data Source',\n key: 'dataSource',\n type: 'dataSource',\n clearOnHide: false,\n hidden: false,\n hideLabel: true\n }].concat(extend));\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Data Source',\n icon: 'database',\n group: 'data',\n documentation: '/userguide/forms/data-components#data-source',\n weight: 20,\n schema: DataSourceComponent.schema()\n };\n }\n }]);\n return DataSourceComponent;\n}(_Field.default);\nexports[\"default\"] = DataSourceComponent;\nDataSourceComponent.editForm = _DataSource.default;\n\n//# sourceURL=webpack://Formio/./lib/components/DataSource/DataSource.js?");
690
690
 
691
691
  /***/ }),
692
692
 
@@ -719,7 +719,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
719
719
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
720
720
 
721
721
  "use strict";
722
- eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.array.slice.js */ \"./node_modules/core-js/modules/es.array.slice.js\");\n__webpack_require__(/*! core-js/modules/es.array.from.js */ \"./node_modules/core-js/modules/es.array.from.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.array.includes.js */ \"./node_modules/core-js/modules/es.array.includes.js\");\n__webpack_require__(/*! core-js/modules/es.string.includes.js */ \"./node_modules/core-js/modules/es.string.includes.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _Formio = __webpack_require__(/*! ../../Formio */ \"./lib/Formio.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar Data = /*#__PURE__*/function (_FieldComponent) {\n _inherits(Data, _FieldComponent);\n var _super = _createSuper(Data);\n function Data(component, options, data) {\n var _this;\n _classCallCheck(this, Data);\n _this = _super.call(this, component, options, data);\n _this.isInitData = false;\n return _this;\n }\n _createClass(Data, [{\n key: \"get\",\n value: function get(path, obj) {\n var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : \"${\".concat(path, \"}\");\n return path.split('.').reduce(function (res, key) {\n return res[key] || fb;\n }, obj);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map, fallback) {\n var _this2 = this;\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n return _this2.get(path, map, fallback);\n });\n }\n }, {\n key: \"render\",\n value: function render(children) {\n return _get(_getPrototypeOf(Data.prototype), \"render\", this).call(this, this.renderTemplate('department'));\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this3 = this;\n var refs = {};\n var self = this;\n this.loadRefs(element, refs);\n if (self.component.url) {\n var _this$component = this.component,\n _this$component$optio = _this$component.options,\n options = _this$component$optio === void 0 ? '{\"headers\":{}}' : _this$component$optio,\n _this$component$body = _this$component.body,\n body = _this$component$body === void 0 ? '{}' : _this$component$body;\n var parsedOptions = {\n ignoreCache: true\n };\n var parsedBody = {};\n try {\n parsedOptions = JSON.parse(this.parseTpl(options || '{\"headers\":{}}', {\n data: this.rootValue\n }, null));\n parsedBody = JSON.parse(this.parseTpl(body || '{}', {\n data: this.rootValue\n }, null));\n } catch (e) {\n console.log(e);\n }\n // 取消请求缓存\n parsedOptions.ignoreCache = true;\n _Formio.GlobalFormio.request(this.component.url, this.component.methods, this.component.methods !== 'GET' ? parsedBody : null, null, parsedOptions).then(function (response) {\n var tree = response;\n var container = element.querySelector('#myUL');\n // 添加列表\n tree.forEach(function (parent) {\n container.insertAdjacentHTML('beforeend', \"<li id=\\\"li-\".concat(parent.id, \"\\\" data-id=\\\"\").concat(parent.id, \"\\\"><input type=\\\"checkbox\\\" class=\\\"tree-input\\\"/><span class=\\\"box\\\">\").concat(parent.name, \"</span></li>\"));\n self.addChild(container, parent);\n });\n var toggler = container.getElementsByClassName('box');\n var i;\n for (i = 0; i < toggler.length; i++) {\n toggler[i].addEventListener('click', function () {\n if (this.parentElement.querySelector('.nested')) {\n this.parentElement.querySelector('.nested').classList.toggle('active');\n }\n });\n }\n var inputs = container.getElementsByClassName('tree-input');\n var _iterator = _createForOfIteratorHelper(inputs),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var input = _step.value;\n input.addEventListener('change', function (val) {\n self.updateValue();\n });\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n self.isInitData = true;\n setTimeout(function () {\n self.setValue(self.initValue);\n }, 300);\n return _get(_getPrototypeOf(Data.prototype), \"attach\", _this3).call(_this3, element);\n }).catch(function (e) {\n self.isInitData = true;\n return _get(_getPrototypeOf(Data.prototype), \"attach\", _this3).call(_this3, element);\n });\n }\n // Allow basic component functionality to attach like field logic and tooltips.\n }\n }, {\n key: \"addChild\",\n value: function addChild(container, parent) {\n var self = this;\n if (parent.children && parent.children.length > 0) {\n var parentNode = container.querySelector(\"#li-\".concat(parent.id));\n if (parentNode) {\n parentNode.insertAdjacentHTML('beforeend', \"<ul class=\\\"nested\\\" id=\\\"ul-\".concat(parent.id, \"\\\">\"));\n parent.children.forEach(function (child) {\n parentNode.querySelector(\"#ul-\".concat(parent.id)).insertAdjacentHTML('beforeend', \"<li id=\\\"li-\".concat(child.id, \"\\\" data-id=\\\"\").concat(child.id, \"\\\"><input type=\\\"checkbox\\\" class=\\\"tree-input\\\"/><span class=\\\"box\\\">\").concat(child.name, \"</span></li>\"));\n self.addChild(container, child);\n });\n }\n }\n }\n }, {\n key: \"getValue\",\n value: function getValue() {\n var value = [];\n var container = this.element.querySelector('#myUL');\n var checked = container.getElementsByClassName('tree-input');\n var _iterator2 = _createForOfIteratorHelper(checked),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var checkedElement = _step2.value;\n if (checkedElement.checked) {\n value.push(checkedElement.parentElement.dataset.id);\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n return value;\n }\n }, {\n key: \"emptyValue\",\n get: function get() {\n return [];\n }\n\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var self = this;\n if (this.isInitData) {\n var checks = self.element.getElementsByClassName('tree-input');\n var _iterator3 = _createForOfIteratorHelper(checks),\n _step3;\n try {\n for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n var check = _step3.value;\n if (value.includes(check.parentElement.dataset.id)) {\n check.checked = true;\n }\n }\n } catch (err) {\n _iterator3.e(err);\n } finally {\n _iterator3.f();\n }\n return true;\n } else {\n this.initValue = JSON.parse(JSON.stringify(value));\n return true;\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _Field.default.schema({\n type: 'department',\n header: '',\n url: '',\n height: 500,\n interval: 0\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Department',\n group: 'advanced',\n icon: 'code-branch',\n weight: 70,\n documentation: '',\n schema: Data.schema()\n };\n }\n }]);\n return Data;\n}(_Field.default);\nexports[\"default\"] = Data;\n\n//# sourceURL=webpack://Formio/./lib/components/Department/Department.js?");
722
+ eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.array.slice.js */ \"./node_modules/core-js/modules/es.array.slice.js\");\n__webpack_require__(/*! core-js/modules/es.array.from.js */ \"./node_modules/core-js/modules/es.array.from.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.array.includes.js */ \"./node_modules/core-js/modules/es.array.includes.js\");\n__webpack_require__(/*! core-js/modules/es.string.includes.js */ \"./node_modules/core-js/modules/es.string.includes.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _Formio = __webpack_require__(/*! ../../Formio */ \"./lib/Formio.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar Data = /*#__PURE__*/function (_FieldComponent) {\n _inherits(Data, _FieldComponent);\n var _super = _createSuper(Data);\n function Data(component, options, data) {\n var _this;\n _classCallCheck(this, Data);\n _this = _super.call(this, component, options, data);\n _this.isInitData = false;\n return _this;\n }\n _createClass(Data, [{\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n });\n }\n }, {\n key: \"render\",\n value: function render(children) {\n return _get(_getPrototypeOf(Data.prototype), \"render\", this).call(this, this.renderTemplate('department'));\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this2 = this;\n var refs = {};\n var self = this;\n this.loadRefs(element, refs);\n if (self.component.url) {\n var _this$component = this.component,\n _this$component$optio = _this$component.options,\n options = _this$component$optio === void 0 ? '{\"headers\":{}}' : _this$component$optio,\n _this$component$body = _this$component.body,\n body = _this$component$body === void 0 ? '{}' : _this$component$body;\n var parsedOptions = {\n ignoreCache: true\n };\n var parsedBody = {};\n try {\n parsedOptions = JSON.parse(this.parseTpl(options || '{\"headers\":{}}', {\n data: this.rootValue\n }));\n parsedBody = JSON.parse(this.parseTpl(body || '{}', {\n data: this.rootValue\n }));\n } catch (e) {\n console.log(e);\n }\n // 取消请求缓存\n parsedOptions.ignoreCache = true;\n _Formio.GlobalFormio.request(this.component.url, this.component.methods, this.component.methods !== 'GET' ? parsedBody : null, null, parsedOptions).then(function (response) {\n var tree = response;\n var container = element.querySelector('#myUL');\n // 添加列表\n tree.forEach(function (parent) {\n container.insertAdjacentHTML('beforeend', \"<li id=\\\"li-\".concat(parent.id, \"\\\" data-id=\\\"\").concat(parent.id, \"\\\"><input type=\\\"checkbox\\\" class=\\\"tree-input\\\"/><span class=\\\"box\\\">\").concat(parent.name, \"</span></li>\"));\n self.addChild(container, parent);\n });\n var toggler = container.getElementsByClassName('box');\n var i;\n for (i = 0; i < toggler.length; i++) {\n toggler[i].addEventListener('click', function () {\n if (this.parentElement.querySelector('.nested')) {\n this.parentElement.querySelector('.nested').classList.toggle('active');\n }\n });\n }\n var inputs = container.getElementsByClassName('tree-input');\n var _iterator = _createForOfIteratorHelper(inputs),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var input = _step.value;\n input.addEventListener('change', function (val) {\n self.updateValue();\n });\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n self.isInitData = true;\n setTimeout(function () {\n self.setValue(self.initValue);\n }, 300);\n return _get(_getPrototypeOf(Data.prototype), \"attach\", _this2).call(_this2, element);\n }).catch(function (e) {\n self.isInitData = true;\n return _get(_getPrototypeOf(Data.prototype), \"attach\", _this2).call(_this2, element);\n });\n }\n // Allow basic component functionality to attach like field logic and tooltips.\n }\n }, {\n key: \"addChild\",\n value: function addChild(container, parent) {\n var self = this;\n if (parent.children && parent.children.length > 0) {\n var parentNode = container.querySelector(\"#li-\".concat(parent.id));\n if (parentNode) {\n parentNode.insertAdjacentHTML('beforeend', \"<ul class=\\\"nested\\\" id=\\\"ul-\".concat(parent.id, \"\\\">\"));\n parent.children.forEach(function (child) {\n parentNode.querySelector(\"#ul-\".concat(parent.id)).insertAdjacentHTML('beforeend', \"<li id=\\\"li-\".concat(child.id, \"\\\" data-id=\\\"\").concat(child.id, \"\\\"><input type=\\\"checkbox\\\" class=\\\"tree-input\\\"/><span class=\\\"box\\\">\").concat(child.name, \"</span></li>\"));\n self.addChild(container, child);\n });\n }\n }\n }\n }, {\n key: \"getValue\",\n value: function getValue() {\n var value = [];\n var container = this.element.querySelector('#myUL');\n var checked = container.getElementsByClassName('tree-input');\n var _iterator2 = _createForOfIteratorHelper(checked),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var checkedElement = _step2.value;\n if (checkedElement.checked) {\n value.push(checkedElement.parentElement.dataset.id);\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n return value;\n }\n }, {\n key: \"emptyValue\",\n get: function get() {\n return [];\n }\n\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var self = this;\n if (this.isInitData) {\n var checks = self.element.getElementsByClassName('tree-input');\n var _iterator3 = _createForOfIteratorHelper(checks),\n _step3;\n try {\n for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n var check = _step3.value;\n if (value.includes(check.parentElement.dataset.id)) {\n check.checked = true;\n }\n }\n } catch (err) {\n _iterator3.e(err);\n } finally {\n _iterator3.f();\n }\n return true;\n } else {\n this.initValue = JSON.parse(JSON.stringify(value));\n return true;\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _Field.default.schema({\n type: 'department',\n header: '',\n url: '',\n height: 500,\n interval: 0\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Department',\n group: 'advanced',\n icon: 'code-branch',\n weight: 70,\n documentation: '',\n schema: Data.schema()\n };\n }\n }]);\n return Data;\n}(_Field.default);\nexports[\"default\"] = Data;\n\n//# sourceURL=webpack://Formio/./lib/components/Department/Department.js?");
723
723
 
724
724
  /***/ }),
725
725
 
@@ -829,7 +829,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
829
829
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
830
830
 
831
831
  "use strict";
832
- eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _TextField = _interopRequireDefault(__webpack_require__(/*! ../textfield/TextField */ \"./lib/components/textfield/TextField.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar LocationInputTextField = /*#__PURE__*/function (_TextFieldComponent) {\n _inherits(LocationInputTextField, _TextFieldComponent);\n var _super = _createSuper(LocationInputTextField);\n function LocationInputTextField(component, options, data) {\n _classCallCheck(this, LocationInputTextField);\n return _super.call(this, component, options, data);\n }\n _createClass(LocationInputTextField, [{\n key: \"get\",\n value: function get(path, obj) {\n var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : \"${\".concat(path, \"}\");\n return path.split('.').reduce(function (res, key) {\n return res[key] || fb;\n }, obj);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map, fallback) {\n var _this = this;\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n return _this.get(path, map, fallback);\n });\n }\n }, {\n key: \"attach\",\n value: function attach(element) {\n var self = this;\n this.loadRefs(element, {\n buttonLocationInput: 'single'\n });\n this.addEventListener(this.refs.buttonLocationInput, 'click', function () {\n if (self.component['source-form'] && self.component['source-form'].length > 0) {\n // 30215716ed6a8631e1fb0183990a050f\n window._AMapSecurityConfig = {\n securityJsCode: self.component[\"amap-code\"]\n };\n // bf743ba0e995351d6afa2d70408fe91c\n AMapLoader.load({\n key: self.component[\"amap-key\"],\n //申请好的Web端开发者 Key,调用 load 时必填\n version: '2.0' //指定要加载的 JS API 的版本,缺省时默认为 1.4.15\n }).then(function (AMap) {\n AMap.plugin(\"AMap.Geocoder\", function () {\n var geocoder = new AMap.Geocoder({});\n var address = self.parseTpl(self.component['source-form'], {\n data: self.rootValue\n }, null);\n geocoder.getLocation(address, function (status, result) {\n if (status === \"complete\" && result.info === \"OK\") {\n // result中对应详细地理坐标信息\n self.setValue(\"\".concat(result.geocodes[0].location.lng, \",\").concat(result.geocodes[0].location.lat));\n }\n });\n });\n }).catch(function (e) {\n console.error(e); //加载错误提示\n });\n }\n });\n\n if (self.component['source-form'] && self.component['source-form'].length > 0 && self.component['amap-key'] && self.component['amap-key'].length > 0 && self.component['amap-code'] && self.component['amap-code'].length > 0) {\n // 30215716ed6a8631e1fb0183990a050f\n window._AMapSecurityConfig = {\n securityJsCode: self.component[\"amap-code\"]\n };\n // bf743ba0e995351d6afa2d70408fe91c\n AMapLoader.load({\n key: self.component[\"amap-key\"],\n //申请好的Web端开发者 Key,调用 load 时必填\n version: '2.0' //指定要加载的 JS API 的版本,缺省时默认为 1.4.15\n }).then(function (AMap) {\n AMap.plugin(\"AMap.Geocoder\", function () {\n var geocoder = new AMap.Geocoder({});\n var address = self.parseTpl(self.component['source-form'], {\n data: self.rootValue\n }, null);\n geocoder.getLocation(address, function (status, result) {\n if (status === \"complete\" && result.info === \"OK\") {\n // result中对应详细地理坐标信息\n self.setValue(\"\".concat(result.geocodes[0].location.lng, \",\").concat(result.geocodes[0].location.lat));\n }\n });\n });\n }).catch(function (e) {\n console.error(e); //加载错误提示\n });\n }\n\n return _get(_getPrototypeOf(LocationInputTextField.prototype), \"attach\", this).call(this, element);\n }\n }, {\n key: \"init\",\n value: function init() {\n _get(_getPrototypeOf(LocationInputTextField.prototype), \"init\", this).call(this);\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _TextField.default.schema({\n label: 'LocationInput TextField',\n 'key': 'locationInputTextField',\n 'type': 'locationInputTextField',\n locationInput: true,\n disabled: true\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'LocationInput TextField',\n icon: 'arrows-rotate',\n weight: 0,\n group: 'basic',\n schema: LocationInputTextField.schema()\n };\n }\n }]);\n return LocationInputTextField;\n}(_TextField.default);\nexports[\"default\"] = LocationInputTextField;\n\n//# sourceURL=webpack://Formio/./lib/components/LocationInputTextField/LocationInputTextField.js?");
832
+ eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _TextField = _interopRequireDefault(__webpack_require__(/*! ../textfield/TextField */ \"./lib/components/textfield/TextField.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar LocationInputTextField = /*#__PURE__*/function (_TextFieldComponent) {\n _inherits(LocationInputTextField, _TextFieldComponent);\n var _super = _createSuper(LocationInputTextField);\n function LocationInputTextField(component, options, data) {\n _classCallCheck(this, LocationInputTextField);\n return _super.call(this, component, options, data);\n }\n _createClass(LocationInputTextField, [{\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n });\n }\n }, {\n key: \"attach\",\n value: function attach(element) {\n var self = this;\n this.loadRefs(element, {\n buttonLocationInput: 'single'\n });\n this.addEventListener(this.refs.buttonLocationInput, 'click', function () {\n if (self.component['source-form'] && self.component['source-form'].length > 0) {\n // 30215716ed6a8631e1fb0183990a050f\n window._AMapSecurityConfig = {\n securityJsCode: self.component[\"amap-code\"]\n };\n // bf743ba0e995351d6afa2d70408fe91c\n AMapLoader.load({\n key: self.component[\"amap-key\"],\n //申请好的Web端开发者 Key,调用 load 时必填\n version: '2.0' //指定要加载的 JS API 的版本,缺省时默认为 1.4.15\n }).then(function (AMap) {\n AMap.plugin(\"AMap.Geocoder\", function () {\n var geocoder = new AMap.Geocoder({});\n var address = self.parseTpl(self.component['source-form'], {\n data: self.rootValue\n });\n geocoder.getLocation(address, function (status, result) {\n if (status === \"complete\" && result.info === \"OK\") {\n // result中对应详细地理坐标信息\n self.setValue(\"\".concat(result.geocodes[0].location.lng, \",\").concat(result.geocodes[0].location.lat));\n }\n });\n });\n }).catch(function (e) {\n console.error(e); //加载错误提示\n });\n }\n });\n\n if (self.component['source-form'] && self.component['source-form'].length > 0 && self.component['amap-key'] && self.component['amap-key'].length > 0 && self.component['amap-code'] && self.component['amap-code'].length > 0) {\n // 30215716ed6a8631e1fb0183990a050f\n window._AMapSecurityConfig = {\n securityJsCode: self.component[\"amap-code\"]\n };\n // bf743ba0e995351d6afa2d70408fe91c\n AMapLoader.load({\n key: self.component[\"amap-key\"],\n //申请好的Web端开发者 Key,调用 load 时必填\n version: '2.0' //指定要加载的 JS API 的版本,缺省时默认为 1.4.15\n }).then(function (AMap) {\n AMap.plugin(\"AMap.Geocoder\", function () {\n var geocoder = new AMap.Geocoder({});\n var address = self.parseTpl(self.component['source-form'], {\n data: self.rootValue\n });\n geocoder.getLocation(address, function (status, result) {\n if (status === \"complete\" && result.info === \"OK\") {\n // result中对应详细地理坐标信息\n self.setValue(\"\".concat(result.geocodes[0].location.lng, \",\").concat(result.geocodes[0].location.lat));\n }\n });\n });\n }).catch(function (e) {\n console.error(e); //加载错误提示\n });\n }\n\n return _get(_getPrototypeOf(LocationInputTextField.prototype), \"attach\", this).call(this, element);\n }\n }, {\n key: \"init\",\n value: function init() {\n _get(_getPrototypeOf(LocationInputTextField.prototype), \"init\", this).call(this);\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _TextField.default.schema({\n label: 'LocationInput TextField',\n 'key': 'locationInputTextField',\n 'type': 'locationInputTextField',\n locationInput: true,\n disabled: true\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'LocationInput TextField',\n icon: 'arrows-rotate',\n weight: 0,\n group: 'basic',\n schema: LocationInputTextField.schema()\n };\n }\n }]);\n return LocationInputTextField;\n}(_TextField.default);\nexports[\"default\"] = LocationInputTextField;\n\n//# sourceURL=webpack://Formio/./lib/components/LocationInputTextField/LocationInputTextField.js?");
833
833
 
834
834
  /***/ }),
835
835
 
@@ -895,7 +895,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
895
895
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
896
896
 
897
897
  "use strict";
898
- eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.async-iterator.js */ \"./node_modules/core-js/modules/es.symbol.async-iterator.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-string-tag.js */ \"./node_modules/core-js/modules/es.symbol.to-string-tag.js\");\n__webpack_require__(/*! core-js/modules/es.json.to-string-tag.js */ \"./node_modules/core-js/modules/es.json.to-string-tag.js\");\n__webpack_require__(/*! core-js/modules/es.math.to-string-tag.js */ \"./node_modules/core-js/modules/es.math.to-string-tag.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.array.find-index.js */ \"./node_modules/core-js/modules/es.array.find-index.js\");\n__webpack_require__(/*! core-js/modules/es.string.ends-with.js */ \"./node_modules/core-js/modules/es.string.ends-with.js\");\n__webpack_require__(/*! core-js/modules/es.object.keys.js */ \"./node_modules/core-js/modules/es.object.keys.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.url.js */ \"./node_modules/core-js/modules/web.url.js\");\n__webpack_require__(/*! core-js/modules/web.url-search-params.js */ \"./node_modules/core-js/modules/web.url-search-params.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.slice.js */ \"./node_modules/core-js/modules/es.array.slice.js\");\n__webpack_require__(/*! core-js/modules/es.promise.js */ \"./node_modules/core-js/modules/es.promise.js\");\n__webpack_require__(/*! core-js/modules/es.array.splice.js */ \"./node_modules/core-js/modules/es.array.splice.js\");\n__webpack_require__(/*! core-js/modules/es.array.includes.js */ \"./node_modules/core-js/modules/es.array.includes.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _utils = __webpack_require__(/*! ../../utils/utils */ \"./lib/utils/utils.js\");\nvar _File = _interopRequireDefault(__webpack_require__(/*! ../file/File */ \"./lib/components/file/File.js\"));\nvar _fileProcessor = _interopRequireDefault(__webpack_require__(/*! ../../providers/processor/fileProcessor */ \"./lib/providers/processor/fileProcessor.js\"));\nvar _browserMd5File = _interopRequireDefault(__webpack_require__(/*! browser-md5-file */ \"./node_modules/browser-md5-file/dist/index.umd.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, \"throw\" === methodName && delegate.iterator.return && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method) || \"return\" !== methodName && (context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a '\" + methodName + \"' method\")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar NocodbFile = /*#__PURE__*/function (_FileComponent) {\n _inherits(NocodbFile, _FileComponent);\n var _super = _createSuper(NocodbFile);\n function NocodbFile(component, options, data) {\n _classCallCheck(this, NocodbFile);\n return _super.call(this, component, options, data);\n }\n _createClass(NocodbFile, [{\n key: \"attach\",\n value:\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n function attach(element) {\n var _this = this;\n var refs = {\n fileLinkDiv: 'multi'\n };\n this.loadRefs(element, refs);\n this.refs.fileLinkDiv.forEach(function (fileLink) {\n // 点击事件\n fileLink.addEventListener('click', function (event) {\n var currentIndex = _this.dataValue.findIndex(function (item) {\n return fileLink.href.endsWith(encodeURI(item.url));\n });\n var file = _this.dataValue[currentIndex];\n var _this$component$optio = _this.component.options,\n options = _this$component$optio === void 0 ? {} : _this$component$optio;\n try {\n options = JSON.parse(_this.parseTpl(options, {\n data: _this.rootValue\n }, null));\n } catch (e) {\n console.log(e);\n }\n var xhr = new XMLHttpRequest();\n xhr.open('GET', fileLink.href, true);\n //设置请求头参数的方式,如果没有可忽略此行代码\n if (options && options.headers) {\n Object.keys(options.headers).forEach(function (headerKey) {\n xhr.setRequestHeader(headerKey, options.headers[\"\".concat(headerKey)]);\n });\n }\n //设置响应类型为 blob xhr.open必须为 异步\n xhr.responseType = 'blob';\n xhr.setRequestHeader('Access-Control-Allow-Origin', '*');\n //关键部分\n xhr.onload = function (e) {\n //如果请求执行成功\n if (this.status == 200) {\n var blob = this.response;\n var a = document.createElement('a');\n // blob.type = \"application/octet-stream\";\n var url = window.URL.createObjectURL(blob);\n a.href = url;\n a.download = file.originalName || file.name;\n document.body.appendChild(a); // 火狐浏览器 必须把元素插入body中\n a.click();\n document.body.removeChild(a);\n //释放之前创建的URL对象\n window.URL.revokeObjectURL(url);\n }\n };\n xhr.send(); // 发送ajax请求\n event.returnValue = false;\n });\n });\n // Allow basic component functionality to attach like field logic and tooltips.\n return _get(_getPrototypeOf(NocodbFile.prototype), \"attach\", this).call(this, element);\n }\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.component.value;\n }\n }, {\n key: \"get\",\n value: function get(path, obj) {\n var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : \"${\".concat(path, \"}\");\n return path.split('.').reduce(function (res, key) {\n return res[key] || fb;\n }, obj);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map, fallback) {\n var _this2 = this;\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n return _this2.get(path, map, fallback);\n });\n }\n }, {\n key: \"upload\",\n value: function upload(files) {\n var _this3 = this;\n // Only allow one upload if not multiple.\n if (!this.component.multiple) {\n if (this.statuses.length) {\n this.statuses = [];\n }\n files = Array.prototype.slice.call(files, 0, 1);\n }\n if (this.component.storage && files && files.length) {\n this.fileDropHidden = true;\n\n // files is not really an array and does not have a forEach method, so fake it.\n /* eslint-disable max-statements */\n Array.prototype.forEach.call(files, /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {\n var bmf, hash, fileName, fileUpload, fileWithSameNameUploaded, fileWithSameNameUploadedWithError, dir, fileService, storage, _this3$component$opti, options, url, groupKey, groupPermissions, fileKey, groupResourceId, processedFile, fileProcessorHandler, filePromise;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n bmf = new _browserMd5File.default();\n _context.next = 3;\n return new Promise(function (resolve, reject) {\n bmf.md5(file, function (err, md5) {\n if (err) {\n return reject(err);\n }\n return resolve(md5);\n });\n });\n case 3:\n hash = _context.sent;\n fileName = (0, _utils.uniqueName)(file.name, _this3.component.fileNameTemplate, _this3.evalContext());\n fileUpload = {\n originalName: file.name,\n name: fileName,\n size: file.size,\n status: 'info',\n message: _this3.t('Processing file. Please wait...'),\n hash: hash,\n progress: 0\n }; // Check if file with the same name is being uploaded\n fileWithSameNameUploaded = _this3.dataValue.some(function (fileStatus) {\n return fileStatus.originalName === file.name;\n });\n fileWithSameNameUploadedWithError = _this3.statuses.findIndex(function (fileStatus) {\n return fileStatus.originalName === file.name && fileStatus.status === 'error';\n });\n if (fileWithSameNameUploaded) {\n fileUpload.status = 'error';\n fileUpload.message = _this3.t('File with the same name is already uploaded');\n }\n if (fileWithSameNameUploadedWithError !== -1) {\n _this3.statuses.splice(fileWithSameNameUploadedWithError, 1);\n _this3.redraw();\n }\n\n // Check file pattern\n if (_this3.component.filePattern && !_this3.validatePattern(file, _this3.component.filePattern)) {\n fileUpload.status = 'error';\n fileUpload.message = _this3.t('File is the wrong type; it must be {{ pattern }}', {\n pattern: _this3.component.filePattern\n });\n }\n\n // Check file minimum size\n if (_this3.component.fileMinSize && !_this3.validateMinSize(file, _this3.component.fileMinSize)) {\n fileUpload.status = 'error';\n fileUpload.message = _this3.t('File is too small; it must be at least {{ size }}', {\n size: _this3.component.fileMinSize\n });\n }\n\n // Check file maximum size\n if (_this3.component.fileMaxSize && !_this3.validateMaxSize(file, _this3.component.fileMaxSize)) {\n fileUpload.status = 'error';\n fileUpload.message = _this3.t('File is too big; it must be at most {{ size }}', {\n size: _this3.component.fileMaxSize\n });\n }\n\n // Get a unique name for this file to keep file collisions from occurring.\n dir = _this3.interpolate(_this3.component.dir || '');\n fileService = _this3.fileService;\n if (!fileService) {\n fileUpload.status = 'error';\n fileUpload.message = _this3.t('File Service not provided.');\n }\n _this3.statuses.push(fileUpload);\n _this3.redraw();\n if (!(fileUpload.status !== 'error')) {\n _context.next = 52;\n break;\n }\n if (_this3.component.privateDownload) {\n file.private = true;\n }\n storage = _this3.component.storage;\n _this3$component$opti = _this3.component.options, options = _this3$component$opti === void 0 ? {} : _this3$component$opti;\n try {\n options = JSON.parse(_this3.parseTpl(options, {\n data: _this3.rootValue\n }, null));\n } catch (e) {\n console.log(e);\n }\n // 解析options变量\n url = _this3.interpolate(_this3.component.url, {\n file: fileUpload\n });\n groupKey = null;\n groupPermissions = null; // Iterate through form components to find group resource if one exists\n _this3.root.everyComponent(function (element) {\n var _element$component, _element$component2;\n if ((_element$component = element.component) !== null && _element$component !== void 0 && _element$component.submissionAccess || (_element$component2 = element.component) !== null && _element$component2 !== void 0 && _element$component2.defaultPermission) {\n groupPermissions = !element.component.submissionAccess ? [{\n type: element.component.defaultPermission,\n roles: []\n }] : element.component.submissionAccess;\n groupPermissions.forEach(function (permission) {\n groupKey = ['admin', 'write', 'create'].includes(permission.type) ? element.component.key : null;\n });\n }\n });\n fileKey = _this3.component.fileKey || 'file';\n groupResourceId = groupKey ? _this3.currentForm.submission.data[groupKey]._id : null;\n processedFile = null;\n if (!_this3.root.options.fileProcessor) {\n _context.next = 49;\n break;\n }\n _context.prev = 31;\n if (_this3.refs.fileProcessingLoader) {\n _this3.refs.fileProcessingLoader.style.display = 'block';\n }\n fileProcessorHandler = (0, _fileProcessor.default)(_this3.fileService, _this3.root.options.fileProcessor);\n _context.next = 36;\n return fileProcessorHandler(file, _this3.component.properties);\n case 36:\n processedFile = _context.sent;\n _context.next = 46;\n break;\n case 39:\n _context.prev = 39;\n _context.t0 = _context[\"catch\"](31);\n fileUpload.status = 'error';\n fileUpload.message = _this3.t('File processing has been failed.');\n _this3.fileDropHidden = false;\n _this3.redraw();\n return _context.abrupt(\"return\");\n case 46:\n _context.prev = 46;\n if (_this3.refs.fileProcessingLoader) {\n _this3.refs.fileProcessingLoader.style.display = 'none';\n }\n return _context.finish(46);\n case 49:\n fileUpload.message = _this3.t('Starting upload.');\n _this3.redraw();\n filePromise = fileService.uploadFile(storage, processedFile || file, fileName, dir,\n // Progress callback\n function (evt) {\n fileUpload.status = 'progress';\n fileUpload.progress = parseInt(String(100.0 * evt.loaded / evt.total));\n delete fileUpload.message;\n _this3.redraw();\n }, url, options, fileKey, groupPermissions, groupResourceId,\n // Upload start callback\n function () {\n _this3.emit('fileUploadingStart', filePromise);\n },\n // Abort upload callback\n function (abort) {\n return _this3.abortUpload = abort;\n }).then(function (fileInfo) {\n if (fileInfo.data.length > 0) {\n fileInfo.data = fileInfo.data[0];\n }\n var index = _this3.statuses.indexOf(fileUpload);\n if (index !== -1) {\n _this3.statuses.splice(index, 1);\n }\n fileInfo.originalName = file.name;\n fileInfo.hash = fileUpload.hash;\n fileInfo.url = \"\".concat(url.split(\"/api/\")[0], \"/\").concat(fileInfo.data.signedPath);\n if (!_this3.hasValue()) {\n _this3.dataValue = [];\n }\n _this3.dataValue.push(fileInfo);\n _this3.fileDropHidden = false;\n _this3.redraw();\n _this3.triggerChange();\n _this3.emit('fileUploadingEnd', filePromise);\n }).catch(function (response) {\n fileUpload.status = 'error';\n fileUpload.message = typeof response === 'string' ? response : response.toString();\n delete fileUpload.progress;\n _this3.fileDropHidden = false;\n _this3.redraw();\n _this3.emit('fileUploadingEnd', filePromise);\n });\n case 52:\n case \"end\":\n return _context.stop();\n }\n }, _callee, null, [[31, 39, 46, 49]]);\n }));\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n }());\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _File.default.schema({\n label: 'Nocodb File',\n 'key': 'ncoodbFile',\n 'type': 'nocodbFile'\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Nocodb File',\n icon: 'file',\n weight: 100,\n group: 'advanced',\n schema: NocodbFile.schema()\n };\n }\n }]);\n return NocodbFile;\n}(_File.default);\nexports[\"default\"] = NocodbFile;\n\n//# sourceURL=webpack://Formio/./lib/components/NocodbFile/NocodbFile.js?");
898
+ eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.async-iterator.js */ \"./node_modules/core-js/modules/es.symbol.async-iterator.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-string-tag.js */ \"./node_modules/core-js/modules/es.symbol.to-string-tag.js\");\n__webpack_require__(/*! core-js/modules/es.json.to-string-tag.js */ \"./node_modules/core-js/modules/es.json.to-string-tag.js\");\n__webpack_require__(/*! core-js/modules/es.math.to-string-tag.js */ \"./node_modules/core-js/modules/es.math.to-string-tag.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.array.find-index.js */ \"./node_modules/core-js/modules/es.array.find-index.js\");\n__webpack_require__(/*! core-js/modules/es.string.ends-with.js */ \"./node_modules/core-js/modules/es.string.ends-with.js\");\n__webpack_require__(/*! core-js/modules/es.object.keys.js */ \"./node_modules/core-js/modules/es.object.keys.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.url.js */ \"./node_modules/core-js/modules/web.url.js\");\n__webpack_require__(/*! core-js/modules/web.url-search-params.js */ \"./node_modules/core-js/modules/web.url-search-params.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.slice.js */ \"./node_modules/core-js/modules/es.array.slice.js\");\n__webpack_require__(/*! core-js/modules/es.promise.js */ \"./node_modules/core-js/modules/es.promise.js\");\n__webpack_require__(/*! core-js/modules/es.array.splice.js */ \"./node_modules/core-js/modules/es.array.splice.js\");\n__webpack_require__(/*! core-js/modules/es.array.includes.js */ \"./node_modules/core-js/modules/es.array.includes.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _utils = __webpack_require__(/*! ../../utils/utils */ \"./lib/utils/utils.js\");\nvar _File = _interopRequireDefault(__webpack_require__(/*! ../file/File */ \"./lib/components/file/File.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nvar _fileProcessor = _interopRequireDefault(__webpack_require__(/*! ../../providers/processor/fileProcessor */ \"./lib/providers/processor/fileProcessor.js\"));\nvar _browserMd5File = _interopRequireDefault(__webpack_require__(/*! browser-md5-file */ \"./node_modules/browser-md5-file/dist/index.umd.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, \"throw\" === methodName && delegate.iterator.return && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method) || \"return\" !== methodName && (context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a '\" + methodName + \"' method\")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar NocodbFile = /*#__PURE__*/function (_FileComponent) {\n _inherits(NocodbFile, _FileComponent);\n var _super = _createSuper(NocodbFile);\n function NocodbFile(component, options, data) {\n _classCallCheck(this, NocodbFile);\n return _super.call(this, component, options, data);\n }\n _createClass(NocodbFile, [{\n key: \"attach\",\n value:\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n function attach(element) {\n var _this = this;\n var refs = {\n fileLinkDiv: 'multi'\n };\n this.loadRefs(element, refs);\n this.refs.fileLinkDiv.forEach(function (fileLink) {\n // 点击事件\n fileLink.addEventListener('click', function (event) {\n var currentIndex = _this.dataValue.findIndex(function (item) {\n return fileLink.href.endsWith(encodeURI(item.url));\n });\n var file = _this.dataValue[currentIndex];\n var _this$component$optio = _this.component.options,\n options = _this$component$optio === void 0 ? {} : _this$component$optio;\n try {\n options = JSON.parse(_this.parseTpl(options, {\n data: _this.rootValue\n }));\n } catch (e) {\n console.log(e);\n }\n var xhr = new XMLHttpRequest();\n xhr.open('GET', fileLink.href, true);\n //设置请求头参数的方式,如果没有可忽略此行代码\n if (options && options.headers) {\n Object.keys(options.headers).forEach(function (headerKey) {\n xhr.setRequestHeader(headerKey, options.headers[\"\".concat(headerKey)]);\n });\n }\n //设置响应类型为 blob xhr.open必须为 异步\n xhr.responseType = 'blob';\n xhr.setRequestHeader('Access-Control-Allow-Origin', '*');\n //关键部分\n xhr.onload = function (e) {\n //如果请求执行成功\n if (this.status == 200) {\n var blob = this.response;\n var a = document.createElement('a');\n // blob.type = \"application/octet-stream\";\n var url = window.URL.createObjectURL(blob);\n a.href = url;\n a.download = file.originalName || file.name;\n document.body.appendChild(a); // 火狐浏览器 必须把元素插入body中\n a.click();\n document.body.removeChild(a);\n //释放之前创建的URL对象\n window.URL.revokeObjectURL(url);\n }\n };\n xhr.send(); // 发送ajax请求\n event.returnValue = false;\n });\n });\n // Allow basic component functionality to attach like field logic and tooltips.\n return _get(_getPrototypeOf(NocodbFile.prototype), \"attach\", this).call(this, element);\n }\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.component.value;\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n });\n }\n }, {\n key: \"upload\",\n value: function upload(files) {\n var _this2 = this;\n // Only allow one upload if not multiple.\n if (!this.component.multiple) {\n if (this.statuses.length) {\n this.statuses = [];\n }\n files = Array.prototype.slice.call(files, 0, 1);\n }\n if (this.component.storage && files && files.length) {\n this.fileDropHidden = true;\n\n // files is not really an array and does not have a forEach method, so fake it.\n /* eslint-disable max-statements */\n Array.prototype.forEach.call(files, /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {\n var bmf, hash, fileName, fileUpload, fileWithSameNameUploaded, fileWithSameNameUploadedWithError, dir, fileService, storage, _this2$component$opti, options, url, groupKey, groupPermissions, fileKey, groupResourceId, processedFile, fileProcessorHandler, filePromise;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n bmf = new _browserMd5File.default();\n _context.next = 3;\n return new Promise(function (resolve, reject) {\n bmf.md5(file, function (err, md5) {\n if (err) {\n return reject(err);\n }\n return resolve(md5);\n });\n });\n case 3:\n hash = _context.sent;\n fileName = (0, _utils.uniqueName)(file.name, _this2.component.fileNameTemplate, _this2.evalContext());\n fileUpload = {\n originalName: file.name,\n name: fileName,\n size: file.size,\n status: 'info',\n message: _this2.t('Processing file. Please wait...'),\n hash: hash,\n progress: 0\n }; // Check if file with the same name is being uploaded\n fileWithSameNameUploaded = _this2.dataValue.some(function (fileStatus) {\n return fileStatus.originalName === file.name;\n });\n fileWithSameNameUploadedWithError = _this2.statuses.findIndex(function (fileStatus) {\n return fileStatus.originalName === file.name && fileStatus.status === 'error';\n });\n if (fileWithSameNameUploaded) {\n fileUpload.status = 'error';\n fileUpload.message = _this2.t('File with the same name is already uploaded');\n }\n if (fileWithSameNameUploadedWithError !== -1) {\n _this2.statuses.splice(fileWithSameNameUploadedWithError, 1);\n _this2.redraw();\n }\n\n // Check file pattern\n if (_this2.component.filePattern && !_this2.validatePattern(file, _this2.component.filePattern)) {\n fileUpload.status = 'error';\n fileUpload.message = _this2.t('File is the wrong type; it must be {{ pattern }}', {\n pattern: _this2.component.filePattern\n });\n }\n\n // Check file minimum size\n if (_this2.component.fileMinSize && !_this2.validateMinSize(file, _this2.component.fileMinSize)) {\n fileUpload.status = 'error';\n fileUpload.message = _this2.t('File is too small; it must be at least {{ size }}', {\n size: _this2.component.fileMinSize\n });\n }\n\n // Check file maximum size\n if (_this2.component.fileMaxSize && !_this2.validateMaxSize(file, _this2.component.fileMaxSize)) {\n fileUpload.status = 'error';\n fileUpload.message = _this2.t('File is too big; it must be at most {{ size }}', {\n size: _this2.component.fileMaxSize\n });\n }\n\n // Get a unique name for this file to keep file collisions from occurring.\n dir = _this2.interpolate(_this2.component.dir || '');\n fileService = _this2.fileService;\n if (!fileService) {\n fileUpload.status = 'error';\n fileUpload.message = _this2.t('File Service not provided.');\n }\n _this2.statuses.push(fileUpload);\n _this2.redraw();\n if (!(fileUpload.status !== 'error')) {\n _context.next = 52;\n break;\n }\n if (_this2.component.privateDownload) {\n file.private = true;\n }\n storage = _this2.component.storage;\n _this2$component$opti = _this2.component.options, options = _this2$component$opti === void 0 ? {} : _this2$component$opti;\n try {\n options = JSON.parse(_this2.parseTpl(options, {\n data: _this2.rootValue\n }));\n } catch (e) {\n console.log(e);\n }\n // 解析options变量\n url = _this2.interpolate(_this2.component.url, {\n file: fileUpload\n });\n groupKey = null;\n groupPermissions = null; // Iterate through form components to find group resource if one exists\n _this2.root.everyComponent(function (element) {\n var _element$component, _element$component2;\n if ((_element$component = element.component) !== null && _element$component !== void 0 && _element$component.submissionAccess || (_element$component2 = element.component) !== null && _element$component2 !== void 0 && _element$component2.defaultPermission) {\n groupPermissions = !element.component.submissionAccess ? [{\n type: element.component.defaultPermission,\n roles: []\n }] : element.component.submissionAccess;\n groupPermissions.forEach(function (permission) {\n groupKey = ['admin', 'write', 'create'].includes(permission.type) ? element.component.key : null;\n });\n }\n });\n fileKey = _this2.component.fileKey || 'file';\n groupResourceId = groupKey ? _this2.currentForm.submission.data[groupKey]._id : null;\n processedFile = null;\n if (!_this2.root.options.fileProcessor) {\n _context.next = 49;\n break;\n }\n _context.prev = 31;\n if (_this2.refs.fileProcessingLoader) {\n _this2.refs.fileProcessingLoader.style.display = 'block';\n }\n fileProcessorHandler = (0, _fileProcessor.default)(_this2.fileService, _this2.root.options.fileProcessor);\n _context.next = 36;\n return fileProcessorHandler(file, _this2.component.properties);\n case 36:\n processedFile = _context.sent;\n _context.next = 46;\n break;\n case 39:\n _context.prev = 39;\n _context.t0 = _context[\"catch\"](31);\n fileUpload.status = 'error';\n fileUpload.message = _this2.t('File processing has been failed.');\n _this2.fileDropHidden = false;\n _this2.redraw();\n return _context.abrupt(\"return\");\n case 46:\n _context.prev = 46;\n if (_this2.refs.fileProcessingLoader) {\n _this2.refs.fileProcessingLoader.style.display = 'none';\n }\n return _context.finish(46);\n case 49:\n fileUpload.message = _this2.t('Starting upload.');\n _this2.redraw();\n filePromise = fileService.uploadFile(storage, processedFile || file, fileName, dir,\n // Progress callback\n function (evt) {\n fileUpload.status = 'progress';\n fileUpload.progress = parseInt(String(100.0 * evt.loaded / evt.total));\n delete fileUpload.message;\n _this2.redraw();\n }, url, options, fileKey, groupPermissions, groupResourceId,\n // Upload start callback\n function () {\n _this2.emit('fileUploadingStart', filePromise);\n },\n // Abort upload callback\n function (abort) {\n return _this2.abortUpload = abort;\n }).then(function (fileInfo) {\n if (fileInfo.data.length > 0) {\n fileInfo.data = fileInfo.data[0];\n }\n var index = _this2.statuses.indexOf(fileUpload);\n if (index !== -1) {\n _this2.statuses.splice(index, 1);\n }\n fileInfo.originalName = file.name;\n fileInfo.hash = fileUpload.hash;\n fileInfo.url = \"\".concat(url.split(\"/api/\")[0], \"/\").concat(fileInfo.data.signedPath);\n if (!_this2.hasValue()) {\n _this2.dataValue = [];\n }\n _this2.dataValue.push(fileInfo);\n _this2.fileDropHidden = false;\n _this2.redraw();\n _this2.triggerChange();\n _this2.emit('fileUploadingEnd', filePromise);\n }).catch(function (response) {\n fileUpload.status = 'error';\n fileUpload.message = typeof response === 'string' ? response : response.toString();\n delete fileUpload.progress;\n _this2.fileDropHidden = false;\n _this2.redraw();\n _this2.emit('fileUploadingEnd', filePromise);\n });\n case 52:\n case \"end\":\n return _context.stop();\n }\n }, _callee, null, [[31, 39, 46, 49]]);\n }));\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n }());\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _File.default.schema({\n label: 'Nocodb File',\n 'key': 'ncoodbFile',\n 'type': 'nocodbFile'\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Nocodb File',\n icon: 'file',\n weight: 100,\n group: 'advanced',\n schema: NocodbFile.schema()\n };\n }\n }]);\n return NocodbFile;\n}(_File.default);\nexports[\"default\"] = NocodbFile;\n\n//# sourceURL=webpack://Formio/./lib/components/NocodbFile/NocodbFile.js?");
899
899
 
900
900
  /***/ }),
901
901
 
@@ -961,7 +961,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
961
961
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
962
962
 
963
963
  "use strict";
964
- eval("\n\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _qrcodejs2Fix = _interopRequireDefault(__webpack_require__(/*! qrcodejs2-fix */ \"./node_modules/qrcodejs2-fix/qrcode.js\"));\nvar _QrCode = _interopRequireDefault(__webpack_require__(/*! ./QrCode.form */ \"./lib/components/QrCode/QrCode.form.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar QrCode = /*#__PURE__*/function (_FieldComponent) {\n _inherits(QrCode, _FieldComponent);\n var _super = _createSuper(QrCode);\n function QrCode(component, options, data) {\n _classCallCheck(this, QrCode);\n return _super.call(this, component, options, data);\n }\n _createClass(QrCode, [{\n key: \"render\",\n value: function render(children) {\n return _get(_getPrototypeOf(QrCode.prototype), \"render\", this).call(this, this.renderTemplate('qrCode'));\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var refs = {};\n this.loadRefs(element, refs);\n\n // Allow basic component functionality to attach like field logic and tooltips.\n return _get(_getPrototypeOf(QrCode.prototype), \"attach\", this).call(this, element);\n }\n\n /**\n * Get the value of the component from the dom elements.\n *\n * @returns {Array}\n */\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.component.value;\n }\n }, {\n key: \"get\",\n value: function get(path, obj) {\n var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : \"${\".concat(path, \"}\");\n return path.split('.').reduce(function (res, key) {\n return res[key] || fb;\n }, obj);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map, fallback) {\n var _this = this;\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n return _this.get(path, map, fallback);\n });\n }\n\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var canvas = this.element.querySelector('#qr-code-container');\n canvas.innerHTML = '';\n new _qrcodejs2Fix.default(canvas, {\n text: this.parseTpl(this.component.value, {\n data: this.rootValue\n }, null),\n width: this.component.width,\n height: this.component.width,\n colorDark: '#000000',\n colorLight: '#ffffff',\n correctLevel: _qrcodejs2Fix.default.CorrectLevel.H\n });\n return true;\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Field.default.schema.apply(_Field.default, [{\n label: 'QR Code',\n key: 'qrCode',\n type: 'qrCode'\n }].concat(extend));\n }\n }]);\n return QrCode;\n}(_Field.default);\nexports[\"default\"] = QrCode;\n_defineProperty(QrCode, \"builderInfo\", {\n title: 'QR Code',\n group: 'advanced',\n icon: 'qrcode',\n weight: 70,\n documentation: 'http://help.form.io/userguide/#table',\n schema: QrCode.schema()\n});\nQrCode.editForm = _QrCode.default;\n\n//# sourceURL=webpack://Formio/./lib/components/QrCode/QrCode.js?");
964
+ eval("\n\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _qrcodejs2Fix = _interopRequireDefault(__webpack_require__(/*! qrcodejs2-fix */ \"./node_modules/qrcodejs2-fix/qrcode.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nvar _QrCode = _interopRequireDefault(__webpack_require__(/*! ./QrCode.form */ \"./lib/components/QrCode/QrCode.form.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar QrCode = /*#__PURE__*/function (_FieldComponent) {\n _inherits(QrCode, _FieldComponent);\n var _super = _createSuper(QrCode);\n function QrCode(component, options, data) {\n _classCallCheck(this, QrCode);\n return _super.call(this, component, options, data);\n }\n _createClass(QrCode, [{\n key: \"render\",\n value: function render(children) {\n return _get(_getPrototypeOf(QrCode.prototype), \"render\", this).call(this, this.renderTemplate('qrCode'));\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var refs = {};\n this.loadRefs(element, refs);\n\n // Allow basic component functionality to attach like field logic and tooltips.\n return _get(_getPrototypeOf(QrCode.prototype), \"attach\", this).call(this, element);\n }\n\n /**\n * Get the value of the component from the dom elements.\n *\n * @returns {Array}\n */\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.component.value;\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n });\n }\n\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var canvas = this.element.querySelector('#qr-code-container');\n canvas.innerHTML = '';\n new _qrcodejs2Fix.default(canvas, {\n text: this.parseTpl(this.component.value, {\n data: this.rootValue\n }),\n width: this.component.width,\n height: this.component.width,\n colorDark: '#000000',\n colorLight: '#ffffff',\n correctLevel: _qrcodejs2Fix.default.CorrectLevel.H\n });\n return true;\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Field.default.schema.apply(_Field.default, [{\n label: 'QR Code',\n key: 'qrCode',\n type: 'qrCode'\n }].concat(extend));\n }\n }]);\n return QrCode;\n}(_Field.default);\nexports[\"default\"] = QrCode;\n_defineProperty(QrCode, \"builderInfo\", {\n title: 'QR Code',\n group: 'advanced',\n icon: 'qrcode',\n weight: 70,\n documentation: 'http://help.form.io/userguide/#table',\n schema: QrCode.schema()\n});\nQrCode.editForm = _QrCode.default;\n\n//# sourceURL=webpack://Formio/./lib/components/QrCode/QrCode.js?");
965
965
 
966
966
  /***/ }),
967
967
 
@@ -994,7 +994,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
994
994
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
995
995
 
996
996
  "use strict";
997
- eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _Formio = __webpack_require__(/*! ../../Formio */ \"./lib/Formio.js\");\nvar _TextField = _interopRequireDefault(__webpack_require__(/*! ../textfield/TextField */ \"./lib/components/textfield/TextField.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar ScanInputTextField = /*#__PURE__*/function (_TextFieldComponent) {\n _inherits(ScanInputTextField, _TextFieldComponent);\n var _super = _createSuper(ScanInputTextField);\n function ScanInputTextField(component, options, data) {\n _classCallCheck(this, ScanInputTextField);\n return _super.call(this, component, options, data);\n }\n _createClass(ScanInputTextField, [{\n key: \"get\",\n value: function get(path, obj) {\n var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : \"${\".concat(path, \"}\");\n return path.split('.').reduce(function (res, key) {\n return res[key] || fb;\n }, obj);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map, fallback) {\n var _this = this;\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n return _this.get(path, map, fallback);\n });\n }\n }, {\n key: \"init\",\n value: function init() {\n _get(_getPrototypeOf(ScanInputTextField.prototype), \"init\", this).call(this);\n var self = this;\n if (self.component.defaultValueSrc === 'url' && self.component.url) {\n var _this$component = this.component,\n _this$component$optio = _this$component.options,\n options = _this$component$optio === void 0 ? '{\"headers\":{}}' : _this$component$optio,\n _this$component$body = _this$component.body,\n body = _this$component$body === void 0 ? '{}' : _this$component$body;\n var parsedOptions = {\n ignoreCache: true\n };\n var parsedBody = {};\n try {\n parsedOptions = JSON.parse(this.parseTpl(options || '{\"headers\":{}}', {\n data: this.rootValue\n }, null));\n parsedBody = JSON.parse(this.parseTpl(body || '{}', {\n data: this.rootValue\n }, null));\n } catch (e) {\n console.log(e);\n }\n // 取消请求缓存\n parsedOptions.ignoreCache = true;\n _Formio.GlobalFormio.request(this.component.url, this.component.methods, this.component.methods !== 'GET' ? parsedBody : null, null, parsedOptions).then(function (response) {\n if (!self.hasSetValue || self.getValue() === self.component.defaultValue) {\n self.setValue(response, {\n resetValue: true\n });\n }\n })\n // eslint-disable-next-line no-unused-vars\n .catch(function (e) {});\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _TextField.default.schema({\n label: 'ScanInput TextField',\n 'key': 'scanInputTextField',\n 'type': 'scanInputTextField',\n scanInput: true\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'ScanInput TextField',\n icon: 'barcode-read',\n weight: 0,\n group: 'basic',\n schema: ScanInputTextField.schema()\n };\n }\n }]);\n return ScanInputTextField;\n}(_TextField.default);\nexports[\"default\"] = ScanInputTextField;\n\n//# sourceURL=webpack://Formio/./lib/components/ScanInputTextField/ScanInputTextField.js?");
997
+ eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _Formio = __webpack_require__(/*! ../../Formio */ \"./lib/Formio.js\");\nvar _TextField = _interopRequireDefault(__webpack_require__(/*! ../textfield/TextField */ \"./lib/components/textfield/TextField.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar ScanInputTextField = /*#__PURE__*/function (_TextFieldComponent) {\n _inherits(ScanInputTextField, _TextFieldComponent);\n var _super = _createSuper(ScanInputTextField);\n function ScanInputTextField(component, options, data) {\n _classCallCheck(this, ScanInputTextField);\n return _super.call(this, component, options, data);\n }\n _createClass(ScanInputTextField, [{\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n });\n }\n }, {\n key: \"init\",\n value: function init() {\n _get(_getPrototypeOf(ScanInputTextField.prototype), \"init\", this).call(this);\n var self = this;\n if (self.component.defaultValueSrc === 'url' && self.component.url) {\n var _this$component = this.component,\n _this$component$optio = _this$component.options,\n options = _this$component$optio === void 0 ? '{\"headers\":{}}' : _this$component$optio,\n _this$component$body = _this$component.body,\n body = _this$component$body === void 0 ? '{}' : _this$component$body;\n var parsedOptions = {\n ignoreCache: true\n };\n var parsedBody = {};\n try {\n parsedOptions = JSON.parse(this.parseTpl(options || '{\"headers\":{}}', {\n data: this.rootValue\n }));\n parsedBody = JSON.parse(this.parseTpl(body || '{}', {\n data: this.rootValue\n }));\n } catch (e) {\n console.log(e);\n }\n // 取消请求缓存\n parsedOptions.ignoreCache = true;\n _Formio.GlobalFormio.request(this.component.url, this.component.methods, this.component.methods !== 'GET' ? parsedBody : null, null, parsedOptions).then(function (response) {\n if (!self.hasSetValue || self.getValue() === self.component.defaultValue) {\n self.setValue(response, {\n resetValue: true\n });\n }\n })\n // eslint-disable-next-line no-unused-vars\n .catch(function (e) {});\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _TextField.default.schema({\n label: 'ScanInput TextField',\n 'key': 'scanInputTextField',\n 'type': 'scanInputTextField',\n scanInput: true\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'ScanInput TextField',\n icon: 'barcode-read',\n weight: 0,\n group: 'basic',\n schema: ScanInputTextField.schema()\n };\n }\n }]);\n return ScanInputTextField;\n}(_TextField.default);\nexports[\"default\"] = ScanInputTextField;\n\n//# sourceURL=webpack://Formio/./lib/components/ScanInputTextField/ScanInputTextField.js?");
998
998
 
999
999
  /***/ }),
1000
1000
 
@@ -1027,7 +1027,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
1027
1027
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1028
1028
 
1029
1029
  "use strict";
1030
- eval("\n\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.promise.js */ \"./node_modules/core-js/modules/es.promise.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.async-iterator.js */ \"./node_modules/core-js/modules/es.symbol.async-iterator.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-string-tag.js */ \"./node_modules/core-js/modules/es.symbol.to-string-tag.js\");\n__webpack_require__(/*! core-js/modules/es.json.to-string-tag.js */ \"./node_modules/core-js/modules/es.json.to-string-tag.js\");\n__webpack_require__(/*! core-js/modules/es.math.to-string-tag.js */ \"./node_modules/core-js/modules/es.math.to-string-tag.js\");\n__webpack_require__(/*! core-js/modules/es.array.slice.js */ \"./node_modules/core-js/modules/es.array.slice.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.object.keys.js */ \"./node_modules/core-js/modules/es.object.keys.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.join.js */ \"./node_modules/core-js/modules/es.array.join.js\");\n__webpack_require__(/*! core-js/modules/es.array.map.js */ \"./node_modules/core-js/modules/es.array.map.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.starts-with.js */ \"./node_modules/core-js/modules/es.string.starts-with.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.url.js */ \"./node_modules/core-js/modules/web.url.js\");\n__webpack_require__(/*! core-js/modules/web.url-search-params.js */ \"./node_modules/core-js/modules/web.url-search-params.js\");\n__webpack_require__(/*! core-js/modules/es.string.search.js */ \"./node_modules/core-js/modules/es.string.search.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.array.find-index.js */ \"./node_modules/core-js/modules/es.array.find-index.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _jquery = _interopRequireDefault(__webpack_require__(/*! jquery */ \"./node_modules/jquery/dist/jquery.js\"));\n__webpack_require__(/*! peity */ \"./node_modules/peity/jquery.peity.js\");\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nvar _core = __webpack_require__(/*! @fullcalendar/core */ \"./node_modules/@fullcalendar/core/index.cjs\");\nvar _daygrid = _interopRequireDefault(__webpack_require__(/*! @fullcalendar/daygrid */ \"./node_modules/@fullcalendar/daygrid/index.cjs\"));\nvar _timegrid = _interopRequireDefault(__webpack_require__(/*! @fullcalendar/timegrid */ \"./node_modules/@fullcalendar/timegrid/index.cjs\"));\nvar _list = _interopRequireDefault(__webpack_require__(/*! @fullcalendar/list */ \"./node_modules/@fullcalendar/list/index.cjs\"));\nvar _localesAll = _interopRequireDefault(__webpack_require__(/*! @fullcalendar/core/locales-all */ \"./node_modules/@fullcalendar/core/locales-all.cjs\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, \"throw\" === methodName && delegate.iterator.return && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method) || \"return\" !== methodName && (context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a '\" + methodName + \"' method\")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\n/**\n * Here we will derive from the base component which all Form.io form components derive from.\n *\n * @param component\n * @param options\n * @param data\n * @constructor\n */\nvar TaskCalendar = /*#__PURE__*/function (_Component) {\n _inherits(TaskCalendar, _Component);\n var _super = _createSuper(TaskCalendar);\n function TaskCalendar(component, options, data) {\n var _this;\n _classCallCheck(this, TaskCalendar);\n _this = _super.call(this, component, options, data);\n _defineProperty(_assertThisInitialized(_this), \"getField\", function (url, path, callback, headers, arrayKey) {\n var xhr = new XMLHttpRequest();\n xhr.open('GET', url, true);\n xhr.responseType = 'json';\n if (headers) {\n Object.keys(headers).forEach(function (key) {\n xhr.setRequestHeader(key, headers[\"\".concat(key)]);\n });\n }\n xhr.onload = function () {\n var status = xhr.status;\n var result = xhr.response;\n result = _lodash.default.get(result, path);\n if (arrayKey && arrayKey.trim().length > 0) {\n // result是数组,需要组合数组\n result = result.map(function (item) {\n return _lodash.default.get(item, arrayKey);\n }).join(',');\n }\n var value = \"\".concat(result);\n try {\n if (!isNaN(Number(value))) {\n value = Number(value).toLocaleString();\n } else {\n value = result;\n }\n } catch (e) {\n console.log(e);\n }\n if (status === 200) {\n callback(value);\n } else {\n callback(value, status);\n }\n };\n xhr.send();\n });\n return _this;\n }\n _createClass(TaskCalendar, [{\n key: \"get\",\n value: function get(path, obj) {\n var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : \"${\".concat(path, \"}\");\n return path.split('.').reduce(function (res, key) {\n return res[key] || fb;\n }, obj);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map, fallback) {\n var _this2 = this;\n if (template && template.length > 0) {\n try {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n return _this2.get(path, map, fallback);\n });\n } catch (e) {\n console.log(e);\n }\n }\n return '{}';\n }\n }, {\n key: \"render\",\n value: function render() {\n return _get(_getPrototypeOf(TaskCalendar.prototype), \"render\", this).call(this, this.renderTemplate('qrCode'));\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this3 = this;\n var refs = {};\n this.loadRefs(element, refs);\n element.querySelector('#qr-code-container').style.width = '100%';\n setTimeout(function () {\n _this3.setValue('');\n }, 100);\n return _get(_getPrototypeOf(TaskCalendar.prototype), \"attach\", this).call(this, element);\n }\n\n /**\n * Get the value of the component from the dom elements.\n *\n * @returns {Array}\n */\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.component.field;\n }\n }, {\n key: \"readCookie\",\n value: function readCookie() {\n var cookies = document.cookie.split('; ');\n var cookieData = {};\n for (var i = 0; i < cookies.length; i++) {\n if (cookies[i]) {\n var parts = cookies[i].split('=');\n var name = decodeURIComponent(parts[0]);\n var value = decodeURIComponent(parts[1]);\n cookieData[name] = value;\n }\n }\n return cookieData;\n }\n\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n }, {\n key: \"setValue\",\n value: function () {\n var _setValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(value) {\n var self, locale, cookies, url, searchParams, params, headers, where, lastestReqTime;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n self = this;\n try {\n locale = 'en';\n cookies = self.readCookie();\n if (cookies['i18n-locale']) {\n locale = cookies['i18n-locale'];\n if (locale === 'jp') {\n locale = 'ja';\n } else if (locale === 'zh') {\n locale = 'zh-cn';\n }\n }\n if (self.component['data-source-url']) {\n url = self.parseTpl(self.component['data-source-url'], {\n data: self.rootValue\n }, null);\n if (url.startsWith('http')) {\n url = new URL(url);\n } else {\n url = new URL(url, window.location.origin);\n }\n searchParams = new URLSearchParams(url.search);\n params = {};\n headers = {};\n self.component.request['headers'].forEach(function (header) {\n headers[\"\".concat(header.key)] = self.parseTpl(header.value, {\n data: self.rootValue\n }, null);\n });\n // 搜索\n if (self.component['dataSource'] === 'url') {} else if (self.component['dataSource'] === 'noco_db') {\n if (self.component.data['noco_db_conditions']) {\n where = '';\n self.component.data['noco_db_conditions'].forEach(function (item, index) {\n if (item.value && item.value.length > 0) {\n var conditionVal = self.parseTpl(item.value, {\n data: self.rootValue\n }, null);\n if (index === 0 && item.logical_operator === '~not') {\n where += \"(\".concat(item.name, \",\").concat(item.operator, \",\").concat(conditionVal, \")\");\n } else {\n where += \"\".concat(item.logical_operator, \"(\").concat(item.name, \",\").concat(item.operator, \",\").concat(conditionVal, \")\");\n }\n }\n });\n params.where = where;\n }\n }\n Object.keys(params).forEach(function (key) {\n searchParams.set(key, params[\"\".concat(key)]);\n });\n try {\n self.loading = true;\n lastestReqTime = new Date().getTime();\n self.lastestReqTime = lastestReqTime;\n self.getField(\"\".concat(url.origin).concat(url.pathname, \"?\").concat(searchParams.toString()), self.component.request['dataPath'], function (result) {\n // 确保最后更新的数据是最新一次请求的接口数据\n if (lastestReqTime - self.lastestReqTime === 0) {\n self.items = result;\n var calendarEl = self.element.querySelector('#qr-code-container');\n var calendar = new _core.Calendar(calendarEl, {\n plugins: [_daygrid.default, _timegrid.default, _list.default],\n initialView: 'dayGridMonth',\n headerToolbar: {\n left: 'prev,next today',\n center: 'title',\n right: 'dayGridMonth,timeGridWeek,listWeek'\n },\n events: result.map(function (item) {\n return {\n id: item[\"\".concat(self.component['result_id_key'])],\n title: item[\"\".concat(self.component['result_title_key'])],\n start: new Date(item[\"\".concat(self.component['result_start_key'])]),\n end: new Date(item[\"\".concat(self.component['result_end_key'])])\n };\n }),\n eventColor: '#FC775A',\n eventClick: function eventClick(info) {\n // console.log('click event:', info.event, info.view);\n if (!self.component['operate_process_key'] || self.component['operate_process_key'].length === 0) {\n return;\n }\n var index = self.items.findIndex(function (child) {\n return child.Id == info.event.id;\n });\n var item = self.items[index];\n var processKey = self.component['operate_process_key'];\n var label = item[\"\".concat(self.component[\"result_title_key\"])] || \"\";\n var field = self.component.key;\n var key = \"modify\";\n var dataAction = Object.keys(item).map(function (key) {\n return item[\"\".concat(key)];\n });\n var columns = Object.keys(item);\n var action = {\n field: field,\n key: key,\n label: label,\n processKey: processKey,\n data: dataAction,\n columns: columns\n };\n if (self.component['operate_type'] === 'dialog') {\n window.editDataTableItemByDialog(action);\n } else if (self.component['operate_type'] === 'drawer') {\n window.editDataTableItemByDrawer(action);\n }\n },\n locales: _localesAll.default,\n locale: locale\n });\n calendar.render();\n // setTimeout(()=>{\n // calendar.updateSize();\n // },500);\n }\n }, headers);\n } catch (e) {\n console.log(e);\n }\n }\n } catch (e) {\n console.log(e);\n }\n return _context.abrupt(\"return\", true);\n case 3:\n case \"end\":\n return _context.stop();\n }\n }, _callee, this);\n }));\n function setValue(_x) {\n return _setValue.apply(this, arguments);\n }\n return setValue;\n }()\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Field.default.schema.apply(_Field.default, [{\n type: 'taskCalendar',\n label: 'Task Calendar'\n }].concat(extend));\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'TaskCalendar',\n group: 'advanced',\n icon: 'calendar-lines',\n weight: 70,\n documentation: 'http://help.form.io/userguide/#taskCalendar',\n schema: TaskCalendar.schema()\n };\n }\n }]);\n return TaskCalendar;\n}(_Field.default);\nexports[\"default\"] = TaskCalendar;\n\n//# sourceURL=webpack://Formio/./lib/components/TaskCalendar/TaskCalendar.js?");
1030
+ eval("\n\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.promise.js */ \"./node_modules/core-js/modules/es.promise.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.async-iterator.js */ \"./node_modules/core-js/modules/es.symbol.async-iterator.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-string-tag.js */ \"./node_modules/core-js/modules/es.symbol.to-string-tag.js\");\n__webpack_require__(/*! core-js/modules/es.json.to-string-tag.js */ \"./node_modules/core-js/modules/es.json.to-string-tag.js\");\n__webpack_require__(/*! core-js/modules/es.math.to-string-tag.js */ \"./node_modules/core-js/modules/es.math.to-string-tag.js\");\n__webpack_require__(/*! core-js/modules/es.array.slice.js */ \"./node_modules/core-js/modules/es.array.slice.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.object.keys.js */ \"./node_modules/core-js/modules/es.object.keys.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.join.js */ \"./node_modules/core-js/modules/es.array.join.js\");\n__webpack_require__(/*! core-js/modules/es.array.map.js */ \"./node_modules/core-js/modules/es.array.map.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.starts-with.js */ \"./node_modules/core-js/modules/es.string.starts-with.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.url.js */ \"./node_modules/core-js/modules/web.url.js\");\n__webpack_require__(/*! core-js/modules/web.url-search-params.js */ \"./node_modules/core-js/modules/web.url-search-params.js\");\n__webpack_require__(/*! core-js/modules/es.string.search.js */ \"./node_modules/core-js/modules/es.string.search.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.array.find-index.js */ \"./node_modules/core-js/modules/es.array.find-index.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _jquery = _interopRequireDefault(__webpack_require__(/*! jquery */ \"./node_modules/jquery/dist/jquery.js\"));\n__webpack_require__(/*! peity */ \"./node_modules/peity/jquery.peity.js\");\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nvar _core = __webpack_require__(/*! @fullcalendar/core */ \"./node_modules/@fullcalendar/core/index.cjs\");\nvar _daygrid = _interopRequireDefault(__webpack_require__(/*! @fullcalendar/daygrid */ \"./node_modules/@fullcalendar/daygrid/index.cjs\"));\nvar _timegrid = _interopRequireDefault(__webpack_require__(/*! @fullcalendar/timegrid */ \"./node_modules/@fullcalendar/timegrid/index.cjs\"));\nvar _list = _interopRequireDefault(__webpack_require__(/*! @fullcalendar/list */ \"./node_modules/@fullcalendar/list/index.cjs\"));\nvar _localesAll = _interopRequireDefault(__webpack_require__(/*! @fullcalendar/core/locales-all */ \"./node_modules/@fullcalendar/core/locales-all.cjs\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, \"throw\" === methodName && delegate.iterator.return && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method) || \"return\" !== methodName && (context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a '\" + methodName + \"' method\")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\n/**\n * Here we will derive from the base component which all Form.io form components derive from.\n *\n * @param component\n * @param options\n * @param data\n * @constructor\n */\nvar TaskCalendar = /*#__PURE__*/function (_Component) {\n _inherits(TaskCalendar, _Component);\n var _super = _createSuper(TaskCalendar);\n function TaskCalendar(component, options, data) {\n var _this;\n _classCallCheck(this, TaskCalendar);\n _this = _super.call(this, component, options, data);\n _defineProperty(_assertThisInitialized(_this), \"getField\", function (url, path, callback, headers, arrayKey) {\n var xhr = new XMLHttpRequest();\n xhr.open('GET', url, true);\n xhr.responseType = 'json';\n if (headers) {\n Object.keys(headers).forEach(function (key) {\n xhr.setRequestHeader(key, headers[\"\".concat(key)]);\n });\n }\n xhr.onload = function () {\n var status = xhr.status;\n var result = xhr.response;\n result = _lodash.default.get(result, path);\n if (arrayKey && arrayKey.trim().length > 0) {\n // result是数组,需要组合数组\n result = result.map(function (item) {\n return _lodash.default.get(item, arrayKey);\n }).join(',');\n }\n var value = \"\".concat(result);\n try {\n if (!isNaN(Number(value))) {\n value = Number(value).toLocaleString();\n } else {\n value = result;\n }\n } catch (e) {\n console.log(e);\n }\n if (status === 200) {\n callback(value);\n } else {\n callback(value, status);\n }\n };\n xhr.send();\n });\n return _this;\n }\n _createClass(TaskCalendar, [{\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n if (template && template.length > 0) {\n try {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n });\n } catch (e) {\n console.log(e);\n }\n }\n return '{}';\n }\n }, {\n key: \"render\",\n value: function render() {\n return _get(_getPrototypeOf(TaskCalendar.prototype), \"render\", this).call(this, this.renderTemplate('qrCode'));\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this2 = this;\n var refs = {};\n this.loadRefs(element, refs);\n element.querySelector('#qr-code-container').style.width = '100%';\n setTimeout(function () {\n _this2.setValue('');\n }, 100);\n return _get(_getPrototypeOf(TaskCalendar.prototype), \"attach\", this).call(this, element);\n }\n\n /**\n * Get the value of the component from the dom elements.\n *\n * @returns {Array}\n */\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.component.field;\n }\n }, {\n key: \"readCookie\",\n value: function readCookie() {\n var cookies = document.cookie.split('; ');\n var cookieData = {};\n for (var i = 0; i < cookies.length; i++) {\n if (cookies[i]) {\n var parts = cookies[i].split('=');\n var name = decodeURIComponent(parts[0]);\n var value = decodeURIComponent(parts[1]);\n cookieData[name] = value;\n }\n }\n return cookieData;\n }\n\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n }, {\n key: \"setValue\",\n value: function () {\n var _setValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(value) {\n var self, locale, cookies, url, searchParams, params, headers, where, lastestReqTime;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n self = this;\n try {\n locale = 'en';\n cookies = self.readCookie();\n if (cookies['i18n-locale']) {\n locale = cookies['i18n-locale'];\n if (locale === 'jp') {\n locale = 'ja';\n } else if (locale === 'zh') {\n locale = 'zh-cn';\n }\n }\n if (self.component['data-source-url']) {\n url = self.parseTpl(self.component['data-source-url'], {\n data: self.rootValue\n });\n if (url.startsWith('http')) {\n url = new URL(url);\n } else {\n url = new URL(url, window.location.origin);\n }\n searchParams = new URLSearchParams(url.search);\n params = {};\n headers = {};\n self.component.request['headers'].forEach(function (header) {\n headers[\"\".concat(header.key)] = self.parseTpl(header.value, {\n data: self.rootValue\n });\n });\n // 搜索\n if (self.component['dataSource'] === 'url') {} else if (self.component['dataSource'] === 'noco_db') {\n if (self.component.data['noco_db_conditions']) {\n where = '';\n self.component.data['noco_db_conditions'].forEach(function (item, index) {\n if (item.value && item.value.length > 0) {\n var conditionVal = self.parseTpl(item.value, {\n data: self.rootValue\n });\n if (index === 0 && item.logical_operator === '~not') {\n where += \"(\".concat(item.name, \",\").concat(item.operator, \",\").concat(conditionVal, \")\");\n } else {\n where += \"\".concat(item.logical_operator, \"(\").concat(item.name, \",\").concat(item.operator, \",\").concat(conditionVal, \")\");\n }\n }\n });\n params.where = where;\n }\n }\n Object.keys(params).forEach(function (key) {\n searchParams.set(key, params[\"\".concat(key)]);\n });\n try {\n self.loading = true;\n lastestReqTime = new Date().getTime();\n self.lastestReqTime = lastestReqTime;\n self.getField(\"\".concat(url.origin).concat(url.pathname, \"?\").concat(searchParams.toString()), self.component.request['dataPath'], function (result) {\n // 确保最后更新的数据是最新一次请求的接口数据\n if (lastestReqTime - self.lastestReqTime === 0) {\n self.items = result;\n var calendarEl = self.element.querySelector('#qr-code-container');\n var calendar = new _core.Calendar(calendarEl, {\n plugins: [_daygrid.default, _timegrid.default, _list.default],\n initialView: 'dayGridMonth',\n headerToolbar: {\n left: 'prev,next today',\n center: 'title',\n right: 'dayGridMonth,timeGridWeek,listWeek'\n },\n events: result.map(function (item) {\n return {\n id: item[\"\".concat(self.component['result_id_key'])],\n title: item[\"\".concat(self.component['result_title_key'])],\n start: new Date(item[\"\".concat(self.component['result_start_key'])]),\n end: new Date(item[\"\".concat(self.component['result_end_key'])])\n };\n }),\n eventColor: '#FC775A',\n eventClick: function eventClick(info) {\n // console.log('click event:', info.event, info.view);\n if (!self.component['operate_process_key'] || self.component['operate_process_key'].length === 0) {\n return;\n }\n var index = self.items.findIndex(function (child) {\n return child.Id == info.event.id;\n });\n var item = self.items[index];\n var processKey = self.component['operate_process_key'];\n var label = item[\"\".concat(self.component[\"result_title_key\"])] || \"\";\n var field = self.component.key;\n var key = \"modify\";\n var dataAction = Object.keys(item).map(function (key) {\n return item[\"\".concat(key)];\n });\n var columns = Object.keys(item);\n var action = {\n field: field,\n key: key,\n label: label,\n processKey: processKey,\n data: dataAction,\n columns: columns\n };\n if (self.component['operate_type'] === 'dialog') {\n window.editDataTableItemByDialog(action);\n } else if (self.component['operate_type'] === 'drawer') {\n window.editDataTableItemByDrawer(action);\n }\n },\n locales: _localesAll.default,\n locale: locale\n });\n calendar.render();\n // setTimeout(()=>{\n // calendar.updateSize();\n // },500);\n }\n }, headers);\n } catch (e) {\n console.log(e);\n }\n }\n } catch (e) {\n console.log(e);\n }\n return _context.abrupt(\"return\", true);\n case 3:\n case \"end\":\n return _context.stop();\n }\n }, _callee, this);\n }));\n function setValue(_x) {\n return _setValue.apply(this, arguments);\n }\n return setValue;\n }()\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Field.default.schema.apply(_Field.default, [{\n type: 'taskCalendar',\n label: 'Task Calendar'\n }].concat(extend));\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'TaskCalendar',\n group: 'advanced',\n icon: 'calendar-lines',\n weight: 70,\n documentation: 'http://help.form.io/userguide/#taskCalendar',\n schema: TaskCalendar.schema()\n };\n }\n }]);\n return TaskCalendar;\n}(_Field.default);\nexports[\"default\"] = TaskCalendar;\n\n//# sourceURL=webpack://Formio/./lib/components/TaskCalendar/TaskCalendar.js?");
1031
1031
 
1032
1032
  /***/ }),
1033
1033
 
@@ -1379,7 +1379,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
1379
1379
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1380
1380
 
1381
1381
  "use strict";
1382
- eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.array.includes.js */ \"./node_modules/core-js/modules/es.array.includes.js\");\n__webpack_require__(/*! core-js/modules/es.array.splice.js */ \"./node_modules/core-js/modules/es.array.splice.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.constructor.js */ \"./node_modules/core-js/modules/es.regexp.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.string.search.js */ \"./node_modules/core-js/modules/es.string.search.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.array.join.js */ \"./node_modules/core-js/modules/es.array.join.js\");\n__webpack_require__(/*! core-js/modules/es.array.map.js */ \"./node_modules/core-js/modules/es.array.map.js\");\n__webpack_require__(/*! core-js/modules/es.object.keys.js */ \"./node_modules/core-js/modules/es.object.keys.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nvar _nativePromiseOnly = _interopRequireDefault(__webpack_require__(/*! native-promise-only */ \"./node_modules/native-promise-only/lib/npo.src.js\"));\nvar _Field2 = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _Input = _interopRequireDefault(__webpack_require__(/*! ../_classes/input/Input */ \"./lib/components/_classes/input/Input.js\"));\nvar _utils = __webpack_require__(/*! ../../utils/utils */ \"./lib/utils/utils.js\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar ButtonComponent = /*#__PURE__*/function (_Field) {\n _inherits(ButtonComponent, _Field);\n var _super = _createSuper(ButtonComponent);\n function ButtonComponent(component, options, data) {\n var _this;\n _classCallCheck(this, ButtonComponent);\n _this = _super.call(this, component, options, data);\n _this.filesUploading = [];\n return _this;\n }\n _createClass(ButtonComponent, [{\n key: \"defaultSchema\",\n get: function get() {\n return ButtonComponent.schema();\n }\n }, {\n key: \"inputInfo\",\n get: function get() {\n var info = _get(_getPrototypeOf(ButtonComponent.prototype), \"elementInfo\", this).call(this);\n info.type = 'button';\n info.attr.type = ['submit', 'saveState'].includes(this.component.action) ? 'submit' : 'button';\n this.component.theme = this.component.theme || 'default';\n info.attr.class = \"btn btn-\".concat(this.component.theme);\n if (this.component.size) {\n info.attr.class += \" btn-\".concat(this.component.size);\n }\n if (this.component.block) {\n info.attr.class += ' btn-block';\n }\n if (this.component.customClass) {\n info.attr.class += \" \".concat(this.component.customClass);\n }\n info.content = this.t(this.component.label, {\n _userInput: true\n });\n return info;\n }\n }, {\n key: \"labelInfo\",\n get: function get() {\n return {\n hidden: true\n };\n }\n }, {\n key: \"loading\",\n set: function set(loading) {\n this.setLoading(this.refs.button, loading);\n }\n }, {\n key: \"skipInEmail\",\n get: function get() {\n return true;\n }\n\n // No label needed for buttons.\n }, {\n key: \"createLabel\",\n value: function createLabel() {}\n }, {\n key: \"createInput\",\n value: function createInput(container) {\n this.refs.button = _get(_getPrototypeOf(ButtonComponent.prototype), \"createInput\", this).call(this, container);\n return this.refs.button;\n }\n }, {\n key: \"emptyValue\",\n get: function get() {\n return false;\n }\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.dataValue;\n }\n }, {\n key: \"clicked\",\n get: function get() {\n return this.dataValue;\n }\n }, {\n key: \"defaultValue\",\n get: function get() {\n return false;\n }\n }, {\n key: \"className\",\n get: function get() {\n var className = _get(_getPrototypeOf(ButtonComponent.prototype), \"className\", this);\n className += ' form-group';\n return className;\n }\n }, {\n key: \"oauthConfig\",\n get: function get() {\n if (_lodash.default.has(this, 'root.form.config.oauth') && this.component.oauthProvider) {\n return this.root.form.config.oauth[this.component.oauthProvider];\n }\n // Legacy oauth location.\n if (this.component.oauth) {\n return this.component.oauth;\n }\n return false;\n }\n }, {\n key: \"render\",\n value: function render() {\n if (this.viewOnly || this.options.hideButtons) {\n this._visible = false;\n }\n return _get(_getPrototypeOf(ButtonComponent.prototype), \"render\", this).call(this, this.renderTemplate('button', {\n component: this.component,\n input: this.inputInfo\n }));\n }\n }, {\n key: \"attachButton\",\n value: function attachButton() {\n var _this2 = this;\n this.addShortcut(this.refs.button);\n var onChange = null;\n var onError = null;\n if (this.component.action === 'submit') {\n this.on('submitButton', function () {\n _this2.disabled = true;\n }, true);\n this.on('cancelSubmit', function () {\n _this2.disabled = false;\n }, true);\n this.on('submitDone', function (message) {\n var resultMessage = _lodash.default.isString(message) ? message : _this2.t('complete');\n _this2.loading = false;\n _this2.disabled = false;\n _this2.addClass(_this2.refs.button, 'btn-success submit-success');\n _this2.removeClass(_this2.refs.button, 'btn-danger submit-fail');\n _this2.addClass(_this2.refs.buttonMessageContainer, 'has-success');\n _this2.removeClass(_this2.refs.buttonMessageContainer, 'has-error');\n _this2.setContent(_this2.refs.buttonMessage, resultMessage);\n }, true);\n this.on('submitError', function (message) {\n var resultMessage = _lodash.default.isString(message) ? _this2.t(message) : _this2.t(_this2.errorMessage('submitError'));\n _this2.loading = false;\n _this2.disabled = false;\n _this2.hasError = true;\n _this2.removeClass(_this2.refs.button, 'btn-success submit-success');\n _this2.addClass(_this2.refs.button, 'btn-danger submit-fail');\n _this2.removeClass(_this2.refs.buttonMessageContainer, 'has-success');\n _this2.addClass(_this2.refs.buttonMessageContainer, 'has-error');\n _this2.setContent(_this2.refs.buttonMessage, resultMessage);\n }, true);\n this.on('fileUploadingStart', function (filePromise) {\n _this2.filesUploading.push(filePromise);\n _this2.disabled = true;\n _this2.setDisabled(_this2.refs.button, _this2.disabled);\n }, true);\n this.on('fileUploadingEnd', function (filePromise) {\n var index = _this2.filesUploading.indexOf(filePromise);\n if (index !== -1) {\n _this2.filesUploading.splice(index, 1);\n }\n _this2.disabled = _this2.shouldDisabled ? true : false;\n _this2.setDisabled(_this2.refs.button, _this2.disabled);\n }, true);\n onChange = function onChange(value, isValid) {\n _this2.removeClass(_this2.refs.button, 'btn-success submit-success');\n if (isValid) {\n _this2.removeClass(_this2.refs.button, 'btn-danger submit-fail');\n if (_this2.hasError) {\n _this2.hasError = false;\n _this2.setContent(_this2.refs.buttonMessage, '');\n _this2.removeClass(_this2.refs.buttonMessageContainer, 'has-success');\n _this2.removeClass(_this2.refs.buttonMessageContainer, 'has-error');\n }\n }\n };\n onError = function onError() {\n _this2.hasError = true;\n _this2.removeClass(_this2.refs.button, 'btn-success submit-success');\n _this2.addClass(_this2.refs.button, 'btn-danger submit-fail');\n _this2.removeClass(_this2.refs.buttonMessageContainer, 'has-success');\n _this2.addClass(_this2.refs.buttonMessageContainer, 'has-error');\n _this2.setContent(_this2.refs.buttonMessage, _this2.t(_this2.errorMessage('submitError')));\n };\n }\n if (this.component.action === 'url') {\n this.on('requestButton', function () {\n _this2.disabled = true;\n }, true);\n this.on('requestDone', function () {\n _this2.loading = false;\n _this2.disabled = false;\n }, true);\n }\n this.on('change', function (value, flags) {\n var isValid = value.isValid;\n var isSilent = flags && flags.silent;\n //check root validity only if disableOnInvalid is set and when it is not possible to make submission because of validation errors\n if (flags && flags.noValidate && (_this2.component.disableOnInvalid || _this2.hasError)) {\n isValid = flags.rootValidity || (_this2.root ? _this2.root.checkValidity(_this2.root.data, null, null, true) : true);\n flags.rootValidity = isValid;\n }\n _this2.isDisabledOnInvalid = _this2.component.disableOnInvalid && (isSilent || !isValid);\n _this2.disabled = _this2.shouldDisabled;\n _this2.setDisabled(_this2.refs.button, _this2.disabled);\n if (onChange) {\n onChange(value, isValid);\n }\n }, true);\n this.on('error', function () {\n _this2.loading = false;\n _this2.disabled = false;\n if (onError) {\n onError();\n }\n }, true);\n if (this.component.saveOnEnter) {\n this.root.addEventListener(this.root.element, 'keyup', function (event) {\n if (event.keyCode === 13) {\n _this2.onClick.call(_this2, event);\n }\n });\n }\n this.addEventListener(this.refs.button, 'click', this.onClick.bind(this));\n this.addEventListener(this.refs.buttonMessageContainer, 'click', function () {\n if (_this2.refs.buttonMessageContainer.classList.contains('has-error')) {\n if (_this2.root && _this2.root.alert) {\n _this2.scrollIntoView(_this2.root.alert);\n }\n }\n });\n this.disabled = this.shouldDisabled;\n this.setDisabled(this.refs.button, this.disabled);\n function getUrlParameter(name) {\n name = name.replace(/[[]/, '\\\\[').replace(/[\\]]/, '\\\\]');\n var regex = new RegExp(\"[\\\\?&]\".concat(name, \"=([^&#]*)\"));\n var results = regex.exec(location.search);\n if (!results) {\n return results;\n }\n return decodeURIComponent(results[1].replace(/\\+/g, ' '));\n }\n\n // If this is an OpenID Provider initiated login, perform the click event immediately\n if (this.component.action === 'oauth' && this.oauthConfig && !this.oauthConfig.error) {\n var iss = getUrlParameter('iss');\n if (iss && this.oauthConfig.authURI.indexOf(iss) === 0) {\n this.openOauth(this.oauthConfig);\n }\n }\n }\n }, {\n key: \"shouldDisabled\",\n get: function get() {\n var _this$filesUploading;\n return _get(_getPrototypeOf(ButtonComponent.prototype), \"shouldDisabled\", this) || !!((_this$filesUploading = this.filesUploading) !== null && _this$filesUploading !== void 0 && _this$filesUploading.length) || this.isDisabledOnInvalid;\n }\n }, {\n key: \"attach\",\n value: function attach(element) {\n this.loadRefs(element, {\n button: 'single',\n buttonMessageContainer: 'single',\n buttonMessage: 'single'\n });\n var superAttach = _get(_getPrototypeOf(ButtonComponent.prototype), \"attach\", this).call(this, element);\n this.attachButton();\n return superAttach;\n }\n /* eslint-enable max-statements */\n }, {\n key: \"detach\",\n value: function detach(element) {\n if (element && this.refs.button) {\n this.removeShortcut(this.refs.button);\n }\n _get(_getPrototypeOf(ButtonComponent.prototype), \"detach\", this).call(this);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n var strTmp = _lodash.default.get(map, path);\n if (strTmp === undefined) {\n strTmp = null;\n } else {\n if (_lodash.default.isArray(strTmp) || _lodash.default.isObject(strTmp)) {\n strTmp = JSON.stringify(strTmp);\n }\n }\n return strTmp;\n });\n }\n }, {\n key: \"onClick\",\n value: function onClick(event) {\n this.triggerReCaptcha();\n // Don't click if disabled or in builder mode.\n if (this.disabled || this.options.attachMode === 'builder') {\n return;\n }\n this.dataValue = true;\n if (this.component.action !== 'submit' && this.component.showValidations) {\n this.emit('checkValidity', this.data);\n }\n var params;\n switch (this.component.action) {\n case 'saveState':\n case 'submit':\n event.preventDefault();\n event.stopPropagation();\n this.loading = true;\n this.emit('submitButton', {\n state: this.component.state || 'submitted',\n component: this.component,\n instance: this\n });\n break;\n case 'event':\n this.emit(this.interpolate(this.component.event), this.data);\n this.events.emit(this.interpolate(this.component.event), this.data);\n this.emit('customEvent', {\n type: this.interpolate(this.component.event),\n component: this.component,\n data: this.data,\n event: event\n });\n break;\n case 'custom':\n {\n // Get the FormioForm at the root of this component's tree\n var form = this.getRoot();\n var flattened = {};\n var components = {};\n (0, _utils.eachComponent)(form.components, function (componentWrapper, path) {\n var component = componentWrapper.component || componentWrapper;\n flattened[path] = component;\n components[component.key] = component;\n }, true);\n this.evaluate(this.component.custom, {\n form: form,\n flattened: flattened,\n components: components\n });\n this.triggerChange();\n break;\n }\n case 'url':\n this.loading = true;\n this.emit('requestButton', {\n component: this.component,\n instance: this\n });\n this.emit('requestUrl', {\n url: this.interpolate(this.component.url),\n headers: this.component.headers\n });\n break;\n case 'reset':\n this.emit('resetForm');\n break;\n case 'delete':\n this.emit('deleteSubmission');\n break;\n case 'oauth':\n if (this.root === this) {\n console.warn('You must add the OAuth button to a form for it to function properly');\n return;\n }\n\n // Display Alert if OAuth config is missing\n if (!this.oauthConfig) {\n this.root.setAlert('danger', 'OAuth not configured. You must configure oauth for your project before it will work.');\n break;\n }\n\n // Display Alert if oAuth has an error is missing\n if (this.oauthConfig.error) {\n this.root.setAlert('danger', \"The Following Error Has Occured \".concat(this.oauthConfig.error));\n break;\n }\n this.openOauth(this.oauthConfig);\n break;\n case 'openPage':\n try {\n params = JSON.parse(this.parseTpl(this.component['page_params'], {\n data: this.rootValue\n }));\n } catch (e) {\n console.log(\"json\\u8F6C\\u6362\\u5931\\u8D25:\".concat(e));\n }\n window.openNewPage(this.component['page'], params);\n break;\n case 'bottomSheet':\n try {\n params = JSON.parse(this.parseTpl(this.component['page_params'], {\n data: this.rootValue\n }));\n } catch (e) {\n console.log(\"json\\u8F6C\\u6362\\u5931\\u8D25:\".concat(e));\n }\n window.openBottomSheet(this.component['page'], params);\n break;\n case 'newIntent':\n var elink = document.createElement('a');\n elink.style.display = 'none';\n elink.target = \"_blank\";\n elink.href = this.component[\"url\"];\n document.body.appendChild(elink);\n elink.click();\n break;\n }\n }\n }, {\n key: \"openOauth\",\n value: function openOauth(settings) {\n var _this3 = this;\n if (!this.root.formio) {\n console.warn('You must attach a Form API url to your form in order to use OAuth buttons.');\n return;\n }\n\n /*eslint-disable camelcase */\n var params = {\n response_type: 'code',\n client_id: settings.clientId,\n redirect_uri: settings.redirectURI || window.location.origin || \"\".concat(window.location.protocol, \"//\").concat(window.location.host),\n state: settings.state,\n scope: settings.scope\n };\n /*eslint-enable camelcase */\n\n // Needs for the correct redirection URI for the OpenID\n var originalRedirectUri = params.redirect_uri;\n\n // Make display optional.\n if (settings.display) {\n params.display = settings.display;\n }\n params = Object.keys(params).map(function (key) {\n return \"\".concat(key, \"=\").concat(encodeURIComponent(params[key]));\n }).join('&');\n var separator = settings.authURI.indexOf('?') !== -1 ? '&' : '?';\n var url = \"\".concat(settings.authURI).concat(separator).concat(params);\n var popup = window.open(url, settings.provider, 'width=1020,height=618');\n var interval = setInterval(function () {\n try {\n var popupHost = popup.location.host;\n var currentHost = window.location.host;\n if (popup && !popup.closed && popupHost === currentHost && popup.location.search) {\n popup.close();\n var _params = popup.location.search.substr(1).split('&').reduce(function (params, param) {\n var split = param.split('=');\n params[split[0]] = split[1];\n return params;\n }, {});\n if (_params.error) {\n alert(_params.error_description || _params.error);\n _this3.root.setAlert('danger', _params.error_description || _params.error);\n return;\n }\n // TODO: check for error response here\n if (settings.state !== _params.state) {\n _this3.root.setAlert('danger', 'OAuth state does not match. Please try logging in again.');\n return;\n }\n // Depending on where the settings came from, submit to either the submission endpoint (old) or oauth endpoint (new).\n var requestPromise = _nativePromiseOnly.default.resolve();\n if (_lodash.default.has(_this3, 'root.form.config.oauth') && _this3.root.form.config.oauth[_this3.component.oauthProvider]) {\n _params.provider = settings.provider;\n _params.redirectURI = originalRedirectUri;\n\n // Needs for the exclude oAuth Actions that not related to this button\n _params.triggeredBy = _this3.key;\n requestPromise = _this3.root.formio.makeRequest('oauth', \"\".concat(_this3.root.formio.projectUrl, \"/oauth2\"), 'POST', _params);\n } else {\n var submission = {\n data: {},\n oauth: {}\n };\n submission.oauth[settings.provider] = _params;\n submission.oauth[settings.provider].redirectURI = originalRedirectUri;\n\n // Needs for the exclude oAuth Actions that not related to this button\n submission.oauth[settings.provider].triggeredBy = _this3.key;\n requestPromise = _this3.root.formio.saveSubmission(submission);\n }\n requestPromise.then(function (result) {\n _this3.root.onSubmit(result, true);\n }).catch(function (err) {\n _this3.root.onSubmissionError(err);\n });\n }\n } catch (error) {\n if (error.name !== 'SecurityError') {\n _this3.root.setAlert('danger', error.message || error);\n }\n }\n if (!popup || popup.closed || popup.closed === undefined) {\n clearInterval(interval);\n }\n }, 100);\n }\n }, {\n key: \"focus\",\n value: function focus() {\n if (this.refs.button) {\n this.refs.button.focus();\n }\n }\n }, {\n key: \"triggerReCaptcha\",\n value: function triggerReCaptcha() {\n var _this4 = this;\n if (!this.root) {\n return;\n }\n var recaptchaComponent;\n this.root.everyComponent(function (component) {\n if (component.component.type === 'recaptcha' && component.component.eventType === 'buttonClick' && component.component.buttonKey === _this4.component.key) {\n recaptchaComponent = component;\n }\n });\n if (recaptchaComponent) {\n recaptchaComponent.verify(\"\".concat(this.component.key, \"Click\"));\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Input.default.schema.apply(_Input.default, [{\n type: 'button',\n label: 'Submit',\n key: 'submit',\n size: 'md',\n leftIcon: '',\n rightIcon: '',\n block: false,\n action: 'submit',\n persistent: false,\n disableOnInvalid: false,\n theme: 'primary',\n dataGridLabel: true\n }].concat(extend));\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Button',\n group: 'basic',\n icon: 'stop',\n documentation: '/userguide/forms/form-components#button',\n weight: 110,\n schema: ButtonComponent.schema()\n };\n }\n }]);\n return ButtonComponent;\n}(_Field2.default);\nexports[\"default\"] = ButtonComponent;\n\n//# sourceURL=webpack://Formio/./lib/components/button/Button.js?");
1382
+ eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.array.includes.js */ \"./node_modules/core-js/modules/es.array.includes.js\");\n__webpack_require__(/*! core-js/modules/es.array.splice.js */ \"./node_modules/core-js/modules/es.array.splice.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.constructor.js */ \"./node_modules/core-js/modules/es.regexp.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.string.search.js */ \"./node_modules/core-js/modules/es.string.search.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.array.join.js */ \"./node_modules/core-js/modules/es.array.join.js\");\n__webpack_require__(/*! core-js/modules/es.array.map.js */ \"./node_modules/core-js/modules/es.array.map.js\");\n__webpack_require__(/*! core-js/modules/es.object.keys.js */ \"./node_modules/core-js/modules/es.object.keys.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nvar _nativePromiseOnly = _interopRequireDefault(__webpack_require__(/*! native-promise-only */ \"./node_modules/native-promise-only/lib/npo.src.js\"));\nvar _Field2 = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _Input = _interopRequireDefault(__webpack_require__(/*! ../_classes/input/Input */ \"./lib/components/_classes/input/Input.js\"));\nvar _utils = __webpack_require__(/*! ../../utils/utils */ \"./lib/utils/utils.js\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar ButtonComponent = /*#__PURE__*/function (_Field) {\n _inherits(ButtonComponent, _Field);\n var _super = _createSuper(ButtonComponent);\n function ButtonComponent(component, options, data) {\n var _this;\n _classCallCheck(this, ButtonComponent);\n _this = _super.call(this, component, options, data);\n _this.filesUploading = [];\n return _this;\n }\n _createClass(ButtonComponent, [{\n key: \"defaultSchema\",\n get: function get() {\n return ButtonComponent.schema();\n }\n }, {\n key: \"inputInfo\",\n get: function get() {\n var info = _get(_getPrototypeOf(ButtonComponent.prototype), \"elementInfo\", this).call(this);\n info.type = 'button';\n info.attr.type = ['submit', 'saveState'].includes(this.component.action) ? 'submit' : 'button';\n this.component.theme = this.component.theme || 'default';\n info.attr.class = \"btn btn-\".concat(this.component.theme);\n if (this.component.size) {\n info.attr.class += \" btn-\".concat(this.component.size);\n }\n if (this.component.block) {\n info.attr.class += ' btn-block';\n }\n if (this.component.customClass) {\n info.attr.class += \" \".concat(this.component.customClass);\n }\n info.content = this.t(this.component.label, {\n _userInput: true\n });\n return info;\n }\n }, {\n key: \"labelInfo\",\n get: function get() {\n return {\n hidden: true\n };\n }\n }, {\n key: \"loading\",\n set: function set(loading) {\n this.setLoading(this.refs.button, loading);\n }\n }, {\n key: \"skipInEmail\",\n get: function get() {\n return true;\n }\n\n // No label needed for buttons.\n }, {\n key: \"createLabel\",\n value: function createLabel() {}\n }, {\n key: \"createInput\",\n value: function createInput(container) {\n this.refs.button = _get(_getPrototypeOf(ButtonComponent.prototype), \"createInput\", this).call(this, container);\n return this.refs.button;\n }\n }, {\n key: \"emptyValue\",\n get: function get() {\n return false;\n }\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.dataValue;\n }\n }, {\n key: \"clicked\",\n get: function get() {\n return this.dataValue;\n }\n }, {\n key: \"defaultValue\",\n get: function get() {\n return false;\n }\n }, {\n key: \"className\",\n get: function get() {\n var className = _get(_getPrototypeOf(ButtonComponent.prototype), \"className\", this);\n className += ' form-group';\n return className;\n }\n }, {\n key: \"oauthConfig\",\n get: function get() {\n if (_lodash.default.has(this, 'root.form.config.oauth') && this.component.oauthProvider) {\n return this.root.form.config.oauth[this.component.oauthProvider];\n }\n // Legacy oauth location.\n if (this.component.oauth) {\n return this.component.oauth;\n }\n return false;\n }\n }, {\n key: \"render\",\n value: function render() {\n if (this.viewOnly || this.options.hideButtons) {\n this._visible = false;\n }\n return _get(_getPrototypeOf(ButtonComponent.prototype), \"render\", this).call(this, this.renderTemplate('button', {\n component: this.component,\n input: this.inputInfo\n }));\n }\n }, {\n key: \"attachButton\",\n value: function attachButton() {\n var _this2 = this;\n this.addShortcut(this.refs.button);\n var onChange = null;\n var onError = null;\n if (this.component.action === 'submit') {\n this.on('submitButton', function () {\n _this2.disabled = true;\n }, true);\n this.on('cancelSubmit', function () {\n _this2.disabled = false;\n }, true);\n this.on('submitDone', function (message) {\n var resultMessage = _lodash.default.isString(message) ? message : _this2.t('complete');\n _this2.loading = false;\n _this2.disabled = false;\n _this2.addClass(_this2.refs.button, 'btn-success submit-success');\n _this2.removeClass(_this2.refs.button, 'btn-danger submit-fail');\n _this2.addClass(_this2.refs.buttonMessageContainer, 'has-success');\n _this2.removeClass(_this2.refs.buttonMessageContainer, 'has-error');\n _this2.setContent(_this2.refs.buttonMessage, resultMessage);\n }, true);\n this.on('submitError', function (message) {\n var resultMessage = _lodash.default.isString(message) ? _this2.t(message) : _this2.t(_this2.errorMessage('submitError'));\n _this2.loading = false;\n _this2.disabled = false;\n _this2.hasError = true;\n _this2.removeClass(_this2.refs.button, 'btn-success submit-success');\n _this2.addClass(_this2.refs.button, 'btn-danger submit-fail');\n _this2.removeClass(_this2.refs.buttonMessageContainer, 'has-success');\n _this2.addClass(_this2.refs.buttonMessageContainer, 'has-error');\n _this2.setContent(_this2.refs.buttonMessage, resultMessage);\n }, true);\n this.on('fileUploadingStart', function (filePromise) {\n _this2.filesUploading.push(filePromise);\n _this2.disabled = true;\n _this2.setDisabled(_this2.refs.button, _this2.disabled);\n }, true);\n this.on('fileUploadingEnd', function (filePromise) {\n var index = _this2.filesUploading.indexOf(filePromise);\n if (index !== -1) {\n _this2.filesUploading.splice(index, 1);\n }\n _this2.disabled = _this2.shouldDisabled ? true : false;\n _this2.setDisabled(_this2.refs.button, _this2.disabled);\n }, true);\n onChange = function onChange(value, isValid) {\n _this2.removeClass(_this2.refs.button, 'btn-success submit-success');\n if (isValid) {\n _this2.removeClass(_this2.refs.button, 'btn-danger submit-fail');\n if (_this2.hasError) {\n _this2.hasError = false;\n _this2.setContent(_this2.refs.buttonMessage, '');\n _this2.removeClass(_this2.refs.buttonMessageContainer, 'has-success');\n _this2.removeClass(_this2.refs.buttonMessageContainer, 'has-error');\n }\n }\n };\n onError = function onError() {\n _this2.hasError = true;\n _this2.removeClass(_this2.refs.button, 'btn-success submit-success');\n _this2.addClass(_this2.refs.button, 'btn-danger submit-fail');\n _this2.removeClass(_this2.refs.buttonMessageContainer, 'has-success');\n _this2.addClass(_this2.refs.buttonMessageContainer, 'has-error');\n _this2.setContent(_this2.refs.buttonMessage, _this2.t(_this2.errorMessage('submitError')));\n };\n }\n if (this.component.action === 'url') {\n this.on('requestButton', function () {\n _this2.disabled = true;\n }, true);\n this.on('requestDone', function () {\n _this2.loading = false;\n _this2.disabled = false;\n }, true);\n }\n this.on('change', function (value, flags) {\n var isValid = value.isValid;\n var isSilent = flags && flags.silent;\n //check root validity only if disableOnInvalid is set and when it is not possible to make submission because of validation errors\n if (flags && flags.noValidate && (_this2.component.disableOnInvalid || _this2.hasError)) {\n isValid = flags.rootValidity || (_this2.root ? _this2.root.checkValidity(_this2.root.data, null, null, true) : true);\n flags.rootValidity = isValid;\n }\n _this2.isDisabledOnInvalid = _this2.component.disableOnInvalid && (isSilent || !isValid);\n _this2.disabled = _this2.shouldDisabled;\n _this2.setDisabled(_this2.refs.button, _this2.disabled);\n if (onChange) {\n onChange(value, isValid);\n }\n }, true);\n this.on('error', function () {\n _this2.loading = false;\n _this2.disabled = false;\n if (onError) {\n onError();\n }\n }, true);\n if (this.component.saveOnEnter) {\n this.root.addEventListener(this.root.element, 'keyup', function (event) {\n if (event.keyCode === 13) {\n _this2.onClick.call(_this2, event);\n }\n });\n }\n this.addEventListener(this.refs.button, 'click', this.onClick.bind(this));\n this.addEventListener(this.refs.buttonMessageContainer, 'click', function () {\n if (_this2.refs.buttonMessageContainer.classList.contains('has-error')) {\n if (_this2.root && _this2.root.alert) {\n _this2.scrollIntoView(_this2.root.alert);\n }\n }\n });\n this.disabled = this.shouldDisabled;\n this.setDisabled(this.refs.button, this.disabled);\n function getUrlParameter(name) {\n name = name.replace(/[[]/, '\\\\[').replace(/[\\]]/, '\\\\]');\n var regex = new RegExp(\"[\\\\?&]\".concat(name, \"=([^&#]*)\"));\n var results = regex.exec(location.search);\n if (!results) {\n return results;\n }\n return decodeURIComponent(results[1].replace(/\\+/g, ' '));\n }\n\n // If this is an OpenID Provider initiated login, perform the click event immediately\n if (this.component.action === 'oauth' && this.oauthConfig && !this.oauthConfig.error) {\n var iss = getUrlParameter('iss');\n if (iss && this.oauthConfig.authURI.indexOf(iss) === 0) {\n this.openOauth(this.oauthConfig);\n }\n }\n }\n }, {\n key: \"shouldDisabled\",\n get: function get() {\n var _this$filesUploading;\n return _get(_getPrototypeOf(ButtonComponent.prototype), \"shouldDisabled\", this) || !!((_this$filesUploading = this.filesUploading) !== null && _this$filesUploading !== void 0 && _this$filesUploading.length) || this.isDisabledOnInvalid;\n }\n }, {\n key: \"attach\",\n value: function attach(element) {\n this.loadRefs(element, {\n button: 'single',\n buttonMessageContainer: 'single',\n buttonMessage: 'single'\n });\n var superAttach = _get(_getPrototypeOf(ButtonComponent.prototype), \"attach\", this).call(this, element);\n this.attachButton();\n return superAttach;\n }\n /* eslint-enable max-statements */\n }, {\n key: \"detach\",\n value: function detach(element) {\n if (element && this.refs.button) {\n this.removeShortcut(this.refs.button);\n }\n _get(_getPrototypeOf(ButtonComponent.prototype), \"detach\", this).call(this);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _strTmp;\n var path = match.substr(2, match.length - 3).trim();\n var strTmp = _lodash.default.get(map, path);\n if (strTmp === undefined) {\n strTmp = null;\n } else {\n if (_lodash.default.isArray(strTmp) || _lodash.default.isObject(strTmp)) {\n strTmp = JSON.stringify(strTmp);\n }\n }\n return (_strTmp = strTmp) !== null && _strTmp !== void 0 ? _strTmp : '--';\n });\n }\n }, {\n key: \"onClick\",\n value: function onClick(event) {\n this.triggerReCaptcha();\n // Don't click if disabled or in builder mode.\n if (this.disabled || this.options.attachMode === 'builder') {\n return;\n }\n this.dataValue = true;\n if (this.component.action !== 'submit' && this.component.showValidations) {\n this.emit('checkValidity', this.data);\n }\n var params;\n switch (this.component.action) {\n case 'saveState':\n case 'submit':\n event.preventDefault();\n event.stopPropagation();\n this.loading = true;\n this.emit('submitButton', {\n state: this.component.state || 'submitted',\n component: this.component,\n instance: this\n });\n break;\n case 'event':\n this.emit(this.interpolate(this.component.event), this.data);\n this.events.emit(this.interpolate(this.component.event), this.data);\n this.emit('customEvent', {\n type: this.interpolate(this.component.event),\n component: this.component,\n data: this.data,\n event: event\n });\n break;\n case 'custom':\n {\n // Get the FormioForm at the root of this component's tree\n var form = this.getRoot();\n var flattened = {};\n var components = {};\n (0, _utils.eachComponent)(form.components, function (componentWrapper, path) {\n var component = componentWrapper.component || componentWrapper;\n flattened[path] = component;\n components[component.key] = component;\n }, true);\n this.evaluate(this.component.custom, {\n form: form,\n flattened: flattened,\n components: components\n });\n this.triggerChange();\n break;\n }\n case 'url':\n this.loading = true;\n this.emit('requestButton', {\n component: this.component,\n instance: this\n });\n this.emit('requestUrl', {\n url: this.interpolate(this.component.url),\n headers: this.component.headers\n });\n break;\n case 'reset':\n this.emit('resetForm');\n break;\n case 'delete':\n this.emit('deleteSubmission');\n break;\n case 'oauth':\n if (this.root === this) {\n console.warn('You must add the OAuth button to a form for it to function properly');\n return;\n }\n\n // Display Alert if OAuth config is missing\n if (!this.oauthConfig) {\n this.root.setAlert('danger', 'OAuth not configured. You must configure oauth for your project before it will work.');\n break;\n }\n\n // Display Alert if oAuth has an error is missing\n if (this.oauthConfig.error) {\n this.root.setAlert('danger', \"The Following Error Has Occured \".concat(this.oauthConfig.error));\n break;\n }\n this.openOauth(this.oauthConfig);\n break;\n case 'openPage':\n try {\n params = JSON.parse(this.parseTpl(this.component['page_params'], {\n data: this.rootValue\n }));\n } catch (e) {\n console.log(\"json\\u8F6C\\u6362\\u5931\\u8D25:\".concat(e));\n }\n window.openNewPage(this.component['page'], params);\n break;\n case 'bottomSheet':\n try {\n params = JSON.parse(this.parseTpl(this.component['page_params'], {\n data: this.rootValue\n }));\n } catch (e) {\n console.log(\"json\\u8F6C\\u6362\\u5931\\u8D25:\".concat(e));\n }\n window.openBottomSheet(this.component['page'], params);\n break;\n case 'newIntent':\n var elink = document.createElement('a');\n elink.style.display = 'none';\n elink.target = \"_blank\";\n elink.href = this.component[\"url\"];\n document.body.appendChild(elink);\n elink.click();\n break;\n }\n }\n }, {\n key: \"openOauth\",\n value: function openOauth(settings) {\n var _this3 = this;\n if (!this.root.formio) {\n console.warn('You must attach a Form API url to your form in order to use OAuth buttons.');\n return;\n }\n\n /*eslint-disable camelcase */\n var params = {\n response_type: 'code',\n client_id: settings.clientId,\n redirect_uri: settings.redirectURI || window.location.origin || \"\".concat(window.location.protocol, \"//\").concat(window.location.host),\n state: settings.state,\n scope: settings.scope\n };\n /*eslint-enable camelcase */\n\n // Needs for the correct redirection URI for the OpenID\n var originalRedirectUri = params.redirect_uri;\n\n // Make display optional.\n if (settings.display) {\n params.display = settings.display;\n }\n params = Object.keys(params).map(function (key) {\n return \"\".concat(key, \"=\").concat(encodeURIComponent(params[key]));\n }).join('&');\n var separator = settings.authURI.indexOf('?') !== -1 ? '&' : '?';\n var url = \"\".concat(settings.authURI).concat(separator).concat(params);\n var popup = window.open(url, settings.provider, 'width=1020,height=618');\n var interval = setInterval(function () {\n try {\n var popupHost = popup.location.host;\n var currentHost = window.location.host;\n if (popup && !popup.closed && popupHost === currentHost && popup.location.search) {\n popup.close();\n var _params = popup.location.search.substr(1).split('&').reduce(function (params, param) {\n var split = param.split('=');\n params[split[0]] = split[1];\n return params;\n }, {});\n if (_params.error) {\n alert(_params.error_description || _params.error);\n _this3.root.setAlert('danger', _params.error_description || _params.error);\n return;\n }\n // TODO: check for error response here\n if (settings.state !== _params.state) {\n _this3.root.setAlert('danger', 'OAuth state does not match. Please try logging in again.');\n return;\n }\n // Depending on where the settings came from, submit to either the submission endpoint (old) or oauth endpoint (new).\n var requestPromise = _nativePromiseOnly.default.resolve();\n if (_lodash.default.has(_this3, 'root.form.config.oauth') && _this3.root.form.config.oauth[_this3.component.oauthProvider]) {\n _params.provider = settings.provider;\n _params.redirectURI = originalRedirectUri;\n\n // Needs for the exclude oAuth Actions that not related to this button\n _params.triggeredBy = _this3.key;\n requestPromise = _this3.root.formio.makeRequest('oauth', \"\".concat(_this3.root.formio.projectUrl, \"/oauth2\"), 'POST', _params);\n } else {\n var submission = {\n data: {},\n oauth: {}\n };\n submission.oauth[settings.provider] = _params;\n submission.oauth[settings.provider].redirectURI = originalRedirectUri;\n\n // Needs for the exclude oAuth Actions that not related to this button\n submission.oauth[settings.provider].triggeredBy = _this3.key;\n requestPromise = _this3.root.formio.saveSubmission(submission);\n }\n requestPromise.then(function (result) {\n _this3.root.onSubmit(result, true);\n }).catch(function (err) {\n _this3.root.onSubmissionError(err);\n });\n }\n } catch (error) {\n if (error.name !== 'SecurityError') {\n _this3.root.setAlert('danger', error.message || error);\n }\n }\n if (!popup || popup.closed || popup.closed === undefined) {\n clearInterval(interval);\n }\n }, 100);\n }\n }, {\n key: \"focus\",\n value: function focus() {\n if (this.refs.button) {\n this.refs.button.focus();\n }\n }\n }, {\n key: \"triggerReCaptcha\",\n value: function triggerReCaptcha() {\n var _this4 = this;\n if (!this.root) {\n return;\n }\n var recaptchaComponent;\n this.root.everyComponent(function (component) {\n if (component.component.type === 'recaptcha' && component.component.eventType === 'buttonClick' && component.component.buttonKey === _this4.component.key) {\n recaptchaComponent = component;\n }\n });\n if (recaptchaComponent) {\n recaptchaComponent.verify(\"\".concat(this.component.key, \"Click\"));\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Input.default.schema.apply(_Input.default, [{\n type: 'button',\n label: 'Submit',\n key: 'submit',\n size: 'md',\n leftIcon: '',\n rightIcon: '',\n block: false,\n action: 'submit',\n persistent: false,\n disableOnInvalid: false,\n theme: 'primary',\n dataGridLabel: true\n }].concat(extend));\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Button',\n group: 'basic',\n icon: 'stop',\n documentation: '/userguide/forms/form-components#button',\n weight: 110,\n schema: ButtonComponent.schema()\n };\n }\n }]);\n return ButtonComponent;\n}(_Field2.default);\nexports[\"default\"] = ButtonComponent;\n\n//# sourceURL=webpack://Formio/./lib/components/button/Button.js?");
1383
1383
 
1384
1384
  /***/ }),
1385
1385
 
@@ -1896,7 +1896,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
1896
1896
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1897
1897
 
1898
1898
  "use strict";
1899
- eval("\n\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.weak-map.js */ \"./node_modules/core-js/modules/es.weak-map.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nvar echarts = _interopRequireWildcard(__webpack_require__(/*! echarts */ \"./node_modules/echarts/dist/echarts.js\"));\nfunction _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== \"function\") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }\nfunction _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== \"object\" && typeof obj !== \"function\") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== \"default\" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar ECharts = /*#__PURE__*/function (_FieldComponent) {\n _inherits(ECharts, _FieldComponent);\n var _super = _createSuper(ECharts);\n function ECharts(component, options, data) {\n _classCallCheck(this, ECharts);\n return _super.call(this, component, options, data);\n }\n _createClass(ECharts, [{\n key: \"render\",\n value: function render(children) {\n return _get(_getPrototypeOf(ECharts.prototype), \"render\", this).call(this, this.renderTemplate('echarts'));\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this = this;\n var refs = {};\n this.loadRefs(element, refs);\n setTimeout(function () {\n _this.setValue();\n }, 100);\n return _get(_getPrototypeOf(ECharts.prototype), \"attach\", this).call(this, element);\n }\n\n /**\n * Get the value of the component from the dom elements.\n *\n * @returns {Array}\n */\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.component.value;\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n var strTmp = _lodash.default.get(map, path);\n if (strTmp === undefined) {\n strTmp = null;\n } else {\n if (_lodash.default.isArray(strTmp) || _lodash.default.isObject(strTmp)) {\n strTmp = JSON.stringify(strTmp);\n }\n }\n return strTmp;\n });\n }\n\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var canvas = this.element.querySelector('#echarts-container');\n var chartInstance = echarts.getInstanceByDom(canvas);\n if (!chartInstance) {\n // 初始化 ECharts 实例\n chartInstance = echarts.init(canvas);\n }\n var optionsStr = this.component['option-value'];\n optionsStr = this.parseTpl(optionsStr, {\n data: this.rootValue\n });\n // 使用配置项渲染图表\n chartInstance.setOption(JSON.parse(optionsStr), true);\n return true;\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Field.default.schema.apply(_Field.default, [{\n label: 'ECharts',\n key: 'echarts',\n type: 'echarts'\n }].concat(extend));\n }\n }]);\n return ECharts;\n}(_Field.default);\nexports[\"default\"] = ECharts;\n_defineProperty(ECharts, \"builderInfo\", {\n title: 'ECharts',\n group: 'advanced',\n icon: 'chart-line',\n weight: 70,\n documentation: 'http://help.form.io/userguide/#echarts',\n schema: ECharts.schema()\n});\n\n//# sourceURL=webpack://Formio/./lib/components/echarts/ECharts.js?");
1899
+ eval("\n\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.weak-map.js */ \"./node_modules/core-js/modules/es.weak-map.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nvar echarts = _interopRequireWildcard(__webpack_require__(/*! echarts */ \"./node_modules/echarts/dist/echarts.js\"));\nfunction _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== \"function\") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }\nfunction _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== \"object\" && typeof obj !== \"function\") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== \"default\" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar ECharts = /*#__PURE__*/function (_FieldComponent) {\n _inherits(ECharts, _FieldComponent);\n var _super = _createSuper(ECharts);\n function ECharts(component, options, data) {\n _classCallCheck(this, ECharts);\n return _super.call(this, component, options, data);\n }\n _createClass(ECharts, [{\n key: \"render\",\n value: function render(children) {\n return _get(_getPrototypeOf(ECharts.prototype), \"render\", this).call(this, this.renderTemplate('echarts'));\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this = this;\n var refs = {};\n this.loadRefs(element, refs);\n setTimeout(function () {\n _this.setValue();\n }, 100);\n return _get(_getPrototypeOf(ECharts.prototype), \"attach\", this).call(this, element);\n }\n\n /**\n * Get the value of the component from the dom elements.\n *\n * @returns {Array}\n */\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.component.value;\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n var strTmp = (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n if (strTmp === undefined) {\n strTmp = null;\n } else {\n if (_lodash.default.isArray(strTmp) || _lodash.default.isObject(strTmp)) {\n strTmp = JSON.stringify(strTmp);\n }\n }\n return strTmp;\n });\n }\n\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var canvas = this.element.querySelector('#echarts-container');\n var chartInstance = echarts.getInstanceByDom(canvas);\n if (!chartInstance) {\n // 初始化 ECharts 实例\n chartInstance = echarts.init(canvas);\n }\n var optionsStr = this.component['option-value'];\n optionsStr = this.parseTpl(optionsStr, {\n data: this.rootValue\n });\n // 使用配置项渲染图表\n chartInstance.setOption(JSON.parse(optionsStr), true);\n return true;\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Field.default.schema.apply(_Field.default, [{\n label: 'ECharts',\n key: 'echarts',\n type: 'echarts'\n }].concat(extend));\n }\n }]);\n return ECharts;\n}(_Field.default);\nexports[\"default\"] = ECharts;\n_defineProperty(ECharts, \"builderInfo\", {\n title: 'ECharts',\n group: 'advanced',\n icon: 'chart-line',\n weight: 70,\n documentation: 'http://help.form.io/userguide/#echarts',\n schema: ECharts.schema()\n});\n\n//# sourceURL=webpack://Formio/./lib/components/echarts/ECharts.js?");
1900
1900
 
1901
1901
  /***/ }),
1902
1902
 
@@ -2103,7 +2103,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
2103
2103
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
2104
2104
 
2105
2105
  "use strict";
2106
- eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.object.keys.js */ \"./node_modules/core-js/modules/es.object.keys.js\");\n__webpack_require__(/*! core-js/modules/es.array.filter.js */ \"./node_modules/core-js/modules/es.array.filter.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptors.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptors.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.async-iterator.js */ \"./node_modules/core-js/modules/es.symbol.async-iterator.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-string-tag.js */ \"./node_modules/core-js/modules/es.symbol.to-string-tag.js\");\n__webpack_require__(/*! core-js/modules/es.json.to-string-tag.js */ \"./node_modules/core-js/modules/es.json.to-string-tag.js\");\n__webpack_require__(/*! core-js/modules/es.math.to-string-tag.js */ \"./node_modules/core-js/modules/es.math.to-string-tag.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.uint8-array.js */ \"./node_modules/core-js/modules/es.typed-array.uint8-array.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.copy-within.js */ \"./node_modules/core-js/modules/es.typed-array.copy-within.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.every.js */ \"./node_modules/core-js/modules/es.typed-array.every.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.fill.js */ \"./node_modules/core-js/modules/es.typed-array.fill.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.filter.js */ \"./node_modules/core-js/modules/es.typed-array.filter.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.find.js */ \"./node_modules/core-js/modules/es.typed-array.find.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.find-index.js */ \"./node_modules/core-js/modules/es.typed-array.find-index.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.for-each.js */ \"./node_modules/core-js/modules/es.typed-array.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.includes.js */ \"./node_modules/core-js/modules/es.typed-array.includes.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.index-of.js */ \"./node_modules/core-js/modules/es.typed-array.index-of.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.iterator.js */ \"./node_modules/core-js/modules/es.typed-array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.join.js */ \"./node_modules/core-js/modules/es.typed-array.join.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.last-index-of.js */ \"./node_modules/core-js/modules/es.typed-array.last-index-of.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.map.js */ \"./node_modules/core-js/modules/es.typed-array.map.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.reduce.js */ \"./node_modules/core-js/modules/es.typed-array.reduce.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.reduce-right.js */ \"./node_modules/core-js/modules/es.typed-array.reduce-right.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.reverse.js */ \"./node_modules/core-js/modules/es.typed-array.reverse.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.set.js */ \"./node_modules/core-js/modules/es.typed-array.set.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.slice.js */ \"./node_modules/core-js/modules/es.typed-array.slice.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.some.js */ \"./node_modules/core-js/modules/es.typed-array.some.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.sort.js */ \"./node_modules/core-js/modules/es.typed-array.sort.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.subarray.js */ \"./node_modules/core-js/modules/es.typed-array.subarray.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.to-locale-string.js */ \"./node_modules/core-js/modules/es.typed-array.to-locale-string.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.to-string.js */ \"./node_modules/core-js/modules/es.typed-array.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.array.join.js */ \"./node_modules/core-js/modules/es.array.join.js\");\n__webpack_require__(/*! core-js/modules/es.array.map.js */ \"./node_modules/core-js/modules/es.array.map.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.includes.js */ \"./node_modules/core-js/modules/es.array.includes.js\");\n__webpack_require__(/*! core-js/modules/es.string.includes.js */ \"./node_modules/core-js/modules/es.string.includes.js\");\n__webpack_require__(/*! core-js/modules/es.array.splice.js */ \"./node_modules/core-js/modules/es.array.splice.js\");\n__webpack_require__(/*! core-js/modules/es.array.find.js */ \"./node_modules/core-js/modules/es.array.find.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.number.to-fixed.js */ \"./node_modules/core-js/modules/es.number.to-fixed.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.starts-with.js */ \"./node_modules/core-js/modules/es.string.starts-with.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.constructor.js */ \"./node_modules/core-js/modules/es.regexp.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.string.search.js */ \"./node_modules/core-js/modules/es.string.search.js\");\n__webpack_require__(/*! core-js/modules/es.array.slice.js */ \"./node_modules/core-js/modules/es.array.slice.js\");\n__webpack_require__(/*! core-js/modules/es.promise.js */ \"./node_modules/core-js/modules/es.promise.js\");\n__webpack_require__(/*! core-js/modules/esnext.string.replace-all.js */ \"./node_modules/core-js/modules/esnext.string.replace-all.js\");\n__webpack_require__(/*! core-js/modules/es.array.find-index.js */ \"./node_modules/core-js/modules/es.array.find-index.js\");\nvar _Field2 = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _utils = __webpack_require__(/*! ../../utils/utils */ \"./lib/utils/utils.js\");\nvar _downloadjs = _interopRequireDefault(__webpack_require__(/*! downloadjs */ \"./node_modules/downloadjs/download.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nvar _nativePromiseOnly = _interopRequireDefault(__webpack_require__(/*! native-promise-only */ \"./node_modules/native-promise-only/lib/npo.src.js\"));\nvar _fileProcessor = _interopRequireDefault(__webpack_require__(/*! ../../providers/processor/fileProcessor */ \"./lib/providers/processor/fileProcessor.js\"));\nvar _browserMd5File = _interopRequireDefault(__webpack_require__(/*! browser-md5-file */ \"./node_modules/browser-md5-file/dist/index.umd.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, \"throw\" === methodName && delegate.iterator.return && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method) || \"return\" !== methodName && (context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a '\" + methodName + \"' method\")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar Camera;\nvar webViewCamera = navigator.camera || Camera;\n\n// canvas.toBlob polyfill.\n\nvar htmlCanvasElement;\nif (typeof window !== 'undefined') {\n htmlCanvasElement = window.HTMLCanvasElement;\n} else if (typeof __webpack_require__.g !== 'undefined') {\n htmlCanvasElement = __webpack_require__.g.HTMLCanvasElement;\n}\nif (htmlCanvasElement && !htmlCanvasElement.prototype.toBlob) {\n Object.defineProperty(HTMLCanvasElement.prototype, 'toBlob', {\n value: function value(callback, type, quality) {\n var canvas = this;\n setTimeout(function () {\n var binStr = atob(canvas.toDataURL(type, quality).split(',')[1]),\n len = binStr.length,\n arr = new Uint8Array(len);\n for (var i = 0; i < len; i++) {\n arr[i] = binStr.charCodeAt(i);\n }\n callback(new Blob([arr], {\n type: type || 'image/png'\n }));\n });\n }\n });\n}\nvar FileComponent = /*#__PURE__*/function (_Field) {\n _inherits(FileComponent, _Field);\n var _super = _createSuper(FileComponent);\n function FileComponent() {\n _classCallCheck(this, FileComponent);\n return _super.apply(this, arguments);\n }\n _createClass(FileComponent, [{\n key: \"init\",\n value: function init() {\n _get(_getPrototypeOf(FileComponent.prototype), \"init\", this).call(this);\n webViewCamera = navigator.camera || Camera;\n var fileReaderSupported = typeof FileReader !== 'undefined';\n var formDataSupported = typeof window !== 'undefined' ? Boolean(window.FormData) : false;\n var progressSupported = typeof window !== 'undefined' && window.XMLHttpRequest ? 'upload' in new XMLHttpRequest() : false;\n this.support = {\n filereader: fileReaderSupported,\n formdata: formDataSupported,\n hasWarning: !fileReaderSupported || !formDataSupported || !progressSupported,\n progress: progressSupported\n };\n this.cameraMode = false;\n this.statuses = [];\n this.fileDropHidden = false;\n }\n }, {\n key: \"dataReady\",\n get: function get() {\n return this.filesReady || _nativePromiseOnly.default.resolve();\n }\n }, {\n key: \"defaultSchema\",\n get: function get() {\n return FileComponent.schema();\n }\n }, {\n key: \"loadImage\",\n value: function loadImage(fileInfo) {\n if (this.component.privateDownload) {\n fileInfo.private = true;\n }\n return this.fileService.downloadFile(fileInfo).then(function (result) {\n return result.url;\n });\n }\n }, {\n key: \"emptyValue\",\n get: function get() {\n return [];\n }\n }, {\n key: \"getValueAsString\",\n value: function getValueAsString(value) {\n if (_lodash.default.isArray(value)) {\n return _lodash.default.map(value, 'originalName').join(', ');\n }\n return _lodash.default.get(value, 'originalName', '');\n }\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.dataValue;\n }\n }, {\n key: \"defaultValue\",\n get: function get() {\n var value = _get(_getPrototypeOf(FileComponent.prototype), \"defaultValue\", this);\n return Array.isArray(value) ? value : [];\n }\n }, {\n key: \"hasTypes\",\n get: function get() {\n return this.component.fileTypes && Array.isArray(this.component.fileTypes) && this.component.fileTypes.length !== 0 && (this.component.fileTypes[0].label !== '' || this.component.fileTypes[0].value !== '');\n }\n }, {\n key: \"fileDropHidden\",\n get: function get() {\n return this._fileBrowseHidden;\n },\n set: function set(value) {\n if (typeof value !== 'boolean' || this.component.multiple) {\n return;\n }\n this._fileBrowseHidden = value;\n }\n }, {\n key: \"render\",\n value: function render() {\n return _get(_getPrototypeOf(FileComponent.prototype), \"render\", this).call(this, this.renderTemplate('file', {\n fileSize: this.fileSize,\n files: this.dataValue || [],\n statuses: this.statuses,\n disabled: this.disabled,\n support: this.support,\n fileDropHidden: this.fileDropHidden\n }));\n }\n }, {\n key: \"getVideoStream\",\n value: function getVideoStream(constraints) {\n return navigator.mediaDevices.getUserMedia({\n video: _objectSpread({\n width: {\n min: 640,\n ideal: 1920\n },\n height: {\n min: 360,\n ideal: 1080\n },\n aspectRatio: {\n ideal: 16 / 9\n }\n }, constraints),\n audio: false\n });\n }\n }, {\n key: \"stopVideoStream\",\n value: function stopVideoStream(videoStream) {\n videoStream.getVideoTracks().forEach(function (track) {\n return track.stop();\n });\n }\n }, {\n key: \"getFrame\",\n value: function getFrame(videoPlayer) {\n return new _nativePromiseOnly.default(function (resolve) {\n var canvas = document.createElement('canvas');\n canvas.height = videoPlayer.videoHeight;\n canvas.width = videoPlayer.videoWidth;\n var context = canvas.getContext('2d');\n context.drawImage(videoPlayer, 0, 0);\n canvas.toBlob(resolve);\n });\n }\n }, {\n key: \"startVideo\",\n value: function startVideo() {\n var _this = this;\n this.getVideoStream().then(function (stream) {\n _this.videoStream = stream;\n var videoPlayer = _this.refs.videoPlayer;\n if (!videoPlayer) {\n console.warn('Video player not found in template.');\n _this.cameraMode = false;\n _this.redraw();\n return;\n }\n videoPlayer.srcObject = stream;\n var width = parseInt(_this.component.webcamSize) || 320;\n videoPlayer.setAttribute('width', width);\n videoPlayer.play();\n }).catch(function (err) {\n console.error(err);\n _this.cameraMode = false;\n _this.redraw();\n });\n }\n }, {\n key: \"stopVideo\",\n value: function stopVideo() {\n if (this.videoStream) {\n this.stopVideoStream(this.videoStream);\n this.videoStream = null;\n }\n }\n }, {\n key: \"takePicture\",\n value: function takePicture() {\n var _this2 = this;\n var videoPlayer = this.refs.videoPlayer;\n if (!videoPlayer) {\n console.warn('Video player not found in template.');\n this.cameraMode = false;\n this.redraw();\n return;\n }\n this.getFrame(videoPlayer).then(function (frame) {\n frame.name = \"photo-\".concat(Date.now(), \".png\");\n _this2.upload([frame]);\n _this2.cameraMode = false;\n _this2.redraw();\n });\n }\n }, {\n key: \"browseFiles\",\n value: function browseFiles() {\n var _this3 = this;\n var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return new _nativePromiseOnly.default(function (resolve) {\n var fileInput = _this3.ce('input', _objectSpread({\n type: 'file',\n style: 'height: 0; width: 0; visibility: hidden;',\n tabindex: '-1'\n }, attrs));\n document.body.appendChild(fileInput);\n fileInput.addEventListener('change', function () {\n resolve(fileInput.files);\n document.body.removeChild(fileInput);\n }, true);\n\n // There is no direct way to trigger a file dialog. To work around this, create an input of type file and trigger\n // a click event on it.\n if (typeof fileInput.trigger === 'function') {\n fileInput.trigger('click');\n } else {\n fileInput.click();\n }\n });\n }\n }, {\n key: \"cameraMode\",\n get: function get() {\n return this._cameraMode;\n },\n set: function set(value) {\n this._cameraMode = value;\n if (value) {\n this.startVideo();\n } else {\n this.stopVideo();\n }\n }\n }, {\n key: \"useWebViewCamera\",\n get: function get() {\n return this.imageUpload && webViewCamera;\n }\n }, {\n key: \"imageUpload\",\n get: function get() {\n return Boolean(this.component.image);\n }\n }, {\n key: \"browseOptions\",\n get: function get() {\n var options = {};\n if (this.component.multiple) {\n options.multiple = true;\n }\n //use \"accept\" attribute only for desktop devices because of its limited support by mobile browsers\n if (!this.isMobile.any) {\n var filePattern = this.component.filePattern.trim() || '';\n var imagesPattern = 'image/*';\n if (this.imageUpload && (!filePattern || filePattern === '*')) {\n options.accept = imagesPattern;\n } else if (this.imageUpload && !filePattern.includes(imagesPattern)) {\n options.accept = \"\".concat(imagesPattern, \",\").concat(filePattern);\n } else {\n options.accept = filePattern;\n }\n }\n return options;\n }\n }, {\n key: \"deleteFile\",\n value: function deleteFile(fileInfo) {\n var _this$component$optio = this.component.options,\n options = _this$component$optio === void 0 ? {} : _this$component$optio;\n if (fileInfo && ['url', 'indexeddb'].includes(this.component.storage)) {\n var fileService = this.fileService;\n if (fileService && typeof fileService.deleteFile === 'function') {\n fileService.deleteFile(fileInfo, options);\n } else {\n var formio = this.options.formio || this.root && this.root.formio;\n if (formio) {\n formio.makeRequest('', fileInfo.url, 'delete');\n }\n }\n }\n }\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this4 = this;\n this.loadRefs(element, {\n fileDrop: 'single',\n fileBrowse: 'single',\n galleryButton: 'single',\n cameraButton: 'single',\n takePictureButton: 'single',\n toggleCameraMode: 'single',\n videoPlayer: 'single',\n fileLink: 'multiple',\n removeLink: 'multiple',\n fileStatusRemove: 'multiple',\n fileImage: 'multiple',\n fileType: 'multiple',\n fileProcessingLoader: 'single'\n });\n // Ensure we have an empty input refs. We need this for the setValue method to redraw the control when it is set.\n this.refs.input = [];\n var superAttach = _get(_getPrototypeOf(FileComponent.prototype), \"attach\", this).call(this, element);\n if (this.refs.fileDrop) {\n if (!this.statuses.length) {\n this.refs.fileDrop.removeAttribute('hidden');\n }\n var _element = this;\n this.addEventListener(this.refs.fileDrop, 'dragover', function (event) {\n this.className = 'fileSelector fileDragOver';\n event.preventDefault();\n });\n this.addEventListener(this.refs.fileDrop, 'dragleave', function (event) {\n this.className = 'fileSelector';\n event.preventDefault();\n });\n this.addEventListener(this.refs.fileDrop, 'drop', function (event) {\n this.className = 'fileSelector';\n event.preventDefault();\n _element.upload(event.dataTransfer.files);\n });\n }\n if (this.refs.fileBrowse) {\n this.addEventListener(this.refs.fileBrowse, 'click', function (event) {\n event.preventDefault();\n _this4.browseFiles(_this4.browseOptions).then(function (files) {\n _this4.upload(files);\n });\n });\n }\n this.refs.fileLink.forEach(function (fileLink, index) {\n _this4.addEventListener(fileLink, 'click', function (event) {\n event.preventDefault();\n _this4.getFile(_this4.dataValue[index]);\n });\n });\n this.refs.removeLink.forEach(function (removeLink, index) {\n _this4.addEventListener(removeLink, 'click', function (event) {\n var fileInfo = _this4.dataValue[index];\n _this4.deleteFile(fileInfo);\n event.preventDefault();\n _this4.splice(index);\n _this4.redraw();\n });\n });\n this.refs.fileStatusRemove.forEach(function (fileStatusRemove, index) {\n _this4.addEventListener(fileStatusRemove, 'click', function (event) {\n event.preventDefault();\n if (_this4.abortUpload) {\n _this4.abortUpload();\n }\n _this4.statuses.splice(index, 1);\n _this4.redraw();\n });\n });\n if (this.refs.galleryButton && webViewCamera) {\n this.addEventListener(this.refs.galleryButton, 'click', function (event) {\n event.preventDefault();\n webViewCamera.getPicture(function (success) {\n window.resolveLocalFileSystemURL(success, function (fileEntry) {\n fileEntry.file(function (file) {\n var reader = new FileReader();\n reader.onloadend = function (evt) {\n var blob = new Blob([new Uint8Array(evt.target.result)], {\n type: file.type\n });\n blob.name = file.name;\n _this4.upload([blob]);\n };\n reader.readAsArrayBuffer(file);\n });\n });\n }, function (err) {\n console.error(err);\n }, {\n sourceType: webViewCamera.PictureSourceType.PHOTOLIBRARY\n });\n });\n }\n if (this.refs.cameraButton && webViewCamera) {\n this.addEventListener(this.refs.cameraButton, 'click', function (event) {\n event.preventDefault();\n webViewCamera.getPicture(function (success) {\n window.resolveLocalFileSystemURL(success, function (fileEntry) {\n fileEntry.file(function (file) {\n var reader = new FileReader();\n reader.onloadend = function (evt) {\n var blob = new Blob([new Uint8Array(evt.target.result)], {\n type: file.type\n });\n blob.name = file.name;\n _this4.upload([blob]);\n };\n reader.readAsArrayBuffer(file);\n });\n });\n }, function (err) {\n console.error(err);\n }, {\n sourceType: webViewCamera.PictureSourceType.CAMERA,\n encodingType: webViewCamera.EncodingType.PNG,\n mediaType: webViewCamera.MediaType.PICTURE,\n saveToPhotoAlbum: true,\n correctOrientation: false\n });\n });\n }\n if (this.refs.takePictureButton) {\n this.addEventListener(this.refs.takePictureButton, 'click', function (event) {\n event.preventDefault();\n _this4.takePicture();\n });\n }\n if (this.refs.toggleCameraMode) {\n this.addEventListener(this.refs.toggleCameraMode, 'click', function (event) {\n event.preventDefault();\n _this4.cameraMode = !_this4.cameraMode;\n _this4.redraw();\n });\n }\n this.refs.fileType.forEach(function (fileType, index) {\n _this4.dataValue[index].fileType = _this4.dataValue[index].fileType || _this4.component.fileTypes[0].label;\n _this4.addEventListener(fileType, 'change', function (event) {\n event.preventDefault();\n var fileType = _this4.component.fileTypes.find(function (typeObj) {\n return typeObj.value === event.target.value;\n });\n _this4.dataValue[index].fileType = fileType.label;\n });\n });\n var fileService = this.fileService;\n if (fileService) {\n var loadingImages = [];\n this.filesReady = new _nativePromiseOnly.default(function (resolve, reject) {\n _this4.filesReadyResolve = resolve;\n _this4.filesReadyReject = reject;\n });\n this.refs.fileImage.forEach(function (image, index) {\n loadingImages.push(_this4.loadImage(_this4.dataValue[index]).then(function (url) {\n return image.src = url;\n }));\n });\n if (loadingImages.length) {\n _nativePromiseOnly.default.all(loadingImages).then(function () {\n _this4.filesReadyResolve();\n }).catch(function () {\n return _this4.filesReadyReject();\n });\n } else {\n this.filesReadyResolve();\n }\n }\n return superAttach;\n }\n\n /* eslint-disable max-len */\n }, {\n key: \"fileSize\",\n value: function fileSize(a, b, c, d, e) {\n return \"\".concat((b = Math, c = b.log, d = 1024, e = c(a) / c(d) | 0, a / b.pow(d, e)).toFixed(2), \" \").concat(e ? \"\".concat('kMGTPEZY'[--e], \"B\") : 'Bytes');\n }\n\n /* eslint-enable max-len */\n\n /* eslint-disable max-depth */\n }, {\n key: \"globStringToRegex\",\n value: function globStringToRegex(str) {\n str = str.replace(/\\s/g, '');\n var regexp = '',\n excludes = [];\n if (str.length > 2 && str[0] === '/' && str[str.length - 1] === '/') {\n regexp = str.substring(1, str.length - 1);\n } else {\n var split = str.split(',');\n if (split.length > 1) {\n for (var i = 0; i < split.length; i++) {\n var r = this.globStringToRegex(split[i]);\n if (r.regexp) {\n regexp += \"(\".concat(r.regexp, \")\");\n if (i < split.length - 1) {\n regexp += '|';\n }\n } else {\n excludes = excludes.concat(r.excludes);\n }\n }\n } else {\n if (str.startsWith('!')) {\n excludes.push(\"^((?!\".concat(this.globStringToRegex(str.substring(1)).regexp, \").)*$\"));\n } else {\n if (str.startsWith('.')) {\n str = \"*\".concat(str);\n }\n regexp = \"^\".concat(str.replace(new RegExp('[.\\\\\\\\+*?\\\\[\\\\^\\\\]$(){}=!<>|:\\\\-]', 'g'), '\\\\$&'), \"$\");\n regexp = regexp.replace(/\\\\\\*/g, '.*').replace(/\\\\\\?/g, '.');\n }\n }\n }\n return {\n regexp: regexp,\n excludes: excludes\n };\n }\n\n /* eslint-enable max-depth */\n }, {\n key: \"translateScalars\",\n value: function translateScalars(str) {\n if (typeof str === 'string') {\n if (str.search(/kb/i) === str.length - 2) {\n return parseFloat(str.substring(0, str.length - 2) * 1024);\n }\n if (str.search(/mb/i) === str.length - 2) {\n return parseFloat(str.substring(0, str.length - 2) * 1024 * 1024);\n }\n if (str.search(/gb/i) === str.length - 2) {\n return parseFloat(str.substring(0, str.length - 2) * 1024 * 1024 * 1024);\n }\n if (str.search(/b/i) === str.length - 1) {\n return parseFloat(str.substring(0, str.length - 1));\n }\n if (str.search(/s/i) === str.length - 1) {\n return parseFloat(str.substring(0, str.length - 1));\n }\n if (str.search(/m/i) === str.length - 1) {\n return parseFloat(str.substring(0, str.length - 1) * 60);\n }\n if (str.search(/h/i) === str.length - 1) {\n return parseFloat(str.substring(0, str.length - 1) * 3600);\n }\n }\n return str;\n }\n }, {\n key: \"validatePattern\",\n value: function validatePattern(file, val) {\n if (!val) {\n return true;\n }\n var pattern = this.globStringToRegex(val);\n var valid = true;\n if (pattern.regexp && pattern.regexp.length) {\n var regexp = new RegExp(pattern.regexp, 'i');\n valid = !_lodash.default.isNil(file.type) && regexp.test(file.type) || !_lodash.default.isNil(file.name) && regexp.test(file.name);\n }\n valid = pattern.excludes.reduce(function (result, excludePattern) {\n var exclude = new RegExp(excludePattern, 'i');\n return result && (_lodash.default.isNil(file.type) || !exclude.test(file.type)) && (_lodash.default.isNil(file.name) || !exclude.test(file.name));\n }, valid);\n return valid;\n }\n }, {\n key: \"validateMinSize\",\n value: function validateMinSize(file, val) {\n return file.size + 0.1 >= this.translateScalars(val);\n }\n }, {\n key: \"validateMaxSize\",\n value: function validateMaxSize(file, val) {\n return file.size - 0.1 <= this.translateScalars(val);\n }\n }, {\n key: \"get\",\n value: function get(path, obj) {\n var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : \"${\".concat(path, \"}\");\n return path.split('.').reduce(function (res, key) {\n return res[key] || fb;\n }, obj);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map, fallback) {\n var _this5 = this;\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n return _this5.get(path, map, fallback);\n });\n }\n }, {\n key: \"upload\",\n value: function upload(files) {\n var _this6 = this;\n // Only allow one upload if not multiple.\n if (!this.component.multiple) {\n if (this.statuses.length) {\n this.statuses = [];\n }\n files = Array.prototype.slice.call(files, 0, 1);\n }\n if (this.component.storage && files && files.length) {\n this.fileDropHidden = true;\n\n // files is not really an array and does not have a forEach method, so fake it.\n /* eslint-disable max-statements */\n Array.prototype.forEach.call(files, /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {\n var bmf, hash, fileName, escapedFileName, fileUpload, fileWithSameNameUploaded, fileWithSameNameUploadedWithError, dir, fileService, storage, _this6$component$opti, options, url, groupKey, groupPermissions, fileKey, groupResourceId, processedFile, fileProcessorHandler, filePromise;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n bmf = new _browserMd5File.default();\n _context.next = 3;\n return new Promise(function (resolve, reject) {\n bmf.md5(file, function (err, md5) {\n if (err) {\n return reject(err);\n }\n return resolve(md5);\n });\n });\n case 3:\n hash = _context.sent;\n fileName = (0, _utils.uniqueName)(file.name, _this6.component.fileNameTemplate, _this6.evalContext());\n escapedFileName = file.name ? file.name.replaceAll('<', '&lt;').replaceAll('>', '&gt;') : file.name;\n fileUpload = {\n originalName: escapedFileName,\n name: fileName,\n size: file.size,\n status: 'info',\n message: _this6.t('Processing file. Please wait...'),\n hash: hash\n }; // Check if file with the same name is being uploaded\n fileWithSameNameUploaded = _this6.dataValue.some(function (fileStatus) {\n return fileStatus.originalName === file.name;\n });\n fileWithSameNameUploadedWithError = _this6.statuses.findIndex(function (fileStatus) {\n return fileStatus.originalName === file.name && fileStatus.status === 'error';\n });\n if (fileWithSameNameUploaded) {\n fileUpload.status = 'error';\n fileUpload.message = _this6.t('File with the same name is already uploaded');\n }\n if (fileWithSameNameUploadedWithError !== -1) {\n _this6.statuses.splice(fileWithSameNameUploadedWithError, 1);\n _this6.redraw();\n }\n\n // Check file pattern\n if (_this6.component.filePattern && !_this6.validatePattern(file, _this6.component.filePattern)) {\n fileUpload.status = 'error';\n fileUpload.message = _this6.t('File is the wrong type; it must be {{ pattern }}', {\n pattern: _this6.component.filePattern\n });\n }\n\n // Check file minimum size\n if (_this6.component.fileMinSize && !_this6.validateMinSize(file, _this6.component.fileMinSize)) {\n fileUpload.status = 'error';\n fileUpload.message = _this6.t('File is too small; it must be at least {{ size }}', {\n size: _this6.component.fileMinSize\n });\n }\n\n // Check file maximum size\n if (_this6.component.fileMaxSize && !_this6.validateMaxSize(file, _this6.component.fileMaxSize)) {\n fileUpload.status = 'error';\n fileUpload.message = _this6.t('File is too big; it must be at most {{ size }}', {\n size: _this6.component.fileMaxSize\n });\n }\n\n // Get a unique name for this file to keep file collisions from occurring.\n dir = _this6.interpolate(_this6.component.dir || '');\n fileService = _this6.fileService;\n if (!fileService) {\n fileUpload.status = 'error';\n fileUpload.message = _this6.t('File Service not provided.');\n }\n _this6.statuses.push(fileUpload);\n _this6.redraw();\n if (!(fileUpload.status !== 'error')) {\n _context.next = 53;\n break;\n }\n if (_this6.component.privateDownload) {\n file.private = true;\n }\n storage = _this6.component.storage;\n _this6$component$opti = _this6.component.options, options = _this6$component$opti === void 0 ? {} : _this6$component$opti;\n try {\n options = JSON.parse(_this6.parseTpl(options, {\n data: _this6.rootValue\n }, null));\n } catch (e) {\n console.log(e);\n }\n url = _this6.interpolate(_this6.component.url, {\n file: fileUpload\n });\n groupKey = null;\n groupPermissions = null; //Iterate through form components to find group resource if one exists\n _this6.root.everyComponent(function (element) {\n var _element$component, _element$component2;\n if ((_element$component = element.component) !== null && _element$component !== void 0 && _element$component.submissionAccess || (_element$component2 = element.component) !== null && _element$component2 !== void 0 && _element$component2.defaultPermission) {\n groupPermissions = !element.component.submissionAccess ? [{\n type: element.component.defaultPermission,\n roles: []\n }] : element.component.submissionAccess;\n groupPermissions.forEach(function (permission) {\n groupKey = ['admin', 'write', 'create'].includes(permission.type) ? element.component.key : null;\n });\n }\n });\n fileKey = _this6.component.fileKey || 'file';\n groupResourceId = groupKey ? _this6.currentForm.submission.data[groupKey]._id : null;\n processedFile = null;\n if (!_this6.root.options.fileProcessor) {\n _context.next = 50;\n break;\n }\n _context.prev = 32;\n if (_this6.refs.fileProcessingLoader) {\n _this6.refs.fileProcessingLoader.style.display = 'block';\n }\n fileProcessorHandler = (0, _fileProcessor.default)(_this6.fileService, _this6.root.options.fileProcessor);\n _context.next = 37;\n return fileProcessorHandler(file, _this6.component.properties);\n case 37:\n processedFile = _context.sent;\n _context.next = 47;\n break;\n case 40:\n _context.prev = 40;\n _context.t0 = _context[\"catch\"](32);\n fileUpload.status = 'error';\n fileUpload.message = _this6.t('File processing has been failed.');\n _this6.fileDropHidden = false;\n _this6.redraw();\n return _context.abrupt(\"return\");\n case 47:\n _context.prev = 47;\n if (_this6.refs.fileProcessingLoader) {\n _this6.refs.fileProcessingLoader.style.display = 'none';\n }\n return _context.finish(47);\n case 50:\n fileUpload.message = _this6.t('Starting upload.');\n _this6.redraw();\n filePromise = fileService.uploadFile(storage, processedFile || file, fileName, dir,\n // Progress callback\n function (evt) {\n fileUpload.status = 'progress';\n fileUpload.progress = parseInt(100.0 * evt.loaded / evt.total);\n delete fileUpload.message;\n _this6.redraw();\n }, url, options, fileKey, groupPermissions, groupResourceId,\n // Upload start callback\n function () {\n _this6.emit('fileUploadingStart', filePromise);\n },\n // Abort upload callback\n function (abort) {\n return _this6.abortUpload = abort;\n }).then(function (fileInfo) {\n var index = _this6.statuses.indexOf(fileUpload);\n if (index !== -1) {\n _this6.statuses.splice(index, 1);\n }\n fileInfo.originalName = escapedFileName;\n fileInfo.hash = fileUpload.hash;\n if (!_this6.hasValue()) {\n _this6.dataValue = [];\n }\n _this6.dataValue.push(fileInfo);\n _this6.fileDropHidden = false;\n _this6.redraw();\n _this6.triggerChange();\n _this6.emit('fileUploadingEnd', filePromise);\n }).catch(function (response) {\n fileUpload.status = 'error';\n fileUpload.message = typeof response === 'string' ? response : response.toString();\n delete fileUpload.progress;\n _this6.fileDropHidden = false;\n _this6.redraw();\n _this6.emit('fileUploadingEnd', filePromise);\n });\n case 53:\n case \"end\":\n return _context.stop();\n }\n }, _callee, null, [[32, 40, 47, 50]]);\n }));\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n }());\n }\n }\n }, {\n key: \"getFile\",\n value: function getFile(fileInfo) {\n var _this$component$optio2 = this.component.options,\n options = _this$component$optio2 === void 0 ? {} : _this$component$optio2;\n var fileService = this.fileService;\n if (!fileService) {\n return alert('File Service not provided');\n }\n if (this.component.privateDownload) {\n fileInfo.private = true;\n }\n fileService.downloadFile(fileInfo, options).then(function (file) {\n if (file) {\n if (['base64', 'indexeddb'].includes(file.storage)) {\n (0, _downloadjs.default)(file.url, file.originalName || file.name, file.type);\n } else {\n window.open(file.url, '_blank');\n }\n }\n }).catch(function (response) {\n // Is alert the best way to do this?\n // User is expecting an immediate notification due to attempting to download a file.\n alert(response);\n });\n }\n }, {\n key: \"focus\",\n value: function focus() {\n if ('beforeFocus' in this.parent) {\n this.parent.beforeFocus(this);\n }\n if (this.refs.fileBrowse) {\n this.refs.fileBrowse.focus();\n }\n }\n }, {\n key: \"destroy\",\n value: function destroy() {\n this.stopVideo();\n _get(_getPrototypeOf(FileComponent.prototype), \"destroy\", this).call(this);\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Field2.default.schema.apply(_Field2.default, [{\n type: 'file',\n label: 'Upload',\n key: 'file',\n image: false,\n privateDownload: false,\n imageSize: '200',\n filePattern: '*',\n fileMinSize: '0KB',\n fileMaxSize: '1GB',\n uploadOnly: false\n }].concat(extend));\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'File',\n group: 'advanced',\n icon: 'file',\n documentation: '/userguide/forms/premium-components#file',\n weight: 100,\n schema: FileComponent.schema()\n };\n }\n }]);\n return FileComponent;\n}(_Field2.default);\nexports[\"default\"] = FileComponent;\n\n//# sourceURL=webpack://Formio/./lib/components/file/File.js?");
2106
+ eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.object.keys.js */ \"./node_modules/core-js/modules/es.object.keys.js\");\n__webpack_require__(/*! core-js/modules/es.array.filter.js */ \"./node_modules/core-js/modules/es.array.filter.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptors.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptors.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.async-iterator.js */ \"./node_modules/core-js/modules/es.symbol.async-iterator.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-string-tag.js */ \"./node_modules/core-js/modules/es.symbol.to-string-tag.js\");\n__webpack_require__(/*! core-js/modules/es.json.to-string-tag.js */ \"./node_modules/core-js/modules/es.json.to-string-tag.js\");\n__webpack_require__(/*! core-js/modules/es.math.to-string-tag.js */ \"./node_modules/core-js/modules/es.math.to-string-tag.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.uint8-array.js */ \"./node_modules/core-js/modules/es.typed-array.uint8-array.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.copy-within.js */ \"./node_modules/core-js/modules/es.typed-array.copy-within.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.every.js */ \"./node_modules/core-js/modules/es.typed-array.every.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.fill.js */ \"./node_modules/core-js/modules/es.typed-array.fill.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.filter.js */ \"./node_modules/core-js/modules/es.typed-array.filter.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.find.js */ \"./node_modules/core-js/modules/es.typed-array.find.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.find-index.js */ \"./node_modules/core-js/modules/es.typed-array.find-index.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.for-each.js */ \"./node_modules/core-js/modules/es.typed-array.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.includes.js */ \"./node_modules/core-js/modules/es.typed-array.includes.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.index-of.js */ \"./node_modules/core-js/modules/es.typed-array.index-of.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.iterator.js */ \"./node_modules/core-js/modules/es.typed-array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.join.js */ \"./node_modules/core-js/modules/es.typed-array.join.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.last-index-of.js */ \"./node_modules/core-js/modules/es.typed-array.last-index-of.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.map.js */ \"./node_modules/core-js/modules/es.typed-array.map.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.reduce.js */ \"./node_modules/core-js/modules/es.typed-array.reduce.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.reduce-right.js */ \"./node_modules/core-js/modules/es.typed-array.reduce-right.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.reverse.js */ \"./node_modules/core-js/modules/es.typed-array.reverse.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.set.js */ \"./node_modules/core-js/modules/es.typed-array.set.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.slice.js */ \"./node_modules/core-js/modules/es.typed-array.slice.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.some.js */ \"./node_modules/core-js/modules/es.typed-array.some.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.sort.js */ \"./node_modules/core-js/modules/es.typed-array.sort.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.subarray.js */ \"./node_modules/core-js/modules/es.typed-array.subarray.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.to-locale-string.js */ \"./node_modules/core-js/modules/es.typed-array.to-locale-string.js\");\n__webpack_require__(/*! core-js/modules/es.typed-array.to-string.js */ \"./node_modules/core-js/modules/es.typed-array.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.array.join.js */ \"./node_modules/core-js/modules/es.array.join.js\");\n__webpack_require__(/*! core-js/modules/es.array.map.js */ \"./node_modules/core-js/modules/es.array.map.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.includes.js */ \"./node_modules/core-js/modules/es.array.includes.js\");\n__webpack_require__(/*! core-js/modules/es.string.includes.js */ \"./node_modules/core-js/modules/es.string.includes.js\");\n__webpack_require__(/*! core-js/modules/es.array.splice.js */ \"./node_modules/core-js/modules/es.array.splice.js\");\n__webpack_require__(/*! core-js/modules/es.array.find.js */ \"./node_modules/core-js/modules/es.array.find.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.number.to-fixed.js */ \"./node_modules/core-js/modules/es.number.to-fixed.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.starts-with.js */ \"./node_modules/core-js/modules/es.string.starts-with.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.constructor.js */ \"./node_modules/core-js/modules/es.regexp.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.string.search.js */ \"./node_modules/core-js/modules/es.string.search.js\");\n__webpack_require__(/*! core-js/modules/es.array.slice.js */ \"./node_modules/core-js/modules/es.array.slice.js\");\n__webpack_require__(/*! core-js/modules/es.promise.js */ \"./node_modules/core-js/modules/es.promise.js\");\n__webpack_require__(/*! core-js/modules/esnext.string.replace-all.js */ \"./node_modules/core-js/modules/esnext.string.replace-all.js\");\n__webpack_require__(/*! core-js/modules/es.array.find-index.js */ \"./node_modules/core-js/modules/es.array.find-index.js\");\nvar _Field2 = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _utils = __webpack_require__(/*! ../../utils/utils */ \"./lib/utils/utils.js\");\nvar _downloadjs = _interopRequireDefault(__webpack_require__(/*! downloadjs */ \"./node_modules/downloadjs/download.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nvar _nativePromiseOnly = _interopRequireDefault(__webpack_require__(/*! native-promise-only */ \"./node_modules/native-promise-only/lib/npo.src.js\"));\nvar _fileProcessor = _interopRequireDefault(__webpack_require__(/*! ../../providers/processor/fileProcessor */ \"./lib/providers/processor/fileProcessor.js\"));\nvar _browserMd5File = _interopRequireDefault(__webpack_require__(/*! browser-md5-file */ \"./node_modules/browser-md5-file/dist/index.umd.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, \"throw\" === methodName && delegate.iterator.return && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method) || \"return\" !== methodName && (context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a '\" + methodName + \"' method\")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar Camera;\nvar webViewCamera = navigator.camera || Camera;\n\n// canvas.toBlob polyfill.\n\nvar htmlCanvasElement;\nif (typeof window !== 'undefined') {\n htmlCanvasElement = window.HTMLCanvasElement;\n} else if (typeof __webpack_require__.g !== 'undefined') {\n htmlCanvasElement = __webpack_require__.g.HTMLCanvasElement;\n}\nif (htmlCanvasElement && !htmlCanvasElement.prototype.toBlob) {\n Object.defineProperty(HTMLCanvasElement.prototype, 'toBlob', {\n value: function value(callback, type, quality) {\n var canvas = this;\n setTimeout(function () {\n var binStr = atob(canvas.toDataURL(type, quality).split(',')[1]),\n len = binStr.length,\n arr = new Uint8Array(len);\n for (var i = 0; i < len; i++) {\n arr[i] = binStr.charCodeAt(i);\n }\n callback(new Blob([arr], {\n type: type || 'image/png'\n }));\n });\n }\n });\n}\nvar FileComponent = /*#__PURE__*/function (_Field) {\n _inherits(FileComponent, _Field);\n var _super = _createSuper(FileComponent);\n function FileComponent() {\n _classCallCheck(this, FileComponent);\n return _super.apply(this, arguments);\n }\n _createClass(FileComponent, [{\n key: \"init\",\n value: function init() {\n _get(_getPrototypeOf(FileComponent.prototype), \"init\", this).call(this);\n webViewCamera = navigator.camera || Camera;\n var fileReaderSupported = typeof FileReader !== 'undefined';\n var formDataSupported = typeof window !== 'undefined' ? Boolean(window.FormData) : false;\n var progressSupported = typeof window !== 'undefined' && window.XMLHttpRequest ? 'upload' in new XMLHttpRequest() : false;\n this.support = {\n filereader: fileReaderSupported,\n formdata: formDataSupported,\n hasWarning: !fileReaderSupported || !formDataSupported || !progressSupported,\n progress: progressSupported\n };\n this.cameraMode = false;\n this.statuses = [];\n this.fileDropHidden = false;\n }\n }, {\n key: \"dataReady\",\n get: function get() {\n return this.filesReady || _nativePromiseOnly.default.resolve();\n }\n }, {\n key: \"defaultSchema\",\n get: function get() {\n return FileComponent.schema();\n }\n }, {\n key: \"loadImage\",\n value: function loadImage(fileInfo) {\n if (this.component.privateDownload) {\n fileInfo.private = true;\n }\n return this.fileService.downloadFile(fileInfo).then(function (result) {\n return result.url;\n });\n }\n }, {\n key: \"emptyValue\",\n get: function get() {\n return [];\n }\n }, {\n key: \"getValueAsString\",\n value: function getValueAsString(value) {\n if (_lodash.default.isArray(value)) {\n return _lodash.default.map(value, 'originalName').join(', ');\n }\n return _lodash.default.get(value, 'originalName', '');\n }\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.dataValue;\n }\n }, {\n key: \"defaultValue\",\n get: function get() {\n var value = _get(_getPrototypeOf(FileComponent.prototype), \"defaultValue\", this);\n return Array.isArray(value) ? value : [];\n }\n }, {\n key: \"hasTypes\",\n get: function get() {\n return this.component.fileTypes && Array.isArray(this.component.fileTypes) && this.component.fileTypes.length !== 0 && (this.component.fileTypes[0].label !== '' || this.component.fileTypes[0].value !== '');\n }\n }, {\n key: \"fileDropHidden\",\n get: function get() {\n return this._fileBrowseHidden;\n },\n set: function set(value) {\n if (typeof value !== 'boolean' || this.component.multiple) {\n return;\n }\n this._fileBrowseHidden = value;\n }\n }, {\n key: \"render\",\n value: function render() {\n return _get(_getPrototypeOf(FileComponent.prototype), \"render\", this).call(this, this.renderTemplate('file', {\n fileSize: this.fileSize,\n files: this.dataValue || [],\n statuses: this.statuses,\n disabled: this.disabled,\n support: this.support,\n fileDropHidden: this.fileDropHidden\n }));\n }\n }, {\n key: \"getVideoStream\",\n value: function getVideoStream(constraints) {\n return navigator.mediaDevices.getUserMedia({\n video: _objectSpread({\n width: {\n min: 640,\n ideal: 1920\n },\n height: {\n min: 360,\n ideal: 1080\n },\n aspectRatio: {\n ideal: 16 / 9\n }\n }, constraints),\n audio: false\n });\n }\n }, {\n key: \"stopVideoStream\",\n value: function stopVideoStream(videoStream) {\n videoStream.getVideoTracks().forEach(function (track) {\n return track.stop();\n });\n }\n }, {\n key: \"getFrame\",\n value: function getFrame(videoPlayer) {\n return new _nativePromiseOnly.default(function (resolve) {\n var canvas = document.createElement('canvas');\n canvas.height = videoPlayer.videoHeight;\n canvas.width = videoPlayer.videoWidth;\n var context = canvas.getContext('2d');\n context.drawImage(videoPlayer, 0, 0);\n canvas.toBlob(resolve);\n });\n }\n }, {\n key: \"startVideo\",\n value: function startVideo() {\n var _this = this;\n this.getVideoStream().then(function (stream) {\n _this.videoStream = stream;\n var videoPlayer = _this.refs.videoPlayer;\n if (!videoPlayer) {\n console.warn('Video player not found in template.');\n _this.cameraMode = false;\n _this.redraw();\n return;\n }\n videoPlayer.srcObject = stream;\n var width = parseInt(_this.component.webcamSize) || 320;\n videoPlayer.setAttribute('width', width);\n videoPlayer.play();\n }).catch(function (err) {\n console.error(err);\n _this.cameraMode = false;\n _this.redraw();\n });\n }\n }, {\n key: \"stopVideo\",\n value: function stopVideo() {\n if (this.videoStream) {\n this.stopVideoStream(this.videoStream);\n this.videoStream = null;\n }\n }\n }, {\n key: \"takePicture\",\n value: function takePicture() {\n var _this2 = this;\n var videoPlayer = this.refs.videoPlayer;\n if (!videoPlayer) {\n console.warn('Video player not found in template.');\n this.cameraMode = false;\n this.redraw();\n return;\n }\n this.getFrame(videoPlayer).then(function (frame) {\n frame.name = \"photo-\".concat(Date.now(), \".png\");\n _this2.upload([frame]);\n _this2.cameraMode = false;\n _this2.redraw();\n });\n }\n }, {\n key: \"browseFiles\",\n value: function browseFiles() {\n var _this3 = this;\n var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return new _nativePromiseOnly.default(function (resolve) {\n var fileInput = _this3.ce('input', _objectSpread({\n type: 'file',\n style: 'height: 0; width: 0; visibility: hidden;',\n tabindex: '-1'\n }, attrs));\n document.body.appendChild(fileInput);\n fileInput.addEventListener('change', function () {\n resolve(fileInput.files);\n document.body.removeChild(fileInput);\n }, true);\n\n // There is no direct way to trigger a file dialog. To work around this, create an input of type file and trigger\n // a click event on it.\n if (typeof fileInput.trigger === 'function') {\n fileInput.trigger('click');\n } else {\n fileInput.click();\n }\n });\n }\n }, {\n key: \"cameraMode\",\n get: function get() {\n return this._cameraMode;\n },\n set: function set(value) {\n this._cameraMode = value;\n if (value) {\n this.startVideo();\n } else {\n this.stopVideo();\n }\n }\n }, {\n key: \"useWebViewCamera\",\n get: function get() {\n return this.imageUpload && webViewCamera;\n }\n }, {\n key: \"imageUpload\",\n get: function get() {\n return Boolean(this.component.image);\n }\n }, {\n key: \"browseOptions\",\n get: function get() {\n var options = {};\n if (this.component.multiple) {\n options.multiple = true;\n }\n //use \"accept\" attribute only for desktop devices because of its limited support by mobile browsers\n if (!this.isMobile.any) {\n var filePattern = this.component.filePattern.trim() || '';\n var imagesPattern = 'image/*';\n if (this.imageUpload && (!filePattern || filePattern === '*')) {\n options.accept = imagesPattern;\n } else if (this.imageUpload && !filePattern.includes(imagesPattern)) {\n options.accept = \"\".concat(imagesPattern, \",\").concat(filePattern);\n } else {\n options.accept = filePattern;\n }\n }\n return options;\n }\n }, {\n key: \"deleteFile\",\n value: function deleteFile(fileInfo) {\n var _this$component$optio = this.component.options,\n options = _this$component$optio === void 0 ? {} : _this$component$optio;\n if (fileInfo && ['url', 'indexeddb'].includes(this.component.storage)) {\n var fileService = this.fileService;\n if (fileService && typeof fileService.deleteFile === 'function') {\n fileService.deleteFile(fileInfo, options);\n } else {\n var formio = this.options.formio || this.root && this.root.formio;\n if (formio) {\n formio.makeRequest('', fileInfo.url, 'delete');\n }\n }\n }\n }\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this4 = this;\n this.loadRefs(element, {\n fileDrop: 'single',\n fileBrowse: 'single',\n galleryButton: 'single',\n cameraButton: 'single',\n takePictureButton: 'single',\n toggleCameraMode: 'single',\n videoPlayer: 'single',\n fileLink: 'multiple',\n removeLink: 'multiple',\n fileStatusRemove: 'multiple',\n fileImage: 'multiple',\n fileType: 'multiple',\n fileProcessingLoader: 'single'\n });\n // Ensure we have an empty input refs. We need this for the setValue method to redraw the control when it is set.\n this.refs.input = [];\n var superAttach = _get(_getPrototypeOf(FileComponent.prototype), \"attach\", this).call(this, element);\n if (this.refs.fileDrop) {\n if (!this.statuses.length) {\n this.refs.fileDrop.removeAttribute('hidden');\n }\n var _element = this;\n this.addEventListener(this.refs.fileDrop, 'dragover', function (event) {\n this.className = 'fileSelector fileDragOver';\n event.preventDefault();\n });\n this.addEventListener(this.refs.fileDrop, 'dragleave', function (event) {\n this.className = 'fileSelector';\n event.preventDefault();\n });\n this.addEventListener(this.refs.fileDrop, 'drop', function (event) {\n this.className = 'fileSelector';\n event.preventDefault();\n _element.upload(event.dataTransfer.files);\n });\n }\n if (this.refs.fileBrowse) {\n this.addEventListener(this.refs.fileBrowse, 'click', function (event) {\n event.preventDefault();\n _this4.browseFiles(_this4.browseOptions).then(function (files) {\n _this4.upload(files);\n });\n });\n }\n this.refs.fileLink.forEach(function (fileLink, index) {\n _this4.addEventListener(fileLink, 'click', function (event) {\n event.preventDefault();\n _this4.getFile(_this4.dataValue[index]);\n });\n });\n this.refs.removeLink.forEach(function (removeLink, index) {\n _this4.addEventListener(removeLink, 'click', function (event) {\n var fileInfo = _this4.dataValue[index];\n _this4.deleteFile(fileInfo);\n event.preventDefault();\n _this4.splice(index);\n _this4.redraw();\n });\n });\n this.refs.fileStatusRemove.forEach(function (fileStatusRemove, index) {\n _this4.addEventListener(fileStatusRemove, 'click', function (event) {\n event.preventDefault();\n if (_this4.abortUpload) {\n _this4.abortUpload();\n }\n _this4.statuses.splice(index, 1);\n _this4.redraw();\n });\n });\n if (this.refs.galleryButton && webViewCamera) {\n this.addEventListener(this.refs.galleryButton, 'click', function (event) {\n event.preventDefault();\n webViewCamera.getPicture(function (success) {\n window.resolveLocalFileSystemURL(success, function (fileEntry) {\n fileEntry.file(function (file) {\n var reader = new FileReader();\n reader.onloadend = function (evt) {\n var blob = new Blob([new Uint8Array(evt.target.result)], {\n type: file.type\n });\n blob.name = file.name;\n _this4.upload([blob]);\n };\n reader.readAsArrayBuffer(file);\n });\n });\n }, function (err) {\n console.error(err);\n }, {\n sourceType: webViewCamera.PictureSourceType.PHOTOLIBRARY\n });\n });\n }\n if (this.refs.cameraButton && webViewCamera) {\n this.addEventListener(this.refs.cameraButton, 'click', function (event) {\n event.preventDefault();\n webViewCamera.getPicture(function (success) {\n window.resolveLocalFileSystemURL(success, function (fileEntry) {\n fileEntry.file(function (file) {\n var reader = new FileReader();\n reader.onloadend = function (evt) {\n var blob = new Blob([new Uint8Array(evt.target.result)], {\n type: file.type\n });\n blob.name = file.name;\n _this4.upload([blob]);\n };\n reader.readAsArrayBuffer(file);\n });\n });\n }, function (err) {\n console.error(err);\n }, {\n sourceType: webViewCamera.PictureSourceType.CAMERA,\n encodingType: webViewCamera.EncodingType.PNG,\n mediaType: webViewCamera.MediaType.PICTURE,\n saveToPhotoAlbum: true,\n correctOrientation: false\n });\n });\n }\n if (this.refs.takePictureButton) {\n this.addEventListener(this.refs.takePictureButton, 'click', function (event) {\n event.preventDefault();\n _this4.takePicture();\n });\n }\n if (this.refs.toggleCameraMode) {\n this.addEventListener(this.refs.toggleCameraMode, 'click', function (event) {\n event.preventDefault();\n _this4.cameraMode = !_this4.cameraMode;\n _this4.redraw();\n });\n }\n this.refs.fileType.forEach(function (fileType, index) {\n _this4.dataValue[index].fileType = _this4.dataValue[index].fileType || _this4.component.fileTypes[0].label;\n _this4.addEventListener(fileType, 'change', function (event) {\n event.preventDefault();\n var fileType = _this4.component.fileTypes.find(function (typeObj) {\n return typeObj.value === event.target.value;\n });\n _this4.dataValue[index].fileType = fileType.label;\n });\n });\n var fileService = this.fileService;\n if (fileService) {\n var loadingImages = [];\n this.filesReady = new _nativePromiseOnly.default(function (resolve, reject) {\n _this4.filesReadyResolve = resolve;\n _this4.filesReadyReject = reject;\n });\n this.refs.fileImage.forEach(function (image, index) {\n loadingImages.push(_this4.loadImage(_this4.dataValue[index]).then(function (url) {\n return image.src = url;\n }));\n });\n if (loadingImages.length) {\n _nativePromiseOnly.default.all(loadingImages).then(function () {\n _this4.filesReadyResolve();\n }).catch(function () {\n return _this4.filesReadyReject();\n });\n } else {\n this.filesReadyResolve();\n }\n }\n return superAttach;\n }\n\n /* eslint-disable max-len */\n }, {\n key: \"fileSize\",\n value: function fileSize(a, b, c, d, e) {\n return \"\".concat((b = Math, c = b.log, d = 1024, e = c(a) / c(d) | 0, a / b.pow(d, e)).toFixed(2), \" \").concat(e ? \"\".concat('kMGTPEZY'[--e], \"B\") : 'Bytes');\n }\n\n /* eslint-enable max-len */\n\n /* eslint-disable max-depth */\n }, {\n key: \"globStringToRegex\",\n value: function globStringToRegex(str) {\n str = str.replace(/\\s/g, '');\n var regexp = '',\n excludes = [];\n if (str.length > 2 && str[0] === '/' && str[str.length - 1] === '/') {\n regexp = str.substring(1, str.length - 1);\n } else {\n var split = str.split(',');\n if (split.length > 1) {\n for (var i = 0; i < split.length; i++) {\n var r = this.globStringToRegex(split[i]);\n if (r.regexp) {\n regexp += \"(\".concat(r.regexp, \")\");\n if (i < split.length - 1) {\n regexp += '|';\n }\n } else {\n excludes = excludes.concat(r.excludes);\n }\n }\n } else {\n if (str.startsWith('!')) {\n excludes.push(\"^((?!\".concat(this.globStringToRegex(str.substring(1)).regexp, \").)*$\"));\n } else {\n if (str.startsWith('.')) {\n str = \"*\".concat(str);\n }\n regexp = \"^\".concat(str.replace(new RegExp('[.\\\\\\\\+*?\\\\[\\\\^\\\\]$(){}=!<>|:\\\\-]', 'g'), '\\\\$&'), \"$\");\n regexp = regexp.replace(/\\\\\\*/g, '.*').replace(/\\\\\\?/g, '.');\n }\n }\n }\n return {\n regexp: regexp,\n excludes: excludes\n };\n }\n\n /* eslint-enable max-depth */\n }, {\n key: \"translateScalars\",\n value: function translateScalars(str) {\n if (typeof str === 'string') {\n if (str.search(/kb/i) === str.length - 2) {\n return parseFloat(str.substring(0, str.length - 2) * 1024);\n }\n if (str.search(/mb/i) === str.length - 2) {\n return parseFloat(str.substring(0, str.length - 2) * 1024 * 1024);\n }\n if (str.search(/gb/i) === str.length - 2) {\n return parseFloat(str.substring(0, str.length - 2) * 1024 * 1024 * 1024);\n }\n if (str.search(/b/i) === str.length - 1) {\n return parseFloat(str.substring(0, str.length - 1));\n }\n if (str.search(/s/i) === str.length - 1) {\n return parseFloat(str.substring(0, str.length - 1));\n }\n if (str.search(/m/i) === str.length - 1) {\n return parseFloat(str.substring(0, str.length - 1) * 60);\n }\n if (str.search(/h/i) === str.length - 1) {\n return parseFloat(str.substring(0, str.length - 1) * 3600);\n }\n }\n return str;\n }\n }, {\n key: \"validatePattern\",\n value: function validatePattern(file, val) {\n if (!val) {\n return true;\n }\n var pattern = this.globStringToRegex(val);\n var valid = true;\n if (pattern.regexp && pattern.regexp.length) {\n var regexp = new RegExp(pattern.regexp, 'i');\n valid = !_lodash.default.isNil(file.type) && regexp.test(file.type) || !_lodash.default.isNil(file.name) && regexp.test(file.name);\n }\n valid = pattern.excludes.reduce(function (result, excludePattern) {\n var exclude = new RegExp(excludePattern, 'i');\n return result && (_lodash.default.isNil(file.type) || !exclude.test(file.type)) && (_lodash.default.isNil(file.name) || !exclude.test(file.name));\n }, valid);\n return valid;\n }\n }, {\n key: \"validateMinSize\",\n value: function validateMinSize(file, val) {\n return file.size + 0.1 >= this.translateScalars(val);\n }\n }, {\n key: \"validateMaxSize\",\n value: function validateMaxSize(file, val) {\n return file.size - 0.1 <= this.translateScalars(val);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n });\n }\n }, {\n key: \"upload\",\n value: function upload(files) {\n var _this5 = this;\n // Only allow one upload if not multiple.\n if (!this.component.multiple) {\n if (this.statuses.length) {\n this.statuses = [];\n }\n files = Array.prototype.slice.call(files, 0, 1);\n }\n if (this.component.storage && files && files.length) {\n this.fileDropHidden = true;\n\n // files is not really an array and does not have a forEach method, so fake it.\n /* eslint-disable max-statements */\n Array.prototype.forEach.call(files, /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {\n var bmf, hash, fileName, escapedFileName, fileUpload, fileWithSameNameUploaded, fileWithSameNameUploadedWithError, dir, fileService, storage, _this5$component$opti, options, url, groupKey, groupPermissions, fileKey, groupResourceId, processedFile, fileProcessorHandler, filePromise;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n bmf = new _browserMd5File.default();\n _context.next = 3;\n return new Promise(function (resolve, reject) {\n bmf.md5(file, function (err, md5) {\n if (err) {\n return reject(err);\n }\n return resolve(md5);\n });\n });\n case 3:\n hash = _context.sent;\n fileName = (0, _utils.uniqueName)(file.name, _this5.component.fileNameTemplate, _this5.evalContext());\n escapedFileName = file.name ? file.name.replaceAll('<', '&lt;').replaceAll('>', '&gt;') : file.name;\n fileUpload = {\n originalName: escapedFileName,\n name: fileName,\n size: file.size,\n status: 'info',\n message: _this5.t('Processing file. Please wait...'),\n hash: hash\n }; // Check if file with the same name is being uploaded\n fileWithSameNameUploaded = _this5.dataValue.some(function (fileStatus) {\n return fileStatus.originalName === file.name;\n });\n fileWithSameNameUploadedWithError = _this5.statuses.findIndex(function (fileStatus) {\n return fileStatus.originalName === file.name && fileStatus.status === 'error';\n });\n if (fileWithSameNameUploaded) {\n fileUpload.status = 'error';\n fileUpload.message = _this5.t('File with the same name is already uploaded');\n }\n if (fileWithSameNameUploadedWithError !== -1) {\n _this5.statuses.splice(fileWithSameNameUploadedWithError, 1);\n _this5.redraw();\n }\n\n // Check file pattern\n if (_this5.component.filePattern && !_this5.validatePattern(file, _this5.component.filePattern)) {\n fileUpload.status = 'error';\n fileUpload.message = _this5.t('File is the wrong type; it must be {{ pattern }}', {\n pattern: _this5.component.filePattern\n });\n }\n\n // Check file minimum size\n if (_this5.component.fileMinSize && !_this5.validateMinSize(file, _this5.component.fileMinSize)) {\n fileUpload.status = 'error';\n fileUpload.message = _this5.t('File is too small; it must be at least {{ size }}', {\n size: _this5.component.fileMinSize\n });\n }\n\n // Check file maximum size\n if (_this5.component.fileMaxSize && !_this5.validateMaxSize(file, _this5.component.fileMaxSize)) {\n fileUpload.status = 'error';\n fileUpload.message = _this5.t('File is too big; it must be at most {{ size }}', {\n size: _this5.component.fileMaxSize\n });\n }\n\n // Get a unique name for this file to keep file collisions from occurring.\n dir = _this5.interpolate(_this5.component.dir || '');\n fileService = _this5.fileService;\n if (!fileService) {\n fileUpload.status = 'error';\n fileUpload.message = _this5.t('File Service not provided.');\n }\n _this5.statuses.push(fileUpload);\n _this5.redraw();\n if (!(fileUpload.status !== 'error')) {\n _context.next = 53;\n break;\n }\n if (_this5.component.privateDownload) {\n file.private = true;\n }\n storage = _this5.component.storage;\n _this5$component$opti = _this5.component.options, options = _this5$component$opti === void 0 ? {} : _this5$component$opti;\n try {\n options = JSON.parse(_this5.parseTpl(options, {\n data: _this5.rootValue\n }));\n } catch (e) {\n console.log(e);\n }\n url = _this5.interpolate(_this5.component.url, {\n file: fileUpload\n });\n groupKey = null;\n groupPermissions = null; //Iterate through form components to find group resource if one exists\n _this5.root.everyComponent(function (element) {\n var _element$component, _element$component2;\n if ((_element$component = element.component) !== null && _element$component !== void 0 && _element$component.submissionAccess || (_element$component2 = element.component) !== null && _element$component2 !== void 0 && _element$component2.defaultPermission) {\n groupPermissions = !element.component.submissionAccess ? [{\n type: element.component.defaultPermission,\n roles: []\n }] : element.component.submissionAccess;\n groupPermissions.forEach(function (permission) {\n groupKey = ['admin', 'write', 'create'].includes(permission.type) ? element.component.key : null;\n });\n }\n });\n fileKey = _this5.component.fileKey || 'file';\n groupResourceId = groupKey ? _this5.currentForm.submission.data[groupKey]._id : null;\n processedFile = null;\n if (!_this5.root.options.fileProcessor) {\n _context.next = 50;\n break;\n }\n _context.prev = 32;\n if (_this5.refs.fileProcessingLoader) {\n _this5.refs.fileProcessingLoader.style.display = 'block';\n }\n fileProcessorHandler = (0, _fileProcessor.default)(_this5.fileService, _this5.root.options.fileProcessor);\n _context.next = 37;\n return fileProcessorHandler(file, _this5.component.properties);\n case 37:\n processedFile = _context.sent;\n _context.next = 47;\n break;\n case 40:\n _context.prev = 40;\n _context.t0 = _context[\"catch\"](32);\n fileUpload.status = 'error';\n fileUpload.message = _this5.t('File processing has been failed.');\n _this5.fileDropHidden = false;\n _this5.redraw();\n return _context.abrupt(\"return\");\n case 47:\n _context.prev = 47;\n if (_this5.refs.fileProcessingLoader) {\n _this5.refs.fileProcessingLoader.style.display = 'none';\n }\n return _context.finish(47);\n case 50:\n fileUpload.message = _this5.t('Starting upload.');\n _this5.redraw();\n filePromise = fileService.uploadFile(storage, processedFile || file, fileName, dir,\n // Progress callback\n function (evt) {\n fileUpload.status = 'progress';\n fileUpload.progress = parseInt(100.0 * evt.loaded / evt.total);\n delete fileUpload.message;\n _this5.redraw();\n }, url, options, fileKey, groupPermissions, groupResourceId,\n // Upload start callback\n function () {\n _this5.emit('fileUploadingStart', filePromise);\n },\n // Abort upload callback\n function (abort) {\n return _this5.abortUpload = abort;\n }).then(function (fileInfo) {\n var index = _this5.statuses.indexOf(fileUpload);\n if (index !== -1) {\n _this5.statuses.splice(index, 1);\n }\n fileInfo.originalName = escapedFileName;\n fileInfo.hash = fileUpload.hash;\n if (!_this5.hasValue()) {\n _this5.dataValue = [];\n }\n _this5.dataValue.push(fileInfo);\n _this5.fileDropHidden = false;\n _this5.redraw();\n _this5.triggerChange();\n _this5.emit('fileUploadingEnd', filePromise);\n }).catch(function (response) {\n fileUpload.status = 'error';\n fileUpload.message = typeof response === 'string' ? response : response.toString();\n delete fileUpload.progress;\n _this5.fileDropHidden = false;\n _this5.redraw();\n _this5.emit('fileUploadingEnd', filePromise);\n });\n case 53:\n case \"end\":\n return _context.stop();\n }\n }, _callee, null, [[32, 40, 47, 50]]);\n }));\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n }());\n }\n }\n }, {\n key: \"getFile\",\n value: function getFile(fileInfo) {\n var _this$component$optio2 = this.component.options,\n options = _this$component$optio2 === void 0 ? {} : _this$component$optio2;\n var fileService = this.fileService;\n if (!fileService) {\n return alert('File Service not provided');\n }\n if (this.component.privateDownload) {\n fileInfo.private = true;\n }\n fileService.downloadFile(fileInfo, options).then(function (file) {\n if (file) {\n if (['base64', 'indexeddb'].includes(file.storage)) {\n (0, _downloadjs.default)(file.url, file.originalName || file.name, file.type);\n } else {\n window.open(file.url, '_blank');\n }\n }\n }).catch(function (response) {\n // Is alert the best way to do this?\n // User is expecting an immediate notification due to attempting to download a file.\n alert(response);\n });\n }\n }, {\n key: \"focus\",\n value: function focus() {\n if ('beforeFocus' in this.parent) {\n this.parent.beforeFocus(this);\n }\n if (this.refs.fileBrowse) {\n this.refs.fileBrowse.focus();\n }\n }\n }, {\n key: \"destroy\",\n value: function destroy() {\n this.stopVideo();\n _get(_getPrototypeOf(FileComponent.prototype), \"destroy\", this).call(this);\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Field2.default.schema.apply(_Field2.default, [{\n type: 'file',\n label: 'Upload',\n key: 'file',\n image: false,\n privateDownload: false,\n imageSize: '200',\n filePattern: '*',\n fileMinSize: '0KB',\n fileMaxSize: '1GB',\n uploadOnly: false\n }].concat(extend));\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'File',\n group: 'advanced',\n icon: 'file',\n documentation: '/userguide/forms/premium-components#file',\n weight: 100,\n schema: FileComponent.schema()\n };\n }\n }]);\n return FileComponent;\n}(_Field2.default);\nexports[\"default\"] = FileComponent;\n\n//# sourceURL=webpack://Formio/./lib/components/file/File.js?");
2107
2107
 
2108
2108
  /***/ }),
2109
2109
 
@@ -2312,7 +2312,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
2312
2312
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
2313
2313
 
2314
2314
  "use strict";
2315
- eval("\n\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar IconButton = /*#__PURE__*/function (_FieldComponent) {\n _inherits(IconButton, _FieldComponent);\n var _super = _createSuper(IconButton);\n function IconButton(component, options, data) {\n _classCallCheck(this, IconButton);\n return _super.call(this, component, options, data);\n }\n _createClass(IconButton, [{\n key: \"render\",\n value: function render(children) {\n return _get(_getPrototypeOf(IconButton.prototype), \"render\", this).call(this, this.renderTemplate('iconButton'));\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this = this;\n var refs = {\n titleContainer: \"single\",\n iconButtonContainer: \"single\"\n };\n this.loadRefs(element, refs);\n var dataContainer = this.refs.iconButtonContainer;\n if (dataContainer) {\n var clickEventType = this.component['click-event-type'];\n if (clickEventType) {\n this.addEventListener(dataContainer, 'click', function (event) {\n // 点击事件\n var params;\n switch (clickEventType) {\n case 'newPage':\n try {\n params = JSON.parse(_this.parseTpl(_this.component['page_params'], {\n data: _this.rootValue\n }));\n } catch (e) {\n console.log(\"json\\u8F6C\\u6362\\u5931\\u8D25:\".concat(e));\n }\n window.openNewPage(_this.component['click-event-form-id'], params);\n break;\n case 'bottomSheet':\n try {\n params = JSON.parse(_this.parseTpl(_this.component['page_params'], {\n data: _this.rootValue\n }));\n } catch (e) {\n console.log(\"json\\u8F6C\\u6362\\u5931\\u8D25:\".concat(e));\n }\n window.openBottomSheet(_this.component['click-event-form-id'], params);\n break;\n case 'newIntent':\n var elink = document.createElement('a');\n elink.style.display = 'none';\n elink.target = \"_blank\";\n elink.href = _this.component[\"click-event-url\"];\n document.body.appendChild(elink);\n elink.click();\n break;\n }\n });\n }\n }\n setTimeout(function () {\n _this.setValue();\n }, 100);\n return _get(_getPrototypeOf(IconButton.prototype), \"attach\", this).call(this, element);\n }\n\n /**\n * Get the value of the component from the dom elements.\n *\n * @returns {Array}\n */\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.component.value;\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n var strTmp = _lodash.default.get(map, path);\n if (strTmp === undefined) {\n strTmp = null;\n } else {\n if (_lodash.default.isArray(strTmp) || _lodash.default.isObject(strTmp)) {\n strTmp = JSON.stringify(strTmp);\n }\n }\n return strTmp;\n });\n }\n\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var _this2 = this;\n try {\n var customContainerStyle = JSON.parse(this.component[\"container-custom-style\"] || \"{}\");\n _lodash.default.forEach(customContainerStyle, function (value, key) {\n _this2.refs.iconButtonContainer.style[key] = value;\n });\n } catch (e) {}\n try {\n var customStyle = JSON.parse(this.component[\"title-custom-style\"] || \"{}\");\n _lodash.default.forEach(customStyle, function (value, key) {\n _this2.refs.titleContainer.style[key] = value;\n });\n } catch (e) {}\n if (this.refs.titleContainer) {\n this.refs.titleContainer.innerText = this.parseTpl(this.component['title'], {\n data: this.rootValue\n });\n }\n return true;\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Field.default.schema.apply(_Field.default, [{\n label: 'IconButton',\n key: 'iconButton',\n type: 'iconButton'\n }].concat(extend));\n }\n }]);\n return IconButton;\n}(_Field.default);\nexports[\"default\"] = IconButton;\n_defineProperty(IconButton, \"builderInfo\", {\n title: 'IconButton',\n group: 'advanced',\n icon: 'icons',\n weight: 70,\n documentation: 'http://help.form.io/userguide/#iconButton',\n schema: IconButton.schema()\n});\n\n//# sourceURL=webpack://Formio/./lib/components/iconButton/IconButton.js?");
2315
+ eval("\n\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar IconButton = /*#__PURE__*/function (_FieldComponent) {\n _inherits(IconButton, _FieldComponent);\n var _super = _createSuper(IconButton);\n function IconButton(component, options, data) {\n _classCallCheck(this, IconButton);\n return _super.call(this, component, options, data);\n }\n _createClass(IconButton, [{\n key: \"render\",\n value: function render(children) {\n return _get(_getPrototypeOf(IconButton.prototype), \"render\", this).call(this, this.renderTemplate('iconButton'));\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this = this;\n var refs = {\n titleContainer: \"single\",\n iconButtonContainer: \"single\"\n };\n this.loadRefs(element, refs);\n var dataContainer = this.refs.iconButtonContainer;\n if (dataContainer) {\n var clickEventType = this.component['click-event-type'];\n if (clickEventType) {\n this.addEventListener(dataContainer, 'click', function (event) {\n // 点击事件\n var params;\n switch (clickEventType) {\n case 'newPage':\n try {\n params = JSON.parse(_this.parseTpl(_this.component['page_params'], {\n data: _this.rootValue\n }));\n } catch (e) {\n console.log(\"json\\u8F6C\\u6362\\u5931\\u8D25:\".concat(e));\n }\n window.openNewPage(_this.component['click-event-form-id'], params);\n break;\n case 'bottomSheet':\n try {\n params = JSON.parse(_this.parseTpl(_this.component['page_params'], {\n data: _this.rootValue\n }));\n } catch (e) {\n console.log(\"json\\u8F6C\\u6362\\u5931\\u8D25:\".concat(e));\n }\n window.openBottomSheet(_this.component['click-event-form-id'], params);\n break;\n case 'newIntent':\n var elink = document.createElement('a');\n elink.style.display = 'none';\n elink.target = \"_blank\";\n elink.href = _this.component[\"click-event-url\"];\n document.body.appendChild(elink);\n elink.click();\n break;\n }\n });\n }\n }\n setTimeout(function () {\n _this.setValue();\n }, 100);\n return _get(_getPrototypeOf(IconButton.prototype), \"attach\", this).call(this, element);\n }\n\n /**\n * Get the value of the component from the dom elements.\n *\n * @returns {Array}\n */\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.component.value;\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n var strTmp = (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n if (strTmp === undefined) {\n strTmp = null;\n } else {\n if (_lodash.default.isArray(strTmp) || _lodash.default.isObject(strTmp)) {\n strTmp = JSON.stringify(strTmp);\n }\n }\n return strTmp;\n });\n }\n\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var _this2 = this;\n try {\n var customContainerStyle = JSON.parse(this.component[\"container-custom-style\"] || \"{}\");\n _lodash.default.forEach(customContainerStyle, function (value, key) {\n _this2.refs.iconButtonContainer.style[key] = value;\n });\n } catch (e) {}\n try {\n var customStyle = JSON.parse(this.component[\"title-custom-style\"] || \"{}\");\n _lodash.default.forEach(customStyle, function (value, key) {\n _this2.refs.titleContainer.style[key] = value;\n });\n } catch (e) {}\n if (this.refs.titleContainer) {\n this.refs.titleContainer.innerText = this.parseTpl(this.component['title'], {\n data: this.rootValue\n });\n }\n return true;\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Field.default.schema.apply(_Field.default, [{\n label: 'IconButton',\n key: 'iconButton',\n type: 'iconButton'\n }].concat(extend));\n }\n }]);\n return IconButton;\n}(_Field.default);\nexports[\"default\"] = IconButton;\n_defineProperty(IconButton, \"builderInfo\", {\n title: 'IconButton',\n group: 'advanced',\n icon: 'icons',\n weight: 70,\n documentation: 'http://help.form.io/userguide/#iconButton',\n schema: IconButton.schema()\n});\n\n//# sourceURL=webpack://Formio/./lib/components/iconButton/IconButton.js?");
2316
2316
 
2317
2317
  /***/ }),
2318
2318
 
@@ -2356,7 +2356,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
2356
2356
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
2357
2357
 
2358
2358
  "use strict";
2359
- eval("\n\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.map.js */ \"./node_modules/core-js/modules/es.array.map.js\");\n__webpack_require__(/*! core-js/modules/es.string.starts-with.js */ \"./node_modules/core-js/modules/es.string.starts-with.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.url.js */ \"./node_modules/core-js/modules/web.url.js\");\n__webpack_require__(/*! core-js/modules/web.url-search-params.js */ \"./node_modules/core-js/modules/web.url-search-params.js\");\n__webpack_require__(/*! core-js/modules/es.string.search.js */ \"./node_modules/core-js/modules/es.string.search.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.object.keys.js */ \"./node_modules/core-js/modules/es.object.keys.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _Map = _interopRequireDefault(__webpack_require__(/*! ./Map.form */ \"./lib/components/map/Map.form.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar Map = /*#__PURE__*/function (_FieldComponent) {\n _inherits(Map, _FieldComponent);\n var _super = _createSuper(Map);\n function Map(component, options, data) {\n _classCallCheck(this, Map);\n return _super.call(this, component, options, data);\n }\n _createClass(Map, [{\n key: \"render\",\n value: function render(children) {\n return _get(_getPrototypeOf(Map.prototype), \"render\", this).call(this, this.renderTemplate('customMap'));\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this = this;\n var self = this;\n var refs = {};\n this.loadRefs(element, refs);\n setTimeout(function () {\n _this.setValue();\n }, 100);\n return _get(_getPrototypeOf(Map.prototype), \"attach\", this).call(this, element);\n }\n\n /**\n * Get the value of the component from the dom elements.\n *\n * @returns {Array}\n */\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.component.value;\n }\n }, {\n key: \"get\",\n value: function get(path, obj) {\n var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : \"${\".concat(path, \"}\");\n return path.split('.').reduce(function (res, key) {\n return res[key] || fb;\n }, obj);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map, fallback) {\n var _this2 = this;\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n return _this2.get(path, map, fallback);\n });\n }\n\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var _this3 = this;\n var self = this;\n if (!self.element) {\n return true;\n }\n var canvas = self.element.querySelector('#map-container');\n if (self.component['amap-key'] && self.component['amap-key'].length > 0 && self.component['amap-code'] && self.component['amap-code'].length > 0) {\n var _self$component$dataT;\n window._AMapSecurityConfig = {\n securityJsCode: self.component['amap-code']\n };\n var defaultCenter = self.component['defaultCenter'];\n var dataType = (_self$component$dataT = self.component['dataType']) !== null && _self$component$dataT !== void 0 ? _self$component$dataT : 'lnglat';\n AMapLoader.load({\n key: self.component['amap-key'],\n //申请好的Web端开发者 Key,调用 load 时必填\n version: '2.0' //指定要加载的 JS API 的版本,缺省时默认为 1.4.15\n }).then(function (AMap) {\n self.map = new AMap.Map(canvas, {\n resizeEnable: true,\n mapStyle: \"amap://styles/whitesmoke\",\n zoom: 12.9\n });\n // 获取标记点\n if (self.component['dataSource'] === 'url') {\n if (self.component['data-source-url']) {\n var url = self.parseTpl(self.component['data-source-url'], {\n data: self.rootValue\n }, null);\n if (url.startsWith('http')) {\n url = new URL(url);\n } else {\n url = new URL(url, window.location.origin);\n }\n var searchParams = new URLSearchParams(url.search);\n var params = {};\n var headers = {};\n if (self.component.request && self.component.request['headers']) {\n self.component.request['headers'].forEach(function (header) {\n headers[\"\".concat(header.key)] = self.parseTpl(header.value, {\n data: self.rootValue\n }, null);\n });\n }\n // 搜索\n if (self.component['dataSource'] === 'url') {} else if (self.component['dataSource'] === 'noco_db') {\n if (self.component.data['noco_db_conditions']) {\n var where = '';\n self.component.data['noco_db_conditions'].forEach(function (item, index) {\n if (item.value && item.value.length > 0) {\n var conditionVal = self.parseTpl(item.value, {\n data: self.rootValue\n }, null);\n if (index === 0 && item.logical_operator === '~not') {\n where += \"(\".concat(item.name, \",\").concat(item.operator, \",\").concat(conditionVal, \")\");\n } else {\n where += \"\".concat(item.logical_operator, \"(\").concat(item.name, \",\").concat(item.operator, \",\").concat(conditionVal, \")\");\n }\n }\n });\n params.where = where;\n }\n }\n Object.keys(params).forEach(function (key) {\n searchParams.set(key, params[\"\".concat(key)]);\n });\n try {\n var lastestReqTime = new Date().getTime();\n self.lastestReqTime = lastestReqTime;\n var xhr = new XMLHttpRequest();\n var reqMethod = self.component.request['method'];\n if (reqMethod === 'GET') {\n xhr.open('GET', \"\".concat(url.origin).concat(url.pathname, \"?\").concat(searchParams.toString()), true);\n xhr.responseType = 'json';\n Object.keys(headers).forEach(function (key) {\n if (key.length > 0 && headers[\"\".concat(key)].length > 0) {\n xhr.setRequestHeader(key, headers[\"\".concat(key)]);\n }\n });\n } else if (reqMethod === 'POST') {\n xhr.open('POST', \"\".concat(url.origin).concat(url.pathname, \"?\").concat(searchParams.toString()), true);\n xhr.setRequestHeader('Content-Type', 'application/json');\n xhr.responseType = 'json';\n Object.keys(headers).forEach(function (key) {\n if (key.length > 0 && headers[\"\".concat(key)].length > 0) {\n xhr.setRequestHeader(key, headers[\"\".concat(key)]);\n }\n });\n }\n xhr.onload = function () {\n var status = xhr.status;\n if (status === 200) {\n // 确保最后更新的数据是最新一次请求的接口数据\n if (lastestReqTime - self.lastestReqTime === 0) {\n var dataPath = self.component.request['dataPath'];\n var results;\n if (dataPath && dataPath.length > 0) {\n results = _lodash.default.get(xhr.response, dataPath);\n } else {\n results = xhr.response;\n }\n // 添加点\n var markerList = results.map(function (marker) {\n var lng, lat;\n if (dataType === 'lnglat') {\n lng = _lodash.default.get(marker, self.component['key_lng']);\n lat = _lodash.default.get(marker, self.component['key_lat']);\n } else {\n var lnglat = _lodash.default.get(marker, self.component['key_lnglat']);\n if (lnglat && lnglat.length > 0 && lnglat.split(',').length === 2) {\n lng = lnglat.split(',')[0];\n lat = lnglat.split(',')[1];\n }\n }\n return new AMap.Marker({\n position: new AMap.LngLat(lng, lat),\n //经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]\n extData: marker,\n content: \"<div>\\n<img src=\\\"https://a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png\\\" style=\\\"width: 25px;height: 34px\\\"/>\\n<span class=\\\"marker\\\" style=\\\"position: absolute;\\n top: -20px;\\n right: -30px;\\n color: #fff;\\n padding: 4px 10px;\\n box-shadow: 1px 1px 1px rgba(10, 10, 10, .2);\\n white-space: nowrap;\\n font-size: 12px;background-color: #25A5F7;\\n border-radius: 3px;\\\">\".concat(_lodash.default.get(marker, self.component['key_marker_title']), \"</span>\\n</div>\")\n });\n });\n markerList.forEach(function (markerItem) {\n markerItem.on('click', function (e) {\n if (self.component['operate_process_key'] && self.component['operate_process_key'].length > 0) {\n var processKey = self.component['operate_process_key'];\n var label = '';\n var field = self.component.key;\n var key = 'modify';\n var data = [];\n var columns = [];\n var lockDrawer = self.component['operate_lock_drawer'];\n var item = e.target._opts.extData;\n Object.keys(item).forEach(function (key) {\n data.push(item[\"\".concat(key)]);\n columns.push(key);\n });\n var action = {\n field: field,\n key: key,\n label: label,\n processKey: processKey,\n data: data,\n columns: columns,\n lockDrawer: lockDrawer\n };\n if (self.component['operate_type'] === 'dialog') {\n window.editDataTableItemByDialog(action);\n } else {\n window.editDataTableItemByDrawer(action);\n }\n }\n });\n });\n self.map.add(markerList);\n // 设置地图中心点\n if (defaultCenter) {\n AMap.plugin('AMap.Geolocation', function () {\n var geolocation = new AMap.Geolocation({\n enableHighAccuracy: true,\n // 是否使用高精度定位,默认:true\n timeout: 10000,\n // 设置定位超时时间,默认:无穷大\n offset: [10, 20],\n // 定位按钮的停靠位置的偏移量\n zoomToAccuracy: true,\n // 定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false\n position: 'RB' // 定位按钮的排放位置, RB表示右下\n });\n\n geolocation.getCurrentPosition(function (status, result) {\n if (status == 'complete') {\n self.map.setCenter([result.position.lng, result.position.lat]);\n }\n });\n });\n } else if (self.component[\"customCenter\"] && self.component[\"customCenter\"].length > 0) {\n // 自定义中心点\n var customCenter = self.parseTpl(self.component[\"customCenter\"], {\n data: self.rootValue\n }, null);\n if (customCenter && customCenter.length > 0 && customCenter.split(',').length === 2) {\n var lng, lat;\n lng = customCenter.split(',')[0];\n lat = customCenter.split(',')[1];\n self.map.setCenter([lng, lat]);\n }\n } else {\n if (results && results.length > 0) {\n var _lng, _lat;\n if (dataType === 'lnglat') {\n _lng = _lodash.default.get(results[0], self.component['key_lng']);\n _lat = _lodash.default.get(results[0], self.component['key_lat']);\n } else {\n var lnglat = _lodash.default.get(results[0], self.component['key_lnglat']);\n if (lnglat && lnglat.length > 0 && lnglat.split(',').length === 2) {\n _lng = lnglat.split(',')[0];\n _lat = lnglat.split(',')[1];\n }\n }\n self.map.setCenter([_lng, _lat]);\n }\n }\n }\n }\n };\n if (reqMethod === 'GET') {\n xhr.send();\n } else if (reqMethod === 'POST') {\n var reqData = JSON.parse(_this3.parseTpl(JSON.stringify(self.component.request['body']) || '{}', {\n data: self.rootValue\n }, null));\n xhr.send(JSON.stringify(reqData));\n }\n } catch (e) {\n console.log(e);\n }\n }\n }\n if (self.component['dataSource'] === 'value') {\n if (self.component['data-source-value']) {\n try {\n // 添加点\n var lng, lat;\n var lnglat = self.parseTpl(self.component[\"data-source-value\"], {\n data: self.rootValue\n }, null);\n if (lnglat && lnglat.length > 0 && lnglat.split(',').length === 2) {\n lng = lnglat.split(',')[0];\n lat = lnglat.split(',')[1];\n }\n var lnglatTitle = self.parseTpl(self.component[\"data-source-value-title\"], {\n data: self.rootValue\n }, null);\n var markerList = [new AMap.Marker({\n position: new AMap.LngLat(lng, lat),\n //经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]\n extData: lnglat,\n content: \"<div>\\n<img src=\\\"https://a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png\\\" style=\\\"width: 25px;height: 34px\\\"/>\\n<span class=\\\"marker\\\" style=\\\"position: absolute;\\n top: -20px;\\n right: -30px;\\n color: #fff;\\n padding: 4px 10px;\\n box-shadow: 1px 1px 1px rgba(10, 10, 10, .2);\\n white-space: nowrap;\\n font-size: 12px;background-color: #25A5F7;\\n border-radius: 3px;\\\">\".concat(lnglatTitle, \"</span>\\n</div>\")\n })];\n markerList.forEach(function (markerItem) {\n markerItem.on('click', function (e) {\n if (self.component['operate_process_key'] && self.component['operate_process_key'].length > 0) {\n var processKey = self.component['operate_process_key'];\n var label = '';\n var field = self.component.key;\n var key = 'modify';\n var data = [];\n var columns = [];\n var lockDrawer = self.component['operate_lock_drawer'];\n var item = e.target._opts.extData;\n Object.keys(item).forEach(function (key) {\n data.push(item[\"\".concat(key)]);\n columns.push(key);\n });\n var action = {\n field: field,\n key: key,\n label: label,\n processKey: processKey,\n data: data,\n columns: columns,\n lockDrawer: lockDrawer\n };\n if (self.component['operate_type'] === 'dialog') {\n window.editDataTableItemByDialog(action);\n } else {\n window.editDataTableItemByDrawer(action);\n }\n }\n });\n });\n self.map.add(markerList);\n // 设置地图中心点\n if (defaultCenter) {\n AMap.plugin('AMap.Geolocation', function () {\n var geolocation = new AMap.Geolocation({\n enableHighAccuracy: true,\n // 是否使用高精度定位,默认:true\n timeout: 10000,\n // 设置定位超时时间,默认:无穷大\n offset: [10, 20],\n // 定位按钮的停靠位置的偏移量\n zoomToAccuracy: true,\n // 定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false\n position: 'RB' // 定位按钮的排放位置, RB表示右下\n });\n\n geolocation.getCurrentPosition(function (status, result) {\n if (status == 'complete') {\n self.map.setCenter([result.position.lng, result.position.lat]);\n }\n });\n });\n } else if (self.component[\"customCenter\"] && self.component[\"customCenter\"].length > 0) {\n // 自定义中心点\n var customCenter = self.parseTpl(self.component[\"customCenter\"], {\n data: self.rootValue\n }, null);\n if (customCenter && customCenter.length > 0 && customCenter.split(',').length === 2) {\n var _lng2, _lat2;\n _lng2 = customCenter.split(',')[0];\n _lat2 = customCenter.split(',')[1];\n self.map.setCenter([_lng2, _lat2]);\n }\n } else {\n self.map.setCenter([lng, lat]);\n }\n } catch (e) {\n console.log(e);\n }\n }\n }\n }).catch(function (e) {\n console.error(e); //加载错误提示\n });\n }\n\n return true;\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Field.default.schema.apply(_Field.default, [{\n label: 'Map',\n key: 'map',\n type: 'map'\n }].concat(extend));\n }\n }]);\n return Map;\n}(_Field.default);\nexports[\"default\"] = Map;\n_defineProperty(Map, \"builderInfo\", {\n title: 'Map',\n group: 'advanced',\n icon: 'map',\n weight: 70,\n documentation: 'http://help.form.io/userguide/#map',\n schema: Map.schema()\n});\nMap.editForm = _Map.default;\n\n//# sourceURL=webpack://Formio/./lib/components/map/Map.js?");
2359
+ eval("\n\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.map.js */ \"./node_modules/core-js/modules/es.array.map.js\");\n__webpack_require__(/*! core-js/modules/es.string.starts-with.js */ \"./node_modules/core-js/modules/es.string.starts-with.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.url.js */ \"./node_modules/core-js/modules/web.url.js\");\n__webpack_require__(/*! core-js/modules/web.url-search-params.js */ \"./node_modules/core-js/modules/web.url-search-params.js\");\n__webpack_require__(/*! core-js/modules/es.string.search.js */ \"./node_modules/core-js/modules/es.string.search.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.object.keys.js */ \"./node_modules/core-js/modules/es.object.keys.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _Map = _interopRequireDefault(__webpack_require__(/*! ./Map.form */ \"./lib/components/map/Map.form.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar Map = /*#__PURE__*/function (_FieldComponent) {\n _inherits(Map, _FieldComponent);\n var _super = _createSuper(Map);\n function Map(component, options, data) {\n _classCallCheck(this, Map);\n return _super.call(this, component, options, data);\n }\n _createClass(Map, [{\n key: \"render\",\n value: function render(children) {\n return _get(_getPrototypeOf(Map.prototype), \"render\", this).call(this, this.renderTemplate('customMap'));\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this = this;\n var self = this;\n var refs = {};\n this.loadRefs(element, refs);\n setTimeout(function () {\n _this.setValue();\n }, 100);\n return _get(_getPrototypeOf(Map.prototype), \"attach\", this).call(this, element);\n }\n\n /**\n * Get the value of the component from the dom elements.\n *\n * @returns {Array}\n */\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.component.value;\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n });\n }\n\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var _this2 = this;\n var self = this;\n if (!self.element) {\n return true;\n }\n var canvas = self.element.querySelector('#map-container');\n if (self.component['amap-key'] && self.component['amap-key'].length > 0 && self.component['amap-code'] && self.component['amap-code'].length > 0) {\n var _self$component$dataT;\n window._AMapSecurityConfig = {\n securityJsCode: self.component['amap-code']\n };\n var defaultCenter = self.component['defaultCenter'];\n var dataType = (_self$component$dataT = self.component['dataType']) !== null && _self$component$dataT !== void 0 ? _self$component$dataT : 'lnglat';\n AMapLoader.load({\n key: self.component['amap-key'],\n //申请好的Web端开发者 Key,调用 load 时必填\n version: '2.0' //指定要加载的 JS API 的版本,缺省时默认为 1.4.15\n }).then(function (AMap) {\n self.map = new AMap.Map(canvas, {\n resizeEnable: true,\n mapStyle: \"amap://styles/whitesmoke\",\n zoom: 12.9\n });\n // 获取标记点\n if (self.component['dataSource'] === 'url') {\n if (self.component['data-source-url']) {\n var url = self.parseTpl(self.component['data-source-url'], {\n data: self.rootValue\n });\n if (url.startsWith('http')) {\n url = new URL(url);\n } else {\n url = new URL(url, window.location.origin);\n }\n var searchParams = new URLSearchParams(url.search);\n var params = {};\n var headers = {};\n if (self.component.request && self.component.request['headers']) {\n self.component.request['headers'].forEach(function (header) {\n headers[\"\".concat(header.key)] = self.parseTpl(header.value, {\n data: self.rootValue\n });\n });\n }\n // 搜索\n if (self.component['dataSource'] === 'url') {} else if (self.component['dataSource'] === 'noco_db') {\n if (self.component.data['noco_db_conditions']) {\n var where = '';\n self.component.data['noco_db_conditions'].forEach(function (item, index) {\n if (item.value && item.value.length > 0) {\n var conditionVal = self.parseTpl(item.value, {\n data: self.rootValue\n });\n if (index === 0 && item.logical_operator === '~not') {\n where += \"(\".concat(item.name, \",\").concat(item.operator, \",\").concat(conditionVal, \")\");\n } else {\n where += \"\".concat(item.logical_operator, \"(\").concat(item.name, \",\").concat(item.operator, \",\").concat(conditionVal, \")\");\n }\n }\n });\n params.where = where;\n }\n }\n Object.keys(params).forEach(function (key) {\n searchParams.set(key, params[\"\".concat(key)]);\n });\n try {\n var lastestReqTime = new Date().getTime();\n self.lastestReqTime = lastestReqTime;\n var xhr = new XMLHttpRequest();\n var reqMethod = self.component.request['method'];\n if (reqMethod === 'GET') {\n xhr.open('GET', \"\".concat(url.origin).concat(url.pathname, \"?\").concat(searchParams.toString()), true);\n xhr.responseType = 'json';\n Object.keys(headers).forEach(function (key) {\n if (key.length > 0 && headers[\"\".concat(key)].length > 0) {\n xhr.setRequestHeader(key, headers[\"\".concat(key)]);\n }\n });\n } else if (reqMethod === 'POST') {\n xhr.open('POST', \"\".concat(url.origin).concat(url.pathname, \"?\").concat(searchParams.toString()), true);\n xhr.setRequestHeader('Content-Type', 'application/json');\n xhr.responseType = 'json';\n Object.keys(headers).forEach(function (key) {\n if (key.length > 0 && headers[\"\".concat(key)].length > 0) {\n xhr.setRequestHeader(key, headers[\"\".concat(key)]);\n }\n });\n }\n xhr.onload = function () {\n var status = xhr.status;\n if (status === 200) {\n // 确保最后更新的数据是最新一次请求的接口数据\n if (lastestReqTime - self.lastestReqTime === 0) {\n var dataPath = self.component.request['dataPath'];\n var results;\n if (dataPath && dataPath.length > 0) {\n results = _lodash.default.get(xhr.response, dataPath);\n } else {\n results = xhr.response;\n }\n // 添加点\n var markerList = results.map(function (marker) {\n var lng, lat;\n if (dataType === 'lnglat') {\n lng = _lodash.default.get(marker, self.component['key_lng']);\n lat = _lodash.default.get(marker, self.component['key_lat']);\n } else {\n var lnglat = _lodash.default.get(marker, self.component['key_lnglat']);\n if (lnglat && lnglat.length > 0 && lnglat.split(',').length === 2) {\n lng = lnglat.split(',')[0];\n lat = lnglat.split(',')[1];\n }\n }\n return new AMap.Marker({\n position: new AMap.LngLat(lng, lat),\n //经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]\n extData: marker,\n content: \"<div>\\n<img src=\\\"https://a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png\\\" style=\\\"width: 25px;height: 34px\\\"/>\\n<span class=\\\"marker\\\" style=\\\"position: absolute;\\n top: -20px;\\n right: -30px;\\n color: #fff;\\n padding: 4px 10px;\\n box-shadow: 1px 1px 1px rgba(10, 10, 10, .2);\\n white-space: nowrap;\\n font-size: 12px;background-color: #25A5F7;\\n border-radius: 3px;\\\">\".concat(_lodash.default.get(marker, self.component['key_marker_title']), \"</span>\\n</div>\")\n });\n });\n markerList.forEach(function (markerItem) {\n markerItem.on('click', function (e) {\n if (self.component['operate_process_key'] && self.component['operate_process_key'].length > 0) {\n var processKey = self.component['operate_process_key'];\n var label = '';\n var field = self.component.key;\n var key = 'modify';\n var data = [];\n var columns = [];\n var lockDrawer = self.component['operate_lock_drawer'];\n var item = e.target._opts.extData;\n Object.keys(item).forEach(function (key) {\n data.push(item[\"\".concat(key)]);\n columns.push(key);\n });\n var action = {\n field: field,\n key: key,\n label: label,\n processKey: processKey,\n data: data,\n columns: columns,\n lockDrawer: lockDrawer\n };\n if (self.component['operate_type'] === 'dialog') {\n window.editDataTableItemByDialog(action);\n } else {\n window.editDataTableItemByDrawer(action);\n }\n }\n });\n });\n self.map.add(markerList);\n // 设置地图中心点\n if (defaultCenter) {\n AMap.plugin('AMap.Geolocation', function () {\n var geolocation = new AMap.Geolocation({\n enableHighAccuracy: true,\n // 是否使用高精度定位,默认:true\n timeout: 10000,\n // 设置定位超时时间,默认:无穷大\n offset: [10, 20],\n // 定位按钮的停靠位置的偏移量\n zoomToAccuracy: true,\n // 定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false\n position: 'RB' // 定位按钮的排放位置, RB表示右下\n });\n\n geolocation.getCurrentPosition(function (status, result) {\n if (status == 'complete') {\n self.map.setCenter([result.position.lng, result.position.lat]);\n }\n });\n });\n } else if (self.component[\"customCenter\"] && self.component[\"customCenter\"].length > 0) {\n // 自定义中心点\n var customCenter = self.parseTpl(self.component[\"customCenter\"], {\n data: self.rootValue\n });\n if (customCenter && customCenter.length > 0 && customCenter.split(',').length === 2) {\n var lng, lat;\n lng = customCenter.split(',')[0];\n lat = customCenter.split(',')[1];\n self.map.setCenter([lng, lat]);\n }\n } else {\n if (results && results.length > 0) {\n var _lng, _lat;\n if (dataType === 'lnglat') {\n _lng = _lodash.default.get(results[0], self.component['key_lng']);\n _lat = _lodash.default.get(results[0], self.component['key_lat']);\n } else {\n var lnglat = _lodash.default.get(results[0], self.component['key_lnglat']);\n if (lnglat && lnglat.length > 0 && lnglat.split(',').length === 2) {\n _lng = lnglat.split(',')[0];\n _lat = lnglat.split(',')[1];\n }\n }\n self.map.setCenter([_lng, _lat]);\n }\n }\n }\n }\n };\n if (reqMethod === 'GET') {\n xhr.send();\n } else if (reqMethod === 'POST') {\n var reqData = JSON.parse(_this2.parseTpl(JSON.stringify(self.component.request['body']) || '{}', {\n data: self.rootValue\n }));\n xhr.send(JSON.stringify(reqData));\n }\n } catch (e) {\n console.log(e);\n }\n }\n }\n if (self.component['dataSource'] === 'value') {\n if (self.component['data-source-value']) {\n try {\n // 添加点\n var lng, lat;\n var lnglat = self.parseTpl(self.component[\"data-source-value\"], {\n data: self.rootValue\n });\n if (lnglat && lnglat.length > 0 && lnglat.split(',').length === 2) {\n lng = lnglat.split(',')[0];\n lat = lnglat.split(',')[1];\n }\n var lnglatTitle = self.parseTpl(self.component[\"data-source-value-title\"], {\n data: self.rootValue\n });\n var markerList = [new AMap.Marker({\n position: new AMap.LngLat(lng, lat),\n //经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]\n extData: lnglat,\n content: \"<div>\\n<img src=\\\"https://a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png\\\" style=\\\"width: 25px;height: 34px\\\"/>\\n<span class=\\\"marker\\\" style=\\\"position: absolute;\\n top: -20px;\\n right: -30px;\\n color: #fff;\\n padding: 4px 10px;\\n box-shadow: 1px 1px 1px rgba(10, 10, 10, .2);\\n white-space: nowrap;\\n font-size: 12px;background-color: #25A5F7;\\n border-radius: 3px;\\\">\".concat(lnglatTitle, \"</span>\\n</div>\")\n })];\n markerList.forEach(function (markerItem) {\n markerItem.on('click', function (e) {\n if (self.component['operate_process_key'] && self.component['operate_process_key'].length > 0) {\n var processKey = self.component['operate_process_key'];\n var label = '';\n var field = self.component.key;\n var key = 'modify';\n var data = [];\n var columns = [];\n var lockDrawer = self.component['operate_lock_drawer'];\n var item = e.target._opts.extData;\n Object.keys(item).forEach(function (key) {\n data.push(item[\"\".concat(key)]);\n columns.push(key);\n });\n var action = {\n field: field,\n key: key,\n label: label,\n processKey: processKey,\n data: data,\n columns: columns,\n lockDrawer: lockDrawer\n };\n if (self.component['operate_type'] === 'dialog') {\n window.editDataTableItemByDialog(action);\n } else {\n window.editDataTableItemByDrawer(action);\n }\n }\n });\n });\n self.map.add(markerList);\n // 设置地图中心点\n if (defaultCenter) {\n AMap.plugin('AMap.Geolocation', function () {\n var geolocation = new AMap.Geolocation({\n enableHighAccuracy: true,\n // 是否使用高精度定位,默认:true\n timeout: 10000,\n // 设置定位超时时间,默认:无穷大\n offset: [10, 20],\n // 定位按钮的停靠位置的偏移量\n zoomToAccuracy: true,\n // 定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false\n position: 'RB' // 定位按钮的排放位置, RB表示右下\n });\n\n geolocation.getCurrentPosition(function (status, result) {\n if (status == 'complete') {\n self.map.setCenter([result.position.lng, result.position.lat]);\n }\n });\n });\n } else if (self.component[\"customCenter\"] && self.component[\"customCenter\"].length > 0) {\n // 自定义中心点\n var customCenter = self.parseTpl(self.component[\"customCenter\"], {\n data: self.rootValue\n });\n if (customCenter && customCenter.length > 0 && customCenter.split(',').length === 2) {\n var _lng2, _lat2;\n _lng2 = customCenter.split(',')[0];\n _lat2 = customCenter.split(',')[1];\n self.map.setCenter([_lng2, _lat2]);\n }\n } else {\n self.map.setCenter([lng, lat]);\n }\n } catch (e) {\n console.log(e);\n }\n }\n }\n }).catch(function (e) {\n console.error(e); //加载错误提示\n });\n }\n\n return true;\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Field.default.schema.apply(_Field.default, [{\n label: 'Map',\n key: 'map',\n type: 'map'\n }].concat(extend));\n }\n }]);\n return Map;\n}(_Field.default);\nexports[\"default\"] = Map;\n_defineProperty(Map, \"builderInfo\", {\n title: 'Map',\n group: 'advanced',\n icon: 'map',\n weight: 70,\n documentation: 'http://help.form.io/userguide/#map',\n schema: Map.schema()\n});\nMap.editForm = _Map.default;\n\n//# sourceURL=webpack://Formio/./lib/components/map/Map.js?");
2360
2360
 
2361
2361
  /***/ }),
2362
2362
 
@@ -2587,7 +2587,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
2587
2587
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
2588
2588
 
2589
2589
  "use strict";
2590
- eval("\n\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _Progress = _interopRequireDefault(__webpack_require__(/*! ./Progress.form */ \"./lib/components/progress/Progress.form.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar Progress = /*#__PURE__*/function (_FieldComponent) {\n _inherits(Progress, _FieldComponent);\n var _super = _createSuper(Progress);\n function Progress(component, options, data) {\n _classCallCheck(this, Progress);\n return _super.call(this, component, options, data);\n }\n _createClass(Progress, [{\n key: \"render\",\n value: function render(children) {\n return _get(_getPrototypeOf(Progress.prototype), \"render\", this).call(this, this.renderTemplate('progress'));\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this = this;\n var refs = {\n titleContainer: 'single',\n progressContainer: 'single'\n };\n this.loadRefs(element, refs);\n setTimeout(function () {\n _this.setValue();\n }, 100);\n // Allow basic component functionality to attach like field logic and tooltips.\n return _get(_getPrototypeOf(Progress.prototype), \"attach\", this).call(this, element);\n }\n\n /**\n * Get the value of the component from the dom elements.\n *\n * @returns {Array}\n */\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.component.value;\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n var strTmp = _lodash.default.get(map, path);\n if (strTmp === undefined) {\n strTmp = null;\n } else {\n if (_lodash.default.isArray(strTmp) || _lodash.default.isObject(strTmp)) {\n strTmp = JSON.stringify(strTmp);\n }\n }\n return strTmp;\n });\n }\n\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var _this2 = this;\n if (this.refs.titleContainer) {\n this.refs.titleContainer.innerHTML = \"\";\n }\n if (this.refs.progressContainer) {\n this.refs.progressContainer.innerHTML = \"\";\n }\n var optionsStr = this.component['option-value'];\n try {\n optionsStr = this.parseTpl(optionsStr, {\n data: this.rootValue\n });\n optionsStr = JSON.parse(optionsStr);\n var sum = _lodash.default.sumBy(optionsStr, 'value');\n if (this.component['max-value'] && this.component['max-value'].trim().length > 0) {\n sum = _lodash.default.toNumber(this.parseTpl(this.component['max-value'], {\n data: this.rootValue\n }));\n }\n optionsStr.forEach(function (item) {\n var percent = _lodash.default.floor(_lodash.default.divide(item.value, sum) * 100, 1);\n if (_this2.refs.titleContainer) {\n _this2.refs.titleContainer.insertAdjacentHTML('beforeend', \"<div class=\\\"progress-title-container\\\" style=\\\"display: flex;flex-direction: row;align-items: center;font-size: \".concat(_this2.component['font-size'], \"\\\">\\n <div class=\\\"progress-title-item-indicator\\\" style=\\\"width: 5px;height: 5px;background-color: \").concat(item.color, \";margin-right: 10px\\\"></div>\\n <div class=\\\"progress-title-item-title\\\" style=\\\"color: \").concat(item.color, \"\\\">\").concat(item.title, \"</div>\\n <div class=\\\"progress-title-item-value\\\" style=\\\"font-weight: bold;margin-left: 5px;margin-right: 5px;color: black\\\">\").concat(item.value, \"</div>\\n <div class=\\\"progress-title-item-unit\\\" style=\\\"color: grey\\\">\").concat(item.unit, \"</div>\\n <div class=\\\"progress-title-item-percent\\\" style=\\\"margin-left: 10px;color: grey\\\">\").concat(percent, \"%</div>\\n </div>\"));\n }\n if (_this2.refs.progressContainer) {\n _this2.refs.progressContainer.insertAdjacentHTML('beforeend', \"<div class=\\\"progress-bar\\\" role=\\\"progressbar\\\" style=\\\"width: \".concat(percent, \"%;background-color: \").concat(item.color, \"\\\" aria-valuenow=\\\"\").concat(item.value, \"\\\" aria-valuemin=\\\"0\\\" aria-valuemax=\\\"\").concat(sum, \"\\\"></div>\"));\n }\n });\n } catch (e) {\n console.log('json转换失败', e);\n }\n return true;\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Field.default.schema.apply(_Field.default, [{\n label: 'Progress',\n key: 'progress',\n type: 'progress'\n }].concat(extend));\n }\n }]);\n return Progress;\n}(_Field.default);\nexports[\"default\"] = Progress;\n_defineProperty(Progress, \"builderInfo\", {\n title: 'Progress',\n group: 'advanced',\n icon: 'bars-progress',\n weight: 70,\n documentation: 'http://help.form.io/userguide/#progress',\n schema: Progress.schema()\n});\nProgress.editForm = _Progress.default;\n\n//# sourceURL=webpack://Formio/./lib/components/progress/Progress.js?");
2590
+ eval("\n\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _Progress = _interopRequireDefault(__webpack_require__(/*! ./Progress.form */ \"./lib/components/progress/Progress.form.js\"));\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nvar Progress = /*#__PURE__*/function (_FieldComponent) {\n _inherits(Progress, _FieldComponent);\n var _super = _createSuper(Progress);\n function Progress(component, options, data) {\n _classCallCheck(this, Progress);\n return _super.call(this, component, options, data);\n }\n _createClass(Progress, [{\n key: \"render\",\n value: function render(children) {\n return _get(_getPrototypeOf(Progress.prototype), \"render\", this).call(this, this.renderTemplate('progress'));\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this = this;\n var refs = {\n titleContainer: 'single',\n progressContainer: 'single'\n };\n this.loadRefs(element, refs);\n setTimeout(function () {\n _this.setValue();\n }, 100);\n // Allow basic component functionality to attach like field logic and tooltips.\n return _get(_getPrototypeOf(Progress.prototype), \"attach\", this).call(this, element);\n }\n\n /**\n * Get the value of the component from the dom elements.\n *\n * @returns {Array}\n */\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.component.value;\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n var strTmp = (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n if (strTmp === undefined) {\n strTmp = null;\n } else {\n if (_lodash.default.isArray(strTmp) || _lodash.default.isObject(strTmp)) {\n strTmp = JSON.stringify(strTmp);\n }\n }\n return strTmp;\n });\n }\n\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var _this2 = this;\n if (this.refs.titleContainer) {\n this.refs.titleContainer.innerHTML = \"\";\n }\n if (this.refs.progressContainer) {\n this.refs.progressContainer.innerHTML = \"\";\n }\n var optionsStr = this.component['option-value'];\n try {\n optionsStr = this.parseTpl(optionsStr, {\n data: this.rootValue\n });\n optionsStr = JSON.parse(optionsStr);\n var sum = _lodash.default.sumBy(optionsStr, 'value');\n if (this.component['max-value'] && this.component['max-value'].trim().length > 0) {\n sum = _lodash.default.toNumber(this.parseTpl(this.component['max-value'], {\n data: this.rootValue\n }));\n }\n optionsStr.forEach(function (item) {\n var percent = _lodash.default.floor(_lodash.default.divide(item.value, sum) * 100, 1);\n if (_this2.refs.titleContainer) {\n _this2.refs.titleContainer.insertAdjacentHTML('beforeend', \"<div class=\\\"progress-title-container\\\" style=\\\"display: flex;flex-direction: row;align-items: center;font-size: \".concat(_this2.component['font-size'], \"\\\">\\n <div class=\\\"progress-title-item-indicator\\\" style=\\\"width: 5px;height: 5px;background-color: \").concat(item.color, \";margin-right: 10px\\\"></div>\\n <div class=\\\"progress-title-item-title\\\" style=\\\"color: \").concat(item.color, \"\\\">\").concat(item.title, \"</div>\\n <div class=\\\"progress-title-item-value\\\" style=\\\"font-weight: bold;margin-left: 5px;margin-right: 5px;color: black\\\">\").concat(item.value, \"</div>\\n <div class=\\\"progress-title-item-unit\\\" style=\\\"color: grey\\\">\").concat(item.unit, \"</div>\\n <div class=\\\"progress-title-item-percent\\\" style=\\\"margin-left: 10px;color: grey\\\">\").concat(percent, \"%</div>\\n </div>\"));\n }\n if (_this2.refs.progressContainer) {\n _this2.refs.progressContainer.insertAdjacentHTML('beforeend', \"<div class=\\\"progress-bar\\\" role=\\\"progressbar\\\" style=\\\"width: \".concat(percent, \"%;background-color: \").concat(item.color, \"\\\" aria-valuenow=\\\"\").concat(item.value, \"\\\" aria-valuemin=\\\"0\\\" aria-valuemax=\\\"\").concat(sum, \"\\\"></div>\"));\n }\n });\n } catch (e) {\n console.log('json转换失败', e);\n }\n return true;\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {\n extend[_key] = arguments[_key];\n }\n return _Field.default.schema.apply(_Field.default, [{\n label: 'Progress',\n key: 'progress',\n type: 'progress'\n }].concat(extend));\n }\n }]);\n return Progress;\n}(_Field.default);\nexports[\"default\"] = Progress;\n_defineProperty(Progress, \"builderInfo\", {\n title: 'Progress',\n group: 'advanced',\n icon: 'bars-progress',\n weight: 70,\n documentation: 'http://help.form.io/userguide/#progress',\n schema: Progress.schema()\n});\nProgress.editForm = _Progress.default;\n\n//# sourceURL=webpack://Formio/./lib/components/progress/Progress.js?");
2591
2591
 
2592
2592
  /***/ }),
2593
2593
 
@@ -2620,7 +2620,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
2620
2620
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
2621
2621
 
2622
2622
  "use strict";
2623
- eval("\n\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.from.js */ \"./node_modules/core-js/modules/es.array.from.js\");\n__webpack_require__(/*! core-js/modules/es.array.slice.js */ \"./node_modules/core-js/modules/es.array.slice.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.array.find-index.js */ \"./node_modules/core-js/modules/es.array.find-index.js\");\n__webpack_require__(/*! core-js/modules/es.array.find.js */ \"./node_modules/core-js/modules/es.array.find.js\");\n__webpack_require__(/*! core-js/modules/es.array.map.js */ \"./node_modules/core-js/modules/es.array.map.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nvar _ListComponent2 = _interopRequireDefault(__webpack_require__(/*! ../_classes/list/ListComponent */ \"./lib/components/_classes/list/ListComponent.js\"));\nvar _nativePromiseOnly = _interopRequireDefault(__webpack_require__(/*! native-promise-only */ \"./node_modules/native-promise-only/lib/npo.src.js\"));\nvar _Formio = __webpack_require__(/*! ../../Formio */ \"./lib/Formio.js\");\nvar _utils = __webpack_require__(/*! ../../utils/utils */ \"./lib/utils/utils.js\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar RadioComponent = /*#__PURE__*/function (_ListComponent) {\n _inherits(RadioComponent, _ListComponent);\n var _super = _createSuper(RadioComponent);\n function RadioComponent(component, options, data) {\n var _this;\n _classCallCheck(this, RadioComponent);\n _this = _super.call(this, component, options, data);\n _this.previousValue = _this.dataValue || null;\n return _this;\n }\n _createClass(RadioComponent, [{\n key: \"get\",\n value: function get(path, obj) {\n var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : \"${\".concat(path, \"}\");\n return path.split('.').reduce(function (res, key) {\n return res[key] || fb;\n }, obj);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map, fallback) {\n var _this2 = this;\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n return _this2.get(path, map, fallback);\n });\n }\n }, {\n key: \"defaultSchema\",\n get: function get() {\n return RadioComponent.schema();\n }\n }, {\n key: \"defaultValue\",\n get: function get() {\n var defaultValue = _get(_getPrototypeOf(RadioComponent.prototype), \"defaultValue\", this);\n if (!defaultValue && this.component.defaultValue === false) {\n defaultValue = this.component.defaultValue;\n }\n return defaultValue;\n }\n }, {\n key: \"inputInfo\",\n get: function get() {\n var _this$root;\n var info = _get(_getPrototypeOf(RadioComponent.prototype), \"elementInfo\", this).call(this);\n info.type = 'input';\n info.changeEvent = 'click';\n info.attr.class = 'form-check-input';\n info.attr.name = info.attr.name += \"[\".concat((_this$root = this.root) === null || _this$root === void 0 ? void 0 : _this$root.id, \"-\").concat(this.id, \"]\");\n return info;\n }\n }, {\n key: \"emptyValue\",\n get: function get() {\n return '';\n }\n }, {\n key: \"isRadio\",\n get: function get() {\n return this.component.inputType === 'radio';\n }\n }, {\n key: \"optionSelectedClass\",\n get: function get() {\n return 'radio-selected';\n }\n }, {\n key: \"init\",\n value: function init() {\n var _this3 = this;\n _get(_getPrototypeOf(RadioComponent.prototype), \"init\", this).call(this);\n this.templateData = {};\n this.validators = this.validators.concat(['select', 'onlyAvailableItems']);\n\n // Trigger an update.\n var updateArgs = [];\n var triggerUpdate = _lodash.default.debounce(function () {\n updateArgs = [];\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return _this3.updateItems.apply(_this3, args);\n }, 100);\n this.triggerUpdate = function () {\n // Make sure we always resolve the previous promise before reassign it\n if (typeof _this3.itemsLoadedResolve === 'function') {\n _this3.itemsLoadedResolve();\n }\n _this3.itemsLoaded = new _nativePromiseOnly.default(function (resolve) {\n _this3.itemsLoadedResolve = resolve;\n });\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n if (args.length) {\n updateArgs = args;\n }\n return triggerUpdate.apply(void 0, _toConsumableArray(updateArgs));\n };\n this.itemsLoaded = new _nativePromiseOnly.default(function (resolve) {\n _this3.itemsLoadedResolve = resolve;\n });\n this.shouldLoad = true;\n this.loadedOptions = [];\n }\n }, {\n key: \"render\",\n value: function render() {\n return _get(_getPrototypeOf(RadioComponent.prototype), \"render\", this).call(this, this.renderTemplate('radio', {\n input: this.inputInfo,\n inline: this.component.inline,\n values: this.component.dataSrc === 'values' ? this.component.values : this.loadedOptions,\n value: this.dataValue,\n row: this.row\n }));\n }\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this4 = this;\n this.loadRefs(element, {\n input: 'multiple',\n wrapper: 'multiple'\n });\n this.refs.input.forEach(function (input, index) {\n _this4.addEventListener(input, _this4.inputInfo.changeEvent, function () {\n _this4.updateValue(null, {\n modified: true\n });\n });\n if (_this4.component.values[index]) {\n _this4.addShortcut(input, _this4.component.values[index].shortcut);\n }\n if (_this4.isRadio) {\n var dataValue = _this4.dataValue;\n if (!_lodash.default.isString(_this4.dataValue)) {\n dataValue = _lodash.default.toString(_this4.dataValue);\n }\n input.checked = dataValue === input.value;\n _this4.addEventListener(input, 'keyup', function (event) {\n if (event.key === ' ' && dataValue === input.value) {\n event.preventDefault();\n _this4.updateValue(null, {\n modified: true\n });\n }\n });\n }\n });\n this.triggerUpdate();\n this.setSelectedClasses();\n return _get(_getPrototypeOf(RadioComponent.prototype), \"attach\", this).call(this, element);\n }\n }, {\n key: \"detach\",\n value: function detach(element) {\n var _this5 = this;\n if (element && this.refs.input) {\n this.refs.input.forEach(function (input, index) {\n if (_this5.component.values[index]) {\n _this5.removeShortcut(input, _this5.component.values[index].shortcut);\n }\n });\n }\n _get(_getPrototypeOf(RadioComponent.prototype), \"detach\", this).call(this);\n }\n }, {\n key: \"getValue\",\n value: function getValue() {\n if (this.viewOnly || !this.refs.input || !this.refs.input.length) {\n return this.dataValue;\n }\n var value = this.dataValue;\n this.refs.input.forEach(function (input) {\n if (input.checked) {\n value = input.value;\n }\n });\n return value;\n }\n }, {\n key: \"validateValueAvailability\",\n value: function validateValueAvailability(setting, value) {\n var _this6 = this;\n if (!(0, _utils.boolValue)(setting) || !value) {\n return true;\n }\n var values = this.component.values;\n if (values) {\n return values.findIndex(function (_ref) {\n var optionValue = _ref.value;\n return _this6.normalizeValue(optionValue) === value;\n }) !== -1;\n }\n return false;\n }\n }, {\n key: \"getValueAsString\",\n value: function getValueAsString(value) {\n if (!_lodash.default.isString(value)) {\n value = _lodash.default.toString(value);\n }\n if (this.component.dataSrc !== 'values') {\n return value;\n }\n var option = _lodash.default.find(this.component.values, function (v) {\n return v.value === value;\n });\n if (!value) {\n return _lodash.default.get(option, 'label', '');\n }\n return _lodash.default.get(option, 'label', '');\n }\n }, {\n key: \"setValueAt\",\n value: function setValueAt(index, value) {\n if (this.refs.input && this.refs.input[index] && value !== null && value !== undefined) {\n var inputValue = this.refs.input[index].value;\n this.refs.input[index].checked = inputValue === value.toString();\n }\n }\n }, {\n key: \"loadItems\",\n value: function loadItems(url, search, headers, options, method, body) {\n var _this7 = this;\n // Ensure we have a method and remove any body if method is get\n method = method || 'GET';\n if (method.toUpperCase() === 'GET') {\n body = null;\n }\n\n // Set ignoreCache if it is\n options.ignoreCache = this.component.ignoreCache;\n // Make the request.\n options.header = headers;\n try {\n url = this.parseTpl(url, {\n data: this.rootValue\n }, null);\n } catch (e) {\n console.log(e);\n }\n if (this.shouldLoad || url !== this.loadedUrl) {\n this.loading = true;\n _Formio.GlobalFormio.makeRequest(this.options.formio, 'select', url, method, body, options).then(function (response) {\n _this7.loading = false;\n _this7.error = null;\n // If they provided select values, then we need to get them instead.\n var items = response;\n if (_this7.component.selectValues) {\n items = _lodash.default.get(items, _this7.component.selectValues, items) || [];\n }\n _this7.setItems(items);\n // 缓存当前选项的url,判断下次是否刷新\n _this7.loadedUrl = url;\n _this7.shouldLoad = false;\n _this7.redraw();\n }).catch(function (err) {\n console.log(err);\n _this7.handleLoadingError(err);\n });\n }\n }\n }, {\n key: \"setItems\",\n value: function setItems(items) {\n var _this8 = this;\n this.loadedOptions = items === null || items === void 0 ? void 0 : items.map(function (item) {\n return {\n value: item[_this8.component.valueProperty],\n label: _this8.itemTemplate(item, item[_this8.component.valueProperty])\n };\n });\n }\n }, {\n key: \"setSelectedClasses\",\n value: function setSelectedClasses() {\n var _this9 = this;\n if (this.refs.wrapper) {\n //add/remove selected option class\n var value = this.dataValue;\n this.refs.wrapper.forEach(function (wrapper, index) {\n var input = _this9.refs.input[index];\n var checked = input.type === 'checkbox' ? value[input.value] : input.value.toString() === value.toString();\n if (checked) {\n //add class to container when selected\n _this9.addClass(wrapper, _this9.optionSelectedClass);\n //change \"checked\" attribute\n input.setAttribute('checked', 'true');\n } else {\n _this9.removeClass(wrapper, _this9.optionSelectedClass);\n input.removeAttribute('checked');\n }\n });\n }\n }\n }, {\n key: \"updateValue\",\n value: function updateValue(value, flags) {\n var changed = _get(_getPrototypeOf(RadioComponent.prototype), \"updateValue\", this).call(this, value, flags);\n if (changed) {\n this.setSelectedClasses();\n }\n if (!flags || !flags.modified && value === this.defaultValue || !this.isRadio) {\n if (changed) {\n this.previousValue = this.dataValue;\n }\n return changed;\n }\n\n // If they clicked on the radio that is currently selected, it needs to reset the value.\n this.currentValue = this.dataValue;\n var shouldResetValue = flags && flags.modified && !flags.noUpdateEvent && this.previousValue === this.currentValue;\n if (shouldResetValue) {\n this.resetValue();\n this.triggerChange(flags);\n }\n this.previousValue = this.dataValue;\n return changed;\n }\n\n /**\n * Normalize values coming into updateValue.\n *\n * @param value\n * @return {*}\n */\n }, {\n key: \"normalizeValue\",\n value: function normalizeValue(value) {\n var dataType = this.component.dataType || 'auto';\n if (value === this.emptyValue) {\n return value;\n }\n switch (dataType) {\n case 'auto':\n if (!isNaN(parseFloat(value)) && isFinite(value)) {\n value = +value;\n }\n if (value === 'true') {\n value = true;\n }\n if (value === 'false') {\n value = false;\n }\n break;\n case 'number':\n value = +value;\n break;\n case 'string':\n if (_typeof(value) === 'object') {\n value = JSON.stringify(value);\n } else {\n value = String(value);\n }\n break;\n case 'boolean':\n value = !(!value || value.toString() === 'false');\n break;\n }\n return _get(_getPrototypeOf(RadioComponent.prototype), \"normalizeValue\", this).call(this, value);\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len3 = arguments.length, extend = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n extend[_key3] = arguments[_key3];\n }\n return _ListComponent2.default.schema.apply(_ListComponent2.default, [{\n type: 'radio',\n inputType: 'radio',\n label: 'Radio',\n key: 'radio',\n values: [{\n label: '',\n value: ''\n }],\n data: {\n url: ''\n },\n fieldSet: false\n }].concat(extend));\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Radio',\n group: 'basic',\n icon: 'dot-circle-o',\n weight: 80,\n documentation: '/userguide/forms/form-components#radio',\n schema: RadioComponent.schema()\n };\n }\n }]);\n return RadioComponent;\n}(_ListComponent2.default);\nexports[\"default\"] = RadioComponent;\n\n//# sourceURL=webpack://Formio/./lib/components/radio/Radio.js?");
2623
+ eval("\n\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.from.js */ \"./node_modules/core-js/modules/es.array.from.js\");\n__webpack_require__(/*! core-js/modules/es.array.slice.js */ \"./node_modules/core-js/modules/es.array.slice.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.array.find-index.js */ \"./node_modules/core-js/modules/es.array.find-index.js\");\n__webpack_require__(/*! core-js/modules/es.array.find.js */ \"./node_modules/core-js/modules/es.array.find.js\");\n__webpack_require__(/*! core-js/modules/es.array.map.js */ \"./node_modules/core-js/modules/es.array.map.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nvar _ListComponent2 = _interopRequireDefault(__webpack_require__(/*! ../_classes/list/ListComponent */ \"./lib/components/_classes/list/ListComponent.js\"));\nvar _nativePromiseOnly = _interopRequireDefault(__webpack_require__(/*! native-promise-only */ \"./node_modules/native-promise-only/lib/npo.src.js\"));\nvar _Formio = __webpack_require__(/*! ../../Formio */ \"./lib/Formio.js\");\nvar _utils = __webpack_require__(/*! ../../utils/utils */ \"./lib/utils/utils.js\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar RadioComponent = /*#__PURE__*/function (_ListComponent) {\n _inherits(RadioComponent, _ListComponent);\n var _super = _createSuper(RadioComponent);\n function RadioComponent(component, options, data) {\n var _this;\n _classCallCheck(this, RadioComponent);\n _this = _super.call(this, component, options, data);\n _this.previousValue = _this.dataValue || null;\n return _this;\n }\n _createClass(RadioComponent, [{\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n });\n }\n }, {\n key: \"defaultSchema\",\n get: function get() {\n return RadioComponent.schema();\n }\n }, {\n key: \"defaultValue\",\n get: function get() {\n var defaultValue = _get(_getPrototypeOf(RadioComponent.prototype), \"defaultValue\", this);\n if (!defaultValue && this.component.defaultValue === false) {\n defaultValue = this.component.defaultValue;\n }\n return defaultValue;\n }\n }, {\n key: \"inputInfo\",\n get: function get() {\n var _this$root;\n var info = _get(_getPrototypeOf(RadioComponent.prototype), \"elementInfo\", this).call(this);\n info.type = 'input';\n info.changeEvent = 'click';\n info.attr.class = 'form-check-input';\n info.attr.name = info.attr.name += \"[\".concat((_this$root = this.root) === null || _this$root === void 0 ? void 0 : _this$root.id, \"-\").concat(this.id, \"]\");\n return info;\n }\n }, {\n key: \"emptyValue\",\n get: function get() {\n return '';\n }\n }, {\n key: \"isRadio\",\n get: function get() {\n return this.component.inputType === 'radio';\n }\n }, {\n key: \"optionSelectedClass\",\n get: function get() {\n return 'radio-selected';\n }\n }, {\n key: \"init\",\n value: function init() {\n var _this2 = this;\n _get(_getPrototypeOf(RadioComponent.prototype), \"init\", this).call(this);\n this.templateData = {};\n this.validators = this.validators.concat(['select', 'onlyAvailableItems']);\n\n // Trigger an update.\n var updateArgs = [];\n var triggerUpdate = _lodash.default.debounce(function () {\n updateArgs = [];\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return _this2.updateItems.apply(_this2, args);\n }, 100);\n this.triggerUpdate = function () {\n // Make sure we always resolve the previous promise before reassign it\n if (typeof _this2.itemsLoadedResolve === 'function') {\n _this2.itemsLoadedResolve();\n }\n _this2.itemsLoaded = new _nativePromiseOnly.default(function (resolve) {\n _this2.itemsLoadedResolve = resolve;\n });\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n if (args.length) {\n updateArgs = args;\n }\n return triggerUpdate.apply(void 0, _toConsumableArray(updateArgs));\n };\n this.itemsLoaded = new _nativePromiseOnly.default(function (resolve) {\n _this2.itemsLoadedResolve = resolve;\n });\n this.shouldLoad = true;\n this.loadedOptions = [];\n }\n }, {\n key: \"render\",\n value: function render() {\n return _get(_getPrototypeOf(RadioComponent.prototype), \"render\", this).call(this, this.renderTemplate('radio', {\n input: this.inputInfo,\n inline: this.component.inline,\n values: this.component.dataSrc === 'values' ? this.component.values : this.loadedOptions,\n value: this.dataValue,\n row: this.row\n }));\n }\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this3 = this;\n this.loadRefs(element, {\n input: 'multiple',\n wrapper: 'multiple'\n });\n this.refs.input.forEach(function (input, index) {\n _this3.addEventListener(input, _this3.inputInfo.changeEvent, function () {\n _this3.updateValue(null, {\n modified: true\n });\n });\n if (_this3.component.values[index]) {\n _this3.addShortcut(input, _this3.component.values[index].shortcut);\n }\n if (_this3.isRadio) {\n var dataValue = _this3.dataValue;\n if (!_lodash.default.isString(_this3.dataValue)) {\n dataValue = _lodash.default.toString(_this3.dataValue);\n }\n input.checked = dataValue === input.value;\n _this3.addEventListener(input, 'keyup', function (event) {\n if (event.key === ' ' && dataValue === input.value) {\n event.preventDefault();\n _this3.updateValue(null, {\n modified: true\n });\n }\n });\n }\n });\n this.triggerUpdate();\n this.setSelectedClasses();\n return _get(_getPrototypeOf(RadioComponent.prototype), \"attach\", this).call(this, element);\n }\n }, {\n key: \"detach\",\n value: function detach(element) {\n var _this4 = this;\n if (element && this.refs.input) {\n this.refs.input.forEach(function (input, index) {\n if (_this4.component.values[index]) {\n _this4.removeShortcut(input, _this4.component.values[index].shortcut);\n }\n });\n }\n _get(_getPrototypeOf(RadioComponent.prototype), \"detach\", this).call(this);\n }\n }, {\n key: \"getValue\",\n value: function getValue() {\n if (this.viewOnly || !this.refs.input || !this.refs.input.length) {\n return this.dataValue;\n }\n var value = this.dataValue;\n this.refs.input.forEach(function (input) {\n if (input.checked) {\n value = input.value;\n }\n });\n return value;\n }\n }, {\n key: \"validateValueAvailability\",\n value: function validateValueAvailability(setting, value) {\n var _this5 = this;\n if (!(0, _utils.boolValue)(setting) || !value) {\n return true;\n }\n var values = this.component.values;\n if (values) {\n return values.findIndex(function (_ref) {\n var optionValue = _ref.value;\n return _this5.normalizeValue(optionValue) === value;\n }) !== -1;\n }\n return false;\n }\n }, {\n key: \"getValueAsString\",\n value: function getValueAsString(value) {\n if (!_lodash.default.isString(value)) {\n value = _lodash.default.toString(value);\n }\n if (this.component.dataSrc !== 'values') {\n return value;\n }\n var option = _lodash.default.find(this.component.values, function (v) {\n return v.value === value;\n });\n if (!value) {\n return _lodash.default.get(option, 'label', '');\n }\n return _lodash.default.get(option, 'label', '');\n }\n }, {\n key: \"setValueAt\",\n value: function setValueAt(index, value) {\n if (this.refs.input && this.refs.input[index] && value !== null && value !== undefined) {\n var inputValue = this.refs.input[index].value;\n this.refs.input[index].checked = inputValue === value.toString();\n }\n }\n }, {\n key: \"loadItems\",\n value: function loadItems(url, search, headers, options, method, body) {\n var _this6 = this;\n // Ensure we have a method and remove any body if method is get\n method = method || 'GET';\n if (method.toUpperCase() === 'GET') {\n body = null;\n }\n\n // Set ignoreCache if it is\n options.ignoreCache = this.component.ignoreCache;\n // Make the request.\n options.header = headers;\n try {\n url = this.parseTpl(url, {\n data: this.rootValue\n });\n } catch (e) {\n console.log(e);\n }\n if (this.shouldLoad || url !== this.loadedUrl) {\n this.loading = true;\n _Formio.GlobalFormio.makeRequest(this.options.formio, 'select', url, method, body, options).then(function (response) {\n _this6.loading = false;\n _this6.error = null;\n // If they provided select values, then we need to get them instead.\n var items = response;\n if (_this6.component.selectValues) {\n items = _lodash.default.get(items, _this6.component.selectValues, items) || [];\n }\n _this6.setItems(items);\n // 缓存当前选项的url,判断下次是否刷新\n _this6.loadedUrl = url;\n _this6.shouldLoad = false;\n _this6.redraw();\n }).catch(function (err) {\n console.log(err);\n _this6.handleLoadingError(err);\n });\n }\n }\n }, {\n key: \"setItems\",\n value: function setItems(items) {\n var _this7 = this;\n this.loadedOptions = items === null || items === void 0 ? void 0 : items.map(function (item) {\n return {\n value: item[_this7.component.valueProperty],\n label: _this7.itemTemplate(item, item[_this7.component.valueProperty])\n };\n });\n }\n }, {\n key: \"setSelectedClasses\",\n value: function setSelectedClasses() {\n var _this8 = this;\n if (this.refs.wrapper) {\n //add/remove selected option class\n var value = this.dataValue;\n this.refs.wrapper.forEach(function (wrapper, index) {\n var input = _this8.refs.input[index];\n var checked = input.type === 'checkbox' ? value[input.value] : input.value.toString() === value.toString();\n if (checked) {\n //add class to container when selected\n _this8.addClass(wrapper, _this8.optionSelectedClass);\n //change \"checked\" attribute\n input.setAttribute('checked', 'true');\n } else {\n _this8.removeClass(wrapper, _this8.optionSelectedClass);\n input.removeAttribute('checked');\n }\n });\n }\n }\n }, {\n key: \"updateValue\",\n value: function updateValue(value, flags) {\n var changed = _get(_getPrototypeOf(RadioComponent.prototype), \"updateValue\", this).call(this, value, flags);\n if (changed) {\n this.setSelectedClasses();\n }\n if (!flags || !flags.modified && value === this.defaultValue || !this.isRadio) {\n if (changed) {\n this.previousValue = this.dataValue;\n }\n return changed;\n }\n\n // If they clicked on the radio that is currently selected, it needs to reset the value.\n this.currentValue = this.dataValue;\n var shouldResetValue = flags && flags.modified && !flags.noUpdateEvent && this.previousValue === this.currentValue;\n if (shouldResetValue) {\n this.resetValue();\n this.triggerChange(flags);\n }\n this.previousValue = this.dataValue;\n return changed;\n }\n\n /**\n * Normalize values coming into updateValue.\n *\n * @param value\n * @return {*}\n */\n }, {\n key: \"normalizeValue\",\n value: function normalizeValue(value) {\n var dataType = this.component.dataType || 'auto';\n if (value === this.emptyValue) {\n return value;\n }\n switch (dataType) {\n case 'auto':\n if (!isNaN(parseFloat(value)) && isFinite(value)) {\n value = +value;\n }\n if (value === 'true') {\n value = true;\n }\n if (value === 'false') {\n value = false;\n }\n break;\n case 'number':\n value = +value;\n break;\n case 'string':\n if (_typeof(value) === 'object') {\n value = JSON.stringify(value);\n } else {\n value = String(value);\n }\n break;\n case 'boolean':\n value = !(!value || value.toString() === 'false');\n break;\n }\n return _get(_getPrototypeOf(RadioComponent.prototype), \"normalizeValue\", this).call(this, value);\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len3 = arguments.length, extend = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n extend[_key3] = arguments[_key3];\n }\n return _ListComponent2.default.schema.apply(_ListComponent2.default, [{\n type: 'radio',\n inputType: 'radio',\n label: 'Radio',\n key: 'radio',\n values: [{\n label: '',\n value: ''\n }],\n data: {\n url: ''\n },\n fieldSet: false\n }].concat(extend));\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Radio',\n group: 'basic',\n icon: 'dot-circle-o',\n weight: 80,\n documentation: '/userguide/forms/form-components#radio',\n schema: RadioComponent.schema()\n };\n }\n }]);\n return RadioComponent;\n}(_ListComponent2.default);\nexports[\"default\"] = RadioComponent;\n\n//# sourceURL=webpack://Formio/./lib/components/radio/Radio.js?");
2624
2624
 
2625
2625
  /***/ }),
2626
2626
 
@@ -2741,7 +2741,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
2741
2741
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
2742
2742
 
2743
2743
  "use strict";
2744
- eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.set.js */ \"./node_modules/core-js/modules/es.reflect.set.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.from.js */ \"./node_modules/core-js/modules/es.array.from.js\");\n__webpack_require__(/*! core-js/modules/es.array.slice.js */ \"./node_modules/core-js/modules/es.array.slice.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptors.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptors.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.array.find.js */ \"./node_modules/core-js/modules/es.array.find.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.array.map.js */ \"./node_modules/core-js/modules/es.array.map.js\");\n__webpack_require__(/*! core-js/modules/es.array.join.js */ \"./node_modules/core-js/modules/es.array.join.js\");\n__webpack_require__(/*! core-js/modules/es.string.match.js */ \"./node_modules/core-js/modules/es.string.match.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.array.sort.js */ \"./node_modules/core-js/modules/es.array.sort.js\");\n__webpack_require__(/*! core-js/modules/es.array.includes.js */ \"./node_modules/core-js/modules/es.array.includes.js\");\n__webpack_require__(/*! core-js/modules/es.string.includes.js */ \"./node_modules/core-js/modules/es.string.includes.js\");\n__webpack_require__(/*! core-js/modules/es.array.filter.js */ \"./node_modules/core-js/modules/es.array.filter.js\");\n__webpack_require__(/*! core-js/modules/es.object.assign.js */ \"./node_modules/core-js/modules/es.object.assign.js\");\n__webpack_require__(/*! core-js/modules/es.object.keys.js */ \"./node_modules/core-js/modules/es.object.keys.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.number.is-nan.js */ \"./node_modules/core-js/modules/es.number.is-nan.js\");\n__webpack_require__(/*! core-js/modules/es.number.is-finite.js */ \"./node_modules/core-js/modules/es.number.is-finite.js\");\n__webpack_require__(/*! core-js/modules/es.array.find-index.js */ \"./node_modules/core-js/modules/es.array.find-index.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nvar _Formio = __webpack_require__(/*! ../../Formio */ \"./lib/Formio.js\");\nvar _ListComponent2 = _interopRequireDefault(__webpack_require__(/*! ../_classes/list/ListComponent */ \"./lib/components/_classes/list/ListComponent.js\"));\nvar _Form = _interopRequireDefault(__webpack_require__(/*! ../../Form */ \"./lib/Form.js\"));\nvar _nativePromiseOnly = _interopRequireDefault(__webpack_require__(/*! native-promise-only */ \"./node_modules/native-promise-only/lib/npo.src.js\"));\nvar _utils = __webpack_require__(/*! ../../utils/utils */ \"./lib/utils/utils.js\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction set(target, property, value, receiver) { if (typeof Reflect !== \"undefined\" && Reflect.set) { set = Reflect.set; } else { set = function set(target, property, value, receiver) { var base = _superPropBase(target, property); var desc; if (base) { desc = Object.getOwnPropertyDescriptor(base, property); if (desc.set) { desc.set.call(receiver, value); return true; } else if (!desc.writable) { return false; } } desc = Object.getOwnPropertyDescriptor(receiver, property); if (desc) { if (!desc.writable) { return false; } desc.value = value; Object.defineProperty(receiver, property, desc); } else { _defineProperty(receiver, property, value); } return true; }; } return set(target, property, value, receiver); }\nfunction _set(target, property, value, receiver, isStrict) { var s = set(target, property, value, receiver || target); if (!s && isStrict) { throw new TypeError('failed to set property'); } return value; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar Choices;\nif (typeof window !== 'undefined') {\n Choices = (__webpack_require__(/*! ../../utils/ChoicesWrapper */ \"./lib/utils/ChoicesWrapper.js\")[\"default\"]);\n}\nvar SelectComponent = /*#__PURE__*/function (_ListComponent) {\n _inherits(SelectComponent, _ListComponent);\n var _super = _createSuper(SelectComponent);\n function SelectComponent() {\n _classCallCheck(this, SelectComponent);\n return _super.apply(this, arguments);\n }\n _createClass(SelectComponent, [{\n key: \"get\",\n value: function get(path, obj) {\n var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : \"${\".concat(path, \"}\");\n return path.split('.').reduce(function (res, key) {\n return res[key] || fb;\n }, obj);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map, fallback) {\n var _this = this;\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n return _this.get(path, map, fallback);\n });\n }\n }, {\n key: \"init\",\n value: function init() {\n var _this2 = this;\n _get(_getPrototypeOf(SelectComponent.prototype), \"init\", this).call(this);\n this.templateData = {};\n this.validators = this.validators.concat(['select', 'onlyAvailableItems']);\n\n // Trigger an update.\n var updateArgs = [];\n var triggerUpdate = _lodash.default.debounce(function () {\n updateArgs = [];\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return _this2.updateItems.apply(_this2, args);\n }, 100);\n this.triggerUpdate = function () {\n // Make sure we always resolve the previous promise before reassign it\n if (typeof _this2.itemsLoadedResolve === 'function') {\n _this2.itemsLoadedResolve();\n }\n _this2.itemsLoaded = new _nativePromiseOnly.default(function (resolve) {\n _this2.itemsLoadedResolve = resolve;\n });\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n if (args.length) {\n updateArgs = args;\n }\n return triggerUpdate.apply(void 0, _toConsumableArray(updateArgs));\n };\n\n // Keep track of the select options.\n this.selectOptions = [];\n if (this.itemsFromUrl) {\n this.isFromSearch = false;\n this.searchServerCount = null;\n this.defaultServerCount = null;\n this.isScrollLoading = false;\n this.searchDownloadedResources = [];\n this.defaultDownloadedResources = [];\n }\n\n // If this component has been activated.\n this.activated = false;\n this.itemsLoaded = new _nativePromiseOnly.default(function (resolve) {\n _this2.itemsLoadedResolve = resolve;\n });\n this.shouldPositionDropdown = this.hasDataGridAncestor();\n if (this.isHtmlRenderMode()) {\n this.activate();\n }\n\n // Get the template keys for this select component.\n this.getTemplateKeys();\n }\n }, {\n key: \"dataReady\",\n get: function get() {\n // If the root submission has been set, and we are still not attached, then assume\n // that our data is ready.\n if (this.root && this.root.submissionSet && !this.attached) {\n return _nativePromiseOnly.default.resolve();\n }\n return this.itemsLoaded;\n }\n }, {\n key: \"defaultSchema\",\n get: function get() {\n return SelectComponent.schema();\n }\n }, {\n key: \"emptyValue\",\n get: function get() {\n if (this.component.multiple) {\n return [];\n }\n // if select has JSON data source type, we are defining if empty value would be an object or a string by checking JSON's first item\n if (this.component.dataSrc === 'json' && this.component.data.json) {\n var firstItem = this.component.data.json[0];\n var firstValue;\n if (this.valueProperty) {\n firstValue = _lodash.default.get(firstItem, this.valueProperty);\n } else {\n firstValue = firstItem;\n }\n if (firstValue && typeof firstValue === 'string') {\n return '';\n } else {\n return {};\n }\n }\n if (this.valueProperty) {\n return '';\n }\n return {};\n }\n }, {\n key: \"valueProperty\",\n get: function get() {\n if (this.component.valueProperty) {\n return this.component.valueProperty;\n }\n // Force values datasource to use values without actually setting it on the component settings.\n if (this.component.dataSrc === 'values') {\n return 'value';\n }\n return '';\n }\n }, {\n key: \"inputInfo\",\n get: function get() {\n var info = _get(_getPrototypeOf(SelectComponent.prototype), \"elementInfo\", this).call(this);\n info.type = 'select';\n info.changeEvent = 'change';\n return info;\n }\n }, {\n key: \"isSelectResource\",\n get: function get() {\n return this.component.dataSrc === 'resource';\n }\n }, {\n key: \"itemsFromUrl\",\n get: function get() {\n return this.isSelectResource || this.isSelectURL;\n }\n }, {\n key: \"isInfiniteScrollProvided\",\n get: function get() {\n return this.itemsFromUrl;\n }\n }, {\n key: \"shouldDisabled\",\n get: function get() {\n return _get(_getPrototypeOf(SelectComponent.prototype), \"shouldDisabled\", this) || this.parentDisabled;\n }\n }, {\n key: \"isEntireObjectDisplay\",\n value: function isEntireObjectDisplay() {\n return this.component.dataSrc === 'resource' && this.valueProperty === 'data';\n }\n }, {\n key: \"selectValueAndLabel\",\n value: function selectValueAndLabel(data) {\n var value = this.getOptionValue(this.itemValue(data));\n return {\n value: value,\n label: this.itemTemplate(data, value)\n };\n }\n }, {\n key: \"itemTemplate\",\n value: function itemTemplate(data, value) {\n if (!_lodash.default.isNumber(data) && _lodash.default.isEmpty(data)) {\n return '';\n }\n\n // If they wish to show the value in read only mode, then just return the itemValue here.\n if (this.options.readOnly && this.component.readOnlyValue) {\n return this.itemValue(data);\n }\n // Perform a fast interpretation if we should not use the template.\n if (data && !this.component.template) {\n var itemLabel = data.label || data;\n var _value = typeof itemLabel === 'string' ? this.t(itemLabel, {\n _userInput: true\n }) : itemLabel;\n return this.sanitize(_value, this.shouldSanitizeValue);\n }\n if (this.component.multiple ? this.dataValue.find(function (val) {\n return value === val;\n }) : this.dataValue === value) {\n var selectData = this.selectData;\n if (selectData) {\n var templateValue = this.component.reference && value !== null && value !== void 0 && value._id ? value._id.toString() : value;\n if (!this.templateData || !this.templateData[templateValue]) {\n this.getOptionTemplate(data, value);\n }\n if (this.component.multiple) {\n if (selectData[templateValue]) {\n data = selectData[templateValue];\n }\n } else {\n data = selectData;\n }\n }\n }\n if (typeof data === 'string' || typeof data === 'number') {\n return this.sanitize(this.t(data, {\n _userInput: true\n }), this.shouldSanitizeValue);\n }\n if (data.data) {\n // checking additional fields in the template for the selected Entire Object option\n var hasNestedFields = /item\\.data\\.\\w*/g.test(this.component.template);\n data.data = this.isEntireObjectDisplay() && _lodash.default.isObject(data.data) && !hasNestedFields ? JSON.stringify(data.data) : data.data;\n }\n return _get(_getPrototypeOf(SelectComponent.prototype), \"itemTemplate\", this).call(this, data, value);\n }\n\n /**\n * Adds an option to the select dropdown.\n *\n * @param value\n * @param label\n */\n }, {\n key: \"addOption\",\n value: function addOption(value, label) {\n var attrs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var id = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : (0, _utils.getRandomComponentId)();\n if (_lodash.default.isNil(label)) return;\n var idPath = this.component.idPath ? this.component.idPath.split('.').reduceRight(function (obj, key) {\n return _defineProperty({}, key, obj);\n }, id) : {};\n var option = _objectSpread({\n value: this.getOptionValue(value),\n label: label\n }, idPath);\n var skipOption = this.component.uniqueOptions ? !!this.selectOptions.find(function (selectOption) {\n return _lodash.default.isEqual(selectOption.value, option.value);\n }) : false;\n if (skipOption) {\n return;\n }\n if (value) {\n this.selectOptions.push(option);\n }\n if (this.refs.selectContainer && this.component.widget === 'html5') {\n // Replace an empty Object value to an empty String.\n if (option.value && _lodash.default.isObject(option.value) && _lodash.default.isEmpty(option.value)) {\n option.value = '';\n }\n // Add element to option so we can reference it later.\n var div = document.createElement('div');\n div.innerHTML = this.sanitize(this.renderTemplate('selectOption', {\n selected: _lodash.default.isEqual(this.getOptionValue(this.dataValue), option.value),\n option: option,\n attrs: attrs,\n id: id,\n useId: this.valueProperty === '' && _lodash.default.isObject(value) && id\n }), this.shouldSanitizeValue).trim();\n option.element = div.firstChild;\n this.refs.selectContainer.appendChild(option.element);\n }\n }\n }, {\n key: \"addValueOptions\",\n value: function addValueOptions(items) {\n items = items || [];\n var added = false;\n if (!this.selectOptions.length) {\n // Add the currently selected choices if they don't already exist.\n var currentChoices = Array.isArray(this.dataValue) ? this.dataValue : [this.dataValue];\n added = this.addCurrentChoices(currentChoices, items);\n if (!added && !this.component.multiple) {\n this.addPlaceholder();\n }\n }\n return added;\n }\n }, {\n key: \"disableInfiniteScroll\",\n value: function disableInfiniteScroll() {\n if (!this.downloadedResources) {\n return;\n }\n this.downloadedResources.serverCount = this.downloadedResources.length;\n this.serverCount = this.downloadedResources.length;\n }\n\n /* eslint-disable max-statements */\n }, {\n key: \"setItems\",\n value: function setItems(items, fromSearch) {\n var _this3 = this,\n _this$choices,\n _this$choices$input;\n // If the items is a string, then parse as JSON.\n if (typeof items == 'string') {\n try {\n items = JSON.parse(items);\n } catch (err) {\n console.warn(err.message);\n items = [];\n }\n }\n\n // Allow js processing (needed for form builder)\n if (this.component.onSetItems && typeof this.component.onSetItems === 'function') {\n var newItems = this.component.onSetItems(this, items);\n if (newItems) {\n items = newItems;\n }\n }\n if (!this.choices && this.refs.selectContainer) {\n this.empty(this.refs.selectContainer);\n }\n\n // If they provided select values, then we need to get them instead.\n if (this.component.selectValues) {\n items = _lodash.default.get(items, this.component.selectValues, items) || [];\n }\n var areItemsEqual;\n if (this.itemsFromUrl) {\n areItemsEqual = this.isSelectURL ? _lodash.default.isEqual(items, this.downloadedResources) : false;\n var areItemsEnded = this.component.limit > items.length;\n var areItemsDownloaded = areItemsEqual && this.downloadedResources && this.downloadedResources.length === items.length;\n if (areItemsEnded) {\n this.disableInfiniteScroll();\n } else if (areItemsDownloaded) {\n this.selectOptions = [];\n } else {\n this.serverCount = items.serverCount;\n }\n }\n if (this.isScrollLoading && items) {\n if (!areItemsEqual) {\n this.downloadedResources = this.downloadedResources ? this.downloadedResources.concat(items) : items;\n }\n this.downloadedResources.serverCount = items.serverCount || this.downloadedResources.serverCount;\n } else {\n this.downloadedResources = items || [];\n this.selectOptions = [];\n // If there is new select option with same id as already selected, set the new one\n if (!_lodash.default.isEmpty(this.dataValue) && this.component.idPath) {\n var selectedOptionId = _lodash.default.get(this.dataValue, this.component.idPath, null);\n var newOptionWithSameId = !_lodash.default.isNil(selectedOptionId) && items.find(function (item) {\n var itemId = _lodash.default.get(item, _this3.component.idPath);\n return itemId === selectedOptionId;\n });\n if (newOptionWithSameId) {\n this.setValue(newOptionWithSameId);\n }\n }\n }\n\n // Add the value options.\n if (!fromSearch) {\n this.addValueOptions(items);\n }\n if (this.component.widget === 'html5' && !this.component.placeholder) {\n this.addOption(null, '');\n }\n\n // Iterate through each of the items.\n _lodash.default.each(items, function (item, index) {\n // preventing references of the components inside the form to the parent form when building forms\n if (_this3.root && _this3.root.options.editForm && _this3.root.options.editForm._id && _this3.root.options.editForm._id === item._id) return;\n var itemValueAndLabel = _this3.selectValueAndLabel(item);\n _this3.addOption(itemValueAndLabel.value, itemValueAndLabel.label, {}, _lodash.default.get(item, _this3.component.idPath, String(index)));\n });\n if (this.choices) {\n this.choices.setChoices(this.selectOptions, 'value', 'label', true);\n } else if (this.loading) {\n // Re-attach select input.\n // this.appendTo(this.refs.input[0], this.selectContainer);\n }\n\n // We are no longer loading.\n this.isScrollLoading = false;\n this.loading = false;\n var searching = fromSearch && ((_this$choices = this.choices) === null || _this$choices === void 0 ? void 0 : (_this$choices$input = _this$choices.input) === null || _this$choices$input === void 0 ? void 0 : _this$choices$input.isFocussed);\n if (!searching) {\n // If a value is provided, then select it.\n if (!this.isEmpty()) {\n this.setValue(this.dataValue, {\n noUpdateEvent: true\n });\n } else if (this.shouldAddDefaultValue && !this.options.readOnly) {\n // If a default value is provided then select it.\n var defaultValue = this.defaultValue;\n if (!this.isEmpty(defaultValue)) {\n this.setValue(defaultValue);\n }\n }\n }\n\n // Say we are done loading the items.\n this.itemsLoadedResolve();\n }\n }, {\n key: \"getSingleItemValueForHTMLMode\",\n value: function getSingleItemValueForHTMLMode(data) {\n var _this$selectOptions;\n var option = (_this$selectOptions = this.selectOptions) === null || _this$selectOptions === void 0 ? void 0 : _this$selectOptions.find(function (_ref2) {\n var value = _ref2.value;\n return _lodash.default.isEqual(value, data);\n });\n if (option) {\n return option.label || data;\n }\n return data;\n }\n }, {\n key: \"itemValueForHTMLMode\",\n value: function itemValueForHTMLMode(value) {\n var _this4 = this;\n if (!this.isHtmlRenderMode()) {\n return _get(_getPrototypeOf(SelectComponent.prototype), \"itemValueForHTMLMode\", this).call(this, value);\n }\n if (Array.isArray(value)) {\n var values = value.map(function (item) {\n return Array.isArray(item) ? _this4.itemValueForHTMLMode(item) : _this4.getSingleItemValueForHTMLMode(item);\n });\n return values.join(', ');\n }\n return this.getSingleItemValueForHTMLMode(value);\n }\n\n /* eslint-enable max-statements */\n }, {\n key: \"defaultValue\",\n get: function get() {\n var defaultValue = _get(_getPrototypeOf(SelectComponent.prototype), \"defaultValue\", this);\n if (!defaultValue && (this.component.defaultValue === false || this.component.defaultValue === 0)) {\n defaultValue = this.component.defaultValue;\n }\n return defaultValue;\n }\n }, {\n key: \"getTemplateKeys\",\n value: function getTemplateKeys() {\n var _this5 = this;\n this.templateKeys = [];\n if (this.options.readOnly && this.component.template) {\n var keys = this.component.template.match(/({{\\s*(.*?)\\s*}})/g);\n if (keys) {\n keys.forEach(function (key) {\n var propKey = key.match(/{{\\s*item\\.(.*?)\\s*}}/);\n if (propKey && propKey.length > 1) {\n _this5.templateKeys.push(propKey[1]);\n }\n });\n }\n }\n }\n }, {\n key: \"loadingError\",\n get: function get() {\n return !this.component.refreshOn && !this.component.refreshOnBlur && this.networkError;\n }\n }, {\n key: \"selectData\",\n get: function get() {\n var selectData = _lodash.default.get(this.root, 'submission.metadata.selectData', {});\n return _lodash.default.get(selectData, this.path);\n }\n }, {\n key: \"shouldLoad\",\n get: function get() {\n if (this.loadingError) {\n return false;\n }\n // Live forms should always load.\n if (!this.options.readOnly) {\n return true;\n }\n\n // If there are template keys, then we need to see if we have the data.\n if (this.templateKeys && this.templateKeys.length) {\n // See if we already have the data we need.\n var dataValue = this.dataValue;\n var selectData = this.selectData;\n return this.templateKeys.reduce(function (shouldLoad, key) {\n var hasValue = _lodash.default.has(dataValue, key) || _lodash.default.has(selectData, key);\n return shouldLoad || !hasValue;\n }, false);\n }\n\n // Return that we should load.\n return true;\n }\n }, {\n key: \"loadItems\",\n value: function loadItems(url, search, headers, options, method, body) {\n var _this6 = this;\n options = options || {};\n\n // See if we should load items or not.\n if (!this.shouldLoad || !this.itemsFromUrl && this.options.readOnly) {\n this.isScrollLoading = false;\n this.loading = false;\n this.itemsLoadedResolve();\n return;\n }\n\n // See if they have not met the minimum search requirements.\n var minSearch = parseInt(this.component.minSearch, 10);\n if ((this.component.searchField || this.component.data.noco_db_conditions && this.component.data.noco_db_conditions.length > 0 && this.component.data.noco_db_conditions[0].name.length > 0) && minSearch > 0 && (!search || search.length < minSearch)) {\n // Set empty items.\n return this.setItems([]);\n }\n\n // Ensure we have a method and remove any body if method is get\n method = method || 'GET';\n if (method.toUpperCase() === 'GET') {\n body = null;\n }\n var limit = this.component.limit || 100;\n var skip = this.isScrollLoading ? this.selectOptions.length : 0;\n var query = this.component.disableLimit ? {} : {\n limit: limit,\n skip: skip\n };\n\n // Allow for url interpolation.\n url = this.interpolate(url, {\n formioBase: _Formio.GlobalFormio.getBaseUrl(),\n search: search,\n limit: limit,\n skip: skip,\n page: Math.abs(Math.floor(skip / limit))\n });\n\n // Add search capability.\n if (this.component.searchField && search) {\n if (Array.isArray(search)) {\n query[\"\".concat(this.component.searchField)] = search.join(',');\n } else {\n query[\"\".concat(this.component.searchField)] = search;\n }\n }\n\n // If they wish to return only some fields.\n if (this.component.selectFields) {\n query.select = this.component.selectFields;\n }\n\n // Add sort capability\n if (this.component.sort) {\n query.sort = this.component.sort;\n }\n\n // 添加nocoDb查询参数\n if (this.component.data.noco_db_conditions && this.component.data.noco_db_conditions.length > 0 && this.component.data.noco_db_conditions[0].name.length > 0 && search && search.length > 0) {\n var where = \"\";\n this.component.data.noco_db_conditions.forEach(function (item, index) {\n if (index === 0 && item.logical_operator === \"~not\") {\n where += \"(\".concat(item.name, \",\").concat(item.operator, \",\").concat(search, \")\");\n } else {\n where += \"\".concat(item.logical_operator, \"(\").concat(item.name, \",\").concat(item.operator, \",\").concat(search, \")\");\n }\n });\n query.where = where;\n }\n if (!_lodash.default.isEmpty(query)) {\n // Add the query string.\n url += (!url.includes('?') ? '?' : '&') + _Formio.GlobalFormio.serialize(query, function (item) {\n return _this6.interpolate(item);\n });\n }\n\n // Add filter capability\n if (this.component.filter) {\n url += (!url.includes('?') ? '?' : '&') + this.interpolate(this.component.filter);\n }\n\n // Set ignoreCache if it is\n options.ignoreCache = this.component.ignoreCache;\n\n // Make the request.\n options.header = headers;\n this.loading = true;\n try {\n url = JSON.parse(this.parseTpl(JSON.stringify({\n url: url\n }), {\n data: this.rootValue\n }, null)).url;\n } catch (e) {}\n _Formio.GlobalFormio.makeRequest(this.options.formio, 'select', url, method, body, options).then(function (response) {\n _this6.loading = false;\n _this6.error = null;\n _this6.setItems(response, !!search);\n }).catch(function (err) {\n if (_this6.itemsFromUrl) {\n _this6.setItems([]);\n _this6.disableInfiniteScroll();\n }\n _this6.isScrollLoading = false;\n _this6.handleLoadingError(err);\n });\n }\n }, {\n key: \"handleLoadingError\",\n value: function handleLoadingError(err) {\n this.loading = false;\n if (err.networkError) {\n this.networkError = true;\n }\n this.itemsLoadedResolve();\n this.emit('componentError', {\n component: this.component,\n message: err.toString()\n });\n console.warn(\"Unable to load resources for \".concat(this.key));\n }\n /**\n * Get the request headers for this select dropdown.\n */\n }, {\n key: \"requestHeaders\",\n get: function get() {\n var _this7 = this;\n // Create the headers object.\n var headers = new _Formio.GlobalFormio.Headers();\n\n // Add custom headers to the url.\n if (this.component.data && this.component.data.headers) {\n try {\n _lodash.default.each(this.component.data.headers, function (header) {\n if (header.key) {\n headers.set(header.key, _this7.interpolate(header.value));\n }\n });\n } catch (err) {\n console.warn(err.message);\n }\n }\n return headers;\n }\n }, {\n key: \"getCustomItems\",\n value: function getCustomItems() {\n var customItems = this.evaluate(this.component.data.custom, {\n values: []\n }, 'values');\n this.asyncValues = (0, _utils.isPromise)(customItems);\n return customItems;\n }\n }, {\n key: \"asyncCustomValues\",\n value: function asyncCustomValues() {\n if (!_lodash.default.isBoolean(this.asyncValues)) {\n this.getCustomItems();\n }\n return this.asyncValues;\n }\n }, {\n key: \"updateCustomItems\",\n value: function updateCustomItems(forceUpdate) {\n var _this8 = this;\n if (this.asyncCustomValues()) {\n if (!forceUpdate && !this.active) {\n this.itemsLoadedResolve();\n return;\n }\n this.loading = true;\n this.getCustomItems().then(function (items) {\n _this8.loading = false;\n _this8.setItems(items || []);\n }).catch(function (err) {\n _this8.handleLoadingError(err);\n });\n } else {\n this.setItems(this.getCustomItems() || []);\n }\n }\n }, {\n key: \"isEmpty\",\n value: function isEmpty() {\n var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.dataValue;\n return _get(_getPrototypeOf(SelectComponent.prototype), \"isEmpty\", this).call(this, value) || value === undefined;\n }\n }, {\n key: \"refresh\",\n value: function refresh(value, _ref3) {\n var instance = _ref3.instance;\n if (this.component.clearOnRefresh && instance && !instance.pristine) {\n this.setValue(this.emptyValue);\n }\n this.updateItems(null, true);\n }\n }, {\n key: \"additionalResourcesAvailable\",\n get: function get() {\n return _lodash.default.isNil(this.serverCount) || this.serverCount > this.downloadedResources.length;\n }\n }, {\n key: \"serverCount\",\n get: function get() {\n if (this.isFromSearch) {\n return this.searchServerCount;\n }\n return this.defaultServerCount;\n },\n set: function set(value) {\n if (this.isFromSearch) {\n this.searchServerCount = value;\n } else {\n this.defaultServerCount = value;\n }\n }\n }, {\n key: \"downloadedResources\",\n get: function get() {\n if (this.isFromSearch) {\n return this.searchDownloadedResources;\n }\n return this.defaultDownloadedResources;\n },\n set: function set(value) {\n if (this.isFromSearch) {\n this.searchDownloadedResources = value;\n } else {\n this.defaultDownloadedResources = value;\n }\n }\n }, {\n key: \"addPlaceholder\",\n value: function addPlaceholder() {\n if (!this.component.placeholder) {\n return;\n }\n this.addOption('', this.component.placeholder, {\n placeholder: true\n });\n }\n\n /**\n * Activate this select control.\n */\n }, {\n key: \"activate\",\n value: function activate() {\n if (this.loading || !this.active) {\n this.setLoadingItem();\n }\n if (this.active) {\n return;\n }\n this.activated = true;\n this.triggerUpdate();\n }\n }, {\n key: \"setLoadingItem\",\n value: function setLoadingItem() {\n var addToCurrentList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n if (this.choices) {\n if (addToCurrentList) {\n this.choices.setChoices([{\n value: \"\".concat(this.id, \"-loading\"),\n label: 'Loading...',\n disabled: true\n }], 'value', 'label');\n } else {\n this.choices.setChoices([{\n value: '',\n label: \"<i class=\\\"\".concat(this.iconClass('refresh'), \"\\\" style=\\\"font-size:1.3em;\\\"></i>\"),\n disabled: true\n }], 'value', 'label', true);\n }\n } else if (this.component.dataSrc === 'url' || this.component.dataSrc === 'resource' || this.component.dataSrc === 'noco_db') {\n this.addOption('', this.t('loading...'));\n }\n }\n }, {\n key: \"active\",\n get: function get() {\n return !this.component.lazyLoad || this.activated;\n }\n }, {\n key: \"render\",\n value: function render() {\n var info = this.inputInfo;\n info.attr = info.attr || {};\n info.multiple = this.component.multiple;\n return _get(_getPrototypeOf(SelectComponent.prototype), \"render\", this).call(this, this.wrapElement(this.renderTemplate('select', {\n input: info,\n selectOptions: '',\n index: null\n })));\n }\n }, {\n key: \"wrapElement\",\n value: function wrapElement(element) {\n return this.component.addResource && !this.options.readOnly ? this.renderTemplate('resourceAdd', {\n element: element\n }) : element;\n }\n }, {\n key: \"choicesOptions\",\n value: function choicesOptions() {\n var useSearch = this.component.hasOwnProperty('searchEnabled') ? this.component.searchEnabled : true;\n var placeholderValue = this.t(this.component.placeholder, {\n _userInput: true\n });\n var customOptions = this.component.customOptions || {};\n if (typeof customOptions == 'string') {\n try {\n customOptions = JSON.parse(customOptions);\n } catch (err) {\n console.warn(err.message);\n customOptions = {};\n }\n }\n var commonFuseOptions = {\n maxPatternLength: 1000,\n distance: 1000\n };\n return _objectSpread({\n removeItemButton: this.component.disabled ? false : _lodash.default.get(this.component, 'removeItemButton', true),\n itemSelectText: '',\n classNames: {\n containerOuter: 'choices form-group formio-choices',\n containerInner: this.transform('class', 'form-control ui fluid selection dropdown')\n },\n addItemText: false,\n placeholder: !!this.component.placeholder,\n placeholderValue: placeholderValue,\n noResultsText: this.t('No results found'),\n noChoicesText: this.t('No choices to choose from'),\n searchPlaceholderValue: this.t('Type to search'),\n shouldSort: false,\n position: this.component.dropdown || 'auto',\n searchEnabled: useSearch,\n searchChoices: !this.component.searchField,\n searchFields: _lodash.default.get(this, 'component.searchFields', ['label']),\n shadowRoot: this.root ? this.root.shadowRoot : null,\n fuseOptions: this.component.useExactSearch ? _objectSpread({\n tokenize: true,\n matchAllTokens: true\n }, commonFuseOptions) : Object.assign({}, _lodash.default.get(this, 'component.fuseOptions', {}), _objectSpread({\n include: 'score',\n threshold: _lodash.default.get(this, 'component.selectThreshold', 0.3)\n }, commonFuseOptions)),\n valueComparer: _lodash.default.isEqual,\n resetScrollPosition: false\n }, customOptions);\n }\n\n /* eslint-disable max-statements */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this9 = this,\n _this$choices2,\n _this$choices2$contai,\n _this$choices2$contai2;\n var superAttach = _get(_getPrototypeOf(SelectComponent.prototype), \"attach\", this).call(this, element);\n this.loadRefs(element, {\n selectContainer: 'single',\n addResource: 'single',\n autocompleteInput: 'single'\n });\n //enable autocomplete for select\n var autocompleteInput = this.refs.autocompleteInput;\n if (autocompleteInput) {\n this.addEventListener(autocompleteInput, 'change', function (event) {\n _this9.setValue(event.target.value);\n });\n }\n var input = this.refs.selectContainer;\n if (!input) {\n return;\n }\n this.addEventListener(input, this.inputInfo.changeEvent, function () {\n return _this9.updateValue(null, {\n modified: true\n });\n });\n this.attachRefreshOnBlur();\n if (this.component.widget === 'html5') {\n this.addFocusBlurEvents(input);\n this.triggerUpdate(null, true);\n if (this.visible) {\n this.setItems(this.selectOptions || []);\n }\n this.focusableElement = input;\n this.addEventListener(input, 'focus', function () {\n return _this9.update();\n });\n this.addEventListener(input, 'keydown', function (event) {\n var key = event.key;\n if (['Backspace', 'Delete'].includes(key)) {\n _this9.setValue(_this9.emptyValue);\n }\n });\n return;\n }\n var tabIndex = input.tabIndex;\n this.addPlaceholder();\n input.setAttribute('dir', this.i18next.dir());\n if ((_this$choices2 = this.choices) !== null && _this$choices2 !== void 0 && (_this$choices2$contai = _this$choices2.containerOuter) !== null && _this$choices2$contai !== void 0 && (_this$choices2$contai2 = _this$choices2$contai.element) !== null && _this$choices2$contai2 !== void 0 && _this$choices2$contai2.parentNode) {\n this.choices.destroy();\n }\n var choicesOptions = this.choicesOptions();\n if (Choices) {\n this.choices = new Choices(input, choicesOptions);\n if (this.choices.input && this.choices.input.element) {\n this.choices.input.element.addEventListener(\"input\", this.choices._onKeyUp, {\n passive: true\n });\n }\n if (this.selectOptions && this.selectOptions.length) {\n this.choices.setChoices(this.selectOptions, 'value', 'label', true);\n }\n if (this.component.multiple) {\n this.focusableElement = this.choices.input.element;\n } else {\n this.focusableElement = this.choices.containerInner.element;\n this.choices.containerOuter.element.setAttribute('tabIndex', '-1');\n this.addEventListener(this.choices.containerOuter.element, 'focus', function () {\n return _this9.focusableElement.focus();\n });\n }\n this.addFocusBlurEvents(this.focusableElement);\n if (this.itemsFromUrl) {\n this.scrollList = this.choices.choiceList.element;\n this.addEventListener(this.scrollList, 'scroll', function () {\n return _this9.onScroll();\n });\n }\n }\n if (window && this.choices && this.shouldPositionDropdown) {\n this.addEventListener(window.document, 'scroll', function () {\n _this9.positionDropdown(true);\n }, false, true);\n }\n this.focusableElement.setAttribute('tabIndex', tabIndex);\n\n // If a search field is provided, then add an event listener to update items on search.\n if (this.component.searchField || this.component.data.noco_db_conditions && this.component.data.noco_db_conditions.length > 0 && this.component.data.noco_db_conditions[0].name.length > 0) {\n // Make sure to clear the search when no value is provided.\n if (this.choices && this.choices.input && this.choices.input.element) {\n this.addEventListener(this.choices.input.element, 'input', function (event) {\n _this9.isFromSearch = !!event.target.value;\n if (!event.target.value) {\n _this9.triggerUpdate();\n } else {\n _this9.serverCount = null;\n _this9.downloadedResources = [];\n }\n });\n }\n this.addEventListener(input, 'choice', function () {\n if (_this9.component.multiple && _this9.component.dataSrc === 'resource' && _this9.isFromSearch) {\n _this9.triggerUpdate();\n }\n _this9.isFromSearch = false;\n });\n // avoid spamming the resource/url endpoint when we have server side filtering enabled.\n var debounceTimeout = (this.component.searchField || this.component.data.noco_db_conditions && this.component.data.noco_db_conditions.length > 0 && this.component.data.noco_db_conditions[0].name.length > 0) && (this.isSelectResource || this.isSelectURL) ? (this.component.searchDebounce === 0 ? 0 : this.component.searchDebounce || this.defaultSchema.searchDebounce) * 1000 : 0;\n var updateComponent = function updateComponent(evt) {\n _this9.triggerUpdate(evt.detail.value);\n };\n this.addEventListener(input, 'search', _lodash.default.debounce(function (e) {\n updateComponent(e);\n _this9.positionDropdown();\n }, debounceTimeout));\n this.addEventListener(input, 'stopSearch', function () {\n return _this9.triggerUpdate();\n });\n this.addEventListener(input, 'hideDropdown', function () {\n if (_this9.choices && _this9.choices.input && _this9.choices.input.element) {\n _this9.choices.input.element.value = '';\n }\n _this9.updateItems(null, true);\n });\n }\n this.addEventListener(input, 'showDropdown', function () {\n _this9.update();\n _this9.positionDropdown();\n });\n if (this.shouldPositionDropdown) {\n this.addEventListener(input, 'highlightChoice', function () {\n _this9.positionDropdown();\n });\n }\n if (this.choices && choicesOptions.placeholderValue && this.choices._isSelectOneElement) {\n this.addPlaceholderItem(choicesOptions.placeholderValue);\n this.addEventListener(input, 'removeItem', function () {\n _this9.addPlaceholderItem(choicesOptions.placeholderValue);\n });\n }\n\n // Add value options.\n this.addValueOptions();\n this.setChoicesValue(this.dataValue);\n if (this.isSelectResource && this.refs.addResource) {\n this.addEventListener(this.refs.addResource, 'click', function (event) {\n event.preventDefault();\n var formioForm = _this9.ce('div');\n var dialog = _this9.createModal(formioForm);\n var projectUrl = _lodash.default.get(_this9.root, 'formio.projectUrl', _Formio.GlobalFormio.getProjectUrl());\n var formUrl = \"\".concat(projectUrl, \"/form/\").concat(_this9.component.data.resource);\n new _Form.default(formioForm, formUrl, {}).ready.then(function (form) {\n form.on('submit', function (submission) {\n // If valueProperty is set, replace the submission with the corresponding value\n var value = _this9.valueProperty ? _lodash.default.get(submission, _this9.valueProperty) : submission;\n if (_this9.component.multiple) {\n value = [].concat(_toConsumableArray(_this9.dataValue), [value]);\n }\n _this9.setValue(value);\n _this9.triggerUpdate();\n dialog.close();\n });\n });\n });\n }\n\n // Force the disabled state with getters and setters.\n this.disabled = this.shouldDisabled;\n this.triggerUpdate();\n return superAttach;\n }\n }, {\n key: \"setDropdownPosition\",\n value: function setDropdownPosition() {\n var _this$choices3, _this$choices3$dropdo, _this$choices4, _this$choices4$contai;\n var dropdown = (_this$choices3 = this.choices) === null || _this$choices3 === void 0 ? void 0 : (_this$choices3$dropdo = _this$choices3.dropdown) === null || _this$choices3$dropdo === void 0 ? void 0 : _this$choices3$dropdo.element;\n var container = (_this$choices4 = this.choices) === null || _this$choices4 === void 0 ? void 0 : (_this$choices4$contai = _this$choices4.containerOuter) === null || _this$choices4$contai === void 0 ? void 0 : _this$choices4$contai.element;\n if (!dropdown || !container) {\n return;\n }\n var containerPosition = container.getBoundingClientRect();\n var isFlipped = container.classList.contains('is-flipped');\n _lodash.default.assign(dropdown.style, {\n top: \"\".concat(isFlipped ? containerPosition.top - dropdown.offsetHeight : containerPosition.top + containerPosition.height, \"px\"),\n left: \"\".concat(containerPosition.left, \"px\"),\n width: \"\".concat(containerPosition.width, \"px\"),\n position: 'fixed',\n bottom: 'unset',\n right: 'unset'\n });\n }\n }, {\n key: \"hasDataGridAncestor\",\n value: function hasDataGridAncestor(comp) {\n comp = comp || this;\n if (comp.inDataGrid || comp.type === 'datagrid') {\n return true;\n } else if (comp.parent) {\n return this.hasDataGridAncestor(comp.parent);\n } else {\n return false;\n }\n }\n }, {\n key: \"positionDropdown\",\n value: function positionDropdown(scroll) {\n var _this$choices$dropdow,\n _this10 = this;\n if (!this.shouldPositionDropdown || !this.choices || !((_this$choices$dropdow = this.choices.dropdown) !== null && _this$choices$dropdow !== void 0 && _this$choices$dropdow.isActive) && scroll) {\n return;\n }\n this.setDropdownPosition();\n this.itemsLoaded.then(function () {\n _this10.setDropdownPosition();\n });\n }\n }, {\n key: \"isLoadingAvailable\",\n get: function get() {\n return !this.isScrollLoading && this.additionalResourcesAvailable;\n }\n }, {\n key: \"onScroll\",\n value: function onScroll() {\n if (this.isLoadingAvailable) {\n this.isScrollLoading = true;\n this.setLoadingItem(true);\n this.triggerUpdate(this.choices.input.element.value);\n }\n }\n }, {\n key: \"attachRefreshOnBlur\",\n value: function attachRefreshOnBlur() {\n var _this11 = this;\n if (this.component.refreshOnBlur) {\n this.on('blur', function (instance) {\n _this11.checkRefreshOn([{\n instance: instance,\n value: instance.dataValue\n }], {\n fromBlur: true\n });\n });\n }\n }\n }, {\n key: \"addPlaceholderItem\",\n value: function addPlaceholderItem(placeholderValue) {\n var items = this.choices._store.activeItems;\n if (!items.length) {\n this.choices._addItem({\n value: placeholderValue,\n label: placeholderValue,\n choiceId: 0,\n groupId: -1,\n customProperties: null,\n placeholder: true,\n keyCode: null\n });\n }\n }\n\n /* eslint-enable max-statements */\n }, {\n key: \"update\",\n value: function update() {\n if (this.component.dataSrc === 'custom') {\n this.updateCustomItems();\n }\n // Activate the control.\n this.activate();\n }\n }, {\n key: \"disabled\",\n get: function get() {\n return _get(_getPrototypeOf(SelectComponent.prototype), \"disabled\", this);\n },\n set: function set(disabled) {\n _set(_getPrototypeOf(SelectComponent.prototype), \"disabled\", disabled, this, true);\n if (!this.choices) {\n return;\n }\n if (disabled) {\n this.setDisabled(this.choices.containerInner.element, true);\n this.focusableElement.removeAttribute('tabIndex');\n this.choices.disable();\n } else {\n this.setDisabled(this.choices.containerInner.element, false);\n this.focusableElement.setAttribute('tabIndex', this.component.tabindex || 0);\n this.choices.enable();\n }\n }\n }, {\n key: \"visible\",\n get: function get() {\n return _get(_getPrototypeOf(SelectComponent.prototype), \"visible\", this);\n }\n\n /**\n * @param {*} value\n * @param {Array} items\n */,\n set: function set(value) {\n // If we go from hidden to visible, trigger a refresh.\n if (value && !this._visible !== !value) {\n this.triggerUpdate();\n }\n _set(_getPrototypeOf(SelectComponent.prototype), \"visible\", value, this, true);\n }\n }, {\n key: \"addCurrentChoices\",\n value: function addCurrentChoices(values, items, keyValue) {\n var _this12 = this;\n if (!values) {\n return false;\n }\n var notFoundValuesToAdd = [];\n var added = values.reduce(function (defaultAdded, value) {\n if (!value || _lodash.default.isEmpty(value)) {\n return defaultAdded;\n }\n var found = false;\n\n // Make sure that `items` and `this.selectOptions` points\n // to the same reference. Because `this.selectOptions` is\n // internal property and all items are populated by\n // `this.addOption` method, we assume that items has\n // 'label' and 'value' properties. This assumption allows\n // us to read correct value from the item.\n var isSelectOptions = items === _this12.selectOptions;\n if (items && items.length) {\n _lodash.default.each(items, function (choice) {\n if (choice._id && value._id && choice._id === value._id) {\n found = true;\n return false;\n }\n var itemValue = keyValue ? choice.value : _this12.itemValue(choice, isSelectOptions);\n found |= _lodash.default.isEqual(itemValue, value);\n return found ? false : true;\n });\n }\n\n // Add the default option if no item is found.\n if (!found) {\n notFoundValuesToAdd.push(_this12.selectValueAndLabel(value));\n return true;\n }\n return found || defaultAdded;\n }, false);\n if (notFoundValuesToAdd.length) {\n if (this.choices) {\n this.choices.setChoices(notFoundValuesToAdd, 'value', 'label');\n }\n notFoundValuesToAdd.map(function (notFoundValue) {\n _this12.addOption(notFoundValue.value, notFoundValue.label);\n });\n }\n return added;\n }\n }, {\n key: \"getValueAsString\",\n value: function getValueAsString(data) {\n return this.component.multiple && Array.isArray(data) ? data.map(this.asString.bind(this)).join(', ') : this.asString(data);\n }\n }, {\n key: \"getValue\",\n value: function getValue() {\n // If the widget isn't active.\n if (this.viewOnly || this.loading || !this.component.lazyLoad && !this.selectOptions.length || !this.element) {\n return this.dataValue;\n }\n var value = this.emptyValue;\n if (this.choices) {\n value = this.choices.getValue(true);\n\n // Make sure we don't get the placeholder\n if (!this.component.multiple && this.component.placeholder && value === this.t(this.component.placeholder, {\n _userInput: true\n })) {\n value = this.emptyValue;\n }\n } else if (this.refs.selectContainer) {\n value = this.refs.selectContainer.value;\n if (this.valueProperty === '') {\n if (value === '') {\n return {};\n }\n var option = this.selectOptions[value];\n if (option && _lodash.default.isObject(option.value)) {\n value = option.value;\n }\n }\n } else {\n value = this.dataValue;\n }\n // Choices will return undefined if nothing is selected. We really want '' to be empty.\n if (value === undefined || value === null) {\n value = '';\n }\n return value;\n }\n }, {\n key: \"redraw\",\n value: function redraw() {\n var done = _get(_getPrototypeOf(SelectComponent.prototype), \"redraw\", this).call(this);\n this.triggerUpdate();\n return done;\n }\n }, {\n key: \"normalizeSingleValue\",\n value: function normalizeSingleValue(value, retainObject) {\n var _this13 = this;\n if (_lodash.default.isNil(value)) {\n return;\n }\n var valueIsObject = _lodash.default.isObject(value);\n //check if value equals to default emptyValue\n if (valueIsObject && Object.keys(value).length === 0) {\n return value;\n }\n // Check to see if we need to save off the template data into our metadata.\n if (retainObject) {\n var _this$root;\n var templateValue = this.component.reference && value !== null && value !== void 0 && value._id ? value._id.toString() : value;\n var shouldSaveData = !valueIsObject || this.component.reference;\n if (templateValue && shouldSaveData && this.templateData && this.templateData[templateValue] && (_this$root = this.root) !== null && _this$root !== void 0 && _this$root.submission) {\n var submission = this.root.submission;\n if (!submission.metadata) {\n submission.metadata = {};\n }\n if (!submission.metadata.selectData) {\n submission.metadata.selectData = {};\n }\n var templateData = this.templateData[templateValue];\n if (this.component.multiple) {\n templateData = {};\n var dataValue = this.dataValue;\n if (dataValue && dataValue.length) {\n dataValue.forEach(function (dataValueItem) {\n var dataValueItemValue = _this13.component.reference ? dataValueItem._id.toString() : dataValueItem;\n templateData[dataValueItemValue] = _this13.templateData[dataValueItemValue];\n });\n }\n }\n _lodash.default.set(submission.metadata.selectData, this.path, templateData);\n }\n }\n var displayEntireObject = this.isEntireObjectDisplay();\n var dataType = this.component.dataType || 'auto';\n var normalize = {\n value: value,\n number: function number() {\n var numberValue = Number(this.value);\n var isEquivalent = value.toString() === numberValue.toString();\n if (!Number.isNaN(numberValue) && Number.isFinite(numberValue) && value !== '' && isEquivalent) {\n this.value = numberValue;\n }\n return this;\n },\n boolean: function boolean() {\n if (_lodash.default.isString(this.value) && (this.value.toLowerCase() === 'true' || this.value.toLowerCase() === 'false')) {\n this.value = this.value.toLowerCase() === 'true';\n }\n return this;\n },\n string: function string() {\n this.value = String(this.value);\n return this;\n },\n object: function object() {\n if (_lodash.default.isObject(this.value) && displayEntireObject && !retainObject) {\n this.value = JSON.stringify(this.value);\n }\n return this;\n },\n auto: function auto() {\n if (_lodash.default.isObject(this.value)) {\n this.value = this.object().value;\n } else {\n this.value = this.string().number().boolean().value;\n }\n return this;\n }\n };\n try {\n return normalize[dataType]().value;\n } catch (err) {\n console.warn('Failed to normalize value', err);\n return value;\n }\n }\n\n /**\n * Normalize values coming into updateValue.\n *\n * @param value\n * @return {*}\n */\n }, {\n key: \"normalizeValue\",\n value: function normalizeValue(value) {\n var _this14 = this;\n if (this.component.multiple && Array.isArray(value)) {\n return value.map(function (singleValue) {\n return _this14.normalizeSingleValue(singleValue, true);\n });\n }\n return _get(_getPrototypeOf(SelectComponent.prototype), \"normalizeValue\", this).call(this, this.normalizeSingleValue(value, true));\n }\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var _this15 = this;\n var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var previousValue = this.dataValue;\n if (this.component.widget === 'html5' && (_lodash.default.isEqual(value, previousValue) || _lodash.default.isEqual(previousValue, {}) && _lodash.default.isEqual(flags, {}))) {\n return false;\n }\n var changed = this.updateValue(value, flags);\n value = this.dataValue;\n var hasPreviousValue = !this.isEmpty(previousValue);\n var hasValue = !this.isEmpty(value);\n\n // Undo typing when searching to set the value.\n if (this.component.multiple && Array.isArray(value)) {\n value = value.map(function (value) {\n if (typeof value === 'boolean' || typeof value === 'number') {\n return value.toString();\n }\n return value;\n });\n } else {\n if (typeof value === 'boolean' || typeof value === 'number') {\n value = value.toString();\n }\n }\n if (this.isHtmlRenderMode() && flags && flags.fromSubmission && changed) {\n this.itemsLoaded.then(function () {\n _this15.redraw();\n });\n return changed;\n }\n\n // Do not set the value if we are loading... that will happen after it is done.\n if (this.loading) {\n return changed;\n }\n\n // Determine if we need to perform an initial lazyLoad api call if searchField is provided.\n if (this.isInitApiCallNeeded(hasValue)) {\n this.loading = true;\n this.lazyLoadInit = true;\n var searchProperty = this.component.searchField || this.component.valueProperty || this.component.data.noco_db_conditions && this.component.data.noco_db_conditions.length > 0 && this.component.data.noco_db_conditions[0].name.length > 0;\n this.triggerUpdate(_lodash.default.get(value.data || value, searchProperty, value), true);\n return changed;\n }\n\n // Add the value options.\n this.itemsLoaded.then(function () {\n _this15.addValueOptions();\n _this15.setChoicesValue(value, hasPreviousValue, flags);\n });\n return changed;\n }\n }, {\n key: \"isInitApiCallNeeded\",\n value: function isInitApiCallNeeded(hasValue) {\n return this.component.lazyLoad && !this.lazyLoadInit && !this.active && !this.selectOptions.length && hasValue && this.shouldLoad && this.visible && (this.component.searchField || this.component.valueProperty || this.component.data.noco_db_conditions && this.component.data.noco_db_conditions.length > 0 && this.component.data.noco_db_conditions[0].name.length > 0);\n }\n }, {\n key: \"setChoicesValue\",\n value: function setChoicesValue(value, hasPreviousValue) {\n var flags = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var hasValue = !this.isEmpty(value) || flags.fromSubmission;\n hasPreviousValue = hasPreviousValue === undefined ? true : hasPreviousValue;\n if (this.choices) {\n // Now set the value.\n if (hasValue) {\n this.choices.removeActiveItems();\n // Add the currently selected choices if they don't already exist.\n var currentChoices = Array.isArray(value) ? value : [value];\n if (!this.addCurrentChoices(currentChoices, this.selectOptions, true)) {\n this.choices.setChoices(this.selectOptions, 'value', 'label', true);\n }\n this.choices.setChoiceByValue(value);\n } else if (hasPreviousValue || flags.resetValue) {\n this.choices.removeActiveItems();\n }\n } else {\n if (hasValue) {\n var values = Array.isArray(value) ? value : [value];\n if (!_lodash.default.isEqual(this.dataValue, this.defaultValue) && this.selectOptions.length < 2) {\n var _this$selectValueAndL = this.selectValueAndLabel(this.dataValue),\n _value2 = _this$selectValueAndL.value,\n label = _this$selectValueAndL.label;\n this.addOption(_value2, label);\n }\n _lodash.default.each(this.selectOptions, function (selectOption) {\n _lodash.default.each(values, function (val) {\n if (selectOption.value === '') {\n selectOption.value = {};\n }\n if (_lodash.default.isEqual(val, selectOption.value) && selectOption.element) {\n selectOption.element.selected = true;\n selectOption.element.setAttribute('selected', 'selected');\n return false;\n }\n });\n });\n } else {\n _lodash.default.each(this.selectOptions, function (selectOption) {\n if (selectOption.element) {\n selectOption.element.selected = false;\n selectOption.element.removeAttribute('selected');\n }\n });\n }\n }\n }\n }, {\n key: \"itemsLoaded\",\n get: function get() {\n return this._itemsLoaded || _nativePromiseOnly.default.resolve();\n },\n set: function set(promise) {\n this._itemsLoaded = promise;\n }\n }, {\n key: \"validateValueAvailability\",\n value: function validateValueAvailability(setting, value) {\n var _this16 = this;\n if (!(0, _utils.boolValue)(setting) || !value) {\n return true;\n }\n var values = this.getOptionsValues();\n if (values) {\n if (_lodash.default.isObject(value)) {\n var compareComplexValues = function compareComplexValues(optionValue) {\n var normalizedOptionValue = _this16.normalizeSingleValue(optionValue, true);\n if (!_lodash.default.isObject(normalizedOptionValue)) {\n return false;\n }\n try {\n return JSON.stringify(normalizedOptionValue) === JSON.stringify(value);\n } catch (err) {\n console.warn.error('Error while comparing items', err);\n return false;\n }\n };\n return values.findIndex(function (optionValue) {\n return compareComplexValues(optionValue);\n }) !== -1;\n }\n return values.findIndex(function (optionValue) {\n return _this16.normalizeSingleValue(optionValue) === value;\n }) !== -1;\n }\n return false;\n }\n\n /**\n * Performs required transformations on the initial value to use in selectOptions\n * @param {*} value\n */\n }, {\n key: \"getOptionValue\",\n value: function getOptionValue(value) {\n return _lodash.default.isObject(value) && this.isEntireObjectDisplay() ? this.normalizeSingleValue(value) : _lodash.default.isObject(value) && (this.valueProperty || this.component.key !== 'resource') ? value : _lodash.default.isObject(value) && !this.valueProperty ? this.interpolate(this.component.template, {\n item: value\n }).replace(/<\\/?[^>]+(>|$)/g, '') : _lodash.default.isNull(value) ? this.emptyValue : String(this.normalizeSingleValue(value));\n }\n\n /**\n * If component has static values (values, json) or custom values, returns an array of them\n * @returns {Array<*>|undefined}\n */\n }, {\n key: \"getOptionsValues\",\n value: function getOptionsValues() {\n var _this17 = this;\n var rawItems = [];\n switch (this.component.dataSrc) {\n case 'values':\n rawItems = this.component.data.values;\n break;\n case 'json':\n rawItems = this.component.data.json;\n break;\n case 'custom':\n rawItems = this.getCustomItems();\n break;\n }\n if (typeof rawItems === 'string') {\n try {\n rawItems = JSON.parse(rawItems);\n } catch (err) {\n console.warn(err.message);\n rawItems = [];\n }\n }\n if (!Array.isArray(rawItems)) {\n return;\n }\n return rawItems.map(function (item) {\n return _this17.getOptionValue(_this17.itemValue(item));\n });\n }\n\n /**\n * Deletes the value of the component.\n */\n }, {\n key: \"deleteValue\",\n value: function deleteValue() {\n this.setValue('', {\n noUpdateEvent: true\n });\n this.unset();\n }\n\n /**\n * Check if a component is eligible for multiple validation\n *\n * @return {boolean}\n */\n }, {\n key: \"validateMultiple\",\n value: function validateMultiple() {\n // Select component will contain one input when flagged as multiple.\n return false;\n }\n\n /**\n * Output this select dropdown as a string value.\n * @return {*}\n */\n }, {\n key: \"isBooleanOrNumber\",\n value: function isBooleanOrNumber(value) {\n return typeof value === 'number' || typeof value === 'boolean';\n }\n }, {\n key: \"getNormalizedValues\",\n value: function getNormalizedValues() {\n var _this18 = this;\n if (!this.component || !this.component.data || !this.component.data.values) {\n return;\n }\n return this.component.data.values.map(function (value) {\n return {\n label: value.label,\n value: String(_this18.normalizeSingleValue(value.value))\n };\n });\n }\n }, {\n key: \"asString\",\n value: function asString(value) {\n var _value3,\n _this19 = this;\n value = (_value3 = value) !== null && _value3 !== void 0 ? _value3 : this.getValue();\n //need to convert values to strings to be able to compare values with available options that are strings\n var convertToString = function convertToString(data, valueProperty) {\n if (valueProperty) {\n if (Array.isArray(data)) {\n data.forEach(function (item) {\n return item[valueProperty] = item[valueProperty].toString();\n });\n } else {\n data[valueProperty] = data[valueProperty].toString();\n }\n return data;\n }\n if (_this19.isBooleanOrNumber(data)) {\n data = data.toString();\n }\n if (Array.isArray(data) && data.some(function (item) {\n return _this19.isBooleanOrNumber(item);\n })) {\n data = data.map(function (item) {\n if (_this19.isBooleanOrNumber(item)) {\n item = item.toString();\n }\n });\n }\n return data;\n };\n value = convertToString(value);\n if (['values', 'custom'].includes(this.component.dataSrc) && !this.asyncCustomValues()) {\n var _getFromValues;\n var _ref4 = this.component.dataSrc === 'values' ? {\n items: convertToString(this.getNormalizedValues(), 'value'),\n valueProperty: 'value'\n } : {\n items: convertToString(this.getCustomItems(), this.valueProperty),\n valueProperty: this.valueProperty\n },\n items = _ref4.items,\n valueProperty = _ref4.valueProperty;\n var getFromValues = function getFromValues() {\n var initialValue = _lodash.default.find(items, [valueProperty, value]);\n var values = _this19.defaultSchema.data.values || [];\n return _lodash.default.isEqual(initialValue, values[0]) ? '-' : initialValue;\n };\n value = this.component.multiple && Array.isArray(value) ? _lodash.default.filter(items, function (item) {\n return value.includes(item.value);\n }) : valueProperty ? (_getFromValues = getFromValues()) !== null && _getFromValues !== void 0 ? _getFromValues : {\n value: value,\n label: value\n } : value;\n }\n if (_lodash.default.isString(value)) {\n return value;\n }\n if (Array.isArray(value)) {\n var _items = [];\n value.forEach(function (item) {\n return _items.push(_this19.itemTemplate(item));\n });\n return _items.length > 0 ? _items.join('<br />') : '-';\n }\n return !_lodash.default.isNil(value) ? this.itemTemplate(value) : '-';\n }\n }, {\n key: \"detach\",\n value: function detach() {\n _get(_getPrototypeOf(SelectComponent.prototype), \"detach\", this).call(this);\n this.off('blur');\n if (this.choices) {\n var _this$choices$contain, _this$choices$contain2;\n if ((_this$choices$contain = this.choices.containerOuter) !== null && _this$choices$contain !== void 0 && (_this$choices$contain2 = _this$choices$contain.element) !== null && _this$choices$contain2 !== void 0 && _this$choices$contain2.parentNode) {\n this.choices.destroy();\n }\n this.choices = null;\n }\n }\n }, {\n key: \"focus\",\n value: function focus() {\n if (this.focusableElement) {\n _get(_getPrototypeOf(SelectComponent.prototype), \"focus\", this).call(this);\n this.focusableElement.focus();\n }\n }\n }, {\n key: \"setErrorClasses\",\n value: function setErrorClasses(elements, dirty, hasError, hasMessages) {\n var element = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : this.element;\n _get(_getPrototypeOf(SelectComponent.prototype), \"setErrorClasses\", this).call(this, elements, dirty, hasError, hasMessages, element);\n if (this.choices) {\n _get(_getPrototypeOf(SelectComponent.prototype), \"setErrorClasses\", this).call(this, [this.choices.containerInner.element], dirty, hasError, hasMessages, element);\n } else {\n _get(_getPrototypeOf(SelectComponent.prototype), \"setErrorClasses\", this).call(this, [this.refs.selectContainer], dirty, hasError, hasMessages, element);\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len3 = arguments.length, extend = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n extend[_key3] = arguments[_key3];\n }\n return _ListComponent2.default.schema.apply(_ListComponent2.default, [{\n type: 'select',\n label: 'Select',\n key: 'select',\n idPath: 'id',\n data: {\n values: [{\n label: '',\n value: ''\n }],\n json: '',\n url: '',\n resource: '',\n custom: ''\n },\n clearOnRefresh: false,\n limit: 100,\n valueProperty: '',\n lazyLoad: true,\n filter: '',\n searchEnabled: true,\n searchDebounce: 0.3,\n searchField: '',\n minSearch: 0,\n readOnlyValue: false,\n selectFields: '',\n selectThreshold: 0.3,\n uniqueOptions: false,\n tableView: true,\n fuseOptions: {\n include: 'score',\n threshold: 0.3\n },\n indexeddb: {\n filter: {}\n },\n customOptions: {},\n useExactSearch: false\n }].concat(extend));\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Select',\n group: 'basic',\n icon: 'th-list',\n weight: 70,\n documentation: '/userguide/forms/form-components#select',\n schema: SelectComponent.schema()\n };\n }\n }]);\n return SelectComponent;\n}(_ListComponent2.default);\nexports[\"default\"] = SelectComponent;\n\n//# sourceURL=webpack://Formio/./lib/components/select/Select.js?");
2744
+ eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.set.js */ \"./node_modules/core-js/modules/es.reflect.set.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.from.js */ \"./node_modules/core-js/modules/es.array.from.js\");\n__webpack_require__(/*! core-js/modules/es.array.slice.js */ \"./node_modules/core-js/modules/es.array.slice.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptors.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptors.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.array.find.js */ \"./node_modules/core-js/modules/es.array.find.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.array.map.js */ \"./node_modules/core-js/modules/es.array.map.js\");\n__webpack_require__(/*! core-js/modules/es.array.join.js */ \"./node_modules/core-js/modules/es.array.join.js\");\n__webpack_require__(/*! core-js/modules/es.string.match.js */ \"./node_modules/core-js/modules/es.string.match.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.array.sort.js */ \"./node_modules/core-js/modules/es.array.sort.js\");\n__webpack_require__(/*! core-js/modules/es.array.includes.js */ \"./node_modules/core-js/modules/es.array.includes.js\");\n__webpack_require__(/*! core-js/modules/es.string.includes.js */ \"./node_modules/core-js/modules/es.string.includes.js\");\n__webpack_require__(/*! core-js/modules/es.array.filter.js */ \"./node_modules/core-js/modules/es.array.filter.js\");\n__webpack_require__(/*! core-js/modules/es.object.assign.js */ \"./node_modules/core-js/modules/es.object.assign.js\");\n__webpack_require__(/*! core-js/modules/es.object.keys.js */ \"./node_modules/core-js/modules/es.object.keys.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.number.is-nan.js */ \"./node_modules/core-js/modules/es.number.is-nan.js\");\n__webpack_require__(/*! core-js/modules/es.number.is-finite.js */ \"./node_modules/core-js/modules/es.number.is-finite.js\");\n__webpack_require__(/*! core-js/modules/es.array.find-index.js */ \"./node_modules/core-js/modules/es.array.find-index.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nvar _Formio = __webpack_require__(/*! ../../Formio */ \"./lib/Formio.js\");\nvar _ListComponent2 = _interopRequireDefault(__webpack_require__(/*! ../_classes/list/ListComponent */ \"./lib/components/_classes/list/ListComponent.js\"));\nvar _Form = _interopRequireDefault(__webpack_require__(/*! ../../Form */ \"./lib/Form.js\"));\nvar _nativePromiseOnly = _interopRequireDefault(__webpack_require__(/*! native-promise-only */ \"./node_modules/native-promise-only/lib/npo.src.js\"));\nvar _utils = __webpack_require__(/*! ../../utils/utils */ \"./lib/utils/utils.js\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction set(target, property, value, receiver) { if (typeof Reflect !== \"undefined\" && Reflect.set) { set = Reflect.set; } else { set = function set(target, property, value, receiver) { var base = _superPropBase(target, property); var desc; if (base) { desc = Object.getOwnPropertyDescriptor(base, property); if (desc.set) { desc.set.call(receiver, value); return true; } else if (!desc.writable) { return false; } } desc = Object.getOwnPropertyDescriptor(receiver, property); if (desc) { if (!desc.writable) { return false; } desc.value = value; Object.defineProperty(receiver, property, desc); } else { _defineProperty(receiver, property, value); } return true; }; } return set(target, property, value, receiver); }\nfunction _set(target, property, value, receiver, isStrict) { var s = set(target, property, value, receiver || target); if (!s && isStrict) { throw new TypeError('failed to set property'); } return value; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar Choices;\nif (typeof window !== 'undefined') {\n Choices = (__webpack_require__(/*! ../../utils/ChoicesWrapper */ \"./lib/utils/ChoicesWrapper.js\")[\"default\"]);\n}\nvar SelectComponent = /*#__PURE__*/function (_ListComponent) {\n _inherits(SelectComponent, _ListComponent);\n var _super = _createSuper(SelectComponent);\n function SelectComponent() {\n _classCallCheck(this, SelectComponent);\n return _super.apply(this, arguments);\n }\n _createClass(SelectComponent, [{\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n });\n }\n }, {\n key: \"init\",\n value: function init() {\n var _this = this;\n _get(_getPrototypeOf(SelectComponent.prototype), \"init\", this).call(this);\n this.templateData = {};\n this.validators = this.validators.concat(['select', 'onlyAvailableItems']);\n\n // Trigger an update.\n var updateArgs = [];\n var triggerUpdate = _lodash.default.debounce(function () {\n updateArgs = [];\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return _this.updateItems.apply(_this, args);\n }, 100);\n this.triggerUpdate = function () {\n // Make sure we always resolve the previous promise before reassign it\n if (typeof _this.itemsLoadedResolve === 'function') {\n _this.itemsLoadedResolve();\n }\n _this.itemsLoaded = new _nativePromiseOnly.default(function (resolve) {\n _this.itemsLoadedResolve = resolve;\n });\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n if (args.length) {\n updateArgs = args;\n }\n return triggerUpdate.apply(void 0, _toConsumableArray(updateArgs));\n };\n\n // Keep track of the select options.\n this.selectOptions = [];\n if (this.itemsFromUrl) {\n this.isFromSearch = false;\n this.searchServerCount = null;\n this.defaultServerCount = null;\n this.isScrollLoading = false;\n this.searchDownloadedResources = [];\n this.defaultDownloadedResources = [];\n }\n\n // If this component has been activated.\n this.activated = false;\n this.itemsLoaded = new _nativePromiseOnly.default(function (resolve) {\n _this.itemsLoadedResolve = resolve;\n });\n this.shouldPositionDropdown = this.hasDataGridAncestor();\n if (this.isHtmlRenderMode()) {\n this.activate();\n }\n\n // Get the template keys for this select component.\n this.getTemplateKeys();\n }\n }, {\n key: \"dataReady\",\n get: function get() {\n // If the root submission has been set, and we are still not attached, then assume\n // that our data is ready.\n if (this.root && this.root.submissionSet && !this.attached) {\n return _nativePromiseOnly.default.resolve();\n }\n return this.itemsLoaded;\n }\n }, {\n key: \"defaultSchema\",\n get: function get() {\n return SelectComponent.schema();\n }\n }, {\n key: \"emptyValue\",\n get: function get() {\n if (this.component.multiple) {\n return [];\n }\n // if select has JSON data source type, we are defining if empty value would be an object or a string by checking JSON's first item\n if (this.component.dataSrc === 'json' && this.component.data.json) {\n var firstItem = this.component.data.json[0];\n var firstValue;\n if (this.valueProperty) {\n firstValue = _lodash.default.get(firstItem, this.valueProperty);\n } else {\n firstValue = firstItem;\n }\n if (firstValue && typeof firstValue === 'string') {\n return '';\n } else {\n return {};\n }\n }\n if (this.valueProperty) {\n return '';\n }\n return {};\n }\n }, {\n key: \"valueProperty\",\n get: function get() {\n if (this.component.valueProperty) {\n return this.component.valueProperty;\n }\n // Force values datasource to use values without actually setting it on the component settings.\n if (this.component.dataSrc === 'values') {\n return 'value';\n }\n return '';\n }\n }, {\n key: \"inputInfo\",\n get: function get() {\n var info = _get(_getPrototypeOf(SelectComponent.prototype), \"elementInfo\", this).call(this);\n info.type = 'select';\n info.changeEvent = 'change';\n return info;\n }\n }, {\n key: \"isSelectResource\",\n get: function get() {\n return this.component.dataSrc === 'resource';\n }\n }, {\n key: \"itemsFromUrl\",\n get: function get() {\n return this.isSelectResource || this.isSelectURL;\n }\n }, {\n key: \"isInfiniteScrollProvided\",\n get: function get() {\n return this.itemsFromUrl;\n }\n }, {\n key: \"shouldDisabled\",\n get: function get() {\n return _get(_getPrototypeOf(SelectComponent.prototype), \"shouldDisabled\", this) || this.parentDisabled;\n }\n }, {\n key: \"isEntireObjectDisplay\",\n value: function isEntireObjectDisplay() {\n return this.component.dataSrc === 'resource' && this.valueProperty === 'data';\n }\n }, {\n key: \"selectValueAndLabel\",\n value: function selectValueAndLabel(data) {\n var value = this.getOptionValue(this.itemValue(data));\n return {\n value: value,\n label: this.itemTemplate(data, value)\n };\n }\n }, {\n key: \"itemTemplate\",\n value: function itemTemplate(data, value) {\n if (!_lodash.default.isNumber(data) && _lodash.default.isEmpty(data)) {\n return '';\n }\n\n // If they wish to show the value in read only mode, then just return the itemValue here.\n if (this.options.readOnly && this.component.readOnlyValue) {\n return this.itemValue(data);\n }\n // Perform a fast interpretation if we should not use the template.\n if (data && !this.component.template) {\n var itemLabel = data.label || data;\n var _value = typeof itemLabel === 'string' ? this.t(itemLabel, {\n _userInput: true\n }) : itemLabel;\n return this.sanitize(_value, this.shouldSanitizeValue);\n }\n if (this.component.multiple ? this.dataValue.find(function (val) {\n return value === val;\n }) : this.dataValue === value) {\n var selectData = this.selectData;\n if (selectData) {\n var templateValue = this.component.reference && value !== null && value !== void 0 && value._id ? value._id.toString() : value;\n if (!this.templateData || !this.templateData[templateValue]) {\n this.getOptionTemplate(data, value);\n }\n if (this.component.multiple) {\n if (selectData[templateValue]) {\n data = selectData[templateValue];\n }\n } else {\n data = selectData;\n }\n }\n }\n if (typeof data === 'string' || typeof data === 'number') {\n return this.sanitize(this.t(data, {\n _userInput: true\n }), this.shouldSanitizeValue);\n }\n if (data.data) {\n // checking additional fields in the template for the selected Entire Object option\n var hasNestedFields = /item\\.data\\.\\w*/g.test(this.component.template);\n data.data = this.isEntireObjectDisplay() && _lodash.default.isObject(data.data) && !hasNestedFields ? JSON.stringify(data.data) : data.data;\n }\n return _get(_getPrototypeOf(SelectComponent.prototype), \"itemTemplate\", this).call(this, data, value);\n }\n\n /**\n * Adds an option to the select dropdown.\n *\n * @param value\n * @param label\n */\n }, {\n key: \"addOption\",\n value: function addOption(value, label) {\n var attrs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var id = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : (0, _utils.getRandomComponentId)();\n if (_lodash.default.isNil(label)) return;\n var idPath = this.component.idPath ? this.component.idPath.split('.').reduceRight(function (obj, key) {\n return _defineProperty({}, key, obj);\n }, id) : {};\n var option = _objectSpread({\n value: this.getOptionValue(value),\n label: label\n }, idPath);\n var skipOption = this.component.uniqueOptions ? !!this.selectOptions.find(function (selectOption) {\n return _lodash.default.isEqual(selectOption.value, option.value);\n }) : false;\n if (skipOption) {\n return;\n }\n if (value) {\n this.selectOptions.push(option);\n }\n if (this.refs.selectContainer && this.component.widget === 'html5') {\n // Replace an empty Object value to an empty String.\n if (option.value && _lodash.default.isObject(option.value) && _lodash.default.isEmpty(option.value)) {\n option.value = '';\n }\n // Add element to option so we can reference it later.\n var div = document.createElement('div');\n div.innerHTML = this.sanitize(this.renderTemplate('selectOption', {\n selected: _lodash.default.isEqual(this.getOptionValue(this.dataValue), option.value),\n option: option,\n attrs: attrs,\n id: id,\n useId: this.valueProperty === '' && _lodash.default.isObject(value) && id\n }), this.shouldSanitizeValue).trim();\n option.element = div.firstChild;\n this.refs.selectContainer.appendChild(option.element);\n }\n }\n }, {\n key: \"addValueOptions\",\n value: function addValueOptions(items) {\n items = items || [];\n var added = false;\n if (!this.selectOptions.length) {\n // Add the currently selected choices if they don't already exist.\n var currentChoices = Array.isArray(this.dataValue) ? this.dataValue : [this.dataValue];\n added = this.addCurrentChoices(currentChoices, items);\n if (!added && !this.component.multiple) {\n this.addPlaceholder();\n }\n }\n return added;\n }\n }, {\n key: \"disableInfiniteScroll\",\n value: function disableInfiniteScroll() {\n if (!this.downloadedResources) {\n return;\n }\n this.downloadedResources.serverCount = this.downloadedResources.length;\n this.serverCount = this.downloadedResources.length;\n }\n\n /* eslint-disable max-statements */\n }, {\n key: \"setItems\",\n value: function setItems(items, fromSearch) {\n var _this2 = this,\n _this$choices,\n _this$choices$input;\n // If the items is a string, then parse as JSON.\n if (typeof items == 'string') {\n try {\n items = JSON.parse(items);\n } catch (err) {\n console.warn(err.message);\n items = [];\n }\n }\n\n // Allow js processing (needed for form builder)\n if (this.component.onSetItems && typeof this.component.onSetItems === 'function') {\n var newItems = this.component.onSetItems(this, items);\n if (newItems) {\n items = newItems;\n }\n }\n if (!this.choices && this.refs.selectContainer) {\n this.empty(this.refs.selectContainer);\n }\n\n // If they provided select values, then we need to get them instead.\n if (this.component.selectValues) {\n items = _lodash.default.get(items, this.component.selectValues, items) || [];\n }\n var areItemsEqual;\n if (this.itemsFromUrl) {\n areItemsEqual = this.isSelectURL ? _lodash.default.isEqual(items, this.downloadedResources) : false;\n var areItemsEnded = this.component.limit > items.length;\n var areItemsDownloaded = areItemsEqual && this.downloadedResources && this.downloadedResources.length === items.length;\n if (areItemsEnded) {\n this.disableInfiniteScroll();\n } else if (areItemsDownloaded) {\n this.selectOptions = [];\n } else {\n this.serverCount = items.serverCount;\n }\n }\n if (this.isScrollLoading && items) {\n if (!areItemsEqual) {\n this.downloadedResources = this.downloadedResources ? this.downloadedResources.concat(items) : items;\n }\n this.downloadedResources.serverCount = items.serverCount || this.downloadedResources.serverCount;\n } else {\n this.downloadedResources = items || [];\n this.selectOptions = [];\n // If there is new select option with same id as already selected, set the new one\n if (!_lodash.default.isEmpty(this.dataValue) && this.component.idPath) {\n var selectedOptionId = _lodash.default.get(this.dataValue, this.component.idPath, null);\n var newOptionWithSameId = !_lodash.default.isNil(selectedOptionId) && items.find(function (item) {\n var itemId = _lodash.default.get(item, _this2.component.idPath);\n return itemId === selectedOptionId;\n });\n if (newOptionWithSameId) {\n this.setValue(newOptionWithSameId);\n }\n }\n }\n\n // Add the value options.\n if (!fromSearch) {\n this.addValueOptions(items);\n }\n if (this.component.widget === 'html5' && !this.component.placeholder) {\n this.addOption(null, '');\n }\n\n // Iterate through each of the items.\n _lodash.default.each(items, function (item, index) {\n // preventing references of the components inside the form to the parent form when building forms\n if (_this2.root && _this2.root.options.editForm && _this2.root.options.editForm._id && _this2.root.options.editForm._id === item._id) return;\n var itemValueAndLabel = _this2.selectValueAndLabel(item);\n _this2.addOption(itemValueAndLabel.value, itemValueAndLabel.label, {}, _lodash.default.get(item, _this2.component.idPath, String(index)));\n });\n if (this.choices) {\n this.choices.setChoices(this.selectOptions, 'value', 'label', true);\n } else if (this.loading) {\n // Re-attach select input.\n // this.appendTo(this.refs.input[0], this.selectContainer);\n }\n\n // We are no longer loading.\n this.isScrollLoading = false;\n this.loading = false;\n var searching = fromSearch && ((_this$choices = this.choices) === null || _this$choices === void 0 ? void 0 : (_this$choices$input = _this$choices.input) === null || _this$choices$input === void 0 ? void 0 : _this$choices$input.isFocussed);\n if (!searching) {\n // If a value is provided, then select it.\n if (!this.isEmpty()) {\n this.setValue(this.dataValue, {\n noUpdateEvent: true\n });\n } else if (this.shouldAddDefaultValue && !this.options.readOnly) {\n // If a default value is provided then select it.\n var defaultValue = this.defaultValue;\n if (!this.isEmpty(defaultValue)) {\n this.setValue(defaultValue);\n }\n }\n }\n\n // Say we are done loading the items.\n this.itemsLoadedResolve();\n }\n }, {\n key: \"getSingleItemValueForHTMLMode\",\n value: function getSingleItemValueForHTMLMode(data) {\n var _this$selectOptions;\n var option = (_this$selectOptions = this.selectOptions) === null || _this$selectOptions === void 0 ? void 0 : _this$selectOptions.find(function (_ref2) {\n var value = _ref2.value;\n return _lodash.default.isEqual(value, data);\n });\n if (option) {\n return option.label || data;\n }\n return data;\n }\n }, {\n key: \"itemValueForHTMLMode\",\n value: function itemValueForHTMLMode(value) {\n var _this3 = this;\n if (!this.isHtmlRenderMode()) {\n return _get(_getPrototypeOf(SelectComponent.prototype), \"itemValueForHTMLMode\", this).call(this, value);\n }\n if (Array.isArray(value)) {\n var values = value.map(function (item) {\n return Array.isArray(item) ? _this3.itemValueForHTMLMode(item) : _this3.getSingleItemValueForHTMLMode(item);\n });\n return values.join(', ');\n }\n return this.getSingleItemValueForHTMLMode(value);\n }\n\n /* eslint-enable max-statements */\n }, {\n key: \"defaultValue\",\n get: function get() {\n var defaultValue = _get(_getPrototypeOf(SelectComponent.prototype), \"defaultValue\", this);\n if (!defaultValue && (this.component.defaultValue === false || this.component.defaultValue === 0)) {\n defaultValue = this.component.defaultValue;\n }\n return defaultValue;\n }\n }, {\n key: \"getTemplateKeys\",\n value: function getTemplateKeys() {\n var _this4 = this;\n this.templateKeys = [];\n if (this.options.readOnly && this.component.template) {\n var keys = this.component.template.match(/({{\\s*(.*?)\\s*}})/g);\n if (keys) {\n keys.forEach(function (key) {\n var propKey = key.match(/{{\\s*item\\.(.*?)\\s*}}/);\n if (propKey && propKey.length > 1) {\n _this4.templateKeys.push(propKey[1]);\n }\n });\n }\n }\n }\n }, {\n key: \"loadingError\",\n get: function get() {\n return !this.component.refreshOn && !this.component.refreshOnBlur && this.networkError;\n }\n }, {\n key: \"selectData\",\n get: function get() {\n var selectData = _lodash.default.get(this.root, 'submission.metadata.selectData', {});\n return _lodash.default.get(selectData, this.path);\n }\n }, {\n key: \"shouldLoad\",\n get: function get() {\n if (this.loadingError) {\n return false;\n }\n // Live forms should always load.\n if (!this.options.readOnly) {\n return true;\n }\n\n // If there are template keys, then we need to see if we have the data.\n if (this.templateKeys && this.templateKeys.length) {\n // See if we already have the data we need.\n var dataValue = this.dataValue;\n var selectData = this.selectData;\n return this.templateKeys.reduce(function (shouldLoad, key) {\n var hasValue = _lodash.default.has(dataValue, key) || _lodash.default.has(selectData, key);\n return shouldLoad || !hasValue;\n }, false);\n }\n\n // Return that we should load.\n return true;\n }\n }, {\n key: \"loadItems\",\n value: function loadItems(url, search, headers, options, method, body) {\n var _this5 = this;\n options = options || {};\n\n // See if we should load items or not.\n if (!this.shouldLoad || !this.itemsFromUrl && this.options.readOnly) {\n this.isScrollLoading = false;\n this.loading = false;\n this.itemsLoadedResolve();\n return;\n }\n\n // See if they have not met the minimum search requirements.\n var minSearch = parseInt(this.component.minSearch, 10);\n if ((this.component.searchField || this.component.data.noco_db_conditions && this.component.data.noco_db_conditions.length > 0 && this.component.data.noco_db_conditions[0].name.length > 0) && minSearch > 0 && (!search || search.length < minSearch)) {\n // Set empty items.\n return this.setItems([]);\n }\n\n // Ensure we have a method and remove any body if method is get\n method = method || 'GET';\n if (method.toUpperCase() === 'GET') {\n body = null;\n }\n var limit = this.component.limit || 100;\n var skip = this.isScrollLoading ? this.selectOptions.length : 0;\n var query = this.component.disableLimit ? {} : {\n limit: limit,\n skip: skip\n };\n\n // Allow for url interpolation.\n url = this.interpolate(url, {\n formioBase: _Formio.GlobalFormio.getBaseUrl(),\n search: search,\n limit: limit,\n skip: skip,\n page: Math.abs(Math.floor(skip / limit))\n });\n\n // Add search capability.\n if (this.component.searchField && search) {\n if (Array.isArray(search)) {\n query[\"\".concat(this.component.searchField)] = search.join(',');\n } else {\n query[\"\".concat(this.component.searchField)] = search;\n }\n }\n\n // If they wish to return only some fields.\n if (this.component.selectFields) {\n query.select = this.component.selectFields;\n }\n\n // Add sort capability\n if (this.component.sort) {\n query.sort = this.component.sort;\n }\n\n // 添加nocoDb查询参数\n if (this.component.data.noco_db_conditions && this.component.data.noco_db_conditions.length > 0 && this.component.data.noco_db_conditions[0].name.length > 0 && search && search.length > 0) {\n var where = \"\";\n this.component.data.noco_db_conditions.forEach(function (item, index) {\n if (index === 0 && item.logical_operator === \"~not\") {\n where += \"(\".concat(item.name, \",\").concat(item.operator, \",\").concat(search, \")\");\n } else {\n where += \"\".concat(item.logical_operator, \"(\").concat(item.name, \",\").concat(item.operator, \",\").concat(search, \")\");\n }\n });\n query.where = where;\n }\n if (!_lodash.default.isEmpty(query)) {\n // Add the query string.\n url += (!url.includes('?') ? '?' : '&') + _Formio.GlobalFormio.serialize(query, function (item) {\n return _this5.interpolate(item);\n });\n }\n\n // Add filter capability\n if (this.component.filter) {\n url += (!url.includes('?') ? '?' : '&') + this.interpolate(this.component.filter);\n }\n\n // Set ignoreCache if it is\n options.ignoreCache = this.component.ignoreCache;\n\n // Make the request.\n options.header = headers;\n this.loading = true;\n try {\n url = JSON.parse(this.parseTpl(JSON.stringify({\n url: url\n }), {\n data: this.rootValue\n })).url;\n } catch (e) {}\n _Formio.GlobalFormio.makeRequest(this.options.formio, 'select', url, method, body, options).then(function (response) {\n _this5.loading = false;\n _this5.error = null;\n _this5.setItems(response, !!search);\n }).catch(function (err) {\n if (_this5.itemsFromUrl) {\n _this5.setItems([]);\n _this5.disableInfiniteScroll();\n }\n _this5.isScrollLoading = false;\n _this5.handleLoadingError(err);\n });\n }\n }, {\n key: \"handleLoadingError\",\n value: function handleLoadingError(err) {\n this.loading = false;\n if (err.networkError) {\n this.networkError = true;\n }\n this.itemsLoadedResolve();\n this.emit('componentError', {\n component: this.component,\n message: err.toString()\n });\n console.warn(\"Unable to load resources for \".concat(this.key));\n }\n /**\n * Get the request headers for this select dropdown.\n */\n }, {\n key: \"requestHeaders\",\n get: function get() {\n var _this6 = this;\n // Create the headers object.\n var headers = new _Formio.GlobalFormio.Headers();\n\n // Add custom headers to the url.\n if (this.component.data && this.component.data.headers) {\n try {\n _lodash.default.each(this.component.data.headers, function (header) {\n if (header.key) {\n headers.set(header.key, _this6.interpolate(header.value));\n }\n });\n } catch (err) {\n console.warn(err.message);\n }\n }\n return headers;\n }\n }, {\n key: \"getCustomItems\",\n value: function getCustomItems() {\n var customItems = this.evaluate(this.component.data.custom, {\n values: []\n }, 'values');\n this.asyncValues = (0, _utils.isPromise)(customItems);\n return customItems;\n }\n }, {\n key: \"asyncCustomValues\",\n value: function asyncCustomValues() {\n if (!_lodash.default.isBoolean(this.asyncValues)) {\n this.getCustomItems();\n }\n return this.asyncValues;\n }\n }, {\n key: \"updateCustomItems\",\n value: function updateCustomItems(forceUpdate) {\n var _this7 = this;\n if (this.asyncCustomValues()) {\n if (!forceUpdate && !this.active) {\n this.itemsLoadedResolve();\n return;\n }\n this.loading = true;\n this.getCustomItems().then(function (items) {\n _this7.loading = false;\n _this7.setItems(items || []);\n }).catch(function (err) {\n _this7.handleLoadingError(err);\n });\n } else {\n this.setItems(this.getCustomItems() || []);\n }\n }\n }, {\n key: \"isEmpty\",\n value: function isEmpty() {\n var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.dataValue;\n return _get(_getPrototypeOf(SelectComponent.prototype), \"isEmpty\", this).call(this, value) || value === undefined;\n }\n }, {\n key: \"refresh\",\n value: function refresh(value, _ref3) {\n var instance = _ref3.instance;\n if (this.component.clearOnRefresh && instance && !instance.pristine) {\n this.setValue(this.emptyValue);\n }\n this.updateItems(null, true);\n }\n }, {\n key: \"additionalResourcesAvailable\",\n get: function get() {\n return _lodash.default.isNil(this.serverCount) || this.serverCount > this.downloadedResources.length;\n }\n }, {\n key: \"serverCount\",\n get: function get() {\n if (this.isFromSearch) {\n return this.searchServerCount;\n }\n return this.defaultServerCount;\n },\n set: function set(value) {\n if (this.isFromSearch) {\n this.searchServerCount = value;\n } else {\n this.defaultServerCount = value;\n }\n }\n }, {\n key: \"downloadedResources\",\n get: function get() {\n if (this.isFromSearch) {\n return this.searchDownloadedResources;\n }\n return this.defaultDownloadedResources;\n },\n set: function set(value) {\n if (this.isFromSearch) {\n this.searchDownloadedResources = value;\n } else {\n this.defaultDownloadedResources = value;\n }\n }\n }, {\n key: \"addPlaceholder\",\n value: function addPlaceholder() {\n if (!this.component.placeholder) {\n return;\n }\n this.addOption('', this.component.placeholder, {\n placeholder: true\n });\n }\n\n /**\n * Activate this select control.\n */\n }, {\n key: \"activate\",\n value: function activate() {\n if (this.loading || !this.active) {\n this.setLoadingItem();\n }\n if (this.active) {\n return;\n }\n this.activated = true;\n this.triggerUpdate();\n }\n }, {\n key: \"setLoadingItem\",\n value: function setLoadingItem() {\n var addToCurrentList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n if (this.choices) {\n if (addToCurrentList) {\n this.choices.setChoices([{\n value: \"\".concat(this.id, \"-loading\"),\n label: 'Loading...',\n disabled: true\n }], 'value', 'label');\n } else {\n this.choices.setChoices([{\n value: '',\n label: \"<i class=\\\"\".concat(this.iconClass('refresh'), \"\\\" style=\\\"font-size:1.3em;\\\"></i>\"),\n disabled: true\n }], 'value', 'label', true);\n }\n } else if (this.component.dataSrc === 'url' || this.component.dataSrc === 'resource' || this.component.dataSrc === 'noco_db') {\n this.addOption('', this.t('loading...'));\n }\n }\n }, {\n key: \"active\",\n get: function get() {\n return !this.component.lazyLoad || this.activated;\n }\n }, {\n key: \"render\",\n value: function render() {\n var info = this.inputInfo;\n info.attr = info.attr || {};\n info.multiple = this.component.multiple;\n return _get(_getPrototypeOf(SelectComponent.prototype), \"render\", this).call(this, this.wrapElement(this.renderTemplate('select', {\n input: info,\n selectOptions: '',\n index: null\n })));\n }\n }, {\n key: \"wrapElement\",\n value: function wrapElement(element) {\n return this.component.addResource && !this.options.readOnly ? this.renderTemplate('resourceAdd', {\n element: element\n }) : element;\n }\n }, {\n key: \"choicesOptions\",\n value: function choicesOptions() {\n var useSearch = this.component.hasOwnProperty('searchEnabled') ? this.component.searchEnabled : true;\n var placeholderValue = this.t(this.component.placeholder, {\n _userInput: true\n });\n var customOptions = this.component.customOptions || {};\n if (typeof customOptions == 'string') {\n try {\n customOptions = JSON.parse(customOptions);\n } catch (err) {\n console.warn(err.message);\n customOptions = {};\n }\n }\n var commonFuseOptions = {\n maxPatternLength: 1000,\n distance: 1000\n };\n return _objectSpread({\n removeItemButton: this.component.disabled ? false : _lodash.default.get(this.component, 'removeItemButton', true),\n itemSelectText: '',\n classNames: {\n containerOuter: 'choices form-group formio-choices',\n containerInner: this.transform('class', 'form-control ui fluid selection dropdown')\n },\n addItemText: false,\n placeholder: !!this.component.placeholder,\n placeholderValue: placeholderValue,\n noResultsText: this.t('No results found'),\n noChoicesText: this.t('No choices to choose from'),\n searchPlaceholderValue: this.t('Type to search'),\n shouldSort: false,\n position: this.component.dropdown || 'auto',\n searchEnabled: useSearch,\n searchChoices: !this.component.searchField,\n searchFields: _lodash.default.get(this, 'component.searchFields', ['label']),\n shadowRoot: this.root ? this.root.shadowRoot : null,\n fuseOptions: this.component.useExactSearch ? _objectSpread({\n tokenize: true,\n matchAllTokens: true\n }, commonFuseOptions) : Object.assign({}, _lodash.default.get(this, 'component.fuseOptions', {}), _objectSpread({\n include: 'score',\n threshold: _lodash.default.get(this, 'component.selectThreshold', 0.3)\n }, commonFuseOptions)),\n valueComparer: _lodash.default.isEqual,\n resetScrollPosition: false\n }, customOptions);\n }\n\n /* eslint-disable max-statements */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this8 = this,\n _this$choices2,\n _this$choices2$contai,\n _this$choices2$contai2;\n var superAttach = _get(_getPrototypeOf(SelectComponent.prototype), \"attach\", this).call(this, element);\n this.loadRefs(element, {\n selectContainer: 'single',\n addResource: 'single',\n autocompleteInput: 'single'\n });\n //enable autocomplete for select\n var autocompleteInput = this.refs.autocompleteInput;\n if (autocompleteInput) {\n this.addEventListener(autocompleteInput, 'change', function (event) {\n _this8.setValue(event.target.value);\n });\n }\n var input = this.refs.selectContainer;\n if (!input) {\n return;\n }\n this.addEventListener(input, this.inputInfo.changeEvent, function () {\n return _this8.updateValue(null, {\n modified: true\n });\n });\n this.attachRefreshOnBlur();\n if (this.component.widget === 'html5') {\n this.addFocusBlurEvents(input);\n this.triggerUpdate(null, true);\n if (this.visible) {\n this.setItems(this.selectOptions || []);\n }\n this.focusableElement = input;\n this.addEventListener(input, 'focus', function () {\n return _this8.update();\n });\n this.addEventListener(input, 'keydown', function (event) {\n var key = event.key;\n if (['Backspace', 'Delete'].includes(key)) {\n _this8.setValue(_this8.emptyValue);\n }\n });\n return;\n }\n var tabIndex = input.tabIndex;\n this.addPlaceholder();\n input.setAttribute('dir', this.i18next.dir());\n if ((_this$choices2 = this.choices) !== null && _this$choices2 !== void 0 && (_this$choices2$contai = _this$choices2.containerOuter) !== null && _this$choices2$contai !== void 0 && (_this$choices2$contai2 = _this$choices2$contai.element) !== null && _this$choices2$contai2 !== void 0 && _this$choices2$contai2.parentNode) {\n this.choices.destroy();\n }\n var choicesOptions = this.choicesOptions();\n if (Choices) {\n this.choices = new Choices(input, choicesOptions);\n if (this.choices.input && this.choices.input.element) {\n this.choices.input.element.addEventListener(\"input\", this.choices._onKeyUp, {\n passive: true\n });\n }\n if (this.selectOptions && this.selectOptions.length) {\n this.choices.setChoices(this.selectOptions, 'value', 'label', true);\n }\n if (this.component.multiple) {\n this.focusableElement = this.choices.input.element;\n } else {\n this.focusableElement = this.choices.containerInner.element;\n this.choices.containerOuter.element.setAttribute('tabIndex', '-1');\n this.addEventListener(this.choices.containerOuter.element, 'focus', function () {\n return _this8.focusableElement.focus();\n });\n }\n this.addFocusBlurEvents(this.focusableElement);\n if (this.itemsFromUrl) {\n this.scrollList = this.choices.choiceList.element;\n this.addEventListener(this.scrollList, 'scroll', function () {\n return _this8.onScroll();\n });\n }\n }\n if (window && this.choices && this.shouldPositionDropdown) {\n this.addEventListener(window.document, 'scroll', function () {\n _this8.positionDropdown(true);\n }, false, true);\n }\n this.focusableElement.setAttribute('tabIndex', tabIndex);\n\n // If a search field is provided, then add an event listener to update items on search.\n if (this.component.searchField || this.component.data.noco_db_conditions && this.component.data.noco_db_conditions.length > 0 && this.component.data.noco_db_conditions[0].name.length > 0) {\n // Make sure to clear the search when no value is provided.\n if (this.choices && this.choices.input && this.choices.input.element) {\n this.addEventListener(this.choices.input.element, 'input', function (event) {\n _this8.isFromSearch = !!event.target.value;\n if (!event.target.value) {\n _this8.triggerUpdate();\n } else {\n _this8.serverCount = null;\n _this8.downloadedResources = [];\n }\n });\n }\n this.addEventListener(input, 'choice', function () {\n if (_this8.component.multiple && _this8.component.dataSrc === 'resource' && _this8.isFromSearch) {\n _this8.triggerUpdate();\n }\n _this8.isFromSearch = false;\n });\n // avoid spamming the resource/url endpoint when we have server side filtering enabled.\n var debounceTimeout = (this.component.searchField || this.component.data.noco_db_conditions && this.component.data.noco_db_conditions.length > 0 && this.component.data.noco_db_conditions[0].name.length > 0) && (this.isSelectResource || this.isSelectURL) ? (this.component.searchDebounce === 0 ? 0 : this.component.searchDebounce || this.defaultSchema.searchDebounce) * 1000 : 0;\n var updateComponent = function updateComponent(evt) {\n _this8.triggerUpdate(evt.detail.value);\n };\n this.addEventListener(input, 'search', _lodash.default.debounce(function (e) {\n updateComponent(e);\n _this8.positionDropdown();\n }, debounceTimeout));\n this.addEventListener(input, 'stopSearch', function () {\n return _this8.triggerUpdate();\n });\n this.addEventListener(input, 'hideDropdown', function () {\n if (_this8.choices && _this8.choices.input && _this8.choices.input.element) {\n _this8.choices.input.element.value = '';\n }\n _this8.updateItems(null, true);\n });\n }\n this.addEventListener(input, 'showDropdown', function () {\n _this8.update();\n _this8.positionDropdown();\n });\n if (this.shouldPositionDropdown) {\n this.addEventListener(input, 'highlightChoice', function () {\n _this8.positionDropdown();\n });\n }\n if (this.choices && choicesOptions.placeholderValue && this.choices._isSelectOneElement) {\n this.addPlaceholderItem(choicesOptions.placeholderValue);\n this.addEventListener(input, 'removeItem', function () {\n _this8.addPlaceholderItem(choicesOptions.placeholderValue);\n });\n }\n\n // Add value options.\n this.addValueOptions();\n this.setChoicesValue(this.dataValue);\n if (this.isSelectResource && this.refs.addResource) {\n this.addEventListener(this.refs.addResource, 'click', function (event) {\n event.preventDefault();\n var formioForm = _this8.ce('div');\n var dialog = _this8.createModal(formioForm);\n var projectUrl = _lodash.default.get(_this8.root, 'formio.projectUrl', _Formio.GlobalFormio.getProjectUrl());\n var formUrl = \"\".concat(projectUrl, \"/form/\").concat(_this8.component.data.resource);\n new _Form.default(formioForm, formUrl, {}).ready.then(function (form) {\n form.on('submit', function (submission) {\n // If valueProperty is set, replace the submission with the corresponding value\n var value = _this8.valueProperty ? _lodash.default.get(submission, _this8.valueProperty) : submission;\n if (_this8.component.multiple) {\n value = [].concat(_toConsumableArray(_this8.dataValue), [value]);\n }\n _this8.setValue(value);\n _this8.triggerUpdate();\n dialog.close();\n });\n });\n });\n }\n\n // Force the disabled state with getters and setters.\n this.disabled = this.shouldDisabled;\n this.triggerUpdate();\n return superAttach;\n }\n }, {\n key: \"setDropdownPosition\",\n value: function setDropdownPosition() {\n var _this$choices3, _this$choices3$dropdo, _this$choices4, _this$choices4$contai;\n var dropdown = (_this$choices3 = this.choices) === null || _this$choices3 === void 0 ? void 0 : (_this$choices3$dropdo = _this$choices3.dropdown) === null || _this$choices3$dropdo === void 0 ? void 0 : _this$choices3$dropdo.element;\n var container = (_this$choices4 = this.choices) === null || _this$choices4 === void 0 ? void 0 : (_this$choices4$contai = _this$choices4.containerOuter) === null || _this$choices4$contai === void 0 ? void 0 : _this$choices4$contai.element;\n if (!dropdown || !container) {\n return;\n }\n var containerPosition = container.getBoundingClientRect();\n var isFlipped = container.classList.contains('is-flipped');\n _lodash.default.assign(dropdown.style, {\n top: \"\".concat(isFlipped ? containerPosition.top - dropdown.offsetHeight : containerPosition.top + containerPosition.height, \"px\"),\n left: \"\".concat(containerPosition.left, \"px\"),\n width: \"\".concat(containerPosition.width, \"px\"),\n position: 'fixed',\n bottom: 'unset',\n right: 'unset'\n });\n }\n }, {\n key: \"hasDataGridAncestor\",\n value: function hasDataGridAncestor(comp) {\n comp = comp || this;\n if (comp.inDataGrid || comp.type === 'datagrid') {\n return true;\n } else if (comp.parent) {\n return this.hasDataGridAncestor(comp.parent);\n } else {\n return false;\n }\n }\n }, {\n key: \"positionDropdown\",\n value: function positionDropdown(scroll) {\n var _this$choices$dropdow,\n _this9 = this;\n if (!this.shouldPositionDropdown || !this.choices || !((_this$choices$dropdow = this.choices.dropdown) !== null && _this$choices$dropdow !== void 0 && _this$choices$dropdow.isActive) && scroll) {\n return;\n }\n this.setDropdownPosition();\n this.itemsLoaded.then(function () {\n _this9.setDropdownPosition();\n });\n }\n }, {\n key: \"isLoadingAvailable\",\n get: function get() {\n return !this.isScrollLoading && this.additionalResourcesAvailable;\n }\n }, {\n key: \"onScroll\",\n value: function onScroll() {\n if (this.isLoadingAvailable) {\n this.isScrollLoading = true;\n this.setLoadingItem(true);\n this.triggerUpdate(this.choices.input.element.value);\n }\n }\n }, {\n key: \"attachRefreshOnBlur\",\n value: function attachRefreshOnBlur() {\n var _this10 = this;\n if (this.component.refreshOnBlur) {\n this.on('blur', function (instance) {\n _this10.checkRefreshOn([{\n instance: instance,\n value: instance.dataValue\n }], {\n fromBlur: true\n });\n });\n }\n }\n }, {\n key: \"addPlaceholderItem\",\n value: function addPlaceholderItem(placeholderValue) {\n var items = this.choices._store.activeItems;\n if (!items.length) {\n this.choices._addItem({\n value: placeholderValue,\n label: placeholderValue,\n choiceId: 0,\n groupId: -1,\n customProperties: null,\n placeholder: true,\n keyCode: null\n });\n }\n }\n\n /* eslint-enable max-statements */\n }, {\n key: \"update\",\n value: function update() {\n if (this.component.dataSrc === 'custom') {\n this.updateCustomItems();\n }\n // Activate the control.\n this.activate();\n }\n }, {\n key: \"disabled\",\n get: function get() {\n return _get(_getPrototypeOf(SelectComponent.prototype), \"disabled\", this);\n },\n set: function set(disabled) {\n _set(_getPrototypeOf(SelectComponent.prototype), \"disabled\", disabled, this, true);\n if (!this.choices) {\n return;\n }\n if (disabled) {\n this.setDisabled(this.choices.containerInner.element, true);\n this.focusableElement.removeAttribute('tabIndex');\n this.choices.disable();\n } else {\n this.setDisabled(this.choices.containerInner.element, false);\n this.focusableElement.setAttribute('tabIndex', this.component.tabindex || 0);\n this.choices.enable();\n }\n }\n }, {\n key: \"visible\",\n get: function get() {\n return _get(_getPrototypeOf(SelectComponent.prototype), \"visible\", this);\n }\n\n /**\n * @param {*} value\n * @param {Array} items\n */,\n set: function set(value) {\n // If we go from hidden to visible, trigger a refresh.\n if (value && !this._visible !== !value) {\n this.triggerUpdate();\n }\n _set(_getPrototypeOf(SelectComponent.prototype), \"visible\", value, this, true);\n }\n }, {\n key: \"addCurrentChoices\",\n value: function addCurrentChoices(values, items, keyValue) {\n var _this11 = this;\n if (!values) {\n return false;\n }\n var notFoundValuesToAdd = [];\n var added = values.reduce(function (defaultAdded, value) {\n if (!value || _lodash.default.isEmpty(value)) {\n return defaultAdded;\n }\n var found = false;\n\n // Make sure that `items` and `this.selectOptions` points\n // to the same reference. Because `this.selectOptions` is\n // internal property and all items are populated by\n // `this.addOption` method, we assume that items has\n // 'label' and 'value' properties. This assumption allows\n // us to read correct value from the item.\n var isSelectOptions = items === _this11.selectOptions;\n if (items && items.length) {\n _lodash.default.each(items, function (choice) {\n if (choice._id && value._id && choice._id === value._id) {\n found = true;\n return false;\n }\n var itemValue = keyValue ? choice.value : _this11.itemValue(choice, isSelectOptions);\n found |= _lodash.default.isEqual(itemValue, value);\n return found ? false : true;\n });\n }\n\n // Add the default option if no item is found.\n if (!found) {\n notFoundValuesToAdd.push(_this11.selectValueAndLabel(value));\n return true;\n }\n return found || defaultAdded;\n }, false);\n if (notFoundValuesToAdd.length) {\n if (this.choices) {\n this.choices.setChoices(notFoundValuesToAdd, 'value', 'label');\n }\n notFoundValuesToAdd.map(function (notFoundValue) {\n _this11.addOption(notFoundValue.value, notFoundValue.label);\n });\n }\n return added;\n }\n }, {\n key: \"getValueAsString\",\n value: function getValueAsString(data) {\n return this.component.multiple && Array.isArray(data) ? data.map(this.asString.bind(this)).join(', ') : this.asString(data);\n }\n }, {\n key: \"getValue\",\n value: function getValue() {\n // If the widget isn't active.\n if (this.viewOnly || this.loading || !this.component.lazyLoad && !this.selectOptions.length || !this.element) {\n return this.dataValue;\n }\n var value = this.emptyValue;\n if (this.choices) {\n value = this.choices.getValue(true);\n\n // Make sure we don't get the placeholder\n if (!this.component.multiple && this.component.placeholder && value === this.t(this.component.placeholder, {\n _userInput: true\n })) {\n value = this.emptyValue;\n }\n } else if (this.refs.selectContainer) {\n value = this.refs.selectContainer.value;\n if (this.valueProperty === '') {\n if (value === '') {\n return {};\n }\n var option = this.selectOptions[value];\n if (option && _lodash.default.isObject(option.value)) {\n value = option.value;\n }\n }\n } else {\n value = this.dataValue;\n }\n // Choices will return undefined if nothing is selected. We really want '' to be empty.\n if (value === undefined || value === null) {\n value = '';\n }\n return value;\n }\n }, {\n key: \"redraw\",\n value: function redraw() {\n var done = _get(_getPrototypeOf(SelectComponent.prototype), \"redraw\", this).call(this);\n this.triggerUpdate();\n return done;\n }\n }, {\n key: \"normalizeSingleValue\",\n value: function normalizeSingleValue(value, retainObject) {\n var _this12 = this;\n if (_lodash.default.isNil(value)) {\n return;\n }\n var valueIsObject = _lodash.default.isObject(value);\n //check if value equals to default emptyValue\n if (valueIsObject && Object.keys(value).length === 0) {\n return value;\n }\n // Check to see if we need to save off the template data into our metadata.\n if (retainObject) {\n var _this$root;\n var templateValue = this.component.reference && value !== null && value !== void 0 && value._id ? value._id.toString() : value;\n var shouldSaveData = !valueIsObject || this.component.reference;\n if (templateValue && shouldSaveData && this.templateData && this.templateData[templateValue] && (_this$root = this.root) !== null && _this$root !== void 0 && _this$root.submission) {\n var submission = this.root.submission;\n if (!submission.metadata) {\n submission.metadata = {};\n }\n if (!submission.metadata.selectData) {\n submission.metadata.selectData = {};\n }\n var templateData = this.templateData[templateValue];\n if (this.component.multiple) {\n templateData = {};\n var dataValue = this.dataValue;\n if (dataValue && dataValue.length) {\n dataValue.forEach(function (dataValueItem) {\n var dataValueItemValue = _this12.component.reference ? dataValueItem._id.toString() : dataValueItem;\n templateData[dataValueItemValue] = _this12.templateData[dataValueItemValue];\n });\n }\n }\n _lodash.default.set(submission.metadata.selectData, this.path, templateData);\n }\n }\n var displayEntireObject = this.isEntireObjectDisplay();\n var dataType = this.component.dataType || 'auto';\n var normalize = {\n value: value,\n number: function number() {\n var numberValue = Number(this.value);\n var isEquivalent = value.toString() === numberValue.toString();\n if (!Number.isNaN(numberValue) && Number.isFinite(numberValue) && value !== '' && isEquivalent) {\n this.value = numberValue;\n }\n return this;\n },\n boolean: function boolean() {\n if (_lodash.default.isString(this.value) && (this.value.toLowerCase() === 'true' || this.value.toLowerCase() === 'false')) {\n this.value = this.value.toLowerCase() === 'true';\n }\n return this;\n },\n string: function string() {\n this.value = String(this.value);\n return this;\n },\n object: function object() {\n if (_lodash.default.isObject(this.value) && displayEntireObject && !retainObject) {\n this.value = JSON.stringify(this.value);\n }\n return this;\n },\n auto: function auto() {\n if (_lodash.default.isObject(this.value)) {\n this.value = this.object().value;\n } else {\n this.value = this.string().number().boolean().value;\n }\n return this;\n }\n };\n try {\n return normalize[dataType]().value;\n } catch (err) {\n console.warn('Failed to normalize value', err);\n return value;\n }\n }\n\n /**\n * Normalize values coming into updateValue.\n *\n * @param value\n * @return {*}\n */\n }, {\n key: \"normalizeValue\",\n value: function normalizeValue(value) {\n var _this13 = this;\n if (this.component.multiple && Array.isArray(value)) {\n return value.map(function (singleValue) {\n return _this13.normalizeSingleValue(singleValue, true);\n });\n }\n return _get(_getPrototypeOf(SelectComponent.prototype), \"normalizeValue\", this).call(this, this.normalizeSingleValue(value, true));\n }\n }, {\n key: \"setValue\",\n value: function setValue(value) {\n var _this14 = this;\n var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var previousValue = this.dataValue;\n if (this.component.widget === 'html5' && (_lodash.default.isEqual(value, previousValue) || _lodash.default.isEqual(previousValue, {}) && _lodash.default.isEqual(flags, {}))) {\n return false;\n }\n var changed = this.updateValue(value, flags);\n value = this.dataValue;\n var hasPreviousValue = !this.isEmpty(previousValue);\n var hasValue = !this.isEmpty(value);\n\n // Undo typing when searching to set the value.\n if (this.component.multiple && Array.isArray(value)) {\n value = value.map(function (value) {\n if (typeof value === 'boolean' || typeof value === 'number') {\n return value.toString();\n }\n return value;\n });\n } else {\n if (typeof value === 'boolean' || typeof value === 'number') {\n value = value.toString();\n }\n }\n if (this.isHtmlRenderMode() && flags && flags.fromSubmission && changed) {\n this.itemsLoaded.then(function () {\n _this14.redraw();\n });\n return changed;\n }\n\n // Do not set the value if we are loading... that will happen after it is done.\n if (this.loading) {\n return changed;\n }\n\n // Determine if we need to perform an initial lazyLoad api call if searchField is provided.\n if (this.isInitApiCallNeeded(hasValue)) {\n this.loading = true;\n this.lazyLoadInit = true;\n var searchProperty = this.component.searchField || this.component.valueProperty || this.component.data.noco_db_conditions && this.component.data.noco_db_conditions.length > 0 && this.component.data.noco_db_conditions[0].name.length > 0;\n this.triggerUpdate(_lodash.default.get(value.data || value, searchProperty, value), true);\n return changed;\n }\n\n // Add the value options.\n this.itemsLoaded.then(function () {\n _this14.addValueOptions();\n _this14.setChoicesValue(value, hasPreviousValue, flags);\n });\n return changed;\n }\n }, {\n key: \"isInitApiCallNeeded\",\n value: function isInitApiCallNeeded(hasValue) {\n return this.component.lazyLoad && !this.lazyLoadInit && !this.active && !this.selectOptions.length && hasValue && this.shouldLoad && this.visible && (this.component.searchField || this.component.valueProperty || this.component.data.noco_db_conditions && this.component.data.noco_db_conditions.length > 0 && this.component.data.noco_db_conditions[0].name.length > 0);\n }\n }, {\n key: \"setChoicesValue\",\n value: function setChoicesValue(value, hasPreviousValue) {\n var flags = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var hasValue = !this.isEmpty(value) || flags.fromSubmission;\n hasPreviousValue = hasPreviousValue === undefined ? true : hasPreviousValue;\n if (this.choices) {\n // Now set the value.\n if (hasValue) {\n this.choices.removeActiveItems();\n // Add the currently selected choices if they don't already exist.\n var currentChoices = Array.isArray(value) ? value : [value];\n if (!this.addCurrentChoices(currentChoices, this.selectOptions, true)) {\n this.choices.setChoices(this.selectOptions, 'value', 'label', true);\n }\n this.choices.setChoiceByValue(value);\n } else if (hasPreviousValue || flags.resetValue) {\n this.choices.removeActiveItems();\n }\n } else {\n if (hasValue) {\n var values = Array.isArray(value) ? value : [value];\n if (!_lodash.default.isEqual(this.dataValue, this.defaultValue) && this.selectOptions.length < 2) {\n var _this$selectValueAndL = this.selectValueAndLabel(this.dataValue),\n _value2 = _this$selectValueAndL.value,\n label = _this$selectValueAndL.label;\n this.addOption(_value2, label);\n }\n _lodash.default.each(this.selectOptions, function (selectOption) {\n _lodash.default.each(values, function (val) {\n if (selectOption.value === '') {\n selectOption.value = {};\n }\n if (_lodash.default.isEqual(val, selectOption.value) && selectOption.element) {\n selectOption.element.selected = true;\n selectOption.element.setAttribute('selected', 'selected');\n return false;\n }\n });\n });\n } else {\n _lodash.default.each(this.selectOptions, function (selectOption) {\n if (selectOption.element) {\n selectOption.element.selected = false;\n selectOption.element.removeAttribute('selected');\n }\n });\n }\n }\n }\n }, {\n key: \"itemsLoaded\",\n get: function get() {\n return this._itemsLoaded || _nativePromiseOnly.default.resolve();\n },\n set: function set(promise) {\n this._itemsLoaded = promise;\n }\n }, {\n key: \"validateValueAvailability\",\n value: function validateValueAvailability(setting, value) {\n var _this15 = this;\n if (!(0, _utils.boolValue)(setting) || !value) {\n return true;\n }\n var values = this.getOptionsValues();\n if (values) {\n if (_lodash.default.isObject(value)) {\n var compareComplexValues = function compareComplexValues(optionValue) {\n var normalizedOptionValue = _this15.normalizeSingleValue(optionValue, true);\n if (!_lodash.default.isObject(normalizedOptionValue)) {\n return false;\n }\n try {\n return JSON.stringify(normalizedOptionValue) === JSON.stringify(value);\n } catch (err) {\n console.warn.error('Error while comparing items', err);\n return false;\n }\n };\n return values.findIndex(function (optionValue) {\n return compareComplexValues(optionValue);\n }) !== -1;\n }\n return values.findIndex(function (optionValue) {\n return _this15.normalizeSingleValue(optionValue) === value;\n }) !== -1;\n }\n return false;\n }\n\n /**\n * Performs required transformations on the initial value to use in selectOptions\n * @param {*} value\n */\n }, {\n key: \"getOptionValue\",\n value: function getOptionValue(value) {\n return _lodash.default.isObject(value) && this.isEntireObjectDisplay() ? this.normalizeSingleValue(value) : _lodash.default.isObject(value) && (this.valueProperty || this.component.key !== 'resource') ? value : _lodash.default.isObject(value) && !this.valueProperty ? this.interpolate(this.component.template, {\n item: value\n }).replace(/<\\/?[^>]+(>|$)/g, '') : _lodash.default.isNull(value) ? this.emptyValue : String(this.normalizeSingleValue(value));\n }\n\n /**\n * If component has static values (values, json) or custom values, returns an array of them\n * @returns {Array<*>|undefined}\n */\n }, {\n key: \"getOptionsValues\",\n value: function getOptionsValues() {\n var _this16 = this;\n var rawItems = [];\n switch (this.component.dataSrc) {\n case 'values':\n rawItems = this.component.data.values;\n break;\n case 'json':\n rawItems = this.component.data.json;\n break;\n case 'custom':\n rawItems = this.getCustomItems();\n break;\n }\n if (typeof rawItems === 'string') {\n try {\n rawItems = JSON.parse(rawItems);\n } catch (err) {\n console.warn(err.message);\n rawItems = [];\n }\n }\n if (!Array.isArray(rawItems)) {\n return;\n }\n return rawItems.map(function (item) {\n return _this16.getOptionValue(_this16.itemValue(item));\n });\n }\n\n /**\n * Deletes the value of the component.\n */\n }, {\n key: \"deleteValue\",\n value: function deleteValue() {\n this.setValue('', {\n noUpdateEvent: true\n });\n this.unset();\n }\n\n /**\n * Check if a component is eligible for multiple validation\n *\n * @return {boolean}\n */\n }, {\n key: \"validateMultiple\",\n value: function validateMultiple() {\n // Select component will contain one input when flagged as multiple.\n return false;\n }\n\n /**\n * Output this select dropdown as a string value.\n * @return {*}\n */\n }, {\n key: \"isBooleanOrNumber\",\n value: function isBooleanOrNumber(value) {\n return typeof value === 'number' || typeof value === 'boolean';\n }\n }, {\n key: \"getNormalizedValues\",\n value: function getNormalizedValues() {\n var _this17 = this;\n if (!this.component || !this.component.data || !this.component.data.values) {\n return;\n }\n return this.component.data.values.map(function (value) {\n return {\n label: value.label,\n value: String(_this17.normalizeSingleValue(value.value))\n };\n });\n }\n }, {\n key: \"asString\",\n value: function asString(value) {\n var _value3,\n _this18 = this;\n value = (_value3 = value) !== null && _value3 !== void 0 ? _value3 : this.getValue();\n //need to convert values to strings to be able to compare values with available options that are strings\n var convertToString = function convertToString(data, valueProperty) {\n if (valueProperty) {\n if (Array.isArray(data)) {\n data.forEach(function (item) {\n return item[valueProperty] = item[valueProperty].toString();\n });\n } else {\n data[valueProperty] = data[valueProperty].toString();\n }\n return data;\n }\n if (_this18.isBooleanOrNumber(data)) {\n data = data.toString();\n }\n if (Array.isArray(data) && data.some(function (item) {\n return _this18.isBooleanOrNumber(item);\n })) {\n data = data.map(function (item) {\n if (_this18.isBooleanOrNumber(item)) {\n item = item.toString();\n }\n });\n }\n return data;\n };\n value = convertToString(value);\n if (['values', 'custom'].includes(this.component.dataSrc) && !this.asyncCustomValues()) {\n var _getFromValues;\n var _ref4 = this.component.dataSrc === 'values' ? {\n items: convertToString(this.getNormalizedValues(), 'value'),\n valueProperty: 'value'\n } : {\n items: convertToString(this.getCustomItems(), this.valueProperty),\n valueProperty: this.valueProperty\n },\n items = _ref4.items,\n valueProperty = _ref4.valueProperty;\n var getFromValues = function getFromValues() {\n var initialValue = _lodash.default.find(items, [valueProperty, value]);\n var values = _this18.defaultSchema.data.values || [];\n return _lodash.default.isEqual(initialValue, values[0]) ? '-' : initialValue;\n };\n value = this.component.multiple && Array.isArray(value) ? _lodash.default.filter(items, function (item) {\n return value.includes(item.value);\n }) : valueProperty ? (_getFromValues = getFromValues()) !== null && _getFromValues !== void 0 ? _getFromValues : {\n value: value,\n label: value\n } : value;\n }\n if (_lodash.default.isString(value)) {\n return value;\n }\n if (Array.isArray(value)) {\n var _items = [];\n value.forEach(function (item) {\n return _items.push(_this18.itemTemplate(item));\n });\n return _items.length > 0 ? _items.join('<br />') : '-';\n }\n return !_lodash.default.isNil(value) ? this.itemTemplate(value) : '-';\n }\n }, {\n key: \"detach\",\n value: function detach() {\n _get(_getPrototypeOf(SelectComponent.prototype), \"detach\", this).call(this);\n this.off('blur');\n if (this.choices) {\n var _this$choices$contain, _this$choices$contain2;\n if ((_this$choices$contain = this.choices.containerOuter) !== null && _this$choices$contain !== void 0 && (_this$choices$contain2 = _this$choices$contain.element) !== null && _this$choices$contain2 !== void 0 && _this$choices$contain2.parentNode) {\n this.choices.destroy();\n }\n this.choices = null;\n }\n }\n }, {\n key: \"focus\",\n value: function focus() {\n if (this.focusableElement) {\n _get(_getPrototypeOf(SelectComponent.prototype), \"focus\", this).call(this);\n this.focusableElement.focus();\n }\n }\n }, {\n key: \"setErrorClasses\",\n value: function setErrorClasses(elements, dirty, hasError, hasMessages) {\n var element = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : this.element;\n _get(_getPrototypeOf(SelectComponent.prototype), \"setErrorClasses\", this).call(this, elements, dirty, hasError, hasMessages, element);\n if (this.choices) {\n _get(_getPrototypeOf(SelectComponent.prototype), \"setErrorClasses\", this).call(this, [this.choices.containerInner.element], dirty, hasError, hasMessages, element);\n } else {\n _get(_getPrototypeOf(SelectComponent.prototype), \"setErrorClasses\", this).call(this, [this.refs.selectContainer], dirty, hasError, hasMessages, element);\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n for (var _len3 = arguments.length, extend = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n extend[_key3] = arguments[_key3];\n }\n return _ListComponent2.default.schema.apply(_ListComponent2.default, [{\n type: 'select',\n label: 'Select',\n key: 'select',\n idPath: 'id',\n data: {\n values: [{\n label: '',\n value: ''\n }],\n json: '',\n url: '',\n resource: '',\n custom: ''\n },\n clearOnRefresh: false,\n limit: 100,\n valueProperty: '',\n lazyLoad: true,\n filter: '',\n searchEnabled: true,\n searchDebounce: 0.3,\n searchField: '',\n minSearch: 0,\n readOnlyValue: false,\n selectFields: '',\n selectThreshold: 0.3,\n uniqueOptions: false,\n tableView: true,\n fuseOptions: {\n include: 'score',\n threshold: 0.3\n },\n indexeddb: {\n filter: {}\n },\n customOptions: {},\n useExactSearch: false\n }].concat(extend));\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Select',\n group: 'basic',\n icon: 'th-list',\n weight: 70,\n documentation: '/userguide/forms/form-components#select',\n schema: SelectComponent.schema()\n };\n }\n }]);\n return SelectComponent;\n}(_ListComponent2.default);\nexports[\"default\"] = SelectComponent;\n\n//# sourceURL=webpack://Formio/./lib/components/select/Select.js?");
2745
2745
 
2746
2746
  /***/ }),
2747
2747
 
@@ -3181,7 +3181,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
3181
3181
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
3182
3182
 
3183
3183
  "use strict";
3184
- eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.array.slice.js */ \"./node_modules/core-js/modules/es.array.slice.js\");\n__webpack_require__(/*! core-js/modules/es.array.from.js */ \"./node_modules/core-js/modules/es.array.from.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.array.includes.js */ \"./node_modules/core-js/modules/es.array.includes.js\");\n__webpack_require__(/*! core-js/modules/es.string.includes.js */ \"./node_modules/core-js/modules/es.string.includes.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _Formio = __webpack_require__(/*! ../../Formio */ \"./lib/Formio.js\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar Data = /*#__PURE__*/function (_FieldComponent) {\n _inherits(Data, _FieldComponent);\n var _super = _createSuper(Data);\n function Data(component, options, data) {\n var _this;\n _classCallCheck(this, Data);\n _this = _super.call(this, component, options, data);\n _this.isInitData = false;\n return _this;\n }\n _createClass(Data, [{\n key: \"get\",\n value: function get(path, obj) {\n var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : \"${\".concat(path, \"}\");\n return path.split('.').reduce(function (res, key) {\n return res[key] || fb;\n }, obj);\n }\n }, {\n key: \"parseTpl\",\n value: function parseTpl(template, map, fallback) {\n var _this2 = this;\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var path = match.substr(2, match.length - 3).trim();\n return _this2.get(path, map, fallback);\n });\n }\n }, {\n key: \"render\",\n value: function render(children) {\n return _get(_getPrototypeOf(Data.prototype), \"render\", this).call(this, this.renderTemplate('tree'));\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this3 = this;\n var refs = {};\n var self = this;\n this.loadRefs(element, refs);\n if (self.component.url) {\n var _this$component = this.component,\n _this$component$optio = _this$component.options,\n options = _this$component$optio === void 0 ? '{\"headers\":{}}' : _this$component$optio,\n _this$component$body = _this$component.body,\n body = _this$component$body === void 0 ? '{}' : _this$component$body;\n var parsedOptions = {\n ignoreCache: true\n };\n var parsedBody = {};\n try {\n parsedOptions = JSON.parse(this.parseTpl(options || '{\"headers\":{}}', {\n data: this.rootValue\n }, null));\n parsedBody = JSON.parse(this.parseTpl(body || '{}', {\n data: this.rootValue\n }, null));\n } catch (e) {\n console.log(e);\n }\n // 取消请求缓存\n parsedOptions.ignoreCache = true;\n _Formio.GlobalFormio.request(this.component.url, this.component.methods, this.component.methods !== 'GET' ? parsedBody : null, null, parsedOptions).then(function (response) {\n var tree = response;\n var container = element.querySelector('#myUL');\n // 添加列表\n tree.forEach(function (parent) {\n container.insertAdjacentHTML('beforeend', \"<li id=\\\"li-\".concat(parent.id, \"\\\" data-id=\\\"\").concat(parent.id, \"\\\"><input type=\\\"checkbox\\\" class=\\\"tree-input\\\"/><span class=\\\"box\\\">\").concat(parent.name, \"</span></li>\"));\n self.addChild(container, parent);\n });\n var toggler = container.getElementsByClassName('box');\n var i;\n for (i = 0; i < toggler.length; i++) {\n toggler[i].addEventListener('click', function () {\n if (this.parentElement.querySelector('.nested')) {\n this.parentElement.querySelector('.nested').classList.toggle('active');\n }\n });\n }\n var inputs = container.getElementsByClassName('tree-input');\n var _iterator = _createForOfIteratorHelper(inputs),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var input = _step.value;\n input.addEventListener('change', function (val) {\n self.updateValue();\n });\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n self.isInitData = true;\n setTimeout(function () {\n self.setValue(self.initValue);\n }, 300);\n return _get(_getPrototypeOf(Data.prototype), \"attach\", _this3).call(_this3, element);\n }).catch(function (e) {\n self.isInitData = true;\n return _get(_getPrototypeOf(Data.prototype), \"attach\", _this3).call(_this3, element);\n });\n }\n // Allow basic component functionality to attach like field logic and tooltips.\n }\n }, {\n key: \"addChild\",\n value: function addChild(container, parent) {\n var self = this;\n if (parent.children && parent.children.length > 0) {\n var parentNode = container.querySelector(\"#li-\".concat(parent.id));\n if (parentNode) {\n parentNode.insertAdjacentHTML('beforeend', \"<ul class=\\\"nested\\\" id=\\\"ul-\".concat(parent.id, \"\\\">\"));\n parent.children.forEach(function (child) {\n parentNode.querySelector(\"#ul-\".concat(parent.id)).insertAdjacentHTML('beforeend', \"<li id=\\\"li-\".concat(child.id, \"\\\" data-id=\\\"\").concat(child.id, \"\\\"><input type=\\\"checkbox\\\" class=\\\"tree-input\\\"/><span class=\\\"box\\\">\").concat(child.name, \"</span></li>\"));\n self.addChild(container, child);\n });\n }\n }\n }\n }, {\n key: \"getValue\",\n value: function getValue() {\n var value = [];\n var container = this.element.querySelector('#myUL');\n var checked = container.getElementsByClassName('tree-input');\n var _iterator2 = _createForOfIteratorHelper(checked),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var checkedElement = _step2.value;\n if (checkedElement.checked) {\n value.push(checkedElement.parentElement.dataset.id);\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n return value;\n }\n }, {\n key: \"setValue\",\n value:\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n function setValue(value) {\n var self = this;\n if (this.isInitData) {\n var checks = self.element.getElementsByClassName('tree-input');\n var _iterator3 = _createForOfIteratorHelper(checks),\n _step3;\n try {\n for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n var check = _step3.value;\n if (value && value.includes(check.parentElement.dataset.id)) {\n check.checked = true;\n }\n }\n } catch (err) {\n _iterator3.e(err);\n } finally {\n _iterator3.f();\n }\n return true;\n } else {\n this.initValue = JSON.parse(JSON.stringify(value));\n return true;\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _Field.default.schema({\n type: 'tree',\n header: '',\n url: '',\n height: 500,\n interval: 0\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Tree',\n group: 'advanced',\n icon: 'list-tree',\n weight: 70,\n documentation: 'http://help.form.io/userguide/#table',\n schema: Data.schema()\n };\n }\n }, {\n key: \"emptyValue\",\n get: function get() {\n return [];\n }\n }]);\n return Data;\n}(_Field.default);\nexports[\"default\"] = Data;\n\n//# sourceURL=webpack://Formio/./lib/components/tree/Tree.js?");
3184
+ eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"./node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"./node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.array.slice.js */ \"./node_modules/core-js/modules/es.array.slice.js\");\n__webpack_require__(/*! core-js/modules/es.array.from.js */ \"./node_modules/core-js/modules/es.array.from.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n__webpack_require__(/*! core-js/modules/es.string.trim.js */ \"./node_modules/core-js/modules/es.string.trim.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.array.includes.js */ \"./node_modules/core-js/modules/es.array.includes.js\");\n__webpack_require__(/*! core-js/modules/es.string.includes.js */ \"./node_modules/core-js/modules/es.string.includes.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\nvar _Field = _interopRequireDefault(__webpack_require__(/*! ../_classes/field/Field */ \"./lib/components/_classes/field/Field.js\"));\nvar _Formio = __webpack_require__(/*! ../../Formio */ \"./lib/Formio.js\");\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar Data = /*#__PURE__*/function (_FieldComponent) {\n _inherits(Data, _FieldComponent);\n var _super = _createSuper(Data);\n function Data(component, options, data) {\n var _this;\n _classCallCheck(this, Data);\n _this = _super.call(this, component, options, data);\n _this.isInitData = false;\n return _this;\n }\n _createClass(Data, [{\n key: \"parseTpl\",\n value: function parseTpl(template, map) {\n return template.replace(/\\$\\{.+?}/g, function (match) {\n var _$get;\n var path = match.substr(2, match.length - 3).trim();\n return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';\n });\n }\n }, {\n key: \"render\",\n value: function render(children) {\n return _get(_getPrototypeOf(Data.prototype), \"render\", this).call(this, this.renderTemplate('tree'));\n }\n\n /**\n * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific\n * elements to attach functionality to.\n *\n * @param element\n * @returns {Promise}\n */\n }, {\n key: \"attach\",\n value: function attach(element) {\n var _this2 = this;\n var refs = {};\n var self = this;\n this.loadRefs(element, refs);\n if (self.component.url) {\n var _this$component = this.component,\n _this$component$optio = _this$component.options,\n options = _this$component$optio === void 0 ? '{\"headers\":{}}' : _this$component$optio,\n _this$component$body = _this$component.body,\n body = _this$component$body === void 0 ? '{}' : _this$component$body;\n var parsedOptions = {\n ignoreCache: true\n };\n var parsedBody = {};\n try {\n parsedOptions = JSON.parse(this.parseTpl(options || '{\"headers\":{}}', {\n data: this.rootValue\n }));\n parsedBody = JSON.parse(this.parseTpl(body || '{}', {\n data: this.rootValue\n }));\n } catch (e) {\n console.log(e);\n }\n // 取消请求缓存\n parsedOptions.ignoreCache = true;\n _Formio.GlobalFormio.request(this.component.url, this.component.methods, this.component.methods !== 'GET' ? parsedBody : null, null, parsedOptions).then(function (response) {\n var tree = response;\n var container = element.querySelector('#myUL');\n // 添加列表\n tree.forEach(function (parent) {\n container.insertAdjacentHTML('beforeend', \"<li id=\\\"li-\".concat(parent.id, \"\\\" data-id=\\\"\").concat(parent.id, \"\\\"><input type=\\\"checkbox\\\" class=\\\"tree-input\\\"/><span class=\\\"box\\\">\").concat(parent.name, \"</span></li>\"));\n self.addChild(container, parent);\n });\n var toggler = container.getElementsByClassName('box');\n var i;\n for (i = 0; i < toggler.length; i++) {\n toggler[i].addEventListener('click', function () {\n if (this.parentElement.querySelector('.nested')) {\n this.parentElement.querySelector('.nested').classList.toggle('active');\n }\n });\n }\n var inputs = container.getElementsByClassName('tree-input');\n var _iterator = _createForOfIteratorHelper(inputs),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var input = _step.value;\n input.addEventListener('change', function (val) {\n self.updateValue();\n });\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n self.isInitData = true;\n setTimeout(function () {\n self.setValue(self.initValue);\n }, 300);\n return _get(_getPrototypeOf(Data.prototype), \"attach\", _this2).call(_this2, element);\n }).catch(function (e) {\n self.isInitData = true;\n return _get(_getPrototypeOf(Data.prototype), \"attach\", _this2).call(_this2, element);\n });\n }\n // Allow basic component functionality to attach like field logic and tooltips.\n }\n }, {\n key: \"addChild\",\n value: function addChild(container, parent) {\n var self = this;\n if (parent.children && parent.children.length > 0) {\n var parentNode = container.querySelector(\"#li-\".concat(parent.id));\n if (parentNode) {\n parentNode.insertAdjacentHTML('beforeend', \"<ul class=\\\"nested\\\" id=\\\"ul-\".concat(parent.id, \"\\\">\"));\n parent.children.forEach(function (child) {\n parentNode.querySelector(\"#ul-\".concat(parent.id)).insertAdjacentHTML('beforeend', \"<li id=\\\"li-\".concat(child.id, \"\\\" data-id=\\\"\").concat(child.id, \"\\\"><input type=\\\"checkbox\\\" class=\\\"tree-input\\\"/><span class=\\\"box\\\">\").concat(child.name, \"</span></li>\"));\n self.addChild(container, child);\n });\n }\n }\n }\n }, {\n key: \"getValue\",\n value: function getValue() {\n var value = [];\n var container = this.element.querySelector('#myUL');\n var checked = container.getElementsByClassName('tree-input');\n var _iterator2 = _createForOfIteratorHelper(checked),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var checkedElement = _step2.value;\n if (checkedElement.checked) {\n value.push(checkedElement.parentElement.dataset.id);\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n return value;\n }\n }, {\n key: \"setValue\",\n value:\n /**\n * Set the value of the component into the dom elements.\n *\n * @param value\n * @returns {boolean}\n */\n function setValue(value) {\n var self = this;\n if (this.isInitData) {\n var checks = self.element.getElementsByClassName('tree-input');\n var _iterator3 = _createForOfIteratorHelper(checks),\n _step3;\n try {\n for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n var check = _step3.value;\n if (value && value.includes(check.parentElement.dataset.id)) {\n check.checked = true;\n }\n }\n } catch (err) {\n _iterator3.e(err);\n } finally {\n _iterator3.f();\n }\n return true;\n } else {\n this.initValue = JSON.parse(JSON.stringify(value));\n return true;\n }\n }\n }], [{\n key: \"schema\",\n value: function schema() {\n return _Field.default.schema({\n type: 'tree',\n header: '',\n url: '',\n height: 500,\n interval: 0\n });\n }\n }, {\n key: \"builderInfo\",\n get: function get() {\n return {\n title: 'Tree',\n group: 'advanced',\n icon: 'list-tree',\n weight: 70,\n documentation: 'http://help.form.io/userguide/#table',\n schema: Data.schema()\n };\n }\n }, {\n key: \"emptyValue\",\n get: function get() {\n return [];\n }\n }]);\n return Data;\n}(_Field.default);\nexports[\"default\"] = Data;\n\n//# sourceURL=webpack://Formio/./lib/components/tree/Tree.js?");
3185
3185
 
3186
3186
  /***/ }),
3187
3187