vue-formulate
Advanced tools
Comparing version 0.11.0 to 0.11.1
@@ -13,3 +13,3 @@ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("vue-formulate",[],e):"object"==typeof exports?exports["vue-formulate"]=e():t["vue-formulate"]=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=10)}([function(t,e,r){"use strict";function n(){d=!1}function o(t){if(!t)return void(c!==h&&(c=h,n()));if(t!==c){if(t.length!==h.length)throw new Error("Custom alphabet for shortid must be "+h.length+" unique characters. You submitted "+t.length+" characters: "+t);var e=t.split("").filter(function(t,e,r){return e!==r.lastIndexOf(t)});if(e.length)throw new Error("Custom alphabet for shortid must be "+h.length+" unique characters. These characters were not unique: "+e.join(", "));c=t,n()}}function i(t){return o(t),c}function a(t){p.seed(t),f!==t&&(n(),f=t)}function u(){c||o(h);for(var t,e=c.split(""),r=[],n=p.nextValue();e.length>0;)n=p.nextValue(),t=Math.floor(n*e.length),r.push(e.splice(t,1)[0]);return r.join("")}function s(){return d||(d=u())}function l(t){return s()[t]}var c,f,d,p=r(27),h="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";t.exports={characters:i,seed:a,lookup:l,shuffled:s}},function(t,e,r){t.exports=r(11)},function(t,e,r){"use strict";function n(t,e){var r=t.length;if(r!==e.length)return!1;for(var n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}function o(t,e){var r=(0,s.default)(t);for(var n in r)r[n]=e(n,r[n]);return r}function i(t,e){var r={};for(var n in t)e(n,t[n])&&(r[n]=t[n]);return r}function a(t,e,r){for(var n in t)r=e(r,n,t[n]);return r}Object.defineProperty(e,"__esModule",{value:!0}),e.inputTypes=void 0,e.equals=n,e.map=o,e.filter=i,e.reduce=a;var u=r(4),s=function(t){return t&&t.__esModule?t:{default:t}}(u);e.inputTypes={text:["text","email","number","color","date","datetime-local","hidden","month","password","range","search","tel","time","url","week"],button:["submit","button"],select:["select"],box:["radio","checkbox"],textarea:["textarea"]}},function(t,e,r){"use strict";function n(t){return!0===o(t)&&"[object Object]"===Object.prototype.toString.call(t)}/*! | ||
*/ | ||
t.exports=function(t,e,r){for(var n in t)if(!1===e.call(r,t[n],n,t))break}},function(t,e){t.exports=function(t,e,r,n,o,i){var a,u=t=t||{},s=typeof t.default;"object"!==s&&"function"!==s||(a=t,u=t.default);var l="function"==typeof u?u.options:u;e&&(l.render=e.render,l.staticRenderFns=e.staticRenderFns,l._compiled=!0),r&&(l.functional=!0),o&&(l._scopeId=o);var c;if(i?(c=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),n&&n.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(i)},l._ssrRegister=c):n&&(c=n),c){var f=l.functional,d=f?l.render:l.beforeCreate;f?(l._injectStyles=c,l.render=function(t,e){return c.call(e),d(t,e)}):l.beforeCreate=d?[].concat(d,c):[c]}return{esModule:a,exports:u,options:l}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){function n(o,i){try{var a=e[o](i),u=a.value}catch(t){return void r(t)}if(!a.done)return Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)});t(u)}return n("next")})}}Object.defineProperty(e,"__esModule",{value:!0});var a=r(1),u=n(a),s=r(2),l=r(4),c=n(l);e.default={props:{name:{type:String,required:!0},module:{type:[String,Boolean],default:function(){return this.$formulate.options.vuexModule}},initial:{type:Object,default:function(){return{}}},behavior:{type:String,default:"blur"},showErrors:{type:[Boolean,Object],default:function(){return{}}},errors:{type:Object,default:function(){return{}}},prevent:{type:String,default:"validation"}},data:function(){return{parentIdentifier:"vue-formulate-wrapper-element",forceErrors:null,fieldInitials:{},whenFinishedValidating:Promise.resolve()}},computed:{m:function(){return this.module?this.module+"/":""},hasErrors:function(){return this.$store.getters[this.m+"hasErrors"][this.name]||!1},hasValidationErrors:function(){return this.$store.getters[this.m+"hasValidationErrors"][this.name]||!1},values:function(){return(0,c.default)(this.$store.getters[this.m+"formValues"][this.name]||{})},storeErrors:function(){return this.$store.getters[this.m+"formErrors"][this.name]||{}},validationErrors:function(){return this.$store.getters[this.m+"formValidationErrors"][this.name]||{}},fields:function(){return this.$store.getters[this.m+"formMeta"][this.name]||[]},shouldShowErrors:function(){return!1===this.forceErrors||!0===this.forceErrors?this.forceErrors:!1===this.showErrors||!0===this.showErrors?this.showErrors:"live"===this.behavior},mergedInitial:function(){return Object.assign({},this.initial,this.fieldInitials)}},watch:{mergedInitial:function(){this.hydrate(this.mergedInitial)},values:function(){this.updateFormValidation()}},created:function(){this.hydrate(this.mergedInitial)},mounted:function(){this.hydrate(this.mergedInitial)},methods:{registerField:function(t,e){this.$store.commit(this.m+"setFieldMeta",{form:this.name,field:t,data:e}),"submit"!==e.type&&this.$store.commit(this.m+"setFieldValue",{field:t,value:this.mergedInitial.hasOwnProperty(t)?this.mergedInitial[t]:void 0,form:this.name})},deregisterField:function(){function t(t){return e.apply(this,arguments)}var e=i(u.default.mark(function t(e){return u.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.whenFinishedValidating;case 2:this.$store.commit(this.m+"removeField",{form:this.name,field:e});case 3:case"end":return t.stop()}},t,this)}));return t}(),hydrate:function(t){var e=!0,r=!1,n=void 0;try{for(var o,i=this.fields[Symbol.iterator]();!(e=(o=i.next()).done);e=!0){var a=o.value;"submit"!==a.type&&void 0===this.values[a.name]&&this.$store.commit(this.m+"setFieldValue",{field:a.name,value:t[a.name],form:this.name})}}catch(t){r=!0,n=t}finally{try{!e&&i.return&&i.return()}finally{if(r)throw n}}},setInitial:function(t,e){this.fieldInitials=Object.assign({},this.fieldInitials,o({},t,e))},update:function(t){this.$store.commit(this.m+"setFieldValue",Object.assign(t,{form:this.name}))},updateFieldErrors:function(t){this.$store.commit(this.m+"setFieldErrors",Object.assign(t,{form:this.name}))},updateFieldValidationErrors:function(t){this.$store.commit(this.m+"setFieldValidationErrors",Object.assign(t,{form:this.name}))},validateField:function(){function t(t){return e.apply(this,arguments)}var e=i(u.default.mark(function t(e){var r,n=e.field,o=e.validation,i=e.label;return u.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.$formulate.validationErrors({field:n,value:this.values[n],label:i},o,this.values);case 2:return r=t.sent,(0,s.equals)(r||[],this.validationErrors[n]||[])||this.fields.find(function(t){return t.name===n})&&this.updateFieldValidationErrors({field:n,errors:r||[]}),t.abrupt("return",r);case 5:case"end":return t.stop()}},t,this)}));return t}(),updateFormValidation:function(){function t(){return e.apply(this,arguments)}var e=i(u.default.mark(function t(){var e=this;return u.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.whenFinishedValidating;case 2:this.whenFinishedValidating=Promise.all(this.fields.map(function(){var t=i(u.default.mark(function t(r){return u.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",e.validateField({field:r.name,validation:r.validation,label:r.validationLabel||r.label||r.name}));case 1:case"end":return t.stop()}},t,e)}));return function(e){return t.apply(this,arguments)}}()));case 3:case"end":return t.stop()}},t,this)}));return t}(),submit:function(){"validation"===this.prevent&&this.hasValidationErrors||"any"===this.prevent&&this.hasErrors?this.forceErrors=!0:this.$emit("submit",Object.assign({},this.values))}}}},function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}Object.defineProperty(e,"__esModule",{value:!0});var o=r(2),i=r(25),a=function(t){return t&&t.__esModule?t:{default:t}}(i);e.default={props:{type:{type:[String,Boolean],default:"text"},name:{type:String,required:!0},initial:{type:[String,Number,Boolean],default:!1},validation:{type:[String,Boolean],default:!1},errors:{type:Array,default:function(){return[]}},label:{type:[String,Boolean],default:!1},id:{type:[String],default:function(){return a.default.generate()}},min:{type:[String,Number,Boolean],default:function(){return!1}},max:{type:[String,Number,Boolean],default:function(){return!1}},maxlength:{type:[String,Number,Boolean],default:function(){return!1}},pattern:{type:[String,Number,Boolean],default:function(){return!1}},minlength:{type:[String,Number,Boolean],default:function(){return!1}},placeholder:{type:[String,Number,Boolean],default:function(){return!1}},step:{type:[String,Number,Boolean],default:function(){return!1}},options:{type:[Object,Array],default:function(){return[]}},multiple:{type:Boolean,default:!1},showErrors:{type:[Object,Boolean],default:function(){return{}}},validationLabel:{type:[String,Boolean],default:!1},elementClasses:{type:[String,Array,Object],default:function(){}},disabled:{type:Boolean,default:!1},help:{type:[Boolean,String],default:!1}},data:function(){return{errorBlurState:!1,focusState:!1}},computed:{classification:function(){return this.isTextInput?"text":this.isBoxInput?"box":this.isButtonInput?"button":this.isSelectInput?"select":this.hasCustomInput?"custom":"unsupported"},hasCustomInput:function(){return this.$slots.default&&this.$slots.default.length},isTextInput:function(){return!this.hasCustomInput&&o.inputTypes.text.includes(this.type)},isTextareaInput:function(){return!this.hasCustomInput&&o.inputTypes.textarea.includes(this.type)},isButtonInput:function(){return!this.hasCustomInput&&o.inputTypes.button.includes(this.type)},isSelectInput:function(){return!this.hasCustomInput&&o.inputTypes.select.includes(this.type)},isBoxInput:function(){return!this.hasCustomInput&&o.inputTypes.box.includes(this.type)},isUnsupportedInput:function(){return!(this.hasCustomInput||this.isTextInput||this.isButtonInput||this.isSelectInput||this.isBoxInput||this.isTextareaInput)},form:function(){for(var t=this.$parent;t&&t.$data&&"vue-formulate-wrapper-element"!==t.$data.parentIdentifier;)t=t.$parent;if(!t.$data||"vue-formulate-wrapper-element"!==t.$data.parentIdentifier)throw new Error("FormulateElement has no FormulateWrapper element");return t},values:function(){return this.form.values},value:function(){var t=this.values[this.name];if(void 0===t)switch(this.type){case"color":return"#000000";case"checkbox":if(this.optionList.length>1)return[]}return t},module:function(){return this.form.$props.module},formName:function(){return this.form.$props.name},classes:function(){var t;return t={"formulate-element":!0},n(t,"formulate-element--type--"+this.type,!0),n(t,"formulate-element--has-value",!!this.value),n(t,"formulate-element--has-errors",this.localAndValidationErrors.length&&this.shouldShowErrors),n(t,"formulate-element--has-prefix",!!this.$slots.prefix),n(t,"formulate-element--has-suffix",!!this.$slots.suffix),n(t,"formulate-element--has-focus",!!this.focusState),t},validationErrors:function(){return this.form.validationErrors[this.name]||[]},storeErrors:function(){return this.form.storeErrors[this.name]||[]},formErrors:function(){return this.form.errors[this.name]||[]},localAndValidationErrors:function(){return this.errors.concat(this.validationErrors).concat(this.formErrors)},shouldShowErrors:function(){var t=this.form.shouldShowErrors;return"blur"===this.form.behavior&&(t=t||this.errorBlurState),!1!==this.showErrors&&!0!==this.showErrors||(t=this.showErrors),t},attributes:function(){var t=this;return["min","max","minlength","maxlength","placeholder","id","multiple","pattern"].filter(function(e){return!1!==t[e]}).reduce(function(e,r){return e[r]=t[r],e},{})},optionList:function(){return Array.isArray(this.options)?Array.isArray(this.options)&&!this.options.length?[{value:this.name,label:this.label||this.name,id:a.default.generate()}]:this.options:(0,o.reduce)(this.options,function(t,e,r){return t.concat({value:e,label:r,id:a.default.generate()})},[])},val:{set:function(t){this.form.update({field:this.name,value:t}),this.isTextInput&&(this.$refs.input.value=t)},get:function(){return this.value}}},watch:{localAndValidationErrors:function(){(0,o.equals)(this.localAndValidationErrors,this.storeErrors)||this.form.updateFieldErrors({field:this.name,errors:this.localAndValidationErrors})},initial:function(){this.form.update({field:this.name,value:this.initial})}},created:function(){"undefined"==typeof window&&this.register()},mounted:function(){this.register()},beforeDestroy:function(){this.form.deregisterField(this.name)},methods:{register:function(){this.form.registerField(this.name,(0,o.filter)(this.$props,function(t,e){return["name","type","id","label","validation","validationLabel"].includes(t)})),!1!==this.initial&&this.form.setInitial(this.name,this.initial)},setBlurState:function(){this.errorBlurState=!0,this.focusState=!1},setFocusState:function(){this.focusState=!0}}}},function(t,e,r){"use strict";function n(t,e){for(var r,n=0,i="";!r;)i+=t(e>>4*n&15|o()),r=e<Math.pow(16,n+1),n++;return i}var o=r(28);t.exports=n},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}function i(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){function n(o,i){try{var a=e[o](i),u=a.value}catch(t){return void r(t)}if(!a.done)return Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)});t(u)}return n("next")})}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.mapModels=void 0;var u=r(1),s=n(u),l=function(){function t(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{!n&&u.return&&u.return()}finally{if(o)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),f=r(13);Object.keys(f).forEach(function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return f[t]}})});var d=r(22),p=n(d),h=r(24),m=n(h),v=r(34),y=n(v),b=r(35),g=n(b),x=function(){function t(){a(this,t),this.defaultOptions={registerComponents:!0,tags:{Formulate:"formulate",FormulateElement:"formulate-element"},errors:{},rules:{},vuexModule:!1},this.errors=g.default,this.rules=y.default}return c(t,[{key:"install",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.prototype.$formulate=this,e=Object.assign(this.defaultOptions,e),e.registerComponents&&(t.component(e.tags.Formulate,p.default),t.component(e.tags.FormulateElement,m.default)),e.errors&&(this.errors=Object.assign(this.errors,e.errors)),e.rules&&(this.rules=Object.assign(this.rules,e.rules)),this.options=e}},{key:"parseRules",value:function(t){return t.split("|").map(function(t){return t.trim()}).map(function(t){return t.match(/([a-zA-Z0-9]+)\((.*)?\)/)||[null,t,""]}).map(function(t){var e=l(t,3),r=(e[0],e[1]),n=e[2];return Object.assign({},{rule:r},n?{args:n.split(",").map(function(t){return t.trim()})}:{args:[]})})}},{key:"errorFactory",value:function(t){return this.errors[t]?this.errors[t]:this.errors.default}},{key:"validationErrors",value:function(){function t(t,r,n){return e.apply(this,arguments)}var e=i(s.default.mark(function t(e,r,n){var i=e.field,a=e.value,u=e.label,l=this;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",!!r&&Promise.all(this.parseRules(r).map(function(t){var e,r=t.rule,s=t.args;if("function"!=typeof l.rules[r])throw new Error("Validation rule is invalid: "+r);return(e=l.rules)[r].apply(e,[{field:i,value:a,label:u,error:l.errorFactory(r),values:n}].concat(o(s)))})).then(function(t){return t.reduce(function(t,e){return e?Array.isArray(t)?t.concat(e):[e]:t},!1)}));case 1:case"end":return t.stop()}},t,this)}));return t}()}]),t}(),w=new x;e.default=w,e.mapModels=function(t){var e={};for(var r in t)!function(r){var n=t[r].split("/"),o=l(n,2),i=o[0],a=o[1];e[r]={set:function(t){var e=w.options.vuexModule?w.options.vuexModule+"/":"";this.$store.commit(e+"setFieldValue",{form:i,field:a,value:t})},get:function(){var t=w.options.vuexModule?w.options.vuexModule+"/":"";return this.$store.getters[t+"formValues"][i]?this.$store.getters[t+"formValues"][i][a]:""}}}(r);return e}},function(t,e,r){var n=function(){return this}()||Function("return this")(),o=n.regeneratorRuntime&&Object.getOwnPropertyNames(n).indexOf("regeneratorRuntime")>=0,i=o&&n.regeneratorRuntime;if(n.regeneratorRuntime=void 0,t.exports=r(12),o)n.regeneratorRuntime=i;else try{delete n.regeneratorRuntime}catch(t){n.regeneratorRuntime=void 0}},function(t,e){!function(e){"use strict";function r(t,e,r,n){var i=e&&e.prototype instanceof o?e:o,a=Object.create(i.prototype),u=new p(n||[]);return a._invoke=l(t,r,u),a}function n(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function o(){}function i(){}function a(){}function u(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function s(t){function e(r,o,i,a){var u=n(t[r],t,o);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&b.call(l,"__await")?Promise.resolve(l.__await).then(function(t){e("next",t,i,a)},function(t){e("throw",t,i,a)}):Promise.resolve(l).then(function(t){s.value=t,i(s)},a)}a(u.arg)}function r(t,r){function n(){return new Promise(function(n,o){e(t,r,n,o)})}return o=o?o.then(n,n):n()}var o;this._invoke=r}function l(t,e,r){var o=O;return function(i,a){if(o===A)throw new Error("Generator is already running");if(o===I){if("throw"===i)throw a;return m()}for(r.method=i,r.arg=a;;){var u=r.delegate;if(u){var s=c(u,r);if(s){if(s===F)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===O)throw o=I,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=A;var l=n(t,e,r);if("normal"===l.type){if(o=r.done?I:S,l.arg===F)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(o=I,r.method="throw",r.arg=l.arg)}}}function c(t,e){var r=t.iterator[e.method];if(r===v){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=v,c(t,e),"throw"===e.method))return F;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return F}var o=n(r,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,F;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=v),e.delegate=null,F):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,F)}function f(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function d(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function p(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(f,this),this.reset(!0)}function h(t){if(t){var e=t[x];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(b.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=v,e.done=!0,e};return n.next=n}}return{next:m}}function m(){return{value:v,done:!0}}var v,y=Object.prototype,b=y.hasOwnProperty,g="function"==typeof Symbol?Symbol:{},x=g.iterator||"@@iterator",w=g.asyncIterator||"@@asyncIterator",_=g.toStringTag||"@@toStringTag",E="object"==typeof t,j=e.regeneratorRuntime;if(j)return void(E&&(t.exports=j));j=e.regeneratorRuntime=E?t.exports:{},j.wrap=r;var O="suspendedStart",S="suspendedYield",A="executing",I="completed",F={},k={};k[x]=function(){return this};var P=Object.getPrototypeOf,C=P&&P(P(h([])));C&&C!==y&&b.call(C,x)&&(k=C);var M=a.prototype=o.prototype=Object.create(k);i.prototype=M.constructor=a,a.constructor=i,a[_]=i.displayName="GeneratorFunction",j.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===i||"GeneratorFunction"===(e.displayName||e.name))},j.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,a):(t.__proto__=a,_ in t||(t[_]="GeneratorFunction")),t.prototype=Object.create(M),t},j.awrap=function(t){return{__await:t}},u(s.prototype),s.prototype[w]=function(){return this},j.AsyncIterator=s,j.async=function(t,e,n,o){var i=new s(r(t,e,n,o));return j.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},u(M),M[_]="Generator",M[x]=function(){return this},M.toString=function(){return"[object Generator]"},j.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},j.values=h,p.prototype={constructor:p,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=v,this.done=!1,this.delegate=null,this.method="next",this.arg=v,this.tryEntries.forEach(d),!t)for(var e in this)"t"===e.charAt(0)&&b.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=v)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){function e(e,n){return i.type="throw",i.arg=t,r.next=e,n&&(r.method="next",r.arg=v),!!n}if(this.done)throw t;for(var r=this,n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var a=b.call(o,"catchLoc"),u=b.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&b.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,F):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),F},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),d(r),F}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;d(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:h(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=v),F}}}(function(){return this}()||Function("return this")())},function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}Object.defineProperty(e,"__esModule",{value:!0}),e.formulateModule=e.formulateMutations=e.formulateActions=e.formulateGetters=e.formulateState=void 0;var o=r(2),i=e.formulateState=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(){return Object.assign({values:{},errors:{},validationErrors:{},meta:{}},t)}},a=e.formulateGetters=function(){var t=(arguments.length>0&&void 0!==arguments[0]&&arguments[0],arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});return Object.assign({formValues:function(t){return t.values},formErrors:function(t){return t.errors},formValidationErrors:function(t){return t.validationErrors},formMeta:function(t){return(0,o.reduce)(t.meta,function(t,e,r){return t[e]=(0,o.reduce)(r,function(t,e,r){return t.concat(r)},[]),t},{})},hasErrors:function(t){return(0,o.map)(t.errors,function(t,e){return(0,o.reduce)(e,function(t,e,r){return t||!!r.length},!1)})},hasValidationErrors:function(t){return(0,o.map)(t.validationErrors,function(t,e){return(0,o.reduce)(e,function(t,e,r){return t||!!r.length},!1)})}},t)},u=e.formulateActions=function(){var t=(arguments.length>0&&void 0!==arguments[0]&&arguments[0],arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});return Object.assign({},t)},s=e.formulateMutations=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign({setFieldValue:function(t,e){var r=e.form,o=e.field,i=e.value;t.values=Object.assign({},t.values,n({},r,Object.assign({},t.values[r]||{},n({},o,i))))},setFieldErrors:function(t,e){var r=e.form,o=e.field,i=e.errors;t.errors=Object.assign({},t.errors,n({},r,Object.assign({},t.errors[r]||{},n({},o,i))))},setFieldValidationErrors:function(t,e){var r=e.form,o=e.field,i=e.errors;t.validationErrors=Object.assign({},t.validationErrors,n({},r,Object.assign({},t.validationErrors[r]||{},n({},o,i))))},setFieldMeta:function(t,e){var r=e.form,o=e.field,i=e.data;t.meta=Object.assign({},t.meta,n({},r,Object.assign({},t.meta[r]||{},n({},o,i))))},resetForm:function(t,e){t.values[e]&&(t.values=Object.assign({},t.values,n({},e,(0,o.map)(t.values[e],function(t,e){}))))},removeField:function(t,e){var r=e.form,n=e.field;for(var i in t)t[i][r]&&t[i][r].hasOwnProperty(n)&&(t[i][r]=(0,o.filter)(t[i][r],function(t,e){return t!==n}))},removeFieldValidationErrors:function(t,e){var r=e.form,i=e.field;t.validationErrors=Object.assign({},t.validationErrors,n({},r,(0,o.filter)(t.validationErrors[r]||{},function(t){return t!==i})))}},t)};e.formulateModule=function(t){return{state:i(),getters:a(t),actions:u(t),mutations:s(),namespaced:!0}}},function(t,e,r){"use strict";/*! | ||
t.exports=function(t,e,r){for(var n in t)if(!1===e.call(r,t[n],n,t))break}},function(t,e){t.exports=function(t,e,r,n,o,i){var a,u=t=t||{},s=typeof t.default;"object"!==s&&"function"!==s||(a=t,u=t.default);var l="function"==typeof u?u.options:u;e&&(l.render=e.render,l.staticRenderFns=e.staticRenderFns,l._compiled=!0),r&&(l.functional=!0),o&&(l._scopeId=o);var c;if(i?(c=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),n&&n.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(i)},l._ssrRegister=c):n&&(c=n),c){var f=l.functional,d=f?l.render:l.beforeCreate;f?(l._injectStyles=c,l.render=function(t,e){return c.call(e),d(t,e)}):l.beforeCreate=d?[].concat(d,c):[c]}return{esModule:a,exports:u,options:l}}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){function n(o,i){try{var a=e[o](i),u=a.value}catch(t){return void r(t)}if(!a.done)return Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)});t(u)}return n("next")})}}Object.defineProperty(e,"__esModule",{value:!0});var a=r(1),u=n(a),s=r(2),l=r(4),c=n(l);e.default={props:{name:{type:String,required:!0},module:{type:[String,Boolean],default:function(){return this.$formulate.options.vuexModule}},initial:{type:Object,default:function(){return{}}},behavior:{type:String,default:"blur"},showErrors:{type:[Boolean,Object],default:function(){return{}}},errors:{type:Object,default:function(){return{}}},prevent:{type:String,default:"validation"}},data:function(){return{parentIdentifier:"vue-formulate-wrapper-element",forceErrors:null,fieldInitials:{},whenFinishedValidating:Promise.resolve()}},computed:{m:function(){return this.module?this.module+"/":""},hasErrors:function(){return this.$store.getters[this.m+"hasErrors"][this.name]||!1},hasValidationErrors:function(){return this.$store.getters[this.m+"hasValidationErrors"][this.name]||!1},values:function(){return(0,c.default)(this.$store.getters[this.m+"formValues"][this.name]||{})},storeErrors:function(){return this.$store.getters[this.m+"formErrors"][this.name]||{}},validationErrors:function(){return this.$store.getters[this.m+"formValidationErrors"][this.name]||{}},fields:function(){return this.$store.getters[this.m+"formMeta"][this.name]||[]},shouldShowErrors:function(){return!1===this.forceErrors||!0===this.forceErrors?this.forceErrors:!1===this.showErrors||!0===this.showErrors?this.showErrors:"live"===this.behavior},mergedInitial:function(){return Object.assign({},this.initial,this.fieldInitials)}},watch:{mergedInitial:function(){this.hydrate(this.mergedInitial)},values:function(){this.updateFormValidation()}},created:function(){this.hydrate(this.mergedInitial)},mounted:function(){this.hydrate(this.mergedInitial)},methods:{registerField:function(t,e){this.$store.commit(this.m+"setFieldMeta",{form:this.name,field:t,data:e}),"submit"!==e.type&&this.$store.commit(this.m+"setFieldValue",{field:t,value:this.mergedInitial.hasOwnProperty(t)?this.mergedInitial[t]:void 0,form:this.name})},deregisterField:function(){function t(t){return e.apply(this,arguments)}var e=i(u.default.mark(function t(e){return u.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.whenFinishedValidating;case 2:this.$store.commit(this.m+"removeField",{form:this.name,field:e});case 3:case"end":return t.stop()}},t,this)}));return t}(),hydrate:function(t){var e=!0,r=!1,n=void 0;try{for(var o,i=this.fields[Symbol.iterator]();!(e=(o=i.next()).done);e=!0){var a=o.value;"submit"!==a.type&&void 0===this.values[a.name]&&this.$store.commit(this.m+"setFieldValue",{field:a.name,value:t[a.name],form:this.name})}}catch(t){r=!0,n=t}finally{try{!e&&i.return&&i.return()}finally{if(r)throw n}}},setInitial:function(t,e){this.fieldInitials=Object.assign({},this.fieldInitials,o({},t,e))},update:function(t){this.$store.commit(this.m+"setFieldValue",Object.assign(t,{form:this.name}))},updateFieldErrors:function(t){this.$store.commit(this.m+"setFieldErrors",Object.assign(t,{form:this.name}))},updateFieldValidationErrors:function(t){this.$store.commit(this.m+"setFieldValidationErrors",Object.assign(t,{form:this.name}))},validateField:function(){function t(t){return e.apply(this,arguments)}var e=i(u.default.mark(function t(e){var r,n=e.field,o=e.validation,i=e.label;return u.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.$formulate.validationErrors({field:n,value:this.values[n],label:i},o,this.values);case 2:return r=t.sent,(0,s.equals)(r||[],this.validationErrors[n]||[])||this.fields.find(function(t){return t.name===n})&&this.updateFieldValidationErrors({field:n,errors:r||[]}),t.abrupt("return",r);case 5:case"end":return t.stop()}},t,this)}));return t}(),updateFormValidation:function(){function t(){return e.apply(this,arguments)}var e=i(u.default.mark(function t(){var e=this;return u.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.whenFinishedValidating;case 2:this.whenFinishedValidating=Promise.all(this.fields.map(function(){var t=i(u.default.mark(function t(r){return u.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",e.validateField({field:r.name,validation:r.validation,label:r.validationLabel||r.label||r.name}));case 1:case"end":return t.stop()}},t,e)}));return function(e){return t.apply(this,arguments)}}()));case 3:case"end":return t.stop()}},t,this)}));return t}(),submit:function(){"validation"===this.prevent&&this.hasValidationErrors||"any"===this.prevent&&this.hasErrors?this.forceErrors=!0:this.$emit("submit",Object.assign({},this.values))}}}},function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}Object.defineProperty(e,"__esModule",{value:!0});var o=r(2),i=r(25),a=function(t){return t&&t.__esModule?t:{default:t}}(i);e.default={props:{type:{type:[String,Boolean],default:"text"},name:{type:String,required:!0},initial:{type:[String,Number,Boolean],default:!1},validation:{type:[String,Boolean],default:!1},errors:{type:Array,default:function(){return[]}},label:{type:[String,Boolean],default:!1},id:{type:[String],default:function(){return a.default.generate()}},min:{type:[String,Number,Boolean],default:function(){return!1}},max:{type:[String,Number,Boolean],default:function(){return!1}},maxlength:{type:[String,Number,Boolean],default:function(){return!1}},pattern:{type:[String,Number,Boolean],default:function(){return!1}},minlength:{type:[String,Number,Boolean],default:function(){return!1}},placeholder:{type:[String,Number,Boolean],default:function(){return!1}},step:{type:[String,Number,Boolean],default:function(){return!1}},options:{type:[Object,Array],default:function(){return[]}},multiple:{type:Boolean,default:!1},showErrors:{type:[Object,Boolean],default:function(){return{}}},validationLabel:{type:[String,Boolean],default:!1},elementClasses:{type:[String,Array,Object],default:function(){}},disabled:{type:Boolean,default:!1},help:{type:[Boolean,String],default:!1}},data:function(){return{errorBlurState:!1,focusState:!1}},computed:{classification:function(){return this.isTextInput?"text":this.isTextareaInput?"textarea":this.isBoxInput?"box":this.isButtonInput?"button":this.isSelectInput?"select":this.hasCustomInput?"custom":"unsupported"},hasCustomInput:function(){return this.$slots.default&&this.$slots.default.length},isTextInput:function(){return!this.hasCustomInput&&o.inputTypes.text.includes(this.type)},isTextareaInput:function(){return!this.hasCustomInput&&o.inputTypes.textarea.includes(this.type)},isButtonInput:function(){return!this.hasCustomInput&&o.inputTypes.button.includes(this.type)},isSelectInput:function(){return!this.hasCustomInput&&o.inputTypes.select.includes(this.type)},isBoxInput:function(){return!this.hasCustomInput&&o.inputTypes.box.includes(this.type)},isUnsupportedInput:function(){return!(this.hasCustomInput||this.isTextInput||this.isButtonInput||this.isSelectInput||this.isBoxInput||this.isTextareaInput)},form:function(){for(var t=this.$parent;t&&t.$data&&"vue-formulate-wrapper-element"!==t.$data.parentIdentifier;)t=t.$parent;if(!t.$data||"vue-formulate-wrapper-element"!==t.$data.parentIdentifier)throw new Error("FormulateElement has no FormulateWrapper element");return t},values:function(){return this.form.values},value:function(){var t=this.values[this.name];if(void 0===t)switch(this.type){case"color":return"#000000";case"checkbox":if(this.optionList.length>1)return[]}return t},module:function(){return this.form.$props.module},formName:function(){return this.form.$props.name},classes:function(){var t;return t={"formulate-element":!0},n(t,"formulate-element--type--"+this.type,!0),n(t,"formulate-element--has-value",!!this.value),n(t,"formulate-element--has-errors",this.localAndValidationErrors.length&&this.shouldShowErrors),n(t,"formulate-element--has-prefix",!!this.$slots.prefix),n(t,"formulate-element--has-suffix",!!this.$slots.suffix),n(t,"formulate-element--has-focus",!!this.focusState),t},validationErrors:function(){return this.form.validationErrors[this.name]||[]},storeErrors:function(){return this.form.storeErrors[this.name]||[]},formErrors:function(){return this.form.errors[this.name]||[]},localAndValidationErrors:function(){return this.errors.concat(this.validationErrors).concat(this.formErrors)},shouldShowErrors:function(){var t=this.form.shouldShowErrors;return"blur"===this.form.behavior&&(t=t||this.errorBlurState),!1!==this.showErrors&&!0!==this.showErrors||(t=this.showErrors),t},attributes:function(){var t=this;return["min","max","minlength","maxlength","placeholder","id","multiple","pattern"].filter(function(e){return!1!==t[e]}).reduce(function(e,r){return e[r]=t[r],e},{})},optionList:function(){return Array.isArray(this.options)?Array.isArray(this.options)&&!this.options.length?[{value:this.name,label:this.label||this.name,id:a.default.generate()}]:this.options:(0,o.reduce)(this.options,function(t,e,r){return t.concat({value:e,label:r,id:a.default.generate()})},[])},val:{set:function(t){this.form.update({field:this.name,value:t}),this.isTextInput&&(this.$refs.input.value=t)},get:function(){return this.value}}},watch:{localAndValidationErrors:function(){(0,o.equals)(this.localAndValidationErrors,this.storeErrors)||this.form.updateFieldErrors({field:this.name,errors:this.localAndValidationErrors})},initial:function(){this.form.update({field:this.name,value:this.initial})}},created:function(){"undefined"==typeof window&&this.register()},mounted:function(){this.register()},beforeDestroy:function(){this.form.deregisterField(this.name)},methods:{register:function(){this.form.registerField(this.name,(0,o.filter)(this.$props,function(t,e){return["name","type","id","label","validation","validationLabel"].includes(t)})),!1!==this.initial&&this.form.setInitial(this.name,this.initial)},setBlurState:function(){this.errorBlurState=!0,this.focusState=!1},setFocusState:function(){this.focusState=!0}}}},function(t,e,r){"use strict";function n(t,e){for(var r,n=0,i="";!r;)i+=t(e>>4*n&15|o()),r=e<Math.pow(16,n+1),n++;return i}var o=r(28);t.exports=n},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)}function i(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){function n(o,i){try{var a=e[o](i),u=a.value}catch(t){return void r(t)}if(!a.done)return Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)});t(u)}return n("next")})}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.mapModels=void 0;var u=r(1),s=n(u),l=function(){function t(t,e){var r=[],n=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{!n&&u.return&&u.return()}finally{if(o)throw i}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),c=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),f=r(13);Object.keys(f).forEach(function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return f[t]}})});var d=r(22),p=n(d),h=r(24),m=n(h),v=r(34),y=n(v),b=r(35),g=n(b),x=function(){function t(){a(this,t),this.defaultOptions={registerComponents:!0,tags:{Formulate:"formulate",FormulateElement:"formulate-element"},errors:{},rules:{},vuexModule:!1},this.errors=g.default,this.rules=y.default}return c(t,[{key:"install",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.prototype.$formulate=this,e=Object.assign(this.defaultOptions,e),e.registerComponents&&(t.component(e.tags.Formulate,p.default),t.component(e.tags.FormulateElement,m.default)),e.errors&&(this.errors=Object.assign(this.errors,e.errors)),e.rules&&(this.rules=Object.assign(this.rules,e.rules)),this.options=e}},{key:"parseRules",value:function(t){return t.split("|").map(function(t){return t.trim()}).map(function(t){return t.match(/([a-zA-Z0-9]+)\((.*)?\)/)||[null,t,""]}).map(function(t){var e=l(t,3),r=(e[0],e[1]),n=e[2];return Object.assign({},{rule:r},n?{args:n.split(",").map(function(t){return t.trim()})}:{args:[]})})}},{key:"errorFactory",value:function(t){return this.errors[t]?this.errors[t]:this.errors.default}},{key:"validationErrors",value:function(){function t(t,r,n){return e.apply(this,arguments)}var e=i(s.default.mark(function t(e,r,n){var i=e.field,a=e.value,u=e.label,l=this;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",!!r&&Promise.all(this.parseRules(r).map(function(t){var e,r=t.rule,s=t.args;if("function"!=typeof l.rules[r])throw new Error("Validation rule is invalid: "+r);return(e=l.rules)[r].apply(e,[{field:i,value:a,label:u,error:l.errorFactory(r),values:n}].concat(o(s)))})).then(function(t){return t.reduce(function(t,e){return e?Array.isArray(t)?t.concat(e):[e]:t},!1)}));case 1:case"end":return t.stop()}},t,this)}));return t}()}]),t}(),w=new x;e.default=w,e.mapModels=function(t){var e={};for(var r in t)!function(r){var n=t[r].split("/"),o=l(n,2),i=o[0],a=o[1];e[r]={set:function(t){var e=w.options.vuexModule?w.options.vuexModule+"/":"";this.$store.commit(e+"setFieldValue",{form:i,field:a,value:t})},get:function(){var t=w.options.vuexModule?w.options.vuexModule+"/":"";return this.$store.getters[t+"formValues"][i]?this.$store.getters[t+"formValues"][i][a]:""}}}(r);return e}},function(t,e,r){var n=function(){return this}()||Function("return this")(),o=n.regeneratorRuntime&&Object.getOwnPropertyNames(n).indexOf("regeneratorRuntime")>=0,i=o&&n.regeneratorRuntime;if(n.regeneratorRuntime=void 0,t.exports=r(12),o)n.regeneratorRuntime=i;else try{delete n.regeneratorRuntime}catch(t){n.regeneratorRuntime=void 0}},function(t,e){!function(e){"use strict";function r(t,e,r,n){var i=e&&e.prototype instanceof o?e:o,a=Object.create(i.prototype),u=new p(n||[]);return a._invoke=l(t,r,u),a}function n(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function o(){}function i(){}function a(){}function u(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function s(t){function e(r,o,i,a){var u=n(t[r],t,o);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&b.call(l,"__await")?Promise.resolve(l.__await).then(function(t){e("next",t,i,a)},function(t){e("throw",t,i,a)}):Promise.resolve(l).then(function(t){s.value=t,i(s)},a)}a(u.arg)}function r(t,r){function n(){return new Promise(function(n,o){e(t,r,n,o)})}return o=o?o.then(n,n):n()}var o;this._invoke=r}function l(t,e,r){var o=O;return function(i,a){if(o===A)throw new Error("Generator is already running");if(o===I){if("throw"===i)throw a;return m()}for(r.method=i,r.arg=a;;){var u=r.delegate;if(u){var s=c(u,r);if(s){if(s===F)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===O)throw o=I,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=A;var l=n(t,e,r);if("normal"===l.type){if(o=r.done?I:S,l.arg===F)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(o=I,r.method="throw",r.arg=l.arg)}}}function c(t,e){var r=t.iterator[e.method];if(r===v){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=v,c(t,e),"throw"===e.method))return F;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return F}var o=n(r,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,F;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=v),e.delegate=null,F):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,F)}function f(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function d(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function p(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(f,this),this.reset(!0)}function h(t){if(t){var e=t[x];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(b.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=v,e.done=!0,e};return n.next=n}}return{next:m}}function m(){return{value:v,done:!0}}var v,y=Object.prototype,b=y.hasOwnProperty,g="function"==typeof Symbol?Symbol:{},x=g.iterator||"@@iterator",w=g.asyncIterator||"@@asyncIterator",_=g.toStringTag||"@@toStringTag",E="object"==typeof t,j=e.regeneratorRuntime;if(j)return void(E&&(t.exports=j));j=e.regeneratorRuntime=E?t.exports:{},j.wrap=r;var O="suspendedStart",S="suspendedYield",A="executing",I="completed",F={},k={};k[x]=function(){return this};var P=Object.getPrototypeOf,C=P&&P(P(h([])));C&&C!==y&&b.call(C,x)&&(k=C);var M=a.prototype=o.prototype=Object.create(k);i.prototype=M.constructor=a,a.constructor=i,a[_]=i.displayName="GeneratorFunction",j.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===i||"GeneratorFunction"===(e.displayName||e.name))},j.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,a):(t.__proto__=a,_ in t||(t[_]="GeneratorFunction")),t.prototype=Object.create(M),t},j.awrap=function(t){return{__await:t}},u(s.prototype),s.prototype[w]=function(){return this},j.AsyncIterator=s,j.async=function(t,e,n,o){var i=new s(r(t,e,n,o));return j.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},u(M),M[_]="Generator",M[x]=function(){return this},M.toString=function(){return"[object Generator]"},j.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},j.values=h,p.prototype={constructor:p,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=v,this.done=!1,this.delegate=null,this.method="next",this.arg=v,this.tryEntries.forEach(d),!t)for(var e in this)"t"===e.charAt(0)&&b.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=v)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){function e(e,n){return i.type="throw",i.arg=t,r.next=e,n&&(r.method="next",r.arg=v),!!n}if(this.done)throw t;for(var r=this,n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var a=b.call(o,"catchLoc"),u=b.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&b.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,F):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),F},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),d(r),F}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;d(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:h(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=v),F}}}(function(){return this}()||Function("return this")())},function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}Object.defineProperty(e,"__esModule",{value:!0}),e.formulateModule=e.formulateMutations=e.formulateActions=e.formulateGetters=e.formulateState=void 0;var o=r(2),i=e.formulateState=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(){return Object.assign({values:{},errors:{},validationErrors:{},meta:{}},t)}},a=e.formulateGetters=function(){var t=(arguments.length>0&&void 0!==arguments[0]&&arguments[0],arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});return Object.assign({formValues:function(t){return t.values},formErrors:function(t){return t.errors},formValidationErrors:function(t){return t.validationErrors},formMeta:function(t){return(0,o.reduce)(t.meta,function(t,e,r){return t[e]=(0,o.reduce)(r,function(t,e,r){return t.concat(r)},[]),t},{})},hasErrors:function(t){return(0,o.map)(t.errors,function(t,e){return(0,o.reduce)(e,function(t,e,r){return t||!!r.length},!1)})},hasValidationErrors:function(t){return(0,o.map)(t.validationErrors,function(t,e){return(0,o.reduce)(e,function(t,e,r){return t||!!r.length},!1)})}},t)},u=e.formulateActions=function(){var t=(arguments.length>0&&void 0!==arguments[0]&&arguments[0],arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});return Object.assign({},t)},s=e.formulateMutations=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign({setFieldValue:function(t,e){var r=e.form,o=e.field,i=e.value;t.values=Object.assign({},t.values,n({},r,Object.assign({},t.values[r]||{},n({},o,i))))},setFieldErrors:function(t,e){var r=e.form,o=e.field,i=e.errors;t.errors=Object.assign({},t.errors,n({},r,Object.assign({},t.errors[r]||{},n({},o,i))))},setFieldValidationErrors:function(t,e){var r=e.form,o=e.field,i=e.errors;t.validationErrors=Object.assign({},t.validationErrors,n({},r,Object.assign({},t.validationErrors[r]||{},n({},o,i))))},setFieldMeta:function(t,e){var r=e.form,o=e.field,i=e.data;t.meta=Object.assign({},t.meta,n({},r,Object.assign({},t.meta[r]||{},n({},o,i))))},resetForm:function(t,e){t.values[e]&&(t.values=Object.assign({},t.values,n({},e,(0,o.map)(t.values[e],function(t,e){}))))},removeField:function(t,e){var r=e.form,n=e.field;for(var i in t)t[i][r]&&t[i][r].hasOwnProperty(n)&&(t[i][r]=(0,o.filter)(t[i][r],function(t,e){return t!==n}))},removeFieldValidationErrors:function(t,e){var r=e.form,i=e.field;t.validationErrors=Object.assign({},t.validationErrors,n({},r,(0,o.filter)(t.validationErrors[r]||{},function(t){return t!==i})))}},t)};e.formulateModule=function(t){return{state:i(),getters:a(t),actions:u(t),mutations:s(),namespaced:!0}}},function(t,e,r){"use strict";/*! | ||
* isobject <https://github.com/jonschlinkert/isobject> | ||
@@ -16,0 +16,0 @@ * |
{ | ||
"name": "vue-formulate", | ||
"version": "0.11.0", | ||
"version": "0.11.1", | ||
"description": "The easiest way to build forms in Vue with validation and vuex support.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
99405