diff --git a/dist/index.js b/dist/index.js index 6dae68b..3dfd4a9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -40,4 +40,4 @@ var n=e(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=e(5),o=Object.prototype.hasOwnProperty;t.exports=function(t,r,e){n(t,function(n,i){if(o.call(t,i))return r.call(e,t[i],i,t)})}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(7),o=e.n(n);for(var i in n)"default"!==i&&function(t){e.d(r,t,function(){return n[t]})}(i);var a=e(23),u=e(6),s=u(o.a,a.a,!1,null,null,null);r.default=s.exports},function(t,r,e){"use strict";var n=function(){var t=this,r=t.$createElement;return(t._self._c||r)("form",{staticClass:"formulate-form",on:{submit:function(r){r.preventDefault(),t.submit(r)}}},[t._t("default")],2)},o=[],i={render:n,staticRenderFns:o};r.a=i},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(8),o=e.n(n);for(var i in n)"default"!==i&&function(t){e.d(r,t,function(){return n[t]})}(i);var a=e(33),u=e(6),s=u(o.a,a.a,!1,null,null,null);r.default=s.exports},function(t,r,e){"use strict";t.exports=e(26)},function(t,r,e){"use strict";function n(r){return u.seed(r),t.exports}function o(r){return f=r,t.exports}function i(t){return void 0!==t&&u.characters(t),u.shuffled()}function a(){return c(f)}var u=e(0),s=(e(9),e(29)),c=e(30),l=e(31),f=e(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=l},function(t,r,e){"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,r,e){"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,r,e){"use strict";function n(t){var r=o.shuffled();return{version:15&r.indexOf(t.substr(0,1)),worker:15&r.indexOf(t.substr(1,1))}}var o=e(0);t.exports=n},function(t,r,e){"use strict";function n(t){var r="",e=Math.floor(.001*(Date.now()-s));return e===i?o++:(o=0,i=e),r+=a(u.lookup,c),r+=a(u.lookup,t),o>0&&(r+=a(u.lookup,o)),r+=a(u.lookup,e)}var o,i,a=e(9),u=e(0),s=1459707606518,c=6;t.exports=n},function(t,r,e){"use strict";function n(t){if(!t||"string"!=typeof t||t.length<6)return!1;for(var r=o.characters(),e=t.length,n=0;n1)?e("label",{attrs:{for:t.id},domProps:{textContent:t._s(t.label)}}):t._e(),t._v(" "),"checkbox"===t.type&&t.isTextInput?e("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],ref:"input",attrs:{name:t.name,type:"checkbox"},domProps:{checked:Array.isArray(t.val)?t._i(t.val,null)>-1:t.val},on:{blur:function(r){t.errorBlurState=!0},change:function(r){var e=t.val,n=r.target,o=!!n.checked;if(Array.isArray(e)){var i=t._i(e,null);n.checked?i<0&&(t.val=e.concat([null])):i>-1&&(t.val=e.slice(0,i).concat(e.slice(i+1)))}else t.val=o}}},"input",t.attributes,!1)):"radio"===t.type&&t.isTextInput?e("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],ref:"input",attrs:{name:t.name,type:"radio"},domProps:{checked:t._q(t.val,null)},on:{blur:function(r){t.errorBlurState=!0},change:function(r){t.val=null}}},"input",t.attributes,!1)):t.isTextInput?e("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],ref:"input",attrs:{name:t.name,type:t.type},domProps:{value:t.val},on:{blur:function(r){t.errorBlurState=!0},input:function(r){r.target.composing||(t.val=r.target.value)}}},"input",t.attributes,!1)):t._e(),t._v(" "),t.isButtonInput?e("button",{attrs:{type:t.type,disabled:"submit"===t.type&&t.form.hasErrors&&"live"===t.form.behavior},domProps:{textContent:t._s(t.label||t.name)}}):t._e(),t._v(" "),t.isSelectInput?e("select",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],attrs:{name:t.name},on:{blur:function(r){t.errorBlurState=!0},change:function(r){var e=Array.prototype.filter.call(r.target.options,function(t){return t.selected}).map(function(t){return"_value"in t?t._value:t.value});t.val=r.target.multiple?e:e[0]}}},"select",t.attributes,!1),t._l(t.optionList,function(r){return e("option",t._b({key:r.id,domProps:{value:r.value,textContent:t._s(r.label)}},"option",r.attributes||{},!1))})):t._e(),t._v(" "),t.isBoxInput?e("div",{staticClass:"formulate-element-box-input-group"},[t._l(t.optionList,function(r){return["radio"===t.type?e("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],key:r.id+"-input",attrs:{type:"radio",name:t.name,id:r.id},domProps:{value:r.value,checked:t._q(t.val,r.value)},on:{blur:function(r){t.errorBlurState=!0},change:function(e){t.val=r.value}}},"input",t.attributes,!1)):t._e(),t._v(" "),"checkbox"===t.type?e("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],key:r.id+"-input",attrs:{type:"checkbox",name:t.name,id:r.id},domProps:{value:r.value,checked:Array.isArray(t.val)?t._i(t.val,r.value)>-1:t.val},on:{blur:function(r){t.errorBlurState=!0},change:function(e){var n=t.val,o=e.target,i=!!o.checked;if(Array.isArray(n)){var a=r.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(" "),e("label",{key:r.id+"-label",attrs:{for:r.id},domProps:{textContent:t._s(r.label)}})]})],2):t._e(),t._v(" "),t.hasCustomInput?t._t("default"):t._e(),t._v(" "),t.isUnsupportedInput?e("div",{staticStyle:{"background-color":"red",color:"white"},domProps:{textContent:t._s("Unsupported field type: “"+t.type+"”.")}}):t._e()],2),t._v(" "),t.shouldShowErrors&&t.localAndValidationErrors.length?e("ul",{staticClass:"formulate-errors"},t._l(t.localAndValidationErrors,function(r){return e("li",{key:r,domProps:{textContent:t._s(r)}})})):t._e()])},o=[],i={render:n,staticRenderFns:o};r.a=i},function(t,r,e){"use strict";function n(t){return function(){var r=t.apply(this,arguments);return new Promise(function(t,e){function n(o,i){try{var a=r[o](i),u=a.value}catch(t){return void e(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(r,"__esModule",{value:!0});var o=e(1),i=function(t){return t&&t.__esModule?t:{default:t}}(o);r.default={required:function(){function t(t){return r.apply(this,arguments)}var r=n(i.default.mark(function t(r){var e=r.value,n=r.error,o=arguments;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",!(e&&(!Array.isArray(e)||e.length))&&n.apply(void 0,o));case 1:case"end":return t.stop()}},t,this)}));return t}(),email:function(){function t(t){return r.apply(this,arguments)}var r=n(i.default.mark(function t(r){var e,n=r.value,o=r.error,a=arguments;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=/^(?:[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||e.test(n.toLowerCase()))&&o.apply(void 0,a));case 2:case"end":return t.stop()}},t,this)}));return t}(),confirmed:function(){function t(t,e){return r.apply(this,arguments)}var r=n(i.default.mark(function t(r,e){var n=r.field,o=r.value,a=r.error,u=r.values,s=arguments;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=e||n+"_confirmation",t.abrupt("return",!(!o||o===u[e])&&a.apply(void 0,s));case 2:case"end":return t.stop()}},t,this)}));return t}()}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default={required:function(t){var r=t.label;return t.value,r+" is required"},email:function(t){var r=t.label;return t.value,r+" is invalid."},confirmed:function(t){var r=t.label;return t.value,r+" 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=e(5),o=Object.prototype.hasOwnProperty;t.exports=function(t,r,e){n(t,function(n,i){if(o.call(t,i))return r.call(e,t[i],i,t)})}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(7),o=e.n(n);for(var i in n)"default"!==i&&function(t){e.d(r,t,function(){return n[t]})}(i);var a=e(23),u=e(6),s=u(o.a,a.a,!1,null,null,null);r.default=s.exports},function(t,r,e){"use strict";var n=function(){var t=this,r=t.$createElement;return(t._self._c||r)("form",{staticClass:"formulate-form",on:{submit:function(r){r.preventDefault(),t.submit(r)}}},[t._t("default")],2)},o=[],i={render:n,staticRenderFns:o};r.a=i},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(8),o=e.n(n);for(var i in n)"default"!==i&&function(t){e.d(r,t,function(){return n[t]})}(i);var a=e(33),u=e(6),s=u(o.a,a.a,!1,null,null,null);r.default=s.exports},function(t,r,e){"use strict";t.exports=e(26)},function(t,r,e){"use strict";function n(r){return u.seed(r),t.exports}function o(r){return f=r,t.exports}function i(t){return void 0!==t&&u.characters(t),u.shuffled()}function a(){return c(f)}var u=e(0),s=(e(9),e(29)),c=e(30),l=e(31),f=e(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=l},function(t,r,e){"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,r,e){"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,r,e){"use strict";function n(t){var r=o.shuffled();return{version:15&r.indexOf(t.substr(0,1)),worker:15&r.indexOf(t.substr(1,1))}}var o=e(0);t.exports=n},function(t,r,e){"use strict";function n(t){var r="",e=Math.floor(.001*(Date.now()-s));return e===i?o++:(o=0,i=e),r+=a(u.lookup,c),r+=a(u.lookup,t),o>0&&(r+=a(u.lookup,o)),r+=a(u.lookup,e)}var o,i,a=e(9),u=e(0),s=1459707606518,c=6;t.exports=n},function(t,r,e){"use strict";function n(t){if(!t||"string"!=typeof t||t.length<6)return!1;for(var r=o.characters(),e=t.length,n=0;n1)?e("label",{attrs:{for:t.id},domProps:{textContent:t._s(t.label)}}):t._e(),t._v(" "),"checkbox"===t.type&&t.isTextInput?e("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],ref:"input",attrs:{name:t.name,type:"checkbox"},domProps:{checked:Array.isArray(t.val)?t._i(t.val,null)>-1:t.val},on:{blur:function(r){t.errorBlurState=!0},change:function(r){var e=t.val,n=r.target,o=!!n.checked;if(Array.isArray(e)){var i=t._i(e,null);n.checked?i<0&&(t.val=e.concat([null])):i>-1&&(t.val=e.slice(0,i).concat(e.slice(i+1)))}else t.val=o}}},"input",t.attributes,!1)):"radio"===t.type&&t.isTextInput?e("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],ref:"input",attrs:{name:t.name,type:"radio"},domProps:{checked:t._q(t.val,null)},on:{blur:function(r){t.errorBlurState=!0},change:function(r){t.val=null}}},"input",t.attributes,!1)):t.isTextInput?e("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],ref:"input",attrs:{name:t.name,type:t.type},domProps:{value:t.val},on:{blur:function(r){t.errorBlurState=!0},input:function(r){r.target.composing||(t.val=r.target.value)}}},"input",t.attributes,!1)):t._e(),t._v(" "),t.isButtonInput?e("button",{attrs:{type:t.type,disabled:"submit"===t.type&&t.form.hasErrors&&"live"===t.form.behavior},domProps:{textContent:t._s(t.label||t.name)}}):t._e(),t._v(" "),t.isSelectInput?e("select",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],attrs:{name:t.name},on:{blur:function(r){t.errorBlurState=!0},change:function(r){var e=Array.prototype.filter.call(r.target.options,function(t){return t.selected}).map(function(t){return"_value"in t?t._value:t.value});t.val=r.target.multiple?e:e[0]}}},"select",t.attributes,!1),t._l(t.optionList,function(r){return e("option",t._b({key:r.id,domProps:{value:r.value,textContent:t._s(r.label)}},"option",r.attributes||{},!1))})):t._e(),t._v(" "),t.isBoxInput?e("div",{staticClass:"formulate-element-box-input-group"},[t._l(t.optionList,function(r){return["radio"===t.type?e("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],key:r.id+"-input",attrs:{type:"radio",name:t.name,id:r.id},domProps:{value:r.value,checked:t._q(t.val,r.value)},on:{blur:function(r){t.errorBlurState=!0},change:function(e){t.val=r.value}}},"input",t.attributes,!1)):t._e(),t._v(" "),"checkbox"===t.type?e("input",t._b({directives:[{name:"model",rawName:"v-model",value:t.val,expression:"val"}],key:r.id+"-input",attrs:{type:"checkbox",name:t.name,id:r.id},domProps:{value:r.value,checked:Array.isArray(t.val)?t._i(t.val,r.value)>-1:t.val},on:{blur:function(r){t.errorBlurState=!0},change:function(e){var n=t.val,o=e.target,i=!!o.checked;if(Array.isArray(n)){var a=r.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(" "),e("label",{key:r.id+"-label",attrs:{for:r.id},domProps:{textContent:t._s(r.label)}})]})],2):t._e(),t._v(" "),t.hasCustomInput?t._t("default"):t._e(),t._v(" "),t.isUnsupportedInput?e("div",{staticStyle:{"background-color":"red",color:"white"},domProps:{textContent:t._s("Unsupported field type: “"+t.type+"”.")}}):t._e()],2),t._v(" "),t.shouldShowErrors&&t.localAndValidationErrors.length?e("transition-group",{staticClass:"formulate-errors",attrs:{tag:"ul",name:"formulate-errors"}},t._l(t.localAndValidationErrors,function(r){return e("li",{key:r,domProps:{textContent:t._s(r)}})})):t._e()],1)},o=[],i={render:n,staticRenderFns:o};r.a=i},function(t,r,e){"use strict";function n(t){return function(){var r=t.apply(this,arguments);return new Promise(function(t,e){function n(o,i){try{var a=r[o](i),u=a.value}catch(t){return void e(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(r,"__esModule",{value:!0});var o=e(1),i=function(t){return t&&t.__esModule?t:{default:t}}(o);r.default={required:function(){function t(t){return r.apply(this,arguments)}var r=n(i.default.mark(function t(r){var e=r.value,n=r.error,o=arguments;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",!(e&&(!Array.isArray(e)||e.length))&&n.apply(void 0,o));case 1:case"end":return t.stop()}},t,this)}));return t}(),email:function(){function t(t){return r.apply(this,arguments)}var r=n(i.default.mark(function t(r){var e,n=r.value,o=r.error,a=arguments;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=/^(?:[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||e.test(n.toLowerCase()))&&o.apply(void 0,a));case 2:case"end":return t.stop()}},t,this)}));return t}(),confirmed:function(){function t(t,e){return r.apply(this,arguments)}var r=n(i.default.mark(function t(r,e){var n=r.field,o=r.value,a=r.error,u=r.values,s=arguments;return i.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=e||n+"_confirmation",t.abrupt("return",!(!o||o===u[e])&&a.apply(void 0,s));case 2:case"end":return t.stop()}},t,this)}));return t}()}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default={required:function(t){var r=t.label;return t.value,r+" is required"},email:function(t){var r=t.label;return t.value,r+" is invalid."},confirmed:function(t){var r=t.label;return t.value,r+" 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 c05cc31..7c3210e 100644 --- a/src/components/FormulateElement.vue +++ b/src/components/FormulateElement.vue @@ -88,7 +88,9 @@ v-text="`Unsupported field type: “${type}”.`" /> - +