Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@formvuelate/plugin-vee-validate

Package Overview
Dependencies
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formvuelate/plugin-vee-validate - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

39

dist/formvuelate-plugin-vee-validate.cjs.js
/**
* @formvuelate/plugin-vee-validate v1.0.2
* @formvuelate/plugin-vee-validate v1.0.3
* (c) 2020 Abdelrahman Awad <logaretm1@gmail.com>

@@ -26,13 +26,13 @@ * @license MIT

*/
function defaultMapProps(validation) {
function defaultMapProps (validation) {
return {
validation: validation,
};
validation: validation
}
}
function VeeValidatePlugin(opts) {
function VeeValidatePlugin (opts) {
// Maps the validation state exposed by vee-validate to components
var mapProps = (opts && opts.mapProps) || defaultMapProps;
return function veeValidatePlugin(baseReturns) {
return function veeValidatePlugin (baseReturns) {
// Take the parsed schema from SchemaForm setup returns

@@ -47,6 +47,6 @@ var parsedSchema = baseReturns.parsedSchema;

var ref$1 = veeValidate.useForm({
validationSchema: formAttrs['validation-schema'] || formAttrs['validationSchema'],
initialErrors: formAttrs['initial-errors'] || formAttrs['initialErrors'],
initialDirty: formAttrs['initial-dirty'] || formAttrs['initialDirty'],
initialTouched: formAttrs['initial-touched'] || formAttrs['initialTouched'],
validationSchema: formAttrs['validation-schema'] || formAttrs.validationSchema,
initialErrors: formAttrs['initial-errors'] || formAttrs.initialErrors,
initialDirty: formAttrs['initial-dirty'] || formAttrs.initialDirty,
initialTouched: formAttrs['initial-touched'] || formAttrs.initialTouched
});

@@ -62,3 +62,3 @@ var handleSubmit = ref$1.handleSubmit;

// override the submit function with one that triggers validation
var formSubmit = formBinds.value.onSubmit;
var formSubmit = formBinds.value.onSubmit;
var onSubmit = handleSubmit(function (_, ref) {

@@ -79,3 +79,3 @@ var evt = ref.evt;

function withField(el, mapProps) {
function withField (el, mapProps) {
var Comp = el.component;

@@ -88,7 +88,7 @@

type: [String, Number],
default: undefined,
default: undefined
},
validations: {
type: [String, Object, Function],
default: undefined,
default: undefined
}

@@ -112,3 +112,3 @@ },

var errors = ref$2.errors;
if (modelValue) {

@@ -120,5 +120,4 @@ vue.watch(modelValue, function (val) {

return function renderWithField() {
return vue.h(Comp, Object.assign({}, props,
return function renderWithField () {
return vue.h(vue.resolveDynamicComponent(Comp), Object.assign({}, props,
attrs,

@@ -130,6 +129,6 @@ mapProps({

setDirty: setDirty,
setTouched: setTouched,
setTouched: setTouched
}, el)))
}
},
}
}

@@ -136,0 +135,0 @@ }

/**
* @formvuelate/plugin-vee-validate v1.0.2
* @formvuelate/plugin-vee-validate v1.0.3
* (c) 2020 Abdelrahman Awad <logaretm1@gmail.com>

@@ -7,3 +7,3 @@ * @license MIT

import { computed, getCurrentInstance, h, markRaw, toRefs, unref, watch } from 'vue';
import { computed, getCurrentInstance, h, markRaw, resolveDynamicComponent, toRefs, unref, watch } from 'vue';
import { useField, useForm } from 'vee-validate';

@@ -23,13 +23,13 @@

*/
function defaultMapProps(validation) {
function defaultMapProps (validation) {
return {
validation: validation,
};
validation: validation
}
}
function VeeValidatePlugin(opts) {
function VeeValidatePlugin (opts) {
// Maps the validation state exposed by vee-validate to components
var mapProps = (opts && opts.mapProps) || defaultMapProps;
return function veeValidatePlugin(baseReturns) {
return function veeValidatePlugin (baseReturns) {
// Take the parsed schema from SchemaForm setup returns

@@ -44,6 +44,6 @@ var parsedSchema = baseReturns.parsedSchema;

var ref$1 = useForm({
validationSchema: formAttrs['validation-schema'] || formAttrs['validationSchema'],
initialErrors: formAttrs['initial-errors'] || formAttrs['initialErrors'],
initialDirty: formAttrs['initial-dirty'] || formAttrs['initialDirty'],
initialTouched: formAttrs['initial-touched'] || formAttrs['initialTouched'],
validationSchema: formAttrs['validation-schema'] || formAttrs.validationSchema,
initialErrors: formAttrs['initial-errors'] || formAttrs.initialErrors,
initialDirty: formAttrs['initial-dirty'] || formAttrs.initialDirty,
initialTouched: formAttrs['initial-touched'] || formAttrs.initialTouched
});

@@ -59,3 +59,3 @@ var handleSubmit = ref$1.handleSubmit;

// override the submit function with one that triggers validation
var formSubmit = formBinds.value.onSubmit;
var formSubmit = formBinds.value.onSubmit;
var onSubmit = handleSubmit(function (_, ref) {

@@ -76,3 +76,3 @@ var evt = ref.evt;

function withField(el, mapProps) {
function withField (el, mapProps) {
var Comp = el.component;

@@ -85,7 +85,7 @@

type: [String, Number],
default: undefined,
default: undefined
},
validations: {
type: [String, Object, Function],
default: undefined,
default: undefined
}

@@ -109,3 +109,3 @@ },

var errors = ref$2.errors;
if (modelValue) {

@@ -117,5 +117,4 @@ watch(modelValue, function (val) {

return function renderWithField() {
return h(Comp, Object.assign({}, props,
return function renderWithField () {
return h(resolveDynamicComponent(Comp), Object.assign({}, props,
attrs,

@@ -127,6 +126,6 @@ mapProps({

setDirty: setDirty,
setTouched: setTouched,
setTouched: setTouched
}, el)))
}
},
}
}

@@ -133,0 +132,0 @@ }

/**
* @formvuelate/plugin-vee-validate v1.0.2
* @formvuelate/plugin-vee-validate v1.0.3
* (c) 2020 Abdelrahman Awad <logaretm1@gmail.com>

@@ -25,13 +25,13 @@ * @license MIT

*/
function defaultMapProps(validation) {
function defaultMapProps (validation) {
return {
validation: validation,
};
validation: validation
}
}
function VeeValidatePlugin(opts) {
function VeeValidatePlugin (opts) {
// Maps the validation state exposed by vee-validate to components
var mapProps = (opts && opts.mapProps) || defaultMapProps;
return function veeValidatePlugin(baseReturns) {
return function veeValidatePlugin (baseReturns) {
// Take the parsed schema from SchemaForm setup returns

@@ -46,6 +46,6 @@ var parsedSchema = baseReturns.parsedSchema;

var ref$1 = veeValidate.useForm({
validationSchema: formAttrs['validation-schema'] || formAttrs['validationSchema'],
initialErrors: formAttrs['initial-errors'] || formAttrs['initialErrors'],
initialDirty: formAttrs['initial-dirty'] || formAttrs['initialDirty'],
initialTouched: formAttrs['initial-touched'] || formAttrs['initialTouched'],
validationSchema: formAttrs['validation-schema'] || formAttrs.validationSchema,
initialErrors: formAttrs['initial-errors'] || formAttrs.initialErrors,
initialDirty: formAttrs['initial-dirty'] || formAttrs.initialDirty,
initialTouched: formAttrs['initial-touched'] || formAttrs.initialTouched
});

@@ -61,3 +61,3 @@ var handleSubmit = ref$1.handleSubmit;

// override the submit function with one that triggers validation
var formSubmit = formBinds.value.onSubmit;
var formSubmit = formBinds.value.onSubmit;
var onSubmit = handleSubmit(function (_, ref) {

@@ -78,3 +78,3 @@ var evt = ref.evt;

function withField(el, mapProps) {
function withField (el, mapProps) {
var Comp = el.component;

@@ -87,7 +87,7 @@

type: [String, Number],
default: undefined,
default: undefined
},
validations: {
type: [String, Object, Function],
default: undefined,
default: undefined
}

@@ -111,3 +111,3 @@ },

var errors = ref$2.errors;
if (modelValue) {

@@ -119,5 +119,4 @@ vue.watch(modelValue, function (val) {

return function renderWithField() {
return vue.h(Comp, Object.assign({}, props,
return function renderWithField () {
return vue.h(vue.resolveDynamicComponent(Comp), Object.assign({}, props,
attrs,

@@ -129,6 +128,6 @@ mapProps({

setDirty: setDirty,
setTouched: setTouched,
setTouched: setTouched
}, el)))
}
},
}
}

@@ -135,0 +134,0 @@ }

/**
* @formvuelate/plugin-vee-validate v1.0.2
* @formvuelate/plugin-vee-validate v1.0.3
* (c) 2020 Abdelrahman Awad <logaretm1@gmail.com>

@@ -7,2 +7,2 @@ * @license MIT

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue"),require("vee-validate")):"function"==typeof define&&define.amd?define(["exports","vue","vee-validate"],t):t(e["@formvuelate/pluginVeeValidate"]={},e.Vue,e.VeeValidate)}(this,function(e,b,y){"use strict";var d=function(e,t){return e.map(function(e){return e.map(function(e){return t(e)})})};function t(e){return{validation:e}}function l(v,p){var h=v.component;return{name:"withFieldWrapper",props:{modelValue:{type:[String,Number],default:void 0},validations:{type:[String,Object,Function],default:void 0}},setup:function(e,t){var i=t.attrs,n=b.toRefs(e),r=n.validations,a=n.modelValue,u=a?a.value:void 0,o=y.useField(i.model,r,{initialValue:u}),s=o.value,d=o.errorMessage,l=o.meta,c=o.setDirty,f=o.setTouched,m=o.errors;return a&&b.watch(a,function(e){s.value=e}),function(){return b.h(h,Object.assign({},e,i,p({errorMessage:b.unref(d),errors:b.unref(m),meta:l,setDirty:c,setTouched:f},v)))}}}}e.mapElementsInSchema=d,e.default=function(e){var s=e&&e.mapProps||t;return function(e){var t=e.parsedSchema,i=e.formBinds,n=b.getCurrentInstance().attrs,r=y.useForm({validationSchema:n["validation-schema"]||n.validationSchema,initialErrors:n["initial-errors"]||n.initialErrors,initialDirty:n["initial-dirty"]||n.initialDirty,initialTouched:n["initial-touched"]||n.initialTouched}).handleSubmit,a=d(t.value,function(e){return Object.assign({},e,{component:b.markRaw(l(e,s))})}),u=i.value.onSubmit,o=r(function(e,t){var i=t.evt;u(i)});return Object.assign({},e,{formBinds:b.computed(function(){return Object.assign({},e.formBinds.value,{onSubmit:o})}),parsedSchema:b.computed(function(){return a})})}},e.withField=l,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue"),require("vee-validate")):"function"==typeof define&&define.amd?define(["exports","vue","vee-validate"],t):t(e["@formvuelate/pluginVeeValidate"]={},e.Vue,e.VeeValidate)}(this,function(e,y,b){"use strict";var l=function(e,t){return e.map(function(e){return e.map(function(e){return t(e)})})};function t(e){return{validation:e}}function d(v,p){var h=v.component;return{name:"withFieldWrapper",props:{modelValue:{type:[String,Number],default:void 0},validations:{type:[String,Object,Function],default:void 0}},setup:function(e,t){var i=t.attrs,n=y.toRefs(e),r=n.validations,a=n.modelValue,o=a?a.value:void 0,u=b.useField(i.model,r,{initialValue:o}),s=u.value,l=u.errorMessage,d=u.meta,c=u.setDirty,f=u.setTouched,m=u.errors;return a&&y.watch(a,function(e){s.value=e}),function(){return y.h(y.resolveDynamicComponent(h),Object.assign({},e,i,p({errorMessage:y.unref(l),errors:y.unref(m),meta:d,setDirty:c,setTouched:f},v)))}}}}e.mapElementsInSchema=l,e.default=function(e){var s=e&&e.mapProps||t;return function(e){var t=e.parsedSchema,i=e.formBinds,n=y.getCurrentInstance().attrs,r=b.useForm({validationSchema:n["validation-schema"]||n.validationSchema,initialErrors:n["initial-errors"]||n.initialErrors,initialDirty:n["initial-dirty"]||n.initialDirty,initialTouched:n["initial-touched"]||n.initialTouched}).handleSubmit,a=l(t.value,function(e){return Object.assign({},e,{component:y.markRaw(d(e,s))})}),o=i.value.onSubmit,u=r(function(e,t){var i=t.evt;o(i)});return Object.assign({},e,{formBinds:y.computed(function(){return Object.assign({},e.formBinds.value,{onSubmit:u})}),parsedSchema:y.computed(function(){return a})})}},e.withField=d,Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "@formvuelate/plugin-vee-validate",
"version": "1.0.2",
"version": "1.0.3",
"description": "FormVueLate Vee-validate plugin",

@@ -5,0 +5,0 @@ "main": "dist/formvuelate-plugin-vee-validate.cjs.js",

@@ -5,3 +5,3 @@ # @formvuelate/plugin-vee-validate

<img width="150px" src="https://avatars1.githubusercontent.com/u/68271974?s=200&v=4" title="FormVueLate logo">
<img width="150px" src="https://github.com/logaretm/vee-validate/raw/master/logo.png" title="Vee validate logo">
<img width="150px" src="https://github.com/logaretm/vee-validate/raw/main/logo.png" title="Vee validate logo">
</p>

@@ -11,2 +11,2 @@

For full documentation check out [FormVueLate's docs](http://formvuelate.js.org/)
For full documentation check out [FormVueLate's docs](http://formvuelate.js.org/)

@@ -1,3 +0,3 @@

import { toRefs, h, computed, markRaw, watch, getCurrentInstance, unref } from 'vue'
import { useForm, useField } from 'vee-validate';
import { toRefs, h, computed, markRaw, watch, getCurrentInstance, unref, resolveDynamicComponent } from 'vue'
import { useForm, useField } from 'vee-validate'

@@ -16,13 +16,13 @@ /**

*/
function defaultMapProps(validation) {
function defaultMapProps (validation) {
return {
validation,
};
validation
}
}
export default function VeeValidatePlugin(opts) {
export default function VeeValidatePlugin (opts) {
// Maps the validation state exposed by vee-validate to components
const mapProps = (opts && opts.mapProps) || defaultMapProps
return function veeValidatePlugin(baseReturns) {
return function veeValidatePlugin (baseReturns) {
// Take the parsed schema from SchemaForm setup returns

@@ -32,10 +32,10 @@ const { parsedSchema, formBinds } = baseReturns

// Get additional properties not defined on the `SchemaForm` derivatives
const { attrs: formAttrs } = getCurrentInstance();
const { attrs: formAttrs } = getCurrentInstance()
// Create a form context and inject the validation schema if provided
const { handleSubmit } = useForm({
validationSchema: formAttrs['validation-schema'] || formAttrs['validationSchema'],
initialErrors: formAttrs['initial-errors'] || formAttrs['initialErrors'],
initialDirty: formAttrs['initial-dirty'] || formAttrs['initialDirty'],
initialTouched: formAttrs['initial-touched'] || formAttrs['initialTouched'],
});
validationSchema: formAttrs['validation-schema'] || formAttrs.validationSchema,
initialErrors: formAttrs['initial-errors'] || formAttrs.initialErrors,
initialDirty: formAttrs['initial-dirty'] || formAttrs.initialDirty,
initialTouched: formAttrs['initial-touched'] || formAttrs.initialTouched
})

@@ -51,6 +51,6 @@ // Map components in schema to enhanced versions with `useField`

// override the submit function with one that triggers validation
const formSubmit = formBinds.value.onSubmit;
const formSubmit = formBinds.value.onSubmit
const onSubmit = handleSubmit((_, { evt }) => {
formSubmit(evt);
});
formSubmit(evt)
})

@@ -62,3 +62,3 @@ return {

...baseReturns.formBinds.value,
onSubmit,
onSubmit
}

@@ -71,4 +71,4 @@ }),

export function withField(el, mapProps) {
const Comp = el.component;
export function withField (el, mapProps) {
const Comp = el.component

@@ -80,7 +80,7 @@ return {

type: [String, Number],
default: undefined,
default: undefined
},
validations: {
type: [String, Object, Function],
default: undefined,
default: undefined
}

@@ -94,3 +94,3 @@ },

})
if (modelValue) {

@@ -102,5 +102,4 @@ watch(modelValue, (val) => {

return function renderWithField() {
return h(Comp, {
return function renderWithField () {
return h(resolveDynamicComponent(Comp), {
...props,

@@ -113,8 +112,8 @@ ...attrs,

setDirty,
setTouched,
setTouched
}, el)
})
}
},
}
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc