diff --git a/dist/index.js b/dist/index.js index 80d34ea..13709bb 100644 --- a/dist/index.js +++ b/dist/index.js @@ -40,4 +40,4 @@ var n=r(3);t.exports=function(t){return n(t)||"function"==typeof t||Array.isArra * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */ -var n=r(5),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){n(t,function(n,i){if(o.call(t,i))return e.call(r,t[i],i,t)})}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(7),o=r.n(n);for(var i in n)"default"!==i&&function(t){r.d(e,t,function(){return n[t]})}(i);var a=r(23),u=r(6),s=u(o.a,a.a,!1,null,null,null);e.default=s.exports},function(t,e,r){"use strict";var n=function(){var t=this,e=t.$createElement;return(t._self._c||e)("form",{staticClass:"formulate-form",on:{submit:function(e){e.preventDefault(),t.submit(e)}}},[t._t("default")],2)},o=[],i={render:n,staticRenderFns:o};e.a=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(8),o=r.n(n);for(var i in n)"default"!==i&&function(t){r.d(e,t,function(){return n[t]})}(i);var a=r(33),u=r(6),s=u(o.a,a.a,!1,null,null,null);e.default=s.exports},function(t,e,r){"use strict";t.exports=r(26)},function(t,e,r){"use strict";function n(e){return u.seed(e),t.exports}function o(e){return f=e,t.exports}function i(t){return void 0!==t&&u.characters(t),u.shuffled()}function a(){return l(f)}var u=r(0),s=(r(9),r(29)),l=r(30),c=r(31),f=r(32)||0;t.exports=a,t.exports.generate=a,t.exports.seed=n,t.exports.worker=o,t.exports.characters=i,t.exports.decode=s,t.exports.isValid=c},function(t,e,r){"use strict";function n(){return(i=(9301*i+49297)%233280)/233280}function o(t){i=t}var i=1;t.exports={nextValue:n,seed:o}},function(t,e,r){"use strict";function n(){if(!o||!o.getRandomValues)return 48&Math.floor(256*Math.random());var t=new Uint8Array(1);return o.getRandomValues(t),48&t[0]}var o="object"==typeof window&&(window.crypto||window.msCrypto);t.exports=n},function(t,e,r){"use strict";function n(t){var e=o.shuffled();return{version:15&e.indexOf(t.substr(0,1)),worker:15&e.indexOf(t.substr(1,1))}}var o=r(0);t.exports=n},function(t,e,r){"use strict";function n(t){var e="",r=Math.floor(.001*(Date.now()-s));return r===i?o++:(o=0,i=r),e+=a(u.lookup,l),e+=a(u.lookup,t),o>0&&(e+=a(u.lookup,o)),e+=a(u.lookup,r)}var o,i,a=r(9),u=r(0),s=1459707606518,l=6;t.exports=n},function(t,e,r){"use strict";function n(t){if(!t||"string"!=typeof t||t.length<6)return!1;for(var e=o.characters(),r=t.length,n=0;n1)?r("label",{attrs:{for:t.id},domProps:{textContent:t._s(t.label)}}):t._e(),t._v(" "),"checkbox"===t.type&&t.isTextInput?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],ref:"input",class:t.elementClasses,attrs:{name:t.name,disabled:t.disabled,type:"checkbox"},domProps:{checked:Array.isArray(t.val)?t._i(t.val,null)>-1:t.val},on:{blur:function(e){t.errorBlurState=!0},change:function(e){var r=t.val,n=e.target,o=!!n.checked;if(Array.isArray(r)){var i=t._i(r,null);n.checked?i<0&&(t.val=r.concat([null])):i>-1&&(t.val=r.slice(0,i).concat(r.slice(i+1)))}else t.val=o}}},"input",t.attributes,!1)):"radio"===t.type&&t.isTextInput?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],ref:"input",class:t.elementClasses,attrs:{name:t.name,disabled:t.disabled,type:"radio"},domProps:{checked:t._q(t.val,null)},on:{blur:function(e){t.errorBlurState=!0},change:function(e){t.val=null}}},"input",t.attributes,!1)):t.isTextInput?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],ref:"input",class:t.elementClasses,attrs:{name:t.name,disabled:t.disabled,type:t.type},domProps:{value:t.val},on:{blur:function(e){t.errorBlurState=!0},input:function(e){e.target.composing||(t.val=e.target.value)}}},"input",t.attributes,!1)):t._e(),t._v(" "),t.isTextareaInput?r("textarea",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],ref:"textarea",class:t.elementClasses,attrs:{type:t.type,name:t.name,disabled:t.disabled},domProps:{value:t.val},on:{blur:function(e){t.errorBlurState=!0},input:function(e){e.target.composing||(t.val=e.target.value)}}},"textarea",t.attributes,!1)):t._e(),t._v(" "),t.isButtonInput?r("button",{class:t.elementClasses,attrs:{type:t.type,disabled:t.disabled||"submit"===t.type&&t.form.hasErrors&&"live"===t.form.behavior}},[t.$slots.button?t._t("button"):r("span",{domProps:{textContent:t._s(t.label||t.name)}})],2):t._e(),t._v(" "),t.isSelectInput?r("select",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],class:t.elementClasses,attrs:{name:t.name,disabled:t.disabled},on:{blur:function(e){t.errorBlurState=!0},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.val=e.target.multiple?r:r[0]}}},"select",t.attributes,!1),t._l(t.optionList,function(e){return r("option",t._b({key:e.id,domProps:{value:e.value,textContent:t._s(e.label)}},"option",e.attributes||{},!1))})):t._e(),t._v(" "),t.isBoxInput?r("div",{staticClass:"formulate-element-box-input-group"},[t._l(t.optionList,function(e){return["radio"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],key:e.id+"-input",class:t.elementClasses,attrs:{type:"radio",name:t.name,id:e.id,disabled:t.disabled},domProps:{value:e.value,checked:t._q(t.val,e.value)},on:{blur:function(e){t.errorBlurState=!0},change:function(r){t.val=e.value}}},"input",t.attributes,!1)):t._e(),t._v(" "),"checkbox"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],key:e.id+"-input",class:t.elementClasses,attrs:{type:"checkbox",name:t.name,id:e.id,disabled:t.disabled},domProps:{value:e.value,checked:Array.isArray(t.val)?t._i(t.val,e.value)>-1:t.val},on:{blur:function(e){t.errorBlurState=!0},change:function(r){var n=t.val,o=r.target,i=!!o.checked;if(Array.isArray(n)){var a=e.value,u=t._i(n,a);o.checked?u<0&&(t.val=n.concat([a])):u>-1&&(t.val=n.slice(0,u).concat(n.slice(u+1)))}else t.val=i}}},"input",t.attributes,!1)):t._e(),t._v(" "),r("label",{key:e.id+"-label",attrs:{for:e.id},domProps:{textContent:t._s(e.label)}})]})],2):t._e(),t._v(" "),t.hasCustomInput?t._t("default"):t._e(),t._v(" "),t.isUnsupportedInput?r("div",{staticStyle:{"background-color":"red",color:"white"},domProps:{textContent:t._s("Unsupported field type: “"+t.type+"”.")}}):t._e()],2),t._v(" "),t.help?r("div",{staticClass:"formulate-help",domProps:{textContent:t._s(t.help)}}):t._e(),t._v(" "),r("transition",{attrs:{name:"formulate-errors"}},[t.shouldShowErrors&&t.localAndValidationErrors.length?r("transition-group",{staticClass:"formulate-errors",attrs:{tag:"ul",name:"formulate-error-list"}},t._l(t.localAndValidationErrors,function(e){return r("li",{key:e,domProps:{textContent:t._s(e)}})})):t._e()],1)],1)},o=[],i={render:n,staticRenderFns:o};e.a=i},function(t,e,r){"use strict";function n(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){function n(o,i){try{var a=e[o](i),u=a.value}catch(t){return void r(t)}if(!a.done)return Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)});t(u)}return n("next")})}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=function(t){return t&&t.__esModule?t:{default:t}}(o);e.default={required:function(){function t(t){return e.apply(this,arguments)}var e=n(i.default.mark(function t(e){var r=e.value,n=e.error,o=arguments;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",!(r&&(!Array.isArray(r)||r.length))&&n.apply(void 0,o));case 1:case"end":return t.stop()}},t,this)}));return t}(),email:function(){function t(t){return e.apply(this,arguments)}var e=n(i.default.mark(function t(e){var r,n=e.value,o=e.error,a=arguments;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=/^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/,t.abrupt("return",!(!n||r.test(n.toLowerCase()))&&o.apply(void 0,a));case 2:case"end":return t.stop()}},t,this)}));return t}(),confirmed:function(){function t(t,r){return e.apply(this,arguments)}var e=n(i.default.mark(function t(e,r){var n=e.field,o=e.value,a=e.error,u=e.values,s=arguments;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=r||n+"_confirmation",t.abrupt("return",!(!o||o===u[r])&&a.apply(void 0,s));case 2:case"end":return t.stop()}},t,this)}));return t}()}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={required:function(t){var e=t.label;return t.value,e+" is required"},email:function(t){var e=t.label;return t.value,e+" is invalid."},confirmed:function(t){var e=t.label;return t.value,e+" does not match the confirmation field."},default:function(t){return t.label,t.value,"This field is invalid."}}}])}); \ No newline at end of file +var n=r(5),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){n(t,function(n,i){if(o.call(t,i))return e.call(r,t[i],i,t)})}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(7),o=r.n(n);for(var i in n)"default"!==i&&function(t){r.d(e,t,function(){return n[t]})}(i);var a=r(23),u=r(6),s=u(o.a,a.a,!1,null,null,null);e.default=s.exports},function(t,e,r){"use strict";var n=function(){var t=this,e=t.$createElement;return(t._self._c||e)("form",{staticClass:"formulate-form",on:{submit:function(e){e.preventDefault(),t.submit(e)}}},[t._t("default")],2)},o=[],i={render:n,staticRenderFns:o};e.a=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(8),o=r.n(n);for(var i in n)"default"!==i&&function(t){r.d(e,t,function(){return n[t]})}(i);var a=r(33),u=r(6),s=u(o.a,a.a,!1,null,null,null);e.default=s.exports},function(t,e,r){"use strict";t.exports=r(26)},function(t,e,r){"use strict";function n(e){return u.seed(e),t.exports}function o(e){return f=e,t.exports}function i(t){return void 0!==t&&u.characters(t),u.shuffled()}function a(){return l(f)}var u=r(0),s=(r(9),r(29)),l=r(30),c=r(31),f=r(32)||0;t.exports=a,t.exports.generate=a,t.exports.seed=n,t.exports.worker=o,t.exports.characters=i,t.exports.decode=s,t.exports.isValid=c},function(t,e,r){"use strict";function n(){return(i=(9301*i+49297)%233280)/233280}function o(t){i=t}var i=1;t.exports={nextValue:n,seed:o}},function(t,e,r){"use strict";function n(){if(!o||!o.getRandomValues)return 48&Math.floor(256*Math.random());var t=new Uint8Array(1);return o.getRandomValues(t),48&t[0]}var o="object"==typeof window&&(window.crypto||window.msCrypto);t.exports=n},function(t,e,r){"use strict";function n(t){var e=o.shuffled();return{version:15&e.indexOf(t.substr(0,1)),worker:15&e.indexOf(t.substr(1,1))}}var o=r(0);t.exports=n},function(t,e,r){"use strict";function n(t){var e="",r=Math.floor(.001*(Date.now()-s));return r===i?o++:(o=0,i=r),e+=a(u.lookup,l),e+=a(u.lookup,t),o>0&&(e+=a(u.lookup,o)),e+=a(u.lookup,r)}var o,i,a=r(9),u=r(0),s=1459707606518,l=6;t.exports=n},function(t,e,r){"use strict";function n(t){if(!t||"string"!=typeof t||t.length<6)return!1;for(var e=o.characters(),r=t.length,n=0;n1)?r("label",{attrs:{for:t.id},domProps:{textContent:t._s(t.label)}}):t._e(),t._v(" "),"checkbox"===t.type&&t.isTextInput?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],ref:"input",class:t.elementClasses,attrs:{name:t.name,disabled:t.disabled,type:"checkbox"},domProps:{checked:Array.isArray(t.val)?t._i(t.val,null)>-1:t.val},on:{blur:function(e){t.errorBlurState=!0},change:function(e){var r=t.val,n=e.target,o=!!n.checked;if(Array.isArray(r)){var i=t._i(r,null);n.checked?i<0&&(t.val=r.concat([null])):i>-1&&(t.val=r.slice(0,i).concat(r.slice(i+1)))}else t.val=o}}},"input",t.attributes,!1)):"radio"===t.type&&t.isTextInput?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],ref:"input",class:t.elementClasses,attrs:{name:t.name,disabled:t.disabled,type:"radio"},domProps:{checked:t._q(t.val,null)},on:{blur:function(e){t.errorBlurState=!0},change:function(e){t.val=null}}},"input",t.attributes,!1)):t.isTextInput?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],ref:"input",class:t.elementClasses,attrs:{name:t.name,disabled:t.disabled,type:t.type},domProps:{value:t.val},on:{blur:function(e){t.errorBlurState=!0},input:function(e){e.target.composing||(t.val=e.target.value)}}},"input",t.attributes,!1)):t._e(),t._v(" "),t.isTextareaInput?r("textarea",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],ref:"textarea",class:t.elementClasses,attrs:{type:t.type,name:t.name,disabled:t.disabled},domProps:{value:t.val},on:{blur:function(e){t.errorBlurState=!0},input:function(e){e.target.composing||(t.val=e.target.value)}}},"textarea",t.attributes,!1)):t._e(),t._v(" "),t.isButtonInput?r("button",{class:t.elementClasses,attrs:{type:t.type,disabled:t.disabled||"submit"===t.type&&t.form.hasErrors&&"live"===t.form.behavior}},[t.$slots.button?t._t("button"):r("span",{domProps:{textContent:t._s(t.label||t.name)}})],2):t._e(),t._v(" "),t.isSelectInput?r("select",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],class:t.elementClasses,attrs:{name:t.name,disabled:t.disabled},on:{blur:function(e){t.errorBlurState=!0},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.val=e.target.multiple?r:r[0]}}},"select",t.attributes,!1),t._l(t.optionList,function(e){return r("option",t._b({key:e.id,domProps:{value:e.value,textContent:t._s(e.label)}},"option",e.attributes||{},!1))})):t._e(),t._v(" "),t.isBoxInput?r("div",{staticClass:"formulate-element-box-input-wrap"},t._l(t.optionList,function(e){return r("div",{key:e.id,staticClass:"formulate-element-box-input-group"},["radio"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],key:e.id+"-input",class:t.elementClasses,attrs:{type:"radio",name:t.name,id:e.id,disabled:t.disabled},domProps:{value:e.value,checked:t._q(t.val,e.value)},on:{blur:function(e){t.errorBlurState=!0},change:function(r){t.val=e.value}}},"input",t.attributes,!1)):t._e(),t._v(" "),"checkbox"===t.type?r("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],key:e.id+"-input",class:t.elementClasses,attrs:{type:"checkbox",name:t.name,id:e.id,disabled:t.disabled},domProps:{value:e.value,checked:Array.isArray(t.val)?t._i(t.val,e.value)>-1:t.val},on:{blur:function(e){t.errorBlurState=!0},change:function(r){var n=t.val,o=r.target,i=!!o.checked;if(Array.isArray(n)){var a=e.value,u=t._i(n,a);o.checked?u<0&&(t.val=n.concat([a])):u>-1&&(t.val=n.slice(0,u).concat(n.slice(u+1)))}else t.val=i}}},"input",t.attributes,!1)):t._e(),t._v(" "),r("label",{key:e.id+"-label",attrs:{for:e.id},domProps:{textContent:t._s(e.label)}})])})):t._e(),t._v(" "),t.hasCustomInput?t._t("default"):t._e(),t._v(" "),t.isUnsupportedInput?r("div",{staticStyle:{"background-color":"red",color:"white"},domProps:{textContent:t._s("Unsupported field type: “"+t.type+"”.")}}):t._e()],2),t._v(" "),t.help?r("div",{staticClass:"formulate-help",domProps:{textContent:t._s(t.help)}}):t._e(),t._v(" "),r("transition",{attrs:{name:"formulate-errors"}},[t.shouldShowErrors&&t.localAndValidationErrors.length?r("transition-group",{staticClass:"formulate-errors",attrs:{tag:"ul",name:"formulate-error-list"}},t._l(t.localAndValidationErrors,function(e){return r("li",{key:e,domProps:{textContent:t._s(e)}})})):t._e()],1)],1)},o=[],i={render:n,staticRenderFns:o};e.a=i},function(t,e,r){"use strict";function n(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,r){function n(o,i){try{var a=e[o](i),u=a.value}catch(t){return void r(t)}if(!a.done)return Promise.resolve(u).then(function(t){n("next",t)},function(t){n("throw",t)});t(u)}return n("next")})}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=function(t){return t&&t.__esModule?t:{default:t}}(o);e.default={required:function(){function t(t){return e.apply(this,arguments)}var e=n(i.default.mark(function t(e){var r=e.value,n=e.error,o=arguments;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",!(r&&(!Array.isArray(r)||r.length))&&n.apply(void 0,o));case 1:case"end":return t.stop()}},t,this)}));return t}(),email:function(){function t(t){return e.apply(this,arguments)}var e=n(i.default.mark(function t(e){var r,n=e.value,o=e.error,a=arguments;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=/^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/,t.abrupt("return",!(!n||r.test(n.toLowerCase()))&&o.apply(void 0,a));case 2:case"end":return t.stop()}},t,this)}));return t}(),confirmed:function(){function t(t,r){return e.apply(this,arguments)}var e=n(i.default.mark(function t(e,r){var n=e.field,o=e.value,a=e.error,u=e.values,s=arguments;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=r||n+"_confirmation",t.abrupt("return",!(!o||o===u[r])&&a.apply(void 0,s));case 2:case"end":return t.stop()}},t,this)}));return t}()}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={required:function(t){var e=t.label;return t.value,e+" is required"},email:function(t){var e=t.label;return t.value,e+" is invalid."},confirmed:function(t){var e=t.label;return t.value,e+" does not match the confirmation field."},default:function(t){return t.label,t.value,"This field is invalid."}}}])}); \ No newline at end of file diff --git a/src/components/FormulateElement.vue b/src/components/FormulateElement.vue index a99cc6d..67abca7 100644 --- a/src/components/FormulateElement.vue +++ b/src/components/FormulateElement.vue @@ -70,10 +70,14 @@
- +