1
0
mirror of synced 2024-11-22 21:36:04 +03:00
vue-formulario/dist/formulario.min.js

35 lines
29 KiB
JavaScript
Raw Normal View History

2020-10-23 14:15:57 +03:00
var VueFormulario=function(e){"use strict";function t(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 o=0;o<r.length;o++){const i=r[o];if(e[i]!==t[i])return!1}return!0}function r(e){return"string"==typeof e?e.replace(/([_][a-z0-9])/gi,t=>0!==e.indexOf(t)&&"_"!==e[e.indexOf(t)-1]?t.toUpperCase().replace("_",""):t):e}function o(e){return"string"==typeof e&&/^[\^]/.test(e.charAt(0))?[r(e.substr(1)),e.charAt(0)]:[r(e),null]}function i(e){return e?"string"==typeof e?[e]:Array.isArray(e)?e:"object"==typeof e?Object.values(e):[]:[]}function a(e,t){return"string"==typeof e?a(e.split("|").filter(e=>e.length),t):Array.isArray(e)?e.map(e=>function(e,t){if("function"==typeof e)return[e,[]];if(Array.isArray(e)&&e.length){e=e.slice();const[r,i]=o(e.shift());if("string"==typeof r&&Object.prototype.hasOwnProperty.call(t,r))return[t[r],e,r,i];if("function"==typeof r)return[r,e,r,i]}if("string"==typeof e){const r=e.split(":"),[i,a]=o(r.shift());if(Object.prototype.hasOwnProperty.call(t,i))return[t[i],r.length?r.join(":").split(","):[],i,a];throw new Error("Unknown validation rule "+e)}return!1}(e,t)).filter(e=>!!e):[]}function s(e){switch(typeof e){case"symbol":case"number":case"string":case"boolean":case"undefined":return!0;default:return null===e}}function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function l(e,t){const r=t.split(".");let o=e;for(const e in r){const t=r[e].match(/(.+)\[(\d+)\]$/);if(void 0===o)return null;if(t){if(o=o[t[1]],void 0===o)return null;o=o[t[2]]}else o=o[r[e]]}return o}e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;var u=function(e){if("string"!=typeof e)return!1;var t=e.match(c);if(!t)return!1;var r=t[1];if(!r)return!1;if(d.test(r)||f.test(r))return!0;return!1},c=/^(?:\w+:)?\/\/(\S+)$/,d=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,f=/^[^\s\.]+\.\S{2,}$/;var h={accepted:({value:e})=>Promise.resolve(["yes","on","1",1,!0,"true"].includes(e)),after({value:e},t=!1){const r=!1!==t?Date.parse(t):Date.now(),o=e instanceof Date?e.getTime():Date.parse(e);return Promise.resolve(!isNaN(o)&&o>r)},alpha({value:e},t="default"){const r={default:/^[a-zA-ZÀ-ÖØ-öø-ÿ]+$/,latin:/^[a-zA-Z]+$/},o=n(r,t)?t:"default";return Promise.resolve(r[o].test(e))},alphanumeric({value:e},t="default"){const r={default:/^[a-zA-Z0-9À-ÖØ-öø-ÿ]+$/,latin:/^[a-zA-Z0-9]+$/},o=n(r,t)?t:"default";return Promise.resolve(r[o].test(e))},before({value:e},t=!1){const r=!1!==t?Date.parse(t):Date.now(),o=e instanceof Date?e.getTime():Date.parse(e);return Promise.resolve(!isNaN(o)&&o<r)},between:({value:e},t=0,r=10,o)=>Promise.resolve(null!==t&&null!==r&&!isNaN(t)&&!isNaN(r)&&(!isNaN(Number(e))&&"length"!==o||"value"===o?(e=Number(e),t=Number(t),r=Number(r),e>t&&e<r):("string"==typeof e||"length"===o)&&(e=isNaN(Number(e))?e:e.toString()).length>t&&e.length<r)),confirm:({value:e,getFormValues:t,name:r},o)=>Promise.resolve((()=>{let i=o;return i||(i=/_confirm$/.test(r)?r.substr(0,r.length-8):r+"_confirm"),t()[i]===e})()),date:({value:e},t=!1)=>Promise.resolve(t?function(e){const t=`^${r=e,r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`;var r;const o={MM:"(0[1-9]|1[012])",M:"([1-9]|1[012])",DD:"([012][1-9]|3[01])",D:"([012]?[1-9]|3[01])",YYYY:"\\d{4}",YY:"\\d{2}"};return new RegExp(Object.keys(o).reduce((e,t)=>e.replace(t,o[t]),t))}(t).test(e):!isNaN(Date.parse(e))),email({value:e}){if(!e)return Promise.resolve(!0);return Promise.resolve(/^(([^<>()\[\].,;:\s@"]+(\.[^<>()\[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,})$/i.test(e))},endsWith:({value:e},...t)=>e?"string"==typeof e?Promise.resolve(0===t.length||t.some(t=>e.endsWith(t))):Promise.resolve(!1):Promise.resolve(!0),in:({value:e},...r)=>Promise.resolve(r.some(r=>"object"==typeof r?t(r,e):r===e)),matches:({value:e},...t)=>Promise.resolve(!!t.find(t=>("string"==typeof t&&"/"===t.substr(0,1)&&"/"===t.substr(-1)&&(t=new RegExp(t.substr(1,t.length-2))),t instanceof RegExp?t.test(e):t=
2020-10-19 12:32:15 +03:00
/*!
2020-10-23 14:15:57 +03:00
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
2020-10-19 12:32:15 +03:00
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
2020-10-23 14:15:57 +03:00
function m(e){return!0==(null!=(t=e)&&"object"==typeof t&&!1===Array.isArray(t))&&"[object Object]"===Object.prototype.toString.call(e);
2020-10-19 12:32:15 +03:00
/*!
2020-10-23 14:15:57 +03:00
* isobject <https://github.com/jonschlinkert/isobject>
2020-10-19 12:32:15 +03:00
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
2020-10-23 14:15:57 +03:00
var t}function v(e){var t,r;return!1!==m(e)&&("function"==typeof(t=e.constructor)&&(!1!==m(r=t.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf")))}function y(e,t,r=!0){const o={};for(const i in e)n(t,i)?v(t[i])&&v(e[i])?o[i]=y(e[i],t[i],r):r&&Array.isArray(e[i])&&Array.isArray(t[i])?o[i]=e[i].concat(t[i]):o[i]=t[i]:o[i]=e[i];for(const e in t)n(o,e)||(o[e]=t[e]);return o}
2020-10-19 14:38:35 +03:00
/*! *****************************************************************************
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.
2020-10-23 14:15:57 +03:00
***************************************************************************** */function g(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(e);i<o.length;i++)t.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(e,o[i])&&(r[o[i]]=e[o[i]])}return r}function b(e,t,r,o){var i,a=arguments.length,s=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,o);else for(var n=e.length-1;n>=0;n--)(i=e[n])&&(s=(a<3?i(s):a>3?i(t,r,s):i(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s
2020-10-19 14:38:35 +03:00
/**
* vue-class-component v7.2.3
* (c) 2015-present Evan You
* @license MIT
2020-10-23 14:15:57 +03:00
*/}function O(e){return(O="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(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function x(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 V(){return"undefined"!=typeof Reflect&&Reflect.defineMetadata&&Reflect.getOwnMetadataKeys}function $(e,t){_(e,t),Object.getOwnPropertyNames(t.prototype).forEach((function(r){_(e.prototype,t.prototype,r)})),Object.getOwnPropertyNames(t).forEach((function(r){_(e,t,r)}))}function _(e,t,r){(r?Reflect.getOwnMetadataKeys(t,r):Reflect.getOwnMetadataKeys(t)).forEach((function(o){var i=r?Reflect.getOwnMetadata(o,t,r):Reflect.getOwnMetadata(o,t);r?Reflect.defineMetadata(o,i,e,r):Reflect.defineMetadata(o,i,e)}))}var j={__proto__:[]}instanceof Array;function F(e){return function(t,r,o){var i="function"==typeof t?t:t.constructor;i.__decorators__||(i.__decorators__=[]),"number"!=typeof o&&(o=void 0),i.__decorators__.push((function(t){return e(t,r,o)}))}}function w(e){"undefined"!=typeof console&&console.warn("[vue-class-component] "+e)}function P(t,r){var o=r.prototype._init;r.prototype._init=function(){var e=this,r=Object.getOwnPropertyNames(t);if(t.$options.props)for(var o in t.$options.props)t.hasOwnProperty(o)||r.push(o);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 i=new r;r.prototype._init=o;var a={};return Object.keys(i).forEach((function(e){void 0!==i[e]&&(a[e]=i[e])})),"production"!==process.env.NODE_ENV&&!(r.prototype instanceof e)&&Object.keys(a).length>0&&w("Component class must inherit Vue or its descendant class when class property is used."),a}var N=["data","beforeCreate","created","beforeMount","mounted","beforeDestroy","destroyed","beforeUpdate","updated","activated","deactivated","render","errorCaptured","serverPrefetch"];function A(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r.name=r.name||t._componentTag||t.name;var o=t.prototype;Object.getOwnPropertyNames(o).forEach((function(e){if("constructor"!==e)if(N.indexOf(e)>-1)r[e]=o[e];else{var t=Object.getOwnPropertyDescriptor(o,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({},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 P(this,t)}});var i=t.__decorators__;i&&(i.forEach((function(e){return e(r)})),delete t.__decorators__);var a=Object.getPrototypeOf(t.prototype),s=a instanceof e?a.constructor:e,n=s.extend(r);return S(n,t,s),V()&&$(n,t),n}var R=["cid","super","options","superOptions","extendOptions","sealedOptions","component","directive","filter"],M={prototype:!0,arguments:!0,callee:!0,caller:!0};function S(e,t,r){Object.getOwnPropertyNames(t).forEach((function(o){if(!M[o]){var i=Object.getOwnPropertyDescriptor(e,o);if(!i||i.configurable){var a,s,n=Object.getOwnPropertyDescriptor(t,o);if(!j){if("cid"===o)return;var l=Object.getOwnPropertyDescriptor(r,o);if(a=n.value,s=O(a),null!=a&&("object"===s||"function"===s)&&l&&l.value===n.value)return}"production"!==process.env.NODE_ENV&&R.indexOf(o)>=0&&w("Static property name '".concat(o,"' 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,o,n)}}}))}function D(e){return"function"==typeof e?A(e):function(t){return A(t,e)}}D.registerHooks=function(e){N.push.apply(N,x