@vueuse/integrations
Advanced tools
Comparing version 8.7.3 to 8.7.4
import { MaybeRef } from '@vueuse/shared'; | ||
import { Rules, ValidateError } from 'async-validator'; | ||
import { ValidateError, ValidateOption, Rules } from 'async-validator'; | ||
import * as vue_demi from 'vue-demi'; | ||
@@ -29,2 +29,8 @@ import { Ref, ShallowRef, WritableComputedRef, ComputedRef } from 'vue-demi'; | ||
} | ||
interface UseAsyncValidatorOptions { | ||
/** | ||
* @see https://github.com/yiminghe/async-validator#options | ||
*/ | ||
validateOption?: ValidateOption; | ||
} | ||
/** | ||
@@ -34,4 +40,5 @@ * Wrapper for async-validator. | ||
* @see https://vueuse.org/useAsyncValidator | ||
* @see https://github.com/yiminghe/async-validator | ||
*/ | ||
declare function useAsyncValidator(value: MaybeRef<Record<string, any>>, rules: MaybeRef<Rules>): UseAsyncValidatorReturn & PromiseLike<UseAsyncValidatorReturn>; | ||
declare function useAsyncValidator(value: MaybeRef<Record<string, any>>, rules: MaybeRef<Rules>, options?: UseAsyncValidatorOptions): UseAsyncValidatorReturn & PromiseLike<UseAsyncValidatorReturn>; | ||
@@ -339,2 +346,2 @@ interface UseAxiosReturn<T> { | ||
export { ChangeCaseType, EasyUseAxiosReturn, FuseOptions, JwtOptions, JwtResult, StrictUseAxiosReturn, UseAxiosOptions, UseAxiosReturn, UseDrauuOptions, UseDrauuReturn, UseFocusTrapOptions, UseFocusTrapReturn, UseFuseOptions, UseFuseReturn, createCookies, useAsyncValidator, useAxios, useChangeCase, useCookies, useDrauu, useFocusTrap, useFuse, useJwt, useNProgress, useQRCode }; | ||
export { AsyncValidatorError, ChangeCaseType, EasyUseAxiosReturn, FuseOptions, JwtOptions, JwtResult, StrictUseAxiosReturn, UseAsyncValidatorOptions, UseAsyncValidatorReturn, UseAxiosOptions, UseAxiosReturn, UseDrauuOptions, UseDrauuReturn, UseFocusTrapOptions, UseFocusTrapReturn, UseFuseOptions, UseFuseReturn, createCookies, useAsyncValidator, useAxios, useChangeCase, useCookies, useDrauu, useFocusTrap, useFuse, useJwt, useNProgress, useQRCode }; |
@@ -122,3 +122,3 @@ ;var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) { | ||
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b)); | ||
function useAsyncValidator(value, rules) { | ||
function useAsyncValidator(value, rules, options = {}) { | ||
const errorInfo = vueDemi.ref(); | ||
@@ -135,2 +135,3 @@ const isFinished = vueDemi.ref(false); | ||
}); | ||
const { validateOption = {} } = options; | ||
vueDemi.watchEffect(async () => { | ||
@@ -141,3 +142,3 @@ isFinished.value = false; | ||
try { | ||
await validator.validate(vueDemi.unref(value)); | ||
await validator.validate(vueDemi.unref(value), validateOption); | ||
pass.value = true; | ||
@@ -144,0 +145,0 @@ errorInfo.value = null; |
@@ -1,1 +0,1 @@ | ||
var VueDemi=function(o,c,m){if(o.install)return o;if(c)if(c.version.slice(0,4)==="2.7."){for(var n in c)o[n]=c[n];o.isVue2=!0,o.isVue3=!1,o.install=function(){},o.Vue=c,o.Vue2=c,o.version=c.version,o.set=function(_,d,y){return Array.isArray(_)?(_.length=Math.max(_.length,d),_.splice(d,1,y),y):(c.set(_,d,y),y)},o.del=function(_,d){if(Array.isArray(_)){_.splice(d,1);return}c.delete(_,d)}}else if(c.version.slice(0,2)==="2.")if(m){for(var n in m)o[n]=m[n];o.isVue2=!0,o.isVue3=!1,o.install=function(){},o.Vue=c,o.Vue2=c,o.version=c.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(c.version.slice(0,2)==="3."){for(var n in c)o[n]=c[n];o.isVue2=!1,o.isVue3=!0,o.install=function(){},o.Vue=c,o.Vue2=void 0,o.version=c.version,o.set=function(_,d,y){return Array.isArray(_)?(_.length=Math.max(_.length,d),_.splice(d,1,y),y):(_[d]=y,y)},o.del=function(_,d){if(Array.isArray(_)){_.splice(d,1);return}delete _[d]}}else console.error("[vue-demi] Vue version "+c.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");return o}(this.VueDemi=this.VueDemi||(typeof VueDemi!="undefined"?VueDemi:{}),this.Vue||(typeof Vue!="undefined"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI!="undefined"?VueCompositionAPI:void 0));(function(o,c,m,n,_,d,y,V,E,D,ee,re,te,ne){"use strict";function S(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var ae=S(m),U=S(_),T=S(y),oe=S(ee),se=S(re),w=S(te),le=S(ne),ue=Object.defineProperty,fe=Object.defineProperties,ce=Object.getOwnPropertyDescriptors,k=Object.getOwnPropertySymbols,ie=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable,G=(t,r,e)=>r in t?ue(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,pe=(t,r)=>{for(var e in r||(r={}))ie.call(r,e)&&G(t,e,r[e]);if(k)for(var e of k(r))de.call(r,e)&&G(t,e,r[e]);return t},ve=(t,r)=>fe(t,ce(r));function _e(t,r){const e=n.ref(),a=n.ref(!1),u=n.ref(!1),p=n.computed(()=>{var l;return((l=e.value)==null?void 0:l.errors)||[]}),h=n.computed(()=>{var l;return((l=e.value)==null?void 0:l.fields)||{}});n.watchEffect(async()=>{a.value=!1,u.value=!1;const l=new ae.default(n.unref(r));try{await l.validate(n.unref(t)),u.value=!0,e.value=null}catch(v){e.value=v}finally{a.value=!0}});const i={pass:u,isFinished:a,errorInfo:e,errors:p,errorFields:h};function s(){return new Promise((l,v)=>{c.until(a).toBe(!0).then(()=>l(i)).catch(P=>v(P))})}return ve(pe({},i),{then(l,v){return s().then(l,v)}})}var he=Object.defineProperty,Oe=Object.defineProperties,Pe=Object.getOwnPropertyDescriptors,Q=Object.getOwnPropertySymbols,ye=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable,J=(t,r,e)=>r in t?he(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,H=(t,r)=>{for(var e in r||(r={}))ye.call(r,e)&&J(t,e,r[e]);if(Q)for(var e of Q(r))we.call(r,e)&&J(t,e,r[e]);return t},M=(t,r)=>Oe(t,Pe(r));function Ce(...t){const r=typeof t[0]=="string"?t[0]:void 0,e=c.isString(r)?1:0;let a={},u=U.default,p={immediate:!!e};const h=O=>!!(O==null?void 0:O.request);t.length>0+e&&(h(t[0+e])?u=t[0+e]:a=t[0+e]),t.length>1+e&&h(t[1+e])&&(u=t[1+e]),(t.length===2+e&&!h(t[1+e])||t.length===3+e)&&(p=t[t.length-1]);const i=n.shallowRef(),s=n.shallowRef(),l=n.ref(!1),v=n.ref(!1),P=n.ref(!1),C=n.shallowRef(),j=U.default.CancelToken.source(),I=O=>{l.value||!v.value||(j.cancel(O),P.value=!0,v.value=!1,l.value=!1)},F=O=>{v.value=O,l.value=!O},R=(O=r,g={})=>{let A=r??"",f;typeof O=="string"&&(A=O),f=g,F(!0),u(A,M(H(H({},a),f),{cancelToken:j.token})).then(b=>{i.value=b,s.value=b.data}).catch(b=>{C.value=b}).finally(()=>{F(!1)})};p.immediate&&r&&R();const L={response:i,data:s,error:C,finished:l,loading:v,isFinished:l,isLoading:v,cancel:I,isAborted:P,canceled:P,aborted:P,isCanceled:P,abort:I,execute:R};function N(){return new Promise((O,g)=>{c.until(l).toBe(!0).then(()=>O(L)).catch(A=>g(A))})}return M(H({},L),{then(O,g){return N().then(O,g)}})}var ge=Object.freeze({__proto__:null,camelCase:d.camelCase,capitalCase:d.capitalCase,constantCase:d.constantCase,dotCase:d.dotCase,headerCase:d.headerCase,noCase:d.noCase,paramCase:d.paramCase,pascalCase:d.pascalCase,pathCase:d.pathCase,sentenceCase:d.sentenceCase,snakeCase:d.snakeCase});function be(t,r,e){const a=n.ref(t);return n.computed({get(){return ge[r](a.value,e)},set(u){a.value=u}})}var Ee=Object.defineProperty,z=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,B=(t,r,e)=>r in t?Ee(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,W=(t,r)=>{for(var e in r||(r={}))Se.call(r,e)&&B(t,e,r[e]);if(z)for(var e of z(r))Ae.call(r,e)&&B(t,e,r[e]);return t};function je(t){const r=new T.default(t?t.headers.cookie:null);return(e,{doNotParse:a=!1,autoUpdateDependencies:u=!1}={})=>q(e,{doNotParse:a,autoUpdateDependencies:u},r)}function q(t,{doNotParse:r=!1,autoUpdateDependencies:e=!1}={},a=new T.default){const u=e?[...t||[]]:t;let p=a.getAll({doNotParse:!0});const h=n.ref(0),i=()=>{const s=a.getAll({doNotParse:!0});me(u||null,s,p)&&h.value++,p=s};return a.addChangeListener(i),c.tryOnScopeDispose(()=>{a.removeChangeListener(i)}),{get:(...s)=>(e&&u&&!u.includes(s[0])&&u.push(s[0]),h.value,a.get(s[0],W({doNotParse:r},s[1]))),getAll:(...s)=>(h.value,a.getAll(W({doNotParse:r},s[0]))),set:(...s)=>a.set(...s),remove:(...s)=>a.remove(...s),addChangeListener:(...s)=>a.addChangeListener(...s),removeChangeListener:(...s)=>a.removeChangeListener(...s)}}function me(t,r,e){if(!t)return!0;for(const a of t)if(r[a]!==e[a])return!0;return!1}var $e=Object.defineProperty,K=Object.getOwnPropertySymbols,Ie=Object.prototype.hasOwnProperty,Fe=Object.prototype.propertyIsEnumerable,X=(t,r,e)=>r in t?$e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,Re=(t,r)=>{for(var e in r||(r={}))Ie.call(r,e)&&X(t,e,r[e]);if(K)for(var e of K(r))Fe.call(r,e)&&X(t,e,r[e]);return t};function Le(t,r){const e=n.ref();let a=[];const u=E.createEventHook(),p=E.createEventHook(),h=E.createEventHook(),i=E.createEventHook(),s=E.createEventHook(),l=n.ref(!1),v=n.ref(!1),P=n.ref(!1),C=n.ref(!1),j=n.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw"});n.watch(j,()=>{const f=e.value;f&&(f.brush=j.value)},{deep:!0});const I=()=>{var f;return(f=e.value)==null?void 0:f.undo()},F=()=>{var f;return(f=e.value)==null?void 0:f.redo()},R=()=>{var f;return(f=e.value)==null?void 0:f.clear()},L=()=>{var f;return(f=e.value)==null?void 0:f.cancel()},N=f=>{var b;return(b=e.value)==null?void 0:b.load(f)},O=()=>{var f;return(f=e.value)==null?void 0:f.dump()},g=()=>{var f;a.forEach(b=>b()),(f=e.value)==null||f.unmount()},A=()=>{e.value&&(l.value=e.value.canUndo(),v.value=e.value.canRedo(),P.value=e.value.altPressed,C.value=e.value.shiftPressed)};return n.watch(()=>E.unrefElement(t),f=>{!f||typeof SVGSVGElement=="undefined"||!(f instanceof SVGSVGElement)||(e.value&&g(),e.value=V.createDrauu(Re({el:f},r)),A(),a=[e.value.on("canceled",()=>p.trigger()),e.value.on("committed",()=>h.trigger()),e.value.on("start",()=>i.trigger()),e.value.on("end",()=>s.trigger()),e.value.on("changed",()=>{A(),u.trigger()})])},{flush:"post"}),c.tryOnScopeDispose(()=>g()),{drauuInstance:e,load:N,dump:O,clear:R,cancel:L,undo:I,redo:F,canUndo:l,canRedo:v,brush:j,onChanged:u.on,onCommitted:h.on,onStart:i.on,onEnd:s.on,onCanceled:p.on}}var He=Object.defineProperty,Ne=Object.defineProperties,Ue=Object.getOwnPropertyDescriptors,$=Object.getOwnPropertySymbols,Y=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable,x=(t,r,e)=>r in t?He(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,Te=(t,r)=>{for(var e in r||(r={}))Y.call(r,e)&&x(t,e,r[e]);if($)for(var e of $(r))Z.call(r,e)&&x(t,e,r[e]);return t},ke=(t,r)=>Ne(t,Ue(r)),Ge=(t,r)=>{var e={};for(var a in t)Y.call(t,a)&&r.indexOf(a)<0&&(e[a]=t[a]);if(t!=null&&$)for(var a of $(t))r.indexOf(a)<0&&Z.call(t,a)&&(e[a]=t[a]);return e};function Qe(t,r={}){let e;const a=r,{immediate:u}=a,p=Ge(a,["immediate"]),h=n.ref(!1),i=n.ref(!1),s=C=>e&&e.activate(C),l=C=>e&&e.deactivate(C),v=()=>{e&&(e.pause(),i.value=!0)},P=()=>{e&&(e.unpause(),i.value=!1)};return n.watch(()=>E.unrefElement(t),C=>{!C||(e=D.createFocusTrap(C,ke(Te({},p),{onActivate(){h.value=!0,r.onActivate&&r.onActivate()},onDeactivate(){h.value=!1,r.onDeactivate&&r.onDeactivate()}})),u&&s())},{flush:"post"}),E.tryOnScopeDispose(()=>l()),{hasFocus:h,isPaused:i,activate:s,deactivate:l,pause:v,unpause:P}}function Je(t,r,e){var a;const u=(i,s)=>{var l;const v=s;return new oe.default((l=n.unref(i))!=null?l:[],v)},p=n.ref(u(r,(a=n.unref(e))==null?void 0:a.fuseOptions));return n.watch(()=>{var i;return(i=n.unref(e))==null?void 0:i.fuseOptions},i=>{p.value=u(r,i)},{deep:!0}),n.watch(()=>n.unref(r),i=>{p.value.setCollection(i)},{deep:!0}),{results:n.computed(()=>{var i,s;if(((i=n.unref(e))==null?void 0:i.matchAllWhenSearchEmpty)&&!n.unref(t))return n.unref(r).map((v,P)=>({item:v,refIndex:P}));const l=(s=n.unref(e))==null?void 0:s.resultLimit;return p.value.search(n.unref(t),l?{limit:l}:void 0)})}}function Me(t,r={}){const e=n.ref(t),{onError:a,fallbackValue:u=null}=r,p=(s,l)=>{try{return se.default(s,l)}catch(v){return a==null||a(v),u}},h=n.computed(()=>p(e.value,{header:!0})),i=n.computed(()=>p(e.value));return{header:h,payload:i}}function ze(t=null,r){const e=n.isRef(t)?t:n.ref(t),a=n.computed({set:p=>p?w.default.start():w.default.done(),get:()=>c.isNumber(e.value)&&e.value<1});r&&w.default.configure(r);const u=w.default.set;return w.default.set=p=>(e.value=p,u.call(w.default,p)),n.watchEffect(()=>{c.isNumber(e.value)&&u.call(w.default,e.value)}),c.tryOnScopeDispose(w.default.remove),{isLoading:a,progress:e,start:w.default.start,done:w.default.done,remove:()=>{e.value=null,w.default.remove()}}}function Be(t,r){const e=n.ref(t),a=n.ref("");return n.watch(e,async u=>{e.value&&c.isClient&&(a.value=await le.default.toDataURL(u,r))},{immediate:!0}),a}o.createCookies=je,o.useAsyncValidator=_e,o.useAxios=Ce,o.useChangeCase=be,o.useCookies=q,o.useDrauu=Le,o.useFocusTrap=Qe,o.useFuse=Je,o.useJwt=Me,o.useNProgress=ze,o.useQRCode=Be,Object.defineProperty(o,"__esModule",{value:!0})})(this.VueUse=this.VueUse||{},VueUse,Schema,VueDemi,axios,changeCase,UniversalCookie,Drauu,VueUse,focusTrap,Fuse,jwt_decode,nprogress,QRCode); | ||
var VueDemi=function(o,f,m){if(o.install)return o;if(f)if(f.version.slice(0,4)==="2.7."){for(var n in f)o[n]=f[n];o.isVue2=!0,o.isVue3=!1,o.install=function(){},o.Vue=f,o.Vue2=f,o.version=f.version,o.set=function(_,d,w){return Array.isArray(_)?(_.length=Math.max(_.length,d),_.splice(d,1,w),w):(f.set(_,d,w),w)},o.del=function(_,d){if(Array.isArray(_)){_.splice(d,1);return}f.delete(_,d)}}else if(f.version.slice(0,2)==="2.")if(m){for(var n in m)o[n]=m[n];o.isVue2=!0,o.isVue3=!1,o.install=function(){},o.Vue=f,o.Vue2=f,o.version=f.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(f.version.slice(0,2)==="3."){for(var n in f)o[n]=f[n];o.isVue2=!1,o.isVue3=!0,o.install=function(){},o.Vue=f,o.Vue2=void 0,o.version=f.version,o.set=function(_,d,w){return Array.isArray(_)?(_.length=Math.max(_.length,d),_.splice(d,1,w),w):(_[d]=w,w)},o.del=function(_,d){if(Array.isArray(_)){_.splice(d,1);return}delete _[d]}}else console.error("[vue-demi] Vue version "+f.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");return o}(this.VueDemi=this.VueDemi||(typeof VueDemi!="undefined"?VueDemi:{}),this.Vue||(typeof Vue!="undefined"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI!="undefined"?VueCompositionAPI:void 0));(function(o,f,m,n,_,d,w,V,E,D,ee,te,re,ne){"use strict";function A(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var ae=A(m),U=A(_),T=A(w),oe=A(ee),se=A(te),C=A(re),le=A(ne),ue=Object.defineProperty,fe=Object.defineProperties,ce=Object.getOwnPropertyDescriptors,k=Object.getOwnPropertySymbols,ie=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable,G=(r,t,e)=>t in r?ue(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,pe=(r,t)=>{for(var e in t||(t={}))ie.call(t,e)&&G(r,e,t[e]);if(k)for(var e of k(t))de.call(t,e)&&G(r,e,t[e]);return r},ve=(r,t)=>fe(r,ce(t));function _e(r,t,e={}){const a=n.ref(),l=n.ref(!1),i=n.ref(!1),h=n.computed(()=>{var v;return((v=a.value)==null?void 0:v.errors)||[]}),c=n.computed(()=>{var v;return((v=a.value)==null?void 0:v.fields)||{}}),{validateOption:s={}}=e;n.watchEffect(async()=>{l.value=!1,i.value=!1;const v=new ae.default(n.unref(t));try{await v.validate(n.unref(r),s),i.value=!0,a.value=null}catch(P){a.value=P}finally{l.value=!0}});const p={pass:i,isFinished:l,errorInfo:a,errors:h,errorFields:c};function O(){return new Promise((v,P)=>{f.until(l).toBe(!0).then(()=>v(p)).catch(S=>P(S))})}return ve(pe({},p),{then(v,P){return O().then(v,P)}})}var he=Object.defineProperty,Oe=Object.defineProperties,Pe=Object.getOwnPropertyDescriptors,Q=Object.getOwnPropertySymbols,ye=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable,J=(r,t,e)=>t in r?he(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,H=(r,t)=>{for(var e in t||(t={}))ye.call(t,e)&&J(r,e,t[e]);if(Q)for(var e of Q(t))we.call(t,e)&&J(r,e,t[e]);return r},M=(r,t)=>Oe(r,Pe(t));function Ce(...r){const t=typeof r[0]=="string"?r[0]:void 0,e=f.isString(t)?1:0;let a={},l=U.default,i={immediate:!!e};const h=y=>!!(y==null?void 0:y.request);r.length>0+e&&(h(r[0+e])?l=r[0+e]:a=r[0+e]),r.length>1+e&&h(r[1+e])&&(l=r[1+e]),(r.length===2+e&&!h(r[1+e])||r.length===3+e)&&(i=r[r.length-1]);const c=n.shallowRef(),s=n.shallowRef(),p=n.ref(!1),O=n.ref(!1),v=n.ref(!1),P=n.shallowRef(),S=U.default.CancelToken.source(),I=y=>{p.value||!O.value||(S.cancel(y),v.value=!0,O.value=!1,p.value=!1)},F=y=>{O.value=y,p.value=!y},R=(y=t,g={})=>{let j=t??"",u;typeof y=="string"&&(j=y),u=g,F(!0),l(j,M(H(H({},a),u),{cancelToken:S.token})).then(b=>{c.value=b,s.value=b.data}).catch(b=>{P.value=b}).finally(()=>{F(!1)})};i.immediate&&t&&R();const L={response:c,data:s,error:P,finished:p,loading:O,isFinished:p,isLoading:O,cancel:I,isAborted:v,canceled:v,aborted:v,isCanceled:v,abort:I,execute:R};function N(){return new Promise((y,g)=>{f.until(p).toBe(!0).then(()=>y(L)).catch(j=>g(j))})}return M(H({},L),{then(y,g){return N().then(y,g)}})}var ge=Object.freeze({__proto__:null,camelCase:d.camelCase,capitalCase:d.capitalCase,constantCase:d.constantCase,dotCase:d.dotCase,headerCase:d.headerCase,noCase:d.noCase,paramCase:d.paramCase,pascalCase:d.pascalCase,pathCase:d.pathCase,sentenceCase:d.sentenceCase,snakeCase:d.snakeCase});function be(r,t,e){const a=n.ref(r);return n.computed({get(){return ge[t](a.value,e)},set(l){a.value=l}})}var Ee=Object.defineProperty,z=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,B=(r,t,e)=>t in r?Ee(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,W=(r,t)=>{for(var e in t||(t={}))Se.call(t,e)&&B(r,e,t[e]);if(z)for(var e of z(t))Ae.call(t,e)&&B(r,e,t[e]);return r};function je(r){const t=new T.default(r?r.headers.cookie:null);return(e,{doNotParse:a=!1,autoUpdateDependencies:l=!1}={})=>q(e,{doNotParse:a,autoUpdateDependencies:l},t)}function q(r,{doNotParse:t=!1,autoUpdateDependencies:e=!1}={},a=new T.default){const l=e?[...r||[]]:r;let i=a.getAll({doNotParse:!0});const h=n.ref(0),c=()=>{const s=a.getAll({doNotParse:!0});me(l||null,s,i)&&h.value++,i=s};return a.addChangeListener(c),f.tryOnScopeDispose(()=>{a.removeChangeListener(c)}),{get:(...s)=>(e&&l&&!l.includes(s[0])&&l.push(s[0]),h.value,a.get(s[0],W({doNotParse:t},s[1]))),getAll:(...s)=>(h.value,a.getAll(W({doNotParse:t},s[0]))),set:(...s)=>a.set(...s),remove:(...s)=>a.remove(...s),addChangeListener:(...s)=>a.addChangeListener(...s),removeChangeListener:(...s)=>a.removeChangeListener(...s)}}function me(r,t,e){if(!r)return!0;for(const a of r)if(t[a]!==e[a])return!0;return!1}var $e=Object.defineProperty,K=Object.getOwnPropertySymbols,Ie=Object.prototype.hasOwnProperty,Fe=Object.prototype.propertyIsEnumerable,X=(r,t,e)=>t in r?$e(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Re=(r,t)=>{for(var e in t||(t={}))Ie.call(t,e)&&X(r,e,t[e]);if(K)for(var e of K(t))Fe.call(t,e)&&X(r,e,t[e]);return r};function Le(r,t){const e=n.ref();let a=[];const l=E.createEventHook(),i=E.createEventHook(),h=E.createEventHook(),c=E.createEventHook(),s=E.createEventHook(),p=n.ref(!1),O=n.ref(!1),v=n.ref(!1),P=n.ref(!1),S=n.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw"});n.watch(S,()=>{const u=e.value;u&&(u.brush=S.value)},{deep:!0});const I=()=>{var u;return(u=e.value)==null?void 0:u.undo()},F=()=>{var u;return(u=e.value)==null?void 0:u.redo()},R=()=>{var u;return(u=e.value)==null?void 0:u.clear()},L=()=>{var u;return(u=e.value)==null?void 0:u.cancel()},N=u=>{var b;return(b=e.value)==null?void 0:b.load(u)},y=()=>{var u;return(u=e.value)==null?void 0:u.dump()},g=()=>{var u;a.forEach(b=>b()),(u=e.value)==null||u.unmount()},j=()=>{e.value&&(p.value=e.value.canUndo(),O.value=e.value.canRedo(),v.value=e.value.altPressed,P.value=e.value.shiftPressed)};return n.watch(()=>E.unrefElement(r),u=>{!u||typeof SVGSVGElement=="undefined"||!(u instanceof SVGSVGElement)||(e.value&&g(),e.value=V.createDrauu(Re({el:u},t)),j(),a=[e.value.on("canceled",()=>i.trigger()),e.value.on("committed",()=>h.trigger()),e.value.on("start",()=>c.trigger()),e.value.on("end",()=>s.trigger()),e.value.on("changed",()=>{j(),l.trigger()})])},{flush:"post"}),f.tryOnScopeDispose(()=>g()),{drauuInstance:e,load:N,dump:y,clear:R,cancel:L,undo:I,redo:F,canUndo:p,canRedo:O,brush:S,onChanged:l.on,onCommitted:h.on,onStart:c.on,onEnd:s.on,onCanceled:i.on}}var He=Object.defineProperty,Ne=Object.defineProperties,Ue=Object.getOwnPropertyDescriptors,$=Object.getOwnPropertySymbols,Y=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable,x=(r,t,e)=>t in r?He(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Te=(r,t)=>{for(var e in t||(t={}))Y.call(t,e)&&x(r,e,t[e]);if($)for(var e of $(t))Z.call(t,e)&&x(r,e,t[e]);return r},ke=(r,t)=>Ne(r,Ue(t)),Ge=(r,t)=>{var e={};for(var a in r)Y.call(r,a)&&t.indexOf(a)<0&&(e[a]=r[a]);if(r!=null&&$)for(var a of $(r))t.indexOf(a)<0&&Z.call(r,a)&&(e[a]=r[a]);return e};function Qe(r,t={}){let e;const a=t,{immediate:l}=a,i=Ge(a,["immediate"]),h=n.ref(!1),c=n.ref(!1),s=P=>e&&e.activate(P),p=P=>e&&e.deactivate(P),O=()=>{e&&(e.pause(),c.value=!0)},v=()=>{e&&(e.unpause(),c.value=!1)};return n.watch(()=>E.unrefElement(r),P=>{!P||(e=D.createFocusTrap(P,ke(Te({},i),{onActivate(){h.value=!0,t.onActivate&&t.onActivate()},onDeactivate(){h.value=!1,t.onDeactivate&&t.onDeactivate()}})),l&&s())},{flush:"post"}),E.tryOnScopeDispose(()=>p()),{hasFocus:h,isPaused:c,activate:s,deactivate:p,pause:O,unpause:v}}function Je(r,t,e){var a;const l=(c,s)=>{var p;const O=s;return new oe.default((p=n.unref(c))!=null?p:[],O)},i=n.ref(l(t,(a=n.unref(e))==null?void 0:a.fuseOptions));return n.watch(()=>{var c;return(c=n.unref(e))==null?void 0:c.fuseOptions},c=>{i.value=l(t,c)},{deep:!0}),n.watch(()=>n.unref(t),c=>{i.value.setCollection(c)},{deep:!0}),{results:n.computed(()=>{var c,s;if(((c=n.unref(e))==null?void 0:c.matchAllWhenSearchEmpty)&&!n.unref(r))return n.unref(t).map((O,v)=>({item:O,refIndex:v}));const p=(s=n.unref(e))==null?void 0:s.resultLimit;return i.value.search(n.unref(r),p?{limit:p}:void 0)})}}function Me(r,t={}){const e=n.ref(r),{onError:a,fallbackValue:l=null}=t,i=(s,p)=>{try{return se.default(s,p)}catch(O){return a==null||a(O),l}},h=n.computed(()=>i(e.value,{header:!0})),c=n.computed(()=>i(e.value));return{header:h,payload:c}}function ze(r=null,t){const e=n.isRef(r)?r:n.ref(r),a=n.computed({set:i=>i?C.default.start():C.default.done(),get:()=>f.isNumber(e.value)&&e.value<1});t&&C.default.configure(t);const l=C.default.set;return C.default.set=i=>(e.value=i,l.call(C.default,i)),n.watchEffect(()=>{f.isNumber(e.value)&&l.call(C.default,e.value)}),f.tryOnScopeDispose(C.default.remove),{isLoading:a,progress:e,start:C.default.start,done:C.default.done,remove:()=>{e.value=null,C.default.remove()}}}function Be(r,t){const e=n.ref(r),a=n.ref("");return n.watch(e,async l=>{e.value&&f.isClient&&(a.value=await le.default.toDataURL(l,t))},{immediate:!0}),a}o.createCookies=je,o.useAsyncValidator=_e,o.useAxios=Ce,o.useChangeCase=be,o.useCookies=q,o.useDrauu=Le,o.useFocusTrap=Qe,o.useFuse=Je,o.useJwt=Me,o.useNProgress=ze,o.useQRCode=Be,Object.defineProperty(o,"__esModule",{value:!0})})(this.VueUse=this.VueUse||{},VueUse,Schema,VueDemi,axios,changeCase,UniversalCookie,Drauu,VueUse,focusTrap,Fuse,jwt_decode,nprogress,QRCode); |
{ | ||
"name": "@vueuse/integrations", | ||
"version": "8.7.3", | ||
"version": "8.7.4", | ||
"description": "Integration wrappers for utility libraries", | ||
@@ -141,4 +141,4 @@ "author": "Anthony Fu <https://github.com/antfu>", | ||
"dependencies": { | ||
"@vueuse/core": "8.7.3", | ||
"@vueuse/shared": "8.7.3", | ||
"@vueuse/core": "8.7.4", | ||
"@vueuse/shared": "8.7.4", | ||
"vue-demi": "*" | ||
@@ -145,0 +145,0 @@ }, |
import { MaybeRef } from '@vueuse/shared'; | ||
import { Rules, ValidateError } from 'async-validator'; | ||
import { ValidateError, ValidateOption, Rules } from 'async-validator'; | ||
import { Ref } from 'vue-demi'; | ||
@@ -16,2 +16,8 @@ | ||
} | ||
interface UseAsyncValidatorOptions { | ||
/** | ||
* @see https://github.com/yiminghe/async-validator#options | ||
*/ | ||
validateOption?: ValidateOption; | ||
} | ||
/** | ||
@@ -21,5 +27,6 @@ * Wrapper for async-validator. | ||
* @see https://vueuse.org/useAsyncValidator | ||
* @see https://github.com/yiminghe/async-validator | ||
*/ | ||
declare function useAsyncValidator(value: MaybeRef<Record<string, any>>, rules: MaybeRef<Rules>): UseAsyncValidatorReturn & PromiseLike<UseAsyncValidatorReturn>; | ||
declare function useAsyncValidator(value: MaybeRef<Record<string, any>>, rules: MaybeRef<Rules>, options?: UseAsyncValidatorOptions): UseAsyncValidatorReturn & PromiseLike<UseAsyncValidatorReturn>; | ||
export { useAsyncValidator }; | ||
export { AsyncValidatorError, UseAsyncValidatorOptions, UseAsyncValidatorReturn, useAsyncValidator }; |
@@ -116,3 +116,3 @@ ;var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) { | ||
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); | ||
function useAsyncValidator(value, rules) { | ||
function useAsyncValidator(value, rules, options = {}) { | ||
const errorInfo = vueDemi.ref(); | ||
@@ -129,2 +129,3 @@ const isFinished = vueDemi.ref(false); | ||
}); | ||
const { validateOption = {} } = options; | ||
vueDemi.watchEffect(async () => { | ||
@@ -135,3 +136,3 @@ isFinished.value = false; | ||
try { | ||
await validator.validate(vueDemi.unref(value)); | ||
await validator.validate(vueDemi.unref(value), validateOption); | ||
pass.value = true; | ||
@@ -138,0 +139,0 @@ errorInfo.value = null; |
@@ -1,1 +0,1 @@ | ||
var VueDemi=function(r,e,c){if(r.install)return r;if(e)if(e.version.slice(0,4)==="2.7."){for(var s in e)r[s]=e[s];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=e,r.Vue2=e,r.version=e.version,r.set=function(n,i,f){return Array.isArray(n)?(n.length=Math.max(n.length,i),n.splice(i,1,f),f):(e.set(n,i,f),f)},r.del=function(n,i){if(Array.isArray(n)){n.splice(i,1);return}e.delete(n,i)}}else if(e.version.slice(0,2)==="2.")if(c){for(var s in c)r[s]=c[s];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=e,r.Vue2=e,r.version=e.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(e.version.slice(0,2)==="3."){for(var s in e)r[s]=e[s];r.isVue2=!1,r.isVue3=!0,r.install=function(){},r.Vue=e,r.Vue2=void 0,r.version=e.version,r.set=function(n,i,f){return Array.isArray(n)?(n.length=Math.max(n.length,i),n.splice(i,1,f),f):(n[i]=f,f)},r.del=function(n,i){if(Array.isArray(n)){n.splice(i,1);return}delete n[i]}}else console.error("[vue-demi] Vue version "+e.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");return r}(this.VueDemi=this.VueDemi||(typeof VueDemi!="undefined"?VueDemi:{}),this.Vue||(typeof Vue!="undefined"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI!="undefined"?VueCompositionAPI:void 0));(function(r,e,c,s){"use strict";function n(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var i=n(c),f=Object.defineProperty,y=Object.defineProperties,P=Object.getOwnPropertyDescriptors,v=Object.getOwnPropertySymbols,O=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable,h=(o,l,t)=>l in o?f(o,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[l]=t,A=(o,l)=>{for(var t in l||(l={}))O.call(l,t)&&h(o,t,l[t]);if(v)for(var t of v(l))w.call(l,t)&&h(o,t,l[t]);return o},b=(o,l)=>y(o,P(l));function j(o,l){const t=s.ref(),d=s.ref(!1),p=s.ref(!1),I=s.computed(()=>{var a;return((a=t.value)==null?void 0:a.errors)||[]}),S=s.computed(()=>{var a;return((a=t.value)==null?void 0:a.fields)||{}});s.watchEffect(async()=>{d.value=!1,p.value=!1;const a=new i.default(s.unref(l));try{await a.validate(s.unref(o)),p.value=!0,t.value=null}catch(u){t.value=u}finally{d.value=!0}});const _={pass:p,isFinished:d,errorInfo:t,errors:I,errorFields:S};function U(){return new Promise((a,u)=>{e.until(d).toBe(!0).then(()=>a(_)).catch(E=>u(E))})}return b(A({},_),{then(a,u){return U().then(a,u)}})}r.useAsyncValidator=j,Object.defineProperty(r,"__esModule",{value:!0})})(this.VueUse=this.VueUse||{},VueUse,Schema,VueDemi); | ||
var VueDemi=function(r,e,c){if(r.install)return r;if(e)if(e.version.slice(0,4)==="2.7."){for(var s in e)r[s]=e[s];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=e,r.Vue2=e,r.version=e.version,r.set=function(n,o,a){return Array.isArray(n)?(n.length=Math.max(n.length,o),n.splice(o,1,a),a):(e.set(n,o,a),a)},r.del=function(n,o){if(Array.isArray(n)){n.splice(o,1);return}e.delete(n,o)}}else if(e.version.slice(0,2)==="2.")if(c){for(var s in c)r[s]=c[s];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=e,r.Vue2=e,r.version=e.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(e.version.slice(0,2)==="3."){for(var s in e)r[s]=e[s];r.isVue2=!1,r.isVue3=!0,r.install=function(){},r.Vue=e,r.Vue2=void 0,r.version=e.version,r.set=function(n,o,a){return Array.isArray(n)?(n.length=Math.max(n.length,o),n.splice(o,1,a),a):(n[o]=a,a)},r.del=function(n,o){if(Array.isArray(n)){n.splice(o,1);return}delete n[o]}}else console.error("[vue-demi] Vue version "+e.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");return r}(this.VueDemi=this.VueDemi||(typeof VueDemi!="undefined"?VueDemi:{}),this.Vue||(typeof Vue!="undefined"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI!="undefined"?VueCompositionAPI:void 0));(function(r,e,c,s){"use strict";function n(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var o=n(c),a=Object.defineProperty,P=Object.defineProperties,O=Object.getOwnPropertyDescriptors,h=Object.getOwnPropertySymbols,w=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable,_=(t,i,l)=>i in t?a(t,i,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[i]=l,b=(t,i)=>{for(var l in i||(i={}))w.call(i,l)&&_(t,l,i[l]);if(h)for(var l of h(i))A.call(i,l)&&_(t,l,i[l]);return t},j=(t,i)=>P(t,O(i));function I(t,i,l={}){const u=s.ref(),p=s.ref(!1),v=s.ref(!1),S=s.computed(()=>{var f;return((f=u.value)==null?void 0:f.errors)||[]}),U=s.computed(()=>{var f;return((f=u.value)==null?void 0:f.fields)||{}}),{validateOption:E={}}=l;s.watchEffect(async()=>{p.value=!1,v.value=!1;const f=new o.default(s.unref(i));try{await f.validate(s.unref(t),E),v.value=!0,u.value=null}catch(d){u.value=d}finally{p.value=!0}});const y={pass:v,isFinished:p,errorInfo:u,errors:S,errorFields:U};function F(){return new Promise((f,d)=>{e.until(p).toBe(!0).then(()=>f(y)).catch(M=>d(M))})}return j(b({},y),{then(f,d){return F().then(f,d)}})}r.useAsyncValidator=I,Object.defineProperty(r,"__esModule",{value:!0})})(this.VueUse=this.VueUse||{},VueUse,Schema,VueDemi); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
226625
5393
+ Added@vueuse/core@8.7.4(transitive)
+ Added@vueuse/metadata@8.7.4(transitive)
+ Added@vueuse/shared@8.7.4(transitive)
- Removed@vueuse/core@8.7.3(transitive)
- Removed@vueuse/metadata@8.7.3(transitive)
- Removed@vueuse/shared@8.7.3(transitive)
Updated@vueuse/core@8.7.4
Updated@vueuse/shared@8.7.4