@lazycatcloud/lzc-toolkit 0.0.46 → 0.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(w,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(w=typeof globalThis<"u"?globalThis:w||self,e(w.ui={},w.Vue))})(this,function(w,e){"use strict";var de;const fe=typeof window<"u";fe&&((de=window?.navigator)==null?void 0:de.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function W(t){return typeof t=="function"?t():e.unref(t)}function he(t,n){function o(...l){t(()=>n.apply(this,l),{fn:n,thisArg:this,args:l})}return o}function xe(t,n={}){let o,l;return i=>{const a=W(t),d=W(n.maxWait);if(o&&clearTimeout(o),a<=0||d!==void 0&&d<=0)return l&&(clearTimeout(l),l=null),i();d&&!l&&(l=setTimeout(()=>{o&&clearTimeout(o),l=null,i()},d)),o=setTimeout(()=>{l&&clearTimeout(l),l=null,i()},a)}}function Be(t,n=!0,o=!0){let l=0,r,i=!0;const a=()=>{r&&(clearTimeout(r),r=void 0)};return y=>{const v=W(t),h=Date.now()-l;if(a(),v<=0)return l=Date.now(),y();h>v&&(o||!i)?(l=Date.now(),y()):n&&(r=setTimeout(()=>{l=Date.now(),i=!0,a(),y()},v)),!o&&!r&&(r=setTimeout(()=>i=!0,v)),i=!1}}function Oe(t){return t}function Re(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function pe(t,n=200,o={}){return he(xe(n,o),t)}function me(t,n=200,o=!1,l=!0){return he(Be(n,o,l),t)}function Ce(t,n=!0){e.getCurrentInstance()?e.onMounted(t):n?t():e.nextTick(t)}function ve(t){var n;const o=W(t);return(n=o?.$el)!=null?n:o}const De=fe?window:void 0;function Ie(t,n=!1){const o=e.ref(),l=()=>o.value=Boolean(t());return l(),Ce(l,n),o}const X=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},J="__vueuse_ssr_handlers__";X[J]=X[J]||{},X[J];var ge=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,He=Object.prototype.propertyIsEnumerable,Ae=(t,n)=>{var o={};for(var l in t)Le.call(t,l)&&n.indexOf(l)<0&&(o[l]=t[l]);if(t!=null&&ge)for(var l of ge(t))n.indexOf(l)<0&&He.call(t,l)&&(o[l]=t[l]);return o};function Me(t,n,o={}){const l=o,{window:r=De}=l,i=Ae(l,["window"]);let a;const d=Ie(()=>r&&"ResizeObserver"in r),y=()=>{a&&(a.disconnect(),a=void 0)},v=e.watch(()=>ve(t),u=>{y(),d.value&&r&&u&&(a=new ResizeObserver(n),a.observe(u,i))},{immediate:!0,flush:"post"}),h=()=>{y(),v()};return Re(h),{isSupported:d,stop:h}}function Pe(t,n={width:0,height:0},o={}){const{box:l="content-box"}=o,r=e.ref(n.width),i=e.ref(n.height);return Me(t,([a])=>{const d=l==="border-box"?a.borderBoxSize:l==="content-box"?a.contentBoxSize:a.devicePixelContentBoxSize;d?(r.value=d.reduce((y,{inlineSize:v})=>y+v,0),i.value=d.reduce((y,{blockSize:v})=>y+v,0)):(r.value=a.contentRect.width,i.value=a.contentRect.height)},o),e.watch(()=>ve(t),a=>{r.value=a?n.width:0,i.value=a?n.height:0}),{width:r,height:i}}var ye;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(ye||(ye={}));var $e=Object.defineProperty,Se=Object.getOwnPropertySymbols,Fe=Object.prototype.hasOwnProperty,ke=Object.prototype.propertyIsEnumerable,be=(t,n,o)=>n in t?$e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,je=(t,n)=>{for(var o in n||(n={}))Fe.call(n,o)&&be(t,o,n[o]);if(Se)for(var o of Se(n))ke.call(n,o)&&be(t,o,n[o]);return t};je({linear:Oe},{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]});function Ee(t,n){const{scrollEndHook:o,itemHeight:l,overscan:r=5}=n,i=e.ref(null),a=Pe(i),d=e.ref(!0),y=pe(U,100);let v;const h=e.shallowRef(t),u=e.ref(0),s=e.ref({start:0,end:10});let c=0;const b=e.ref([]),_=e.computed(()=>{let{sum:p,height:S}={sum:0,height:0};return h.value.map((D,C)=>(typeof l=="number"?S=l:S=l(C),p+=S,{height:S,sum:p}))}),E=e.computed(()=>F(s.value.start)),g=e.computed(()=>typeof l=="number"?_.value.length*l:_.value[_.value.length-1]?.sum||0),O=e.computed(()=>{let p=b.value.length-r,S=Math.max(p-c,0);return b.value.slice(S,p)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(v)),e.watch([a.width,a.height,h],([p,S])=>{(p||S)&&K()},{deep:!0}),e.watch(u,()=>{I(),y()});function I(){d.value=!1}function U(){d.value=!0,o?.()}function K(){cancelAnimationFrame(v),v=requestAnimationFrame($)}function $(){if(i.value){u.value=i.value.scrollTop,c=M();let p=H(u.value),S=p+c+r;p=p-r,p=p<0?0:p,S=S>h.value.length?h.value.length:S,s.value={start:p,end:S},b.value=h.value.slice(p,S).map((D,C)=>({data:D,index:C+p}))}}function H(p){let S=0,D=_.value.length-1,C=-1;for(;S<=D;){const B=Math.floor((S+D)/2);_.value[B].sum>=p?(C=B,D=B-1):S=B+1}return Math.max(0,C)}function M(){let p=0,S=0,D=L();for(let C=D;C<_.value.length&&(p++,S+=_.value[C].height,!(S>=a.height.value));C++);return p}function F(p){if(typeof l=="number")return p*l;let S=_.value[p];return S?S.sum-S.height:0}function k(p){return _.value[p]||{sum:0,height:0}}function L(){let p=s.value.start;return p>=r&&(p+=r),p}function V(p){if(i.value){const S=k(p);i.value.scrollTop=S.sum-S.height,$()}}const q=e.computed(()=>({style:{width:"100%",height:`${g.value}px`,pointerEvents:d.value?void 0:"none"}})),j=e.computed(()=>({style:{transform:`translate3d(0, ${E.value}px, 0)`,"will-change":"transform"}})),N={overflowY:"auto"};return{list:b,visiableList:O,getItemHeightData:k,getoffsetTopIndex:H,totalHeight:g,clientHeight:a.height,scrollTo:V,scrollTop:u,isScrollEnd:d,containerProps:{ref:i,onScroll:()=>{K()},style:N},wrapperProps:q,innerProps:j}}const Z=Symbol(),ee=Symbol(),te=Symbol(),ne=Symbol(),le=Symbol(),oe=Symbol(),re=Symbol(),ae=Symbol(),ie=Symbol();function Ke(){const{voidFn:t,boolFn:n,boolRef:o,arrayRef:l}={voidFn:c=>{},boolFn:c=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},r=e.inject(ne,l),i=e.inject(te,n),a=e.inject(ae,o),d=e.inject(ee,t),y=e.inject(Z,t),v=e.inject(le,t),h=e.inject(oe,t),u=e.inject(re,t),s=e.inject(ie,t);return{selected:r,isSelected:i,isAllSelected:a,toggle:d,toggleAll:y,select:v,selectAll:h,unselect:u,unselectAll:s}}function Ve(t,n){const o=e.ref({}),l=e.computed(()=>t.value.filter(s=>o.value[s[n]])),r=e.computed(()=>l.value.length!=0&&Object.keys(o.value).length==t.value.length);function i(){t.value.forEach(s=>{o.value[s[n]]=!0})}function a(){o.value={}}function d(s){s.forEach(c=>{o.value[c[n]]||(o.value[c[n]]=!0)})}function y(s){s.forEach(c=>{o.value[c[n]]&&delete o.value[c[n]]})}function v(s){return!!o.value[s[n]]}function h(s){s.forEach(c=>{v(c)?delete o.value[c[n]]:o.value[c[n]]=!0})}function u(){r.value?a():i()}return e.provide(Z,u),e.provide(ee,h),e.provide(te,v),e.provide(ne,l),e.provide(le,d),e.provide(oe,i),e.provide(re,y),e.provide(ae,r),e.provide(ie,a),{selected:l,select:d,selectAll:i,unselect:y,unselectAll:a,toggle:h,toggleAll:u,isSelected:v,isAllSelected:r}}function se(t){return()=>{console.debug(`\u9ED8\u8BA4${t}\u65B9\u6CD5,\u9700\u8981\u81EA\u5B9A\u4E49\u751F\u6548`)}}function ce({attribute:t,selectWay:n="colum",scrollOptions:o={},getSelectMap:l=()=>({})}){const{select:r=se("\u9009\u62E9"),unselect:i=se("\u53D6\u6D88\u9009\u62E9"),unselectAll:a=se("\u53D6\u6D88\u5168\u9009")}=l();let d={};const y=e.computed(()=>me(n==="colum"?P:Y,50)),v=new Set,h=e.ref(!0),u=e.ref(),s=e.ref(!1),c=e.ref({x:0,y:0}),b=e.ref({x:0,y:0,scrollTop:0}),_=new ResizeObserver(f=>E.value=f[0].target.getBoundingClientRect()),E=e.ref({}),g=e.ref({top:0,height:0,sync(f=!1){g.value.top=u.value?.scrollTop||0,f&&(g.value.height=u.value?.scrollHeight||0)}}),O=e.computed(()=>s.value?{left:Math.min(c.value.x,b.value.x)-E.value.left,top:Math.min(c.value.y,b.value.y)-E.value.top,width:Math.abs(c.value.x-b.value.x),height:Math.abs(c.value.y-b.value.y)}:{left:0,top:0,width:0,height:0}),{margin:I=50,startSpeed:U=30,maxSpeed:K=30}=o;let $;const H=I,M=U,F=K,k=f=>f**1;let L=0;function V(f){if(cancelAnimationFrame($),L=q(f),L=Math.max(Math.min(L,F),-F),L!==0){const m=u.value;if(!m||!s.value)return;const R=g.value.height-E.value.height;let T=g.value.top+Number(L);T=Math.min(Math.max(0,T),R),m.scrollTop=T,N(),$=requestAnimationFrame(()=>V(f))}}function q(f){if(u.value){const R=E.value,T=R.bottom-f;if(T<H)return M*k(1-T/H);const A=f-R.top;if(A<H)return-M*k(1-A/H)}return 0}function j(f){const m={...O.value,right:0,bottom:0};return m.left+=E.value.left,m.top+=E.value.top-g.value.top,m.right=m.width+m.left,m.bottom=m.height+m.top,m.left<f.right&&m.right>f.left&&m.top<f.bottom&&m.bottom>f.top}function N(){g.value.sync();const{top:f,height:m}=g.value;b.value.y=Math.min(m+E.value.top,b.value.y+f-b.value.scrollTop),b.value.scrollTop=f}function p(f,m,R="dynamic-styles"){let T=document.getElementById(R);T||(T=document.createElement("style"),T.id=R,document.head.appendChild(T));const A=T.sheet.cssRules,Q=A.length,lt=`${f} { ${m} }`;for(let ue=0;ue<Q;ue++){const Te=A[ue];if(Te.selectorText===f&&Te.style.cssText===m)return}T.sheet.insertRule(lt,Q)}function S(f,m){h.value=!0,s.value=!0,g.value.height?g.value.sync():g.value.sync(!0),c.value.x=f,c.value.y=m+g.value.top,b.value.x=c.value.x,b.value.y=c.value.y,u.value?.classList.add("disable-scroll-behavior"),v.clear()}function D(f,m,R){!s.value||(h.value&&n==="colum"&&!x()&&(a(),h.value=!1),R?.(),V(m),b.value.x=Math.max(f,E.value.left),b.value.y=Math.min(m+g.value.top,g.value.height+E.value.top),b.value.scrollTop=g.value.top,y.value())}function C(){s.value=!1,u.value?.classList.remove("disable-scroll-behavior")}function B(){!s.value||(L||N(),y.value())}function x(){if(!s.value)return!1;const{width:f,height:m}=O.value;return!(Math.max(f,m)>5)}function z(){x()&&a()}function P(){x()||u.value?.querySelectorAll(`[${t}]`).forEach(f=>{d[`${t}`]=f.getAttribute(`${t}`),j(f.getBoundingClientRect())?r([d]):i([d])})}function Y(){const f=[];let m=null,R=0;u.value?.querySelectorAll(`[${t}]`).forEach((T,A)=>{const Q=T.getAttribute(`${t}`);f.push(Q),j(T.getBoundingClientRect())?(m===null&&(m=A),m=Math.min(m,A),R=Math.max(R,A)):(d[`${t}`]=Q,v.has(Q)&&i([d]))});for(let T=m;T<R+1;T++)d[`${t}`]=f[T],r([d]),v.add(f[T])}function G(f){return!f?.value||(u.value=f.value,!u?.value)?!1:(_.observe(u.value),p(".disable-scroll-behavior","scroll-behavior: unset !important;"),!0)}return{init:G,dragStart:S,dragMove:D,dragEnd:C,onScroll:B,isSingleClick:x,cancelSelectAllBySingleClick:z,selectFn:y,selectRange:O,isPressing:s,containerEl:u,observer:_}}function Ne(t){const n=ce(t),{observer:o,selectRange:l}=n,{onScroll:r,dragStart:i,dragMove:a,dragEnd:d,cancelSelectAllBySingleClick:y}=n,v=e.computed(()=>({left:`${l.value.left}px`,top:`${l.value.top}px`,width:`${l.value.width}px`,height:`${l.value.height}px`})),h=e.defineComponent({render(){return e.h("div",{id:"selectBoxEl",class:"absolute z-50 bg-blue-200 opacity-50",style:v.value})}});function u(E){E.button===0&&i(E.x,E.y)}function s(E){a(E.x,E.y)}function c(E){E.composedPath().some(O=>O?.getAttribute?.(t.attribute))||y(),d()}function b(E){try{if(!n.init(E))throw"\u521D\u59CB\u5316\u5931\u8D25,Ref\u5143\u7D20\u4E0D\u6B63\u786E";if(!n.containerEl?.value)return!1;e.render(e.h(h),n.containerEl.value),n.containerEl.value?.addEventListener("scroll",r),n.containerEl.value?.addEventListener("mousedown",u),window.addEventListener("mousemove",s),window.addEventListener("mouseup",c)}catch(g){console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25",g)}}function _(){o.disconnect(),n.containerEl.value?.removeEventListener("scroll",r),n.containerEl.value?.removeEventListener("mousedown",u),window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",c)}return{init:b,unMount:_}}function ze(t,n,o=600){const l=ce({...t,selectWay:"row",scrollOptions:{startSpeed:5,maxSpeed:5}}),{observer:r}=l,{onScroll:i,dragStart:a,dragMove:d,dragEnd:y,selectFn:v}=l;let h;function u(){clearTimeout(h)}function s(g){u(),h=setTimeout(()=>{const{clientX:O,clientY:I}=g.targetTouches[0];a(O,I),n?.(),v.value(),g.preventDefault()},o)}function c(g){u();const{clientX:O,clientY:I}=g.targetTouches[0];d(O,I,()=>g.preventDefault())}function b(){u(),y()}function _(g){try{if(!l.init(g))throw"\u521D\u59CB\u5316\u5931\u8D25,Ref\u5143\u7D20\u4E0D\u6B63\u786E";if(!l.containerEl?.value)return!1;l.containerEl.value?.addEventListener("scroll",i),l.containerEl.value?.addEventListener("touchstart",s),l.containerEl.value?.addEventListener("touchmove",c),window.addEventListener("touchcancel",b),window.addEventListener("touchend",b)}catch(O){console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25",O)}}function E(){r.disconnect(),l.containerEl.value?.removeEventListener("scroll",i),l.containerEl.value?.removeEventListener("touchstart",s),l.containerEl.value?.removeEventListener("touchmove",c),window.removeEventListener("touchcancel",b),window.removeEventListener("touchEnd",b)}return{init:_,unMount:E}}const we=Symbol(),Qe=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0},dialogClass:{default:""}},emits:["update:visiable"],setup(t,{emit:n}){const o=t,l=()=>{o.closeOnClickOverlay&&n("update:visiable",!1)};return e.provide(we,()=>n("update:visiable",!1)),(r,i)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[t.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:l,class:"modal absolute left-0 right-0 top-0 bottom-0 flex bg-stone-900 bg-opacity-50 z-[999]"},[e.createElementVNode("div",{onClick:i[0]||(i[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog m-auto flex flex-col",t.dialogClass])},[e.renderSlot(r.$slots,"default")],2)])):e.createCommentVNode("",!0)]),_:3}))}});function Ue(t){function n(o,l){const r=document.createElement("div"),i={setup(){return()=>e.h(Qe,{visiable:!0,"onUpdate:visiable":()=>{r?.remove()},...t},{default:()=>e.h(o,l)})}};return document.body.appendChild(r),e.render(e.h(i),r),{close:()=>r?.remove()}}return{create:n}}const qe=["xlink:href","fill","color"],We=e.defineComponent({__name:"SvgIcon",props:{name:null,prefix:{default:"icon"},color:{default:"#FFF"},width:null,height:null},setup(t){const n=t,o=e.computed(()=>`#${n.prefix}-${n.name}`),l=e.computed(()=>({width:`${n.width??n.height}px`,height:`${n.height??n.width}px`,aspectRatio:n.width&&n.height?void 0:"1/1"}));return(r,i)=>(e.openBlock(),e.createElementBlock("svg",{"aria-hidden":"",style:e.normalizeStyle(e.unref(l))},[e.createElementVNode("use",{"xlink:href":e.unref(o),fill:t.color,color:t.color},null,8,qe)],4))}});function Ye(t){const{containerEl:n,sliderEl:o,autoHeight:l,performance:r={},maxHeightRatio:i=.9}=t,a=e.ref(!0),d=pe(F,100);let y,v="";const h=e.ref(0),u=e.ref(0),s=e.ref(0),c=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),b=e.ref({clientHeight:0}),_=e.computed(()=>!!u.value),E=e.computed(()=>c.value.scrollHeight>c.value.clientHeight),g=e.computed(()=>c.value.clientHeight-b.value.clientHeight),O=e.computed(()=>c.value.scrollHeight-c.value.clientHeight),I=e.computed(()=>Math.max(c.value.clientHeight/c.value.scrollHeight,.05)),U=e.computed(()=>I.value>i?0:I.value*c.value.clientHeight),K=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${s.value}px,0)`,height:l?`${U.value}px`:void 0}));function $(B){M(),u.value=B.clientY-o.value.getBoundingClientRect().top||1,v=getComputedStyle(n.value).scrollBehavior,v==="smooth"&&(n.value.style.scrollBehavior="unset")}function H(){n.value.style.scrollBehavior=v,u.value=0,d()}function M(){a.value=!1}function F(){_.value||(a.value=!0)}function k(B){if(!_.value)return;let x=B.clientY-c.value.top-u.value;x<0?s.value=0:x>=g.value?s.value=g.value:s.value=x,n.value.scrollTo({top:s.value/g.value*O.value})}function L(){_.value||V()}function V(){cancelAnimationFrame(y),y=requestAnimationFrame(q)}function q(){n.value&&(h.value=r.scrollTop?.value??n.value.scrollTop,s.value=h.value/O.value*g.value)}function j(B){let x="addEventListener";B==="add"?x="addEventListener":x="removeEventListener",o.value?.[x]("pointerdown",$,{passive:!0}),window[x]("pointermove",k,{passive:!0}),window[x]("pointerup",H,{passive:!0})}const N=new MutationObserver(B=>{B.map(z=>z.oldValue).join().includes("height")&&p()});function p(){c.value.top=n.value?.getBoundingClientRect().top??0,c.value.scrollHeight=n.value?.scrollHeight??0,c.value.clientHeight=n.value?.clientHeight??0}function S(){M(),setTimeout(()=>{b.value.clientHeight=o.value?.clientHeight??0,F()},150)}function D(B,x,z="dynamic-styles"){let P=document.getElementById(z);P||(P=document.createElement("style"),P.id=z,document.head.appendChild(P));const Y=P.sheet.cssRules,G=Y.length,f=`${B} { ${x} }`;for(let m=0;m<G;m++){const R=Y[m];if(R.selectorText===B&&R.style.cssText===x)return}P.sheet.insertRule(f,G)}function C(){n.value&&o.value?(D(".hide-scrollbar","scrollbar-width: none; -ms-overflow-style: none;"),D(".hide-scrollbar::-webkit-scrollbar","display: none"),n.value.addEventListener("scroll",L,{passive:!0}),j("add"),N.observe(n.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{p()},100),S()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:n,sliderEl:o})}return e.watch(h,()=>{M(),d()}),{isScrollEnd:a,isDragSlider:_,offsetTop:s,scrollTop:h,scrollable:E,sliderPos:K,init:C,modifySliderEventListener:j}}const Ge=(t=>(e.pushScopeId("data-v-edec7292"),t=t(),e.popScopeId(),t))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),Xe=e.defineComponent({__name:"ScrollBar",props:{containerEl:null,autoHide:{type:Boolean},autoHeight:{type:Boolean},performance:null},setup(t,{expose:n}){const o=t,l=!!e.useSlots().default,r=e.ref(null),i=e.computed(()=>o.containerEl),a=Ye({containerEl:i,sliderEl:r,autoHeight:l?o.autoHeight:!0,performance:o.performance}),{scrollable:d,isScrollEnd:y,sliderPos:v}=a,h=e.ref(!1),u=o.autoHide?e.computed(()=>h.value||!y.value):e.computed(()=>d.value);e.onMounted(()=>{e.nextTick(()=>{a.init()})}),e.onUnmounted(()=>{a.modifySliderEventListener("remove")});function s(){h.value=!0}function c(){h.value=!1}return n({uScrollBarReturn:a}),(b,_)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"sliderRef",ref:r,class:"slider-wrapper",onMouseenter:s,onMouseleave:c,style:e.normalizeStyle(e.unref(v))},[e.renderSlot(b.$slots,"default",{},()=>[Ge],!0)],36),[[e.vShow,e.unref(u)]])]),_:3}))}}),at="",_e=(t,n)=>{const o=t.__vccOpts||t;for(const[l,r]of n)o[l]=r;return o},Je=_e(Xe,[["__scopeId","data-v-edec7292"]]),Ze={class:"virtualListWrapper"},et={inheritAttrs:!1},tt=e.defineComponent({...et,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},emits:["scrollEnd"],setup(t,{expose:n,emit:o}){const l=t,r=Ee(e.toRef(l,"data"),{itemHeight:h=>l.itemHeight(l.data[h]),overscan:l.overscan,scrollEndHook:()=>{o("scrollEnd")}}),{list:i,containerProps:a,wrapperProps:d,innerProps:y,getItemHeightData:v}=r;return n({vListReturn:r}),(h,u)=>(e.openBlock(),e.createElementBlock("div",Ze,[e.createElementVNode("div",e.mergeProps({onScrollPassive:u[0]||(u[0]=(...s)=>e.unref(a).onScroll&&e.unref(a).onScroll(...s)),ref:e.unref(a).ref,class:"virtualList"},h.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(d))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(y))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i),({index:s,data:c})=>(e.openBlock(),e.createElementBlock("div",{key:s,style:e.normalizeStyle({height:`${e.unref(v)(s).height}px`,display:"flex"})},[e.renderSlot(h.$slots,"default",{data:c,index:s},void 0,!0)],4))),128))],16)],16)],16)]))}}),it="",nt=_e(tt,[["__scopeId","data-v-4ba97cce"]]);w.ScrollBar=Je,w.SvgIcon=We,w.VirtualList=nt,w.allSelectedKey=ne,w.closeDialogKey=we,w.dialogController=Ue,w.isAllSelectedKey=ae,w.isSelectedKey=te,w.selectAllKey=oe,w.selectKey=le,w.toggleAllKey=Z,w.toggleKey=ee,w.unselectAllKey=ie,w.unselectKey=re,w.useDragSelect=ce,w.useDragSelectByMobile=ze,w.useDragSelectByPc=Ne,w.useSelectable=Ve,w.useSelectableInjectors=Ke,w.useVirtualList=Ee,Object.defineProperties(w,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(h,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(h=typeof globalThis<"u"?globalThis:h||self,e(h.ui={},h.Vue))})(this,function(h,e){"use strict";var Z;const T=typeof window<"u";T&&((Z=window?.navigator)==null?void 0:Z.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function $(n){return typeof n=="function"?n():e.unref(n)}function ue(n,t){function o(...l){n(()=>t.apply(this,l),{fn:t,thisArg:this,args:l})}return o}function de(n,t={}){let o,l;return s=>{const r=$(n),f=$(t.maxWait);if(o&&clearTimeout(o),r<=0||f!==void 0&&f<=0)return l&&(clearTimeout(l),l=null),s();f&&!l&&(l=setTimeout(()=>{o&&clearTimeout(o),l=null,s()},f)),o=setTimeout(()=>{l&&clearTimeout(l),l=null,s()},r)}}function fe(n){return n}function pe(n){return e.getCurrentScope()?(e.onScopeDispose(n),!0):!1}function ee(n,t=200,o={}){return ue(de(t,o),n)}function he(n,t=!0){e.getCurrentInstance()?e.onMounted(n):t?n():e.nextTick(n)}function te(n){var t;const o=$(n);return(t=o?.$el)!=null?t:o}const me=T?window:void 0;T&&window.document,T&&window.navigator,T&&window.location;function ge(n,t=!1){const o=e.ref(),l=()=>o.value=Boolean(n());return l(),he(l,t),o}const F=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},L="__vueuse_ssr_handlers__";F[L]=F[L]||{},F[L];var ne=Object.getOwnPropertySymbols,ye=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable,be=(n,t)=>{var o={};for(var l in n)ye.call(n,l)&&t.indexOf(l)<0&&(o[l]=n[l]);if(n!=null&&ne)for(var l of ne(n))t.indexOf(l)<0&&ve.call(n,l)&&(o[l]=n[l]);return o};function _e(n,t,o={}){const l=o,{window:i=me}=l,s=be(l,["window"]);let r;const f=ge(()=>i&&"ResizeObserver"in i),y=()=>{r&&(r.disconnect(),r=void 0)},m=e.watch(()=>te(n),g=>{y(),f.value&&i&&g&&(r=new ResizeObserver(t),r.observe(g,s))},{immediate:!0,flush:"post"}),p=()=>{y(),m()};return pe(p),{isSupported:f,stop:p}}function Se(n,t={width:0,height:0},o={}){const{box:l="content-box"}=o,i=e.ref(t.width),s=e.ref(t.height);return _e(n,([r])=>{const f=l==="border-box"?r.borderBoxSize:l==="content-box"?r.contentBoxSize:r.devicePixelContentBoxSize;f?(i.value=f.reduce((y,{inlineSize:m})=>y+m,0),s.value=f.reduce((y,{blockSize:m})=>y+m,0)):(i.value=r.contentRect.width,s.value=r.contentRect.height)},o),e.watch(()=>te(n),r=>{i.value=r?t.width:0,s.value=r?t.height:0}),{width:i,height:s}}var oe;(function(n){n.UP="UP",n.RIGHT="RIGHT",n.DOWN="DOWN",n.LEFT="LEFT",n.NONE="NONE"})(oe||(oe={}));var we=Object.defineProperty,le=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,re=(n,t,o)=>t in n?we(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,Te=(n,t)=>{for(var o in t||(t={}))Ee.call(t,o)&&re(n,o,t[o]);if(le)for(var o of le(t))Oe.call(t,o)&&re(n,o,t[o]);return n};Te({linear:fe},{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]});function ie(n,t){const{scrollEndHook:o,itemHeight:l,overscan:i=5}=t,s=e.ref(null),r=Se(s),f=e.ref(!0),y=ee(q,100);let m;const p=e.shallowRef(n),g=e.ref(0),c=e.ref({start:0,end:10});let u=0;const E=e.ref([]),v=e.computed(()=>{let{sum:a,height:d}={sum:0,height:0};return p.value.map((S,b)=>(typeof l=="number"?d=l:d=l(b),a+=d,{height:d,sum:a}))}),U=e.computed(()=>R(c.value.start)),O=e.computed(()=>typeof l=="number"?v.value.length*l:v.value[v.value.length-1]?.sum||0),x=e.computed(()=>{let a=E.value.length-i,d=Math.max(a-u,0);return E.value.slice(d,a)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(m)),e.watch([r.width,r.height,p],([a,d])=>{(a||d)&&I()},{deep:!0}),e.watch(g,()=>{H(),y()});function H(){f.value=!1}function q(){f.value=!0,o?.()}function I(){cancelAnimationFrame(m),m=requestAnimationFrame(C)}function C(){if(s.value){g.value=s.value.scrollTop,u=B();let a=P(g.value),d=a+u+i;a=a-i,a=a<0?0:a,d=d>p.value.length?p.value.length:d,c.value={start:a,end:d},E.value=p.value.slice(a,d).map((S,b)=>({data:S,index:b+a}))}}function P(a){let d=0,S=v.value.length-1,b=-1;for(;d<=S;){const _=Math.floor((d+S)/2);v.value[_].sum>=a?(b=_,S=_-1):d=_+1}return Math.max(0,b)}function B(){let a=0,d=0,S=Y();for(let b=S;b<v.value.length&&(a++,d+=v.value[b].height,!(d>=r.height.value));b++);return a}function R(a){if(typeof l=="number")return a*l;let d=v.value[a];return d?d.sum-d.height:0}function k(a){return v.value[a]||{sum:0,height:0}}function Y(){let a=c.value.start;return a>=i&&(a+=i),a}function G(a){if(s.value){const d=k(a);s.value.scrollTop=d.sum-d.height,C()}}const J=e.computed(()=>({style:{width:"100%",height:`${O.value}px`,pointerEvents:f.value?void 0:"none"}})),A=e.computed(()=>({style:{transform:`translate3d(0, ${U.value}px, 0)`,"will-change":"transform"}})),X={overflowY:"auto"};return{list:E,visiableList:x,getItemHeightData:k,getoffsetTopIndex:P,totalHeight:O,clientHeight:r.height,scrollTo:G,scrollTop:g,isScrollEnd:f,containerProps:{ref:s,onScroll:()=>{I()},style:X},wrapperProps:J,innerProps:A}}const V=Symbol(),D=Symbol(),j=Symbol(),K=Symbol(),M=Symbol(),N=Symbol(),z=Symbol(),W=Symbol(),Q=Symbol();function Be(){const{voidFn:n,boolFn:t,boolRef:o,arrayRef:l}={voidFn:u=>{},boolFn:u=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},i=e.inject(K,l),s=e.inject(j,t),r=e.inject(W,o),f=e.inject(D,n),y=e.inject(V,n),m=e.inject(M,n),p=e.inject(N,n),g=e.inject(z,n),c=e.inject(Q,n);return{selected:i,isSelected:s,isAllSelected:r,toggle:f,toggleAll:y,select:m,selectAll:p,unselect:g,unselectAll:c}}function xe(n,t){const o=e.ref({}),l=e.computed(()=>n.value.filter(c=>o.value[c[t]])),i=e.computed(()=>l.value.length!=0&&Object.keys(o.value).length==n.value.length);function s(){n.value.forEach(c=>{o.value[c[t]]=!0})}function r(){o.value={}}function f(c){c.forEach(u=>{o.value[u[t]]||(o.value[u[t]]=!0)})}function y(c){c.forEach(u=>{o.value[u[t]]&&delete o.value[u[t]]})}function m(c){return!!o.value[c[t]]}function p(c){c.forEach(u=>{m(u)?delete o.value[u[t]]:o.value[u[t]]=!0})}function g(){i.value?r():s()}return e.provide(V,g),e.provide(D,p),e.provide(j,m),e.provide(K,l),e.provide(M,f),e.provide(N,s),e.provide(z,y),e.provide(W,i),e.provide(Q,r),{selected:l,select:f,selectAll:s,unselect:y,unselectAll:r,toggle:p,toggleAll:g,isSelected:m,isAllSelected:i}}const se=Symbol(),He=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0},dialogClass:{default:""}},emits:["update:visiable"],setup(n,{emit:t}){const o=n,l=()=>{o.closeOnClickOverlay&&t("update:visiable",!1)};return e.provide(se,()=>t("update:visiable",!1)),(i,s)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[n.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:l,class:"modal absolute inset-0 bottom-0 flex bg-stone-900 bg-opacity-50 z-[999]"},[e.createElementVNode("div",{onClick:s[0]||(s[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog m-auto flex flex-col",n.dialogClass])},[e.renderSlot(i.$slots,"default")],2)])):e.createCommentVNode("",!0)]),_:3}))}});function Ie(n){function t(o,l){const i=document.createElement("div"),s={setup(){return()=>e.h(He,{visiable:!0,"onUpdate:visiable":()=>{i?.remove()},...n},{default:()=>e.h(o,l)})}};return document.body.appendChild(i),e.render(e.h(s),i),{close:()=>i?.remove()}}return{create:t}}const Ce=["xlink:href","fill","color"],Pe=e.defineComponent({__name:"SvgIcon",props:{name:null,prefix:{default:"icon"},color:{default:"#FFF"},width:null,height:null},setup(n){const t=n,o=e.computed(()=>`#${t.prefix}-${t.name}`),l=e.computed(()=>({width:`${t.width??t.height}px`,height:`${t.height??t.width}px`,aspectRatio:t.width&&t.height?void 0:"1/1"}));return(i,s)=>(e.openBlock(),e.createElementBlock("svg",{"aria-hidden":"",style:e.normalizeStyle(e.unref(l))},[e.createElementVNode("use",{"xlink:href":e.unref(o),fill:n.color,color:n.color},null,8,Ce)],4))}});function Re(n){const{containerEl:t,sliderEl:o,autoHeight:l,performance:i={},maxHeightRatio:s=.9}=n,r=e.ref(!0),f=ee(R,100);let y,m="";const p=e.ref(0),g=e.ref(0),c=e.ref(0),u=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),E=e.ref({clientHeight:0}),v=e.computed(()=>!!g.value),U=e.computed(()=>u.value.scrollHeight>u.value.clientHeight),O=e.computed(()=>u.value.clientHeight-E.value.clientHeight),x=e.computed(()=>u.value.scrollHeight-u.value.clientHeight),H=e.computed(()=>Math.max(u.value.clientHeight/u.value.scrollHeight,.05)),q=e.computed(()=>H.value>s?0:H.value*u.value.clientHeight),I=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${c.value}px,0)`,height:l?`${q.value}px`:void 0}));function C(_){B(),g.value=_.clientY-o.value.getBoundingClientRect().top||1,m=getComputedStyle(t.value).scrollBehavior,m==="smooth"&&(t.value.style.scrollBehavior="unset")}function P(){t.value.style.scrollBehavior=m,g.value=0,f()}function B(){r.value=!1}function R(){v.value||(r.value=!0)}function k(_){if(!v.value)return;let w=_.clientY-u.value.top-g.value;w<0?c.value=0:w>=O.value?c.value=O.value:c.value=w,t.value.scrollTo({top:c.value/O.value*x.value})}function Y(){v.value||G()}function G(){cancelAnimationFrame(y),y=requestAnimationFrame(J)}function J(){t.value&&(p.value=i.scrollTop?.value??t.value.scrollTop,c.value=p.value/x.value*O.value)}function A(_){let w="addEventListener";_==="add"?w="addEventListener":w="removeEventListener",o.value?.[w]("pointerdown",C,{passive:!0}),window[w]("pointermove",k,{passive:!0}),window[w]("pointerup",P,{passive:!0})}const X=new MutationObserver(_=>{_.map(ze=>ze.oldValue).join().includes("height")&&a()});function a(){u.value.top=t.value?.getBoundingClientRect().top??0,u.value.scrollHeight=t.value?.scrollHeight??0,u.value.clientHeight=t.value?.clientHeight??0}function d(){B(),setTimeout(()=>{E.value.clientHeight=o.value?.clientHeight??0,R()},150)}function S(){document.styleSheets[0].insertRule(".hide-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }",0),document.styleSheets[0].insertRule(".hide-scrollbar::-webkit-scrollbar{ display: none }",0),t.value?.classList.add("hide-scrollbar")}function b(){t.value&&o.value?(S(),t.value.addEventListener("scroll",Y,{passive:!0}),A("add"),X.observe(t.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{a()},100),d()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:t,sliderEl:o})}return e.watch(p,()=>{B(),f()}),{isScrollEnd:r,isDragSlider:v,offsetTop:c,scrollTop:p,scrollable:U,sliderPos:I,init:b,modifySliderEventListener:A}}const ke=(n=>(e.pushScopeId("data-v-edec7292"),n=n(),e.popScopeId(),n))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),Ae=e.defineComponent({__name:"ScrollBar",props:{containerEl:null,autoHide:{type:Boolean},autoHeight:{type:Boolean},performance:null},setup(n,{expose:t}){const o=n,l=!!e.useSlots().default,i=e.ref(null),s=e.computed(()=>o.containerEl),r=Re({containerEl:s,sliderEl:i,autoHeight:l?o.autoHeight:!0,performance:o.performance}),{scrollable:f,isScrollEnd:y,sliderPos:m}=r,p=e.ref(!1),g=o.autoHide?e.computed(()=>p.value||!y.value):e.computed(()=>f.value);e.onMounted(()=>{e.nextTick(()=>{r.init()})}),e.onUnmounted(()=>{r.modifySliderEventListener("remove")});function c(){p.value=!0}function u(){p.value=!1}return t({uScrollBarReturn:r}),(E,v)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"sliderRef",ref:i,class:"slider-wrapper",onMouseenter:c,onMouseleave:u,style:e.normalizeStyle(e.unref(m))},[e.renderSlot(E.$slots,"default",{},()=>[ke],!0)],36),[[e.vShow,e.unref(g)]])]),_:3}))}}),Ue="",ae=(n,t)=>{const o=n.__vccOpts||n;for(const[l,i]of t)o[l]=i;return o},$e=ae(Ae,[["__scopeId","data-v-edec7292"]]),Fe={class:"virtualListWrapper"},Le={inheritAttrs:!1},Ve=e.defineComponent({...Le,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},emits:["scrollEnd"],setup(n,{expose:t,emit:o}){const l=n,i=ie(e.toRef(l,"data"),{itemHeight:p=>l.itemHeight(l.data[p]),overscan:l.overscan,scrollEndHook:()=>{o("scrollEnd")}}),{list:s,containerProps:r,wrapperProps:f,innerProps:y,getItemHeightData:m}=i;return t({vListReturn:i}),(p,g)=>(e.openBlock(),e.createElementBlock("div",Fe,[e.createElementVNode("div",e.mergeProps({onScrollPassive:g[0]||(g[0]=(...c)=>e.unref(r).onScroll&&e.unref(r).onScroll(...c)),ref:e.unref(r).ref,class:"virtualList"},p.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(f))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(y))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),({index:c,data:u})=>(e.openBlock(),e.createElementBlock("div",{key:c,style:e.normalizeStyle({height:`${e.unref(m)(c).height}px`,display:"flex"})},[e.renderSlot(p.$slots,"default",{data:u,index:c},void 0,!0)],4))),128))],16)],16)],16)]))}}),qe="",De=ae(Ve,[["__scopeId","data-v-4ba97cce"]]),je={class:"flex w-full max-w-[700px] items-center justify-center"},Ke={class:"text-[14px] text-white"},Me=e.defineComponent({__name:"Toast",props:{message:null,position:null},setup(n){const t=n,o=e.ref(),l=e.ref(),i=e.ref(),s=e.computed(()=>{switch(t.position){case"top":return 10;case"middle":return 50;case"bottom":return 85}}),r=e.computed(()=>({top:`calc(${s.value}% - ${i.value}px)`,left:`calc(50% - ${l.value}px)`,backgroundColor:"black"}));return e.nextTick(()=>{l.value=o.value.offsetWidth/2,i.value=o.value.offsetHeight/2}),(f,y)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",{id:"toastWrapper",ref_key:"toastWrapper",ref:o,class:"absolute rounded-[8px] bg-black px-[14px] py-[12px] opacity-[0.79]",style:e.normalizeStyle([e.unref(r),{zIndex:9999}])},[e.createElementVNode("div",je,[e.createElementVNode("span",Ke,e.toDisplayString(n.message),1)])],4)]))}}),ce={message:"\u61D2\u732B\u4E91 Yes!!!",position:"middle",duration:1500};class Ne{options;container;constructor(t){this.options=t,this.container=document.createElement("div")}present(){const t=e.h(e.h(Me),{...ce,...this.options});e.render(t,this.container),document.body.insertBefore(this.container,document.body.firstChild);const o=this.options.duration||ce.duration;setTimeout(()=>{this.dismiss()},o)}dismiss(){this.container&&(this.container.querySelector("#toastWrapper")?.classList.add("animate-toastAnimation"),setTimeout(()=>{this.container&&(e.render(null,this.container),document.body.removeChild(this.container))},500))}}h.ScrollBar=$e,h.SvgIcon=Pe,h.ToastCreator=Ne,h.VirtualList=De,h.allSelectedKey=K,h.closeDialogKey=se,h.dialogController=Ie,h.isAllSelectedKey=W,h.isSelectedKey=j,h.selectAllKey=N,h.selectKey=M,h.toggleAllKey=V,h.toggleKey=D,h.unselectAllKey=Q,h.unselectKey=z,h.useSelectable=xe,h.useSelectableInjectors=Be,h.useVirtualList=ie,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from "./useVirtualList";
|
|
2
2
|
export * from "./useSelectable";
|
|
3
|
-
export * from "./useDragSelect";
|
|
4
3
|
export * from "./dialog";
|
|
5
4
|
export { default as SvgIcon } from "./svgIcon/SvgIcon.vue";
|
|
6
5
|
export { default as ScrollBar } from "./scroll-bar";
|
|
7
6
|
export { default as VirtualList } from "./useVirtualList/VirtualList.vue";
|
|
7
|
+
export { ToastCreator } from "./toast/ToastCreator";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
+
message: string;
|
|
3
|
+
position: "top" | "middle" | "bottom";
|
|
4
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
5
|
+
message: string;
|
|
6
|
+
position: "top" | "middle" | "bottom";
|
|
7
|
+
}>>>, {}>;
|
|
8
|
+
export default _default;
|
|
9
|
+
declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
10
|
+
declare type __VLS_TypePropsToRuntimeProps<T> = {
|
|
11
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
12
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
13
|
+
} : {
|
|
14
|
+
type: import('vue').PropType<T[K]>;
|
|
15
|
+
required: true;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface ToastOptions {
|
|
2
|
+
message?: string;
|
|
3
|
+
position?: "top" | "middle" | "bottom";
|
|
4
|
+
duration?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare class ToastCreator {
|
|
7
|
+
options: ToastOptions;
|
|
8
|
+
container: HTMLElement;
|
|
9
|
+
constructor(options: ToastOptions);
|
|
10
|
+
present(): void;
|
|
11
|
+
dismiss(): void;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lazycatcloud/lzc-toolkit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.47",
|
|
4
4
|
"description": "lazycat ui toolkits",
|
|
5
5
|
"main": "./dist/index.umd.js",
|
|
6
6
|
"module": "./dist/index.es.js",
|
|
@@ -32,4 +32,4 @@
|
|
|
32
32
|
"vue": "^3.2.39",
|
|
33
33
|
"vue-tsc": "^0.40.13"
|
|
34
34
|
}
|
|
35
|
-
}
|
|
35
|
+
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { type Ref } from "vue";
|
|
2
|
-
interface DragOptions {
|
|
3
|
-
attribute: string;
|
|
4
|
-
selectWay?: "row" | "colum";
|
|
5
|
-
scrollOptions?: {
|
|
6
|
-
margin?: number;
|
|
7
|
-
startSpeed?: number;
|
|
8
|
-
maxSpeed?: number;
|
|
9
|
-
};
|
|
10
|
-
getSelectMap?: () => {
|
|
11
|
-
select?: (_: any[]) => void;
|
|
12
|
-
unselect?: (_: any[]) => void;
|
|
13
|
-
unselectAll?: () => void;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
declare type ContainsRefType = Ref<HTMLElement | null | undefined>;
|
|
17
|
-
export declare function useDragSelect({ attribute, selectWay, scrollOptions, getSelectMap, }: DragOptions): {
|
|
18
|
-
init: (_containerEl: ContainsRefType) => boolean;
|
|
19
|
-
dragStart: (x: number, y: number) => void;
|
|
20
|
-
dragMove: (x: number, y: number, hook?: Function) => void;
|
|
21
|
-
dragEnd: () => void;
|
|
22
|
-
onScroll: () => void;
|
|
23
|
-
isSingleClick: () => boolean;
|
|
24
|
-
cancelSelectAllBySingleClick: () => void;
|
|
25
|
-
selectFn: import("vue").ComputedRef<() => void>;
|
|
26
|
-
selectRange: import("vue").ComputedRef<{
|
|
27
|
-
left: number;
|
|
28
|
-
top: number;
|
|
29
|
-
width: number;
|
|
30
|
-
height: number;
|
|
31
|
-
}>;
|
|
32
|
-
isPressing: Ref<boolean>;
|
|
33
|
-
containerEl: ContainsRefType;
|
|
34
|
-
observer: ResizeObserver;
|
|
35
|
-
};
|
|
36
|
-
export declare function useDragSelectByPc(options: DragOptions): {
|
|
37
|
-
init: (_containerEl: ContainsRefType) => false | undefined;
|
|
38
|
-
unMount: () => void;
|
|
39
|
-
};
|
|
40
|
-
export declare function useDragSelectByMobile(options: DragOptions, joinSelectMode?: Function, pressTime?: number): {
|
|
41
|
-
init: (_containerEl: ContainsRefType) => false | undefined;
|
|
42
|
-
unMount: () => void;
|
|
43
|
-
};
|
|
44
|
-
export {};
|