@formvuelate/plugin-vee-validate
Advanced tools
Comparing version 3.3.2 to 3.4.0
/** | ||
* plugin-vee-validate v3.3.2 | ||
* plugin-vee-validate v3.4.0 | ||
*/ | ||
@@ -77,11 +77,18 @@ 'use strict'; | ||
return { | ||
...el, | ||
// namespaced prop to avoid clash with users' props | ||
_veeValidateConfig: { | ||
mapProps, | ||
path | ||
}, | ||
component: withField(el) | ||
const constructField = (field) => { | ||
return { | ||
...field, | ||
_veeValidateConfig: { | ||
mapProps, | ||
path | ||
}, | ||
component: withField(field) | ||
} | ||
}; | ||
if (Array.isArray(el)) { | ||
return el.map(constructField) | ||
} | ||
return constructField(el) | ||
} | ||
@@ -88,0 +95,0 @@ |
/** | ||
* plugin-vee-validate v3.3.2 | ||
* plugin-vee-validate v3.4.0 | ||
*/ | ||
@@ -75,11 +75,18 @@ import { getCurrentInstance, inject, provide, computed, markRaw, toRefs, watch, resolveDynamicComponent, h, unref } from 'vue'; | ||
return { | ||
...el, | ||
// namespaced prop to avoid clash with users' props | ||
_veeValidateConfig: { | ||
mapProps, | ||
path | ||
}, | ||
component: withField(el) | ||
const constructField = (field) => { | ||
return { | ||
...field, | ||
_veeValidateConfig: { | ||
mapProps, | ||
path | ||
}, | ||
component: withField(field) | ||
} | ||
}; | ||
if (Array.isArray(el)) { | ||
return el.map(constructField) | ||
} | ||
return constructField(el) | ||
} | ||
@@ -86,0 +93,0 @@ |
/** | ||
* plugin-vee-validate v3.3.2 | ||
* plugin-vee-validate v3.4.0 | ||
*/ | ||
@@ -78,11 +78,18 @@ (function (global, factory) { | ||
return { | ||
...el, | ||
// namespaced prop to avoid clash with users' props | ||
_veeValidateConfig: { | ||
mapProps, | ||
path | ||
}, | ||
component: withField(el) | ||
const constructField = (field) => { | ||
return { | ||
...field, | ||
_veeValidateConfig: { | ||
mapProps, | ||
path | ||
}, | ||
component: withField(field) | ||
} | ||
}; | ||
if (Array.isArray(el)) { | ||
return el.map(constructField) | ||
} | ||
return constructField(el) | ||
} | ||
@@ -89,0 +96,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("vee-validate")):"function"==typeof define&&define.amd?define(["vue","vee-validate"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).FormvuelatePluginVeeValidate=t(e.Vue,e.VeeValidate)}(this,(function(e,t){"use strict";function a(e){return{validation:e}}const i="vee-validate-fvl-form-context";const n=new Map;function o(a){const i=a.component;if(n.has(i))return n.get(i);const o=e.markRaw({name:"withFieldWrapper",props:{modelValue:{type:null,default:void 0},validations:{type:[String,Object,Function],default:void 0},_veeValidateConfig:{type:Object,required:!0}},setup(n,{attrs:o}){const{path:r,mapProps:u}=n._veeValidateConfig,{validations:s,modelValue:l}=e.toRefs(n),d=l?l.value:void 0,m=r?`${r}.${o.model}`:o.model,{value:c,errorMessage:v,meta:p,setTouched:f,errors:h}=t.useField(m,s,{initialValue:d});l&&e.watch(l,(e=>{c.value=e}));const b=e.resolveDynamicComponent(i);return function(){return e.h(b,{...n,...o,...u({errorMessage:e.unref(v),errors:e.unref(h),meta:p,setTouched:f},a)})}}});return n.set(i,o),o}return function(n){const r=n&&n.mapProps||a;return function(a){const{parsedSchema:n,formBinds:u}=a,{attrs:s}=e.getCurrentInstance()||{attrs:{}};let l=e.inject(i,void 0);l||(l=t.useForm({validationSchema:s["validation-schema"]||s.validationSchema,initialErrors:s["initial-errors"]||s.initialErrors,initialTouched:s["initial-touched"]||s.initialTouched}),e.provide(i,l));const{handleSubmit:d}=l;function m(e,t=""){if(e.schema){t=t?`${t}.${e.model}`:e.model;const a=Array.isArray(e.schema)?e.schema:Object.keys(e.schema).map((t=>({model:t,...e.schema[t]})));return{...e,schema:a.map((e=>m(e,t)))}}return{...e,_veeValidateConfig:{mapProps:r,path:t},component:o(e)}}const c=e.computed((()=>{return e=n.value,t=m,e.map((e=>e.map((e=>t(e)))));var e,t})),v=u.value.onSubmit,p=d(((e,{evt:t})=>{v(t)}));return{...a,formBinds:e.computed((()=>({...a.formBinds.value,onSubmit:p}))),slotBinds:e.computed((()=>({...a.slotBinds.value,validation:{errors:l.errors.value,values:l.values,isSubmitting:l.isSubmitting.value,submitCount:l.submitCount.value,meta:l.meta.value}}))),parsedSchema:c}}}})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("vee-validate")):"function"==typeof define&&define.amd?define(["vue","vee-validate"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).FormvuelatePluginVeeValidate=t(e.Vue,e.VeeValidate)}(this,(function(e,t){"use strict";function a(e){return{validation:e}}const i="vee-validate-fvl-form-context";const n=new Map;function o(a){const i=a.component;if(n.has(i))return n.get(i);const o=e.markRaw({name:"withFieldWrapper",props:{modelValue:{type:null,default:void 0},validations:{type:[String,Object,Function],default:void 0},_veeValidateConfig:{type:Object,required:!0}},setup(n,{attrs:o}){const{path:r,mapProps:u}=n._veeValidateConfig,{validations:s,modelValue:l}=e.toRefs(n),d=l?l.value:void 0,m=r?`${r}.${o.model}`:o.model,{value:c,errorMessage:v,meta:p,setTouched:f,errors:h}=t.useField(m,s,{initialValue:d});l&&e.watch(l,(e=>{c.value=e}));const b=e.resolveDynamicComponent(i);return function(){return e.h(b,{...n,...o,...u({errorMessage:e.unref(v),errors:e.unref(h),meta:p,setTouched:f},a)})}}});return n.set(i,o),o}return function(n){const r=n&&n.mapProps||a;return function(a){const{parsedSchema:n,formBinds:u}=a,{attrs:s}=e.getCurrentInstance()||{attrs:{}};let l=e.inject(i,void 0);l||(l=t.useForm({validationSchema:s["validation-schema"]||s.validationSchema,initialErrors:s["initial-errors"]||s.initialErrors,initialTouched:s["initial-touched"]||s.initialTouched}),e.provide(i,l));const{handleSubmit:d}=l;function m(e,t=""){if(e.schema){t=t?`${t}.${e.model}`:e.model;const a=Array.isArray(e.schema)?e.schema:Object.keys(e.schema).map((t=>({model:t,...e.schema[t]})));return{...e,schema:a.map((e=>m(e,t)))}}const a=e=>({...e,_veeValidateConfig:{mapProps:r,path:t},component:o(e)});return Array.isArray(e)?e.map(a):a(e)}const c=e.computed((()=>{return e=n.value,t=m,e.map((e=>e.map((e=>t(e)))));var e,t})),v=u.value.onSubmit,p=d(((e,{evt:t})=>{v(t)}));return{...a,formBinds:e.computed((()=>({...a.formBinds.value,onSubmit:p}))),slotBinds:e.computed((()=>({...a.slotBinds.value,validation:{errors:l.errors.value,values:l.values,isSubmitting:l.isSubmitting.value,submitCount:l.submitCount.value,meta:l.meta.value}}))),parsedSchema:c}}}})); |
{ | ||
"name": "@formvuelate/plugin-vee-validate", | ||
"version": "3.3.2", | ||
"version": "3.4.0", | ||
"description": "FormVueLate Vee-validate plugin", | ||
"main": "dist/formvuelate-plugin-vee-validate.cjs.js", | ||
"types": "dist/formvuelate-plugin-vee-validate.d.ts", | ||
"private": false, | ||
@@ -44,3 +45,3 @@ "publishConfig": { | ||
"browser": "dist/formvuelate-plugin-vee-validate.es.js", | ||
"gitHead": "3d6dcff17e6806b70ac57102a54261bfb22aee1e" | ||
"gitHead": "d00d4fabc55f5eafa37927f429459790f5c2aa26" | ||
} |
@@ -72,11 +72,18 @@ import { toRefs, h, computed, markRaw, watch, getCurrentInstance, unref, resolveDynamicComponent, inject, provide } from 'vue' | ||
return { | ||
...el, | ||
// namespaced prop to avoid clash with users' props | ||
_veeValidateConfig: { | ||
mapProps, | ||
path | ||
}, | ||
component: withField(el) | ||
const constructField = (field) => { | ||
return { | ||
...field, | ||
_veeValidateConfig: { | ||
mapProps, | ||
path | ||
}, | ||
component: withField(field) | ||
} | ||
} | ||
if (Array.isArray(el)) { | ||
return el.map(constructField) | ||
} | ||
return constructField(el) | ||
} | ||
@@ -83,0 +90,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37612
12
874