UNPKG

quick-admin-vue3-core

Version:

以快(计算机执行效率、开发效率)为核心的后台管理系统开发模板

2 lines (1 loc) 3.87 kB
"use strict";const l=require("vue");function E(e){return l.getCurrentScope()?(l.onScopeDispose(e),!0):!1}function b(e){return typeof e=="function"?e():l.unref(e)}typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const x=e=>typeof e<"u",D=()=>{};function F(e,n=!1,i="Timeout"){return new Promise((r,o)=>{setTimeout(n?()=>o(i):r,e)})}function C(e){return e}function P(e,n,i){let r;l.isRef(i)?r={evaluating:i}:r={};const{lazy:o=!1,evaluating:a=void 0,shallow:v=!0,onError:f=D}=r,m=l.ref(!o),y=v?l.shallowRef(n):l.ref(n);let t=0;return l.watchEffect(async u=>{if(!m.value)return;t++;const c=t;let s=!1;a&&Promise.resolve().then(()=>{a.value=!0});try{const O=await e(I=>{u(()=>{a&&(a.value=!1),s||I()})});c===t&&(y.value=O)}catch(O){f(O)}finally{a&&c===t&&(a.value=!1),s=!0}}),o?l.computed(()=>(m.value=!0,y.value)):y}function B(e){return JSON.parse(JSON.stringify(e))}const $={easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]},N=Object.assign({},{linear:C},$);function k([e,n,i,r]){const o=(t,u)=>1-3*u+3*t,a=(t,u)=>3*u-6*t,v=t=>3*t,f=(t,u,c)=>((o(u,c)*t+a(u,c))*t+v(u))*t,m=(t,u,c)=>3*o(u,c)*t*t+2*a(u,c)*t+v(u),y=t=>{let u=t;for(let c=0;c<4;++c){const s=m(u,e,i);if(s===0)return u;const O=f(u,e,i)-t;u-=O/s}return u};return t=>e===n&&i===r?t:f(y(t),n,r)}function Q(e,n,i){return e+i*(n-e)}function _(e){return(typeof e=="number"?[e]:e)||[]}function q(e,n,i,r={}){var o,a;const v=b(n),f=b(i),m=_(v),y=_(f),t=(o=b(r.duration))!=null?o:1e3,u=Date.now(),c=Date.now()+t,s=typeof r.transition=="function"?r.transition:(a=b(r.transition))!=null?a:C,O=typeof s=="function"?s:k(s);return new Promise(I=>{e.value=v;const h=()=>{var S;if((S=r.abort)!=null&&S.call(r)){I();return}const T=Date.now(),d=O((T-u)/t),p=_(e.value).map((w,g)=>Q(m[g],y[g],d));Array.isArray(e.value)?e.value=p.map((w,g)=>{var V,A;return Q((V=m[g])!=null?V:0,(A=y[g])!=null?A:0,d)}):typeof e.value=="number"&&(e.value=p[0]),T<c?requestAnimationFrame(h):(e.value=f,I())};h()})}function G(e,n={}){let i=0;const r=()=>{const a=b(e);return typeof a=="number"?a:a.map(b)},o=l.ref(r());return l.watch(r,async a=>{var v,f;if(b(n.disabled))return;const m=++i;if(n.delay&&await F(b(n.delay)),m!==i)return;const y=Array.isArray(a)?a.map(b):b(a);(v=n.onStarted)==null||v.call(n),await q(o,o.value,y,{...n,abort:()=>{var t;return m!==i||((t=n.abort)==null?void 0:t.call(n))}}),(f=n.onFinished)==null||f.call(n)},{deep:!0}),l.watch(()=>b(n.disabled),a=>{a&&(i++,o.value=r())}),E(()=>{i++}),l.computed(()=>b(n.disabled)?r():o.value)}function J(e,n,i,r={}){var o,a,v;const{clone:f=!1,passive:m=!1,eventName:y,deep:t=!1,defaultValue:u,shouldEmit:c}=r,s=l.getCurrentInstance(),O=i||(s==null?void 0:s.emit)||((o=s==null?void 0:s.$emit)==null?void 0:o.bind(s))||((v=(a=s==null?void 0:s.proxy)==null?void 0:a.$emit)==null?void 0:v.bind(s==null?void 0:s.proxy));let I=y;I=I||`update:${n.toString()}`;const h=d=>f?typeof f=="function"?f(d):B(d):d,S=()=>x(e[n])?h(e[n]):u,T=d=>{c?c(d)&&O(I,d):O(I,d)};if(m){const d=S(),p=l.ref(d);let w=!1;return l.watch(()=>e[n],g=>{w||(w=!0,p.value=h(g),l.nextTick(()=>w=!1))}),l.watch(p,g=>{!w&&(g!==e[n]||t)&&T(g)},{deep:t}),p}else return l.computed({get(){return S()},set(d){T(d)}})}exports.TransitionPresets=N;exports.computedAsync=P;exports.useTransition=G;exports.useVModel=J;