diff --git a/build/rollup.config.js b/build/rollup.config.js index b41087a..538a8fe 100644 --- a/build/rollup.config.js +++ b/build/rollup.config.js @@ -15,7 +15,8 @@ export default { 'nanoid/non-secure': 'nanoid', 'is-url': 'isUrl', '@braid/vue-formulate-i18n': 'VueFormulateI18n' - } + }, + sourcemap: false } ], external: ['nanoid/non-secure'], diff --git a/dist/formulate.esm.js b/dist/formulate.esm.js index e0bd790..0a9d704 100644 --- a/dist/formulate.esm.js +++ b/dist/formulate.esm.js @@ -1 +1 @@ -import t from"is-url";import e from"nanoid/non-secure";import r from"is-plain-object";import{en as o}from"@braid/vue-formulate-i18n";var i=function(t,e){return{classification:t,component:"FormulateInput"+(e||t[0].toUpperCase()+t.substr(1))}},n=Object.assign({},["text","email","number","color","date","hidden","month","password","search","tel","time","url","week","datetime-local"].reduce((function(t,e){var r;return Object.assign({},t,((r={})[e]=i("text"),r))}),{}),{range:i("slider"),textarea:i("textarea","TextArea"),checkbox:i("box"),radio:i("box"),submit:i("button"),button:i("button"),select:i("select"),file:i("file"),image:i("file")}),s=function(t,e,r){void 0===r&&(r={}),this.input=t,this.fileList=t.files,this.files=[],this.options=Object.assign({},{mimes:{}},r),this.results=!1,this.context=e,Array.isArray(this.fileList)?this.rehydrateFileList(this.fileList):this.addFileList(this.fileList)};function a(t,e){var r={};for(var o in t)r[o]=e(o,t[o]);return r}function l(t,e){if(t===e)return!0;if(!t||!e)return!1;var r=Object.keys(t),o=Object.keys(e),i=r.length;if(o.length!==i)return!1;for(var n=0;n=100&&(e.complete||(e.justFinished=!0,setTimeout((function(){e.justFinished=!1}),t.options.uploadJustCompleteDuration)),e.complete=!0)}),(function(t){e.progress=0,e.error=t,e.complete=!0}),t.options)}))).then((function(r){t.results=r,e(r)})).catch((function(t){throw new Error(t)}))}))},s.prototype.removeFile=function(t){if(this.files=this.files.filter((function(e){return e.uuid!==t})),this.context.performValidation(),window&&this.fileList instanceof FileList){var e=new DataTransfer;this.files.map((function(t){return e.items.add(t.file)})),this.fileList=e.files,this.input.files=this.fileList}},s.prototype.loadPreviews=function(){this.files.map((function(t){if(!t.previewData&&window&&window.FileReader&&/^image\//.test(t.file.type)){var e=new FileReader;e.onload=function(e){return Object.assign(t,{previewData:e.target.result})},e.readAsDataURL(t.file)}}))},s.prototype.getFileList=function(){return this.fileList},s.prototype.getFiles=function(){return this.files},s.prototype.toString=function(){var t=this.files.length?this.files.length+" files":"empty";return this.results?JSON.stringify(this.results,null," "):"FileUpload("+t+")"};var f={accepted:function(t){var e=t.value;return Promise.resolve(["yes","on","1",1,!0,"true"].includes(e))},after:function(t,e){var r=t.value;void 0===e&&(e=!1);var o=Date.parse(e||new Date),i=Date.parse(r);return Promise.resolve(!isNaN(i)&&i>o)},alpha:function(t,e){var r=t.value;void 0===e&&(e="default");var o={default:/^[a-zA-ZÀ-ÖØ-öø-ÿ]+$/,latin:/^[a-zA-Z]+$/},i=o.hasOwnProperty(e)?e:"default";return Promise.resolve(o[i].test(r))},alphanumeric:function(t,e){var r=t.value;void 0===e&&(e="default");var o={default:/^[a-zA-Z0-9À-ÖØ-öø-ÿ]+$/,latin:/^[a-zA-Z0-9]+$/},i=o.hasOwnProperty(e)?e:"default";return Promise.resolve(o[i].test(r))},before:function(t,e){var r=t.value;void 0===e&&(e=!1);var o=Date.parse(e||new Date),i=Date.parse(r);return Promise.resolve(!isNaN(i)&&ie&&ie&&i.length()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test(e))},endsWith:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve("string"==typeof e&&r.length?void 0!==r.find((function(t){return e.endsWith(t)})):"string"==typeof e&&0===r.length)},in:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(void 0!==r.find((function(t){return"object"==typeof t?l(t,e):t===e})))},matches:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(!!r.find((function(t){return t instanceof RegExp?t.test(e):t===e})))},mime:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(function(){if(e instanceof s)for(var t=e.getFiles(),o=0;o=e):!isNaN(o)&&"length"!==r||"value"===r?(o=isNaN(o)?o:Number(o))>=e:("string"==typeof o||"length"===r)&&(o=isNaN(o)?o:o.toString()).length>=e)},max:function(t,e,r){var o=t.value;return void 0===e&&(e=10),Promise.resolve(Array.isArray(o)?(e=isNaN(e)?e:Number(e),o.length<=e):!isNaN(o)&&"length"!==r||"value"===r?(o=isNaN(o)?o:Number(o))<=e:("string"==typeof o||"length"===r)&&(o=isNaN(o)?o:o.toString()).length<=e)},not:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(void 0===r.find((function(t){return"object"==typeof t?l(t,e):t===e})))},number:function(t){var e=t.value;return Promise.resolve(!isNaN(e))},required:function(t,e){var r=t.value;return void 0===e&&(e=!0),Promise.resolve(!(e&&!["no","false"].includes(e))||(Array.isArray(r)?!!r.length:r instanceof s?r.getFiles().length>0:"string"==typeof r?!!r:"object"!=typeof r||!!r&&!!Object.keys(r).length))},startsWith:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve("string"==typeof e&&r.length?void 0!==r.find((function(t){return e.startsWith(t)})):"string"==typeof e&&0===r.length)},url:function(e){var r=e.value;return Promise.resolve(t(r))}},h="image/",m={csv:"text/csv",gif:h+"gif",jpg:h+"jpeg",jpeg:h+"jpeg",png:h+"png",pdf:"application/pdf",svg:h+"svg+xml"};function v(t,e,r,o){return new Promise((function(r,i){var n=(o.fauxUploaderDuration||2e3)*(.5+Math.random()),s=performance.now(),a=function(){return setTimeout((function(){var o=performance.now()-s,i=Math.min(100,Math.round(o/n*100));if(e(i),i>=100)return r({url:"http://via.placeholder.com/350x150.png",name:t.name});a()}),20)};a()}))}var y={context:function(){return x.call(this,Object.assign({},{type:this.type,value:this.value,name:this.nameOrFallback,classification:this.classification,component:this.component,id:this.id||this.defaultId,hasLabel:this.label&&"button"!==this.classification,label:this.label,labelPosition:this.logicalLabelPosition,attributes:this.elementAttributes,performValidation:this.performValidation.bind(this),blurHandler:g.bind(this),imageBehavior:this.imageBehavior,uploadUrl:this.mergedUploadUrl,uploader:this.uploader||this.$formulate.getUploader(),uploadBehavior:this.uploadBehavior,preventWindowDrops:this.preventWindowDrops,hasValidationErrors:this.hasValidationErrors,getValidationErrors:this.getValidationErrors.bind(this),validationErrors:this.validationErrors,errors:this.explicitErrors,setErrors:this.setErrors.bind(this),showValidationErrors:this.showValidationErrors,visibleValidationErrors:this.visibleValidationErrors},this.typeContext))},nameOrFallback:function(){if(!0===this.name&&"button"!==this.classification)return this.type+"_"+this.elementAttributes.id;if(!1===this.name||"button"===this.classification&&!0===this.name)return!1;return this.name},typeContext:function(){var t=this;switch(this.classification){case"select":return{options:b.call(this,this.options),optionGroups:!!this.optionGroups&&a(this.optionGroups,(function(e,r){return b.call(t,r)})),placeholder:this.$attrs.placeholder||!1};case"slider":return{showValue:!!this.showValue};default:return this.options?{options:b.call(this,this.options)}:{}}},elementAttributes:function(){var t=Object.assign({},this.localAttributes);this.id?t.id=this.id:t.id=this.defaultId;return t},logicalLabelPosition:function(){if(this.labelPosition)return this.labelPosition;switch(this.classification){case"box":return"after";default:return"before"}},mergedUploadUrl:function(){return this.uploadUrl||this.$formulate.getUploadUrl()},isVmodeled:function(){return!!(this.$options.propsData.hasOwnProperty("formulateValue")&&this._events&&Array.isArray(this._events.input)&&this._events.input.length)},mergedValidationName:function(){if(this.validationName)return this.validationName;if("string"==typeof this.name)return this.name;if(this.label)return this.label;return this.type},explicitErrors:function(){return c(this.errors).concat(this.localErrors).concat(c(this.error))},allErrors:function(){return this.explicitErrors.concat(c(this.validationErrors))},hasErrors:function(){return!!this.allErrors.length},hasVisibleErrors:function(){return this.validationErrors&&this.showValidationErrors||!!this.explicitErrors.length},showValidationErrors:function(){if(this.showErrors||this.formShouldShowErrors)return!0;if("file"===this.classification&&"live"===this.uploadBehavior&&E.call(this))return!0;return this.behavioralErrorVisibility},visibleValidationErrors:function(){return this.showValidationErrors&&this.validationErrors.length?this.validationErrors:[]}};function b(t){if(!Array.isArray(t)&&t&&"object"==typeof t){var r=[];for(var o in t)r.push({value:o,label:t[o],id:this.elementAttributes.id+"_"+o});return r}return Array.isArray(t)&&!t.length?[{value:this.value,label:this.label||this.name,id:this.context.id||e(9)}]:t}function g(){this.$emit("blur"),"blur"===this.errorBehavior&&(this.behavioralErrorVisibility=!0)}function x(t){return Object.defineProperty(t,"model",{get:E.bind(this),set:w.bind(this)})}function E(){var t=this.isVmodeled?"formulateValue":"internalModelProxy";return"checkbox"===this.type&&!Array.isArray(this[t])&&this.options?[]:this[t]?this[t]:""}function w(t){l(t,this.internalModelProxy)||(this.internalModelProxy=t),this.$emit("input",t),this.context.name&&"function"==typeof this.formulateFormSetter&&this.formulateFormSetter(this.context.name,t)}function F(t,e,r,o,i,n,s,a,l,u){"boolean"!=typeof s&&(l=a,a=s,s=!1);var c,d="function"==typeof r?r.options:r;if(t&&t.render&&(d.render=t.render,d.staticRenderFns=t.staticRenderFns,d._compiled=!0,i&&(d.functional=!0)),o&&(d._scopeId=o),n?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,l(t)),t&&t._registeredComponents&&t._registeredComponents.add(n)},d._ssrRegister=c):e&&(c=s?function(t){e.call(this,u(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,a(t))}),c)if(d.functional){var p=d.render;d.render=function(t,e){return c.call(e),p(t,e)}}else{var f=d.beforeCreate;d.beforeCreate=f?[].concat(f,c):[c]}return r}var _={name:"FormulateInput",inheritAttrs:!1,inject:{formulateFormSetter:{default:void 0},formulateFieldValidation:{default:function(){return function(){return{}}}},formulateFormRegister:{default:void 0},getFormValues:{default:function(){return function(){return{}}}},observeErrors:{default:void 0},removeErrorObserver:{default:void 0}},model:{prop:"formulateValue",event:"input"},props:{type:{type:String,default:"text"},name:{type:[String,Boolean],default:!0},formulateValue:{default:""},value:{default:!1},options:{type:[Object,Array,Boolean],default:!1},optionGroups:{type:[Object,Boolean],default:!1},id:{type:[String,Boolean,Number],default:!1},label:{type:[String,Boolean],default:!1},labelPosition:{type:[String,Boolean],default:!1},help:{type:[String,Boolean],default:!1},debug:{type:Boolean,default:!1},errors:{type:[String,Array,Boolean],default:!1},validation:{type:[String,Boolean,Array],default:!1},validationName:{type:[String,Boolean],default:!1},error:{type:[String,Boolean],default:!1},errorBehavior:{type:String,default:"blur",validator:function(t){return["blur","live"].includes(t)}},showErrors:{type:Boolean,default:!1},imageBehavior:{type:String,default:"preview"},uploadUrl:{type:[String,Boolean],default:!1},uploader:{type:[Function,Object,Boolean],default:!1},uploadBehavior:{type:String,default:"live"},preventWindowDrops:{type:Boolean,default:!0},showValue:{type:[String,Boolean],default:!1},validationMessages:{type:Object,default:function(){return{}}},validationRules:{type:Object,default:function(){return{}}},checked:{type:[String,Boolean],default:!1},disableErrors:{type:Boolean,default:!1}},data:function(){return{defaultId:e(9),localAttributes:{},localErrors:[],internalModelProxy:this.getInitialValue(),behavioralErrorVisibility:"live"===this.errorBehavior,formShouldShowErrors:!1,validationErrors:[],pendingValidation:Promise.resolve()}},computed:Object.assign({},y,{classification:function(){var t=this.$formulate.classify(this.type);return"box"===t&&this.options?"group":t},component:function(){return"group"===this.classification?"FormulateInputGroup":this.$formulate.component(this.type)},parsedValidationRules:function(){var t=this,e={};return Object.keys(this.validationRules).forEach((function(r){e[u(r)]=t.validationRules[r]})),e},messages:function(){var t=this,e={};return Object.keys(this.validationMessages).forEach((function(r){e[u(r)]=t.validationMessages[r]})),e}}),watch:{$attrs:{handler:function(t){this.updateLocalAttributes(t)},deep:!0},internalModelProxy:function(t,e){this.performValidation(),this.isVmodeled||l(t,e)||(this.context.model=t)},formulateValue:function(t,e){this.isVmodeled&&!l(t,e)&&(this.context.model=t)},showValidationErrors:{handler:function(t){this.$emit("error-visibility",t)},immediate:!0}},created:function(){this.applyInitialValue(),this.formulateFormRegister&&"function"==typeof this.formulateFormRegister&&this.formulateFormRegister(this.nameOrFallback,this),this.disableErrors||"function"!=typeof this.observeErrors||this.observeErrors({callback:this.setErrors,type:"input",field:this.nameOrFallback}),this.updateLocalAttributes(this.$attrs),this.performValidation()},destroyed:function(){this.disableErrors||"function"!=typeof this.removeErrorObserver||this.removeErrorObserver(this.setErrors)},methods:{getInitialValue:function(){var t=this.$formulate.classify(this.type);return"box"===(t="box"===t&&this.options?"group":t)&&this.checked?this.value||!0:Object.prototype.hasOwnProperty.call(this.$options.propsData,"value")&&"box"!==t?this.value:Object.prototype.hasOwnProperty.call(this.$options.propsData,"formulateValue")?this.formulateValue:""},applyInitialValue:function(){!l(this.context.model,this.internalModelProxy)&&Object.prototype.hasOwnProperty(this.$options.propsData,"options")&&"box"===this.classification&&(this.context.model=this.internalModelProxy)},updateLocalAttributes:function(t){l(t,this.localAttributes)||(this.localAttributes=t)},performValidation:function(){var t=this,e=d(this.validation,this.$formulate.rules(this.parsedValidationRules));return this.pendingValidation=Promise.all(e.map((function(e){var r=e[0],o=e[1],i=e[2],n=r.apply(void 0,[{value:t.context.model,getFormValues:t.getFormValues.bind(t),name:t.context.name}].concat(o));return(n=n instanceof Promise?n:Promise.resolve(n)).then((function(e){return!e&&t.getMessage(i,o)}))}))).then((function(t){return t.filter((function(t){return t}))})).then((function(e){return t.didValidate(e)})),this.pendingValidation},didValidate:function(t){var e=!l(t,this.validationErrors);if(this.validationErrors=t,e){var r=this.getErrorObject();this.$emit("validation",r),this.formulateFieldValidation&&"function"==typeof this.formulateFieldValidation&&this.formulateFieldValidation(r)}},getMessage:function(t,e){return this.getMessageFunc(t)({args:e,name:this.mergedValidationName,value:this.context.model,vm:this,formValues:this.getFormValues()})},getMessageFunc:function(t){var e=this;if(t=u(t),this.messages&&void 0!==this.messages[t])switch(typeof this.messages[t]){case"function":return this.messages[t];case"string":return function(){return e.messages[t]}}return function(r){return e.$formulate.validationMessage(t,r,e)}},hasValidationErrors:function(){var t=this;return new Promise((function(e){t.$nextTick((function(){t.pendingValidation.then((function(){return e(!!t.validationErrors.length)}))}))}))},getValidationErrors:function(){var t=this;return new Promise((function(e){t.$nextTick((function(){t.pendingValidation.then((function(){return e(t.getErrorObject())}))}))}))},getErrorObject:function(){return{name:this.context.nameOrFallback||this.context.name,errors:this.validationErrors,hasErrors:!!this.validationErrors.length}},setErrors:function(t){this.localErrors=c(t)}}},V=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"formulate-input",attrs:{"data-classification":t.classification,"data-has-errors":t.hasErrors,"data-is-showing-errors":t.hasVisibleErrors,"data-type":t.type}},[r("div",{staticClass:"formulate-input-wrapper"},[t.context.hasLabel&&"before"===t.context.labelPosition?t._t("label",[r("label",{staticClass:"formulate-input-label formulate-input-label--before",attrs:{for:t.context.attributes.id},domProps:{textContent:t._s(t.context.label)}})],null,t.context):t._e(),t._v(" "),t._t("element",[r(t.context.component,{tag:"component",attrs:{context:t.context}},[t._t("default",null,null,t.context)],2)],null,t.context),t._v(" "),t.context.hasLabel&&"after"===t.context.labelPosition?t._t("label",[r("label",{staticClass:"formulate-input-label formulate-input-label--after",attrs:{for:t.context.attributes.id},domProps:{textContent:t._s(t.context.label)}})],null,t.context.label):t._e()],2),t._v(" "),t.help?r("div",{staticClass:"formulate-input-help",domProps:{textContent:t._s(t.help)}}):t._e(),t._v(" "),t.disableErrors?t._e():r("FormulateErrors",{attrs:{type:"input",context:t.context}})],1)};V._withStripped=!0;var P=F({render:V,staticRenderFns:[]},void 0,_,void 0,!1,void 0,!1,void 0,void 0,void 0),O=function(t){this.form=t};O.prototype.hasValidationErrors=function(){return this.form.hasValidationErrors()},O.prototype.values=function(){var t=this;return new Promise((function(e,r){var o=[],i=function t(e){var r={};for(var o in e)e[o]instanceof s||p(e[o])?r[o]=e[o]:r[o]=t(e[o]);return r}(t.form.internalFormModelProxy),n=function(e){"object"==typeof t.form.internalFormModelProxy[e]&&t.form.internalFormModelProxy[e]instanceof s&&o.push(t.form.internalFormModelProxy[e].upload().then((function(t){var r;return Object.assign(i,((r={})[e]=t,r))})))};for(var a in i)n(a);Promise.all(o).then((function(){return e(i)})).catch((function(t){return r(t)}))}))};var $={provide:function(){return{formulateFormSetter:this.setFieldValue,formulateFormRegister:this.register,getFormValues:this.getFormValues,observeErrors:this.addErrorObserver,removeErrorObserver:this.removeErrorObserver,formulateFieldValidation:this.formulateFieldValidation}},name:"FormulateForm",model:{prop:"formulateValue",event:"input"},props:{name:{type:[String,Boolean],default:!1},formulateValue:{type:Object,default:function(){return{}}},values:{type:[Object,Boolean],default:!1},errors:{type:[Object,Boolean],default:!1},formErrors:{type:Array,default:function(){return[]}}},data:function(){return{registry:{},internalFormModelProxy:{},formShouldShowErrors:!1,errorObservers:[],namedErrors:[],namedFieldErrors:{}}},computed:{formContext:function(){return{errors:this.mergedFormErrors}},hasInitialValue:function(){return this.formulateValue&&"object"==typeof this.formulateValue||this.values&&"object"==typeof this.values},isVmodeled:function(){return!!(this.$options.propsData.hasOwnProperty("formulateValue")&&this._events&&Array.isArray(this._events.input)&&this._events.input.length)},initialValues:function(){return Object.prototype.hasOwnProperty.call(this.$options.propsData,"formulateValue")&&"object"==typeof this.formulateValue?Object.assign({},this.formulateValue):Object.prototype.hasOwnProperty.call(this.$options.propsData,"values")&&"object"==typeof this.values?Object.assign({},this.values):{}},classes:function(){var t={"formulate-form":!0};return this.name&&(t["formulate-form--"+this.name]=!0),t},mergedFormErrors:function(){return this.formErrors.concat(this.namedErrors)},mergedFieldErrors:function(){var t={};if(this.errors)for(var e in this.errors)t[e]=c(this.errors[e]);for(var r in this.namedFieldErrors)t[r]=c(this.namedFieldErrors[r]);return t},hasFormErrorObservers:function(){return!!this.errorObservers.filter((function(t){return"form"===t.type})).length}},watch:{formulateValue:{handler:function(t,e){if(this.isVmodeled&&t&&"object"==typeof t)for(var r in t)!this.registry.hasOwnProperty(r)||l(t[r],this.internalFormModelProxy[r])||l(t[r],this.registry[r].internalModelProxy[r])||(this.setFieldValue(r,t[r]),this.registry[r].context.model=t[r])},deep:!0},mergedFormErrors:function(t){this.errorObservers.filter((function(t){return"form"===t.type})).forEach((function(e){return e.callback(t)}))},mergedFieldErrors:{handler:function(t){this.errorObservers.filter((function(t){return"input"===t.type})).forEach((function(e){return e.callback(t[e.field]||[])}))},immediate:!0}},created:function(){this.$formulate.register(this),this.applyInitialValues()},destroyed:function(){this.$formulate.deregister(this)},methods:{applyInitialValues:function(){this.hasInitialValue&&(this.internalFormModelProxy=this.initialValues)},applyErrors:function(t){var e=t.formErrors,r=t.inputErrors;this.namedErrors=e,this.namedFieldErrors=r},addErrorObserver:function(t){this.errorObservers.find((function(e){return t.callback===e.callback}))||(this.errorObservers.push(t),"form"===t.type?t.callback(this.mergedFormErrors):Object.prototype.hasOwnProperty.call(this.mergedFieldErrors,t.field)&&t.callback(this.mergedFieldErrors[t.field]))},removeErrorObserver:function(t){this.errorObservers=this.errorObservers.filter((function(e){return e.callback!==t}))},setFieldValue:function(t,e){var r;Object.assign(this.internalFormModelProxy,((r={})[t]=e,r)),this.$emit("input",Object.assign({},this.internalFormModelProxy))},getUniqueRegistryName:function(t,e){return void 0===e&&(e=0),Object.prototype.hasOwnProperty.call(this.registry,t+(e||""))?this.getUniqueRegistryName(t,e+1):t+(e||"")},register:function(t,e){if(Object.prototype.hasOwnProperty.call(this.registry,t))return!1;this.registry[t]=e;var r=Object.prototype.hasOwnProperty.call(e.$options.propsData,"formulateValue"),o=Object.prototype.hasOwnProperty.call(e.$options.propsData,"value");!r&&this.hasInitialValue&&this.initialValues[t]?e.context.model=this.initialValues[t]:!r&&!o||l(e.internalModelProxy,this.initialValues[t])||this.setFieldValue(t,e.internalModelProxy)},registerErrorComponent:function(t){this.errorComponents.includes(t)||this.errorComponents.push(t)},formSubmitted:function(){var t=this;this.showErrors();var e=new O(this);return this.$emit("submit-raw",e),e.hasValidationErrors().then((function(t){return t?void 0:e.values()})).then((function(e){if(void 0!==e)return t.$emit("submit",e),e}))},showErrors:function(){for(var t in this.registry)this.registry[t].formShouldShowErrors=!0},getFormValues:function(){return this.internalFormModelProxy},formulateFieldValidation:function(t){this.$emit("validation",t)},hasValidationErrors:function(){var t=[];for(var e in this.registry)"function"==typeof this.registry[e].getValidationErrors&&t.push(this.registry[e].getValidationErrors());return Promise.all(t).then((function(t){return t.some((function(t){return t.hasErrors}))}))}}},A=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("form",{class:t.classes,on:{submit:function(e){return e.preventDefault(),t.formSubmitted(e)}}},[t.hasFormErrorObservers?t._e():r("FormulateErrors",{attrs:{context:t.formContext}}),t._v(" "),t._t("default")],2)};A._withStripped=!0;var j=F({render:A,staticRenderFns:[]},void 0,$,void 0,!1,void 0,!1,void 0,void 0,void 0),N={inject:{observeErrors:{default:!1},removeErrorObserver:{default:!1}},props:{context:{type:Object,default:function(){return{}}},type:{type:String,default:"form"}},data:function(){return{boundSetErrors:this.setErrors.bind(this),localErrors:[]}},computed:{visibleValidationErrors:function(){return Array.isArray(this.context.visibleValidationErrors)?this.context.visibleValidationErrors:[]},errors:function(){return Array.isArray(this.context.errors)?this.context.errors:[]},mergedErrors:function(){return this.errors.concat(this.localErrors)},visibleErrors:function(){return Array.from(new Set(this.mergedErrors.concat(this.visibleValidationErrors)))}},created:function(){"form"!==this.type||"function"!=typeof this.observeErrors||Array.isArray(this.context.errors)||this.observeErrors({callback:this.boundSetErrors,type:this.type})},destroyed:function(){"form"!==this.type||"function"!=typeof this.removeErrorObserver||Array.isArray(this.context.errors)||this.removeErrorObserver(this.boundSetErrors)},methods:{setErrors:function(t){this.localErrors=c(t)}}},S=function(){var t=this,e=t.$createElement,r=t._self._c||e;return t.visibleErrors.length?r("ul",{class:"formulate-"+t.type+"-errors"},t._l(t.visibleErrors,(function(e){return r("li",{key:e,class:"formulate-"+t.type+"-error",domProps:{textContent:t._s(e)}})})),0):t._e()};S._withStripped=!0;var k=F({render:S,staticRenderFns:[]},void 0,N,void 0,!1,void 0,!1,void 0,void 0,void 0);function C(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&-1===e.indexOf(o)&&(r[o]=t[o]);return r}var D={name:"FormulateInputGroup",props:{context:{type:Object,required:!0}},computed:{options:function(){return this.context.options||[]},subComponent:function(){return"FormulateInput"},optionsWithContext:function(){var t=this,e=this.context,r=(e.options,e.labelPosition,e.attributes),o=(r.id,C(r,["id"])),i=(e.classification,e.blurHandler,e.performValidation,e.hasValidationErrors,e.getValidationErrors,e.validationErrors,e.setErrors,e.visibleValidationErrors,e.component,e.hasLabel,C(e,["options","labelPosition","attributes","classification","blurHandler","performValidation","hasValidationErrors","getValidationErrors","validationErrors","setErrors","visibleValidationErrors","component","hasLabel"]));return this.options.map((function(e){return t.groupItemContext(i,e,o)}))}},methods:{groupItemContext:function(t,e,r){return Object.assign({},t,e,r,{})}}},U=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"formulate-input-group"},t._l(t.optionsWithContext,(function(e){return r(t.subComponent,t._b({key:e.id,tag:"component",staticClass:"formulate-input-group-item",attrs:{"disable-errors":!0},on:{blur:t.context.blurHandler},model:{value:t.context.model,callback:function(e){t.$set(t.context,"model",e)},expression:"context.model"}},"component",e,!1))})),1)};U._withStripped=!0;var I=F({render:U,staticRenderFns:[]},void 0,D,void 0,!1,void 0,!1,void 0,void 0,void 0),B={props:{context:{type:Object,required:!0}},computed:{type:function(){return this.context.type},id:function(){return this.context.id},attributes:function(){return this.context.attributes||{}},hasValue:function(){return!!this.context.model}}},L={name:"FormulateInputBox",mixins:[B]},M=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type}},["radio"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"radio"},domProps:{value:t.context.value,checked:t._q(t.context.model,t.context.value)},on:{blur:t.context.blurHandler,change:function(e){return t.$set(t.context,"model",t.context.value)}}},"input",t.attributes,!1)):r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"checkbox"},domProps:{value:t.context.value,checked:Array.isArray(t.context.model)?t._i(t.context.model,t.context.value)>-1:t.context.model},on:{blur:t.context.blurHandler,change:function(e){var r=t.context.model,o=e.target,i=!!o.checked;if(Array.isArray(r)){var n=t.context.value,s=t._i(r,n);o.checked?s<0&&t.$set(t.context,"model",r.concat([n])):s>-1&&t.$set(t.context,"model",r.slice(0,s).concat(r.slice(s+1)))}else t.$set(t.context,"model",i)}}},"input",t.attributes,!1)),t._v(" "),r("label",{staticClass:"formulate-input-element-decorator",attrs:{for:t.id}})])};M._withStripped=!0;var R=F({render:M,staticRenderFns:[]},void 0,L,void 0,!1,void 0,!1,void 0,void 0,void 0),T={name:"FormulateInputText",mixins:[B]},H=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type}},["checkbox"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"checkbox"},domProps:{checked:Array.isArray(t.context.model)?t._i(t.context.model,null)>-1:t.context.model},on:{blur:t.context.blurHandler,change:function(e){var r=t.context.model,o=e.target,i=!!o.checked;if(Array.isArray(r)){var n=t._i(r,null);o.checked?n<0&&t.$set(t.context,"model",r.concat([null])):n>-1&&t.$set(t.context,"model",r.slice(0,n).concat(r.slice(n+1)))}else t.$set(t.context,"model",i)}}},"input",t.attributes,!1)):"radio"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"radio"},domProps:{checked:t._q(t.context.model,null)},on:{blur:t.context.blurHandler,change:function(e){return t.$set(t.context,"model",null)}}},"input",t.attributes,!1)):r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:t.type},domProps:{value:t.context.model},on:{blur:t.context.blurHandler,input:function(e){e.target.composing||t.$set(t.context,"model",e.target.value)}}},"input",t.attributes,!1))])};H._withStripped=!0;var G=F({render:H,staticRenderFns:[]},void 0,T,void 0,!1,void 0,!1,void 0,void 0,void 0),W={name:"FormulateFiles",props:{files:{type:s,required:!0},imagePreview:{type:Boolean,default:!1}},computed:{fileUploads:function(){return this.files.files||[]}},watch:{files:function(){this.imagePreview&&this.files.loadPreviews()}},mounted:function(){this.imagePreview&&this.files.loadPreviews()}},q=function(){var t=this,e=t.$createElement,r=t._self._c||e;return t.fileUploads.length?r("ul",{staticClass:"formulate-files"},t._l(t.fileUploads,(function(e){return r("li",{key:e.uuid,attrs:{"data-has-error":!!e.error,"data-has-preview":!(!t.imagePreview||!e.previewData)}},[r("div",{staticClass:"formulate-file"},[t.imagePreview&&e.previewData?r("div",{staticClass:"formulate-file-image-preview"},[r("img",{attrs:{src:e.previewData}})]):t._e(),t._v(" "),r("div",{staticClass:"formulate-file-name",attrs:{title:e.name},domProps:{textContent:t._s(e.name)}}),t._v(" "),!1!==e.progress?r("div",{staticClass:"formulate-file-progress",attrs:{"data-just-finished":e.justFinished,"data-is-finished":!e.justFinished&&e.complete}},[r("div",{staticClass:"formulate-file-progress-inner",style:{width:e.progress+"%"}})]):t._e(),t._v(" "),e.complete&&!e.justFinished||!1===e.progress?r("div",{staticClass:"formulate-file-remove",on:{click:e.removeFile}}):t._e()]),t._v(" "),e.error?r("div",{staticClass:"formulate-file-upload-error",domProps:{textContent:t._s(e.error)}}):t._e()])})),0):t._e()};q._withStripped=!0;var Y={name:"FormulateInputFile",components:{FormulateFiles:F({render:q,staticRenderFns:[]},void 0,W,void 0,!1,void 0,!1,void 0,void 0,void 0)},mixins:[B],data:function(){return{isOver:!1}},computed:{hasFiles:function(){return!!(this.context.model instanceof s&&this.context.model.files.length)}},created:function(){Array.isArray(this.context.model)&&"string"==typeof this.context.model[0][this.$formulate.getFileUrlKey()]&&(this.context.model=this.$formulate.createUpload({files:this.context.model},this.context))},mounted:function(){window&&this.context.preventWindowDrops&&(window.addEventListener("dragover",this.preventDefault),window.addEventListener("drop",this.preventDefault))},destroyed:function(){window&&this.context.preventWindowDrops&&(window.removeEventListener("dragover",this.preventDefault),window.removeEventListener("drop",this.preventDefault))},methods:{preventDefault:function(t){"INPUT"!==t.target.tagName&&"file"!==t.target.getAttribute("type")&&(t=t||event).preventDefault()},handleFile:function(){var t=this;this.isOver=!1;var e=this.$refs.file;e.files.length&&(this.context.model=this.$formulate.createUpload(e,this.context),this.$nextTick((function(){return t.attemptImmediateUpload()})))},attemptImmediateUpload:function(){var t=this;"live"===this.context.uploadBehavior&&this.context.model instanceof s&&this.context.hasValidationErrors().then((function(e){e||t.context.model.upload()}))},handleDragOver:function(t){t.preventDefault(),this.isOver=!0},handleDragLeave:function(t){t.preventDefault(),this.isOver=!1}}},z=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type,"data-has-files":t.hasFiles}},[r("div",{staticClass:"formulate-input-upload-area",attrs:{"data-has-files":t.hasFiles}},[r("input",t._b({ref:"file",attrs:{"data-is-drag-hover":t.isOver,type:"file"},on:{blur:t.context.blurHandler,change:t.handleFile,dragover:t.handleDragOver,dragleave:t.handleDragLeave}},"input",t.attributes,!1)),t._v(" "),r("div",{directives:[{name:"show",rawName:"v-show",value:!t.hasFiles,expression:"!hasFiles"}],staticClass:"formulate-input-upload-area-mask"}),t._v(" "),t.hasFiles?r("FormulateFiles",{attrs:{files:t.context.model,"image-preview":"image"===t.context.type&&"preview"===t.context.imageBehavior}}):t._e()],1)])};z._withStripped=!0;var K=F({render:z,staticRenderFns:[]},void 0,Y,void 0,!1,void 0,!1,void 0,void 0,void 0),Z={name:"FormulateInputButton",mixins:[B]},J=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type}},[r("button",t._b({attrs:{type:t.type}},"button",t.attributes,!1),[t._t("default",[r("span",{class:"formulate-input-element--"+t.context.type+"--label",domProps:{textContent:t._s(t.context.value||t.context.label||t.context.name||"Submit")}})])],2)])};J._withStripped=!0;var X=F({render:J,staticRenderFns:[]},void 0,Z,void 0,!1,void 0,!1,void 0,void 0,void 0),Q={name:"FormulateInputSelect",mixins:[B],computed:{options:function(){return this.context.options||{}},optionGroups:function(){return this.context.optionGroups||!1},placeholderSelected:function(){return!(this.hasValue||!this.context.attributes||!this.context.attributes.placeholder)}}},tt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type}},[r("select",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{"data-placeholder-selected":t.placeholderSelected},on:{blur:t.context.blurHandler,change:function(e){var r=Array.prototype.filter.call(e.target.options,(function(t){return t.selected})).map((function(t){return"_value"in t?t._value:t.value}));t.$set(t.context,"model",e.target.multiple?r:r[0])}}},"select",t.attributes,!1),[t.context.placeholder?r("option",{attrs:{value:"",disabled:""},domProps:{selected:!t.hasValue}},[t._v("\n "+t._s(t.context.placeholder)+"\n ")]):t._e(),t._v(" "),t.optionGroups?t._l(t.optionGroups,(function(e,o){return r("optgroup",{key:o,attrs:{label:o}},t._l(e,(function(e){return r("option",t._b({key:e.id,domProps:{value:e.value,textContent:t._s(e.label)}},"option",e.attributes||{},!1))})),0)})):t._l(t.options,(function(e){return r("option",t._b({key:e.id,domProps:{value:e.value,textContent:t._s(e.label)}},"option",e.attributes||{},!1))}))],2)])};tt._withStripped=!0;var et=F({render:tt,staticRenderFns:[]},void 0,Q,void 0,!1,void 0,!1,void 0,void 0,void 0),rt={name:"FormulateInputSlider",mixins:[B]},ot=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type}},["checkbox"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"checkbox"},domProps:{checked:Array.isArray(t.context.model)?t._i(t.context.model,null)>-1:t.context.model},on:{blur:t.context.blurHandler,change:function(e){var r=t.context.model,o=e.target,i=!!o.checked;if(Array.isArray(r)){var n=t._i(r,null);o.checked?n<0&&t.$set(t.context,"model",r.concat([null])):n>-1&&t.$set(t.context,"model",r.slice(0,n).concat(r.slice(n+1)))}else t.$set(t.context,"model",i)}}},"input",t.attributes,!1)):"radio"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"radio"},domProps:{checked:t._q(t.context.model,null)},on:{blur:t.context.blurHandler,change:function(e){return t.$set(t.context,"model",null)}}},"input",t.attributes,!1)):r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:t.type},domProps:{value:t.context.model},on:{blur:t.context.blurHandler,input:function(e){e.target.composing||t.$set(t.context,"model",e.target.value)}}},"input",t.attributes,!1)),t._v(" "),t.context.showValue?r("div",{staticClass:"formulate-input-element-range-value",domProps:{textContent:t._s(t.context.model)}}):t._e()])};ot._withStripped=!0;var it=F({render:ot,staticRenderFns:[]},void 0,rt,void 0,!1,void 0,!1,void 0,void 0,void 0),nt={name:"FormulateInputTextArea",mixins:[B]},st=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"formulate-input-element formulate-input-element--textarea",attrs:{"data-type":"textarea"}},[r("textarea",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],domProps:{value:t.context.model},on:{blur:t.context.blurHandler,input:function(e){e.target.composing||t.$set(t.context,"model",e.target.value)}}},"textarea",t.attributes,!1))])};st._withStripped=!0;var at=F({render:st,staticRenderFns:[]},void 0,nt,void 0,!1,void 0,!1,void 0,void 0,void 0),lt=function(){this.options={},this.defaults={components:{FormulateForm:j,FormulateInput:P,FormulateErrors:k,FormulateInputBox:R,FormulateInputText:G,FormulateInputFile:K,FormulateInputGroup:I,FormulateInputButton:X,FormulateInputSelect:et,FormulateInputSlider:it,FormulateInputTextArea:at},library:n,rules:f,mimes:m,locale:!1,uploader:v,uploadUrl:!1,fileUrlKey:"url",uploadJustCompleteDuration:1e3,errorHandler:function(t){return t},plugins:[o],locales:{}},this.registry=new Map};lt.prototype.install=function(t,e){var r=this;t.prototype.$formulate=this,this.options=this.defaults;var o=this.defaults.plugins;for(var i in e&&Array.isArray(e.plugins)&&e.plugins.length&&(o=o.concat(e.plugins)),o.forEach((function(t){return"function"==typeof t?t(r):null})),this.extend(e||{}),this.options.components)t.component(i,this.options.components[i])},lt.prototype.extend=function(t){if("object"==typeof t)return this.options=this.merge(this.options,t),this;throw new Error("VueFormulate extend() should be passed an object (was "+typeof t+")")},lt.prototype.merge=function(t,e,o){void 0===o&&(o=!0);var i={};for(var n in t)e.hasOwnProperty(n)?r(e[n])&&r(t[n])?i[n]=this.merge(t[n],e[n],o):o&&Array.isArray(t[n])&&Array.isArray(e[n])?i[n]=t[n].concat(e[n]):i[n]=e[n]:i[n]=t[n];for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i},lt.prototype.classify=function(t){return this.options.library.hasOwnProperty(t)?this.options.library[t].classification:"unknown"},lt.prototype.component=function(t){return!!this.options.library.hasOwnProperty(t)&&this.options.library[t].component},lt.prototype.rules=function(t){return void 0===t&&(t={}),Object.assign({},this.options.rules,t)},lt.prototype.i18n=function(t){if(t.$i18n)switch(typeof t.$i18n.locale){case"string":return t.$i18n.locale;case"function":return t.$i18n.locale()}return!1},lt.prototype.getLocale=function(t){var e=this;return this.selectedLocale||(this.selectedLocale=[this.options.locale,this.i18n(t),"en"].reduce((function(t,r){if(t)return t;if(r){var o=function(t){return t.split("-").reduce((function(t,e){return t.length&&t.unshift(t[0]+"-"+e),t.length?t:[e]}),[])}(r).find((function(t){return Object.prototype.hasOwnProperty.call(e.options.locales,t)}));o&&(t=o)}return t}),!1)),this.selectedLocale},lt.prototype.validationMessage=function(t,e,r){var o=this.options.locales[this.getLocale(r)];return o.hasOwnProperty(t)?o[t](e):"_"===t[0]&&o.hasOwnProperty(t.substr(1))?o[t.substr(1)](e):o.hasOwnProperty("default")?o.default(e):"This field does not have a valid value"},lt.prototype.register=function(t){"FormulateForm"===t.$options.name&&t.name&&this.registry.set(t.name,t)},lt.prototype.deregister=function(t){"FormulateForm"===t.$options.name&&t.name&&this.registry.has(t.name)&&this.registry.delete(t.name)},lt.prototype.handle=function(t,e,r){void 0===r&&(r=!1);var o=r?t:this.options.errorHandler(t);return e&&this.registry.has(e)&&this.registry.get(e).applyErrors({formErrors:c(o.formErrors),inputErrors:o.inputErrors||{}}),o},lt.prototype.getUploader=function(){return this.options.uploader||!1},lt.prototype.getUploadUrl=function(){return this.options.uploadUrl||!1},lt.prototype.getFileUrlKey=function(){return this.options.fileUrlKey||"url"},lt.prototype.createUpload=function(t,e){return new s(t,e,this.options)};var ut=new lt;export default ut; +import t from"is-url";import e from"nanoid/non-secure";import r from"is-plain-object";import{en as o}from"@braid/vue-formulate-i18n";var i=function(t,e){return{classification:t,component:"FormulateInput"+(e||t[0].toUpperCase()+t.substr(1))}},n=Object.assign({},["text","email","number","color","date","hidden","month","password","search","tel","time","url","week","datetime-local"].reduce((function(t,e){var r;return Object.assign({},t,((r={})[e]=i("text"),r))}),{}),{range:i("slider"),textarea:i("textarea","TextArea"),checkbox:i("box"),radio:i("box"),submit:i("button"),button:i("button"),select:i("select"),file:i("file"),image:i("file"),group:i("group")}),s=function(t,e,r){void 0===r&&(r={}),this.input=t,this.fileList=t.files,this.files=[],this.options=Object.assign({},{mimes:{}},r),this.results=!1,this.context=e,Array.isArray(this.fileList)?this.rehydrateFileList(this.fileList):this.addFileList(this.fileList)};function a(t,e){var r={};for(var o in t)r[o]=e(o,t[o]);return r}function l(t,e){if(t===e)return!0;if(!t||!e)return!1;var r=Object.keys(t),o=Object.keys(e),i=r.length;if(o.length!==i)return!1;for(var n=0;n=100&&(e.complete||(e.justFinished=!0,setTimeout((function(){e.justFinished=!1}),t.options.uploadJustCompleteDuration)),e.complete=!0)}),(function(t){e.progress=0,e.error=t,e.complete=!0}),t.options)}))).then((function(r){t.results=r,e(r)})).catch((function(t){throw new Error(t)}))}))},s.prototype.removeFile=function(t){if(this.files=this.files.filter((function(e){return e.uuid!==t})),this.context.performValidation(),window&&this.fileList instanceof FileList){var e=new DataTransfer;this.files.map((function(t){return e.items.add(t.file)})),this.fileList=e.files,this.input.files=this.fileList}},s.prototype.loadPreviews=function(){this.files.map((function(t){if(!t.previewData&&window&&window.FileReader&&/^image\//.test(t.file.type)){var e=new FileReader;e.onload=function(e){return Object.assign(t,{previewData:e.target.result})},e.readAsDataURL(t.file)}}))},s.prototype.getFileList=function(){return this.fileList},s.prototype.getFiles=function(){return this.files},s.prototype.toString=function(){var t=this.files.length?this.files.length+" files":"empty";return this.results?JSON.stringify(this.results,null," "):"FileUpload("+t+")"};var m={accepted:function(t){var e=t.value;return Promise.resolve(["yes","on","1",1,!0,"true"].includes(e))},after:function(t,e){var r=t.value;void 0===e&&(e=!1);var o=Date.parse(e||new Date),i=Date.parse(r);return Promise.resolve(!isNaN(i)&&i>o)},alpha:function(t,e){var r=t.value;void 0===e&&(e="default");var o={default:/^[a-zA-ZÀ-ÖØ-öø-ÿ]+$/,latin:/^[a-zA-Z]+$/},i=o.hasOwnProperty(e)?e:"default";return Promise.resolve(o[i].test(r))},alphanumeric:function(t,e){var r=t.value;void 0===e&&(e="default");var o={default:/^[a-zA-Z0-9À-ÖØ-öø-ÿ]+$/,latin:/^[a-zA-Z0-9]+$/},i=o.hasOwnProperty(e)?e:"default";return Promise.resolve(o[i].test(r))},before:function(t,e){var r=t.value;void 0===e&&(e=!1);var o=Date.parse(e||new Date),i=Date.parse(r);return Promise.resolve(!isNaN(i)&&ie&&ie&&i.length()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test(e))},endsWith:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve("string"==typeof e&&r.length?void 0!==r.find((function(t){return e.endsWith(t)})):"string"==typeof e&&0===r.length)},in:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(void 0!==r.find((function(t){return"object"==typeof t?l(t,e):t===e})))},matches:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(!!r.find((function(t){return"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===e})))},mime:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(function(){if(e instanceof s)for(var t=e.getFiles(),o=0;o=e):!isNaN(o)&&"length"!==r||"value"===r?(o=isNaN(o)?o:Number(o))>=e:("string"==typeof o||"length"===r)&&(o=isNaN(o)?o:o.toString()).length>=e)},max:function(t,e,r){var o=t.value;return void 0===e&&(e=10),Promise.resolve(Array.isArray(o)?(e=isNaN(e)?e:Number(e),o.length<=e):!isNaN(o)&&"length"!==r||"value"===r?(o=isNaN(o)?o:Number(o))<=e:("string"==typeof o||"length"===r)&&(o=isNaN(o)?o:o.toString()).length<=e)},not:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(void 0===r.find((function(t){return"object"==typeof t?l(t,e):t===e})))},number:function(t){var e=t.value;return Promise.resolve(!isNaN(e))},required:function(t,e){var r=t.value;return void 0===e&&(e=!0),Promise.resolve(!(e&&!["no","false"].includes(e))||(Array.isArray(r)?!!r.length:r instanceof s?r.getFiles().length>0:"string"==typeof r?!!r:"object"!=typeof r||!!r&&!!Object.keys(r).length))},startsWith:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve("string"==typeof e&&r.length?void 0!==r.find((function(t){return e.startsWith(t)})):"string"==typeof e&&0===r.length)},url:function(e){var r=e.value;return Promise.resolve(t(r))},bail:function(){return Promise.resolve(!0)}},v="image/",y={csv:"text/csv",gif:v+"gif",jpg:v+"jpeg",jpeg:v+"jpeg",png:v+"png",pdf:"application/pdf",svg:v+"svg+xml"};function g(t,e,r,o){return new Promise((function(r,i){var n=(o.fauxUploaderDuration||2e3)*(.5+Math.random()),s=performance.now(),a=function(){return setTimeout((function(){var o=performance.now()-s,i=Math.min(100,Math.round(o/n*100));if(e(i),i>=100)return r({url:"http://via.placeholder.com/350x150.png",name:t.name});a()}),20)};a()}))}function b(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&-1===e.indexOf(o)&&(r[o]=t[o]);return r}var x={inheritAttrs:!1,functional:!0,render:function(t,e){for(var r=e.props,o=e.data,i=e.parent,n=e.children,s=i,a=(r.name,r.forceWrap),l=r.context,u=b(r,["name","forceWrap","context"]);s&&"FormulateInput"!==s.$options.name;)s=s.$parent;if(!s)return null;if(s.$scopedSlots&&s.$scopedSlots[r.name])return s.$scopedSlots[r.name](Object.assign({},l,u));if(Array.isArray(n)&&(n.length>1||a&&n.length>0)){var c=o.attrs,d=(c.name,c.context,b(c,["name","context"]));return t("div",Object.assign({},o,{attrs:d}),n)}return Array.isArray(n)&&1===n.length?n[0]:null}};function E(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&-1===e.indexOf(o)&&(r[o]=t[o]);return r}var w=function(t){this.registry=new Map,this.ctx=t};function _(t){return new w(t).dataProps()}function F(){return{hasInitialValue:function(){return this.formulateValue&&"object"==typeof this.formulateValue||this.values&&"object"==typeof this.values||this.isGrouping&&"object"==typeof this.context.model[this.index]},isVmodeled:function(){return!!(this.$options.propsData.hasOwnProperty("formulateValue")&&this._events&&Array.isArray(this._events.input)&&this._events.input.length)},initialValues:function(){return f(this.$options.propsData,"formulateValue")&&"object"==typeof this.formulateValue?Object.assign({},this.formulateValue):f(this.$options.propsData,"values")&&"object"==typeof this.values?Object.assign({},this.values):this.isGrouping&&"object"==typeof this.context.model[this.index]?this.context.model[this.index]:{}}}}function V(t){void 0===t&&(t=[]);var e={applyInitialValues:function(){this.hasInitialValue&&(this.proxy=this.initialValues)},setFieldValue:function(t,e){var r;if(void 0===e){var o=this.proxy,i=(o[t],E(o,[String(t)]));this.proxy=i}else Object.assign(this.proxy,((r={})[t]=e,r));this.$emit("input",Object.assign({},this.proxy))},getFormValues:function(){return this.proxy},hasValidationErrors:function(){return Promise.all(this.registry.reduce((function(t,e,r){return t.push(e.performValidation()&&e.getValidationErrors()),t}),[])).then((function(t){return t.some((function(t){return t.hasErrors}))}))},showErrors:function(){this.childrenShouldShowErrors=!0,this.registry.map((function(t){t.formShouldShowErrors=!0}))},hideErrors:function(){this.childrenShouldShowErrors=!1,this.registry.map((function(t){t.formShouldShowErrors=!1,t.behavioralErrorVisibility=!1}))},setValues:function(t){var e=this;Array.from(new Set(Object.keys(t).concat(Object.keys(this.proxy)))).forEach((function(r){!e.registry.has(r)||l(t[r],e.proxy[r])||l(t[r],e.registry.get(r).proxy)||(e.setFieldValue(r,t[r]),e.registry.get(r).context.model=t[r])}))}};return Object.keys(e).reduce((function(r,o){var i;return t.includes(o)?r:Object.assign({},r,((i={})[o]=e[o],i))}),{})}function O(t){return{formulateSetter:t.setFieldValue,formulateRegister:t.register,formulateDeregister:t.deregister,getFormValues:t.getFormValues}}w.prototype.add=function(t,e){return this.registry.set(t,e),this},w.prototype.remove=function(t){this.registry.delete(t);var e=this.ctx.proxy,r=(e[t],E(e,[String(t)]));return this.ctx.proxy=r,this},w.prototype.has=function(t){return this.registry.has(t)},w.prototype.get=function(t){return this.registry.get(t)},w.prototype.map=function(t){var e={};return this.registry.forEach((function(r,o){var i;return Object.assign(e,((i={})[o]=t(r,o),i))})),e},w.prototype.keys=function(){return Array.from(this.registry.keys())},w.prototype.register=function(t,e){if(this.registry.has(t))return!1;this.registry.set(t,e);var r=f(e.$options.propsData,"formulateValue"),o=f(e.$options.propsData,"value");!r&&this.ctx.hasInitialValue&&this.ctx.initialValues[t]?e.context.model=this.ctx.initialValues[t]:!r&&!o||l(e.proxy,this.ctx.initialValues[t])||this.ctx.setFieldValue(t,e.proxy),this.childrenShouldShowErrors&&(e.formShouldShowErrors=!0)},w.prototype.reduce=function(t,e){return this.registry.forEach((function(r,o){e=t(e,r,o)})),e},w.prototype.dataProps=function(){var t=this;return{proxy:{},registry:this,register:this.register.bind(this),deregister:function(e){return t.remove(e)},childrenShouldShowErrors:!1}};var A=function(t){this.form=t};function P(t,e,r,o,i,n,s,a,l,u){"boolean"!=typeof s&&(l=a,a=s,s=!1);var c,d="function"==typeof r?r.options:r;if(t&&t.render&&(d.render=t.render,d.staticRenderFns=t.staticRenderFns,d._compiled=!0,i&&(d.functional=!0)),o&&(d._scopeId=o),n?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,l(t)),t&&t._registeredComponents&&t._registeredComponents.add(n)},d._ssrRegister=c):e&&(c=s?function(t){e.call(this,u(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,a(t))}),c)if(d.functional){var p=d.render;d.render=function(t,e){return c.call(e),p(t,e)}}else{var h=d.beforeCreate;d.beforeCreate=h?[].concat(h,c):[c]}return r}A.prototype.hasValidationErrors=function(){return this.form.hasValidationErrors()},A.prototype.values=function(){var t=this;return new Promise((function(e,r){var o=[],i=function t(e){if("object"!=typeof e)return e;var r=Array.isArray(e)?[]:{};for(var o in e)e[o]instanceof s||h(e[o])?r[o]=e[o]:r[o]=t(e[o]);return r}(t.form.proxy),n=function(e){"object"==typeof t.form.proxy[e]&&t.form.proxy[e]instanceof s&&o.push(t.form.proxy[e].upload().then((function(t){var r;return Object.assign(i,((r={})[e]=t,r))})))};for(var a in i)n(a);Promise.all(o).then((function(){return e(i)})).catch((function(t){return r(t)}))}))};var S={provide:function(){return Object.assign({},O(this),{observeErrors:this.addErrorObserver,removeErrorObserver:this.removeErrorObserver,formulateFieldValidation:this.formulateFieldValidation})},name:"FormulateForm",model:{prop:"formulateValue",event:"input"},props:{name:{type:[String,Boolean],default:!1},formulateValue:{type:Object,default:function(){return{}}},values:{type:[Object,Boolean],default:!1},errors:{type:[Object,Boolean],default:!1},formErrors:{type:Array,default:function(){return[]}}},data:function(){return Object.assign({},_(this),{formShouldShowErrors:!1,errorObservers:[],namedErrors:[],namedFieldErrors:{}})},computed:Object.assign({},F(),{formContext:function(){return{errors:this.mergedFormErrors}},classes:function(){var t={"formulate-form":!0};return this.name&&(t["formulate-form--"+this.name]=!0),t},mergedFormErrors:function(){return this.formErrors.concat(this.namedErrors)},mergedFieldErrors:function(){var t={};if(this.errors)for(var e in this.errors)t[e]=c(this.errors[e]);for(var r in this.namedFieldErrors)t[r]=c(this.namedFieldErrors[r]);return t},hasFormErrorObservers:function(){return!!this.errorObservers.filter((function(t){return"form"===t.type})).length}}),watch:{formulateValue:{handler:function(t){this.isVmodeled&&t&&"object"==typeof t&&this.setValues(t)},deep:!0},mergedFormErrors:function(t){this.errorObservers.filter((function(t){return"form"===t.type})).forEach((function(e){return e.callback(t)}))},mergedFieldErrors:{handler:function(t){this.errorObservers.filter((function(t){return"input"===t.type})).forEach((function(e){return e.callback(t[e.field]||[])}))},immediate:!0}},created:function(){this.$formulate.register(this),this.applyInitialValues()},destroyed:function(){this.$formulate.deregister(this)},methods:Object.assign({},V(),{applyErrors:function(t){var e=t.formErrors,r=t.inputErrors;this.namedErrors=e,this.namedFieldErrors=r},addErrorObserver:function(t){this.errorObservers.find((function(e){return t.callback===e.callback}))||(this.errorObservers.push(t),"form"===t.type?t.callback(this.mergedFormErrors):f(this.mergedFieldErrors,t.field)&&t.callback(this.mergedFieldErrors[t.field]))},removeErrorObserver:function(t){this.errorObservers=this.errorObservers.filter((function(e){return e.callback!==t}))},registerErrorComponent:function(t){this.errorComponents.includes(t)||this.errorComponents.push(t)},formSubmitted:function(){var t=this;this.showErrors();var e=new A(this);return this.$emit("submit-raw",e),e.hasValidationErrors().then((function(t){return t?void 0:e.values()})).then((function(e){if(void 0!==e)return t.$emit("submit",e),e}))},formulateFieldValidation:function(t){this.$emit("validation",t)}})},$=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("form",{class:t.classes,on:{submit:function(e){return e.preventDefault(),t.formSubmitted(e)}}},[t.hasFormErrorObservers?t._e():r("FormulateErrors",{attrs:{context:t.formContext}}),t._v(" "),t._t("default")],2)};$._withStripped=!0;var j=P({render:$,staticRenderFns:[]},void 0,S,void 0,!1,void 0,!1,void 0,void 0,void 0),C={context:function(){return N.call(this,Object.assign({},{addLabel:this.logicalAddLabel,attributes:this.elementAttributes,blurHandler:k.bind(this),classification:this.classification,component:this.component,disableErrors:this.disableErrors,errors:this.explicitErrors,formShouldShowErrors:this.formShouldShowErrors,getValidationErrors:this.getValidationErrors.bind(this),hasGivenName:this.hasGivenName,hasLabel:this.label&&"button"!==this.classification,hasValidationErrors:this.hasValidationErrors.bind(this),help:this.help,helpPosition:this.logicalHelpPosition,id:this.id||this.defaultId,imageBehavior:this.imageBehavior,label:this.label,labelPosition:this.logicalLabelPosition,limit:this.limit,name:this.nameOrFallback,performValidation:this.performValidation.bind(this),preventWindowDrops:this.preventWindowDrops,repeatable:this.repeatable,setErrors:this.setErrors.bind(this),showValidationErrors:this.showValidationErrors,slotComponents:this.slotComponents,type:this.type,uploadBehavior:this.uploadBehavior,uploadUrl:this.mergedUploadUrl,uploader:this.uploader||this.$formulate.getUploader(),validationErrors:this.validationErrors,value:this.value,visibleValidationErrors:this.visibleValidationErrors,isSubField:this.isSubField},this.typeContext))},nameOrFallback:function(){if(!0===this.name&&"button"!==this.classification)return this.type+"_"+this.elementAttributes.id;if(!1===this.name||"button"===this.classification&&!0===this.name)return!1;return this.name},hasGivenName:function(){return"boolean"!=typeof this.name},typeContext:function(){var t=this;switch(this.classification){case"select":return{options:R.call(this,this.options),optionGroups:!!this.optionGroups&&a(this.optionGroups,(function(e,r){return R.call(t,r)})),placeholder:this.$attrs.placeholder||!1};case"slider":return{showValue:!!this.showValue};default:return this.options?{options:R.call(this,this.options)}:{}}},elementAttributes:function(){var t=Object.assign({},this.localAttributes);this.id?t.id=this.id:t.id=this.defaultId;this.hasGivenName&&(t.name=this.name);this.help&&(t["aria-describedby"]=t.id+"-help");return t},logicalLabelPosition:function(){if(this.labelPosition)return this.labelPosition;switch(this.classification){case"box":return"after";default:return"before"}},logicalHelpPosition:function(){if(this.helpPosition)return this.helpPosition;switch(this.classification){case"group":return"before";default:return"after"}},mergedUploadUrl:function(){return this.uploadUrl||this.$formulate.getUploadUrl()},isVmodeled:function(){return!!(this.$options.propsData.hasOwnProperty("formulateValue")&&this._events&&Array.isArray(this._events.input)&&this._events.input.length)},mergedValidationName:function(){if(this.validationName)return this.validationName;if("string"==typeof this.name)return this.name;if(this.label)return this.label;return this.type},explicitErrors:function(){return c(this.errors).concat(this.localErrors).concat(c(this.error))},allErrors:function(){return this.explicitErrors.concat(c(this.validationErrors))},hasErrors:function(){return!!this.allErrors.length},hasVisibleErrors:function(){return this.validationErrors&&this.showValidationErrors||!!this.explicitErrors.length},showValidationErrors:function(){if(this.showErrors||this.formShouldShowErrors)return!0;if("file"===this.classification&&"live"===this.uploadBehavior&&I.call(this))return!0;return this.behavioralErrorVisibility},visibleValidationErrors:function(){return this.showValidationErrors&&this.validationErrors.length?this.validationErrors:[]},slotComponents:function(){return{label:this.$formulate.slotComponent(this.type,"label"),help:this.$formulate.slotComponent(this.type,"help"),errors:this.$formulate.slotComponent(this.type,"errors"),repeatable:this.$formulate.slotComponent(this.type,"repeatable"),addMore:this.$formulate.slotComponent(this.type,"addMore")}},logicalAddLabel:function(){if("boolean"==typeof this.addLabel)return"+ "+(this.label||this.name||"Add");return this.addLabel}};function R(t){if(!Array.isArray(t)&&t&&"object"==typeof t){var e=[];for(var r in t)e.push({value:r,label:t[r],id:this.elementAttributes.id+"_"+r});return e}return t}function k(){this.$emit("blur"),"blur"===this.errorBehavior&&(this.behavioralErrorVisibility=!0)}function N(t){return Object.defineProperty(t,"model",{get:I.bind(this),set:D.bind(this)})}function I(){var t=this.isVmodeled?"formulateValue":"proxy";return"checkbox"===this.type&&!Array.isArray(this[t])&&this.options?[]:this[t]?this[t]:""}function D(t){l(t,this.proxy)||(this.proxy=t),this.$emit("input",t),this.context.name&&"function"==typeof this.formulateSetter&&this.formulateSetter(this.context.name,t)}var L={name:"FormulateInput",inheritAttrs:!1,provide:function(){return{formulateRegisterRule:this.registerRule,formulateRemoveRule:this.removeRule}},inject:{formulateSetter:{default:void 0},formulateFieldValidation:{default:function(){return function(){return{}}}},formulateRegister:{default:void 0},formulateDeregister:{default:void 0},getFormValues:{default:function(){return function(){return{}}}},observeErrors:{default:void 0},removeErrorObserver:{default:void 0},isSubField:{default:function(){return function(){return!1}}}},model:{prop:"formulateValue",event:"input"},props:{type:{type:String,default:"text"},name:{type:[String,Boolean],default:!0},formulateValue:{default:""},value:{default:!1},options:{type:[Object,Array,Boolean],default:!1},optionGroups:{type:[Object,Boolean],default:!1},id:{type:[String,Boolean,Number],default:!1},label:{type:[String,Boolean],default:!1},labelPosition:{type:[String,Boolean],default:!1},limit:{type:Number,default:1/0},help:{type:[String,Boolean],default:!1},helpPosition:{type:[String,Boolean],default:!1},errors:{type:[String,Array,Boolean],default:!1},repeatable:{type:Boolean,default:!1},validation:{type:[String,Boolean,Array],default:!1},validationName:{type:[String,Boolean],default:!1},error:{type:[String,Boolean],default:!1},errorBehavior:{type:String,default:"blur",validator:function(t){return["blur","live","submit"].includes(t)}},showErrors:{type:Boolean,default:!1},imageBehavior:{type:String,default:"preview"},uploadUrl:{type:[String,Boolean],default:!1},uploader:{type:[Function,Object,Boolean],default:!1},uploadBehavior:{type:String,default:"live"},preventWindowDrops:{type:Boolean,default:!0},showValue:{type:[String,Boolean],default:!1},validationMessages:{type:Object,default:function(){return{}}},validationRules:{type:Object,default:function(){return{}}},checked:{type:[String,Boolean],default:!1},disableErrors:{type:Boolean,default:!1},addLabel:{type:[Boolean,String],default:!1}},data:function(){return{defaultId:this.$formulate.nextId(this),localAttributes:{},localErrors:[],proxy:this.getInitialValue(),behavioralErrorVisibility:"live"===this.errorBehavior,formShouldShowErrors:!1,validationErrors:[],pendingValidation:Promise.resolve(),ruleRegistry:[],messageRegistry:{}}},computed:Object.assign({},C,{classification:function(){var t=this.$formulate.classify(this.type);return"box"===t&&this.options?"group":t},component:function(){return"group"===this.classification?"FormulateInputGroup":this.$formulate.component(this.type)},parsedValidationRules:function(){var t=this,e={};return Object.keys(this.validationRules).forEach((function(r){e[u(r)]=t.validationRules[r]})),e},messages:function(){var t=this,e={};return Object.keys(this.validationMessages).forEach((function(r){e[u(r)]=t.validationMessages[r]})),Object.keys(this.messageRegistry).forEach((function(r){e[u(r)]=t.messageRegistry[r]})),e}}),watch:{$attrs:{handler:function(t){this.updateLocalAttributes(t)},deep:!0},proxy:function(t,e){this.performValidation(),this.isVmodeled||l(t,e)||(this.context.model=t)},formulateValue:function(t,e){this.isVmodeled&&!l(t,e)&&(this.context.model=t)},showValidationErrors:{handler:function(t){this.$emit("error-visibility",t)},immediate:!0}},created:function(){this.applyInitialValue(),this.formulateRegister&&"function"==typeof this.formulateRegister&&this.formulateRegister(this.nameOrFallback,this),this.disableErrors||"function"!=typeof this.observeErrors||this.observeErrors({callback:this.setErrors,type:"input",field:this.nameOrFallback}),this.updateLocalAttributes(this.$attrs),this.performValidation()},beforeDestroy:function(){this.disableErrors||"function"!=typeof this.removeErrorObserver||this.removeErrorObserver(this.setErrors),"function"==typeof this.formulateDeregister&&this.formulateDeregister(this.nameOrFallback)},methods:{getInitialValue:function(){var t=this.$formulate.classify(this.type);return"box"===(t="box"===t&&this.options?"group":t)&&this.checked?this.value||!0:f(this.$options.propsData,"value")&&"box"!==t?this.value:f(this.$options.propsData,"formulateValue")?this.formulateValue:""},applyInitialValue:function(){!l(this.context.model,this.proxy)&&Object.prototype.hasOwnProperty(this.$options.propsData,"options")&&"box"===this.classification&&(this.context.model=this.proxy)},updateLocalAttributes:function(t){l(t,this.localAttributes)||(this.localAttributes=t)},performValidation:function(){var t=this,e=d(this.validation,this.$formulate.rules(this.parsedValidationRules));return e=this.ruleRegistry.length?this.ruleRegistry.concat(e):e,this.pendingValidation=this.runRules(e).then((function(e){return t.didValidate(e)})),this.pendingValidation},runRules:function(t){var e=this,r=function(t){var r=t[0],o=t[1],i=t[2],n=(t[3],r.apply(void 0,[{value:e.context.model,getFormValues:e.getFormValues.bind(e),name:e.context.name}].concat(o)));return(n=n instanceof Promise?n:Promise.resolve(n)).then((function(t){return!t&&e.getMessage(i,o)}))};return new Promise((function(e){var o=function(t,i){void 0===i&&(i=[]);var n=t.shift();Array.isArray(n)&&n.length?Promise.all(n.map(r)).then((function(t){return t.filter((function(t){return!!t}))})).then((function(r){return(r=Array.isArray(r)?r:[]).length&&n.bail||!t.length?e(i.concat(r)):o(t,i.concat(r))})):e([])};o(function(t){var e=[],r=t.findIndex((function(t){return"bail"===t[2].toLowerCase()}));if(r>=0){var o=t.splice(0,r+1).slice(0,-1);o.length&&e.push(o),t.map((function(t){return e.push(Object.defineProperty([t],"bail",{value:!0}))}))}else e.push(t);return e.reduce((function(t,e){var r=function(t,e){if(void 0===e&&(e=!1),t.length<2)return Object.defineProperty([t],"bail",{value:e});var o=[],i=t.findIndex((function(t){return"^"===t[3]}));if(i>=0){var n=t.splice(0,i);n.length&&o.push.apply(o,r(n,e)),o.push(Object.defineProperty([t.shift()],"bail",{value:!0})),t.length&&o.push.apply(o,r(t,e))}else o.push(t);return o};return t.concat(r(e))}),[])}(t))}))},didValidate:function(t){var e=!l(t,this.validationErrors);if(this.validationErrors=t,e){var r=this.getErrorObject();this.$emit("validation",r),this.formulateFieldValidation&&"function"==typeof this.formulateFieldValidation&&this.formulateFieldValidation(r)}},getMessage:function(t,e){return this.getMessageFunc(t)({args:e,name:this.mergedValidationName,value:this.context.model,vm:this,formValues:this.getFormValues()})},getMessageFunc:function(t){var e=this;if(t=u(t),this.messages&&void 0!==this.messages[t])switch(typeof this.messages[t]){case"function":return this.messages[t];case"string":case"boolean":return function(){return e.messages[t]}}return function(r){return e.$formulate.validationMessage(t,r,e)}},hasValidationErrors:function(){var t=this;return new Promise((function(e){t.$nextTick((function(){t.pendingValidation.then((function(){return e(!!t.validationErrors.length)}))}))}))},getValidationErrors:function(){var t=this;return new Promise((function(e){t.$nextTick((function(){return t.pendingValidation.then((function(){return e(t.getErrorObject())}))}))}))},getErrorObject:function(){return{name:this.context.nameOrFallback||this.context.name,errors:this.validationErrors.filter((function(t){return"string"==typeof t})),hasErrors:!!this.validationErrors.length}},setErrors:function(t){this.localErrors=c(t)},registerRule:function(t,e,r,o){void 0===o&&(o=null),this.ruleRegistry.some((function(t){return t[2]===r}))||(this.ruleRegistry.push([t,e,r]),null!==o&&(this.messageRegistry[r]=o))},removeRule:function(t){var e=this.ruleRegistry.findIndex((function(e){return e[2]===t}));e>=0&&(this.ruleRegistry.splice(e,1),delete this.messageRegistry[t])}}},U=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"formulate-input",attrs:{"data-classification":t.classification,"data-has-errors":t.hasErrors,"data-is-showing-errors":t.hasVisibleErrors,"data-type":t.type}},[r("div",{staticClass:"formulate-input-wrapper"},["before"===t.context.labelPosition?t._t("label",[t.context.hasLabel?r(t.context.slotComponents.label,{tag:"component",attrs:{context:t.context}}):t._e()],null,t.context):t._e(),t._v(" "),"before"===t.context.helpPosition?t._t("help",[t.context.help?r(t.context.slotComponents.help,{tag:"component",attrs:{context:t.context}}):t._e()],null,t.context):t._e(),t._v(" "),t._t("element",[r(t.context.component,{tag:"component",attrs:{context:t.context},on:{click:function(e){return t.$emit("click",e)}}},[t._t("default",null,null,t.context)],2)],null,t.context),t._v(" "),"after"===t.context.labelPosition?t._t("label",[t.context.hasLabel?r(t.context.slotComponents.label,{tag:"component",attrs:{context:t.context}}):t._e()],null,t.context):t._e()],2),t._v(" "),"after"===t.context.helpPosition?t._t("help",[t.context.help?r(t.context.slotComponents.help,{tag:"component",attrs:{context:t.context}}):t._e()],null,t.context):t._e(),t._v(" "),t._t("errors",[t.context.disableErrors?t._e():r(t.context.slotComponents.errors,{tag:"component",attrs:{type:"FormulateErrors"===t.context.slotComponents.errors&&"input",context:t.context}})],null,t.context)],2)};U._withStripped=!0;var B=P({render:U,staticRenderFns:[]},void 0,L,void 0,!1,void 0,!1,void 0,void 0,void 0),M={inject:{observeErrors:{default:!1},removeErrorObserver:{default:!1}},props:{context:{type:Object,default:function(){return{}}},type:{type:String,default:"form"}},data:function(){return{boundSetErrors:this.setErrors.bind(this),localErrors:[]}},computed:{visibleValidationErrors:function(){return Array.isArray(this.context.visibleValidationErrors)?this.context.visibleValidationErrors:[]},errors:function(){return Array.isArray(this.context.errors)?this.context.errors:[]},mergedErrors:function(){return this.errors.concat(this.localErrors)},visibleErrors:function(){return Array.from(new Set(this.mergedErrors.concat(this.visibleValidationErrors))).filter((function(t){return"string"==typeof t}))}},created:function(){"form"!==this.type||"function"!=typeof this.observeErrors||Array.isArray(this.context.errors)||this.observeErrors({callback:this.boundSetErrors,type:this.type})},destroyed:function(){"form"!==this.type||"function"!=typeof this.removeErrorObserver||Array.isArray(this.context.errors)||this.removeErrorObserver(this.boundSetErrors)},methods:{setErrors:function(t){this.localErrors=c(t)}}},G=function(){var t=this,e=t.$createElement,r=t._self._c||e;return t.visibleErrors.length?r("ul",{class:"formulate-"+t.type+"-errors"},t._l(t.visibleErrors,(function(e){return r("li",{key:e,class:"formulate-"+t.type+"-error",domProps:{textContent:t._s(e)}})})),0):t._e()};G._withStripped=!0;var H=P({render:G,staticRenderFns:[]},void 0,M,void 0,!1,void 0,!1,void 0,void 0,void 0),T={props:{context:{type:Object,required:!0}}},q=function(){var t=this.$createElement,e=this._self._c||t;return this.context.help?e("div",{class:"formulate-input-help formulate-input-help--"+this.context.helpPosition,attrs:{id:this.context.id+"-help"},domProps:{textContent:this._s(this.context.help)}}):this._e()};q._withStripped=!0;var W=P({render:q,staticRenderFns:[]},void 0,T,void 0,!1,void 0,!1,void 0,void 0,void 0),Y={name:"FormulateGrouping",props:{context:{type:Object,required:!0}},provide:function(){return{isSubField:function(){return!0}}},inject:["formulateRegisterRule","formulateRemoveRule"],computed:{items:function(){return Array.isArray(this.context.model)&&(this.context.repeatable||0!==this.context.model.length)?this.context.model:[{}]},providers:function(){var t=this;return this.items.map((function(e,r){return!!Array.isArray(t.$refs["provider-"+r])&&t.$refs["provider-"+r][0]}))},formShouldShowErrors:function(){return this.context.formShouldShowErrors}},watch:{providers:function(){this.formShouldShowErrors&&this.showErrors()},formShouldShowErrors:function(t){t&&this.showErrors()}},created:function(){this.formulateRegisterRule(this.validateGroup.bind(this),[],"formulateGrouping",!0)},destroyed:function(){this.formulateRemoveRule("formulateGrouping")},methods:{setFieldValue:function(t,e,r){var o,i=Array.isArray(this.context.model)?this.context.model:[];i.splice(t,1,Object.assign({},"object"==typeof this.context.model[t]?this.context.model[t]:{},((o={})[e]=r,o))),this.context.model=i},validateGroup:function(){return Promise.all(this.providers.reduce((function(t,e){return e&&"function"==typeof e.hasValidationErrors&&t.push(e.hasValidationErrors()),t}),[])).then((function(t){return!t.some((function(t){return!!t}))}))},showErrors:function(){this.providers.map((function(t){return t&&"function"==typeof t.showErrors&&t.showErrors()}))},removeItem:function(t){Array.isArray(this.context.model)&&this.context.model.splice(t,1)}}},z=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("FormulateSlot",{staticClass:"formulate-input-grouping",attrs:{name:"grouping",context:t.context,"force-wrap":t.context.repeatable}},t._l(t.items,(function(e,o){return r("FormulateRepeatableProvider",{key:o,ref:"provider-"+o,refInFor:!0,attrs:{index:o,"set-field-value":function(e,r){return t.setFieldValue(o,e,r)},context:t.context},on:{remove:t.removeItem}},[t._t("default")],2)})),1)};z._withStripped=!0;var K=P({render:z,staticRenderFns:[]},void 0,Y,void 0,!1,void 0,!1,void 0,void 0,void 0),Z={props:{context:{type:Object,required:!0}}},J=function(){var t=this.$createElement;return(this._self._c||t)("label",{class:"formulate-input-label formulate-input-label--"+this.context.labelPosition,attrs:{for:this.context.id},domProps:{textContent:this._s(this.context.label)}})};J._withStripped=!0;var X=P({render:J,staticRenderFns:[]},void 0,Z,void 0,!1,void 0,!1,void 0,void 0,void 0),Q={props:{context:{type:Object,required:!0},addMore:{type:Function,required:!0}}},tt=function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"formulate-input-group-add-more"},[e("FormulateInput",{attrs:{type:"button",label:this.context.addLabel,"data-minor":"","data-ghost":""},on:{click:this.addMore}})],1)};tt._withStripped=!0;var et=P({render:tt,staticRenderFns:[]},void 0,Q,void 0,!1,void 0,!1,void 0,void 0,void 0),rt={props:{context:{type:Object,required:!0}},computed:{type:function(){return this.context.type},id:function(){return this.context.id},attributes:function(){return this.context.attributes||{}},hasValue:function(){return!!this.context.model}}},ot={name:"FormulateInputBox",mixins:[rt]},it=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type}},["radio"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"radio"},domProps:{value:t.context.value,checked:t._q(t.context.model,t.context.value)},on:{blur:t.context.blurHandler,change:function(e){return t.$set(t.context,"model",t.context.value)}}},"input",t.attributes,!1)):r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"checkbox"},domProps:{value:t.context.value,checked:Array.isArray(t.context.model)?t._i(t.context.model,t.context.value)>-1:t.context.model},on:{blur:t.context.blurHandler,change:function(e){var r=t.context.model,o=e.target,i=!!o.checked;if(Array.isArray(r)){var n=t.context.value,s=t._i(r,n);o.checked?s<0&&t.$set(t.context,"model",r.concat([n])):s>-1&&t.$set(t.context,"model",r.slice(0,s).concat(r.slice(s+1)))}else t.$set(t.context,"model",i)}}},"input",t.attributes,!1)),t._v(" "),r("label",{staticClass:"formulate-input-element-decorator",attrs:{for:t.id}})])};it._withStripped=!0;var nt=P({render:it,staticRenderFns:[]},void 0,ot,void 0,!1,void 0,!1,void 0,void 0,void 0),st={name:"FormulateInputText",mixins:[rt]},at=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type}},["checkbox"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"checkbox"},domProps:{checked:Array.isArray(t.context.model)?t._i(t.context.model,null)>-1:t.context.model},on:{blur:t.context.blurHandler,change:function(e){var r=t.context.model,o=e.target,i=!!o.checked;if(Array.isArray(r)){var n=t._i(r,null);o.checked?n<0&&t.$set(t.context,"model",r.concat([null])):n>-1&&t.$set(t.context,"model",r.slice(0,n).concat(r.slice(n+1)))}else t.$set(t.context,"model",i)}}},"input",t.attributes,!1)):"radio"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"radio"},domProps:{checked:t._q(t.context.model,null)},on:{blur:t.context.blurHandler,change:function(e){return t.$set(t.context,"model",null)}}},"input",t.attributes,!1)):r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:t.type},domProps:{value:t.context.model},on:{blur:t.context.blurHandler,input:function(e){e.target.composing||t.$set(t.context,"model",e.target.value)}}},"input",t.attributes,!1))])};at._withStripped=!0;var lt=P({render:at,staticRenderFns:[]},void 0,st,void 0,!1,void 0,!1,void 0,void 0,void 0),ut={name:"FormulateFiles",props:{files:{type:s,required:!0},imagePreview:{type:Boolean,default:!1}},computed:{fileUploads:function(){return this.files.files||[]}},watch:{files:function(){this.imagePreview&&this.files.loadPreviews()}},mounted:function(){this.imagePreview&&this.files.loadPreviews()}},ct=function(){var t=this,e=t.$createElement,r=t._self._c||e;return t.fileUploads.length?r("ul",{staticClass:"formulate-files"},t._l(t.fileUploads,(function(e){return r("li",{key:e.uuid,attrs:{"data-has-error":!!e.error,"data-has-preview":!(!t.imagePreview||!e.previewData)}},[r("div",{staticClass:"formulate-file"},[t.imagePreview&&e.previewData?r("div",{staticClass:"formulate-file-image-preview"},[r("img",{attrs:{src:e.previewData}})]):t._e(),t._v(" "),r("div",{staticClass:"formulate-file-name",attrs:{title:e.name},domProps:{textContent:t._s(e.name)}}),t._v(" "),!1!==e.progress?r("div",{staticClass:"formulate-file-progress",attrs:{"data-just-finished":e.justFinished,"data-is-finished":!e.justFinished&&e.complete}},[r("div",{staticClass:"formulate-file-progress-inner",style:{width:e.progress+"%"}})]):t._e(),t._v(" "),e.complete&&!e.justFinished||!1===e.progress?r("div",{staticClass:"formulate-file-remove",on:{click:e.removeFile}}):t._e()]),t._v(" "),e.error?r("div",{staticClass:"formulate-file-upload-error",domProps:{textContent:t._s(e.error)}}):t._e()])})),0):t._e()};ct._withStripped=!0;var dt={name:"FormulateInputFile",components:{FormulateFiles:P({render:ct,staticRenderFns:[]},void 0,ut,void 0,!1,void 0,!1,void 0,void 0,void 0)},mixins:[rt],data:function(){return{isOver:!1}},computed:{hasFiles:function(){return!!(this.context.model instanceof s&&this.context.model.files.length)}},created:function(){Array.isArray(this.context.model)&&"string"==typeof this.context.model[0][this.$formulate.getFileUrlKey()]&&(this.context.model=this.$formulate.createUpload({files:this.context.model},this.context))},mounted:function(){window&&this.context.preventWindowDrops&&(window.addEventListener("dragover",this.preventDefault),window.addEventListener("drop",this.preventDefault))},destroyed:function(){window&&this.context.preventWindowDrops&&(window.removeEventListener("dragover",this.preventDefault),window.removeEventListener("drop",this.preventDefault))},methods:{preventDefault:function(t){"INPUT"!==t.target.tagName&&"file"!==t.target.getAttribute("type")&&(t=t||event).preventDefault()},handleFile:function(){var t=this;this.isOver=!1;var e=this.$refs.file;e.files.length&&(this.context.model=this.$formulate.createUpload(e,this.context),this.$nextTick((function(){return t.attemptImmediateUpload()})))},attemptImmediateUpload:function(){var t=this;"live"===this.context.uploadBehavior&&this.context.model instanceof s&&this.context.hasValidationErrors().then((function(e){e||t.context.model.upload()}))},handleDragOver:function(t){t.preventDefault(),this.isOver=!0},handleDragLeave:function(t){t.preventDefault(),this.isOver=!1}}},pt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type,"data-has-files":t.hasFiles}},[r("div",{staticClass:"formulate-input-upload-area",attrs:{"data-has-files":t.hasFiles}},[r("input",t._b({ref:"file",attrs:{"data-is-drag-hover":t.isOver,type:"file"},on:{blur:t.context.blurHandler,change:t.handleFile,dragover:t.handleDragOver,dragleave:t.handleDragLeave}},"input",t.attributes,!1)),t._v(" "),r("div",{directives:[{name:"show",rawName:"v-show",value:!t.hasFiles,expression:"!hasFiles"}],staticClass:"formulate-input-upload-area-mask"}),t._v(" "),t.hasFiles?r("FormulateFiles",{attrs:{files:t.context.model,"image-preview":"image"===t.context.type&&"preview"===t.context.imageBehavior}}):t._e()],1)])};pt._withStripped=!0;var ht=P({render:pt,staticRenderFns:[]},void 0,dt,void 0,!1,void 0,!1,void 0,void 0,void 0),ft={props:{context:{type:Object,required:!0},removeItem:{type:Function,required:!0},index:{type:Number,required:!0}}},mt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"formulate-input-group-repeatable"},[t.context.repeatable?r("a",{staticClass:"formulate-input-group-repeatable-remove",attrs:{role:"button"},on:{click:function(e){return e.preventDefault(),t.removeItem(e)},keypress:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.removeItem(e)}}}):t._e(),t._v(" "),t._t("default")],2)};mt._withStripped=!0;var vt=P({render:mt,staticRenderFns:[]},void 0,ft,void 0,!1,void 0,!1,void 0,void 0,void 0);function yt(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&-1===e.indexOf(o)&&(r[o]=t[o]);return r}var gt={name:"FormulateInputGroup",props:{context:{type:Object,required:!0}},computed:{options:function(){return this.context.options||[]},subType:function(){return"group"===this.context.type?"grouping":"inputs"},optionsWithContext:function(){var t=this,e=this.context,r=e.attributes,o=(r.id,yt(r,["id"])),i=(e.blurHandler,e.classification,e.component,e.getValidationErrors,e.hasLabel,e.hasValidationErrors,e.isSubField,e.labelPosition,e.options,e.performValidation,e.setErrors,e.slotComponents,e.validationErrors,e.visibleValidationErrors,yt(e,["attributes","blurHandler","classification","component","getValidationErrors","hasLabel","hasValidationErrors","isSubField","labelPosition","options","performValidation","setErrors","slotComponents","validationErrors","visibleValidationErrors"]));return this.options.map((function(e){return t.groupItemContext(i,e,o)}))},canAddMore:function(){return this.context.repeatable&&this.items.length-1:t.context.model},on:{blur:t.context.blurHandler,change:function(e){var r=t.context.model,o=e.target,i=!!o.checked;if(Array.isArray(r)){var n=t._i(r,null);o.checked?n<0&&t.$set(t.context,"model",r.concat([null])):n>-1&&t.$set(t.context,"model",r.slice(0,n).concat(r.slice(n+1)))}else t.$set(t.context,"model",i)}}},"input",t.attributes,!1)):"radio"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"radio"},domProps:{checked:t._q(t.context.model,null)},on:{blur:t.context.blurHandler,change:function(e){return t.$set(t.context,"model",null)}}},"input",t.attributes,!1)):r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:t.type},domProps:{value:t.context.model},on:{blur:t.context.blurHandler,input:function(e){e.target.composing||t.$set(t.context,"model",e.target.value)}}},"input",t.attributes,!1)),t._v(" "),t.context.showValue?r("div",{staticClass:"formulate-input-element-range-value",domProps:{textContent:t._s(t.context.model)}}):t._e()])};Pt._withStripped=!0;var St=P({render:Pt,staticRenderFns:[]},void 0,At,void 0,!1,void 0,!1,void 0,void 0,void 0),$t={name:"FormulateInputTextArea",mixins:[rt]},jt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"formulate-input-element formulate-input-element--textarea",attrs:{"data-type":"textarea"}},[r("textarea",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],domProps:{value:t.context.model},on:{blur:t.context.blurHandler,input:function(e){e.target.composing||t.$set(t.context,"model",e.target.value)}}},"textarea",t.attributes,!1))])};jt._withStripped=!0;var Ct=P({render:jt,staticRenderFns:[]},void 0,$t,void 0,!1,void 0,!1,void 0,void 0,void 0),Rt={provide:function(){var t=this;return Object.assign({},O(this),{formulateSetter:function(e,r){return t.setFieldValue(e,r)}})},props:{index:{type:Number,required:!0},context:{type:Object,required:!0},setFieldValue:{type:Function,required:!0}},data:function(){return Object.assign({},_(this),{isGrouping:!0})},computed:Object.assign({},F()),methods:Object.assign({},V(["setFieldValue"]),{removeItem:function(){this.$emit("remove",this.index)}})},kt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("FormulateSlot",{attrs:{name:"repeatable",context:t.context,index:t.index,"remove-item":t.removeItem}},[r(t.context.slotComponents.repeatable,{tag:"component",attrs:{context:t.context,index:t.index,"remove-item":t.removeItem}},[r("FormulateSlot",{attrs:{context:t.context,index:t.index,name:"default"}})],1)],1)};kt._withStripped=!0;var Nt=P({render:kt,staticRenderFns:[]},void 0,Rt,void 0,!1,void 0,!1,void 0,void 0,void 0),It=function(){this.options={},this.defaults={components:{FormulateSlot:x,FormulateForm:j,FormulateHelp:W,FormulateLabel:X,FormulateInput:B,FormulateErrors:H,FormulateAddMore:et,FormulateGrouping:K,FormulateInputBox:nt,FormulateInputText:lt,FormulateInputFile:ht,FormulateRepeatable:vt,FormulateInputGroup:xt,FormulateInputButton:_t,FormulateInputSelect:Ot,FormulateInputSlider:St,FormulateInputTextArea:Ct,FormulateRepeatableProvider:Nt},slotComponents:{label:"FormulateLabel",help:"FormulateHelp",errors:"FormulateErrors",repeatable:"FormulateRepeatable",addMore:"FormulateAddMore"},library:n,rules:m,mimes:y,locale:!1,uploader:g,uploadUrl:!1,fileUrlKey:"url",uploadJustCompleteDuration:1e3,errorHandler:function(t){return t},plugins:[o],locales:{},idPrefix:"formulate-"},this.registry=new Map,this.idRegistry={}};It.prototype.install=function(t,e){var r=this;t.prototype.$formulate=this,this.options=this.defaults;var o=this.defaults.plugins;for(var i in e&&Array.isArray(e.plugins)&&e.plugins.length&&(o=o.concat(e.plugins)),o.forEach((function(t){return"function"==typeof t?t(r):null})),this.extend(e||{}),this.options.components)t.component(i,this.options.components[i])},It.prototype.nextId=function(t){var e=!(!t.$route||!t.$route.path)&&t.$route.path?t.$route.path.replace(/[/\\.\s]/g,"-"):"global";return Object.prototype.hasOwnProperty.call(this.idRegistry,e)||(this.idRegistry[e]=0),""+this.options.idPrefix+e+"-"+ ++this.idRegistry[e]},It.prototype.extend=function(t){if("object"==typeof t)return this.options=this.merge(this.options,t),this;throw new Error("VueFormulate extend() should be passed an object (was "+typeof t+")")},It.prototype.merge=function(t,e,o){void 0===o&&(o=!0);var i={};for(var n in t)e.hasOwnProperty(n)?r(e[n])&&r(t[n])?i[n]=this.merge(t[n],e[n],o):o&&Array.isArray(t[n])&&Array.isArray(e[n])?i[n]=t[n].concat(e[n]):i[n]=e[n]:i[n]=t[n];for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i},It.prototype.classify=function(t){return this.options.library.hasOwnProperty(t)?this.options.library[t].classification:"unknown"},It.prototype.component=function(t){return!!this.options.library.hasOwnProperty(t)&&this.options.library[t].component},It.prototype.slotComponent=function(t,e){var r=this.options.library[t];return r&&r.slotComponents&&r.slotComponents[e]?r.slotComponents[e]:this.options.slotComponents[e]},It.prototype.rules=function(t){return void 0===t&&(t={}),Object.assign({},this.options.rules,t)},It.prototype.i18n=function(t){if(t.$i18n)switch(typeof t.$i18n.locale){case"string":return t.$i18n.locale;case"function":return t.$i18n.locale()}return!1},It.prototype.getLocale=function(t){var e=this;return this.selectedLocale||(this.selectedLocale=[this.options.locale,this.i18n(t),"en"].reduce((function(t,r){if(t)return t;if(r){var o=function(t){return t.split("-").reduce((function(t,e){return t.length&&t.unshift(t[0]+"-"+e),t.length?t:[e]}),[])}(r).find((function(t){return f(e.options.locales,t)}));o&&(t=o)}return t}),!1)),this.selectedLocale},It.prototype.validationMessage=function(t,e,r){var o=this.options.locales[this.getLocale(r)];return o.hasOwnProperty(t)?o[t](e):"_"===t[0]&&o.hasOwnProperty(t.substr(1))?o[t.substr(1)](e):o.hasOwnProperty("default")?o.default(e):"This field does not have a valid value"},It.prototype.register=function(t){"FormulateForm"===t.$options.name&&t.name&&this.registry.set(t.name,t)},It.prototype.deregister=function(t){"FormulateForm"===t.$options.name&&t.name&&this.registry.has(t.name)&&this.registry.delete(t.name)},It.prototype.handle=function(t,e,r){void 0===r&&(r=!1);var o=r?t:this.options.errorHandler(t,e);return e&&this.registry.has(e)&&this.registry.get(e).applyErrors({formErrors:c(o.formErrors),inputErrors:o.inputErrors||{}}),o},It.prototype.reset=function(t,e){void 0===e&&(e={}),this.resetValidation(t),this.setValues(t,e)},It.prototype.resetValidation=function(t){var e=this.registry.get(t);e.hideErrors(t),e.namedErrors=[],e.namedFieldErrors={}},It.prototype.setValues=function(t,e){e&&!Array.isArray(e)&&"object"==typeof e&&this.registry.get(t).setValues(Object.assign({},e))},It.prototype.getUploader=function(){return this.options.uploader||!1},It.prototype.getUploadUrl=function(){return this.options.uploadUrl||!1},It.prototype.getFileUrlKey=function(){return this.options.fileUrlKey||"url"},It.prototype.createUpload=function(t,e){return new s(t,e,this.options)};var Dt=new It;export default Dt; diff --git a/dist/formulate.min.js b/dist/formulate.min.js index bda9419..81f4676 100644 --- a/dist/formulate.min.js +++ b/dist/formulate.min.js @@ -1,15 +1,15 @@ -var VueFormulate=function(){"use strict";var t=function(t,e){return{classification:t,component:"FormulateInput"+(e||t[0].toUpperCase()+t.substr(1))}},e=Object.assign({},["text","email","number","color","date","hidden","month","password","search","tel","time","url","week","datetime-local"].reduce((function(e,r){var o;return Object.assign({},e,((o={})[r]=t("text"),o))}),{}),{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")}),r=function(t){if("string"!=typeof t)return!1;var e=t.match(o);if(!e)return!1;var r=e[1];if(!r)return!1;if(i.test(r)||n.test(r))return!0;return!1},o=/^(?:\w+:)?\/\/(\S+)$/,i=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,n=/^[^\s\.]+\.\S{2,}$/;for(var a="-_",s=36;s--;)a+=s.toString(36);for(s=36;s---10;)a+=s.toString(36).toUpperCase();var l=function(t){var e="";for(s=t||21;s--;)e+=a[64*Math.random()|0];return e},u=function(t,e,r){void 0===r&&(r={}),this.input=t,this.fileList=t.files,this.files=[],this.options=Object.assign({},{mimes:{}},r),this.results=!1,this.context=e,Array.isArray(this.fileList)?this.rehydrateFileList(this.fileList):this.addFileList(this.fileList)};function c(t,e){var r={};for(var o in t)r[o]=e(o,t[o]);return r}function d(t,e){if(t===e)return!0;if(!t||!e)return!1;var r=Object.keys(t),o=Object.keys(e),i=r.length;if(o.length!==i)return!1;for(var n=0;n=100&&(e.complete||(e.justFinished=!0,setTimeout((function(){e.justFinished=!1}),t.options.uploadJustCompleteDuration)),e.complete=!0)}),(function(t){e.progress=0,e.error=t,e.complete=!0}),t.options)}))).then((function(r){t.results=r,e(r)})).catch((function(t){throw new Error(t)}))}))},u.prototype.removeFile=function(t){if(this.files=this.files.filter((function(e){return e.uuid!==t})),this.context.performValidation(),window&&this.fileList instanceof FileList){var e=new DataTransfer;this.files.map((function(t){return e.items.add(t.file)})),this.fileList=e.files,this.input.files=this.fileList}},u.prototype.loadPreviews=function(){this.files.map((function(t){if(!t.previewData&&window&&window.FileReader&&/^image\//.test(t.file.type)){var e=new FileReader;e.onload=function(e){return Object.assign(t,{previewData:e.target.result})},e.readAsDataURL(t.file)}}))},u.prototype.getFileList=function(){return this.fileList},u.prototype.getFiles=function(){return this.files},u.prototype.toString=function(){var t=this.files.length?this.files.length+" files":"empty";return this.results?JSON.stringify(this.results,null," "):"FileUpload("+t+")"};var v={accepted:function(t){var e=t.value;return Promise.resolve(["yes","on","1",1,!0,"true"].includes(e))},after:function(t,e){var r=t.value;void 0===e&&(e=!1);var o=Date.parse(e||new Date),i=Date.parse(r);return Promise.resolve(!isNaN(i)&&i>o)},alpha:function(t,e){var r=t.value;void 0===e&&(e="default");var o={default:/^[a-zA-ZÀ-ÖØ-öø-ÿ]+$/,latin:/^[a-zA-Z]+$/},i=o.hasOwnProperty(e)?e:"default";return Promise.resolve(o[i].test(r))},alphanumeric:function(t,e){var r=t.value;void 0===e&&(e="default");var o={default:/^[a-zA-Z0-9À-ÖØ-öø-ÿ]+$/,latin:/^[a-zA-Z0-9]+$/},i=o.hasOwnProperty(e)?e:"default";return Promise.resolve(o[i].test(r))},before:function(t,e){var r=t.value;void 0===e&&(e=!1);var o=Date.parse(e||new Date),i=Date.parse(r);return Promise.resolve(!isNaN(i)&&ie&&ie&&i.length()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test(e))},endsWith:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve("string"==typeof e&&r.length?void 0!==r.find((function(t){return e.endsWith(t)})):"string"==typeof e&&0===r.length)},in:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(void 0!==r.find((function(t){return"object"==typeof t?d(t,e):t===e})))},matches:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(!!r.find((function(t){return t instanceof RegExp?t.test(e):t===e})))},mime:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(function(){if(e instanceof u)for(var t=e.getFiles(),o=0;o=e):!isNaN(o)&&"length"!==r||"value"===r?(o=isNaN(o)?o:Number(o))>=e:("string"==typeof o||"length"===r)&&(o=isNaN(o)?o:o.toString()).length>=e)},max:function(t,e,r){var o=t.value;return void 0===e&&(e=10),Promise.resolve(Array.isArray(o)?(e=isNaN(e)?e:Number(e),o.length<=e):!isNaN(o)&&"length"!==r||"value"===r?(o=isNaN(o)?o:Number(o))<=e:("string"==typeof o||"length"===r)&&(o=isNaN(o)?o:o.toString()).length<=e)},not:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(void 0===r.find((function(t){return"object"==typeof t?d(t,e):t===e})))},number:function(t){var e=t.value;return Promise.resolve(!isNaN(e))},required:function(t,e){var r=t.value;return void 0===e&&(e=!0),Promise.resolve(!(e&&!["no","false"].includes(e))||(Array.isArray(r)?!!r.length:r instanceof u?r.getFiles().length>0:"string"==typeof r?!!r:"object"!=typeof r||!!r&&!!Object.keys(r).length))},startsWith:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve("string"==typeof e&&r.length?void 0!==r.find((function(t){return e.startsWith(t)})):"string"==typeof e&&0===r.length)},url:function(t){var e=t.value;return Promise.resolve(r(e))}},y="image/",b={csv:"text/csv",gif:y+"gif",jpg:y+"jpeg",jpeg:y+"jpeg",png:y+"png",pdf:"application/pdf",svg:y+"svg+xml"}; +var VueFormulate=function(){"use strict";var t=function(t,e){return{classification:t,component:"FormulateInput"+(e||t[0].toUpperCase()+t.substr(1))}},e=Object.assign({},["text","email","number","color","date","hidden","month","password","search","tel","time","url","week","datetime-local"].reduce((function(e,r){var o;return Object.assign({},e,((o={})[r]=t("text"),o))}),{}),{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")}),r=function(t){if("string"!=typeof t)return!1;var e=t.match(o);if(!e)return!1;var r=e[1];if(!r)return!1;if(i.test(r)||n.test(r))return!0;return!1},o=/^(?:\w+:)?\/\/(\S+)$/,i=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,n=/^[^\s\.]+\.\S{2,}$/;for(var s="-_",a=36;a--;)s+=a.toString(36);for(a=36;a---10;)s+=a.toString(36).toUpperCase();var l=function(t){var e="";for(a=t||21;a--;)e+=s[64*Math.random()|0];return e},u=function(t,e,r){void 0===r&&(r={}),this.input=t,this.fileList=t.files,this.files=[],this.options=Object.assign({},{mimes:{}},r),this.results=!1,this.context=e,Array.isArray(this.fileList)?this.rehydrateFileList(this.fileList):this.addFileList(this.fileList)};function c(t,e){var r={};for(var o in t)r[o]=e(o,t[o]);return r}function d(t,e){if(t===e)return!0;if(!t||!e)return!1;var r=Object.keys(t),o=Object.keys(e),i=r.length;if(o.length!==i)return!1;for(var n=0;n=100&&(e.complete||(e.justFinished=!0,setTimeout((function(){e.justFinished=!1}),t.options.uploadJustCompleteDuration)),e.complete=!0)}),(function(t){e.progress=0,e.error=t,e.complete=!0}),t.options)}))).then((function(r){t.results=r,e(r)})).catch((function(t){throw new Error(t)}))}))},u.prototype.removeFile=function(t){if(this.files=this.files.filter((function(e){return e.uuid!==t})),this.context.performValidation(),window&&this.fileList instanceof FileList){var e=new DataTransfer;this.files.map((function(t){return e.items.add(t.file)})),this.fileList=e.files,this.input.files=this.fileList}},u.prototype.loadPreviews=function(){this.files.map((function(t){if(!t.previewData&&window&&window.FileReader&&/^image\//.test(t.file.type)){var e=new FileReader;e.onload=function(e){return Object.assign(t,{previewData:e.target.result})},e.readAsDataURL(t.file)}}))},u.prototype.getFileList=function(){return this.fileList},u.prototype.getFiles=function(){return this.files},u.prototype.toString=function(){var t=this.files.length?this.files.length+" files":"empty";return this.results?JSON.stringify(this.results,null," "):"FileUpload("+t+")"};var g={accepted:function(t){var e=t.value;return Promise.resolve(["yes","on","1",1,!0,"true"].includes(e))},after:function(t,e){var r=t.value;void 0===e&&(e=!1);var o=Date.parse(e||new Date),i=Date.parse(r);return Promise.resolve(!isNaN(i)&&i>o)},alpha:function(t,e){var r=t.value;void 0===e&&(e="default");var o={default:/^[a-zA-ZÀ-ÖØ-öø-ÿ]+$/,latin:/^[a-zA-Z]+$/},i=o.hasOwnProperty(e)?e:"default";return Promise.resolve(o[i].test(r))},alphanumeric:function(t,e){var r=t.value;void 0===e&&(e="default");var o={default:/^[a-zA-Z0-9À-ÖØ-öø-ÿ]+$/,latin:/^[a-zA-Z0-9]+$/},i=o.hasOwnProperty(e)?e:"default";return Promise.resolve(o[i].test(r))},before:function(t,e){var r=t.value;void 0===e&&(e=!1);var o=Date.parse(e||new Date),i=Date.parse(r);return Promise.resolve(!isNaN(i)&&ie&&ie&&i.length()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test(e))},endsWith:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve("string"==typeof e&&r.length?void 0!==r.find((function(t){return e.endsWith(t)})):"string"==typeof e&&0===r.length)},in:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(void 0!==r.find((function(t){return"object"==typeof t?d(t,e):t===e})))},matches:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(!!r.find((function(t){return"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===e})))},mime:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(function(){if(e instanceof u)for(var t=e.getFiles(),o=0;o=e):!isNaN(o)&&"length"!==r||"value"===r?(o=isNaN(o)?o:Number(o))>=e:("string"==typeof o||"length"===r)&&(o=isNaN(o)?o:o.toString()).length>=e)},max:function(t,e,r){var o=t.value;return void 0===e&&(e=10),Promise.resolve(Array.isArray(o)?(e=isNaN(e)?e:Number(e),o.length<=e):!isNaN(o)&&"length"!==r||"value"===r?(o=isNaN(o)?o:Number(o))<=e:("string"==typeof o||"length"===r)&&(o=isNaN(o)?o:o.toString()).length<=e)},not:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(void 0===r.find((function(t){return"object"==typeof t?d(t,e):t===e})))},number:function(t){var e=t.value;return Promise.resolve(!isNaN(e))},required:function(t,e){var r=t.value;return void 0===e&&(e=!0),Promise.resolve(!(e&&!["no","false"].includes(e))||(Array.isArray(r)?!!r.length:r instanceof u?r.getFiles().length>0:"string"==typeof r?!!r:"object"!=typeof r||!!r&&!!Object.keys(r).length))},startsWith:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve("string"==typeof e&&r.length?void 0!==r.find((function(t){return e.startsWith(t)})):"string"==typeof e&&0===r.length)},url:function(t){var e=t.value;return Promise.resolve(r(e))},bail:function(){return Promise.resolve(!0)}},b="image/",x={csv:"text/csv",gif:b+"gif",jpg:b+"jpeg",jpeg:b+"jpeg",png:b+"png",pdf:"application/pdf",svg:b+"svg+xml"}; /*! * is-plain-object * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */ -function g(t){return!0==(null!=(e=t)&&"object"==typeof e&&!1===Array.isArray(e))&&"[object Object]"===Object.prototype.toString.call(t); +function E(t){return!0==(null!=(e=t)&&"object"==typeof e&&!1===Array.isArray(e))&&"[object Object]"===Object.prototype.toString.call(t); /*! * isobject * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */ -var e}function x(t){var e,r;return!1!==g(t)&&("function"==typeof(e=t.constructor)&&(!1!==g(r=e.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf")))}function E(t){return"string"==typeof t?t[0].toUpperCase()+t.substr(1):t}var w={accepted:function(t){return"Please accept the "+t.name+"."},after:function(t){var e=t.name,r=t.args;return Array.isArray(r)&&r.length?E(e)+" must be after "+r[0]+".":E(e)+" must be a later date."},alpha:function(t){return E(t.name)+" can only contain alphabetical characters."},alphanumeric:function(t){return E(t.name)+" can only contain letters and numbers."},before:function(t){var e=t.name,r=t.args;return Array.isArray(r)&&r.length?E(e)+" must be before "+r[0]+".":E(e)+" must be an earlier date."},between:function(t){var e=t.name,r=t.value,o=t.args,i=!(!Array.isArray(o)||!o[2])&&o[2];return!isNaN(r)&&"length"!==i||"value"===i?E(e)+" must be between "+o[0]+" and "+o[1]+".":E(e)+" must be between "+o[0]+" and "+o[1]+" characters long."},confirm:function(t){var e=t.name;return t.args,E(e)+" does not match."},date:function(t){var e=t.name,r=t.args;return Array.isArray(r)&&r.length?E(e)+" is not a valid, please use the format "+r[0]:E(e)+" is not a valid date."},default:function(t){return t.name,"This field isn’t valid."},email:function(t){t.name;var e=t.value;return e?"“"+e+"” is not a valid email address.":"Please enter a valid email address."},endsWith:function(t){t.name;var e=t.value;return e?"“"+e+"” doesn’t end with a valid value.":"This field doesn’t end with a valid value."},in:function(t){var e=t.name,r=t.value;return"string"==typeof r&&r?"“"+E(r)+"” is not an allowed "+e+".":"This is not an allowed "+e+"."},matches:function(t){return E(t.name)+" is not an allowed value."},max:function(t){var e=t.name,r=t.value,o=t.args;if(Array.isArray(r))return"You may only select "+o[0]+" "+e+".";var i=!(!Array.isArray(o)||!o[1])&&o[1];return!isNaN(r)&&"length"!==i||"value"===i?E(e)+" must be less than or equal to "+o[0]+".":E(e)+" must be less than or equal to "+o[0]+" characters long."},mime:function(t){var e=t.name,r=t.args;return E(e)+" must be of the the type: "+(r[0]||"No file formats allowed.")},min:function(t){var e=t.name,r=t.value,o=t.args;if(Array.isArray(r))return"You must select at least "+o[0]+" "+e+".";var i=!(!Array.isArray(o)||!o[1])&&o[1];return!isNaN(r)&&"length"!==i||"value"===i?E(e)+" must be more than "+o[0]+".":E(e)+" must be more than "+o[0]+" characters long."},not:function(t){var e=t.name;return"“"+t.value+"” is not an allowed "+e+"."},number:function(t){return E(t.name)+" must be a number."},required:function(t){return E(t.name)+" is required."},startsWith:function(t){t.name;var e=t.value;return e?"“"+e+"” doesn’t start with a valid value.":"This field doesn’t start with a valid value."},url:function(t){return t.name,"Please include a valid url."}};function F(t){var e;t.extend({locales:(e={},e.en=w,e)})}function _(t,e,r,o){return new Promise((function(r,i){var n=(o.fauxUploaderDuration||2e3)*(.5+Math.random()),a=performance.now(),s=function(){return setTimeout((function(){var o=performance.now()-a,i=Math.min(100,Math.round(o/n*100));if(e(i),i>=100)return r({url:"http://via.placeholder.com/350x150.png",name:t.name});s()}),20)};s()}))}var P={context:function(){return A.call(this,Object.assign({},{type:this.type,value:this.value,name:this.nameOrFallback,classification:this.classification,component:this.component,id:this.id||this.defaultId,hasLabel:this.label&&"button"!==this.classification,label:this.label,labelPosition:this.logicalLabelPosition,attributes:this.elementAttributes,performValidation:this.performValidation.bind(this),blurHandler:O.bind(this),imageBehavior:this.imageBehavior,uploadUrl:this.mergedUploadUrl,uploader:this.uploader||this.$formulate.getUploader(),uploadBehavior:this.uploadBehavior,preventWindowDrops:this.preventWindowDrops,hasValidationErrors:this.hasValidationErrors,getValidationErrors:this.getValidationErrors.bind(this),validationErrors:this.validationErrors,errors:this.explicitErrors,setErrors:this.setErrors.bind(this),showValidationErrors:this.showValidationErrors,visibleValidationErrors:this.visibleValidationErrors},this.typeContext))},nameOrFallback:function(){if(!0===this.name&&"button"!==this.classification)return this.type+"_"+this.elementAttributes.id;if(!1===this.name||"button"===this.classification&&!0===this.name)return!1;return this.name},typeContext:function(){var t=this;switch(this.classification){case"select":return{options:V.call(this,this.options),optionGroups:!!this.optionGroups&&c(this.optionGroups,(function(e,r){return V.call(t,r)})),placeholder:this.$attrs.placeholder||!1};case"slider":return{showValue:!!this.showValue};default:return this.options?{options:V.call(this,this.options)}:{}}},elementAttributes:function(){var t=Object.assign({},this.localAttributes);this.id?t.id=this.id:t.id=this.defaultId;return t},logicalLabelPosition:function(){if(this.labelPosition)return this.labelPosition;switch(this.classification){case"box":return"after";default:return"before"}},mergedUploadUrl:function(){return this.uploadUrl||this.$formulate.getUploadUrl()},isVmodeled:function(){return!!(this.$options.propsData.hasOwnProperty("formulateValue")&&this._events&&Array.isArray(this._events.input)&&this._events.input.length)},mergedValidationName:function(){if(this.validationName)return this.validationName;if("string"==typeof this.name)return this.name;if(this.label)return this.label;return this.type},explicitErrors:function(){return p(this.errors).concat(this.localErrors).concat(p(this.error))},allErrors:function(){return this.explicitErrors.concat(p(this.validationErrors))},hasErrors:function(){return!!this.allErrors.length},hasVisibleErrors:function(){return this.validationErrors&&this.showValidationErrors||!!this.explicitErrors.length},showValidationErrors:function(){if(this.showErrors||this.formShouldShowErrors)return!0;if("file"===this.classification&&"live"===this.uploadBehavior&&$.call(this))return!0;return this.behavioralErrorVisibility},visibleValidationErrors:function(){return this.showValidationErrors&&this.validationErrors.length?this.validationErrors:[]}};function V(t){if(!Array.isArray(t)&&t&&"object"==typeof t){var e=[];for(var r in t)e.push({value:r,label:t[r],id:this.elementAttributes.id+"_"+r});return e}return Array.isArray(t)&&!t.length?[{value:this.value,label:this.label||this.name,id:this.context.id||l(9)}]:t}function O(){this.$emit("blur"),"blur"===this.errorBehavior&&(this.behavioralErrorVisibility=!0)}function A(t){return Object.defineProperty(t,"model",{get:$.bind(this),set:j.bind(this)})}function $(){var t=this.isVmodeled?"formulateValue":"internalModelProxy";return"checkbox"===this.type&&!Array.isArray(this[t])&&this.options?[]:this[t]?this[t]:""}function j(t){d(t,this.internalModelProxy)||(this.internalModelProxy=t),this.$emit("input",t),this.context.name&&"function"==typeof this.formulateFormSetter&&this.formulateFormSetter(this.context.name,t)}function N(t,e,r,o,i,n,a,s,l,u){"boolean"!=typeof a&&(l=s,s=a,a=!1);var c,d="function"==typeof r?r.options:r;if(t&&t.render&&(d.render=t.render,d.staticRenderFns=t.staticRenderFns,d._compiled=!0,i&&(d.functional=!0)),o&&(d._scopeId=o),n?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,l(t)),t&&t._registeredComponents&&t._registeredComponents.add(n)},d._ssrRegister=c):e&&(c=a?function(t){e.call(this,u(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,s(t))}),c)if(d.functional){var f=d.render;d.render=function(t,e){return c.call(e),f(t,e)}}else{var p=d.beforeCreate;d.beforeCreate=p?[].concat(p,c):[c]}return r}var S={name:"FormulateInput",inheritAttrs:!1,inject:{formulateFormSetter:{default:void 0},formulateFieldValidation:{default:function(){return function(){return{}}}},formulateFormRegister:{default:void 0},getFormValues:{default:function(){return function(){return{}}}},observeErrors:{default:void 0},removeErrorObserver:{default:void 0}},model:{prop:"formulateValue",event:"input"},props:{type:{type:String,default:"text"},name:{type:[String,Boolean],default:!0},formulateValue:{default:""},value:{default:!1},options:{type:[Object,Array,Boolean],default:!1},optionGroups:{type:[Object,Boolean],default:!1},id:{type:[String,Boolean,Number],default:!1},label:{type:[String,Boolean],default:!1},labelPosition:{type:[String,Boolean],default:!1},help:{type:[String,Boolean],default:!1},debug:{type:Boolean,default:!1},errors:{type:[String,Array,Boolean],default:!1},validation:{type:[String,Boolean,Array],default:!1},validationName:{type:[String,Boolean],default:!1},error:{type:[String,Boolean],default:!1},errorBehavior:{type:String,default:"blur",validator:function(t){return["blur","live"].includes(t)}},showErrors:{type:Boolean,default:!1},imageBehavior:{type:String,default:"preview"},uploadUrl:{type:[String,Boolean],default:!1},uploader:{type:[Function,Object,Boolean],default:!1},uploadBehavior:{type:String,default:"live"},preventWindowDrops:{type:Boolean,default:!0},showValue:{type:[String,Boolean],default:!1},validationMessages:{type:Object,default:function(){return{}}},validationRules:{type:Object,default:function(){return{}}},checked:{type:[String,Boolean],default:!1},disableErrors:{type:Boolean,default:!1}},data:function(){return{defaultId:l(9),localAttributes:{},localErrors:[],internalModelProxy:this.getInitialValue(),behavioralErrorVisibility:"live"===this.errorBehavior,formShouldShowErrors:!1,validationErrors:[],pendingValidation:Promise.resolve()}},computed:Object.assign({},P,{classification:function(){var t=this.$formulate.classify(this.type);return"box"===t&&this.options?"group":t},component:function(){return"group"===this.classification?"FormulateInputGroup":this.$formulate.component(this.type)},parsedValidationRules:function(){var t=this,e={};return Object.keys(this.validationRules).forEach((function(r){e[f(r)]=t.validationRules[r]})),e},messages:function(){var t=this,e={};return Object.keys(this.validationMessages).forEach((function(r){e[f(r)]=t.validationMessages[r]})),e}}),watch:{$attrs:{handler:function(t){this.updateLocalAttributes(t)},deep:!0},internalModelProxy:function(t,e){this.performValidation(),this.isVmodeled||d(t,e)||(this.context.model=t)},formulateValue:function(t,e){this.isVmodeled&&!d(t,e)&&(this.context.model=t)},showValidationErrors:{handler:function(t){this.$emit("error-visibility",t)},immediate:!0}},created:function(){this.applyInitialValue(),this.formulateFormRegister&&"function"==typeof this.formulateFormRegister&&this.formulateFormRegister(this.nameOrFallback,this),this.disableErrors||"function"!=typeof this.observeErrors||this.observeErrors({callback:this.setErrors,type:"input",field:this.nameOrFallback}),this.updateLocalAttributes(this.$attrs),this.performValidation()},destroyed:function(){this.disableErrors||"function"!=typeof this.removeErrorObserver||this.removeErrorObserver(this.setErrors)},methods:{getInitialValue:function(){var t=this.$formulate.classify(this.type);return"box"===(t="box"===t&&this.options?"group":t)&&this.checked?this.value||!0:Object.prototype.hasOwnProperty.call(this.$options.propsData,"value")&&"box"!==t?this.value:Object.prototype.hasOwnProperty.call(this.$options.propsData,"formulateValue")?this.formulateValue:""},applyInitialValue:function(){!d(this.context.model,this.internalModelProxy)&&Object.prototype.hasOwnProperty(this.$options.propsData,"options")&&"box"===this.classification&&(this.context.model=this.internalModelProxy)},updateLocalAttributes:function(t){d(t,this.localAttributes)||(this.localAttributes=t)},performValidation:function(){var t=this,e=h(this.validation,this.$formulate.rules(this.parsedValidationRules));return this.pendingValidation=Promise.all(e.map((function(e){var r=e[0],o=e[1],i=e[2],n=r.apply(void 0,[{value:t.context.model,getFormValues:t.getFormValues.bind(t),name:t.context.name}].concat(o));return(n=n instanceof Promise?n:Promise.resolve(n)).then((function(e){return!e&&t.getMessage(i,o)}))}))).then((function(t){return t.filter((function(t){return t}))})).then((function(e){return t.didValidate(e)})),this.pendingValidation},didValidate:function(t){var e=!d(t,this.validationErrors);if(this.validationErrors=t,e){var r=this.getErrorObject();this.$emit("validation",r),this.formulateFieldValidation&&"function"==typeof this.formulateFieldValidation&&this.formulateFieldValidation(r)}},getMessage:function(t,e){return this.getMessageFunc(t)({args:e,name:this.mergedValidationName,value:this.context.model,vm:this,formValues:this.getFormValues()})},getMessageFunc:function(t){var e=this;if(t=f(t),this.messages&&void 0!==this.messages[t])switch(typeof this.messages[t]){case"function":return this.messages[t];case"string":return function(){return e.messages[t]}}return function(r){return e.$formulate.validationMessage(t,r,e)}},hasValidationErrors:function(){var t=this;return new Promise((function(e){t.$nextTick((function(){t.pendingValidation.then((function(){return e(!!t.validationErrors.length)}))}))}))},getValidationErrors:function(){var t=this;return new Promise((function(e){t.$nextTick((function(){t.pendingValidation.then((function(){return e(t.getErrorObject())}))}))}))},getErrorObject:function(){return{name:this.context.nameOrFallback||this.context.name,errors:this.validationErrors,hasErrors:!!this.validationErrors.length}},setErrors:function(t){this.localErrors=p(t)}}},C=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"formulate-input",attrs:{"data-classification":t.classification,"data-has-errors":t.hasErrors,"data-is-showing-errors":t.hasVisibleErrors,"data-type":t.type}},[r("div",{staticClass:"formulate-input-wrapper"},[t.context.hasLabel&&"before"===t.context.labelPosition?t._t("label",[r("label",{staticClass:"formulate-input-label formulate-input-label--before",attrs:{for:t.context.attributes.id},domProps:{textContent:t._s(t.context.label)}})],null,t.context):t._e(),t._v(" "),t._t("element",[r(t.context.component,{tag:"component",attrs:{context:t.context}},[t._t("default",null,null,t.context)],2)],null,t.context),t._v(" "),t.context.hasLabel&&"after"===t.context.labelPosition?t._t("label",[r("label",{staticClass:"formulate-input-label formulate-input-label--after",attrs:{for:t.context.attributes.id},domProps:{textContent:t._s(t.context.label)}})],null,t.context.label):t._e()],2),t._v(" "),t.help?r("div",{staticClass:"formulate-input-help",domProps:{textContent:t._s(t.help)}}):t._e(),t._v(" "),t.disableErrors?t._e():r("FormulateErrors",{attrs:{type:"input",context:t.context}})],1)};C._withStripped=!0;var k=N({render:C,staticRenderFns:[]},void 0,S,void 0,!1,void 0,!1,void 0,void 0,void 0),D=function(t){this.form=t};D.prototype.hasValidationErrors=function(){return this.form.hasValidationErrors()},D.prototype.values=function(){var t=this;return new Promise((function(e,r){var o=[],i=function t(e){var r={};for(var o in e)e[o]instanceof u||m(e[o])?r[o]=e[o]:r[o]=t(e[o]);return r}(t.form.internalFormModelProxy),n=function(e){"object"==typeof t.form.internalFormModelProxy[e]&&t.form.internalFormModelProxy[e]instanceof u&&o.push(t.form.internalFormModelProxy[e].upload().then((function(t){var r;return Object.assign(i,((r={})[e]=t,r))})))};for(var a in i)n(a);Promise.all(o).then((function(){return e(i)})).catch((function(t){return r(t)}))}))};var U={provide:function(){return{formulateFormSetter:this.setFieldValue,formulateFormRegister:this.register,getFormValues:this.getFormValues,observeErrors:this.addErrorObserver,removeErrorObserver:this.removeErrorObserver,formulateFieldValidation:this.formulateFieldValidation}},name:"FormulateForm",model:{prop:"formulateValue",event:"input"},props:{name:{type:[String,Boolean],default:!1},formulateValue:{type:Object,default:function(){return{}}},values:{type:[Object,Boolean],default:!1},errors:{type:[Object,Boolean],default:!1},formErrors:{type:Array,default:function(){return[]}}},data:function(){return{registry:{},internalFormModelProxy:{},formShouldShowErrors:!1,errorObservers:[],namedErrors:[],namedFieldErrors:{}}},computed:{formContext:function(){return{errors:this.mergedFormErrors}},hasInitialValue:function(){return this.formulateValue&&"object"==typeof this.formulateValue||this.values&&"object"==typeof this.values},isVmodeled:function(){return!!(this.$options.propsData.hasOwnProperty("formulateValue")&&this._events&&Array.isArray(this._events.input)&&this._events.input.length)},initialValues:function(){return Object.prototype.hasOwnProperty.call(this.$options.propsData,"formulateValue")&&"object"==typeof this.formulateValue?Object.assign({},this.formulateValue):Object.prototype.hasOwnProperty.call(this.$options.propsData,"values")&&"object"==typeof this.values?Object.assign({},this.values):{}},classes:function(){var t={"formulate-form":!0};return this.name&&(t["formulate-form--"+this.name]=!0),t},mergedFormErrors:function(){return this.formErrors.concat(this.namedErrors)},mergedFieldErrors:function(){var t={};if(this.errors)for(var e in this.errors)t[e]=p(this.errors[e]);for(var r in this.namedFieldErrors)t[r]=p(this.namedFieldErrors[r]);return t},hasFormErrorObservers:function(){return!!this.errorObservers.filter((function(t){return"form"===t.type})).length}},watch:{formulateValue:{handler:function(t,e){if(this.isVmodeled&&t&&"object"==typeof t)for(var r in t)!this.registry.hasOwnProperty(r)||d(t[r],this.internalFormModelProxy[r])||d(t[r],this.registry[r].internalModelProxy[r])||(this.setFieldValue(r,t[r]),this.registry[r].context.model=t[r])},deep:!0},mergedFormErrors:function(t){this.errorObservers.filter((function(t){return"form"===t.type})).forEach((function(e){return e.callback(t)}))},mergedFieldErrors:{handler:function(t){this.errorObservers.filter((function(t){return"input"===t.type})).forEach((function(e){return e.callback(t[e.field]||[])}))},immediate:!0}},created:function(){this.$formulate.register(this),this.applyInitialValues()},destroyed:function(){this.$formulate.deregister(this)},methods:{applyInitialValues:function(){this.hasInitialValue&&(this.internalFormModelProxy=this.initialValues)},applyErrors:function(t){var e=t.formErrors,r=t.inputErrors;this.namedErrors=e,this.namedFieldErrors=r},addErrorObserver:function(t){this.errorObservers.find((function(e){return t.callback===e.callback}))||(this.errorObservers.push(t),"form"===t.type?t.callback(this.mergedFormErrors):Object.prototype.hasOwnProperty.call(this.mergedFieldErrors,t.field)&&t.callback(this.mergedFieldErrors[t.field]))},removeErrorObserver:function(t){this.errorObservers=this.errorObservers.filter((function(e){return e.callback!==t}))},setFieldValue:function(t,e){var r;Object.assign(this.internalFormModelProxy,((r={})[t]=e,r)),this.$emit("input",Object.assign({},this.internalFormModelProxy))},getUniqueRegistryName:function(t,e){return void 0===e&&(e=0),Object.prototype.hasOwnProperty.call(this.registry,t+(e||""))?this.getUniqueRegistryName(t,e+1):t+(e||"")},register:function(t,e){if(Object.prototype.hasOwnProperty.call(this.registry,t))return!1;this.registry[t]=e;var r=Object.prototype.hasOwnProperty.call(e.$options.propsData,"formulateValue"),o=Object.prototype.hasOwnProperty.call(e.$options.propsData,"value");!r&&this.hasInitialValue&&this.initialValues[t]?e.context.model=this.initialValues[t]:!r&&!o||d(e.internalModelProxy,this.initialValues[t])||this.setFieldValue(t,e.internalModelProxy)},registerErrorComponent:function(t){this.errorComponents.includes(t)||this.errorComponents.push(t)},formSubmitted:function(){var t=this;this.showErrors();var e=new D(this);return this.$emit("submit-raw",e),e.hasValidationErrors().then((function(t){return t?void 0:e.values()})).then((function(e){if(void 0!==e)return t.$emit("submit",e),e}))},showErrors:function(){for(var t in this.registry)this.registry[t].formShouldShowErrors=!0},getFormValues:function(){return this.internalFormModelProxy},formulateFieldValidation:function(t){this.$emit("validation",t)},hasValidationErrors:function(){var t=[];for(var e in this.registry)"function"==typeof this.registry[e].getValidationErrors&&t.push(this.registry[e].getValidationErrors());return Promise.all(t).then((function(t){return t.some((function(t){return t.hasErrors}))}))}}},I=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("form",{class:t.classes,on:{submit:function(e){return e.preventDefault(),t.formSubmitted(e)}}},[t.hasFormErrorObservers?t._e():r("FormulateErrors",{attrs:{context:t.formContext}}),t._v(" "),t._t("default")],2)};I._withStripped=!0;var B=N({render:I,staticRenderFns:[]},void 0,U,void 0,!1,void 0,!1,void 0,void 0,void 0),L={inject:{observeErrors:{default:!1},removeErrorObserver:{default:!1}},props:{context:{type:Object,default:function(){return{}}},type:{type:String,default:"form"}},data:function(){return{boundSetErrors:this.setErrors.bind(this),localErrors:[]}},computed:{visibleValidationErrors:function(){return Array.isArray(this.context.visibleValidationErrors)?this.context.visibleValidationErrors:[]},errors:function(){return Array.isArray(this.context.errors)?this.context.errors:[]},mergedErrors:function(){return this.errors.concat(this.localErrors)},visibleErrors:function(){return Array.from(new Set(this.mergedErrors.concat(this.visibleValidationErrors)))}},created:function(){"form"!==this.type||"function"!=typeof this.observeErrors||Array.isArray(this.context.errors)||this.observeErrors({callback:this.boundSetErrors,type:this.type})},destroyed:function(){"form"!==this.type||"function"!=typeof this.removeErrorObserver||Array.isArray(this.context.errors)||this.removeErrorObserver(this.boundSetErrors)},methods:{setErrors:function(t){this.localErrors=p(t)}}},M=function(){var t=this,e=t.$createElement,r=t._self._c||e;return t.visibleErrors.length?r("ul",{class:"formulate-"+t.type+"-errors"},t._l(t.visibleErrors,(function(e){return r("li",{key:e,class:"formulate-"+t.type+"-error",domProps:{textContent:t._s(e)}})})),0):t._e()};M._withStripped=!0;var R=N({render:M,staticRenderFns:[]},void 0,L,void 0,!1,void 0,!1,void 0,void 0,void 0);function T(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&-1===e.indexOf(o)&&(r[o]=t[o]);return r}var H={name:"FormulateInputGroup",props:{context:{type:Object,required:!0}},computed:{options:function(){return this.context.options||[]},subComponent:function(){return"FormulateInput"},optionsWithContext:function(){var t=this,e=this.context,r=(e.options,e.labelPosition,e.attributes),o=(r.id,T(r,["id"])),i=(e.classification,e.blurHandler,e.performValidation,e.hasValidationErrors,e.getValidationErrors,e.validationErrors,e.setErrors,e.visibleValidationErrors,e.component,e.hasLabel,T(e,["options","labelPosition","attributes","classification","blurHandler","performValidation","hasValidationErrors","getValidationErrors","validationErrors","setErrors","visibleValidationErrors","component","hasLabel"]));return this.options.map((function(e){return t.groupItemContext(i,e,o)}))}},methods:{groupItemContext:function(t,e,r){return Object.assign({},t,e,r,{})}}},q=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"formulate-input-group"},t._l(t.optionsWithContext,(function(e){return r(t.subComponent,t._b({key:e.id,tag:"component",staticClass:"formulate-input-group-item",attrs:{"disable-errors":!0},on:{blur:t.context.blurHandler},model:{value:t.context.model,callback:function(e){t.$set(t.context,"model",e)},expression:"context.model"}},"component",e,!1))})),1)};q._withStripped=!0;var W=N({render:q,staticRenderFns:[]},void 0,H,void 0,!1,void 0,!1,void 0,void 0,void 0),G={props:{context:{type:Object,required:!0}},computed:{type:function(){return this.context.type},id:function(){return this.context.id},attributes:function(){return this.context.attributes||{}},hasValue:function(){return!!this.context.model}}},Y={name:"FormulateInputBox",mixins:[G]},z=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type}},["radio"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"radio"},domProps:{value:t.context.value,checked:t._q(t.context.model,t.context.value)},on:{blur:t.context.blurHandler,change:function(e){return t.$set(t.context,"model",t.context.value)}}},"input",t.attributes,!1)):r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"checkbox"},domProps:{value:t.context.value,checked:Array.isArray(t.context.model)?t._i(t.context.model,t.context.value)>-1:t.context.model},on:{blur:t.context.blurHandler,change:function(e){var r=t.context.model,o=e.target,i=!!o.checked;if(Array.isArray(r)){var n=t.context.value,a=t._i(r,n);o.checked?a<0&&t.$set(t.context,"model",r.concat([n])):a>-1&&t.$set(t.context,"model",r.slice(0,a).concat(r.slice(a+1)))}else t.$set(t.context,"model",i)}}},"input",t.attributes,!1)),t._v(" "),r("label",{staticClass:"formulate-input-element-decorator",attrs:{for:t.id}})])};z._withStripped=!0;var K=N({render:z,staticRenderFns:[]},void 0,Y,void 0,!1,void 0,!1,void 0,void 0,void 0),Z={name:"FormulateInputText",mixins:[G]},J=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type}},["checkbox"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"checkbox"},domProps:{checked:Array.isArray(t.context.model)?t._i(t.context.model,null)>-1:t.context.model},on:{blur:t.context.blurHandler,change:function(e){var r=t.context.model,o=e.target,i=!!o.checked;if(Array.isArray(r)){var n=t._i(r,null);o.checked?n<0&&t.$set(t.context,"model",r.concat([null])):n>-1&&t.$set(t.context,"model",r.slice(0,n).concat(r.slice(n+1)))}else t.$set(t.context,"model",i)}}},"input",t.attributes,!1)):"radio"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"radio"},domProps:{checked:t._q(t.context.model,null)},on:{blur:t.context.blurHandler,change:function(e){return t.$set(t.context,"model",null)}}},"input",t.attributes,!1)):r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:t.type},domProps:{value:t.context.model},on:{blur:t.context.blurHandler,input:function(e){e.target.composing||t.$set(t.context,"model",e.target.value)}}},"input",t.attributes,!1))])};J._withStripped=!0;var X=N({render:J,staticRenderFns:[]},void 0,Z,void 0,!1,void 0,!1,void 0,void 0,void 0),Q={name:"FormulateFiles",props:{files:{type:u,required:!0},imagePreview:{type:Boolean,default:!1}},computed:{fileUploads:function(){return this.files.files||[]}},watch:{files:function(){this.imagePreview&&this.files.loadPreviews()}},mounted:function(){this.imagePreview&&this.files.loadPreviews()}},tt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return t.fileUploads.length?r("ul",{staticClass:"formulate-files"},t._l(t.fileUploads,(function(e){return r("li",{key:e.uuid,attrs:{"data-has-error":!!e.error,"data-has-preview":!(!t.imagePreview||!e.previewData)}},[r("div",{staticClass:"formulate-file"},[t.imagePreview&&e.previewData?r("div",{staticClass:"formulate-file-image-preview"},[r("img",{attrs:{src:e.previewData}})]):t._e(),t._v(" "),r("div",{staticClass:"formulate-file-name",attrs:{title:e.name},domProps:{textContent:t._s(e.name)}}),t._v(" "),!1!==e.progress?r("div",{staticClass:"formulate-file-progress",attrs:{"data-just-finished":e.justFinished,"data-is-finished":!e.justFinished&&e.complete}},[r("div",{staticClass:"formulate-file-progress-inner",style:{width:e.progress+"%"}})]):t._e(),t._v(" "),e.complete&&!e.justFinished||!1===e.progress?r("div",{staticClass:"formulate-file-remove",on:{click:e.removeFile}}):t._e()]),t._v(" "),e.error?r("div",{staticClass:"formulate-file-upload-error",domProps:{textContent:t._s(e.error)}}):t._e()])})),0):t._e()};tt._withStripped=!0;var et={name:"FormulateInputFile",components:{FormulateFiles:N({render:tt,staticRenderFns:[]},void 0,Q,void 0,!1,void 0,!1,void 0,void 0,void 0)},mixins:[G],data:function(){return{isOver:!1}},computed:{hasFiles:function(){return!!(this.context.model instanceof u&&this.context.model.files.length)}},created:function(){Array.isArray(this.context.model)&&"string"==typeof this.context.model[0][this.$formulate.getFileUrlKey()]&&(this.context.model=this.$formulate.createUpload({files:this.context.model},this.context))},mounted:function(){window&&this.context.preventWindowDrops&&(window.addEventListener("dragover",this.preventDefault),window.addEventListener("drop",this.preventDefault))},destroyed:function(){window&&this.context.preventWindowDrops&&(window.removeEventListener("dragover",this.preventDefault),window.removeEventListener("drop",this.preventDefault))},methods:{preventDefault:function(t){"INPUT"!==t.target.tagName&&"file"!==t.target.getAttribute("type")&&(t=t||event).preventDefault()},handleFile:function(){var t=this;this.isOver=!1;var e=this.$refs.file;e.files.length&&(this.context.model=this.$formulate.createUpload(e,this.context),this.$nextTick((function(){return t.attemptImmediateUpload()})))},attemptImmediateUpload:function(){var t=this;"live"===this.context.uploadBehavior&&this.context.model instanceof u&&this.context.hasValidationErrors().then((function(e){e||t.context.model.upload()}))},handleDragOver:function(t){t.preventDefault(),this.isOver=!0},handleDragLeave:function(t){t.preventDefault(),this.isOver=!1}}},rt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type,"data-has-files":t.hasFiles}},[r("div",{staticClass:"formulate-input-upload-area",attrs:{"data-has-files":t.hasFiles}},[r("input",t._b({ref:"file",attrs:{"data-is-drag-hover":t.isOver,type:"file"},on:{blur:t.context.blurHandler,change:t.handleFile,dragover:t.handleDragOver,dragleave:t.handleDragLeave}},"input",t.attributes,!1)),t._v(" "),r("div",{directives:[{name:"show",rawName:"v-show",value:!t.hasFiles,expression:"!hasFiles"}],staticClass:"formulate-input-upload-area-mask"}),t._v(" "),t.hasFiles?r("FormulateFiles",{attrs:{files:t.context.model,"image-preview":"image"===t.context.type&&"preview"===t.context.imageBehavior}}):t._e()],1)])};rt._withStripped=!0;var ot=N({render:rt,staticRenderFns:[]},void 0,et,void 0,!1,void 0,!1,void 0,void 0,void 0),it={name:"FormulateInputButton",mixins:[G]},nt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type}},[r("button",t._b({attrs:{type:t.type}},"button",t.attributes,!1),[t._t("default",[r("span",{class:"formulate-input-element--"+t.context.type+"--label",domProps:{textContent:t._s(t.context.value||t.context.label||t.context.name||"Submit")}})])],2)])};nt._withStripped=!0;var at=N({render:nt,staticRenderFns:[]},void 0,it,void 0,!1,void 0,!1,void 0,void 0,void 0),st={name:"FormulateInputSelect",mixins:[G],computed:{options:function(){return this.context.options||{}},optionGroups:function(){return this.context.optionGroups||!1},placeholderSelected:function(){return!(this.hasValue||!this.context.attributes||!this.context.attributes.placeholder)}}},lt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type}},[r("select",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{"data-placeholder-selected":t.placeholderSelected},on:{blur:t.context.blurHandler,change:function(e){var r=Array.prototype.filter.call(e.target.options,(function(t){return t.selected})).map((function(t){return"_value"in t?t._value:t.value}));t.$set(t.context,"model",e.target.multiple?r:r[0])}}},"select",t.attributes,!1),[t.context.placeholder?r("option",{attrs:{value:"",disabled:""},domProps:{selected:!t.hasValue}},[t._v("\n "+t._s(t.context.placeholder)+"\n ")]):t._e(),t._v(" "),t.optionGroups?t._l(t.optionGroups,(function(e,o){return r("optgroup",{key:o,attrs:{label:o}},t._l(e,(function(e){return r("option",t._b({key:e.id,domProps:{value:e.value,textContent:t._s(e.label)}},"option",e.attributes||{},!1))})),0)})):t._l(t.options,(function(e){return r("option",t._b({key:e.id,domProps:{value:e.value,textContent:t._s(e.label)}},"option",e.attributes||{},!1))}))],2)])};lt._withStripped=!0;var ut=N({render:lt,staticRenderFns:[]},void 0,st,void 0,!1,void 0,!1,void 0,void 0,void 0),ct={name:"FormulateInputSlider",mixins:[G]},dt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type}},["checkbox"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"checkbox"},domProps:{checked:Array.isArray(t.context.model)?t._i(t.context.model,null)>-1:t.context.model},on:{blur:t.context.blurHandler,change:function(e){var r=t.context.model,o=e.target,i=!!o.checked;if(Array.isArray(r)){var n=t._i(r,null);o.checked?n<0&&t.$set(t.context,"model",r.concat([null])):n>-1&&t.$set(t.context,"model",r.slice(0,n).concat(r.slice(n+1)))}else t.$set(t.context,"model",i)}}},"input",t.attributes,!1)):"radio"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"radio"},domProps:{checked:t._q(t.context.model,null)},on:{blur:t.context.blurHandler,change:function(e){return t.$set(t.context,"model",null)}}},"input",t.attributes,!1)):r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:t.type},domProps:{value:t.context.model},on:{blur:t.context.blurHandler,input:function(e){e.target.composing||t.$set(t.context,"model",e.target.value)}}},"input",t.attributes,!1)),t._v(" "),t.context.showValue?r("div",{staticClass:"formulate-input-element-range-value",domProps:{textContent:t._s(t.context.model)}}):t._e()])};dt._withStripped=!0;var ft=N({render:dt,staticRenderFns:[]},void 0,ct,void 0,!1,void 0,!1,void 0,void 0,void 0),pt={name:"FormulateInputTextArea",mixins:[G]},ht=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"formulate-input-element formulate-input-element--textarea",attrs:{"data-type":"textarea"}},[r("textarea",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],domProps:{value:t.context.model},on:{blur:t.context.blurHandler,input:function(e){e.target.composing||t.$set(t.context,"model",e.target.value)}}},"textarea",t.attributes,!1))])};ht._withStripped=!0;var mt=N({render:ht,staticRenderFns:[]},void 0,pt,void 0,!1,void 0,!1,void 0,void 0,void 0),vt=function(){this.options={},this.defaults={components:{FormulateForm:B,FormulateInput:k,FormulateErrors:R,FormulateInputBox:K,FormulateInputText:X,FormulateInputFile:ot,FormulateInputGroup:W,FormulateInputButton:at,FormulateInputSelect:ut,FormulateInputSlider:ft,FormulateInputTextArea:mt},library:e,rules:v,mimes:b,locale:!1,uploader:_,uploadUrl:!1,fileUrlKey:"url",uploadJustCompleteDuration:1e3,errorHandler:function(t){return t},plugins:[F],locales:{}},this.registry=new Map};return vt.prototype.install=function(t,e){var r=this;t.prototype.$formulate=this,this.options=this.defaults;var o=this.defaults.plugins;for(var i in e&&Array.isArray(e.plugins)&&e.plugins.length&&(o=o.concat(e.plugins)),o.forEach((function(t){return"function"==typeof t?t(r):null})),this.extend(e||{}),this.options.components)t.component(i,this.options.components[i])},vt.prototype.extend=function(t){if("object"==typeof t)return this.options=this.merge(this.options,t),this;throw new Error("VueFormulate extend() should be passed an object (was "+typeof t+")")},vt.prototype.merge=function(t,e,r){void 0===r&&(r=!0);var o={};for(var i in t)e.hasOwnProperty(i)?x(e[i])&&x(t[i])?o[i]=this.merge(t[i],e[i],r):r&&Array.isArray(t[i])&&Array.isArray(e[i])?o[i]=t[i].concat(e[i]):o[i]=e[i]:o[i]=t[i];for(var n in e)o.hasOwnProperty(n)||(o[n]=e[n]);return o},vt.prototype.classify=function(t){return this.options.library.hasOwnProperty(t)?this.options.library[t].classification:"unknown"},vt.prototype.component=function(t){return!!this.options.library.hasOwnProperty(t)&&this.options.library[t].component},vt.prototype.rules=function(t){return void 0===t&&(t={}),Object.assign({},this.options.rules,t)},vt.prototype.i18n=function(t){if(t.$i18n)switch(typeof t.$i18n.locale){case"string":return t.$i18n.locale;case"function":return t.$i18n.locale()}return!1},vt.prototype.getLocale=function(t){var e=this;return this.selectedLocale||(this.selectedLocale=[this.options.locale,this.i18n(t),"en"].reduce((function(t,r){if(t)return t;if(r){var o=function(t){return t.split("-").reduce((function(t,e){return t.length&&t.unshift(t[0]+"-"+e),t.length?t:[e]}),[])}(r).find((function(t){return Object.prototype.hasOwnProperty.call(e.options.locales,t)}));o&&(t=o)}return t}),!1)),this.selectedLocale},vt.prototype.validationMessage=function(t,e,r){var o=this.options.locales[this.getLocale(r)];return o.hasOwnProperty(t)?o[t](e):"_"===t[0]&&o.hasOwnProperty(t.substr(1))?o[t.substr(1)](e):o.hasOwnProperty("default")?o.default(e):"This field does not have a valid value"},vt.prototype.register=function(t){"FormulateForm"===t.$options.name&&t.name&&this.registry.set(t.name,t)},vt.prototype.deregister=function(t){"FormulateForm"===t.$options.name&&t.name&&this.registry.has(t.name)&&this.registry.delete(t.name)},vt.prototype.handle=function(t,e,r){void 0===r&&(r=!1);var o=r?t:this.options.errorHandler(t);return e&&this.registry.has(e)&&this.registry.get(e).applyErrors({formErrors:p(o.formErrors),inputErrors:o.inputErrors||{}}),o},vt.prototype.getUploader=function(){return this.options.uploader||!1},vt.prototype.getUploadUrl=function(){return this.options.uploadUrl||!1},vt.prototype.getFileUrlKey=function(){return this.options.fileUrlKey||"url"},vt.prototype.createUpload=function(t,e){return new u(t,e,this.options)},new vt}(); +var e}function w(t){var e,r;return!1!==E(t)&&("function"==typeof(e=t.constructor)&&(!1!==E(r=e.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf")))}function _(t){return"string"==typeof t?t[0].toUpperCase()+t.substr(1):t}var F={accepted:function(t){return"Please accept the "+t.name+"."},after:function(t){var e=t.name,r=t.args;return Array.isArray(r)&&r.length?_(e)+" must be after "+r[0]+".":_(e)+" must be a later date."},alpha:function(t){return _(t.name)+" can only contain alphabetical characters."},alphanumeric:function(t){return _(t.name)+" can only contain letters and numbers."},before:function(t){var e=t.name,r=t.args;return Array.isArray(r)&&r.length?_(e)+" must be before "+r[0]+".":_(e)+" must be an earlier date."},between:function(t){var e=t.name,r=t.value,o=t.args,i=!(!Array.isArray(o)||!o[2])&&o[2];return!isNaN(r)&&"length"!==i||"value"===i?_(e)+" must be between "+o[0]+" and "+o[1]+".":_(e)+" must be between "+o[0]+" and "+o[1]+" characters long."},confirm:function(t){var e=t.name;return t.args,_(e)+" does not match."},date:function(t){var e=t.name,r=t.args;return Array.isArray(r)&&r.length?_(e)+" is not a valid date, please use the format "+r[0]:_(e)+" is not a valid date."},default:function(t){return t.name,"This field isn’t valid."},email:function(t){t.name;var e=t.value;return e?"“"+e+"” is not a valid email address.":"Please enter a valid email address."},endsWith:function(t){t.name;var e=t.value;return e?"“"+e+"” doesn’t end with a valid value.":"This field doesn’t end with a valid value."},in:function(t){var e=t.name,r=t.value;return"string"==typeof r&&r?"“"+_(r)+"” is not an allowed "+e+".":"This is not an allowed "+e+"."},matches:function(t){return _(t.name)+" is not an allowed value."},max:function(t){var e=t.name,r=t.value,o=t.args;if(Array.isArray(r))return"You may only select "+o[0]+" "+e+".";var i=!(!Array.isArray(o)||!o[1])&&o[1];return!isNaN(r)&&"length"!==i||"value"===i?_(e)+" must be less than or equal to "+o[0]+".":_(e)+" must be less than or equal to "+o[0]+" characters long."},mime:function(t){var e=t.name,r=t.args;return _(e)+" must be of the the type: "+(r[0]||"No file formats allowed.")},min:function(t){var e=t.name,r=t.value,o=t.args;if(Array.isArray(r))return"You need at least "+o[0]+" "+e+".";var i=!(!Array.isArray(o)||!o[1])&&o[1];return!isNaN(r)&&"length"!==i||"value"===i?_(e)+" must be more than "+o[0]+".":_(e)+" must be more than "+o[0]+" characters long."},not:function(t){var e=t.name;return"“"+t.value+"” is not an allowed "+e+"."},number:function(t){return _(t.name)+" must be a number."},required:function(t){return _(t.name)+" is required."},startsWith:function(t){t.name;var e=t.value;return e?"“"+e+"” doesn’t start with a valid value.":"This field doesn’t start with a valid value."},url:function(t){return t.name,"Please include a valid url."}};function O(t){var e;t.extend({locales:(e={},e.en=F,e)})}function V(t,e,r,o){return new Promise((function(r,i){var n=(o.fauxUploaderDuration||2e3)*(.5+Math.random()),s=performance.now(),a=function(){return setTimeout((function(){var o=performance.now()-s,i=Math.min(100,Math.round(o/n*100));if(e(i),i>=100)return r({url:"http://via.placeholder.com/350x150.png",name:t.name});a()}),20)};a()}))}function A(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&-1===e.indexOf(o)&&(r[o]=t[o]);return r}var P={inheritAttrs:!1,functional:!0,render:function(t,e){for(var r=e.props,o=e.data,i=e.parent,n=e.children,s=i,a=(r.name,r.forceWrap),l=r.context,u=A(r,["name","forceWrap","context"]);s&&"FormulateInput"!==s.$options.name;)s=s.$parent;if(!s)return null;if(s.$scopedSlots&&s.$scopedSlots[r.name])return s.$scopedSlots[r.name](Object.assign({},l,u));if(Array.isArray(n)&&(n.length>1||a&&n.length>0)){var c=o.attrs,d=(c.name,c.context,A(c,["name","context"]));return t("div",Object.assign({},o,{attrs:d}),n)}return Array.isArray(n)&&1===n.length?n[0]:null}};function S(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&-1===e.indexOf(o)&&(r[o]=t[o]);return r}var $=function(t){this.registry=new Map,this.ctx=t};function j(t){return new $(t).dataProps()}function C(){return{hasInitialValue:function(){return this.formulateValue&&"object"==typeof this.formulateValue||this.values&&"object"==typeof this.values||this.isGrouping&&"object"==typeof this.context.model[this.index]},isVmodeled:function(){return!!(this.$options.propsData.hasOwnProperty("formulateValue")&&this._events&&Array.isArray(this._events.input)&&this._events.input.length)},initialValues:function(){return y(this.$options.propsData,"formulateValue")&&"object"==typeof this.formulateValue?Object.assign({},this.formulateValue):y(this.$options.propsData,"values")&&"object"==typeof this.values?Object.assign({},this.values):this.isGrouping&&"object"==typeof this.context.model[this.index]?this.context.model[this.index]:{}}}}function R(t){void 0===t&&(t=[]);var e={applyInitialValues:function(){this.hasInitialValue&&(this.proxy=this.initialValues)},setFieldValue:function(t,e){var r;if(void 0===e){var o=this.proxy,i=(o[t],S(o,[String(t)]));this.proxy=i}else Object.assign(this.proxy,((r={})[t]=e,r));this.$emit("input",Object.assign({},this.proxy))},getFormValues:function(){return this.proxy},hasValidationErrors:function(){return Promise.all(this.registry.reduce((function(t,e,r){return t.push(e.performValidation()&&e.getValidationErrors()),t}),[])).then((function(t){return t.some((function(t){return t.hasErrors}))}))},showErrors:function(){this.childrenShouldShowErrors=!0,this.registry.map((function(t){t.formShouldShowErrors=!0}))},hideErrors:function(){this.childrenShouldShowErrors=!1,this.registry.map((function(t){t.formShouldShowErrors=!1,t.behavioralErrorVisibility=!1}))},setValues:function(t){var e=this;Array.from(new Set(Object.keys(t).concat(Object.keys(this.proxy)))).forEach((function(r){!e.registry.has(r)||d(t[r],e.proxy[r])||d(t[r],e.registry.get(r).proxy)||(e.setFieldValue(r,t[r]),e.registry.get(r).context.model=t[r])}))}};return Object.keys(e).reduce((function(r,o){var i;return t.includes(o)?r:Object.assign({},r,((i={})[o]=e[o],i))}),{})}function N(t){return{formulateSetter:t.setFieldValue,formulateRegister:t.register,formulateDeregister:t.deregister,getFormValues:t.getFormValues}}$.prototype.add=function(t,e){return this.registry.set(t,e),this},$.prototype.remove=function(t){this.registry.delete(t);var e=this.ctx.proxy,r=(e[t],S(e,[String(t)]));return this.ctx.proxy=r,this},$.prototype.has=function(t){return this.registry.has(t)},$.prototype.get=function(t){return this.registry.get(t)},$.prototype.map=function(t){var e={};return this.registry.forEach((function(r,o){var i;return Object.assign(e,((i={})[o]=t(r,o),i))})),e},$.prototype.keys=function(){return Array.from(this.registry.keys())},$.prototype.register=function(t,e){if(this.registry.has(t))return!1;this.registry.set(t,e);var r=y(e.$options.propsData,"formulateValue"),o=y(e.$options.propsData,"value");!r&&this.ctx.hasInitialValue&&this.ctx.initialValues[t]?e.context.model=this.ctx.initialValues[t]:!r&&!o||d(e.proxy,this.ctx.initialValues[t])||this.ctx.setFieldValue(t,e.proxy),this.childrenShouldShowErrors&&(e.formShouldShowErrors=!0)},$.prototype.reduce=function(t,e){return this.registry.forEach((function(r,o){e=t(e,r,o)})),e},$.prototype.dataProps=function(){var t=this;return{proxy:{},registry:this,register:this.register.bind(this),deregister:function(e){return t.remove(e)},childrenShouldShowErrors:!1}};var k=function(t){this.form=t};function I(t,e,r,o,i,n,s,a,l,u){"boolean"!=typeof s&&(l=a,a=s,s=!1);var c,d="function"==typeof r?r.options:r;if(t&&t.render&&(d.render=t.render,d.staticRenderFns=t.staticRenderFns,d._compiled=!0,i&&(d.functional=!0)),o&&(d._scopeId=o),n?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,l(t)),t&&t._registeredComponents&&t._registeredComponents.add(n)},d._ssrRegister=c):e&&(c=s?function(t){e.call(this,u(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,a(t))}),c)if(d.functional){var p=d.render;d.render=function(t,e){return c.call(e),p(t,e)}}else{var h=d.beforeCreate;d.beforeCreate=h?[].concat(h,c):[c]}return r}k.prototype.hasValidationErrors=function(){return this.form.hasValidationErrors()},k.prototype.values=function(){var t=this;return new Promise((function(e,r){var o=[],i=function t(e){if("object"!=typeof e)return e;var r=Array.isArray(e)?[]:{};for(var o in e)e[o]instanceof u||v(e[o])?r[o]=e[o]:r[o]=t(e[o]);return r}(t.form.proxy),n=function(e){"object"==typeof t.form.proxy[e]&&t.form.proxy[e]instanceof u&&o.push(t.form.proxy[e].upload().then((function(t){var r;return Object.assign(i,((r={})[e]=t,r))})))};for(var s in i)n(s);Promise.all(o).then((function(){return e(i)})).catch((function(t){return r(t)}))}))};var D={provide:function(){return Object.assign({},N(this),{observeErrors:this.addErrorObserver,removeErrorObserver:this.removeErrorObserver,formulateFieldValidation:this.formulateFieldValidation})},name:"FormulateForm",model:{prop:"formulateValue",event:"input"},props:{name:{type:[String,Boolean],default:!1},formulateValue:{type:Object,default:function(){return{}}},values:{type:[Object,Boolean],default:!1},errors:{type:[Object,Boolean],default:!1},formErrors:{type:Array,default:function(){return[]}}},data:function(){return Object.assign({},j(this),{formShouldShowErrors:!1,errorObservers:[],namedErrors:[],namedFieldErrors:{}})},computed:Object.assign({},C(),{formContext:function(){return{errors:this.mergedFormErrors}},classes:function(){var t={"formulate-form":!0};return this.name&&(t["formulate-form--"+this.name]=!0),t},mergedFormErrors:function(){return this.formErrors.concat(this.namedErrors)},mergedFieldErrors:function(){var t={};if(this.errors)for(var e in this.errors)t[e]=h(this.errors[e]);for(var r in this.namedFieldErrors)t[r]=h(this.namedFieldErrors[r]);return t},hasFormErrorObservers:function(){return!!this.errorObservers.filter((function(t){return"form"===t.type})).length}}),watch:{formulateValue:{handler:function(t){this.isVmodeled&&t&&"object"==typeof t&&this.setValues(t)},deep:!0},mergedFormErrors:function(t){this.errorObservers.filter((function(t){return"form"===t.type})).forEach((function(e){return e.callback(t)}))},mergedFieldErrors:{handler:function(t){this.errorObservers.filter((function(t){return"input"===t.type})).forEach((function(e){return e.callback(t[e.field]||[])}))},immediate:!0}},created:function(){this.$formulate.register(this),this.applyInitialValues()},destroyed:function(){this.$formulate.deregister(this)},methods:Object.assign({},R(),{applyErrors:function(t){var e=t.formErrors,r=t.inputErrors;this.namedErrors=e,this.namedFieldErrors=r},addErrorObserver:function(t){this.errorObservers.find((function(e){return t.callback===e.callback}))||(this.errorObservers.push(t),"form"===t.type?t.callback(this.mergedFormErrors):y(this.mergedFieldErrors,t.field)&&t.callback(this.mergedFieldErrors[t.field]))},removeErrorObserver:function(t){this.errorObservers=this.errorObservers.filter((function(e){return e.callback!==t}))},registerErrorComponent:function(t){this.errorComponents.includes(t)||this.errorComponents.push(t)},formSubmitted:function(){var t=this;this.showErrors();var e=new k(this);return this.$emit("submit-raw",e),e.hasValidationErrors().then((function(t){return t?void 0:e.values()})).then((function(e){if(void 0!==e)return t.$emit("submit",e),e}))},formulateFieldValidation:function(t){this.$emit("validation",t)}})},L=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("form",{class:t.classes,on:{submit:function(e){return e.preventDefault(),t.formSubmitted(e)}}},[t.hasFormErrorObservers?t._e():r("FormulateErrors",{attrs:{context:t.formContext}}),t._v(" "),t._t("default")],2)};L._withStripped=!0;var U=I({render:L,staticRenderFns:[]},void 0,D,void 0,!1,void 0,!1,void 0,void 0,void 0),B={context:function(){return T.call(this,Object.assign({},{addLabel:this.logicalAddLabel,attributes:this.elementAttributes,blurHandler:G.bind(this),classification:this.classification,component:this.component,disableErrors:this.disableErrors,errors:this.explicitErrors,formShouldShowErrors:this.formShouldShowErrors,getValidationErrors:this.getValidationErrors.bind(this),hasGivenName:this.hasGivenName,hasLabel:this.label&&"button"!==this.classification,hasValidationErrors:this.hasValidationErrors.bind(this),help:this.help,helpPosition:this.logicalHelpPosition,id:this.id||this.defaultId,imageBehavior:this.imageBehavior,label:this.label,labelPosition:this.logicalLabelPosition,limit:this.limit,name:this.nameOrFallback,performValidation:this.performValidation.bind(this),preventWindowDrops:this.preventWindowDrops,repeatable:this.repeatable,setErrors:this.setErrors.bind(this),showValidationErrors:this.showValidationErrors,slotComponents:this.slotComponents,type:this.type,uploadBehavior:this.uploadBehavior,uploadUrl:this.mergedUploadUrl,uploader:this.uploader||this.$formulate.getUploader(),validationErrors:this.validationErrors,value:this.value,visibleValidationErrors:this.visibleValidationErrors,isSubField:this.isSubField},this.typeContext))},nameOrFallback:function(){if(!0===this.name&&"button"!==this.classification)return this.type+"_"+this.elementAttributes.id;if(!1===this.name||"button"===this.classification&&!0===this.name)return!1;return this.name},hasGivenName:function(){return"boolean"!=typeof this.name},typeContext:function(){var t=this;switch(this.classification){case"select":return{options:M.call(this,this.options),optionGroups:!!this.optionGroups&&c(this.optionGroups,(function(e,r){return M.call(t,r)})),placeholder:this.$attrs.placeholder||!1};case"slider":return{showValue:!!this.showValue};default:return this.options?{options:M.call(this,this.options)}:{}}},elementAttributes:function(){var t=Object.assign({},this.localAttributes);this.id?t.id=this.id:t.id=this.defaultId;this.hasGivenName&&(t.name=this.name);this.help&&(t["aria-describedby"]=t.id+"-help");return t},logicalLabelPosition:function(){if(this.labelPosition)return this.labelPosition;switch(this.classification){case"box":return"after";default:return"before"}},logicalHelpPosition:function(){if(this.helpPosition)return this.helpPosition;switch(this.classification){case"group":return"before";default:return"after"}},mergedUploadUrl:function(){return this.uploadUrl||this.$formulate.getUploadUrl()},isVmodeled:function(){return!!(this.$options.propsData.hasOwnProperty("formulateValue")&&this._events&&Array.isArray(this._events.input)&&this._events.input.length)},mergedValidationName:function(){if(this.validationName)return this.validationName;if("string"==typeof this.name)return this.name;if(this.label)return this.label;return this.type},explicitErrors:function(){return h(this.errors).concat(this.localErrors).concat(h(this.error))},allErrors:function(){return this.explicitErrors.concat(h(this.validationErrors))},hasErrors:function(){return!!this.allErrors.length},hasVisibleErrors:function(){return this.validationErrors&&this.showValidationErrors||!!this.explicitErrors.length},showValidationErrors:function(){if(this.showErrors||this.formShouldShowErrors)return!0;if("file"===this.classification&&"live"===this.uploadBehavior&&q.call(this))return!0;return this.behavioralErrorVisibility},visibleValidationErrors:function(){return this.showValidationErrors&&this.validationErrors.length?this.validationErrors:[]},slotComponents:function(){return{label:this.$formulate.slotComponent(this.type,"label"),help:this.$formulate.slotComponent(this.type,"help"),errors:this.$formulate.slotComponent(this.type,"errors"),repeatable:this.$formulate.slotComponent(this.type,"repeatable"),addMore:this.$formulate.slotComponent(this.type,"addMore")}},logicalAddLabel:function(){if("boolean"==typeof this.addLabel)return"+ "+(this.label||this.name||"Add");return this.addLabel}};function M(t){if(!Array.isArray(t)&&t&&"object"==typeof t){var e=[];for(var r in t)e.push({value:r,label:t[r],id:this.elementAttributes.id+"_"+r});return e}return t}function G(){this.$emit("blur"),"blur"===this.errorBehavior&&(this.behavioralErrorVisibility=!0)}function T(t){return Object.defineProperty(t,"model",{get:q.bind(this),set:H.bind(this)})}function q(){var t=this.isVmodeled?"formulateValue":"proxy";return"checkbox"===this.type&&!Array.isArray(this[t])&&this.options?[]:this[t]?this[t]:""}function H(t){d(t,this.proxy)||(this.proxy=t),this.$emit("input",t),this.context.name&&"function"==typeof this.formulateSetter&&this.formulateSetter(this.context.name,t)}var W={name:"FormulateInput",inheritAttrs:!1,provide:function(){return{formulateRegisterRule:this.registerRule,formulateRemoveRule:this.removeRule}},inject:{formulateSetter:{default:void 0},formulateFieldValidation:{default:function(){return function(){return{}}}},formulateRegister:{default:void 0},formulateDeregister:{default:void 0},getFormValues:{default:function(){return function(){return{}}}},observeErrors:{default:void 0},removeErrorObserver:{default:void 0},isSubField:{default:function(){return function(){return!1}}}},model:{prop:"formulateValue",event:"input"},props:{type:{type:String,default:"text"},name:{type:[String,Boolean],default:!0},formulateValue:{default:""},value:{default:!1},options:{type:[Object,Array,Boolean],default:!1},optionGroups:{type:[Object,Boolean],default:!1},id:{type:[String,Boolean,Number],default:!1},label:{type:[String,Boolean],default:!1},labelPosition:{type:[String,Boolean],default:!1},limit:{type:Number,default:1/0},help:{type:[String,Boolean],default:!1},helpPosition:{type:[String,Boolean],default:!1},errors:{type:[String,Array,Boolean],default:!1},repeatable:{type:Boolean,default:!1},validation:{type:[String,Boolean,Array],default:!1},validationName:{type:[String,Boolean],default:!1},error:{type:[String,Boolean],default:!1},errorBehavior:{type:String,default:"blur",validator:function(t){return["blur","live","submit"].includes(t)}},showErrors:{type:Boolean,default:!1},imageBehavior:{type:String,default:"preview"},uploadUrl:{type:[String,Boolean],default:!1},uploader:{type:[Function,Object,Boolean],default:!1},uploadBehavior:{type:String,default:"live"},preventWindowDrops:{type:Boolean,default:!0},showValue:{type:[String,Boolean],default:!1},validationMessages:{type:Object,default:function(){return{}}},validationRules:{type:Object,default:function(){return{}}},checked:{type:[String,Boolean],default:!1},disableErrors:{type:Boolean,default:!1},addLabel:{type:[Boolean,String],default:!1}},data:function(){return{defaultId:this.$formulate.nextId(this),localAttributes:{},localErrors:[],proxy:this.getInitialValue(),behavioralErrorVisibility:"live"===this.errorBehavior,formShouldShowErrors:!1,validationErrors:[],pendingValidation:Promise.resolve(),ruleRegistry:[],messageRegistry:{}}},computed:Object.assign({},B,{classification:function(){var t=this.$formulate.classify(this.type);return"box"===t&&this.options?"group":t},component:function(){return"group"===this.classification?"FormulateInputGroup":this.$formulate.component(this.type)},parsedValidationRules:function(){var t=this,e={};return Object.keys(this.validationRules).forEach((function(r){e[p(r)]=t.validationRules[r]})),e},messages:function(){var t=this,e={};return Object.keys(this.validationMessages).forEach((function(r){e[p(r)]=t.validationMessages[r]})),Object.keys(this.messageRegistry).forEach((function(r){e[p(r)]=t.messageRegistry[r]})),e}}),watch:{$attrs:{handler:function(t){this.updateLocalAttributes(t)},deep:!0},proxy:function(t,e){this.performValidation(),this.isVmodeled||d(t,e)||(this.context.model=t)},formulateValue:function(t,e){this.isVmodeled&&!d(t,e)&&(this.context.model=t)},showValidationErrors:{handler:function(t){this.$emit("error-visibility",t)},immediate:!0}},created:function(){this.applyInitialValue(),this.formulateRegister&&"function"==typeof this.formulateRegister&&this.formulateRegister(this.nameOrFallback,this),this.disableErrors||"function"!=typeof this.observeErrors||this.observeErrors({callback:this.setErrors,type:"input",field:this.nameOrFallback}),this.updateLocalAttributes(this.$attrs),this.performValidation()},beforeDestroy:function(){this.disableErrors||"function"!=typeof this.removeErrorObserver||this.removeErrorObserver(this.setErrors),"function"==typeof this.formulateDeregister&&this.formulateDeregister(this.nameOrFallback)},methods:{getInitialValue:function(){var t=this.$formulate.classify(this.type);return"box"===(t="box"===t&&this.options?"group":t)&&this.checked?this.value||!0:y(this.$options.propsData,"value")&&"box"!==t?this.value:y(this.$options.propsData,"formulateValue")?this.formulateValue:""},applyInitialValue:function(){!d(this.context.model,this.proxy)&&Object.prototype.hasOwnProperty(this.$options.propsData,"options")&&"box"===this.classification&&(this.context.model=this.proxy)},updateLocalAttributes:function(t){d(t,this.localAttributes)||(this.localAttributes=t)},performValidation:function(){var t=this,e=f(this.validation,this.$formulate.rules(this.parsedValidationRules));return e=this.ruleRegistry.length?this.ruleRegistry.concat(e):e,this.pendingValidation=this.runRules(e).then((function(e){return t.didValidate(e)})),this.pendingValidation},runRules:function(t){var e=this,r=function(t){var r=t[0],o=t[1],i=t[2],n=(t[3],r.apply(void 0,[{value:e.context.model,getFormValues:e.getFormValues.bind(e),name:e.context.name}].concat(o)));return(n=n instanceof Promise?n:Promise.resolve(n)).then((function(t){return!t&&e.getMessage(i,o)}))};return new Promise((function(e){var o=function(t,i){void 0===i&&(i=[]);var n=t.shift();Array.isArray(n)&&n.length?Promise.all(n.map(r)).then((function(t){return t.filter((function(t){return!!t}))})).then((function(r){return(r=Array.isArray(r)?r:[]).length&&n.bail||!t.length?e(i.concat(r)):o(t,i.concat(r))})):e([])};o(function(t){var e=[],r=t.findIndex((function(t){return"bail"===t[2].toLowerCase()}));if(r>=0){var o=t.splice(0,r+1).slice(0,-1);o.length&&e.push(o),t.map((function(t){return e.push(Object.defineProperty([t],"bail",{value:!0}))}))}else e.push(t);return e.reduce((function(t,e){var r=function(t,e){if(void 0===e&&(e=!1),t.length<2)return Object.defineProperty([t],"bail",{value:e});var o=[],i=t.findIndex((function(t){return"^"===t[3]}));if(i>=0){var n=t.splice(0,i);n.length&&o.push.apply(o,r(n,e)),o.push(Object.defineProperty([t.shift()],"bail",{value:!0})),t.length&&o.push.apply(o,r(t,e))}else o.push(t);return o};return t.concat(r(e))}),[])}(t))}))},didValidate:function(t){var e=!d(t,this.validationErrors);if(this.validationErrors=t,e){var r=this.getErrorObject();this.$emit("validation",r),this.formulateFieldValidation&&"function"==typeof this.formulateFieldValidation&&this.formulateFieldValidation(r)}},getMessage:function(t,e){return this.getMessageFunc(t)({args:e,name:this.mergedValidationName,value:this.context.model,vm:this,formValues:this.getFormValues()})},getMessageFunc:function(t){var e=this;if(t=p(t),this.messages&&void 0!==this.messages[t])switch(typeof this.messages[t]){case"function":return this.messages[t];case"string":case"boolean":return function(){return e.messages[t]}}return function(r){return e.$formulate.validationMessage(t,r,e)}},hasValidationErrors:function(){var t=this;return new Promise((function(e){t.$nextTick((function(){t.pendingValidation.then((function(){return e(!!t.validationErrors.length)}))}))}))},getValidationErrors:function(){var t=this;return new Promise((function(e){t.$nextTick((function(){return t.pendingValidation.then((function(){return e(t.getErrorObject())}))}))}))},getErrorObject:function(){return{name:this.context.nameOrFallback||this.context.name,errors:this.validationErrors.filter((function(t){return"string"==typeof t})),hasErrors:!!this.validationErrors.length}},setErrors:function(t){this.localErrors=h(t)},registerRule:function(t,e,r,o){void 0===o&&(o=null),this.ruleRegistry.some((function(t){return t[2]===r}))||(this.ruleRegistry.push([t,e,r]),null!==o&&(this.messageRegistry[r]=o))},removeRule:function(t){var e=this.ruleRegistry.findIndex((function(e){return e[2]===t}));e>=0&&(this.ruleRegistry.splice(e,1),delete this.messageRegistry[t])}}},Y=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"formulate-input",attrs:{"data-classification":t.classification,"data-has-errors":t.hasErrors,"data-is-showing-errors":t.hasVisibleErrors,"data-type":t.type}},[r("div",{staticClass:"formulate-input-wrapper"},["before"===t.context.labelPosition?t._t("label",[t.context.hasLabel?r(t.context.slotComponents.label,{tag:"component",attrs:{context:t.context}}):t._e()],null,t.context):t._e(),t._v(" "),"before"===t.context.helpPosition?t._t("help",[t.context.help?r(t.context.slotComponents.help,{tag:"component",attrs:{context:t.context}}):t._e()],null,t.context):t._e(),t._v(" "),t._t("element",[r(t.context.component,{tag:"component",attrs:{context:t.context},on:{click:function(e){return t.$emit("click",e)}}},[t._t("default",null,null,t.context)],2)],null,t.context),t._v(" "),"after"===t.context.labelPosition?t._t("label",[t.context.hasLabel?r(t.context.slotComponents.label,{tag:"component",attrs:{context:t.context}}):t._e()],null,t.context):t._e()],2),t._v(" "),"after"===t.context.helpPosition?t._t("help",[t.context.help?r(t.context.slotComponents.help,{tag:"component",attrs:{context:t.context}}):t._e()],null,t.context):t._e(),t._v(" "),t._t("errors",[t.context.disableErrors?t._e():r(t.context.slotComponents.errors,{tag:"component",attrs:{type:"FormulateErrors"===t.context.slotComponents.errors&&"input",context:t.context}})],null,t.context)],2)};Y._withStripped=!0;var z=I({render:Y,staticRenderFns:[]},void 0,W,void 0,!1,void 0,!1,void 0,void 0,void 0),K={inject:{observeErrors:{default:!1},removeErrorObserver:{default:!1}},props:{context:{type:Object,default:function(){return{}}},type:{type:String,default:"form"}},data:function(){return{boundSetErrors:this.setErrors.bind(this),localErrors:[]}},computed:{visibleValidationErrors:function(){return Array.isArray(this.context.visibleValidationErrors)?this.context.visibleValidationErrors:[]},errors:function(){return Array.isArray(this.context.errors)?this.context.errors:[]},mergedErrors:function(){return this.errors.concat(this.localErrors)},visibleErrors:function(){return Array.from(new Set(this.mergedErrors.concat(this.visibleValidationErrors))).filter((function(t){return"string"==typeof t}))}},created:function(){"form"!==this.type||"function"!=typeof this.observeErrors||Array.isArray(this.context.errors)||this.observeErrors({callback:this.boundSetErrors,type:this.type})},destroyed:function(){"form"!==this.type||"function"!=typeof this.removeErrorObserver||Array.isArray(this.context.errors)||this.removeErrorObserver(this.boundSetErrors)},methods:{setErrors:function(t){this.localErrors=h(t)}}},Z=function(){var t=this,e=t.$createElement,r=t._self._c||e;return t.visibleErrors.length?r("ul",{class:"formulate-"+t.type+"-errors"},t._l(t.visibleErrors,(function(e){return r("li",{key:e,class:"formulate-"+t.type+"-error",domProps:{textContent:t._s(e)}})})),0):t._e()};Z._withStripped=!0;var J=I({render:Z,staticRenderFns:[]},void 0,K,void 0,!1,void 0,!1,void 0,void 0,void 0),X={props:{context:{type:Object,required:!0}}},Q=function(){var t=this.$createElement,e=this._self._c||t;return this.context.help?e("div",{class:"formulate-input-help formulate-input-help--"+this.context.helpPosition,attrs:{id:this.context.id+"-help"},domProps:{textContent:this._s(this.context.help)}}):this._e()};Q._withStripped=!0;var tt=I({render:Q,staticRenderFns:[]},void 0,X,void 0,!1,void 0,!1,void 0,void 0,void 0),et={name:"FormulateGrouping",props:{context:{type:Object,required:!0}},provide:function(){return{isSubField:function(){return!0}}},inject:["formulateRegisterRule","formulateRemoveRule"],computed:{items:function(){return Array.isArray(this.context.model)&&(this.context.repeatable||0!==this.context.model.length)?this.context.model:[{}]},providers:function(){var t=this;return this.items.map((function(e,r){return!!Array.isArray(t.$refs["provider-"+r])&&t.$refs["provider-"+r][0]}))},formShouldShowErrors:function(){return this.context.formShouldShowErrors}},watch:{providers:function(){this.formShouldShowErrors&&this.showErrors()},formShouldShowErrors:function(t){t&&this.showErrors()}},created:function(){this.formulateRegisterRule(this.validateGroup.bind(this),[],"formulateGrouping",!0)},destroyed:function(){this.formulateRemoveRule("formulateGrouping")},methods:{setFieldValue:function(t,e,r){var o,i=Array.isArray(this.context.model)?this.context.model:[];i.splice(t,1,Object.assign({},"object"==typeof this.context.model[t]?this.context.model[t]:{},((o={})[e]=r,o))),this.context.model=i},validateGroup:function(){return Promise.all(this.providers.reduce((function(t,e){return e&&"function"==typeof e.hasValidationErrors&&t.push(e.hasValidationErrors()),t}),[])).then((function(t){return!t.some((function(t){return!!t}))}))},showErrors:function(){this.providers.map((function(t){return t&&"function"==typeof t.showErrors&&t.showErrors()}))},removeItem:function(t){Array.isArray(this.context.model)&&this.context.model.splice(t,1)}}},rt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("FormulateSlot",{staticClass:"formulate-input-grouping",attrs:{name:"grouping",context:t.context,"force-wrap":t.context.repeatable}},t._l(t.items,(function(e,o){return r("FormulateRepeatableProvider",{key:o,ref:"provider-"+o,refInFor:!0,attrs:{index:o,"set-field-value":function(e,r){return t.setFieldValue(o,e,r)},context:t.context},on:{remove:t.removeItem}},[t._t("default")],2)})),1)};rt._withStripped=!0;var ot=I({render:rt,staticRenderFns:[]},void 0,et,void 0,!1,void 0,!1,void 0,void 0,void 0),it={props:{context:{type:Object,required:!0}}},nt=function(){var t=this.$createElement;return(this._self._c||t)("label",{class:"formulate-input-label formulate-input-label--"+this.context.labelPosition,attrs:{for:this.context.id},domProps:{textContent:this._s(this.context.label)}})};nt._withStripped=!0;var st=I({render:nt,staticRenderFns:[]},void 0,it,void 0,!1,void 0,!1,void 0,void 0,void 0),at={props:{context:{type:Object,required:!0},addMore:{type:Function,required:!0}}},lt=function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"formulate-input-group-add-more"},[e("FormulateInput",{attrs:{type:"button",label:this.context.addLabel,"data-minor":"","data-ghost":""},on:{click:this.addMore}})],1)};lt._withStripped=!0;var ut=I({render:lt,staticRenderFns:[]},void 0,at,void 0,!1,void 0,!1,void 0,void 0,void 0),ct={props:{context:{type:Object,required:!0}},computed:{type:function(){return this.context.type},id:function(){return this.context.id},attributes:function(){return this.context.attributes||{}},hasValue:function(){return!!this.context.model}}},dt={name:"FormulateInputBox",mixins:[ct]},pt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type}},["radio"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"radio"},domProps:{value:t.context.value,checked:t._q(t.context.model,t.context.value)},on:{blur:t.context.blurHandler,change:function(e){return t.$set(t.context,"model",t.context.value)}}},"input",t.attributes,!1)):r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"checkbox"},domProps:{value:t.context.value,checked:Array.isArray(t.context.model)?t._i(t.context.model,t.context.value)>-1:t.context.model},on:{blur:t.context.blurHandler,change:function(e){var r=t.context.model,o=e.target,i=!!o.checked;if(Array.isArray(r)){var n=t.context.value,s=t._i(r,n);o.checked?s<0&&t.$set(t.context,"model",r.concat([n])):s>-1&&t.$set(t.context,"model",r.slice(0,s).concat(r.slice(s+1)))}else t.$set(t.context,"model",i)}}},"input",t.attributes,!1)),t._v(" "),r("label",{staticClass:"formulate-input-element-decorator",attrs:{for:t.id}})])};pt._withStripped=!0;var ht=I({render:pt,staticRenderFns:[]},void 0,dt,void 0,!1,void 0,!1,void 0,void 0,void 0),ft={name:"FormulateInputText",mixins:[ct]},mt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type}},["checkbox"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"checkbox"},domProps:{checked:Array.isArray(t.context.model)?t._i(t.context.model,null)>-1:t.context.model},on:{blur:t.context.blurHandler,change:function(e){var r=t.context.model,o=e.target,i=!!o.checked;if(Array.isArray(r)){var n=t._i(r,null);o.checked?n<0&&t.$set(t.context,"model",r.concat([null])):n>-1&&t.$set(t.context,"model",r.slice(0,n).concat(r.slice(n+1)))}else t.$set(t.context,"model",i)}}},"input",t.attributes,!1)):"radio"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"radio"},domProps:{checked:t._q(t.context.model,null)},on:{blur:t.context.blurHandler,change:function(e){return t.$set(t.context,"model",null)}}},"input",t.attributes,!1)):r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:t.type},domProps:{value:t.context.model},on:{blur:t.context.blurHandler,input:function(e){e.target.composing||t.$set(t.context,"model",e.target.value)}}},"input",t.attributes,!1))])};mt._withStripped=!0;var vt=I({render:mt,staticRenderFns:[]},void 0,ft,void 0,!1,void 0,!1,void 0,void 0,void 0),yt={name:"FormulateFiles",props:{files:{type:u,required:!0},imagePreview:{type:Boolean,default:!1}},computed:{fileUploads:function(){return this.files.files||[]}},watch:{files:function(){this.imagePreview&&this.files.loadPreviews()}},mounted:function(){this.imagePreview&&this.files.loadPreviews()}},gt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return t.fileUploads.length?r("ul",{staticClass:"formulate-files"},t._l(t.fileUploads,(function(e){return r("li",{key:e.uuid,attrs:{"data-has-error":!!e.error,"data-has-preview":!(!t.imagePreview||!e.previewData)}},[r("div",{staticClass:"formulate-file"},[t.imagePreview&&e.previewData?r("div",{staticClass:"formulate-file-image-preview"},[r("img",{attrs:{src:e.previewData}})]):t._e(),t._v(" "),r("div",{staticClass:"formulate-file-name",attrs:{title:e.name},domProps:{textContent:t._s(e.name)}}),t._v(" "),!1!==e.progress?r("div",{staticClass:"formulate-file-progress",attrs:{"data-just-finished":e.justFinished,"data-is-finished":!e.justFinished&&e.complete}},[r("div",{staticClass:"formulate-file-progress-inner",style:{width:e.progress+"%"}})]):t._e(),t._v(" "),e.complete&&!e.justFinished||!1===e.progress?r("div",{staticClass:"formulate-file-remove",on:{click:e.removeFile}}):t._e()]),t._v(" "),e.error?r("div",{staticClass:"formulate-file-upload-error",domProps:{textContent:t._s(e.error)}}):t._e()])})),0):t._e()};gt._withStripped=!0;var bt={name:"FormulateInputFile",components:{FormulateFiles:I({render:gt,staticRenderFns:[]},void 0,yt,void 0,!1,void 0,!1,void 0,void 0,void 0)},mixins:[ct],data:function(){return{isOver:!1}},computed:{hasFiles:function(){return!!(this.context.model instanceof u&&this.context.model.files.length)}},created:function(){Array.isArray(this.context.model)&&"string"==typeof this.context.model[0][this.$formulate.getFileUrlKey()]&&(this.context.model=this.$formulate.createUpload({files:this.context.model},this.context))},mounted:function(){window&&this.context.preventWindowDrops&&(window.addEventListener("dragover",this.preventDefault),window.addEventListener("drop",this.preventDefault))},destroyed:function(){window&&this.context.preventWindowDrops&&(window.removeEventListener("dragover",this.preventDefault),window.removeEventListener("drop",this.preventDefault))},methods:{preventDefault:function(t){"INPUT"!==t.target.tagName&&"file"!==t.target.getAttribute("type")&&(t=t||event).preventDefault()},handleFile:function(){var t=this;this.isOver=!1;var e=this.$refs.file;e.files.length&&(this.context.model=this.$formulate.createUpload(e,this.context),this.$nextTick((function(){return t.attemptImmediateUpload()})))},attemptImmediateUpload:function(){var t=this;"live"===this.context.uploadBehavior&&this.context.model instanceof u&&this.context.hasValidationErrors().then((function(e){e||t.context.model.upload()}))},handleDragOver:function(t){t.preventDefault(),this.isOver=!0},handleDragLeave:function(t){t.preventDefault(),this.isOver=!1}}},xt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type,"data-has-files":t.hasFiles}},[r("div",{staticClass:"formulate-input-upload-area",attrs:{"data-has-files":t.hasFiles}},[r("input",t._b({ref:"file",attrs:{"data-is-drag-hover":t.isOver,type:"file"},on:{blur:t.context.blurHandler,change:t.handleFile,dragover:t.handleDragOver,dragleave:t.handleDragLeave}},"input",t.attributes,!1)),t._v(" "),r("div",{directives:[{name:"show",rawName:"v-show",value:!t.hasFiles,expression:"!hasFiles"}],staticClass:"formulate-input-upload-area-mask"}),t._v(" "),t.hasFiles?r("FormulateFiles",{attrs:{files:t.context.model,"image-preview":"image"===t.context.type&&"preview"===t.context.imageBehavior}}):t._e()],1)])};xt._withStripped=!0;var Et=I({render:xt,staticRenderFns:[]},void 0,bt,void 0,!1,void 0,!1,void 0,void 0,void 0),wt={props:{context:{type:Object,required:!0},removeItem:{type:Function,required:!0},index:{type:Number,required:!0}}},_t=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"formulate-input-group-repeatable"},[t.context.repeatable?r("a",{staticClass:"formulate-input-group-repeatable-remove",attrs:{role:"button"},on:{click:function(e){return e.preventDefault(),t.removeItem(e)},keypress:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.removeItem(e)}}}):t._e(),t._v(" "),t._t("default")],2)};_t._withStripped=!0;var Ft=I({render:_t,staticRenderFns:[]},void 0,wt,void 0,!1,void 0,!1,void 0,void 0,void 0);function Ot(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&-1===e.indexOf(o)&&(r[o]=t[o]);return r}var Vt={name:"FormulateInputGroup",props:{context:{type:Object,required:!0}},computed:{options:function(){return this.context.options||[]},subType:function(){return"group"===this.context.type?"grouping":"inputs"},optionsWithContext:function(){var t=this,e=this.context,r=e.attributes,o=(r.id,Ot(r,["id"])),i=(e.blurHandler,e.classification,e.component,e.getValidationErrors,e.hasLabel,e.hasValidationErrors,e.isSubField,e.labelPosition,e.options,e.performValidation,e.setErrors,e.slotComponents,e.validationErrors,e.visibleValidationErrors,Ot(e,["attributes","blurHandler","classification","component","getValidationErrors","hasLabel","hasValidationErrors","isSubField","labelPosition","options","performValidation","setErrors","slotComponents","validationErrors","visibleValidationErrors"]));return this.options.map((function(e){return t.groupItemContext(i,e,o)}))},canAddMore:function(){return this.context.repeatable&&this.items.length-1:t.context.model},on:{blur:t.context.blurHandler,change:function(e){var r=t.context.model,o=e.target,i=!!o.checked;if(Array.isArray(r)){var n=t._i(r,null);o.checked?n<0&&t.$set(t.context,"model",r.concat([null])):n>-1&&t.$set(t.context,"model",r.slice(0,n).concat(r.slice(n+1)))}else t.$set(t.context,"model",i)}}},"input",t.attributes,!1)):"radio"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"radio"},domProps:{checked:t._q(t.context.model,null)},on:{blur:t.context.blurHandler,change:function(e){return t.$set(t.context,"model",null)}}},"input",t.attributes,!1)):r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:t.type},domProps:{value:t.context.model},on:{blur:t.context.blurHandler,input:function(e){e.target.composing||t.$set(t.context,"model",e.target.value)}}},"input",t.attributes,!1)),t._v(" "),t.context.showValue?r("div",{staticClass:"formulate-input-element-range-value",domProps:{textContent:t._s(t.context.model)}}):t._e()])};It._withStripped=!0;var Dt=I({render:It,staticRenderFns:[]},void 0,kt,void 0,!1,void 0,!1,void 0,void 0,void 0),Lt={name:"FormulateInputTextArea",mixins:[ct]},Ut=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"formulate-input-element formulate-input-element--textarea",attrs:{"data-type":"textarea"}},[r("textarea",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],domProps:{value:t.context.model},on:{blur:t.context.blurHandler,input:function(e){e.target.composing||t.$set(t.context,"model",e.target.value)}}},"textarea",t.attributes,!1))])};Ut._withStripped=!0;var Bt=I({render:Ut,staticRenderFns:[]},void 0,Lt,void 0,!1,void 0,!1,void 0,void 0,void 0),Mt={provide:function(){var t=this;return Object.assign({},N(this),{formulateSetter:function(e,r){return t.setFieldValue(e,r)}})},props:{index:{type:Number,required:!0},context:{type:Object,required:!0},setFieldValue:{type:Function,required:!0}},data:function(){return Object.assign({},j(this),{isGrouping:!0})},computed:Object.assign({},C()),methods:Object.assign({},R(["setFieldValue"]),{removeItem:function(){this.$emit("remove",this.index)}})},Gt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("FormulateSlot",{attrs:{name:"repeatable",context:t.context,index:t.index,"remove-item":t.removeItem}},[r(t.context.slotComponents.repeatable,{tag:"component",attrs:{context:t.context,index:t.index,"remove-item":t.removeItem}},[r("FormulateSlot",{attrs:{context:t.context,index:t.index,name:"default"}})],1)],1)};Gt._withStripped=!0;var Tt=I({render:Gt,staticRenderFns:[]},void 0,Mt,void 0,!1,void 0,!1,void 0,void 0,void 0),qt=function(){this.options={},this.defaults={components:{FormulateSlot:P,FormulateForm:U,FormulateHelp:tt,FormulateLabel:st,FormulateInput:z,FormulateErrors:J,FormulateAddMore:ut,FormulateGrouping:ot,FormulateInputBox:ht,FormulateInputText:vt,FormulateInputFile:Et,FormulateRepeatable:Ft,FormulateInputGroup:Pt,FormulateInputButton:jt,FormulateInputSelect:Nt,FormulateInputSlider:Dt,FormulateInputTextArea:Bt,FormulateRepeatableProvider:Tt},slotComponents:{label:"FormulateLabel",help:"FormulateHelp",errors:"FormulateErrors",repeatable:"FormulateRepeatable",addMore:"FormulateAddMore"},library:e,rules:g,mimes:x,locale:!1,uploader:V,uploadUrl:!1,fileUrlKey:"url",uploadJustCompleteDuration:1e3,errorHandler:function(t){return t},plugins:[O],locales:{},idPrefix:"formulate-"},this.registry=new Map,this.idRegistry={}};return qt.prototype.install=function(t,e){var r=this;t.prototype.$formulate=this,this.options=this.defaults;var o=this.defaults.plugins;for(var i in e&&Array.isArray(e.plugins)&&e.plugins.length&&(o=o.concat(e.plugins)),o.forEach((function(t){return"function"==typeof t?t(r):null})),this.extend(e||{}),this.options.components)t.component(i,this.options.components[i])},qt.prototype.nextId=function(t){var e=!(!t.$route||!t.$route.path)&&t.$route.path?t.$route.path.replace(/[/\\.\s]/g,"-"):"global";return Object.prototype.hasOwnProperty.call(this.idRegistry,e)||(this.idRegistry[e]=0),""+this.options.idPrefix+e+"-"+ ++this.idRegistry[e]},qt.prototype.extend=function(t){if("object"==typeof t)return this.options=this.merge(this.options,t),this;throw new Error("VueFormulate extend() should be passed an object (was "+typeof t+")")},qt.prototype.merge=function(t,e,r){void 0===r&&(r=!0);var o={};for(var i in t)e.hasOwnProperty(i)?w(e[i])&&w(t[i])?o[i]=this.merge(t[i],e[i],r):r&&Array.isArray(t[i])&&Array.isArray(e[i])?o[i]=t[i].concat(e[i]):o[i]=e[i]:o[i]=t[i];for(var n in e)o.hasOwnProperty(n)||(o[n]=e[n]);return o},qt.prototype.classify=function(t){return this.options.library.hasOwnProperty(t)?this.options.library[t].classification:"unknown"},qt.prototype.component=function(t){return!!this.options.library.hasOwnProperty(t)&&this.options.library[t].component},qt.prototype.slotComponent=function(t,e){var r=this.options.library[t];return r&&r.slotComponents&&r.slotComponents[e]?r.slotComponents[e]:this.options.slotComponents[e]},qt.prototype.rules=function(t){return void 0===t&&(t={}),Object.assign({},this.options.rules,t)},qt.prototype.i18n=function(t){if(t.$i18n)switch(typeof t.$i18n.locale){case"string":return t.$i18n.locale;case"function":return t.$i18n.locale()}return!1},qt.prototype.getLocale=function(t){var e=this;return this.selectedLocale||(this.selectedLocale=[this.options.locale,this.i18n(t),"en"].reduce((function(t,r){if(t)return t;if(r){var o=function(t){return t.split("-").reduce((function(t,e){return t.length&&t.unshift(t[0]+"-"+e),t.length?t:[e]}),[])}(r).find((function(t){return y(e.options.locales,t)}));o&&(t=o)}return t}),!1)),this.selectedLocale},qt.prototype.validationMessage=function(t,e,r){var o=this.options.locales[this.getLocale(r)];return o.hasOwnProperty(t)?o[t](e):"_"===t[0]&&o.hasOwnProperty(t.substr(1))?o[t.substr(1)](e):o.hasOwnProperty("default")?o.default(e):"This field does not have a valid value"},qt.prototype.register=function(t){"FormulateForm"===t.$options.name&&t.name&&this.registry.set(t.name,t)},qt.prototype.deregister=function(t){"FormulateForm"===t.$options.name&&t.name&&this.registry.has(t.name)&&this.registry.delete(t.name)},qt.prototype.handle=function(t,e,r){void 0===r&&(r=!1);var o=r?t:this.options.errorHandler(t,e);return e&&this.registry.has(e)&&this.registry.get(e).applyErrors({formErrors:h(o.formErrors),inputErrors:o.inputErrors||{}}),o},qt.prototype.reset=function(t,e){void 0===e&&(e={}),this.resetValidation(t),this.setValues(t,e)},qt.prototype.resetValidation=function(t){var e=this.registry.get(t);e.hideErrors(t),e.namedErrors=[],e.namedFieldErrors={}},qt.prototype.setValues=function(t,e){e&&!Array.isArray(e)&&"object"==typeof e&&this.registry.get(t).setValues(Object.assign({},e))},qt.prototype.getUploader=function(){return this.options.uploader||!1},qt.prototype.getUploadUrl=function(){return this.options.uploadUrl||!1},qt.prototype.getFileUrlKey=function(){return this.options.fileUrlKey||"url"},qt.prototype.createUpload=function(t,e){return new u(t,e,this.options)},new qt}(); diff --git a/dist/formulate.umd.js b/dist/formulate.umd.js index bdb73f3..25b1549 100644 --- a/dist/formulate.umd.js +++ b/dist/formulate.umd.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("is-url"),require("nanoid/non-secure"),require("is-plain-object"),require("@braid/vue-formulate-i18n")):"function"==typeof define&&define.amd?define(["is-url","nanoid/non-secure","is-plain-object","@braid/vue-formulate-i18n"],e):(t=t||self).Formulate=e(t.isUrl,t.nanoid,t.isPlainObject,t.VueFormulateI18n)}(this,(function(t,e,r,o){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t,e=e&&e.hasOwnProperty("default")?e.default:e,r=r&&r.hasOwnProperty("default")?r.default:r;var i=function(t,e){return{classification:t,component:"FormulateInput"+(e||t[0].toUpperCase()+t.substr(1))}},n=Object.assign({},["text","email","number","color","date","hidden","month","password","search","tel","time","url","week","datetime-local"].reduce((function(t,e){var r;return Object.assign({},t,((r={})[e]=i("text"),r))}),{}),{range:i("slider"),textarea:i("textarea","TextArea"),checkbox:i("box"),radio:i("box"),submit:i("button"),button:i("button"),select:i("select"),file:i("file"),image:i("file")}),s=function(t,e,r){void 0===r&&(r={}),this.input=t,this.fileList=t.files,this.files=[],this.options=Object.assign({},{mimes:{}},r),this.results=!1,this.context=e,Array.isArray(this.fileList)?this.rehydrateFileList(this.fileList):this.addFileList(this.fileList)};function a(t,e){var r={};for(var o in t)r[o]=e(o,t[o]);return r}function l(t,e){if(t===e)return!0;if(!t||!e)return!1;var r=Object.keys(t),o=Object.keys(e),i=r.length;if(o.length!==i)return!1;for(var n=0;n=100&&(e.complete||(e.justFinished=!0,setTimeout((function(){e.justFinished=!1}),t.options.uploadJustCompleteDuration)),e.complete=!0)}),(function(t){e.progress=0,e.error=t,e.complete=!0}),t.options)}))).then((function(r){t.results=r,e(r)})).catch((function(t){throw new Error(t)}))}))},s.prototype.removeFile=function(t){if(this.files=this.files.filter((function(e){return e.uuid!==t})),this.context.performValidation(),window&&this.fileList instanceof FileList){var e=new DataTransfer;this.files.map((function(t){return e.items.add(t.file)})),this.fileList=e.files,this.input.files=this.fileList}},s.prototype.loadPreviews=function(){this.files.map((function(t){if(!t.previewData&&window&&window.FileReader&&/^image\//.test(t.file.type)){var e=new FileReader;e.onload=function(e){return Object.assign(t,{previewData:e.target.result})},e.readAsDataURL(t.file)}}))},s.prototype.getFileList=function(){return this.fileList},s.prototype.getFiles=function(){return this.files},s.prototype.toString=function(){var t=this.files.length?this.files.length+" files":"empty";return this.results?JSON.stringify(this.results,null," "):"FileUpload("+t+")"};var f={accepted:function(t){var e=t.value;return Promise.resolve(["yes","on","1",1,!0,"true"].includes(e))},after:function(t,e){var r=t.value;void 0===e&&(e=!1);var o=Date.parse(e||new Date),i=Date.parse(r);return Promise.resolve(!isNaN(i)&&i>o)},alpha:function(t,e){var r=t.value;void 0===e&&(e="default");var o={default:/^[a-zA-ZÀ-ÖØ-öø-ÿ]+$/,latin:/^[a-zA-Z]+$/},i=o.hasOwnProperty(e)?e:"default";return Promise.resolve(o[i].test(r))},alphanumeric:function(t,e){var r=t.value;void 0===e&&(e="default");var o={default:/^[a-zA-Z0-9À-ÖØ-öø-ÿ]+$/,latin:/^[a-zA-Z0-9]+$/},i=o.hasOwnProperty(e)?e:"default";return Promise.resolve(o[i].test(r))},before:function(t,e){var r=t.value;void 0===e&&(e=!1);var o=Date.parse(e||new Date),i=Date.parse(r);return Promise.resolve(!isNaN(i)&&ie&&ie&&i.length()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test(e))},endsWith:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve("string"==typeof e&&r.length?void 0!==r.find((function(t){return e.endsWith(t)})):"string"==typeof e&&0===r.length)},in:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(void 0!==r.find((function(t){return"object"==typeof t?l(t,e):t===e})))},matches:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(!!r.find((function(t){return t instanceof RegExp?t.test(e):t===e})))},mime:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(function(){if(e instanceof s)for(var t=e.getFiles(),o=0;o=e):!isNaN(o)&&"length"!==r||"value"===r?(o=isNaN(o)?o:Number(o))>=e:("string"==typeof o||"length"===r)&&(o=isNaN(o)?o:o.toString()).length>=e)},max:function(t,e,r){var o=t.value;return void 0===e&&(e=10),Promise.resolve(Array.isArray(o)?(e=isNaN(e)?e:Number(e),o.length<=e):!isNaN(o)&&"length"!==r||"value"===r?(o=isNaN(o)?o:Number(o))<=e:("string"==typeof o||"length"===r)&&(o=isNaN(o)?o:o.toString()).length<=e)},not:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(void 0===r.find((function(t){return"object"==typeof t?l(t,e):t===e})))},number:function(t){var e=t.value;return Promise.resolve(!isNaN(e))},required:function(t,e){var r=t.value;return void 0===e&&(e=!0),Promise.resolve(!(e&&!["no","false"].includes(e))||(Array.isArray(r)?!!r.length:r instanceof s?r.getFiles().length>0:"string"==typeof r?!!r:"object"!=typeof r||!!r&&!!Object.keys(r).length))},startsWith:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve("string"==typeof e&&r.length?void 0!==r.find((function(t){return e.startsWith(t)})):"string"==typeof e&&0===r.length)},url:function(e){var r=e.value;return Promise.resolve(t(r))}},h="image/",m={csv:"text/csv",gif:h+"gif",jpg:h+"jpeg",jpeg:h+"jpeg",png:h+"png",pdf:"application/pdf",svg:h+"svg+xml"};function v(t,e,r,o){return new Promise((function(r,i){var n=(o.fauxUploaderDuration||2e3)*(.5+Math.random()),s=performance.now(),a=function(){return setTimeout((function(){var o=performance.now()-s,i=Math.min(100,Math.round(o/n*100));if(e(i),i>=100)return r({url:"http://via.placeholder.com/350x150.png",name:t.name});a()}),20)};a()}))}var y={context:function(){return x.call(this,Object.assign({},{type:this.type,value:this.value,name:this.nameOrFallback,classification:this.classification,component:this.component,id:this.id||this.defaultId,hasLabel:this.label&&"button"!==this.classification,label:this.label,labelPosition:this.logicalLabelPosition,attributes:this.elementAttributes,performValidation:this.performValidation.bind(this),blurHandler:g.bind(this),imageBehavior:this.imageBehavior,uploadUrl:this.mergedUploadUrl,uploader:this.uploader||this.$formulate.getUploader(),uploadBehavior:this.uploadBehavior,preventWindowDrops:this.preventWindowDrops,hasValidationErrors:this.hasValidationErrors,getValidationErrors:this.getValidationErrors.bind(this),validationErrors:this.validationErrors,errors:this.explicitErrors,setErrors:this.setErrors.bind(this),showValidationErrors:this.showValidationErrors,visibleValidationErrors:this.visibleValidationErrors},this.typeContext))},nameOrFallback:function(){if(!0===this.name&&"button"!==this.classification)return this.type+"_"+this.elementAttributes.id;if(!1===this.name||"button"===this.classification&&!0===this.name)return!1;return this.name},typeContext:function(){var t=this;switch(this.classification){case"select":return{options:b.call(this,this.options),optionGroups:!!this.optionGroups&&a(this.optionGroups,(function(e,r){return b.call(t,r)})),placeholder:this.$attrs.placeholder||!1};case"slider":return{showValue:!!this.showValue};default:return this.options?{options:b.call(this,this.options)}:{}}},elementAttributes:function(){var t=Object.assign({},this.localAttributes);this.id?t.id=this.id:t.id=this.defaultId;return t},logicalLabelPosition:function(){if(this.labelPosition)return this.labelPosition;switch(this.classification){case"box":return"after";default:return"before"}},mergedUploadUrl:function(){return this.uploadUrl||this.$formulate.getUploadUrl()},isVmodeled:function(){return!!(this.$options.propsData.hasOwnProperty("formulateValue")&&this._events&&Array.isArray(this._events.input)&&this._events.input.length)},mergedValidationName:function(){if(this.validationName)return this.validationName;if("string"==typeof this.name)return this.name;if(this.label)return this.label;return this.type},explicitErrors:function(){return c(this.errors).concat(this.localErrors).concat(c(this.error))},allErrors:function(){return this.explicitErrors.concat(c(this.validationErrors))},hasErrors:function(){return!!this.allErrors.length},hasVisibleErrors:function(){return this.validationErrors&&this.showValidationErrors||!!this.explicitErrors.length},showValidationErrors:function(){if(this.showErrors||this.formShouldShowErrors)return!0;if("file"===this.classification&&"live"===this.uploadBehavior&&E.call(this))return!0;return this.behavioralErrorVisibility},visibleValidationErrors:function(){return this.showValidationErrors&&this.validationErrors.length?this.validationErrors:[]}};function b(t){if(!Array.isArray(t)&&t&&"object"==typeof t){var r=[];for(var o in t)r.push({value:o,label:t[o],id:this.elementAttributes.id+"_"+o});return r}return Array.isArray(t)&&!t.length?[{value:this.value,label:this.label||this.name,id:this.context.id||e(9)}]:t}function g(){this.$emit("blur"),"blur"===this.errorBehavior&&(this.behavioralErrorVisibility=!0)}function x(t){return Object.defineProperty(t,"model",{get:E.bind(this),set:w.bind(this)})}function E(){var t=this.isVmodeled?"formulateValue":"internalModelProxy";return"checkbox"===this.type&&!Array.isArray(this[t])&&this.options?[]:this[t]?this[t]:""}function w(t){l(t,this.internalModelProxy)||(this.internalModelProxy=t),this.$emit("input",t),this.context.name&&"function"==typeof this.formulateFormSetter&&this.formulateFormSetter(this.context.name,t)}function F(t,e,r,o,i,n,s,a,l,u){"boolean"!=typeof s&&(l=a,a=s,s=!1);var c,d="function"==typeof r?r.options:r;if(t&&t.render&&(d.render=t.render,d.staticRenderFns=t.staticRenderFns,d._compiled=!0,i&&(d.functional=!0)),o&&(d._scopeId=o),n?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,l(t)),t&&t._registeredComponents&&t._registeredComponents.add(n)},d._ssrRegister=c):e&&(c=s?function(t){e.call(this,u(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,a(t))}),c)if(d.functional){var p=d.render;d.render=function(t,e){return c.call(e),p(t,e)}}else{var f=d.beforeCreate;d.beforeCreate=f?[].concat(f,c):[c]}return r}var _={name:"FormulateInput",inheritAttrs:!1,inject:{formulateFormSetter:{default:void 0},formulateFieldValidation:{default:function(){return function(){return{}}}},formulateFormRegister:{default:void 0},getFormValues:{default:function(){return function(){return{}}}},observeErrors:{default:void 0},removeErrorObserver:{default:void 0}},model:{prop:"formulateValue",event:"input"},props:{type:{type:String,default:"text"},name:{type:[String,Boolean],default:!0},formulateValue:{default:""},value:{default:!1},options:{type:[Object,Array,Boolean],default:!1},optionGroups:{type:[Object,Boolean],default:!1},id:{type:[String,Boolean,Number],default:!1},label:{type:[String,Boolean],default:!1},labelPosition:{type:[String,Boolean],default:!1},help:{type:[String,Boolean],default:!1},debug:{type:Boolean,default:!1},errors:{type:[String,Array,Boolean],default:!1},validation:{type:[String,Boolean,Array],default:!1},validationName:{type:[String,Boolean],default:!1},error:{type:[String,Boolean],default:!1},errorBehavior:{type:String,default:"blur",validator:function(t){return["blur","live"].includes(t)}},showErrors:{type:Boolean,default:!1},imageBehavior:{type:String,default:"preview"},uploadUrl:{type:[String,Boolean],default:!1},uploader:{type:[Function,Object,Boolean],default:!1},uploadBehavior:{type:String,default:"live"},preventWindowDrops:{type:Boolean,default:!0},showValue:{type:[String,Boolean],default:!1},validationMessages:{type:Object,default:function(){return{}}},validationRules:{type:Object,default:function(){return{}}},checked:{type:[String,Boolean],default:!1},disableErrors:{type:Boolean,default:!1}},data:function(){return{defaultId:e(9),localAttributes:{},localErrors:[],internalModelProxy:this.getInitialValue(),behavioralErrorVisibility:"live"===this.errorBehavior,formShouldShowErrors:!1,validationErrors:[],pendingValidation:Promise.resolve()}},computed:Object.assign({},y,{classification:function(){var t=this.$formulate.classify(this.type);return"box"===t&&this.options?"group":t},component:function(){return"group"===this.classification?"FormulateInputGroup":this.$formulate.component(this.type)},parsedValidationRules:function(){var t=this,e={};return Object.keys(this.validationRules).forEach((function(r){e[u(r)]=t.validationRules[r]})),e},messages:function(){var t=this,e={};return Object.keys(this.validationMessages).forEach((function(r){e[u(r)]=t.validationMessages[r]})),e}}),watch:{$attrs:{handler:function(t){this.updateLocalAttributes(t)},deep:!0},internalModelProxy:function(t,e){this.performValidation(),this.isVmodeled||l(t,e)||(this.context.model=t)},formulateValue:function(t,e){this.isVmodeled&&!l(t,e)&&(this.context.model=t)},showValidationErrors:{handler:function(t){this.$emit("error-visibility",t)},immediate:!0}},created:function(){this.applyInitialValue(),this.formulateFormRegister&&"function"==typeof this.formulateFormRegister&&this.formulateFormRegister(this.nameOrFallback,this),this.disableErrors||"function"!=typeof this.observeErrors||this.observeErrors({callback:this.setErrors,type:"input",field:this.nameOrFallback}),this.updateLocalAttributes(this.$attrs),this.performValidation()},destroyed:function(){this.disableErrors||"function"!=typeof this.removeErrorObserver||this.removeErrorObserver(this.setErrors)},methods:{getInitialValue:function(){var t=this.$formulate.classify(this.type);return"box"===(t="box"===t&&this.options?"group":t)&&this.checked?this.value||!0:Object.prototype.hasOwnProperty.call(this.$options.propsData,"value")&&"box"!==t?this.value:Object.prototype.hasOwnProperty.call(this.$options.propsData,"formulateValue")?this.formulateValue:""},applyInitialValue:function(){!l(this.context.model,this.internalModelProxy)&&Object.prototype.hasOwnProperty(this.$options.propsData,"options")&&"box"===this.classification&&(this.context.model=this.internalModelProxy)},updateLocalAttributes:function(t){l(t,this.localAttributes)||(this.localAttributes=t)},performValidation:function(){var t=this,e=d(this.validation,this.$formulate.rules(this.parsedValidationRules));return this.pendingValidation=Promise.all(e.map((function(e){var r=e[0],o=e[1],i=e[2],n=r.apply(void 0,[{value:t.context.model,getFormValues:t.getFormValues.bind(t),name:t.context.name}].concat(o));return(n=n instanceof Promise?n:Promise.resolve(n)).then((function(e){return!e&&t.getMessage(i,o)}))}))).then((function(t){return t.filter((function(t){return t}))})).then((function(e){return t.didValidate(e)})),this.pendingValidation},didValidate:function(t){var e=!l(t,this.validationErrors);if(this.validationErrors=t,e){var r=this.getErrorObject();this.$emit("validation",r),this.formulateFieldValidation&&"function"==typeof this.formulateFieldValidation&&this.formulateFieldValidation(r)}},getMessage:function(t,e){return this.getMessageFunc(t)({args:e,name:this.mergedValidationName,value:this.context.model,vm:this,formValues:this.getFormValues()})},getMessageFunc:function(t){var e=this;if(t=u(t),this.messages&&void 0!==this.messages[t])switch(typeof this.messages[t]){case"function":return this.messages[t];case"string":return function(){return e.messages[t]}}return function(r){return e.$formulate.validationMessage(t,r,e)}},hasValidationErrors:function(){var t=this;return new Promise((function(e){t.$nextTick((function(){t.pendingValidation.then((function(){return e(!!t.validationErrors.length)}))}))}))},getValidationErrors:function(){var t=this;return new Promise((function(e){t.$nextTick((function(){t.pendingValidation.then((function(){return e(t.getErrorObject())}))}))}))},getErrorObject:function(){return{name:this.context.nameOrFallback||this.context.name,errors:this.validationErrors,hasErrors:!!this.validationErrors.length}},setErrors:function(t){this.localErrors=c(t)}}},P=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"formulate-input",attrs:{"data-classification":t.classification,"data-has-errors":t.hasErrors,"data-is-showing-errors":t.hasVisibleErrors,"data-type":t.type}},[r("div",{staticClass:"formulate-input-wrapper"},[t.context.hasLabel&&"before"===t.context.labelPosition?t._t("label",[r("label",{staticClass:"formulate-input-label formulate-input-label--before",attrs:{for:t.context.attributes.id},domProps:{textContent:t._s(t.context.label)}})],null,t.context):t._e(),t._v(" "),t._t("element",[r(t.context.component,{tag:"component",attrs:{context:t.context}},[t._t("default",null,null,t.context)],2)],null,t.context),t._v(" "),t.context.hasLabel&&"after"===t.context.labelPosition?t._t("label",[r("label",{staticClass:"formulate-input-label formulate-input-label--after",attrs:{for:t.context.attributes.id},domProps:{textContent:t._s(t.context.label)}})],null,t.context.label):t._e()],2),t._v(" "),t.help?r("div",{staticClass:"formulate-input-help",domProps:{textContent:t._s(t.help)}}):t._e(),t._v(" "),t.disableErrors?t._e():r("FormulateErrors",{attrs:{type:"input",context:t.context}})],1)};P._withStripped=!0;var V=F({render:P,staticRenderFns:[]},void 0,_,void 0,!1,void 0,!1,void 0,void 0,void 0),O=function(t){this.form=t};O.prototype.hasValidationErrors=function(){return this.form.hasValidationErrors()},O.prototype.values=function(){var t=this;return new Promise((function(e,r){var o=[],i=function t(e){var r={};for(var o in e)e[o]instanceof s||p(e[o])?r[o]=e[o]:r[o]=t(e[o]);return r}(t.form.internalFormModelProxy),n=function(e){"object"==typeof t.form.internalFormModelProxy[e]&&t.form.internalFormModelProxy[e]instanceof s&&o.push(t.form.internalFormModelProxy[e].upload().then((function(t){var r;return Object.assign(i,((r={})[e]=t,r))})))};for(var a in i)n(a);Promise.all(o).then((function(){return e(i)})).catch((function(t){return r(t)}))}))};var $={provide:function(){return{formulateFormSetter:this.setFieldValue,formulateFormRegister:this.register,getFormValues:this.getFormValues,observeErrors:this.addErrorObserver,removeErrorObserver:this.removeErrorObserver,formulateFieldValidation:this.formulateFieldValidation}},name:"FormulateForm",model:{prop:"formulateValue",event:"input"},props:{name:{type:[String,Boolean],default:!1},formulateValue:{type:Object,default:function(){return{}}},values:{type:[Object,Boolean],default:!1},errors:{type:[Object,Boolean],default:!1},formErrors:{type:Array,default:function(){return[]}}},data:function(){return{registry:{},internalFormModelProxy:{},formShouldShowErrors:!1,errorObservers:[],namedErrors:[],namedFieldErrors:{}}},computed:{formContext:function(){return{errors:this.mergedFormErrors}},hasInitialValue:function(){return this.formulateValue&&"object"==typeof this.formulateValue||this.values&&"object"==typeof this.values},isVmodeled:function(){return!!(this.$options.propsData.hasOwnProperty("formulateValue")&&this._events&&Array.isArray(this._events.input)&&this._events.input.length)},initialValues:function(){return Object.prototype.hasOwnProperty.call(this.$options.propsData,"formulateValue")&&"object"==typeof this.formulateValue?Object.assign({},this.formulateValue):Object.prototype.hasOwnProperty.call(this.$options.propsData,"values")&&"object"==typeof this.values?Object.assign({},this.values):{}},classes:function(){var t={"formulate-form":!0};return this.name&&(t["formulate-form--"+this.name]=!0),t},mergedFormErrors:function(){return this.formErrors.concat(this.namedErrors)},mergedFieldErrors:function(){var t={};if(this.errors)for(var e in this.errors)t[e]=c(this.errors[e]);for(var r in this.namedFieldErrors)t[r]=c(this.namedFieldErrors[r]);return t},hasFormErrorObservers:function(){return!!this.errorObservers.filter((function(t){return"form"===t.type})).length}},watch:{formulateValue:{handler:function(t,e){if(this.isVmodeled&&t&&"object"==typeof t)for(var r in t)!this.registry.hasOwnProperty(r)||l(t[r],this.internalFormModelProxy[r])||l(t[r],this.registry[r].internalModelProxy[r])||(this.setFieldValue(r,t[r]),this.registry[r].context.model=t[r])},deep:!0},mergedFormErrors:function(t){this.errorObservers.filter((function(t){return"form"===t.type})).forEach((function(e){return e.callback(t)}))},mergedFieldErrors:{handler:function(t){this.errorObservers.filter((function(t){return"input"===t.type})).forEach((function(e){return e.callback(t[e.field]||[])}))},immediate:!0}},created:function(){this.$formulate.register(this),this.applyInitialValues()},destroyed:function(){this.$formulate.deregister(this)},methods:{applyInitialValues:function(){this.hasInitialValue&&(this.internalFormModelProxy=this.initialValues)},applyErrors:function(t){var e=t.formErrors,r=t.inputErrors;this.namedErrors=e,this.namedFieldErrors=r},addErrorObserver:function(t){this.errorObservers.find((function(e){return t.callback===e.callback}))||(this.errorObservers.push(t),"form"===t.type?t.callback(this.mergedFormErrors):Object.prototype.hasOwnProperty.call(this.mergedFieldErrors,t.field)&&t.callback(this.mergedFieldErrors[t.field]))},removeErrorObserver:function(t){this.errorObservers=this.errorObservers.filter((function(e){return e.callback!==t}))},setFieldValue:function(t,e){var r;Object.assign(this.internalFormModelProxy,((r={})[t]=e,r)),this.$emit("input",Object.assign({},this.internalFormModelProxy))},getUniqueRegistryName:function(t,e){return void 0===e&&(e=0),Object.prototype.hasOwnProperty.call(this.registry,t+(e||""))?this.getUniqueRegistryName(t,e+1):t+(e||"")},register:function(t,e){if(Object.prototype.hasOwnProperty.call(this.registry,t))return!1;this.registry[t]=e;var r=Object.prototype.hasOwnProperty.call(e.$options.propsData,"formulateValue"),o=Object.prototype.hasOwnProperty.call(e.$options.propsData,"value");!r&&this.hasInitialValue&&this.initialValues[t]?e.context.model=this.initialValues[t]:!r&&!o||l(e.internalModelProxy,this.initialValues[t])||this.setFieldValue(t,e.internalModelProxy)},registerErrorComponent:function(t){this.errorComponents.includes(t)||this.errorComponents.push(t)},formSubmitted:function(){var t=this;this.showErrors();var e=new O(this);return this.$emit("submit-raw",e),e.hasValidationErrors().then((function(t){return t?void 0:e.values()})).then((function(e){if(void 0!==e)return t.$emit("submit",e),e}))},showErrors:function(){for(var t in this.registry)this.registry[t].formShouldShowErrors=!0},getFormValues:function(){return this.internalFormModelProxy},formulateFieldValidation:function(t){this.$emit("validation",t)},hasValidationErrors:function(){var t=[];for(var e in this.registry)"function"==typeof this.registry[e].getValidationErrors&&t.push(this.registry[e].getValidationErrors());return Promise.all(t).then((function(t){return t.some((function(t){return t.hasErrors}))}))}}},A=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("form",{class:t.classes,on:{submit:function(e){return e.preventDefault(),t.formSubmitted(e)}}},[t.hasFormErrorObservers?t._e():r("FormulateErrors",{attrs:{context:t.formContext}}),t._v(" "),t._t("default")],2)};A._withStripped=!0;var j=F({render:A,staticRenderFns:[]},void 0,$,void 0,!1,void 0,!1,void 0,void 0,void 0),N={inject:{observeErrors:{default:!1},removeErrorObserver:{default:!1}},props:{context:{type:Object,default:function(){return{}}},type:{type:String,default:"form"}},data:function(){return{boundSetErrors:this.setErrors.bind(this),localErrors:[]}},computed:{visibleValidationErrors:function(){return Array.isArray(this.context.visibleValidationErrors)?this.context.visibleValidationErrors:[]},errors:function(){return Array.isArray(this.context.errors)?this.context.errors:[]},mergedErrors:function(){return this.errors.concat(this.localErrors)},visibleErrors:function(){return Array.from(new Set(this.mergedErrors.concat(this.visibleValidationErrors)))}},created:function(){"form"!==this.type||"function"!=typeof this.observeErrors||Array.isArray(this.context.errors)||this.observeErrors({callback:this.boundSetErrors,type:this.type})},destroyed:function(){"form"!==this.type||"function"!=typeof this.removeErrorObserver||Array.isArray(this.context.errors)||this.removeErrorObserver(this.boundSetErrors)},methods:{setErrors:function(t){this.localErrors=c(t)}}},S=function(){var t=this,e=t.$createElement,r=t._self._c||e;return t.visibleErrors.length?r("ul",{class:"formulate-"+t.type+"-errors"},t._l(t.visibleErrors,(function(e){return r("li",{key:e,class:"formulate-"+t.type+"-error",domProps:{textContent:t._s(e)}})})),0):t._e()};S._withStripped=!0;var k=F({render:S,staticRenderFns:[]},void 0,N,void 0,!1,void 0,!1,void 0,void 0,void 0);function C(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&-1===e.indexOf(o)&&(r[o]=t[o]);return r}var D={name:"FormulateInputGroup",props:{context:{type:Object,required:!0}},computed:{options:function(){return this.context.options||[]},subComponent:function(){return"FormulateInput"},optionsWithContext:function(){var t=this,e=this.context,r=(e.options,e.labelPosition,e.attributes),o=(r.id,C(r,["id"])),i=(e.classification,e.blurHandler,e.performValidation,e.hasValidationErrors,e.getValidationErrors,e.validationErrors,e.setErrors,e.visibleValidationErrors,e.component,e.hasLabel,C(e,["options","labelPosition","attributes","classification","blurHandler","performValidation","hasValidationErrors","getValidationErrors","validationErrors","setErrors","visibleValidationErrors","component","hasLabel"]));return this.options.map((function(e){return t.groupItemContext(i,e,o)}))}},methods:{groupItemContext:function(t,e,r){return Object.assign({},t,e,r,{})}}},U=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"formulate-input-group"},t._l(t.optionsWithContext,(function(e){return r(t.subComponent,t._b({key:e.id,tag:"component",staticClass:"formulate-input-group-item",attrs:{"disable-errors":!0},on:{blur:t.context.blurHandler},model:{value:t.context.model,callback:function(e){t.$set(t.context,"model",e)},expression:"context.model"}},"component",e,!1))})),1)};U._withStripped=!0;var I=F({render:U,staticRenderFns:[]},void 0,D,void 0,!1,void 0,!1,void 0,void 0,void 0),B={props:{context:{type:Object,required:!0}},computed:{type:function(){return this.context.type},id:function(){return this.context.id},attributes:function(){return this.context.attributes||{}},hasValue:function(){return!!this.context.model}}},L={name:"FormulateInputBox",mixins:[B]},M=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type}},["radio"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"radio"},domProps:{value:t.context.value,checked:t._q(t.context.model,t.context.value)},on:{blur:t.context.blurHandler,change:function(e){return t.$set(t.context,"model",t.context.value)}}},"input",t.attributes,!1)):r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"checkbox"},domProps:{value:t.context.value,checked:Array.isArray(t.context.model)?t._i(t.context.model,t.context.value)>-1:t.context.model},on:{blur:t.context.blurHandler,change:function(e){var r=t.context.model,o=e.target,i=!!o.checked;if(Array.isArray(r)){var n=t.context.value,s=t._i(r,n);o.checked?s<0&&t.$set(t.context,"model",r.concat([n])):s>-1&&t.$set(t.context,"model",r.slice(0,s).concat(r.slice(s+1)))}else t.$set(t.context,"model",i)}}},"input",t.attributes,!1)),t._v(" "),r("label",{staticClass:"formulate-input-element-decorator",attrs:{for:t.id}})])};M._withStripped=!0;var R=F({render:M,staticRenderFns:[]},void 0,L,void 0,!1,void 0,!1,void 0,void 0,void 0),T={name:"FormulateInputText",mixins:[B]},H=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type}},["checkbox"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"checkbox"},domProps:{checked:Array.isArray(t.context.model)?t._i(t.context.model,null)>-1:t.context.model},on:{blur:t.context.blurHandler,change:function(e){var r=t.context.model,o=e.target,i=!!o.checked;if(Array.isArray(r)){var n=t._i(r,null);o.checked?n<0&&t.$set(t.context,"model",r.concat([null])):n>-1&&t.$set(t.context,"model",r.slice(0,n).concat(r.slice(n+1)))}else t.$set(t.context,"model",i)}}},"input",t.attributes,!1)):"radio"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"radio"},domProps:{checked:t._q(t.context.model,null)},on:{blur:t.context.blurHandler,change:function(e){return t.$set(t.context,"model",null)}}},"input",t.attributes,!1)):r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:t.type},domProps:{value:t.context.model},on:{blur:t.context.blurHandler,input:function(e){e.target.composing||t.$set(t.context,"model",e.target.value)}}},"input",t.attributes,!1))])};H._withStripped=!0;var q=F({render:H,staticRenderFns:[]},void 0,T,void 0,!1,void 0,!1,void 0,void 0,void 0),G={name:"FormulateFiles",props:{files:{type:s,required:!0},imagePreview:{type:Boolean,default:!1}},computed:{fileUploads:function(){return this.files.files||[]}},watch:{files:function(){this.imagePreview&&this.files.loadPreviews()}},mounted:function(){this.imagePreview&&this.files.loadPreviews()}},W=function(){var t=this,e=t.$createElement,r=t._self._c||e;return t.fileUploads.length?r("ul",{staticClass:"formulate-files"},t._l(t.fileUploads,(function(e){return r("li",{key:e.uuid,attrs:{"data-has-error":!!e.error,"data-has-preview":!(!t.imagePreview||!e.previewData)}},[r("div",{staticClass:"formulate-file"},[t.imagePreview&&e.previewData?r("div",{staticClass:"formulate-file-image-preview"},[r("img",{attrs:{src:e.previewData}})]):t._e(),t._v(" "),r("div",{staticClass:"formulate-file-name",attrs:{title:e.name},domProps:{textContent:t._s(e.name)}}),t._v(" "),!1!==e.progress?r("div",{staticClass:"formulate-file-progress",attrs:{"data-just-finished":e.justFinished,"data-is-finished":!e.justFinished&&e.complete}},[r("div",{staticClass:"formulate-file-progress-inner",style:{width:e.progress+"%"}})]):t._e(),t._v(" "),e.complete&&!e.justFinished||!1===e.progress?r("div",{staticClass:"formulate-file-remove",on:{click:e.removeFile}}):t._e()]),t._v(" "),e.error?r("div",{staticClass:"formulate-file-upload-error",domProps:{textContent:t._s(e.error)}}):t._e()])})),0):t._e()};W._withStripped=!0;var Y={name:"FormulateInputFile",components:{FormulateFiles:F({render:W,staticRenderFns:[]},void 0,G,void 0,!1,void 0,!1,void 0,void 0,void 0)},mixins:[B],data:function(){return{isOver:!1}},computed:{hasFiles:function(){return!!(this.context.model instanceof s&&this.context.model.files.length)}},created:function(){Array.isArray(this.context.model)&&"string"==typeof this.context.model[0][this.$formulate.getFileUrlKey()]&&(this.context.model=this.$formulate.createUpload({files:this.context.model},this.context))},mounted:function(){window&&this.context.preventWindowDrops&&(window.addEventListener("dragover",this.preventDefault),window.addEventListener("drop",this.preventDefault))},destroyed:function(){window&&this.context.preventWindowDrops&&(window.removeEventListener("dragover",this.preventDefault),window.removeEventListener("drop",this.preventDefault))},methods:{preventDefault:function(t){"INPUT"!==t.target.tagName&&"file"!==t.target.getAttribute("type")&&(t=t||event).preventDefault()},handleFile:function(){var t=this;this.isOver=!1;var e=this.$refs.file;e.files.length&&(this.context.model=this.$formulate.createUpload(e,this.context),this.$nextTick((function(){return t.attemptImmediateUpload()})))},attemptImmediateUpload:function(){var t=this;"live"===this.context.uploadBehavior&&this.context.model instanceof s&&this.context.hasValidationErrors().then((function(e){e||t.context.model.upload()}))},handleDragOver:function(t){t.preventDefault(),this.isOver=!0},handleDragLeave:function(t){t.preventDefault(),this.isOver=!1}}},z=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type,"data-has-files":t.hasFiles}},[r("div",{staticClass:"formulate-input-upload-area",attrs:{"data-has-files":t.hasFiles}},[r("input",t._b({ref:"file",attrs:{"data-is-drag-hover":t.isOver,type:"file"},on:{blur:t.context.blurHandler,change:t.handleFile,dragover:t.handleDragOver,dragleave:t.handleDragLeave}},"input",t.attributes,!1)),t._v(" "),r("div",{directives:[{name:"show",rawName:"v-show",value:!t.hasFiles,expression:"!hasFiles"}],staticClass:"formulate-input-upload-area-mask"}),t._v(" "),t.hasFiles?r("FormulateFiles",{attrs:{files:t.context.model,"image-preview":"image"===t.context.type&&"preview"===t.context.imageBehavior}}):t._e()],1)])};z._withStripped=!0;var K=F({render:z,staticRenderFns:[]},void 0,Y,void 0,!1,void 0,!1,void 0,void 0,void 0),Z={name:"FormulateInputButton",mixins:[B]},J=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type}},[r("button",t._b({attrs:{type:t.type}},"button",t.attributes,!1),[t._t("default",[r("span",{class:"formulate-input-element--"+t.context.type+"--label",domProps:{textContent:t._s(t.context.value||t.context.label||t.context.name||"Submit")}})])],2)])};J._withStripped=!0;var X=F({render:J,staticRenderFns:[]},void 0,Z,void 0,!1,void 0,!1,void 0,void 0,void 0),Q={name:"FormulateInputSelect",mixins:[B],computed:{options:function(){return this.context.options||{}},optionGroups:function(){return this.context.optionGroups||!1},placeholderSelected:function(){return!(this.hasValue||!this.context.attributes||!this.context.attributes.placeholder)}}},tt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type}},[r("select",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{"data-placeholder-selected":t.placeholderSelected},on:{blur:t.context.blurHandler,change:function(e){var r=Array.prototype.filter.call(e.target.options,(function(t){return t.selected})).map((function(t){return"_value"in t?t._value:t.value}));t.$set(t.context,"model",e.target.multiple?r:r[0])}}},"select",t.attributes,!1),[t.context.placeholder?r("option",{attrs:{value:"",disabled:""},domProps:{selected:!t.hasValue}},[t._v("\n "+t._s(t.context.placeholder)+"\n ")]):t._e(),t._v(" "),t.optionGroups?t._l(t.optionGroups,(function(e,o){return r("optgroup",{key:o,attrs:{label:o}},t._l(e,(function(e){return r("option",t._b({key:e.id,domProps:{value:e.value,textContent:t._s(e.label)}},"option",e.attributes||{},!1))})),0)})):t._l(t.options,(function(e){return r("option",t._b({key:e.id,domProps:{value:e.value,textContent:t._s(e.label)}},"option",e.attributes||{},!1))}))],2)])};tt._withStripped=!0;var et=F({render:tt,staticRenderFns:[]},void 0,Q,void 0,!1,void 0,!1,void 0,void 0,void 0),rt={name:"FormulateInputSlider",mixins:[B]},ot=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type}},["checkbox"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"checkbox"},domProps:{checked:Array.isArray(t.context.model)?t._i(t.context.model,null)>-1:t.context.model},on:{blur:t.context.blurHandler,change:function(e){var r=t.context.model,o=e.target,i=!!o.checked;if(Array.isArray(r)){var n=t._i(r,null);o.checked?n<0&&t.$set(t.context,"model",r.concat([null])):n>-1&&t.$set(t.context,"model",r.slice(0,n).concat(r.slice(n+1)))}else t.$set(t.context,"model",i)}}},"input",t.attributes,!1)):"radio"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"radio"},domProps:{checked:t._q(t.context.model,null)},on:{blur:t.context.blurHandler,change:function(e){return t.$set(t.context,"model",null)}}},"input",t.attributes,!1)):r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:t.type},domProps:{value:t.context.model},on:{blur:t.context.blurHandler,input:function(e){e.target.composing||t.$set(t.context,"model",e.target.value)}}},"input",t.attributes,!1)),t._v(" "),t.context.showValue?r("div",{staticClass:"formulate-input-element-range-value",domProps:{textContent:t._s(t.context.model)}}):t._e()])};ot._withStripped=!0;var it=F({render:ot,staticRenderFns:[]},void 0,rt,void 0,!1,void 0,!1,void 0,void 0,void 0),nt={name:"FormulateInputTextArea",mixins:[B]},st=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"formulate-input-element formulate-input-element--textarea",attrs:{"data-type":"textarea"}},[r("textarea",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],domProps:{value:t.context.model},on:{blur:t.context.blurHandler,input:function(e){e.target.composing||t.$set(t.context,"model",e.target.value)}}},"textarea",t.attributes,!1))])};st._withStripped=!0;var at=F({render:st,staticRenderFns:[]},void 0,nt,void 0,!1,void 0,!1,void 0,void 0,void 0),lt=function(){this.options={},this.defaults={components:{FormulateForm:j,FormulateInput:V,FormulateErrors:k,FormulateInputBox:R,FormulateInputText:q,FormulateInputFile:K,FormulateInputGroup:I,FormulateInputButton:X,FormulateInputSelect:et,FormulateInputSlider:it,FormulateInputTextArea:at},library:n,rules:f,mimes:m,locale:!1,uploader:v,uploadUrl:!1,fileUrlKey:"url",uploadJustCompleteDuration:1e3,errorHandler:function(t){return t},plugins:[o.en],locales:{}},this.registry=new Map};return lt.prototype.install=function(t,e){var r=this;t.prototype.$formulate=this,this.options=this.defaults;var o=this.defaults.plugins;for(var i in e&&Array.isArray(e.plugins)&&e.plugins.length&&(o=o.concat(e.plugins)),o.forEach((function(t){return"function"==typeof t?t(r):null})),this.extend(e||{}),this.options.components)t.component(i,this.options.components[i])},lt.prototype.extend=function(t){if("object"==typeof t)return this.options=this.merge(this.options,t),this;throw new Error("VueFormulate extend() should be passed an object (was "+typeof t+")")},lt.prototype.merge=function(t,e,o){void 0===o&&(o=!0);var i={};for(var n in t)e.hasOwnProperty(n)?r(e[n])&&r(t[n])?i[n]=this.merge(t[n],e[n],o):o&&Array.isArray(t[n])&&Array.isArray(e[n])?i[n]=t[n].concat(e[n]):i[n]=e[n]:i[n]=t[n];for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i},lt.prototype.classify=function(t){return this.options.library.hasOwnProperty(t)?this.options.library[t].classification:"unknown"},lt.prototype.component=function(t){return!!this.options.library.hasOwnProperty(t)&&this.options.library[t].component},lt.prototype.rules=function(t){return void 0===t&&(t={}),Object.assign({},this.options.rules,t)},lt.prototype.i18n=function(t){if(t.$i18n)switch(typeof t.$i18n.locale){case"string":return t.$i18n.locale;case"function":return t.$i18n.locale()}return!1},lt.prototype.getLocale=function(t){var e=this;return this.selectedLocale||(this.selectedLocale=[this.options.locale,this.i18n(t),"en"].reduce((function(t,r){if(t)return t;if(r){var o=function(t){return t.split("-").reduce((function(t,e){return t.length&&t.unshift(t[0]+"-"+e),t.length?t:[e]}),[])}(r).find((function(t){return Object.prototype.hasOwnProperty.call(e.options.locales,t)}));o&&(t=o)}return t}),!1)),this.selectedLocale},lt.prototype.validationMessage=function(t,e,r){var o=this.options.locales[this.getLocale(r)];return o.hasOwnProperty(t)?o[t](e):"_"===t[0]&&o.hasOwnProperty(t.substr(1))?o[t.substr(1)](e):o.hasOwnProperty("default")?o.default(e):"This field does not have a valid value"},lt.prototype.register=function(t){"FormulateForm"===t.$options.name&&t.name&&this.registry.set(t.name,t)},lt.prototype.deregister=function(t){"FormulateForm"===t.$options.name&&t.name&&this.registry.has(t.name)&&this.registry.delete(t.name)},lt.prototype.handle=function(t,e,r){void 0===r&&(r=!1);var o=r?t:this.options.errorHandler(t);return e&&this.registry.has(e)&&this.registry.get(e).applyErrors({formErrors:c(o.formErrors),inputErrors:o.inputErrors||{}}),o},lt.prototype.getUploader=function(){return this.options.uploader||!1},lt.prototype.getUploadUrl=function(){return this.options.uploadUrl||!1},lt.prototype.getFileUrlKey=function(){return this.options.fileUrlKey||"url"},lt.prototype.createUpload=function(t,e){return new s(t,e,this.options)},new lt})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("is-url"),require("nanoid/non-secure"),require("is-plain-object"),require("@braid/vue-formulate-i18n")):"function"==typeof define&&define.amd?define(["is-url","nanoid/non-secure","is-plain-object","@braid/vue-formulate-i18n"],e):(t=t||self).Formulate=e(t.isUrl,t.nanoid,t.isPlainObject,t.VueFormulateI18n)}(this,(function(t,e,r,o){"use strict";t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t,e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e,r=r&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r;var i=function(t,e){return{classification:t,component:"FormulateInput"+(e||t[0].toUpperCase()+t.substr(1))}},n=Object.assign({},["text","email","number","color","date","hidden","month","password","search","tel","time","url","week","datetime-local"].reduce((function(t,e){var r;return Object.assign({},t,((r={})[e]=i("text"),r))}),{}),{range:i("slider"),textarea:i("textarea","TextArea"),checkbox:i("box"),radio:i("box"),submit:i("button"),button:i("button"),select:i("select"),file:i("file"),image:i("file"),group:i("group")}),s=function(t,e,r){void 0===r&&(r={}),this.input=t,this.fileList=t.files,this.files=[],this.options=Object.assign({},{mimes:{}},r),this.results=!1,this.context=e,Array.isArray(this.fileList)?this.rehydrateFileList(this.fileList):this.addFileList(this.fileList)};function a(t,e){var r={};for(var o in t)r[o]=e(o,t[o]);return r}function l(t,e){if(t===e)return!0;if(!t||!e)return!1;var r=Object.keys(t),o=Object.keys(e),i=r.length;if(o.length!==i)return!1;for(var n=0;n=100&&(e.complete||(e.justFinished=!0,setTimeout((function(){e.justFinished=!1}),t.options.uploadJustCompleteDuration)),e.complete=!0)}),(function(t){e.progress=0,e.error=t,e.complete=!0}),t.options)}))).then((function(r){t.results=r,e(r)})).catch((function(t){throw new Error(t)}))}))},s.prototype.removeFile=function(t){if(this.files=this.files.filter((function(e){return e.uuid!==t})),this.context.performValidation(),window&&this.fileList instanceof FileList){var e=new DataTransfer;this.files.map((function(t){return e.items.add(t.file)})),this.fileList=e.files,this.input.files=this.fileList}},s.prototype.loadPreviews=function(){this.files.map((function(t){if(!t.previewData&&window&&window.FileReader&&/^image\//.test(t.file.type)){var e=new FileReader;e.onload=function(e){return Object.assign(t,{previewData:e.target.result})},e.readAsDataURL(t.file)}}))},s.prototype.getFileList=function(){return this.fileList},s.prototype.getFiles=function(){return this.files},s.prototype.toString=function(){var t=this.files.length?this.files.length+" files":"empty";return this.results?JSON.stringify(this.results,null," "):"FileUpload("+t+")"};var m={accepted:function(t){var e=t.value;return Promise.resolve(["yes","on","1",1,!0,"true"].includes(e))},after:function(t,e){var r=t.value;void 0===e&&(e=!1);var o=Date.parse(e||new Date),i=Date.parse(r);return Promise.resolve(!isNaN(i)&&i>o)},alpha:function(t,e){var r=t.value;void 0===e&&(e="default");var o={default:/^[a-zA-ZÀ-ÖØ-öø-ÿ]+$/,latin:/^[a-zA-Z]+$/},i=o.hasOwnProperty(e)?e:"default";return Promise.resolve(o[i].test(r))},alphanumeric:function(t,e){var r=t.value;void 0===e&&(e="default");var o={default:/^[a-zA-Z0-9À-ÖØ-öø-ÿ]+$/,latin:/^[a-zA-Z0-9]+$/},i=o.hasOwnProperty(e)?e:"default";return Promise.resolve(o[i].test(r))},before:function(t,e){var r=t.value;void 0===e&&(e=!1);var o=Date.parse(e||new Date),i=Date.parse(r);return Promise.resolve(!isNaN(i)&&ie&&ie&&i.length()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test(e))},endsWith:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve("string"==typeof e&&r.length?void 0!==r.find((function(t){return e.endsWith(t)})):"string"==typeof e&&0===r.length)},in:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(void 0!==r.find((function(t){return"object"==typeof t?l(t,e):t===e})))},matches:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(!!r.find((function(t){return"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===e})))},mime:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(function(){if(e instanceof s)for(var t=e.getFiles(),o=0;o=e):!isNaN(o)&&"length"!==r||"value"===r?(o=isNaN(o)?o:Number(o))>=e:("string"==typeof o||"length"===r)&&(o=isNaN(o)?o:o.toString()).length>=e)},max:function(t,e,r){var o=t.value;return void 0===e&&(e=10),Promise.resolve(Array.isArray(o)?(e=isNaN(e)?e:Number(e),o.length<=e):!isNaN(o)&&"length"!==r||"value"===r?(o=isNaN(o)?o:Number(o))<=e:("string"==typeof o||"length"===r)&&(o=isNaN(o)?o:o.toString()).length<=e)},not:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve(void 0===r.find((function(t){return"object"==typeof t?l(t,e):t===e})))},number:function(t){var e=t.value;return Promise.resolve(!isNaN(e))},required:function(t,e){var r=t.value;return void 0===e&&(e=!0),Promise.resolve(!(e&&!["no","false"].includes(e))||(Array.isArray(r)?!!r.length:r instanceof s?r.getFiles().length>0:"string"==typeof r?!!r:"object"!=typeof r||!!r&&!!Object.keys(r).length))},startsWith:function(t){for(var e=t.value,r=[],o=arguments.length-1;o-- >0;)r[o]=arguments[o+1];return Promise.resolve("string"==typeof e&&r.length?void 0!==r.find((function(t){return e.startsWith(t)})):"string"==typeof e&&0===r.length)},url:function(e){var r=e.value;return Promise.resolve(t(r))},bail:function(){return Promise.resolve(!0)}},v="image/",y={csv:"text/csv",gif:v+"gif",jpg:v+"jpeg",jpeg:v+"jpeg",png:v+"png",pdf:"application/pdf",svg:v+"svg+xml"};function b(t,e,r,o){return new Promise((function(r,i){var n=(o.fauxUploaderDuration||2e3)*(.5+Math.random()),s=performance.now(),a=function(){return setTimeout((function(){var o=performance.now()-s,i=Math.min(100,Math.round(o/n*100));if(e(i),i>=100)return r({url:"http://via.placeholder.com/350x150.png",name:t.name});a()}),20)};a()}))}function g(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&-1===e.indexOf(o)&&(r[o]=t[o]);return r}var x={inheritAttrs:!1,functional:!0,render:function(t,e){for(var r=e.props,o=e.data,i=e.parent,n=e.children,s=i,a=(r.name,r.forceWrap),l=r.context,u=g(r,["name","forceWrap","context"]);s&&"FormulateInput"!==s.$options.name;)s=s.$parent;if(!s)return null;if(s.$scopedSlots&&s.$scopedSlots[r.name])return s.$scopedSlots[r.name](Object.assign({},l,u));if(Array.isArray(n)&&(n.length>1||a&&n.length>0)){var c=o.attrs,d=(c.name,c.context,g(c,["name","context"]));return t("div",Object.assign({},o,{attrs:d}),n)}return Array.isArray(n)&&1===n.length?n[0]:null}};function E(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&-1===e.indexOf(o)&&(r[o]=t[o]);return r}var w=function(t){this.registry=new Map,this.ctx=t};function _(t){return new w(t).dataProps()}function F(){return{hasInitialValue:function(){return this.formulateValue&&"object"==typeof this.formulateValue||this.values&&"object"==typeof this.values||this.isGrouping&&"object"==typeof this.context.model[this.index]},isVmodeled:function(){return!!(this.$options.propsData.hasOwnProperty("formulateValue")&&this._events&&Array.isArray(this._events.input)&&this._events.input.length)},initialValues:function(){return f(this.$options.propsData,"formulateValue")&&"object"==typeof this.formulateValue?Object.assign({},this.formulateValue):f(this.$options.propsData,"values")&&"object"==typeof this.values?Object.assign({},this.values):this.isGrouping&&"object"==typeof this.context.model[this.index]?this.context.model[this.index]:{}}}}function O(t){void 0===t&&(t=[]);var e={applyInitialValues:function(){this.hasInitialValue&&(this.proxy=this.initialValues)},setFieldValue:function(t,e){var r;if(void 0===e){var o=this.proxy,i=(o[t],E(o,[String(t)]));this.proxy=i}else Object.assign(this.proxy,((r={})[t]=e,r));this.$emit("input",Object.assign({},this.proxy))},getFormValues:function(){return this.proxy},hasValidationErrors:function(){return Promise.all(this.registry.reduce((function(t,e,r){return t.push(e.performValidation()&&e.getValidationErrors()),t}),[])).then((function(t){return t.some((function(t){return t.hasErrors}))}))},showErrors:function(){this.childrenShouldShowErrors=!0,this.registry.map((function(t){t.formShouldShowErrors=!0}))},hideErrors:function(){this.childrenShouldShowErrors=!1,this.registry.map((function(t){t.formShouldShowErrors=!1,t.behavioralErrorVisibility=!1}))},setValues:function(t){var e=this;Array.from(new Set(Object.keys(t).concat(Object.keys(this.proxy)))).forEach((function(r){!e.registry.has(r)||l(t[r],e.proxy[r])||l(t[r],e.registry.get(r).proxy)||(e.setFieldValue(r,t[r]),e.registry.get(r).context.model=t[r])}))}};return Object.keys(e).reduce((function(r,o){var i;return t.includes(o)?r:Object.assign({},r,((i={})[o]=e[o],i))}),{})}function V(t){return{formulateSetter:t.setFieldValue,formulateRegister:t.register,formulateDeregister:t.deregister,getFormValues:t.getFormValues}}w.prototype.add=function(t,e){return this.registry.set(t,e),this},w.prototype.remove=function(t){this.registry.delete(t);var e=this.ctx.proxy,r=(e[t],E(e,[String(t)]));return this.ctx.proxy=r,this},w.prototype.has=function(t){return this.registry.has(t)},w.prototype.get=function(t){return this.registry.get(t)},w.prototype.map=function(t){var e={};return this.registry.forEach((function(r,o){var i;return Object.assign(e,((i={})[o]=t(r,o),i))})),e},w.prototype.keys=function(){return Array.from(this.registry.keys())},w.prototype.register=function(t,e){if(this.registry.has(t))return!1;this.registry.set(t,e);var r=f(e.$options.propsData,"formulateValue"),o=f(e.$options.propsData,"value");!r&&this.ctx.hasInitialValue&&this.ctx.initialValues[t]?e.context.model=this.ctx.initialValues[t]:!r&&!o||l(e.proxy,this.ctx.initialValues[t])||this.ctx.setFieldValue(t,e.proxy),this.childrenShouldShowErrors&&(e.formShouldShowErrors=!0)},w.prototype.reduce=function(t,e){return this.registry.forEach((function(r,o){e=t(e,r,o)})),e},w.prototype.dataProps=function(){var t=this;return{proxy:{},registry:this,register:this.register.bind(this),deregister:function(e){return t.remove(e)},childrenShouldShowErrors:!1}};var P=function(t){this.form=t};function A(t,e,r,o,i,n,s,a,l,u){"boolean"!=typeof s&&(l=a,a=s,s=!1);var c,d="function"==typeof r?r.options:r;if(t&&t.render&&(d.render=t.render,d.staticRenderFns=t.staticRenderFns,d._compiled=!0,i&&(d.functional=!0)),o&&(d._scopeId=o),n?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,l(t)),t&&t._registeredComponents&&t._registeredComponents.add(n)},d._ssrRegister=c):e&&(c=s?function(t){e.call(this,u(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,a(t))}),c)if(d.functional){var p=d.render;d.render=function(t,e){return c.call(e),p(t,e)}}else{var h=d.beforeCreate;d.beforeCreate=h?[].concat(h,c):[c]}return r}P.prototype.hasValidationErrors=function(){return this.form.hasValidationErrors()},P.prototype.values=function(){var t=this;return new Promise((function(e,r){var o=[],i=function t(e){if("object"!=typeof e)return e;var r=Array.isArray(e)?[]:{};for(var o in e)e[o]instanceof s||h(e[o])?r[o]=e[o]:r[o]=t(e[o]);return r}(t.form.proxy),n=function(e){"object"==typeof t.form.proxy[e]&&t.form.proxy[e]instanceof s&&o.push(t.form.proxy[e].upload().then((function(t){var r;return Object.assign(i,((r={})[e]=t,r))})))};for(var a in i)n(a);Promise.all(o).then((function(){return e(i)})).catch((function(t){return r(t)}))}))};var S={provide:function(){return Object.assign({},V(this),{observeErrors:this.addErrorObserver,removeErrorObserver:this.removeErrorObserver,formulateFieldValidation:this.formulateFieldValidation})},name:"FormulateForm",model:{prop:"formulateValue",event:"input"},props:{name:{type:[String,Boolean],default:!1},formulateValue:{type:Object,default:function(){return{}}},values:{type:[Object,Boolean],default:!1},errors:{type:[Object,Boolean],default:!1},formErrors:{type:Array,default:function(){return[]}}},data:function(){return Object.assign({},_(this),{formShouldShowErrors:!1,errorObservers:[],namedErrors:[],namedFieldErrors:{}})},computed:Object.assign({},F(),{formContext:function(){return{errors:this.mergedFormErrors}},classes:function(){var t={"formulate-form":!0};return this.name&&(t["formulate-form--"+this.name]=!0),t},mergedFormErrors:function(){return this.formErrors.concat(this.namedErrors)},mergedFieldErrors:function(){var t={};if(this.errors)for(var e in this.errors)t[e]=c(this.errors[e]);for(var r in this.namedFieldErrors)t[r]=c(this.namedFieldErrors[r]);return t},hasFormErrorObservers:function(){return!!this.errorObservers.filter((function(t){return"form"===t.type})).length}}),watch:{formulateValue:{handler:function(t){this.isVmodeled&&t&&"object"==typeof t&&this.setValues(t)},deep:!0},mergedFormErrors:function(t){this.errorObservers.filter((function(t){return"form"===t.type})).forEach((function(e){return e.callback(t)}))},mergedFieldErrors:{handler:function(t){this.errorObservers.filter((function(t){return"input"===t.type})).forEach((function(e){return e.callback(t[e.field]||[])}))},immediate:!0}},created:function(){this.$formulate.register(this),this.applyInitialValues()},destroyed:function(){this.$formulate.deregister(this)},methods:Object.assign({},O(),{applyErrors:function(t){var e=t.formErrors,r=t.inputErrors;this.namedErrors=e,this.namedFieldErrors=r},addErrorObserver:function(t){this.errorObservers.find((function(e){return t.callback===e.callback}))||(this.errorObservers.push(t),"form"===t.type?t.callback(this.mergedFormErrors):f(this.mergedFieldErrors,t.field)&&t.callback(this.mergedFieldErrors[t.field]))},removeErrorObserver:function(t){this.errorObservers=this.errorObservers.filter((function(e){return e.callback!==t}))},registerErrorComponent:function(t){this.errorComponents.includes(t)||this.errorComponents.push(t)},formSubmitted:function(){var t=this;this.showErrors();var e=new P(this);return this.$emit("submit-raw",e),e.hasValidationErrors().then((function(t){return t?void 0:e.values()})).then((function(e){if(void 0!==e)return t.$emit("submit",e),e}))},formulateFieldValidation:function(t){this.$emit("validation",t)}})},$=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("form",{class:t.classes,on:{submit:function(e){return e.preventDefault(),t.formSubmitted(e)}}},[t.hasFormErrorObservers?t._e():r("FormulateErrors",{attrs:{context:t.formContext}}),t._v(" "),t._t("default")],2)};$._withStripped=!0;var j=A({render:$,staticRenderFns:[]},void 0,S,void 0,!1,void 0,!1,void 0,void 0,void 0),C={context:function(){return N.call(this,Object.assign({},{addLabel:this.logicalAddLabel,attributes:this.elementAttributes,blurHandler:k.bind(this),classification:this.classification,component:this.component,disableErrors:this.disableErrors,errors:this.explicitErrors,formShouldShowErrors:this.formShouldShowErrors,getValidationErrors:this.getValidationErrors.bind(this),hasGivenName:this.hasGivenName,hasLabel:this.label&&"button"!==this.classification,hasValidationErrors:this.hasValidationErrors.bind(this),help:this.help,helpPosition:this.logicalHelpPosition,id:this.id||this.defaultId,imageBehavior:this.imageBehavior,label:this.label,labelPosition:this.logicalLabelPosition,limit:this.limit,name:this.nameOrFallback,performValidation:this.performValidation.bind(this),preventWindowDrops:this.preventWindowDrops,repeatable:this.repeatable,setErrors:this.setErrors.bind(this),showValidationErrors:this.showValidationErrors,slotComponents:this.slotComponents,type:this.type,uploadBehavior:this.uploadBehavior,uploadUrl:this.mergedUploadUrl,uploader:this.uploader||this.$formulate.getUploader(),validationErrors:this.validationErrors,value:this.value,visibleValidationErrors:this.visibleValidationErrors,isSubField:this.isSubField},this.typeContext))},nameOrFallback:function(){if(!0===this.name&&"button"!==this.classification)return this.type+"_"+this.elementAttributes.id;if(!1===this.name||"button"===this.classification&&!0===this.name)return!1;return this.name},hasGivenName:function(){return"boolean"!=typeof this.name},typeContext:function(){var t=this;switch(this.classification){case"select":return{options:R.call(this,this.options),optionGroups:!!this.optionGroups&&a(this.optionGroups,(function(e,r){return R.call(t,r)})),placeholder:this.$attrs.placeholder||!1};case"slider":return{showValue:!!this.showValue};default:return this.options?{options:R.call(this,this.options)}:{}}},elementAttributes:function(){var t=Object.assign({},this.localAttributes);this.id?t.id=this.id:t.id=this.defaultId;this.hasGivenName&&(t.name=this.name);this.help&&(t["aria-describedby"]=t.id+"-help");return t},logicalLabelPosition:function(){if(this.labelPosition)return this.labelPosition;switch(this.classification){case"box":return"after";default:return"before"}},logicalHelpPosition:function(){if(this.helpPosition)return this.helpPosition;switch(this.classification){case"group":return"before";default:return"after"}},mergedUploadUrl:function(){return this.uploadUrl||this.$formulate.getUploadUrl()},isVmodeled:function(){return!!(this.$options.propsData.hasOwnProperty("formulateValue")&&this._events&&Array.isArray(this._events.input)&&this._events.input.length)},mergedValidationName:function(){if(this.validationName)return this.validationName;if("string"==typeof this.name)return this.name;if(this.label)return this.label;return this.type},explicitErrors:function(){return c(this.errors).concat(this.localErrors).concat(c(this.error))},allErrors:function(){return this.explicitErrors.concat(c(this.validationErrors))},hasErrors:function(){return!!this.allErrors.length},hasVisibleErrors:function(){return this.validationErrors&&this.showValidationErrors||!!this.explicitErrors.length},showValidationErrors:function(){if(this.showErrors||this.formShouldShowErrors)return!0;if("file"===this.classification&&"live"===this.uploadBehavior&&I.call(this))return!0;return this.behavioralErrorVisibility},visibleValidationErrors:function(){return this.showValidationErrors&&this.validationErrors.length?this.validationErrors:[]},slotComponents:function(){return{label:this.$formulate.slotComponent(this.type,"label"),help:this.$formulate.slotComponent(this.type,"help"),errors:this.$formulate.slotComponent(this.type,"errors"),repeatable:this.$formulate.slotComponent(this.type,"repeatable"),addMore:this.$formulate.slotComponent(this.type,"addMore")}},logicalAddLabel:function(){if("boolean"==typeof this.addLabel)return"+ "+(this.label||this.name||"Add");return this.addLabel}};function R(t){if(!Array.isArray(t)&&t&&"object"==typeof t){var e=[];for(var r in t)e.push({value:r,label:t[r],id:this.elementAttributes.id+"_"+r});return e}return t}function k(){this.$emit("blur"),"blur"===this.errorBehavior&&(this.behavioralErrorVisibility=!0)}function N(t){return Object.defineProperty(t,"model",{get:I.bind(this),set:D.bind(this)})}function I(){var t=this.isVmodeled?"formulateValue":"proxy";return"checkbox"===this.type&&!Array.isArray(this[t])&&this.options?[]:this[t]?this[t]:""}function D(t){l(t,this.proxy)||(this.proxy=t),this.$emit("input",t),this.context.name&&"function"==typeof this.formulateSetter&&this.formulateSetter(this.context.name,t)}var L={name:"FormulateInput",inheritAttrs:!1,provide:function(){return{formulateRegisterRule:this.registerRule,formulateRemoveRule:this.removeRule}},inject:{formulateSetter:{default:void 0},formulateFieldValidation:{default:function(){return function(){return{}}}},formulateRegister:{default:void 0},formulateDeregister:{default:void 0},getFormValues:{default:function(){return function(){return{}}}},observeErrors:{default:void 0},removeErrorObserver:{default:void 0},isSubField:{default:function(){return function(){return!1}}}},model:{prop:"formulateValue",event:"input"},props:{type:{type:String,default:"text"},name:{type:[String,Boolean],default:!0},formulateValue:{default:""},value:{default:!1},options:{type:[Object,Array,Boolean],default:!1},optionGroups:{type:[Object,Boolean],default:!1},id:{type:[String,Boolean,Number],default:!1},label:{type:[String,Boolean],default:!1},labelPosition:{type:[String,Boolean],default:!1},limit:{type:Number,default:1/0},help:{type:[String,Boolean],default:!1},helpPosition:{type:[String,Boolean],default:!1},errors:{type:[String,Array,Boolean],default:!1},repeatable:{type:Boolean,default:!1},validation:{type:[String,Boolean,Array],default:!1},validationName:{type:[String,Boolean],default:!1},error:{type:[String,Boolean],default:!1},errorBehavior:{type:String,default:"blur",validator:function(t){return["blur","live","submit"].includes(t)}},showErrors:{type:Boolean,default:!1},imageBehavior:{type:String,default:"preview"},uploadUrl:{type:[String,Boolean],default:!1},uploader:{type:[Function,Object,Boolean],default:!1},uploadBehavior:{type:String,default:"live"},preventWindowDrops:{type:Boolean,default:!0},showValue:{type:[String,Boolean],default:!1},validationMessages:{type:Object,default:function(){return{}}},validationRules:{type:Object,default:function(){return{}}},checked:{type:[String,Boolean],default:!1},disableErrors:{type:Boolean,default:!1},addLabel:{type:[Boolean,String],default:!1}},data:function(){return{defaultId:this.$formulate.nextId(this),localAttributes:{},localErrors:[],proxy:this.getInitialValue(),behavioralErrorVisibility:"live"===this.errorBehavior,formShouldShowErrors:!1,validationErrors:[],pendingValidation:Promise.resolve(),ruleRegistry:[],messageRegistry:{}}},computed:Object.assign({},C,{classification:function(){var t=this.$formulate.classify(this.type);return"box"===t&&this.options?"group":t},component:function(){return"group"===this.classification?"FormulateInputGroup":this.$formulate.component(this.type)},parsedValidationRules:function(){var t=this,e={};return Object.keys(this.validationRules).forEach((function(r){e[u(r)]=t.validationRules[r]})),e},messages:function(){var t=this,e={};return Object.keys(this.validationMessages).forEach((function(r){e[u(r)]=t.validationMessages[r]})),Object.keys(this.messageRegistry).forEach((function(r){e[u(r)]=t.messageRegistry[r]})),e}}),watch:{$attrs:{handler:function(t){this.updateLocalAttributes(t)},deep:!0},proxy:function(t,e){this.performValidation(),this.isVmodeled||l(t,e)||(this.context.model=t)},formulateValue:function(t,e){this.isVmodeled&&!l(t,e)&&(this.context.model=t)},showValidationErrors:{handler:function(t){this.$emit("error-visibility",t)},immediate:!0}},created:function(){this.applyInitialValue(),this.formulateRegister&&"function"==typeof this.formulateRegister&&this.formulateRegister(this.nameOrFallback,this),this.disableErrors||"function"!=typeof this.observeErrors||this.observeErrors({callback:this.setErrors,type:"input",field:this.nameOrFallback}),this.updateLocalAttributes(this.$attrs),this.performValidation()},beforeDestroy:function(){this.disableErrors||"function"!=typeof this.removeErrorObserver||this.removeErrorObserver(this.setErrors),"function"==typeof this.formulateDeregister&&this.formulateDeregister(this.nameOrFallback)},methods:{getInitialValue:function(){var t=this.$formulate.classify(this.type);return"box"===(t="box"===t&&this.options?"group":t)&&this.checked?this.value||!0:f(this.$options.propsData,"value")&&"box"!==t?this.value:f(this.$options.propsData,"formulateValue")?this.formulateValue:""},applyInitialValue:function(){!l(this.context.model,this.proxy)&&Object.prototype.hasOwnProperty(this.$options.propsData,"options")&&"box"===this.classification&&(this.context.model=this.proxy)},updateLocalAttributes:function(t){l(t,this.localAttributes)||(this.localAttributes=t)},performValidation:function(){var t=this,e=d(this.validation,this.$formulate.rules(this.parsedValidationRules));return e=this.ruleRegistry.length?this.ruleRegistry.concat(e):e,this.pendingValidation=this.runRules(e).then((function(e){return t.didValidate(e)})),this.pendingValidation},runRules:function(t){var e=this,r=function(t){var r=t[0],o=t[1],i=t[2],n=(t[3],r.apply(void 0,[{value:e.context.model,getFormValues:e.getFormValues.bind(e),name:e.context.name}].concat(o)));return(n=n instanceof Promise?n:Promise.resolve(n)).then((function(t){return!t&&e.getMessage(i,o)}))};return new Promise((function(e){var o=function(t,i){void 0===i&&(i=[]);var n=t.shift();Array.isArray(n)&&n.length?Promise.all(n.map(r)).then((function(t){return t.filter((function(t){return!!t}))})).then((function(r){return(r=Array.isArray(r)?r:[]).length&&n.bail||!t.length?e(i.concat(r)):o(t,i.concat(r))})):e([])};o(function(t){var e=[],r=t.findIndex((function(t){return"bail"===t[2].toLowerCase()}));if(r>=0){var o=t.splice(0,r+1).slice(0,-1);o.length&&e.push(o),t.map((function(t){return e.push(Object.defineProperty([t],"bail",{value:!0}))}))}else e.push(t);return e.reduce((function(t,e){var r=function(t,e){if(void 0===e&&(e=!1),t.length<2)return Object.defineProperty([t],"bail",{value:e});var o=[],i=t.findIndex((function(t){return"^"===t[3]}));if(i>=0){var n=t.splice(0,i);n.length&&o.push.apply(o,r(n,e)),o.push(Object.defineProperty([t.shift()],"bail",{value:!0})),t.length&&o.push.apply(o,r(t,e))}else o.push(t);return o};return t.concat(r(e))}),[])}(t))}))},didValidate:function(t){var e=!l(t,this.validationErrors);if(this.validationErrors=t,e){var r=this.getErrorObject();this.$emit("validation",r),this.formulateFieldValidation&&"function"==typeof this.formulateFieldValidation&&this.formulateFieldValidation(r)}},getMessage:function(t,e){return this.getMessageFunc(t)({args:e,name:this.mergedValidationName,value:this.context.model,vm:this,formValues:this.getFormValues()})},getMessageFunc:function(t){var e=this;if(t=u(t),this.messages&&void 0!==this.messages[t])switch(typeof this.messages[t]){case"function":return this.messages[t];case"string":case"boolean":return function(){return e.messages[t]}}return function(r){return e.$formulate.validationMessage(t,r,e)}},hasValidationErrors:function(){var t=this;return new Promise((function(e){t.$nextTick((function(){t.pendingValidation.then((function(){return e(!!t.validationErrors.length)}))}))}))},getValidationErrors:function(){var t=this;return new Promise((function(e){t.$nextTick((function(){return t.pendingValidation.then((function(){return e(t.getErrorObject())}))}))}))},getErrorObject:function(){return{name:this.context.nameOrFallback||this.context.name,errors:this.validationErrors.filter((function(t){return"string"==typeof t})),hasErrors:!!this.validationErrors.length}},setErrors:function(t){this.localErrors=c(t)},registerRule:function(t,e,r,o){void 0===o&&(o=null),this.ruleRegistry.some((function(t){return t[2]===r}))||(this.ruleRegistry.push([t,e,r]),null!==o&&(this.messageRegistry[r]=o))},removeRule:function(t){var e=this.ruleRegistry.findIndex((function(e){return e[2]===t}));e>=0&&(this.ruleRegistry.splice(e,1),delete this.messageRegistry[t])}}},U=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"formulate-input",attrs:{"data-classification":t.classification,"data-has-errors":t.hasErrors,"data-is-showing-errors":t.hasVisibleErrors,"data-type":t.type}},[r("div",{staticClass:"formulate-input-wrapper"},["before"===t.context.labelPosition?t._t("label",[t.context.hasLabel?r(t.context.slotComponents.label,{tag:"component",attrs:{context:t.context}}):t._e()],null,t.context):t._e(),t._v(" "),"before"===t.context.helpPosition?t._t("help",[t.context.help?r(t.context.slotComponents.help,{tag:"component",attrs:{context:t.context}}):t._e()],null,t.context):t._e(),t._v(" "),t._t("element",[r(t.context.component,{tag:"component",attrs:{context:t.context},on:{click:function(e){return t.$emit("click",e)}}},[t._t("default",null,null,t.context)],2)],null,t.context),t._v(" "),"after"===t.context.labelPosition?t._t("label",[t.context.hasLabel?r(t.context.slotComponents.label,{tag:"component",attrs:{context:t.context}}):t._e()],null,t.context):t._e()],2),t._v(" "),"after"===t.context.helpPosition?t._t("help",[t.context.help?r(t.context.slotComponents.help,{tag:"component",attrs:{context:t.context}}):t._e()],null,t.context):t._e(),t._v(" "),t._t("errors",[t.context.disableErrors?t._e():r(t.context.slotComponents.errors,{tag:"component",attrs:{type:"FormulateErrors"===t.context.slotComponents.errors&&"input",context:t.context}})],null,t.context)],2)};U._withStripped=!0;var B=A({render:U,staticRenderFns:[]},void 0,L,void 0,!1,void 0,!1,void 0,void 0,void 0),M={inject:{observeErrors:{default:!1},removeErrorObserver:{default:!1}},props:{context:{type:Object,default:function(){return{}}},type:{type:String,default:"form"}},data:function(){return{boundSetErrors:this.setErrors.bind(this),localErrors:[]}},computed:{visibleValidationErrors:function(){return Array.isArray(this.context.visibleValidationErrors)?this.context.visibleValidationErrors:[]},errors:function(){return Array.isArray(this.context.errors)?this.context.errors:[]},mergedErrors:function(){return this.errors.concat(this.localErrors)},visibleErrors:function(){return Array.from(new Set(this.mergedErrors.concat(this.visibleValidationErrors))).filter((function(t){return"string"==typeof t}))}},created:function(){"form"!==this.type||"function"!=typeof this.observeErrors||Array.isArray(this.context.errors)||this.observeErrors({callback:this.boundSetErrors,type:this.type})},destroyed:function(){"form"!==this.type||"function"!=typeof this.removeErrorObserver||Array.isArray(this.context.errors)||this.removeErrorObserver(this.boundSetErrors)},methods:{setErrors:function(t){this.localErrors=c(t)}}},G=function(){var t=this,e=t.$createElement,r=t._self._c||e;return t.visibleErrors.length?r("ul",{class:"formulate-"+t.type+"-errors"},t._l(t.visibleErrors,(function(e){return r("li",{key:e,class:"formulate-"+t.type+"-error",domProps:{textContent:t._s(e)}})})),0):t._e()};G._withStripped=!0;var q=A({render:G,staticRenderFns:[]},void 0,M,void 0,!1,void 0,!1,void 0,void 0,void 0),H={props:{context:{type:Object,required:!0}}},T=function(){var t=this.$createElement,e=this._self._c||t;return this.context.help?e("div",{class:"formulate-input-help formulate-input-help--"+this.context.helpPosition,attrs:{id:this.context.id+"-help"},domProps:{textContent:this._s(this.context.help)}}):this._e()};T._withStripped=!0;var W=A({render:T,staticRenderFns:[]},void 0,H,void 0,!1,void 0,!1,void 0,void 0,void 0),Y={name:"FormulateGrouping",props:{context:{type:Object,required:!0}},provide:function(){return{isSubField:function(){return!0}}},inject:["formulateRegisterRule","formulateRemoveRule"],computed:{items:function(){return Array.isArray(this.context.model)&&(this.context.repeatable||0!==this.context.model.length)?this.context.model:[{}]},providers:function(){var t=this;return this.items.map((function(e,r){return!!Array.isArray(t.$refs["provider-"+r])&&t.$refs["provider-"+r][0]}))},formShouldShowErrors:function(){return this.context.formShouldShowErrors}},watch:{providers:function(){this.formShouldShowErrors&&this.showErrors()},formShouldShowErrors:function(t){t&&this.showErrors()}},created:function(){this.formulateRegisterRule(this.validateGroup.bind(this),[],"formulateGrouping",!0)},destroyed:function(){this.formulateRemoveRule("formulateGrouping")},methods:{setFieldValue:function(t,e,r){var o,i=Array.isArray(this.context.model)?this.context.model:[];i.splice(t,1,Object.assign({},"object"==typeof this.context.model[t]?this.context.model[t]:{},((o={})[e]=r,o))),this.context.model=i},validateGroup:function(){return Promise.all(this.providers.reduce((function(t,e){return e&&"function"==typeof e.hasValidationErrors&&t.push(e.hasValidationErrors()),t}),[])).then((function(t){return!t.some((function(t){return!!t}))}))},showErrors:function(){this.providers.map((function(t){return t&&"function"==typeof t.showErrors&&t.showErrors()}))},removeItem:function(t){Array.isArray(this.context.model)&&this.context.model.splice(t,1)}}},z=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("FormulateSlot",{staticClass:"formulate-input-grouping",attrs:{name:"grouping",context:t.context,"force-wrap":t.context.repeatable}},t._l(t.items,(function(e,o){return r("FormulateRepeatableProvider",{key:o,ref:"provider-"+o,refInFor:!0,attrs:{index:o,"set-field-value":function(e,r){return t.setFieldValue(o,e,r)},context:t.context},on:{remove:t.removeItem}},[t._t("default")],2)})),1)};z._withStripped=!0;var K=A({render:z,staticRenderFns:[]},void 0,Y,void 0,!1,void 0,!1,void 0,void 0,void 0),Z={props:{context:{type:Object,required:!0}}},J=function(){var t=this.$createElement;return(this._self._c||t)("label",{class:"formulate-input-label formulate-input-label--"+this.context.labelPosition,attrs:{for:this.context.id},domProps:{textContent:this._s(this.context.label)}})};J._withStripped=!0;var X=A({render:J,staticRenderFns:[]},void 0,Z,void 0,!1,void 0,!1,void 0,void 0,void 0),Q={props:{context:{type:Object,required:!0},addMore:{type:Function,required:!0}}},tt=function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"formulate-input-group-add-more"},[e("FormulateInput",{attrs:{type:"button",label:this.context.addLabel,"data-minor":"","data-ghost":""},on:{click:this.addMore}})],1)};tt._withStripped=!0;var et=A({render:tt,staticRenderFns:[]},void 0,Q,void 0,!1,void 0,!1,void 0,void 0,void 0),rt={props:{context:{type:Object,required:!0}},computed:{type:function(){return this.context.type},id:function(){return this.context.id},attributes:function(){return this.context.attributes||{}},hasValue:function(){return!!this.context.model}}},ot={name:"FormulateInputBox",mixins:[rt]},it=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type}},["radio"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"radio"},domProps:{value:t.context.value,checked:t._q(t.context.model,t.context.value)},on:{blur:t.context.blurHandler,change:function(e){return t.$set(t.context,"model",t.context.value)}}},"input",t.attributes,!1)):r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"checkbox"},domProps:{value:t.context.value,checked:Array.isArray(t.context.model)?t._i(t.context.model,t.context.value)>-1:t.context.model},on:{blur:t.context.blurHandler,change:function(e){var r=t.context.model,o=e.target,i=!!o.checked;if(Array.isArray(r)){var n=t.context.value,s=t._i(r,n);o.checked?s<0&&t.$set(t.context,"model",r.concat([n])):s>-1&&t.$set(t.context,"model",r.slice(0,s).concat(r.slice(s+1)))}else t.$set(t.context,"model",i)}}},"input",t.attributes,!1)),t._v(" "),r("label",{staticClass:"formulate-input-element-decorator",attrs:{for:t.id}})])};it._withStripped=!0;var nt=A({render:it,staticRenderFns:[]},void 0,ot,void 0,!1,void 0,!1,void 0,void 0,void 0),st={name:"FormulateInputText",mixins:[rt]},at=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type}},["checkbox"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"checkbox"},domProps:{checked:Array.isArray(t.context.model)?t._i(t.context.model,null)>-1:t.context.model},on:{blur:t.context.blurHandler,change:function(e){var r=t.context.model,o=e.target,i=!!o.checked;if(Array.isArray(r)){var n=t._i(r,null);o.checked?n<0&&t.$set(t.context,"model",r.concat([null])):n>-1&&t.$set(t.context,"model",r.slice(0,n).concat(r.slice(n+1)))}else t.$set(t.context,"model",i)}}},"input",t.attributes,!1)):"radio"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"radio"},domProps:{checked:t._q(t.context.model,null)},on:{blur:t.context.blurHandler,change:function(e){return t.$set(t.context,"model",null)}}},"input",t.attributes,!1)):r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:t.type},domProps:{value:t.context.model},on:{blur:t.context.blurHandler,input:function(e){e.target.composing||t.$set(t.context,"model",e.target.value)}}},"input",t.attributes,!1))])};at._withStripped=!0;var lt=A({render:at,staticRenderFns:[]},void 0,st,void 0,!1,void 0,!1,void 0,void 0,void 0),ut={name:"FormulateFiles",props:{files:{type:s,required:!0},imagePreview:{type:Boolean,default:!1}},computed:{fileUploads:function(){return this.files.files||[]}},watch:{files:function(){this.imagePreview&&this.files.loadPreviews()}},mounted:function(){this.imagePreview&&this.files.loadPreviews()}},ct=function(){var t=this,e=t.$createElement,r=t._self._c||e;return t.fileUploads.length?r("ul",{staticClass:"formulate-files"},t._l(t.fileUploads,(function(e){return r("li",{key:e.uuid,attrs:{"data-has-error":!!e.error,"data-has-preview":!(!t.imagePreview||!e.previewData)}},[r("div",{staticClass:"formulate-file"},[t.imagePreview&&e.previewData?r("div",{staticClass:"formulate-file-image-preview"},[r("img",{attrs:{src:e.previewData}})]):t._e(),t._v(" "),r("div",{staticClass:"formulate-file-name",attrs:{title:e.name},domProps:{textContent:t._s(e.name)}}),t._v(" "),!1!==e.progress?r("div",{staticClass:"formulate-file-progress",attrs:{"data-just-finished":e.justFinished,"data-is-finished":!e.justFinished&&e.complete}},[r("div",{staticClass:"formulate-file-progress-inner",style:{width:e.progress+"%"}})]):t._e(),t._v(" "),e.complete&&!e.justFinished||!1===e.progress?r("div",{staticClass:"formulate-file-remove",on:{click:e.removeFile}}):t._e()]),t._v(" "),e.error?r("div",{staticClass:"formulate-file-upload-error",domProps:{textContent:t._s(e.error)}}):t._e()])})),0):t._e()};ct._withStripped=!0;var dt={name:"FormulateInputFile",components:{FormulateFiles:A({render:ct,staticRenderFns:[]},void 0,ut,void 0,!1,void 0,!1,void 0,void 0,void 0)},mixins:[rt],data:function(){return{isOver:!1}},computed:{hasFiles:function(){return!!(this.context.model instanceof s&&this.context.model.files.length)}},created:function(){Array.isArray(this.context.model)&&"string"==typeof this.context.model[0][this.$formulate.getFileUrlKey()]&&(this.context.model=this.$formulate.createUpload({files:this.context.model},this.context))},mounted:function(){window&&this.context.preventWindowDrops&&(window.addEventListener("dragover",this.preventDefault),window.addEventListener("drop",this.preventDefault))},destroyed:function(){window&&this.context.preventWindowDrops&&(window.removeEventListener("dragover",this.preventDefault),window.removeEventListener("drop",this.preventDefault))},methods:{preventDefault:function(t){"INPUT"!==t.target.tagName&&"file"!==t.target.getAttribute("type")&&(t=t||event).preventDefault()},handleFile:function(){var t=this;this.isOver=!1;var e=this.$refs.file;e.files.length&&(this.context.model=this.$formulate.createUpload(e,this.context),this.$nextTick((function(){return t.attemptImmediateUpload()})))},attemptImmediateUpload:function(){var t=this;"live"===this.context.uploadBehavior&&this.context.model instanceof s&&this.context.hasValidationErrors().then((function(e){e||t.context.model.upload()}))},handleDragOver:function(t){t.preventDefault(),this.isOver=!0},handleDragLeave:function(t){t.preventDefault(),this.isOver=!1}}},pt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{class:"formulate-input-element formulate-input-element--"+t.context.type,attrs:{"data-type":t.context.type,"data-has-files":t.hasFiles}},[r("div",{staticClass:"formulate-input-upload-area",attrs:{"data-has-files":t.hasFiles}},[r("input",t._b({ref:"file",attrs:{"data-is-drag-hover":t.isOver,type:"file"},on:{blur:t.context.blurHandler,change:t.handleFile,dragover:t.handleDragOver,dragleave:t.handleDragLeave}},"input",t.attributes,!1)),t._v(" "),r("div",{directives:[{name:"show",rawName:"v-show",value:!t.hasFiles,expression:"!hasFiles"}],staticClass:"formulate-input-upload-area-mask"}),t._v(" "),t.hasFiles?r("FormulateFiles",{attrs:{files:t.context.model,"image-preview":"image"===t.context.type&&"preview"===t.context.imageBehavior}}):t._e()],1)])};pt._withStripped=!0;var ht=A({render:pt,staticRenderFns:[]},void 0,dt,void 0,!1,void 0,!1,void 0,void 0,void 0),ft={props:{context:{type:Object,required:!0},removeItem:{type:Function,required:!0},index:{type:Number,required:!0}}},mt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"formulate-input-group-repeatable"},[t.context.repeatable?r("a",{staticClass:"formulate-input-group-repeatable-remove",attrs:{role:"button"},on:{click:function(e){return e.preventDefault(),t.removeItem(e)},keypress:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.removeItem(e)}}}):t._e(),t._v(" "),t._t("default")],2)};mt._withStripped=!0;var vt=A({render:mt,staticRenderFns:[]},void 0,ft,void 0,!1,void 0,!1,void 0,void 0,void 0);function yt(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&-1===e.indexOf(o)&&(r[o]=t[o]);return r}var bt={name:"FormulateInputGroup",props:{context:{type:Object,required:!0}},computed:{options:function(){return this.context.options||[]},subType:function(){return"group"===this.context.type?"grouping":"inputs"},optionsWithContext:function(){var t=this,e=this.context,r=e.attributes,o=(r.id,yt(r,["id"])),i=(e.blurHandler,e.classification,e.component,e.getValidationErrors,e.hasLabel,e.hasValidationErrors,e.isSubField,e.labelPosition,e.options,e.performValidation,e.setErrors,e.slotComponents,e.validationErrors,e.visibleValidationErrors,yt(e,["attributes","blurHandler","classification","component","getValidationErrors","hasLabel","hasValidationErrors","isSubField","labelPosition","options","performValidation","setErrors","slotComponents","validationErrors","visibleValidationErrors"]));return this.options.map((function(e){return t.groupItemContext(i,e,o)}))},canAddMore:function(){return this.context.repeatable&&this.items.length-1:t.context.model},on:{blur:t.context.blurHandler,change:function(e){var r=t.context.model,o=e.target,i=!!o.checked;if(Array.isArray(r)){var n=t._i(r,null);o.checked?n<0&&t.$set(t.context,"model",r.concat([null])):n>-1&&t.$set(t.context,"model",r.slice(0,n).concat(r.slice(n+1)))}else t.$set(t.context,"model",i)}}},"input",t.attributes,!1)):"radio"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:"radio"},domProps:{checked:t._q(t.context.model,null)},on:{blur:t.context.blurHandler,change:function(e){return t.$set(t.context,"model",null)}}},"input",t.attributes,!1)):r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],attrs:{type:t.type},domProps:{value:t.context.model},on:{blur:t.context.blurHandler,input:function(e){e.target.composing||t.$set(t.context,"model",e.target.value)}}},"input",t.attributes,!1)),t._v(" "),t.context.showValue?r("div",{staticClass:"formulate-input-element-range-value",domProps:{textContent:t._s(t.context.model)}}):t._e()])};At._withStripped=!0;var St=A({render:At,staticRenderFns:[]},void 0,Pt,void 0,!1,void 0,!1,void 0,void 0,void 0),$t={name:"FormulateInputTextArea",mixins:[rt]},jt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"formulate-input-element formulate-input-element--textarea",attrs:{"data-type":"textarea"}},[r("textarea",t._b({directives:[{name:"model",rawName:"v-model",value:t.context.model,expression:"context.model"}],domProps:{value:t.context.model},on:{blur:t.context.blurHandler,input:function(e){e.target.composing||t.$set(t.context,"model",e.target.value)}}},"textarea",t.attributes,!1))])};jt._withStripped=!0;var Ct=A({render:jt,staticRenderFns:[]},void 0,$t,void 0,!1,void 0,!1,void 0,void 0,void 0),Rt={provide:function(){var t=this;return Object.assign({},V(this),{formulateSetter:function(e,r){return t.setFieldValue(e,r)}})},props:{index:{type:Number,required:!0},context:{type:Object,required:!0},setFieldValue:{type:Function,required:!0}},data:function(){return Object.assign({},_(this),{isGrouping:!0})},computed:Object.assign({},F()),methods:Object.assign({},O(["setFieldValue"]),{removeItem:function(){this.$emit("remove",this.index)}})},kt=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("FormulateSlot",{attrs:{name:"repeatable",context:t.context,index:t.index,"remove-item":t.removeItem}},[r(t.context.slotComponents.repeatable,{tag:"component",attrs:{context:t.context,index:t.index,"remove-item":t.removeItem}},[r("FormulateSlot",{attrs:{context:t.context,index:t.index,name:"default"}})],1)],1)};kt._withStripped=!0;var Nt=A({render:kt,staticRenderFns:[]},void 0,Rt,void 0,!1,void 0,!1,void 0,void 0,void 0),It=function(){this.options={},this.defaults={components:{FormulateSlot:x,FormulateForm:j,FormulateHelp:W,FormulateLabel:X,FormulateInput:B,FormulateErrors:q,FormulateAddMore:et,FormulateGrouping:K,FormulateInputBox:nt,FormulateInputText:lt,FormulateInputFile:ht,FormulateRepeatable:vt,FormulateInputGroup:xt,FormulateInputButton:_t,FormulateInputSelect:Vt,FormulateInputSlider:St,FormulateInputTextArea:Ct,FormulateRepeatableProvider:Nt},slotComponents:{label:"FormulateLabel",help:"FormulateHelp",errors:"FormulateErrors",repeatable:"FormulateRepeatable",addMore:"FormulateAddMore"},library:n,rules:m,mimes:y,locale:!1,uploader:b,uploadUrl:!1,fileUrlKey:"url",uploadJustCompleteDuration:1e3,errorHandler:function(t){return t},plugins:[o.en],locales:{},idPrefix:"formulate-"},this.registry=new Map,this.idRegistry={}};return It.prototype.install=function(t,e){var r=this;t.prototype.$formulate=this,this.options=this.defaults;var o=this.defaults.plugins;for(var i in e&&Array.isArray(e.plugins)&&e.plugins.length&&(o=o.concat(e.plugins)),o.forEach((function(t){return"function"==typeof t?t(r):null})),this.extend(e||{}),this.options.components)t.component(i,this.options.components[i])},It.prototype.nextId=function(t){var e=!(!t.$route||!t.$route.path)&&t.$route.path?t.$route.path.replace(/[/\\.\s]/g,"-"):"global";return Object.prototype.hasOwnProperty.call(this.idRegistry,e)||(this.idRegistry[e]=0),""+this.options.idPrefix+e+"-"+ ++this.idRegistry[e]},It.prototype.extend=function(t){if("object"==typeof t)return this.options=this.merge(this.options,t),this;throw new Error("VueFormulate extend() should be passed an object (was "+typeof t+")")},It.prototype.merge=function(t,e,o){void 0===o&&(o=!0);var i={};for(var n in t)e.hasOwnProperty(n)?r(e[n])&&r(t[n])?i[n]=this.merge(t[n],e[n],o):o&&Array.isArray(t[n])&&Array.isArray(e[n])?i[n]=t[n].concat(e[n]):i[n]=e[n]:i[n]=t[n];for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i},It.prototype.classify=function(t){return this.options.library.hasOwnProperty(t)?this.options.library[t].classification:"unknown"},It.prototype.component=function(t){return!!this.options.library.hasOwnProperty(t)&&this.options.library[t].component},It.prototype.slotComponent=function(t,e){var r=this.options.library[t];return r&&r.slotComponents&&r.slotComponents[e]?r.slotComponents[e]:this.options.slotComponents[e]},It.prototype.rules=function(t){return void 0===t&&(t={}),Object.assign({},this.options.rules,t)},It.prototype.i18n=function(t){if(t.$i18n)switch(typeof t.$i18n.locale){case"string":return t.$i18n.locale;case"function":return t.$i18n.locale()}return!1},It.prototype.getLocale=function(t){var e=this;return this.selectedLocale||(this.selectedLocale=[this.options.locale,this.i18n(t),"en"].reduce((function(t,r){if(t)return t;if(r){var o=function(t){return t.split("-").reduce((function(t,e){return t.length&&t.unshift(t[0]+"-"+e),t.length?t:[e]}),[])}(r).find((function(t){return f(e.options.locales,t)}));o&&(t=o)}return t}),!1)),this.selectedLocale},It.prototype.validationMessage=function(t,e,r){var o=this.options.locales[this.getLocale(r)];return o.hasOwnProperty(t)?o[t](e):"_"===t[0]&&o.hasOwnProperty(t.substr(1))?o[t.substr(1)](e):o.hasOwnProperty("default")?o.default(e):"This field does not have a valid value"},It.prototype.register=function(t){"FormulateForm"===t.$options.name&&t.name&&this.registry.set(t.name,t)},It.prototype.deregister=function(t){"FormulateForm"===t.$options.name&&t.name&&this.registry.has(t.name)&&this.registry.delete(t.name)},It.prototype.handle=function(t,e,r){void 0===r&&(r=!1);var o=r?t:this.options.errorHandler(t,e);return e&&this.registry.has(e)&&this.registry.get(e).applyErrors({formErrors:c(o.formErrors),inputErrors:o.inputErrors||{}}),o},It.prototype.reset=function(t,e){void 0===e&&(e={}),this.resetValidation(t),this.setValues(t,e)},It.prototype.resetValidation=function(t){var e=this.registry.get(t);e.hideErrors(t),e.namedErrors=[],e.namedFieldErrors={}},It.prototype.setValues=function(t,e){e&&!Array.isArray(e)&&"object"==typeof e&&this.registry.get(t).setValues(Object.assign({},e))},It.prototype.getUploader=function(){return this.options.uploader||!1},It.prototype.getUploadUrl=function(){return this.options.uploadUrl||!1},It.prototype.getFileUrlKey=function(){return this.options.fileUrlKey||"url"},It.prototype.createUpload=function(t,e){return new s(t,e,this.options)},new It})); diff --git a/dist/snow.css b/dist/snow.css index 7c1d05f..936a14d 100644 --- a/dist/snow.css +++ b/dist/snow.css @@ -7,6 +7,9 @@ font-size: .9em; font-weight: 600; margin-bottom: .1em; } + .formulate-input .formulate-input-label--before + .formulate-input-help--before { + margin-top: -.25em; + margin-bottom: .75em; } .formulate-input .formulate-input-element { max-width: 20em; margin-bottom: .1em; } @@ -27,8 +30,6 @@ font-weight: 300; line-height: 1.5; margin-bottom: .25em; } - .formulate-input .formulate-input-group-item { - margin-bottom: .5em; } .formulate-input:last-child { margin-bottom: 0; } .formulate-input[data-classification='text'] input { @@ -120,6 +121,7 @@ width: 1em; height: 1em; border-radius: 1em; + border: 0; background-color: #41b883; margin-top: calc(-.5em + 2px); } .formulate-input[data-classification='slider'] input::-moz-range-thumb { @@ -128,6 +130,7 @@ width: 1em; height: 1em; border-radius: 1em; + border: 0; background-color: #41b883; margin-top: calc(-.5em + 2px); } .formulate-input[data-classification='slider'] input::-ms-thumb { @@ -136,6 +139,7 @@ width: 1em; height: 1em; border-radius: 1em; + border: 0; background-color: #41b883; margin-top: calc(-.5em + 2px); } .formulate-input[data-classification='slider'] input::-webkit-slider-runnable-track { @@ -146,6 +150,14 @@ border-radius: 3px; margin: 0; padding: 0; } + .formulate-input[data-classification='slider'] input::-moz-range-track { + appearance: none; + width: 100%; + height: 4px; + background-color: #efefef; + border-radius: 3px; + margin: 0; + padding: 0; } .formulate-input[data-classification='textarea'] textarea { appearance: none; border-radius: .3em; @@ -198,6 +210,19 @@ .formulate-input[data-classification='button'] button[disabled] { background-color: #cecece; border-color: #cecece; } + .formulate-input[data-classification='button'] button[data-ghost] { + color: #41b883; + background-color: transparent; + border-color: currentColor; } + .formulate-input[data-classification='button'] button[data-minor] { + font-size: .75em; + display: inline-block; } + .formulate-input[data-classification='button'] button[data-danger] { + background-color: #960505; + border-color: #960505; } + .formulate-input[data-classification='button'] button[data-danger][data-ghost] { + color: #960505; + background-color: transparent; } .formulate-input[data-classification='button'] button:active { background-color: #64c89b; border-color: #64c89b; } @@ -288,8 +313,56 @@ margin-left: .5em; } .formulate-input[data-classification='box'] .formulate-input-label--before { margin-right: .5em; } - .formulate-input[data-classification="group"] > .formulate-input-wrapper > .formulate-input-label { + .formulate-input[data-classification='group'] .formulate-input-group-item { margin-bottom: .5em; } + .formulate-input[data-classification='group'] > .formulate-input-wrapper > .formulate-input-label { + margin-bottom: .5em; } + .formulate-input[data-classification='group'] [data-is-repeatable] { + padding: 1em; + border: 1px solid #efefef; + border-radius: .3em; } + .formulate-input[data-classification='group'] [data-is-repeatable] .formulate-input-grouping { + margin: -1em -1em 0 -1em; } + .formulate-input[data-classification='group'] [data-is-repeatable] .formulate-input-group-repeatable { + padding: 1em 3em 1em 1em; + border-bottom: 1px solid #efefef; + position: relative; } + .formulate-input[data-classification='group'] [data-is-repeatable] .formulate-input-group-repeatable-remove { + position: absolute; + display: block; + top: calc(50% - .65em + .5em); + width: 1.3em; + height: 1.3em; + background-color: #cecece; + right: .85em; + border-radius: 1.3em; + cursor: pointer; + transition: background-color .2s; } + .formulate-input[data-classification='group'] [data-is-repeatable] .formulate-input-group-repeatable-remove::before, .formulate-input[data-classification='group'] [data-is-repeatable] .formulate-input-group-repeatable-remove::after { + content: ''; + position: absolute; + top: calc(50% - .1em); + left: .325em; + display: block; + width: .65em; + height: .2em; + background-color: white; + transform-origin: center center; + transition: transform .25s; } + @media (pointer: fine) { + .formulate-input[data-classification='group'] [data-is-repeatable] .formulate-input-group-repeatable-remove:hover { + background-color: #dc2c2c; } + .formulate-input[data-classification='group'] [data-is-repeatable] .formulate-input-group-repeatable-remove:hover::after, .formulate-input[data-classification='group'] [data-is-repeatable] .formulate-input-group-repeatable-remove:hover::before { + height: .2em; + width: .75em; + left: .25em; + top: calc(50% - .075em); } + .formulate-input[data-classification='group'] [data-is-repeatable] .formulate-input-group-repeatable-remove:hover::after { + transform: rotate(45deg); } + .formulate-input[data-classification='group'] [data-is-repeatable] .formulate-input-group-repeatable-remove:hover::before { + transform: rotate(-45deg); } } + .formulate-input[data-classification='group'] [data-is-repeatable] .formulate-input-group-repeatable:last-child { + margin-bottom: 1em; } .formulate-input[data-classification="file"] .formulate-input-upload-area { width: 100%; position: relative; diff --git a/dist/snow.min.css b/dist/snow.min.css index 225fa67..ffce20e 100644 --- a/dist/snow.min.css +++ b/dist/snow.min.css @@ -1 +1 @@ -.formulate-input{margin-bottom:1.5em;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol}.formulate-input .formulate-input-label{display:block;line-height:1.5;font-size:.9em;font-weight:600;margin-bottom:.1em}.formulate-input .formulate-input-element{max-width:20em;margin-bottom:.1em}.formulate-input .formulate-input-help{color:#6d6d6d;font-size:.7em;font-weight:400;line-height:1.5;margin-bottom:.25em}.formulate-input .formulate-input-errors{list-style-type:none;padding:0;margin:0}.formulate-input .formulate-file-upload-error,.formulate-input .formulate-input-error{color:#960505;font-size:.8em;font-weight:300;line-height:1.5;margin-bottom:.25em}.formulate-input .formulate-input-group-item{margin-bottom:.5em}.formulate-input:last-child{margin-bottom:0}.formulate-input[data-classification=text] input{-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:.3em;border:1px solid #cecece;box-sizing:border-box;background-color:transparent;font-size:.9em;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;padding:.75em;display:block;width:100%;font-weight:400;line-height:1.2em;margin:0}.formulate-input[data-classification=text] input::-webkit-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=text] input::-moz-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=text] input:-ms-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=text] input::-ms-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=text] input::placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=text] input:focus{outline:0;border:1px solid #41b883}.formulate-input[data-classification=text] .formulate-input-element--date input,.formulate-input[data-classification=text] .formulate-input-element--datetime-local input,.formulate-input[data-classification=text] .formulate-input-element--month input,.formulate-input[data-classification=text] .formulate-input-element--week input{min-height:2.2em}.formulate-input[data-classification=text] .formulate-input-element--search{position:relative}.formulate-input[data-classification=text] .formulate-input-element--search:before{content:"";width:2em;height:100%;position:absolute;left:0;top:0;background-image:url('data:image/svg+xml;utf8,');background-size:1em 1em;background-repeat:no-repeat;background-position:50%;pointer-events:none}.formulate-input[data-classification=text] .formulate-input-element--search input{padding-left:2em}.formulate-input[data-classification=text] input[type=color]{height:1.1em;box-sizing:content-box}.formulate-input[data-classification=text] input[type=color]::-webkit-color-swatch-wrapper{padding:0 0 0 1.5em;display:flex;align-items:center;background-image:url('data:image/svg+xml;utf8,');background-repeat:no-repeat;background-size:.9em .9em;background-position:left .1em}.formulate-input[data-classification=text] input[type=color]::-webkit-color-swatch{display:block;height:1em;border-radius:.2em;border:0;flex:auto}.formulate-input[data-classification=text] input[type=color]::-moz-color-swatch{display:block;height:1em;border-radius:.2em;border:0;flex:auto}.formulate-input[data-classification=slider] .formulate-input-element--range{display:flex;align-items:center}.formulate-input[data-classification=slider] .formulate-input-element-range-value{font-size:.9em;line-height:1;margin-left:.5em;background-color:#efefef;padding:.25em .3em;border-radius:.25em;color:#6d6d6d;font-variant-numeric:tabular-nums}.formulate-input[data-classification=slider] input{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:100%;font-size:1em;padding:.5em 0}.formulate-input[data-classification=slider] input:focus{outline:0}.formulate-input[data-classification=slider] input::-webkit-slider-thumb{cursor:pointer;-webkit-appearance:none;appearance:none;width:1em;height:1em;border-radius:1em;background-color:#41b883;margin-top:calc(-.5em + 2px)}.formulate-input[data-classification=slider] input::-moz-range-thumb{cursor:pointer;-moz-appearance:none;appearance:none;width:1em;height:1em;border-radius:1em;background-color:#41b883;margin-top:calc(-.5em + 2px)}.formulate-input[data-classification=slider] input::-ms-thumb{cursor:pointer;appearance:none;width:1em;height:1em;border-radius:1em;background-color:#41b883;margin-top:calc(-.5em + 2px)}.formulate-input[data-classification=slider] input::-webkit-slider-runnable-track{-webkit-appearance:none;appearance:none;width:100%;height:4px;background-color:#efefef;border-radius:3px;margin:0;padding:0}.formulate-input[data-classification=textarea] textarea{-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:.3em;border:1px solid #cecece;box-sizing:border-box;background-color:transparent;font-size:.9em;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;padding:.75em;display:block;width:100%;font-weight:400;line-height:1.2em;margin:0}.formulate-input[data-classification=textarea] textarea::-webkit-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=textarea] textarea::-moz-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=textarea] textarea:-ms-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=textarea] textarea::-ms-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=textarea] textarea::placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=textarea] textarea:focus{outline:0;border:1px solid #41b883}.formulate-input[data-classification=button] button{-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:.3em;box-sizing:border-box;background-color:transparent;font-size:.9em;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;padding:.75em;display:block;width:100%;font-weight:400;line-height:1.2em;margin:0;border:1px solid #41b883;background-color:#41b883;color:#fff;min-width:0;width:auto;font-weight:700;cursor:pointer;display:inline-flex;align-items:center}.formulate-input[data-classification=button] button::-webkit-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=button] button::-moz-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=button] button:-ms-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=button] button::-ms-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=button] button::placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=button] button:focus{outline:0;border:1px solid #41b883}.formulate-input[data-classification=button] button[disabled]{background-color:#cecece;border-color:#cecece}.formulate-input[data-classification=button] button:active{background-color:#64c89b;border-color:#64c89b}.formulate-input[data-classification=select] .formulate-input-element{position:relative}.formulate-input[data-classification=select] .formulate-input-element:before{content:"";width:0;height:0;border-color:#cecece transparent transparent;border-style:solid;border-width:.3em .3em 0;top:50%;margin-top:-.1em;right:1em;position:absolute}.formulate-input[data-classification=select] select{-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:.3em;border:1px solid #cecece;box-sizing:border-box;background-color:transparent;font-size:.9em;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;display:block;width:100%;font-weight:400;line-height:1.2em;margin:0;padding:.75em 2em .75em .75em}.formulate-input[data-classification=select] select::-webkit-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=select] select::-moz-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=select] select:-ms-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=select] select::-ms-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=select] select::placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=select] select:focus{outline:0;border:1px solid #41b883}.formulate-input[data-classification=select] select[data-placeholder-selected]{color:#a8a8a8}.formulate-input[data-classification=box] .formulate-input-wrapper{display:flex;align-items:center}.formulate-input[data-classification=box] .formulate-input-element{overflow:hidden;display:flex;align-items:center}.formulate-input[data-classification=box] .formulate-input-element input{position:absolute;left:-999px}.formulate-input[data-classification=box] .formulate-input-element-decorator{display:block;width:1em;height:1em;border-radius:.25em;border:1px solid #cecece;position:relative}.formulate-input[data-classification=box] .formulate-input-element-decorator:before{content:"";display:block;background-size:contain;background-position:100%;width:calc(100% - .125em);height:calc(100% - .125em);box-sizing:border-box;position:absolute;top:.0625em;left:.0625em}.formulate-input[data-classification=box] .formulate-input-element[data-type=radio] .formulate-input-element-decorator{border-radius:1em}.formulate-input[data-classification=box] .formulate-input-element[data-type=radio] .formulate-input-element-decorator:before{border-radius:1em;width:calc(100% - .5em);height:calc(100% - .5em);top:.25em;left:.25em}.formulate-input[data-classification=box] .formulate-input-element input[type=checkbox]:checked~.formulate-input-element-decorator{border-color:#41b883}.formulate-input[data-classification=box] .formulate-input-element input[type=checkbox]:checked~.formulate-input-element-decorator:before{background-color:#41b883;-webkit-mask-image:url('data:image/svg+xml;utf8,');mask-image:url('data:image/svg+xml;utf8,')}.formulate-input[data-classification=box] .formulate-input-element input[type=radio]:checked~.formulate-input-element-decorator{border-color:#41b883}.formulate-input[data-classification=box] .formulate-input-element input[type=radio]:checked~.formulate-input-element-decorator:before{background-color:#41b883}.formulate-input[data-classification=box] .formulate-input-element input:focus~.formulate-input-element-decorator{border-color:#41b883}.formulate-input[data-classification=box] .formulate-input-label--after{margin-left:.5em}.formulate-input[data-classification=box] .formulate-input-label--before{margin-right:.5em}.formulate-input[data-classification=group]>.formulate-input-wrapper>.formulate-input-label{margin-bottom:.5em}.formulate-input[data-classification=file] .formulate-input-upload-area{width:100%;position:relative;padding:2em 0}.formulate-input[data-classification=file] .formulate-input-upload-area input{cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;opacity:0;position:absolute;left:0;right:0;bottom:0;top:0;width:100%;height:100%;z-index:5}.formulate-input[data-classification=file] .formulate-input-upload-area[data-has-files]{padding:0}.formulate-input[data-classification=file] .formulate-input-upload-area[data-has-files] input{display:none}.formulate-input[data-classification=file] .formulate-input-upload-area-mask{border-radius:.4em;pointer-events:none;position:absolute;display:flex;justify-content:center;align-items:center;left:0;right:0;top:0;bottom:0;border:2px dashed #a8a8a8;z-index:2}.formulate-input[data-classification=file] .formulate-input-upload-area-mask:before{content:"";background-color:#a8a8a8;-webkit-mask-image:url('data:image/svg+xml;utf8,');mask-image:url('data:image/svg+xml;utf8,');-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;width:2em;height:2em;position:absolute;pointer-events:none}.formulate-input[data-classification=file] .formulate-input-upload-area input:focus~.formulate-input-upload-area-mask,.formulate-input[data-classification=file] .formulate-input-upload-area input:hover~.formulate-input-upload-area-mask,.formulate-input[data-classification=file] .formulate-input-upload-area input[data-is-drag-hover]~.formulate-input-upload-area-mask{border-color:#41b883}.formulate-input[data-classification=file] .formulate-input-upload-area input:focus~.formulate-input-upload-area-mask:before,.formulate-input[data-classification=file] .formulate-input-upload-area input:hover~.formulate-input-upload-area-mask:before,.formulate-input[data-classification=file] .formulate-input-upload-area input[data-is-drag-hover]~.formulate-input-upload-area-mask:before{background-color:#41b883}.formulate-input[data-classification=file] .formulate-files{list-style-type:none;margin:0;padding:0}.formulate-input[data-classification=file] .formulate-files .formulate-file-progress{background-color:#cecece;height:.3em;border-radius:1.25em;width:5em;overflow:hidden;position:relative;flex:0 0 5em;right:.75em;transition:height .25s,width .25s,flex-basis .25s;z-index:2}.formulate-input[data-classification=file] .formulate-files .formulate-file-progress:before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;display:block;opacity:0;transform:scale(.08);background-color:#fff;-webkit-mask-image:url('data:image/svg+xml;utf8,');mask-image:url('data:image/svg+xml;utf8,');-webkit-mask-size:77%;mask-size:77%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;z-index:3}.formulate-input[data-classification=file] .formulate-files .formulate-file-progress[data-just-finished]{width:1.25em;height:1.25em;flex:0 0 1.25em}.formulate-input[data-classification=file] .formulate-files .formulate-file-progress[data-just-finished]:before{transition:transform .25s .2s,opacity .25s .2s;transform:scale(1);opacity:1}.formulate-input[data-classification=file] .formulate-files .formulate-file-progress[data-is-finished]{transition:height .25s,width .25s,left .25s,top,.25s,border-radius .25s;width:.3em;flex:0 0 .3em;height:100%;right:0;border-radius:0 .23em .23em 0}.formulate-input[data-classification=file] .formulate-files .formulate-file-progress[data-is-finished]:before{transition:opacity .1s;opacity:0}.formulate-input[data-classification=file] .formulate-files .formulate-file-progress .formulate-file-progress-inner{background-color:#41b883;width:1%;position:absolute;left:0;bottom:0;top:0;z-index:2}.formulate-input[data-classification=file] .formulate-files .formulate-file-name{padding-left:1.5em;padding-right:2em;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.formulate-input[data-classification=file] .formulate-files .formulate-file-name:before{position:absolute;left:.7em;top:50%;margin-top:-.7em;background-color:#a8a8a8;content:"";-webkit-mask-image:url('data:image/svg+xml;utf8,');mask-image:url('data:image/svg+xml;utf8,');-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;width:1.25em;height:1.25em;display:inline-block;margin-right:.5em}.formulate-input[data-classification=file] .formulate-files .formulate-file-remove{width:1.25em;height:1.25em;border-radius:1em;border:1px solid #a8a8a8;background-color:#a8a8a8;-webkit-mask-image:url('data:image/svg+xml;utf8,');mask-image:url('data:image/svg+xml;utf8,');-webkit-mask-size:.6em;mask-size:.6em;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;cursor:pointer;position:absolute;right:.75em;z-index:1;transition:transform .25s}@media (pointer:fine){.formulate-input[data-classification=file] .formulate-files .formulate-file-remove:hover{transform:scale(1.5)}}.formulate-input[data-classification=file] .formulate-files li{display:block}.formulate-input[data-classification=file] .formulate-files li[data-has-error] .formulate-file-progress{background-color:#dc2c2c}.formulate-input[data-classification=file] .formulate-files li[data-has-preview] .formulate-file-name:before{display:none}.formulate-input[data-classification=file] .formulate-files li+li{margin-top:.5em}.formulate-input[data-classification=file] .formulate-files .formulate-file{-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:.3em;border:1px solid #cecece;box-sizing:border-box;background-color:transparent;font-size:.9em;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;padding:.75em;font-weight:400;line-height:1.2em;margin:0;display:block;width:100%;display:flex;justify-content:flex-start;align-items:center;position:relative}.formulate-input[data-classification=file] .formulate-files .formulate-file::-webkit-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=file] .formulate-files .formulate-file::-moz-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=file] .formulate-files .formulate-file:-ms-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=file] .formulate-files .formulate-file::-ms-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=file] .formulate-files .formulate-file::placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=file] .formulate-files .formulate-file:focus{outline:0;border:1px solid #41b883}.formulate-input[data-classification=file] .formulate-files .formulate-file ::-webkit-progress-bar{-webkit-appearance:none;appearance:none;height:.5em;border-radius:.5em;overflow:hidden}.formulate-input[data-classification=file] .formulate-files .formulate-file-image-preview{width:3em;height:3em;flex:0 0 3em;position:relative;z-index:2;left:-1px;box-shadow:0 0 0 1px #efefef;transition:transform .25s,box-shadow .25s,background-color .25s}@media (pointer:fine){.formulate-input[data-classification=file] .formulate-files .formulate-file-image-preview:hover{transition-delay:.2s;transform:scale(3);background-color:#fff;box-shadow:0 0 2px 0 rgba(0,0,0,.1)}}.formulate-input[data-classification=file] .formulate-files .formulate-file-image-preview img{display:block;position:absolute;width:100%;height:100%;left:0;right:0;bottom:0;top:0;-o-object-fit:contain;object-fit:contain;transition:all .25s}.formulate-input[data-classification=file] [data-type=image] .formulate-input-upload-area .formulate-input-upload-area-mask:before{-webkit-mask-image:url('data:image/svg+xml;utf8,');mask-image:url('data:image/svg+xml;utf8,')}.formulate-form-errors{margin:.75em 0;padding:0;list-style-type:none}.formulate-form-errors:first-child{margin-top:0}.formulate-form-errors:last-child{margin-bottom:0}.formulate-form-errors .formulate-form-error{color:#960505;font-size:.9em;font-weight:300;line-height:1.5;margin-bottom:.25em} \ No newline at end of file +.formulate-input{margin-bottom:1.5em;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol}.formulate-input .formulate-input-label{display:block;line-height:1.5;font-size:.9em;font-weight:600;margin-bottom:.1em}.formulate-input .formulate-input-label--before+.formulate-input-help--before{margin-top:-.25em;margin-bottom:.75em}.formulate-input .formulate-input-element{max-width:20em;margin-bottom:.1em}.formulate-input .formulate-input-help{color:#6d6d6d;font-size:.7em;font-weight:400;line-height:1.5;margin-bottom:.25em}.formulate-input .formulate-input-errors{list-style-type:none;padding:0;margin:0}.formulate-input .formulate-file-upload-error,.formulate-input .formulate-input-error{color:#960505;font-size:.8em;font-weight:300;line-height:1.5;margin-bottom:.25em}.formulate-input:last-child{margin-bottom:0}.formulate-input[data-classification=text] input{-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:.3em;border:1px solid #cecece;box-sizing:border-box;background-color:transparent;font-size:.9em;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;padding:.75em;display:block;width:100%;font-weight:400;line-height:1.2em;margin:0}.formulate-input[data-classification=text] input::-webkit-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=text] input::-moz-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=text] input:-ms-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=text] input::-ms-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=text] input::placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=text] input:focus{outline:0;border:1px solid #41b883}.formulate-input[data-classification=text] .formulate-input-element--date input,.formulate-input[data-classification=text] .formulate-input-element--datetime-local input,.formulate-input[data-classification=text] .formulate-input-element--month input,.formulate-input[data-classification=text] .formulate-input-element--week input{min-height:2.2em}.formulate-input[data-classification=text] .formulate-input-element--search{position:relative}.formulate-input[data-classification=text] .formulate-input-element--search:before{content:"";width:2em;height:100%;position:absolute;left:0;top:0;background-image:url('data:image/svg+xml;utf8,');background-size:1em 1em;background-repeat:no-repeat;background-position:50%;pointer-events:none}.formulate-input[data-classification=text] .formulate-input-element--search input{padding-left:2em}.formulate-input[data-classification=text] input[type=color]{height:1.1em;box-sizing:content-box}.formulate-input[data-classification=text] input[type=color]::-webkit-color-swatch-wrapper{padding:0 0 0 1.5em;display:flex;align-items:center;background-image:url('data:image/svg+xml;utf8,');background-repeat:no-repeat;background-size:.9em .9em;background-position:left .1em}.formulate-input[data-classification=text] input[type=color]::-webkit-color-swatch{display:block;height:1em;border-radius:.2em;border:0;flex:auto}.formulate-input[data-classification=text] input[type=color]::-moz-color-swatch{display:block;height:1em;border-radius:.2em;border:0;flex:auto}.formulate-input[data-classification=slider] .formulate-input-element--range{display:flex;align-items:center}.formulate-input[data-classification=slider] .formulate-input-element-range-value{font-size:.9em;line-height:1;margin-left:.5em;background-color:#efefef;padding:.25em .3em;border-radius:.25em;color:#6d6d6d;font-variant-numeric:tabular-nums}.formulate-input[data-classification=slider] input{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:100%;font-size:1em;padding:.5em 0}.formulate-input[data-classification=slider] input:focus{outline:0}.formulate-input[data-classification=slider] input::-webkit-slider-thumb{cursor:pointer;-webkit-appearance:none;appearance:none;width:1em;height:1em;border-radius:1em;border:0;background-color:#41b883;margin-top:calc(-.5em + 2px)}.formulate-input[data-classification=slider] input::-moz-range-thumb{cursor:pointer;-moz-appearance:none;appearance:none;width:1em;height:1em;border-radius:1em;border:0;background-color:#41b883;margin-top:calc(-.5em + 2px)}.formulate-input[data-classification=slider] input::-ms-thumb{cursor:pointer;appearance:none;width:1em;height:1em;border-radius:1em;border:0;background-color:#41b883;margin-top:calc(-.5em + 2px)}.formulate-input[data-classification=slider] input::-webkit-slider-runnable-track{-webkit-appearance:none;appearance:none;width:100%;height:4px;background-color:#efefef;border-radius:3px;margin:0;padding:0}.formulate-input[data-classification=slider] input::-moz-range-track{-moz-appearance:none;appearance:none;width:100%;height:4px;background-color:#efefef;border-radius:3px;margin:0;padding:0}.formulate-input[data-classification=textarea] textarea{-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:.3em;border:1px solid #cecece;box-sizing:border-box;background-color:transparent;font-size:.9em;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;padding:.75em;display:block;width:100%;font-weight:400;line-height:1.2em;margin:0}.formulate-input[data-classification=textarea] textarea::-webkit-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=textarea] textarea::-moz-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=textarea] textarea:-ms-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=textarea] textarea::-ms-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=textarea] textarea::placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=textarea] textarea:focus{outline:0;border:1px solid #41b883}.formulate-input[data-classification=button] button{-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:.3em;box-sizing:border-box;background-color:transparent;font-size:.9em;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;padding:.75em;display:block;width:100%;font-weight:400;line-height:1.2em;margin:0;border:1px solid #41b883;background-color:#41b883;color:#fff;min-width:0;width:auto;font-weight:700;cursor:pointer;display:inline-flex;align-items:center}.formulate-input[data-classification=button] button::-webkit-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=button] button::-moz-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=button] button:-ms-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=button] button::-ms-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=button] button::placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=button] button:focus{outline:0;border:1px solid #41b883}.formulate-input[data-classification=button] button[disabled]{background-color:#cecece;border-color:#cecece}.formulate-input[data-classification=button] button[data-ghost]{color:#41b883;background-color:transparent;border-color:currentColor}.formulate-input[data-classification=button] button[data-minor]{font-size:.75em;display:inline-block}.formulate-input[data-classification=button] button[data-danger]{background-color:#960505;border-color:#960505}.formulate-input[data-classification=button] button[data-danger][data-ghost]{color:#960505;background-color:transparent}.formulate-input[data-classification=button] button:active{background-color:#64c89b;border-color:#64c89b}.formulate-input[data-classification=select] .formulate-input-element{position:relative}.formulate-input[data-classification=select] .formulate-input-element:before{content:"";width:0;height:0;border-color:#cecece transparent transparent;border-style:solid;border-width:.3em .3em 0;top:50%;margin-top:-.1em;right:1em;position:absolute}.formulate-input[data-classification=select] select{-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:.3em;border:1px solid #cecece;box-sizing:border-box;background-color:transparent;font-size:.9em;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;display:block;width:100%;font-weight:400;line-height:1.2em;margin:0;padding:.75em 2em .75em .75em}.formulate-input[data-classification=select] select::-webkit-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=select] select::-moz-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=select] select:-ms-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=select] select::-ms-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=select] select::placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=select] select:focus{outline:0;border:1px solid #41b883}.formulate-input[data-classification=select] select[data-placeholder-selected]{color:#a8a8a8}.formulate-input[data-classification=box] .formulate-input-wrapper{display:flex;align-items:center}.formulate-input[data-classification=box] .formulate-input-element{overflow:hidden;display:flex;align-items:center}.formulate-input[data-classification=box] .formulate-input-element input{position:absolute;left:-999px}.formulate-input[data-classification=box] .formulate-input-element-decorator{display:block;width:1em;height:1em;border-radius:.25em;border:1px solid #cecece;position:relative}.formulate-input[data-classification=box] .formulate-input-element-decorator:before{content:"";display:block;background-size:contain;background-position:100%;width:calc(100% - .125em);height:calc(100% - .125em);box-sizing:border-box;position:absolute;top:.0625em;left:.0625em}.formulate-input[data-classification=box] .formulate-input-element[data-type=radio] .formulate-input-element-decorator{border-radius:1em}.formulate-input[data-classification=box] .formulate-input-element[data-type=radio] .formulate-input-element-decorator:before{border-radius:1em;width:calc(100% - .5em);height:calc(100% - .5em);top:.25em;left:.25em}.formulate-input[data-classification=box] .formulate-input-element input[type=checkbox]:checked~.formulate-input-element-decorator{border-color:#41b883}.formulate-input[data-classification=box] .formulate-input-element input[type=checkbox]:checked~.formulate-input-element-decorator:before{background-color:#41b883;-webkit-mask-image:url('data:image/svg+xml;utf8,');mask-image:url('data:image/svg+xml;utf8,')}.formulate-input[data-classification=box] .formulate-input-element input[type=radio]:checked~.formulate-input-element-decorator{border-color:#41b883}.formulate-input[data-classification=box] .formulate-input-element input[type=radio]:checked~.formulate-input-element-decorator:before{background-color:#41b883}.formulate-input[data-classification=box] .formulate-input-element input:focus~.formulate-input-element-decorator{border-color:#41b883}.formulate-input[data-classification=box] .formulate-input-label--after{margin-left:.5em}.formulate-input[data-classification=box] .formulate-input-label--before{margin-right:.5em}.formulate-input[data-classification=group] .formulate-input-group-item,.formulate-input[data-classification=group]>.formulate-input-wrapper>.formulate-input-label{margin-bottom:.5em}.formulate-input[data-classification=group] [data-is-repeatable]{padding:1em;border:1px solid #efefef;border-radius:.3em}.formulate-input[data-classification=group] [data-is-repeatable] .formulate-input-grouping{margin:-1em -1em 0}.formulate-input[data-classification=group] [data-is-repeatable] .formulate-input-group-repeatable{padding:1em 3em 1em 1em;border-bottom:1px solid #efefef;position:relative}.formulate-input[data-classification=group] [data-is-repeatable] .formulate-input-group-repeatable-remove{position:absolute;display:block;top:calc(50% - .15em);width:1.3em;height:1.3em;background-color:#cecece;right:.85em;border-radius:1.3em;cursor:pointer;transition:background-color .2s}.formulate-input[data-classification=group] [data-is-repeatable] .formulate-input-group-repeatable-remove:after,.formulate-input[data-classification=group] [data-is-repeatable] .formulate-input-group-repeatable-remove:before{content:"";position:absolute;top:calc(50% - .1em);left:.325em;display:block;width:.65em;height:.2em;background-color:#fff;transform-origin:center center;transition:transform .25s}@media (pointer:fine){.formulate-input[data-classification=group] [data-is-repeatable] .formulate-input-group-repeatable-remove:hover{background-color:#dc2c2c}.formulate-input[data-classification=group] [data-is-repeatable] .formulate-input-group-repeatable-remove:hover:after,.formulate-input[data-classification=group] [data-is-repeatable] .formulate-input-group-repeatable-remove:hover:before{height:.2em;width:.75em;left:.25em;top:calc(50% - .075em)}.formulate-input[data-classification=group] [data-is-repeatable] .formulate-input-group-repeatable-remove:hover:after{transform:rotate(45deg)}.formulate-input[data-classification=group] [data-is-repeatable] .formulate-input-group-repeatable-remove:hover:before{transform:rotate(-45deg)}}.formulate-input[data-classification=group] [data-is-repeatable] .formulate-input-group-repeatable:last-child{margin-bottom:1em}.formulate-input[data-classification=file] .formulate-input-upload-area{width:100%;position:relative;padding:2em 0}.formulate-input[data-classification=file] .formulate-input-upload-area input{cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;opacity:0;position:absolute;left:0;right:0;bottom:0;top:0;width:100%;height:100%;z-index:5}.formulate-input[data-classification=file] .formulate-input-upload-area[data-has-files]{padding:0}.formulate-input[data-classification=file] .formulate-input-upload-area[data-has-files] input{display:none}.formulate-input[data-classification=file] .formulate-input-upload-area-mask{border-radius:.4em;pointer-events:none;position:absolute;display:flex;justify-content:center;align-items:center;left:0;right:0;top:0;bottom:0;border:2px dashed #a8a8a8;z-index:2}.formulate-input[data-classification=file] .formulate-input-upload-area-mask:before{content:"";background-color:#a8a8a8;-webkit-mask-image:url('data:image/svg+xml;utf8,');mask-image:url('data:image/svg+xml;utf8,');-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;width:2em;height:2em;position:absolute;pointer-events:none}.formulate-input[data-classification=file] .formulate-input-upload-area input:focus~.formulate-input-upload-area-mask,.formulate-input[data-classification=file] .formulate-input-upload-area input:hover~.formulate-input-upload-area-mask,.formulate-input[data-classification=file] .formulate-input-upload-area input[data-is-drag-hover]~.formulate-input-upload-area-mask{border-color:#41b883}.formulate-input[data-classification=file] .formulate-input-upload-area input:focus~.formulate-input-upload-area-mask:before,.formulate-input[data-classification=file] .formulate-input-upload-area input:hover~.formulate-input-upload-area-mask:before,.formulate-input[data-classification=file] .formulate-input-upload-area input[data-is-drag-hover]~.formulate-input-upload-area-mask:before{background-color:#41b883}.formulate-input[data-classification=file] .formulate-files{list-style-type:none;margin:0;padding:0}.formulate-input[data-classification=file] .formulate-files .formulate-file-progress{background-color:#cecece;height:.3em;border-radius:1.25em;width:5em;overflow:hidden;position:relative;flex:0 0 5em;right:.75em;transition:height .25s,width .25s,flex-basis .25s;z-index:2}.formulate-input[data-classification=file] .formulate-files .formulate-file-progress:before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;display:block;opacity:0;transform:scale(.08);background-color:#fff;-webkit-mask-image:url('data:image/svg+xml;utf8,');mask-image:url('data:image/svg+xml;utf8,');-webkit-mask-size:77%;mask-size:77%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;z-index:3}.formulate-input[data-classification=file] .formulate-files .formulate-file-progress[data-just-finished]{width:1.25em;height:1.25em;flex:0 0 1.25em}.formulate-input[data-classification=file] .formulate-files .formulate-file-progress[data-just-finished]:before{transition:transform .25s .2s,opacity .25s .2s;transform:scale(1);opacity:1}.formulate-input[data-classification=file] .formulate-files .formulate-file-progress[data-is-finished]{transition:height .25s,width .25s,left .25s,top,.25s,border-radius .25s;width:.3em;flex:0 0 .3em;height:100%;right:0;border-radius:0 .23em .23em 0}.formulate-input[data-classification=file] .formulate-files .formulate-file-progress[data-is-finished]:before{transition:opacity .1s;opacity:0}.formulate-input[data-classification=file] .formulate-files .formulate-file-progress .formulate-file-progress-inner{background-color:#41b883;width:1%;position:absolute;left:0;bottom:0;top:0;z-index:2}.formulate-input[data-classification=file] .formulate-files .formulate-file-name{padding-left:1.5em;padding-right:2em;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.formulate-input[data-classification=file] .formulate-files .formulate-file-name:before{position:absolute;left:.7em;top:50%;margin-top:-.7em;background-color:#a8a8a8;content:"";-webkit-mask-image:url('data:image/svg+xml;utf8,');mask-image:url('data:image/svg+xml;utf8,');-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;width:1.25em;height:1.25em;display:inline-block;margin-right:.5em}.formulate-input[data-classification=file] .formulate-files .formulate-file-remove{width:1.25em;height:1.25em;border-radius:1em;border:1px solid #a8a8a8;background-color:#a8a8a8;-webkit-mask-image:url('data:image/svg+xml;utf8,');mask-image:url('data:image/svg+xml;utf8,');-webkit-mask-size:.6em;mask-size:.6em;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;cursor:pointer;position:absolute;right:.75em;z-index:1;transition:transform .25s}@media (pointer:fine){.formulate-input[data-classification=file] .formulate-files .formulate-file-remove:hover{transform:scale(1.5)}}.formulate-input[data-classification=file] .formulate-files li{display:block}.formulate-input[data-classification=file] .formulate-files li[data-has-error] .formulate-file-progress{background-color:#dc2c2c}.formulate-input[data-classification=file] .formulate-files li[data-has-preview] .formulate-file-name:before{display:none}.formulate-input[data-classification=file] .formulate-files li+li{margin-top:.5em}.formulate-input[data-classification=file] .formulate-files .formulate-file{-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:.3em;border:1px solid #cecece;box-sizing:border-box;background-color:transparent;font-size:.9em;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;padding:.75em;font-weight:400;line-height:1.2em;margin:0;display:block;width:100%;display:flex;justify-content:flex-start;align-items:center;position:relative}.formulate-input[data-classification=file] .formulate-files .formulate-file::-webkit-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=file] .formulate-files .formulate-file::-moz-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=file] .formulate-files .formulate-file:-ms-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=file] .formulate-files .formulate-file::-ms-input-placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=file] .formulate-files .formulate-file::placeholder{color:#a8a8a8;line-height:normal}.formulate-input[data-classification=file] .formulate-files .formulate-file:focus{outline:0;border:1px solid #41b883}.formulate-input[data-classification=file] .formulate-files .formulate-file ::-webkit-progress-bar{-webkit-appearance:none;appearance:none;height:.5em;border-radius:.5em;overflow:hidden}.formulate-input[data-classification=file] .formulate-files .formulate-file-image-preview{width:3em;height:3em;flex:0 0 3em;position:relative;z-index:2;left:-1px;box-shadow:0 0 0 1px #efefef;transition:transform .25s,box-shadow .25s,background-color .25s}@media (pointer:fine){.formulate-input[data-classification=file] .formulate-files .formulate-file-image-preview:hover{transition-delay:.2s;transform:scale(3);background-color:#fff;box-shadow:0 0 2px 0 rgba(0,0,0,.1)}}.formulate-input[data-classification=file] .formulate-files .formulate-file-image-preview img{display:block;position:absolute;width:100%;height:100%;left:0;right:0;bottom:0;top:0;-o-object-fit:contain;object-fit:contain;transition:all .25s}.formulate-input[data-classification=file] [data-type=image] .formulate-input-upload-area .formulate-input-upload-area-mask:before{-webkit-mask-image:url('data:image/svg+xml;utf8,');mask-image:url('data:image/svg+xml;utf8,')}.formulate-form-errors{margin:.75em 0;padding:0;list-style-type:none}.formulate-form-errors:first-child{margin-top:0}.formulate-form-errors:last-child{margin-bottom:0}.formulate-form-errors .formulate-form-error{color:#960505;font-size:.9em;font-weight:300;line-height:1.5;margin-bottom:.25em} \ No newline at end of file diff --git a/examples/FormulateSpecimens.vue b/examples/FormulateSpecimens.vue index 0a511fc..a6cd6e6 100644 --- a/examples/FormulateSpecimens.vue +++ b/examples/FormulateSpecimens.vue @@ -1,16 +1,19 @@ diff --git a/examples/specimens/SpecimenText.vue b/examples/specimens/SpecimenText.vue index 625735c..538759b 100644 --- a/examples/specimens/SpecimenText.vue +++ b/examples/specimens/SpecimenText.vue @@ -6,15 +6,11 @@ placeholder="Username" help="Select a username" /> + - - - - diff --git a/package-lock.json b/package-lock.json index 6f6808f..15dd239 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@braid/vue-formulate", - "version": "2.2.6", + "version": "2.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1177,144 +1177,6 @@ "resolved": "https://registry.npmjs.org/@braid/vue-formulate-i18n/-/vue-formulate-i18n-1.6.1.tgz", "integrity": "sha512-yncYwyUiQQJ+jCBom74RSVKGp8eC9sdIyDRzHAV0FGhyXpYg7h79l61bQ6Yz7XxlkbrB/xn5m471TR7H+3l+3w==" }, - "@cypress/listr-verbose-renderer": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@cypress/listr-verbose-renderer/-/listr-verbose-renderer-0.4.1.tgz", - "integrity": "sha1-p3SS9LEdzHxEajSz4ochr9M8ZCo=", - "dev": true, - "requires": { - "chalk": "^1.1.3", - "cli-cursor": "^1.0.2", - "date-fns": "^1.27.2", - "figures": "^1.7.0" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "cli-cursor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz", - "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", - "dev": true, - "requires": { - "restore-cursor": "^1.0.1" - } - }, - "figures": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", - "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.5", - "object-assign": "^4.1.0" - } - }, - "onetime": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", - "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", - "dev": true - }, - "restore-cursor": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz", - "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", - "dev": true, - "requires": { - "exit-hook": "^1.0.0", - "onetime": "^1.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - } - } - }, - "@cypress/request": { - "version": "2.88.5", - "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.5.tgz", - "integrity": "sha512-TzEC1XMi1hJkywWpRfD2clreTa/Z+lOrXDCxxBTBPEcY5azdPi56A6Xw+O4tWJnaJH3iIE7G5aDXZC6JgRZLcA==", - "dev": true, - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - } - }, - "@cypress/xvfb": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@cypress/xvfb/-/xvfb-1.2.4.tgz", - "integrity": "sha512-skbBzPggOVYCbnGgV+0dmBdW/s77ZkAOXIC1knS8NagwDjBrNC1LuXtQJeiN6l+m7lzmHtaoUw/ctJKdqkG57Q==", - "dev": true, - "requires": { - "debug": "^3.1.0", - "lodash.once": "^4.1.1" - }, - "dependencies": { - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - } - } - }, "@hapi/address": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz", @@ -2084,15 +1946,6 @@ "micromatch": "^4.0.2" } }, - "@samverschueren/stream-to-observable": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz", - "integrity": "sha512-MI4Xx6LHs4Webyvi6EbspgyAb4D2Q2VtnCQ1blOJcoLS6mVa8lNN2rkIy1CVxfTUpoyIbCTkXES1rLXztFD1lg==", - "dev": true, - "requires": { - "any-observable": "^0.3.0" - } - }, "@sinonjs/commons": { "version": "1.7.2", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.7.2.tgz", @@ -2252,18 +2105,6 @@ "@types/babel-types": "*" } }, - "@types/blob-util": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@types/blob-util/-/blob-util-1.3.3.tgz", - "integrity": "sha512-4ahcL/QDnpjWA2Qs16ZMQif7HjGP2cw3AGjHabybjw7Vm1EKu+cfQN1D78BaZbS1WJNa1opSMF5HNMztx7lR0w==", - "dev": true - }, - "@types/bluebird": { - "version": "3.5.29", - "resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.29.tgz", - "integrity": "sha512-kmVtnxTuUuhCET669irqQmPAez4KFnFVKvpleVRyfC3g+SHD1hIkFZcWLim9BVcwUBLO59o8VZE4yGCmTif8Yw==", - "dev": true - }, "@types/buble": { "version": "0.19.2", "resolved": "https://registry.npmjs.org/@types/buble/-/buble-0.19.2.tgz", @@ -2273,22 +2114,6 @@ "magic-string": "^0.25.0" } }, - "@types/chai": { - "version": "4.2.7", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.7.tgz", - "integrity": "sha512-luq8meHGYwvky0O7u0eQZdA7B4Wd9owUCqvbw2m3XCrCU8mplYOujMBbvyS547AxJkC+pGnd0Cm15eNxEUNU8g==", - "dev": true - }, - "@types/chai-jquery": { - "version": "1.1.40", - "resolved": "https://registry.npmjs.org/@types/chai-jquery/-/chai-jquery-1.1.40.tgz", - "integrity": "sha512-mCNEZ3GKP7T7kftKeIs7QmfZZQM7hslGSpYzKbOlR2a2HCFf9ph4nlMRA9UnuOETeOQYJVhJQK7MwGqNZVyUtQ==", - "dev": true, - "requires": { - "@types/chai": "*", - "@types/jquery": "*" - } - }, "@types/color-name": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", @@ -2352,33 +2177,12 @@ "@types/istanbul-lib-report": "*" } }, - "@types/jquery": { - "version": "3.3.31", - "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.3.31.tgz", - "integrity": "sha512-Lz4BAJihoFw5nRzKvg4nawXPzutkv7wmfQ5121avptaSIXlDNJCUuxZxX/G+9EVidZGuO0UBlk+YjKbwRKJigg==", - "dev": true, - "requires": { - "@types/sizzle": "*" - } - }, - "@types/lodash": { - "version": "4.14.149", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.149.tgz", - "integrity": "sha512-ijGqzZt/b7BfzcK9vTrS6MFljQRPn5BFWOx8oE0GYxribu6uV+aA9zZuXI1zc/etK9E8nrgdoF2+LgUw7+9tJQ==", - "dev": true - }, "@types/minimatch": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", "dev": true }, - "@types/mocha": { - "version": "5.2.7", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz", - "integrity": "sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==", - "dev": true - }, "@types/node": { "version": "13.13.0", "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.0.tgz", @@ -2412,28 +2216,6 @@ "@types/node": "*" } }, - "@types/sinon": { - "version": "7.5.1", - "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-7.5.1.tgz", - "integrity": "sha512-EZQUP3hSZQyTQRfiLqelC9NMWd1kqLcmQE0dMiklxBkgi84T+cHOhnKpgk4NnOWpGX863yE6+IaGnOXUNFqDnQ==", - "dev": true - }, - "@types/sinon-chai": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/@types/sinon-chai/-/sinon-chai-3.2.3.tgz", - "integrity": "sha512-TOUFS6vqS0PVL1I8NGVSNcFaNJtFoyZPXZ5zur+qlhDfOmQECZZM4H4kKgca6O8L+QceX/ymODZASfUfn+y4yQ==", - "dev": true, - "requires": { - "@types/chai": "*", - "@types/sinon": "*" - } - }, - "@types/sizzle": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.2.tgz", - "integrity": "sha512-7EJYyKTL7tFR8+gDbB6Wwz/arpGa0Mywk1TJbNzKzHtzbwVmY4HR9WqS5VV7dsBUKQmPNr192jHr/VpBluj/hg==", - "dev": true - }, "@types/stack-utils": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz", @@ -3328,12 +3110,6 @@ "color-convert": "^1.9.0" } }, - "any-observable": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/any-observable/-/any-observable-0.3.0.tgz", - "integrity": "sha512-/FQM1EDkTsf63Ub2C6O7GuYFDsSXUwsaZDurV0np41ocwq0jthUAYCmhBX9f+KwlaCgIuWyr/4WlUQUBfKfZog==", - "dev": true - }, "any-promise": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", @@ -4493,12 +4269,6 @@ "isarray": "^1.0.0" } }, - "buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", - "dev": true - }, "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", @@ -4706,12 +4476,6 @@ } } }, - "cachedir": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.3.0.tgz", - "integrity": "sha512-A+Fezp4zxnit6FanDmv9EqXNAi3vt9DWp51/71UEhXukb7QUuvtv9344h91dyAxuTLoSYJFU299qzR3tzwPAhw==", - "dev": true - }, "call-me-maybe": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz", @@ -4853,12 +4617,6 @@ "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dev": true }, - "check-more-types": { - "version": "2.24.0", - "resolved": "https://registry.npmjs.org/check-more-types/-/check-more-types-2.24.0.tgz", - "integrity": "sha1-FCD/sQ/URNz8ebQ4kbv//TKoRgA=", - "dev": true - }, "check-types": { "version": "8.0.3", "resolved": "https://registry.npmjs.org/check-types/-/check-types-8.0.3.tgz", @@ -5124,103 +4882,6 @@ "integrity": "sha512-Xs2Hf2nzrvJMFKimOR7YR0QwZ8fc0u98kdtwN1eNAZzNQgH3vK2pXzff6GJtKh7S5hoJ87ECiAiZFS2fb5Ii2w==", "dev": true }, - "cli-table3": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.5.1.tgz", - "integrity": "sha512-7Qg2Jrep1S/+Q3EceiZtQcDPWxhAvBw+ERf1162v4sikJrvojMHFqXt8QIVha8UlH9rgU0BeWPytZ9/TzYqlUw==", - "dev": true, - "requires": { - "colors": "^1.1.2", - "object-assign": "^4.1.0", - "string-width": "^2.1.1" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "cli-truncate": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-0.2.1.tgz", - "integrity": "sha1-nxXPuwcFAFNpIWxiasfQWrkN1XQ=", - "dev": true, - "requires": { - "slice-ansi": "0.0.4", - "string-width": "^1.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "slice-ansi": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", - "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=", - "dev": true - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - } - } - }, "cli-width": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz", @@ -5365,13 +5026,6 @@ "simple-swizzle": "^0.2.2" } }, - "colors": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", - "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", - "dev": true, - "optional": true - }, "combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -5387,12 +5041,6 @@ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, - "common-tags": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.0.tgz", - "integrity": "sha512-6P6g0uetGpW/sdyUy/iQQCbFF0kWVMSIVSyYz7Zgjcgh8mgw8PQzDNZeyZ5DQ2gM7LBoZPHmnjz8rUthkBG5tw==", - "dev": true - }, "commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", @@ -6104,127 +5752,6 @@ "integrity": "sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=", "dev": true }, - "cypress": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-4.5.0.tgz", - "integrity": "sha512-2A4g5FW5d2fHzq8HKUGAMVTnW6P8nlWYQALiCoGN4bqBLvgwhYM/oG9oKc2CS6LnvgHFiKivKzpm9sfk3uU3zQ==", - "dev": true, - "requires": { - "@cypress/listr-verbose-renderer": "0.4.1", - "@cypress/request": "2.88.5", - "@cypress/xvfb": "1.2.4", - "@types/blob-util": "1.3.3", - "@types/bluebird": "3.5.29", - "@types/chai": "4.2.7", - "@types/chai-jquery": "1.1.40", - "@types/jquery": "3.3.31", - "@types/lodash": "4.14.149", - "@types/minimatch": "3.0.3", - "@types/mocha": "5.2.7", - "@types/sinon": "7.5.1", - "@types/sinon-chai": "3.2.3", - "@types/sizzle": "2.3.2", - "arch": "2.1.1", - "bluebird": "3.7.2", - "cachedir": "2.3.0", - "chalk": "2.4.2", - "check-more-types": "2.24.0", - "cli-table3": "0.5.1", - "commander": "4.1.0", - "common-tags": "1.8.0", - "debug": "4.1.1", - "eventemitter2": "4.1.2", - "execa": "1.0.0", - "executable": "4.1.1", - "extract-zip": "1.7.0", - "fs-extra": "8.1.0", - "getos": "3.1.4", - "is-ci": "2.0.0", - "is-installed-globally": "0.1.0", - "lazy-ass": "1.6.0", - "listr": "0.14.3", - "lodash": "4.17.15", - "log-symbols": "3.0.0", - "minimist": "1.2.5", - "moment": "2.24.0", - "ospath": "1.2.2", - "pretty-bytes": "5.3.0", - "ramda": "0.26.1", - "request-progress": "3.0.0", - "supports-color": "7.1.0", - "tmp": "0.1.0", - "untildify": "4.0.0", - "url": "0.11.0", - "yauzl": "2.10.0" - }, - "dependencies": { - "ci-info": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", - "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", - "dev": true - }, - "commander": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.0.tgz", - "integrity": "sha512-NIQrwvv9V39FHgGFm36+U9SMQzbiHvU79k+iADraJTpmrFFfx7Ds0IvDoAdZsDrknlkRk14OYoWXb57uTh7/sw==", - "dev": true - }, - "fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "is-ci": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", - "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", - "dev": true, - "requires": { - "ci-info": "^2.0.0" - } - }, - "log-symbols": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", - "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", - "dev": true, - "requires": { - "chalk": "^2.4.2" - } - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "tmp": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.1.0.tgz", - "integrity": "sha512-J7Z2K08jbGcdA1kkQpJSqLF6T0tdQqpR2pnSUXsIchbPdTI9v3e85cLW0d6WDhwuAleOV71j2xWs8qMPfK7nKw==", - "dev": true, - "requires": { - "rimraf": "^2.6.3" - } - } - } - }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -6245,12 +5772,6 @@ "whatwg-url": "^7.0.0" } }, - "date-fns": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.30.1.tgz", - "integrity": "sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==", - "dev": true - }, "de-indent": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz", @@ -6823,12 +6344,6 @@ "integrity": "sha512-4bVdSeJScR8fT7ERveLWbxemY5uXEHVseqMRyORosiKcTUSGtVwBkV8uLjXCqoFLeImA57Z9hbz3TOid01U4Hw==", "dev": true }, - "elegant-spinner": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/elegant-spinner/-/elegant-spinner-1.0.1.tgz", - "integrity": "sha1-2wQ1IcldfjA/2PNFvtwzSc+wcp4=", - "dev": true - }, "elliptic": { "version": "6.5.2", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz", @@ -7423,12 +6938,6 @@ "integrity": "sha512-z7IyloorXvKbFx9Bpie2+vMJKKx1fH1EN5yiTfp8CiLOTptSYy1g8H4yDpGlEdshL1PBiFtBHepF2cNsqeEeFQ==", "dev": true }, - "eventemitter2": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-4.1.2.tgz", - "integrity": "sha1-DhqEd6+CGm7zmVsxG/dMI6UkfxU=", - "dev": true - }, "eventemitter3": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.4.tgz", @@ -7481,35 +6990,12 @@ "strip-eof": "^1.0.0" } }, - "executable": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/executable/-/executable-4.1.1.tgz", - "integrity": "sha512-8iA79xD3uAch729dUG8xaaBBFGaEa0wdD2VkYLFHwlqosEj/jT66AzcreRDSgV7ehnNLBW2WR5jIXwGKjVdTLg==", - "dev": true, - "requires": { - "pify": "^2.2.0" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - } - } - }, "exit": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", "dev": true }, - "exit-hook": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-1.1.1.tgz", - "integrity": "sha1-8FyiM7SMBdVP/wd2XfhQfpXAL/g=", - "dev": true - }, "expand-brackets": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", @@ -7789,35 +7275,6 @@ "css": "^2.1.0" } }, - "extract-zip": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz", - "integrity": "sha512-xoh5G1W/PB0/27lXgMQyIhP5DSY/LhoCsOyZgb+6iMmRtCwVBo55uKaMoEYrDCKQhWvqEip5ZPKAc6eFNyf/MA==", - "dev": true, - "requires": { - "concat-stream": "^1.6.2", - "debug": "^2.6.9", - "mkdirp": "^0.5.4", - "yauzl": "^2.10.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, "extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", @@ -8000,15 +7457,6 @@ "bser": "2.1.1" } }, - "fd-slicer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", - "dev": true, - "requires": { - "pend": "~1.2.0" - } - }, "figgy-pudding": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.2.tgz", @@ -9068,23 +8516,6 @@ "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", "dev": true }, - "getos": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/getos/-/getos-3.1.4.tgz", - "integrity": "sha512-UORPzguEB/7UG5hqiZai8f0vQ7hzynMQyJLxStoQ8dPGAcmgsfXOPA4iE/fGtweHYkK+z4zc9V0g+CIFRf5HYw==", - "dev": true, - "requires": { - "async": "^3.1.0" - }, - "dependencies": { - "async": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.0.tgz", - "integrity": "sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw==", - "dev": true - } - } - }, "getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", @@ -9135,15 +8566,6 @@ "integrity": "sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=", "dev": true }, - "global-dirs": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", - "integrity": "sha1-sxnA3UYH81PzvpzKTHL8FIxJ9EU=", - "dev": true, - "requires": { - "ini": "^1.3.4" - } - }, "globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", @@ -10241,27 +9663,6 @@ "is-extglob": "^2.1.1" } }, - "is-installed-globally": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.1.0.tgz", - "integrity": "sha1-Df2Y9akRFxbdU13aZJL2e/PSWoA=", - "dev": true, - "requires": { - "global-dirs": "^0.1.0", - "is-path-inside": "^1.0.0" - }, - "dependencies": { - "is-path-inside": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", - "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", - "dev": true, - "requires": { - "path-is-inside": "^1.0.1" - } - } - } - }, "is-module": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", @@ -10280,15 +9681,6 @@ "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", "dev": true }, - "is-observable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-observable/-/is-observable-1.1.0.tgz", - "integrity": "sha512-NqCa4Sa2d+u7BWc6CukaObG3Fh+CU9bvixbpcXYhy2VvYS7vVGIdAgnIS5Ks3A/cqk4rebLJ9s8zBstT2aKnIA==", - "dev": true, - "requires": { - "symbol-observable": "^1.1.0" - } - }, "is-path-cwd": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz", @@ -12464,12 +11856,6 @@ "launch-editor": "^2.2.1" } }, - "lazy-ass": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/lazy-ass/-/lazy-ass-1.6.0.tgz", - "integrity": "sha1-eZllXoZGwX8In90YfRUNMyTVRRM=", - "dev": true - }, "lazy-cache": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", @@ -12550,143 +11936,6 @@ "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", "dev": true }, - "listr": { - "version": "0.14.3", - "resolved": "https://registry.npmjs.org/listr/-/listr-0.14.3.tgz", - "integrity": "sha512-RmAl7su35BFd/xoMamRjpIE4j3v+L28o8CT5YhAXQJm1fD+1l9ngXY8JAQRJ+tFK2i5njvi0iRUKV09vPwA0iA==", - "dev": true, - "requires": { - "@samverschueren/stream-to-observable": "^0.3.0", - "is-observable": "^1.1.0", - "is-promise": "^2.1.0", - "is-stream": "^1.1.0", - "listr-silent-renderer": "^1.1.1", - "listr-update-renderer": "^0.5.0", - "listr-verbose-renderer": "^0.5.0", - "p-map": "^2.0.0", - "rxjs": "^6.3.3" - }, - "dependencies": { - "p-map": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz", - "integrity": "sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==", - "dev": true - } - } - }, - "listr-silent-renderer": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz", - "integrity": "sha1-kktaN1cVN3C/Go4/v3S4u/P5JC4=", - "dev": true - }, - "listr-update-renderer": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/listr-update-renderer/-/listr-update-renderer-0.5.0.tgz", - "integrity": "sha512-tKRsZpKz8GSGqoI/+caPmfrypiaq+OQCbd+CovEC24uk1h952lVj5sC7SqyFUm+OaJ5HN/a1YLt5cit2FMNsFA==", - "dev": true, - "requires": { - "chalk": "^1.1.3", - "cli-truncate": "^0.2.1", - "elegant-spinner": "^1.0.1", - "figures": "^1.7.0", - "indent-string": "^3.0.0", - "log-symbols": "^1.0.2", - "log-update": "^2.3.0", - "strip-ansi": "^3.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "figures": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", - "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.5", - "object-assign": "^4.1.0" - } - }, - "indent-string": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", - "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", - "dev": true - }, - "log-symbols": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-1.0.2.tgz", - "integrity": "sha1-N2/3tY6jCGoPCfrMdGF+ylAeGhg=", - "dev": true, - "requires": { - "chalk": "^1.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - } - } - }, - "listr-verbose-renderer": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/listr-verbose-renderer/-/listr-verbose-renderer-0.5.0.tgz", - "integrity": "sha512-04PDPqSlsqIOaaaGZ+41vq5FejI9auqTInicFRndCBgE3bXG8D6W1I+mWhk+1nqbHmyhla/6BUrd5OSiHwKRXw==", - "dev": true, - "requires": { - "chalk": "^2.4.1", - "cli-cursor": "^2.1.0", - "date-fns": "^1.27.2", - "figures": "^2.0.0" - }, - "dependencies": { - "figures": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", - "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.5" - } - } - } - }, "load-json-file": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", @@ -12835,12 +12084,6 @@ "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", "dev": true }, - "lodash.once": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", - "integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=", - "dev": true - }, "lodash.sortby": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", @@ -12868,66 +12111,6 @@ "chalk": "^2.0.1" } }, - "log-update": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/log-update/-/log-update-2.3.0.tgz", - "integrity": "sha1-iDKP19HOeTiykoN0bwsbwSayRwg=", - "dev": true, - "requires": { - "ansi-escapes": "^3.0.0", - "cli-cursor": "^2.0.0", - "wrap-ansi": "^3.0.1" - }, - "dependencies": { - "ansi-escapes": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", - "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==", - "dev": true - }, - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - }, - "wrap-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-3.0.1.tgz", - "integrity": "sha1-KIoE2H7aXChuBg3+jxNc6NAH+Lo=", - "dev": true, - "requires": { - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0" - } - } - } - }, "loglevel": { "version": "1.6.8", "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.8.tgz", @@ -13439,12 +12622,6 @@ "minimist": "^1.2.5" } }, - "moment": { - "version": "2.24.0", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz", - "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==", - "dev": true - }, "move-concurrently": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", @@ -14182,12 +13359,6 @@ "os-tmpdir": "^1.0.0" } }, - "ospath": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/ospath/-/ospath-1.2.2.tgz", - "integrity": "sha1-EnZjl3Sj+O8lcvf+QoDg6kVQwHs=", - "dev": true - }, "p-each-series": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-2.1.0.tgz", @@ -14416,12 +13587,6 @@ "sha.js": "^2.4.8" } }, - "pend": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", - "dev": true - }, "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", @@ -15659,12 +14824,6 @@ } } }, - "pretty-bytes": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.3.0.tgz", - "integrity": "sha512-hjGrh+P926p4R4WbaB6OckyRtO0F0/lQBiT+0gnxjV+5kjPBrfVBFCsCLbMqVQeydvIoouYTCmmEURiH3R1Bdg==", - "dev": true - }, "pretty-error": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-2.1.1.tgz", @@ -16087,12 +15246,6 @@ "integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==", "dev": true }, - "ramda": { - "version": "0.26.1", - "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.26.1.tgz", - "integrity": "sha512-hLWjpy7EnsDBb0p+Z3B7rPi3GDeRG5ZtiI33kJhTt+ORCd38AbAIjB/9zRIUoeTbE/AVX5ZkU7m6bznsvrf8eQ==", - "dev": true - }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -16589,15 +15742,6 @@ "uuid": "^3.3.2" } }, - "request-progress": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-3.0.0.tgz", - "integrity": "sha1-TKdUCBx/7GP1BeT6qCWqBs1mnb4=", - "dev": true, - "requires": { - "throttleit": "^1.0.0" - } - }, "request-promise-core": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.3.tgz", @@ -18400,12 +17544,6 @@ "util.promisify": "~1.0.0" } }, - "symbol-observable": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", - "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==", - "dev": true - }, "symbol-tree": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", @@ -18592,12 +17730,6 @@ "integrity": "sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA==", "dev": true }, - "throttleit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz", - "integrity": "sha1-nnhYNtr0Z0MUWlmEtiaNgoUorGw=", - "dev": true - }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -18853,6 +17985,12 @@ "is-typedarray": "^1.0.0" } }, + "typescript": { + "version": "3.9.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.2.tgz", + "integrity": "sha512-q2ktq4n/uLuNNShyayit+DTobV2ApPEo/6so68JaD5ojvc/6GClBipedB9zNWYxRSAlZXAe405Rlijzl6qDiSw==", + "dev": true + }, "uglify-js": { "version": "3.4.10", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.10.tgz", @@ -19018,12 +18156,6 @@ } } }, - "untildify": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", - "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", - "dev": true - }, "upath": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", @@ -20303,16 +19435,6 @@ "decamelize": "^1.2.0" } }, - "yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", - "dev": true, - "requires": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" - } - }, "yorkie": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/yorkie/-/yorkie-2.0.0.tgz", diff --git a/package.json b/package.json index e260b61..f3c278a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@braid/vue-formulate", - "version": "2.2.6", + "version": "2.3.0", "description": "The easiest way to build forms in Vue.", "main": "dist/formulate.umd.js", "module": "dist/formulate.esm.js", @@ -8,9 +8,6 @@ "publishConfig": { "access": "public" }, - "engines": { - "node": ">=11" - }, "browser": { "./sfc": "src/Formulate.js" }, @@ -45,23 +42,22 @@ }, "homepage": "https://www.vueformulate.com", "devDependencies": { - "@babel/core": "^7.8.4", - "@babel/plugin-transform-modules-commonjs": "^7.8.3", - "@babel/preset-env": "^7.8.4", - "@rollup/plugin-buble": "^0.21.1", - "@rollup/plugin-commonjs": "^11.0.2", - "@rollup/plugin-node-resolve": "^7.1.1", - "@vue/cli-plugin-babel": "^4.2.3", - "@vue/cli-plugin-eslint": "^4.2.3", - "@vue/cli-service": "^4.2.3", - "@vue/component-compiler-utils": "^3.1.1", - "@vue/test-utils": "^1.0.0-beta.31", - "autoprefixer": "^9.7.4", + "@babel/core": "^7.9.6", + "@babel/plugin-transform-modules-commonjs": "^7.9.6", + "@babel/preset-env": "^7.9.6", + "@rollup/plugin-buble": "^0.21.3", + "@rollup/plugin-commonjs": "^11.1.0", + "@rollup/plugin-node-resolve": "^7.1.3", + "@vue/cli-plugin-babel": "^4.3.1", + "@vue/cli-plugin-eslint": "^4.3.1", + "@vue/cli-service": "^4.3.1", + "@vue/component-compiler-utils": "^3.1.2", + "@vue/test-utils": "^1.0.2", + "autoprefixer": "^9.7.6", "babel-core": "^7.0.0-bridge.0", - "babel-eslint": "^10.0.1", - "babel-jest": "^25.1.0", + "babel-eslint": "^10.1.0", + "babel-jest": "^25.5.1", "cssnano": "^4.1.10", - "cypress": "^4.1.0", "eslint": "^5.16.0", "eslint-config-standard": "^12.0.0", "eslint-plugin-import": "^2.20.1", @@ -70,18 +66,19 @@ "eslint-plugin-standard": "^4.0.0", "eslint-plugin-vue": "^5.2.3", "flush-promises": "^1.0.2", - "jest": "^25.1.0", + "jest": "^25.5.4", "jest-vue-preprocessor": "^1.7.1", - "node-sass": "^4.13.1", - "postcss": "^7.0.27", - "postcss-cli": "^7.1.0", - "rollup": "^1.31.1", + "node-sass": "^4.14.1", + "postcss": "^7.0.30", + "postcss-cli": "^7.1.1", + "rollup": "^1.32.1", "rollup-plugin-auto-external": "^2.0.0", "rollup-plugin-internal": "^1.0.4", "rollup-plugin-multi-input": "^1.1.1", - "rollup-plugin-terser": "^5.2.0", - "rollup-plugin-vue": "^5.1.6", + "rollup-plugin-terser": "^5.3.0", + "rollup-plugin-vue": "^5.1.7", "sass-loader": "^8.0.2", + "typescript": "^3.9.2", "vue": "^2.6.11", "vue-jest": "^3.0.5", "vue-runtime-helpers": "^1.1.2", @@ -90,7 +87,7 @@ "watch": "^1.0.2" }, "dependencies": { - "@braid/vue-formulate-i18n": "^1.4.0", + "@braid/vue-formulate-i18n": "^1.6.1", "is-plain-object": "^3.0.0", "is-url": "^1.2.4", "nanoid": "^2.1.11" diff --git a/src/FormSubmission.js b/src/FormSubmission.js index 7b625b1..30b33f0 100644 --- a/src/FormSubmission.js +++ b/src/FormSubmission.js @@ -26,11 +26,11 @@ export default class FormSubmission { values () { return new Promise((resolve, reject) => { const pending = [] - const values = cloneDeep(this.form.internalFormModelProxy) + const values = cloneDeep(this.form.proxy) for (const key in values) { - if (typeof this.form.internalFormModelProxy[key] === 'object' && this.form.internalFormModelProxy[key] instanceof FileUpload) { + if (typeof this.form.proxy[key] === 'object' && this.form.proxy[key] instanceof FileUpload) { pending.push( - this.form.internalFormModelProxy[key].upload().then(data => Object.assign(values, { [key]: data })) + this.form.proxy[key].upload().then(data => Object.assign(values, { [key]: data })) ) } } diff --git a/src/Formulate.js b/src/Formulate.js index 0742107..bf99fe4 100644 --- a/src/Formulate.js +++ b/src/Formulate.js @@ -2,21 +2,28 @@ import library from './libs/library' import rules from './libs/rules' import mimes from './libs/mimes' import FileUpload from './FileUpload' -import { arrayify, parseLocale } from './libs/utils' +import { arrayify, parseLocale, has } from './libs/utils' import isPlainObject from 'is-plain-object' import { en } from '@braid/vue-formulate-i18n' import fauxUploader from './libs/faux-uploader' -import FormulateInput from './FormulateInput.vue' +import FormulateSlot from './FormulateSlot' import FormulateForm from './FormulateForm.vue' +import FormulateInput from './FormulateInput.vue' import FormulateErrors from './FormulateErrors.vue' -import FormulateInputGroup from './FormulateInputGroup.vue' +import FormulateHelp from './slots/FormulateHelp.vue' +import FormulateGrouping from './FormulateGrouping.vue' +import FormulateLabel from './slots/FormulateLabel.vue' +import FormulateAddMore from './slots/FormulateAddMore.vue' import FormulateInputBox from './inputs/FormulateInputBox.vue' import FormulateInputText from './inputs/FormulateInputText.vue' import FormulateInputFile from './inputs/FormulateInputFile.vue' +import FormulateRepeatable from './slots/FormulateRepeatable.vue' +import FormulateInputGroup from './inputs/FormulateInputGroup.vue' import FormulateInputButton from './inputs/FormulateInputButton.vue' import FormulateInputSelect from './inputs/FormulateInputSelect.vue' import FormulateInputSlider from './inputs/FormulateInputSlider.vue' import FormulateInputTextArea from './inputs/FormulateInputTextArea.vue' +import FormulateRepeatableProvider from './FormulateRepeatableProvider.vue' /** * The base formulate library. @@ -29,17 +36,31 @@ class Formulate { this.options = {} this.defaults = { components: { + FormulateSlot, FormulateForm, + FormulateHelp, + FormulateLabel, FormulateInput, FormulateErrors, + FormulateAddMore, + FormulateGrouping, FormulateInputBox, FormulateInputText, FormulateInputFile, + FormulateRepeatable, FormulateInputGroup, FormulateInputButton, FormulateInputSelect, FormulateInputSlider, - FormulateInputTextArea + FormulateInputTextArea, + FormulateRepeatableProvider + }, + slotComponents: { + label: 'FormulateLabel', + help: 'FormulateHelp', + errors: 'FormulateErrors', + repeatable: 'FormulateRepeatable', + addMore: 'FormulateAddMore' }, library, rules, @@ -51,9 +72,11 @@ class Formulate { uploadJustCompleteDuration: 1000, errorHandler: (err) => err, plugins: [ en ], - locales: {} + locales: {}, + idPrefix: 'formulate-' } this.registry = new Map() + this.idRegistry = {} } /** @@ -73,6 +96,21 @@ class Formulate { } } + /** + * Produce a deterministically generated id based on the sequence by which it + * was requested. This should be *theoretically* the same SSR as client side. + * However, SSR and deterministic ids can be very challenging, so this + * implementation is open to community review. + */ + nextId (vm) { + const path = vm.$route && vm.$route.path ? vm.$route.path : false + const pathPrefix = path ? vm.$route.path.replace(/[/\\.\s]/g, '-') : 'global' + if (!Object.prototype.hasOwnProperty.call(this.idRegistry, pathPrefix)) { + this.idRegistry[pathPrefix] = 0 + } + return `${this.options.idPrefix}${pathPrefix}-${++this.idRegistry[pathPrefix]}` + } + /** * Given a set of options, apply them to the pre-existing options. * @param {Object} extendWith @@ -139,7 +177,20 @@ class Formulate { } /** - * Get validation rules. + * What component should be rendered for the given slot location and type. + * @param {string} type the type of component + * @param {string} slot the name of the slot + */ + slotComponent (type, slot) { + const def = this.options.library[type] + if (def && def.slotComponents && def.slotComponents[slot]) { + return def.slotComponents[slot] + } + return this.options.slotComponents[slot] + } + + /** + * Get validation rules by merging any passed in with global rules. * @return {object} object of validation functions */ rules (rules = {}) { @@ -176,7 +227,7 @@ class Formulate { } if (locale) { const option = parseLocale(locale) - .find(locale => Object.prototype.hasOwnProperty.call(this.options.locales, locale)) + .find(locale => has(this.options.locales, locale)) if (option) { selection = option } @@ -236,7 +287,7 @@ class Formulate { * @param {error} */ handle (err, formName, skip = false) { - const e = skip ? err : this.options.errorHandler(err) + const e = skip ? err : this.options.errorHandler(err, formName) if (formName && this.registry.has(formName)) { this.registry.get(formName).applyErrors({ formErrors: arrayify(e.formErrors), @@ -246,6 +297,39 @@ class Formulate { return e } + /** + * Reset a form. + * @param {string} formName + * @param {object} initialValue + */ + reset (formName, initialValue = {}) { + this.resetValidation(formName) + this.setValues(formName, initialValue) + } + + /** + * Reset the form's validation messages. + * @param {string} formName + */ + resetValidation (formName) { + const form = this.registry.get(formName) + form.hideErrors(formName) + form.namedErrors = [] + form.namedFieldErrors = {} + } + + /** + * Set the form values. + * @param {string} formName + * @param {object} values + */ + setValues (formName, values) { + if (values && !Array.isArray(values) && typeof values === 'object') { + const form = this.registry.get(formName) + form.setValues({ ...values }) + } + } + /** * Get the file uploader. */ diff --git a/src/FormulateErrors.vue b/src/FormulateErrors.vue index 6f9c44d..e1cf3ca 100644 --- a/src/FormulateErrors.vue +++ b/src/FormulateErrors.vue @@ -52,6 +52,7 @@ export default { }, visibleErrors () { return Array.from(new Set(this.mergedErrors.concat(this.visibleValidationErrors))) + .filter(message => typeof message === 'string') } }, created () { diff --git a/src/FormulateForm.vue b/src/FormulateForm.vue index 0e8ea81..d4dc344 100644 --- a/src/FormulateForm.vue +++ b/src/FormulateForm.vue @@ -12,15 +12,14 @@ diff --git a/src/FormulateInput.vue b/src/FormulateInput.vue index c6adf6f..ffe47e9 100644 --- a/src/FormulateInput.vue +++ b/src/FormulateInput.vue @@ -8,14 +8,25 @@ >
- + + -
-
- + + + + + +
diff --git a/src/FormulateRepeatableProvider.vue b/src/FormulateRepeatableProvider.vue new file mode 100644 index 0000000..5ba0285 --- /dev/null +++ b/src/FormulateRepeatableProvider.vue @@ -0,0 +1,63 @@ + + + diff --git a/src/FormulateSlot.js b/src/FormulateSlot.js new file mode 100644 index 0000000..822aa8e --- /dev/null +++ b/src/FormulateSlot.js @@ -0,0 +1,36 @@ +export default { + inheritAttrs: false, + functional: true, + render (h, { props, data, parent, children }) { + var p = parent + var { name, forceWrap, context, ...mergeWithContext } = props + + // Look up the ancestor tree for the first FormulateInput + while (p && p.$options.name !== 'FormulateInput') { + p = p.$parent + } + + // if we never found the proper parent, just end it. + if (!p) { + return null + } + + // If we found a formulate input, check for a matching scoped slot + if (p.$scopedSlots && p.$scopedSlots[props.name]) { + return p.$scopedSlots[props.name]({ ...context, ...mergeWithContext }) + } + + // If we found no scoped slot, take the children and render those inside a wrapper if there are multiple + if (Array.isArray(children) && (children.length > 1 || (forceWrap && children.length > 0))) { + const { name, context, ...attrs } = data.attrs + return h('div', { ...data, ...{ attrs } }, children) + + // If there is only one child, render it alone + } else if (Array.isArray(children) && children.length === 1) { + return children[0] + } + + // If there are no children, render nothing + return null + } +} diff --git a/src/inputs/FormulateInputButton.vue b/src/inputs/FormulateInputButton.vue index 801a922..d348ce5 100644 --- a/src/inputs/FormulateInputButton.vue +++ b/src/inputs/FormulateInputButton.vue @@ -6,6 +6,7 @@