2020-10-19 14:38:35 +03:00
|
|
|
var VueFormulario=function(e){"use strict";e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;const t=(e,t)=>({classification:e,component:"FormularioInput"+(t||e[0].toUpperCase()+e.substr(1))});var r=Object.assign(Object.assign({},["text","email","number","color","date","hidden","month","password","search","tel","time","url","week","datetime-local"].reduce((e,r)=>Object.assign(Object.assign({},e),{[r]:t("text")}),{})),{range:t("slider"),textarea:t("textarea","TextArea"),checkbox:t("box"),radio:t("box"),submit:t("button"),button:t("button"),select:t("select"),file:t("file"),image:t("file"),group:t("group")}),i=function(e){if("string"!=typeof e)return!1;var t=e.match(o);if(!t)return!1;var r=t[1];if(!r)return!1;if(s.test(r)||a.test(r))return!0;return!1},o=/^(?:\w+:)?\/\/(\S+)$/,s=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,a=/^[^\s\.]+\.\S{2,}$/;for(var n="-_",l=36;l--;)n+=l.toString(36);for(l=36;l---10;)n+=l.toString(36).toUpperCase();var u=function(e){var t="";for(l=e||21;l--;)t+=n[64*Math.random()|0];return t};class d{constructor(e,t={},r={}){this.input=e,this.fileList=e.files,this.files=[],this.options=Object.assign({mimes:{}},r),this.results=!1,this.context=t,Array.isArray(this.fileList)?this.rehydrateFileList(this.fileList):this.addFileList(this.fileList)}rehydrateFileList(e){const t=e.reduce((e,t)=>{const r=t[this.options?this.options.fileUrlKey:"url"],i=!(!r||-1===r.lastIndexOf("."))&&r.substr(r.lastIndexOf(".")+1),o=this.options.mimes[i]||!1;return e.push(Object.assign({},t,r?{name:r.substr(r.lastIndexOf("/")+1||0),type:t.type?t.type:o,previewData:r}:{})),e},[]);this.results=e,this.addFileList(t)}addFileList(e){for(let t=0;t<e.length;t++){const r=e[t],i=u();this.files.push({progress:!1,error:!1,complete:!1,justFinished:!1,name:r.name||"file-upload",file:r,uuid:i,path:!1,removeFile:()=>this.removeFile(i),previewData:r.previewData||!1})}}hasUploader(){return!!this.context.uploader}uploaderIsAxios(){return this.hasUploader&&"function"==typeof this.context.uploader.request&&"function"==typeof this.context.uploader.get&&"function"==typeof this.context.uploader.delete&&"function"==typeof this.context.uploader.post}getUploader(...e){if(this.uploaderIsAxios()){const t=new FormData;if(t.append(this.context.name||"file",e[0]),!1===this.context.uploadUrl)throw new Error("No uploadURL specified: https://vueformulate.com/guide/inputs/file/#props");return this.context.uploader.post(this.context.uploadUrl,t,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:t=>{e[1](Math.round(100*t.loaded/t.total))}}).then(e=>e.data).catch(e[2])}return this.context.uploader(...e)}upload(){return this.results?Promise.resolve(this.results):new Promise((e,t)=>{if(!this.hasUploader)return t(new Error("No uploader has been defined"));Promise.all(this.files.map(e=>e.path?Promise.resolve(e.path):this.getUploader(e.file,t=>{e.progress=t,t>=100&&(e.complete||(e.justFinished=!0,setTimeout(()=>{e.justFinished=!1},this.options.uploadJustCompleteDuration)),e.complete=!0)},t=>{e.progress=0,e.error=t,e.complete=!0},this.options))).then(t=>{this.results=t,e(t)}).catch(e=>{throw new Error(e)})})}removeFile(e){if(this.files=this.files.filter(t=>t.uuid!==e),this.context.performValidation(),window&&this.fileList instanceof FileList){const e=new DataTransfer;this.files.map(({file:t})=>e.items.add(t)),this.fileList=e.files,this.input=e}}loadPreviews(){this.files.map(e=>{if(!e.previewData&&window&&window.FileReader&&/^image\//.test(e.file.type)){const t=new FileReader;t.onload=t=>Object.assign(e,{previewData:t.target.result}),t.readAsDataURL(e.file)}})}getFileList(){return this.fileList}getFiles(){return this.files}toString(){const e=this.files.length?this.files.length+" files":"empty";return this.results?JSON.stringify(this.results,null," "):`FileUpload(${e})`}}function h(e,t){if(e===t)return!0;if(!e||!t)return!1;const r=Object.keys(e);if(Object.keys(t).length!==r.length)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(0===r.length)return e===t;for(let i=0;i<r.length;i++){const o=r[i];if(e[o]!==t[o])return
|
2020-10-19 12:32:15 +03:00
|
|
|
/*!
|
|
|
|
* isobject <https://github.com/jonschlinkert/isobject>
|
|
|
|
*
|
|
|
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
|
|
* Released under the MIT License.
|
|
|
|
*/
|
|
|
|
/*!
|
|
|
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
|
|
*
|
|
|
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
|
|
* Released under the MIT License.
|
|
|
|
*/
|
2020-10-19 14:38:35 +03:00
|
|
|
function V(e){return!0==(null!=(t=e)&&"object"==typeof t&&!1===Array.isArray(t))&&"[object Object]"===Object.prototype.toString.call(e);var t}function j(e){var t,r;return!1!==V(e)&&("function"==typeof(t=e.constructor)&&(!1!==V(r=t.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf")))}
|
|
|
|
/*! *****************************************************************************
|
|
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
purpose with or without fee is hereby granted.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
***************************************************************************** */
|
|
|
|
function $(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(r[i[o]]=e[i[o]])}return r}function A(e,t,r,i){var o,s=arguments.length,a=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,i);else for(var n=e.length-1;n>=0;n--)(o=e[n])&&(a=(s<3?o(a):s>3?o(t,r,a):o(t,r))||a);return s>3&&a&&Object.defineProperty(t,r,a),a
|
|
|
|
/**
|
|
|
|
* vue-class-component v7.2.3
|
|
|
|
* (c) 2015-present Evan You
|
|
|
|
* @license MIT
|
2020-10-21 10:58:40 +03:00
|
|
|
*/}function F(e){return(F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function P(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function R(){return"undefined"!=typeof Reflect&&Reflect.defineMetadata&&Reflect.getOwnMetadataKeys}function N(e,t){S(e,t),Object.getOwnPropertyNames(t.prototype).forEach((function(r){S(e.prototype,t.prototype,r)})),Object.getOwnPropertyNames(t).forEach((function(r){S(e,t,r)}))}function S(e,t,r){(r?Reflect.getOwnMetadataKeys(t,r):Reflect.getOwnMetadataKeys(t)).forEach((function(i){var o=r?Reflect.getOwnMetadata(i,t,r):Reflect.getOwnMetadata(i,t);r?Reflect.defineMetadata(i,o,e,r):Reflect.defineMetadata(i,o,e)}))}var D={__proto__:[]}instanceof Array;function M(e){return function(t,r,i){var o="function"==typeof t?t:t.constructor;o.__decorators__||(o.__decorators__=[]),"number"!=typeof i&&(i=void 0),o.__decorators__.push((function(t){return e(t,r,i)}))}}function U(e){"undefined"!=typeof console&&console.warn("[vue-class-component] "+e)}function I(t,r){var i=r.prototype._init;r.prototype._init=function(){var e=this,r=Object.getOwnPropertyNames(t);if(t.$options.props)for(var i in t.$options.props)t.hasOwnProperty(i)||r.push(i);r.forEach((function(r){"_"!==r.charAt(0)&&Object.defineProperty(e,r,{get:function(){return t[r]},set:function(e){t[r]=e},configurable:!0})}))};var o=new r;r.prototype._init=i;var s={};return Object.keys(o).forEach((function(e){void 0!==o[e]&&(s[e]=o[e])})),"production"!==process.env.NODE_ENV&&!(r.prototype instanceof e)&&Object.keys(s).length>0&&U("Component class must inherit Vue or its descendant class when class property is used."),s}var C=["data","beforeCreate","created","beforeMount","mounted","beforeDestroy","destroyed","beforeUpdate","updated","activated","deactivated","render","errorCaptured","serverPrefetch"];function k(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r.name=r.name||t._componentTag||t.name;var i=t.prototype;Object.getOwnPropertyNames(i).forEach((function(e){if("constructor"!==e)if(C.indexOf(e)>-1)r[e]=i[e];else{var t=Object.getOwnPropertyDescriptor(i,e);void 0!==t.value?"function"==typeof t.value?(r.methods||(r.methods={}))[e]=t.value:(r.mixins||(r.mixins=[])).push({data:function(){return _({},e,t.value)}}):(t.get||t.set)&&((r.computed||(r.computed={}))[e]={get:t.get,set:t.set})}})),(r.mixins||(r.mixins=[])).push({data:function(){return I(this,t)}});var o=t.__decorators__;o&&(o.forEach((function(e){return e(r)})),delete t.__decorators__);var s=Object.getPrototypeOf(t.prototype),a=s instanceof e?s.constructor:e,n=a.extend(r);return T(n,t,a),R()&&N(n,t),n}var L=["cid","super","options","superOptions","extendOptions","sealedOptions","component","directive","filter"],B={prototype:!0,arguments:!0,callee:!0,caller:!0};function T(e,t,r){Object.getOwnPropertyNames(t).forEach((function(i){if(!B[i]){var o=Object.getOwnPropertyDescriptor(e,i);if(!o||o.configurable){var s,a,n=Object.getOwnPropertyDescriptor(t,i);if(!D){if("cid"===i)return;var l=Object.getOwnPropertyDescriptor(r,i);if(s=n.value,a=F(s),null!=s&&("object"===a||"function"===a)&&l&&l.value===n.value)return}"production"!==process.env.NODE_ENV&&L.indexOf(i)>=0&&U("Static property name '".concat(i,"' declared on class '").concat(t.name,"' ")+"conflicts with reserved property name of Vue internal. It may cause unexpected behavior of the component. Consider renaming the property."),Object.defineProperty(e,i,n)}}}))}function W(e){return"function"==typeof e?k(e):function(t){return k(t,e)}}W.registerHooks=function(e){C.push.apply(C,P
|