@lazycatcloud/lzc-toolkit 0.0.59 → 0.0.60
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.es.js +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -519,7 +519,7 @@ function Vt(t, e, n = 600) {
|
|
|
519
519
|
clearTimeout(f);
|
|
520
520
|
}
|
|
521
521
|
function c(m) {
|
|
522
|
-
d(), m.composedPath().some((O) => !!O
|
|
522
|
+
d(), m.composedPath().some((O) => !!O?.getAttribute(t.attribute)) && (f = setTimeout(() => {
|
|
523
523
|
const { clientX: O, clientY: $ } = m.targetTouches[0];
|
|
524
524
|
r(O, $), e?.(), i(O, $, () => m.preventDefault()), m.preventDefault();
|
|
525
525
|
}, n));
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(E,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(E=typeof globalThis<"u"?globalThis:E||self,e(E.ui={},E.Vue))})(this,function(E,e){"use strict";var fe;const pe=typeof window<"u";pe&&((fe=window?.navigator)==null?void 0:fe.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function Q(n){return typeof n=="function"?n():e.unref(n)}function he(n,t){function o(...l){n(()=>t.apply(this,l),{fn:t,thisArg:this,args:l})}return o}function Be(n,t={}){let o,l;return i=>{const a=Q(n),u=Q(t.maxWait);if(o&&clearTimeout(o),a<=0||u!==void 0&&u<=0)return l&&(clearTimeout(l),l=null),i();u&&!l&&(l=setTimeout(()=>{o&&clearTimeout(o),l=null,i()},u)),o=setTimeout(()=>{l&&clearTimeout(l),l=null,i()},a)}}function Oe(n,t=!0,o=!0){let l=0,r,i=!0;const a=()=>{r&&(clearTimeout(r),r=void 0)};return y=>{const h=Q(n),p=Date.now()-l;if(a(),h<=0)return l=Date.now(),y();p>h&&(o||!i)?(l=Date.now(),y()):t&&(r=setTimeout(()=>{l=Date.now(),i=!0,a(),y()},h)),!o&&!r&&(r=setTimeout(()=>i=!0,h)),i=!1}}function Ce(n){return n}function De(n){return e.getCurrentScope()?(e.onScopeDispose(n),!0):!1}function me(n,t=200,o={}){return he(Be(t,o),n)}function ve(n,t=200,o=!1,l=!0){return he(Oe(t,o,l),n)}function Re(n,t=!0){e.getCurrentInstance()?e.onMounted(n):t?n():e.nextTick(n)}function ge(n){var t;const o=Q(n);return(t=o?.$el)!=null?t:o}const Ie=pe?window:void 0;function Le(n,t=!1){const o=e.ref(),l=()=>o.value=Boolean(n());return l(),Re(l,t),o}const J=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Z="__vueuse_ssr_handlers__";J[Z]=J[Z]||{},J[Z];var ye=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,He=Object.prototype.propertyIsEnumerable,Pe=(n,t)=>{var o={};for(var l in n)Ae.call(n,l)&&t.indexOf(l)<0&&(o[l]=n[l]);if(n!=null&&ye)for(var l of ye(n))t.indexOf(l)<0&&He.call(n,l)&&(o[l]=n[l]);return o};function Me(n,t,o={}){const l=o,{window:r=Ie}=l,i=Pe(l,["window"]);let a;const u=Le(()=>r&&"ResizeObserver"in r),y=()=>{a&&(a.disconnect(),a=void 0)},h=e.watch(()=>ge(n),d=>{y(),u.value&&r&&d&&(a=new ResizeObserver(t),a.observe(d,i))},{immediate:!0,flush:"post"}),p=()=>{y(),h()};return De(p),{isSupported:u,stop:p}}function $e(n,t={width:0,height:0},o={}){const{box:l="content-box"}=o,r=e.ref(t.width),i=e.ref(t.height);return Me(n,([a])=>{const u=l==="border-box"?a.borderBoxSize:l==="content-box"?a.contentBoxSize:a.devicePixelContentBoxSize;u?(r.value=u.reduce((y,{inlineSize:h})=>y+h,0),i.value=u.reduce((y,{blockSize:h})=>y+h,0)):(r.value=a.contentRect.width,i.value=a.contentRect.height)},o),e.watch(()=>ge(n),a=>{r.value=a?t.width:0,i.value=a?t.height:0}),{width:r,height:i}}var Se;(function(n){n.UP="UP",n.RIGHT="RIGHT",n.DOWN="DOWN",n.LEFT="LEFT",n.NONE="NONE"})(Se||(Se={}));var Fe=Object.defineProperty,be=Object.getOwnPropertySymbols,ke=Object.prototype.hasOwnProperty,Ve=Object.prototype.propertyIsEnumerable,Ee=(n,t,o)=>t in n?Fe(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,je=(n,t)=>{for(var o in t||(t={}))ke.call(t,o)&&Ee(n,o,t[o]);if(be)for(var o of be(t))Ve.call(t,o)&&Ee(n,o,t[o]);return n};je({linear:Ce},{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 _e(n,t){const{scrollEndHook:o,itemHeight:l,overscan:r=5}=t,i=e.ref(null),a=$e(i),u=e.ref(!0),y=me(U,100);let h;const p=e.shallowRef(n),d=e.ref(0),c=e.ref({start:0,end:10});let s=0;const _=e.ref([]),w=e.computed(()=>{let{sum:m,height:S}={sum:0,height:0};return p.value.map((R,D)=>(typeof l=="number"?S=l:S=l(D),m+=S,{height:S,sum:m}))}),g=e.computed(()=>F(c.value.start)),b=e.computed(()=>typeof l=="number"?w.value.length*l:w.value[w.value.length-1]?.sum||0),B=e.computed(()=>{let m=_.value.length-r,S=Math.max(m-s,0);return _.value.slice(S,m)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(h)),e.watch([a.width,a.height,p],([m,S])=>{(m||S)&&j()},{deep:!0}),e.watch(d,()=>{L(),y()});function L(){u.value=!1}function U(){u.value=!0,o?.()}function j(){cancelAnimationFrame(h),h=requestAnimationFrame($)}function $(){if(i.value){d.value=i.value.scrollTop,s=P();let m=A(d.value),S=m+s+r;m=m-r,m=m<0?0:m,S=S>p.value.length?p.value.length:S,c.value={start:m,end:S},_.value=p.value.slice(m,S).map((R,D)=>({data:R,index:D+m}))}}function A(m){let S=0,R=w.value.length-1,D=-1;for(;S<=R;){const O=Math.floor((S+R)/2);w.value[O].sum>=m?(D=O,R=O-1):S=O+1}return Math.max(0,D)}function P(){let m=0,S=0,R=I();for(let D=R;D<w.value.length&&(m++,S+=w.value[D].height,!(S>=a.height.value));D++);return m}function F(m){if(typeof l=="number")return m*l;let S=w.value[m];return S?S.sum-S.height:0}function k(m){return w.value[m]||{sum:0,height:0}}function I(){let m=c.value.start;return m>=r&&(m+=r),m}function z(m){if(i.value){const S=k(m);i.value.scrollTop=S.sum-S.height,$()}}const q=e.computed(()=>({style:{width:"100%",height:`${b.value}px`,pointerEvents:u.value?void 0:"none"}})),V=e.computed(()=>({style:{transform:`translate3d(0, ${g.value}px, 0)`,"will-change":"transform"}})),K={overflowY:"auto"};return{list:_,visiableList:B,getItemHeightData:k,getoffsetTopIndex:A,totalHeight:b,clientHeight:a.height,scrollTo:z,scrollTop:d,isScrollEnd:u,containerProps:{ref:i,onScroll:()=>{j()},style:K},wrapperProps:q,innerProps:V}}const ee=Symbol(),te=Symbol(),ne=Symbol(),oe=Symbol(),le=Symbol(),re=Symbol(),ae=Symbol(),ie=Symbol(),se=Symbol();function ze(){const{voidFn:n,boolFn:t,boolRef:o,arrayRef:l}={voidFn:s=>{},boolFn:s=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},r=e.inject(oe,l),i=e.inject(ne,t),a=e.inject(ie,o),u=e.inject(te,n),y=e.inject(ee,n),h=e.inject(le,n),p=e.inject(re,n),d=e.inject(ae,n),c=e.inject(se,n);return{selected:r,isSelected:i,isAllSelected:a,toggle:u,toggleAll:y,select:h,selectAll:p,unselect:d,unselectAll:c}}function Ke(n,t){const o=e.ref({}),l=e.computed(()=>n.value.filter(c=>o.value[c[t]])),r=e.computed(()=>l.value.length!=0&&Object.keys(o.value).length==n.value.length);function i(){n.value.forEach(c=>{o.value[c[t]]=!0})}function a(){o.value={}}function u(c){c.forEach(s=>{o.value[s[t]]||(o.value[s[t]]=!0)})}function y(c){c.forEach(s=>{o.value[s[t]]&&delete o.value[s[t]]})}function h(c){return!!o.value[c[t]]}function p(c){c.forEach(s=>{h(s)?delete o.value[s[t]]:o.value[s[t]]=!0})}function d(){r.value?a():i()}return e.provide(ee,d),e.provide(te,p),e.provide(ne,h),e.provide(oe,l),e.provide(le,u),e.provide(re,i),e.provide(ae,y),e.provide(ie,r),e.provide(se,a),{selected:l,select:u,selectAll:i,unselect:y,unselectAll:a,toggle:p,toggleAll:d,isSelected:h,isAllSelected:r}}function ce(n){return()=>{console.debug(`\u9ED8\u8BA4${n}\u65B9\u6CD5,\u9700\u8981\u81EA\u5B9A\u4E49\u751F\u6548`)}}function ue({attribute:n,selectWay:t="colum",scrollOptions:o={},getSelectMap:l=()=>({})}){const{select:r=ce("\u9009\u62E9"),unselect:i=ce("\u53D6\u6D88\u9009\u62E9"),unselectAll:a=ce("\u53D6\u6D88\u5168\u9009")}=l();let u={};const y=e.computed(()=>ve(t==="colum"?M:G,50)),h=new Set,p=e.ref(!0),d=e.ref(),c=e.ref(!1),s=e.ref({x:0,y:0}),_=e.ref({x:0,y:0,scrollTop:0}),w=new ResizeObserver(f=>g.value=f[0].target.getBoundingClientRect()),g=e.ref({}),b=e.ref({top:0,height:0,sync(f=!1){b.value.top=d.value?.scrollTop||0,f&&(b.value.height=d.value?.scrollHeight||0)}}),B=e.computed(()=>c.value?{left:Math.min(s.value.x,_.value.x)-g.value.left,top:Math.min(s.value.y,_.value.y)-g.value.top,width:Math.abs(s.value.x-_.value.x),height:Math.abs(s.value.y-_.value.y)}:{left:0,top:0,width:0,height:0}),{margin:L=50,startSpeed:U=30,maxSpeed:j=30}=o;let $;const A=L,P=U,F=j,k=f=>f**1;let I=0;function z(f){if(cancelAnimationFrame($),I=q(f),I=Math.max(Math.min(I,F),-F),I!==0){const v=d.value;if(!v||!c.value)return;const C=b.value.height-g.value.height;let T=b.value.top+Number(I);T=Math.min(Math.max(0,T),C),v.scrollTop=T,K(),$=requestAnimationFrame(()=>z(f))}}function q(f){if(d.value){const C=g.value,T=C.bottom-f;if(T<A)return P*k(1-T/A);const H=f-C.top;if(H<A)return-P*k(1-H/A)}return 0}function V(f){const v={...B.value,right:0,bottom:0};return v.left+=g.value.left,v.top+=g.value.top-b.value.top,v.right=v.width+v.left,v.bottom=v.height+v.top,v.left<f.right&&v.right>f.left&&v.top<f.bottom&&v.bottom>f.top}function K(){b.value.sync();const{top:f,height:v}=b.value;_.value.y=Math.min(v+g.value.top,_.value.y+f-_.value.scrollTop),_.value.scrollTop=f}function m(f,v,C="dynamic-styles"){let T=document.getElementById(C);T||(T=document.createElement("style"),T.id=C,document.head.appendChild(T));const H=T.sheet.cssRules,W=H.length,st=`${f} { ${v} }`;for(let de=0;de<W;de++){const xe=H[de];if(xe.selectorText===f&&xe.style.cssText===v)return}T.sheet.insertRule(st,W)}function S(f,v){p.value=!0,c.value=!0,b.value.height?b.value.sync():b.value.sync(!0),s.value.x=f,s.value.y=v+b.value.top,_.value.x=s.value.x,_.value.y=s.value.y,d.value?.classList.add("disable-scroll-behavior"),h.clear()}function R(f,v,C){!c.value||(p.value&&t==="colum"&&!x()&&(a(),p.value=!1),C?.(),z(v),_.value.x=Math.max(f,g.value.left),_.value.y=Math.min(v+b.value.top,b.value.height+g.value.top),_.value.scrollTop=b.value.top,y.value())}function D(){c.value=!1,d.value?.classList.remove("disable-scroll-behavior")}function O(){!c.value||(I||K(),y.value())}function x(){if(!c.value)return!1;const{width:f,height:v}=B.value;return!(Math.max(f,v)>5)}function N(){x()&&a()}function M(){x()||d.value?.querySelectorAll(`[${n}]`).forEach(f=>{u[`${n}`]=f.getAttribute(`${n}`),V(f.getBoundingClientRect())?r([u]):i([u])})}function G(){const f=[];let v=null,C=0;d.value?.querySelectorAll(`[${n}]`).forEach((T,H)=>{const W=T.getAttribute(`${n}`);f.push(W),V(T.getBoundingClientRect())?(v===null&&(v=H),v=Math.min(v,H),C=Math.max(C,H)):(u[`${n}`]=W,h.has(W)&&i([u]))});for(let T=v;T<C+1;T++)u[`${n}`]=f[T],r([u]),h.add(f[T])}function X(f){return!f?.value||(d.value=f.value,!d?.value)?!1:(w.observe(d.value),m(".disable-scroll-behavior","scroll-behavior: unset !important;"),!0)}return{init:X,dragStart:S,dragMove:R,dragEnd:D,onScroll:O,isSingleClick:x,cancelSelectAllBySingleClick:N,selectFn:y,selectRange:B,isPressing:c,containerEl:d,observer:w}}function Ne(n){const t=ue(n),{observer:o,selectRange:l}=t,{onScroll:r,dragStart:i,dragMove:a,dragEnd:u,cancelSelectAllBySingleClick:y}=t,h=e.computed(()=>({left:`${l.value.left}px`,top:`${l.value.top}px`,width:`${l.value.width}px`,height:`${l.value.height}px`})),p=e.defineComponent({render(){return e.h("div",{id:"selectBoxEl",class:"absolute z-50 bg-blue-200 opacity-50",style:h.value})}});function d(g){g.button===0&&i(g.x,g.y)}function c(g){a(g.x,g.y)}function s(g){g.composedPath().some(B=>B?.getAttribute?.(n.attribute))||y(),u()}function _(g){try{if(!t.init(g))throw"\u521D\u59CB\u5316\u5931\u8D25,Ref\u5143\u7D20\u4E0D\u6B63\u786E";if(!t.containerEl?.value)return!1;e.render(e.h(p),t.containerEl.value),t.containerEl.value?.addEventListener("scroll",r),t.containerEl.value?.addEventListener("mousedown",d),window.addEventListener("mousemove",c),window.addEventListener("mouseup",s)}catch(b){console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25",b)}}function w(){o.disconnect(),t.containerEl.value?.removeEventListener("scroll",r),t.containerEl.value?.removeEventListener("mousedown",d),window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",s)}return{init:_,unMount:w}}function We(n,t,o=600){const l=ue({...n,selectWay:"row",scrollOptions:{startSpeed:5,maxSpeed:5}}),{observer:r}=l,{onScroll:i,dragStart:a,dragMove:u,dragEnd:y}=l;let h;function p(){clearTimeout(h)}function d(g){p(),g.composedPath().some(B=>!!B.getAttribute(n.attribute))&&(h=setTimeout(()=>{const{clientX:B,clientY:L}=g.targetTouches[0];a(B,L),t?.(),u(B,L,()=>g.preventDefault()),g.preventDefault()},o))}function c(g){p();const{clientX:b,clientY:B}=g.targetTouches[0];u(b,B,()=>g.preventDefault())}function s(){p(),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",d),l.containerEl.value?.addEventListener("touchmove",c),window.addEventListener("touchcancel",s),window.addEventListener("touchend",s)}catch(b){console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25",b)}}function w(){r.disconnect(),l.containerEl.value?.removeEventListener("scroll",i),l.containerEl.value?.removeEventListener("touchstart",d),l.containerEl.value?.removeEventListener("touchmove",c),window.removeEventListener("touchcancel",s),window.removeEventListener("touchEnd",s)}return{init:_,unMount:w}}const we=Symbol(),Ue=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(we,()=>t("update:visiable",!1)),(r,i)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[n.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:l,class:"lzc-modal"},[e.createElementVNode("div",{onClick:i[0]||(i[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["lzc-dialog",n.dialogClass])},[e.renderSlot(r.$slots,"default",{},void 0,!0)],2)])):e.createCommentVNode("",!0)]),_:3}))}}),ut="",Y=(n,t)=>{const o=n.__vccOpts||n;for(const[l,r]of t)o[l]=r;return o},qe=Y(Ue,[["__scopeId","data-v-e171c24d"]]);function Qe(n){function t(o,l){const r=document.createElement("div"),i={setup(){return()=>e.h(qe,{visiable:!0,"onUpdate:visiable":()=>{r?.remove()},...n},{default:()=>e.h(o,l)})}};return document.body.appendChild(r),e.render(e.h(i),r),{close:()=>r?.remove()}}return{create:t}}const Ye=e.defineComponent({__name:"Toast",props:{message:null,position:null},setup(n){const t=n,o=e.ref(),l=e.ref(),r=e.ref(),i=e.computed(()=>{switch(t.position){case"top":return 10;case"middle":return 50;case"bottom":return 85}}),a=e.computed(()=>({position:"absolute",borderRadius:"10px",backgroundColor:"rgba(0, 0, 0, 0.8)",padding:"14px 19px",top:`calc(${i.value}% - ${r.value}px)`,left:`calc(50% - ${l.value}px)`})),u=e.computed(()=>({width:"fit-content",display:"flex",justifyContent:"center",alignItems:"center",color:"white",fontSize:"14px"}));return e.nextTick(()=>{l.value=o.value.offsetWidth/2,r.value=o.value.offsetHeight/2}),(y,h)=>(e.openBlock(),e.createElementBlock("div",{id:"toastWrapper",ref_key:"toastWrapper",ref:o,class:"toastWrapper",style:e.normalizeStyle([e.unref(a),{zIndex:9999}])},[e.createElementVNode("div",{style:e.normalizeStyle(e.unref(u))},[e.createElementVNode("span",null,e.toDisplayString(n.message),1)],4)],4))}}),dt="",Ge=Y(Ye,[["__scopeId","data-v-15ab4094"]]),Te={message:"\u61D2\u732B\u4E91 Yes!!!",position:"middle",duration:1500};class Xe{options;container;constructor(t){this.options=t,this.container=document.createElement("div")}present(){const t=e.h(e.h(Ge),{...Te,...this.options});e.render(t,this.container),document.body.insertBefore(this.container,document.body.firstChild);const o=this.options.duration||Te.duration;setTimeout(()=>{this.dismiss()},o)}dismiss(){if(this.container){const t=this.container.querySelector("#toastWrapper");t.style.opacity="0",t.style.transition="opacity 0.4s ease-in",setTimeout(()=>{this.container&&(e.render(null,this.container),document.body.removeChild(this.container))},500)}}}const Je=["xlink:href","fill","color"],Ze=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(r,i)=>(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,Je)],4))}});function et(n){const{containerEl:t,sliderEl:o,autoHeight:l,performance:r={},maxHeightRatio:i=.9}=n,a=e.ref(!0),u=me(F,100);let y,h="";const p=e.ref(0),d=e.ref(0),c=e.ref(0),s=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),_=e.ref({clientHeight:0}),w=e.computed(()=>!!d.value),g=e.computed(()=>s.value.scrollHeight>s.value.clientHeight),b=e.computed(()=>s.value.clientHeight-_.value.clientHeight),B=e.computed(()=>s.value.scrollHeight-s.value.clientHeight),L=e.computed(()=>Math.max(s.value.clientHeight/s.value.scrollHeight,.05)),U=e.computed(()=>L.value>i?0:L.value*s.value.clientHeight),j=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${c.value}px,0)`,height:l?`${U.value}px`:void 0}));function $(O){P(),d.value=O.clientY-o.value.getBoundingClientRect().top||1,h=getComputedStyle(t.value).scrollBehavior,h==="smooth"&&(t.value.style.scrollBehavior="unset")}function A(){t.value.style.scrollBehavior=h,d.value=0,u()}function P(){a.value=!1}function F(){w.value||(a.value=!0)}function k(O){if(!w.value)return;let x=O.clientY-s.value.top-d.value;x<0?c.value=0:x>=b.value?c.value=b.value:c.value=x,t.value.scrollTo({top:c.value/b.value*B.value})}function I(){w.value||z()}function z(){cancelAnimationFrame(y),y=requestAnimationFrame(q)}function q(){t.value&&(p.value=r.scrollTop?.value??t.value.scrollTop,c.value=p.value/B.value*b.value)}function V(O){let x="addEventListener";O==="add"?x="addEventListener":x="removeEventListener",o.value?.[x]("pointerdown",$,{passive:!0}),window[x]("pointermove",k,{passive:!0}),window[x]("pointerup",A,{passive:!0})}const K=new MutationObserver(O=>{O.map(N=>N.oldValue).join().includes("height")&&m()});function m(){s.value.top=t.value?.getBoundingClientRect().top??0,s.value.scrollHeight=t.value?.scrollHeight??0,s.value.clientHeight=t.value?.clientHeight??0}function S(){P(),setTimeout(()=>{_.value.clientHeight=o.value?.clientHeight??0,F()},150)}function R(O,x,N="dynamic-styles"){let M=document.getElementById(N);M||(M=document.createElement("style"),M.id=N,document.head.appendChild(M));const G=M.sheet.cssRules,X=G.length,f=`${O} { ${x} }`;for(let v=0;v<X;v++){const C=G[v];if(C.selectorText===O&&C.style.cssText===x)return}M.sheet.insertRule(f,X)}function D(){t.value&&o.value?(R(".hide-scrollbar","scrollbar-width: none; -ms-overflow-style: none;"),R(".hide-scrollbar::-webkit-scrollbar","display: none"),t.value.classList.add("hide-scrollbar"),t.value.addEventListener("scroll",I,{passive:!0}),V("add"),K.observe(t.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{m()},100),S()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:t,sliderEl:o})}return e.watch(p,()=>{P(),u()}),{isScrollEnd:a,isDragSlider:w,offsetTop:c,scrollTop:p,scrollable:g,sliderPos:j,init:D,modifySliderEventListener:V}}const tt=(n=>(e.pushScopeId("data-v-edec7292"),n=n(),e.popScopeId(),n))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),nt=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,r=e.ref(null),i=e.computed(()=>o.containerEl),a=et({containerEl:i,sliderEl:r,autoHeight:l?o.autoHeight:!0,performance:o.performance}),{scrollable:u,isScrollEnd:y,sliderPos:h}=a,p=e.ref(!1),d=o.autoHide?e.computed(()=>p.value||!y.value):e.computed(()=>u.value);e.onMounted(()=>{e.nextTick(()=>{a.init()})}),e.onUnmounted(()=>{a.modifySliderEventListener("remove")});function c(){p.value=!0}function s(){p.value=!1}return t({uScrollBarReturn:a}),(_,w)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"sliderRef",ref:r,class:"slider-wrapper",onMouseenter:c,onMouseleave:s,style:e.normalizeStyle(e.unref(h))},[e.renderSlot(_.$slots,"default",{},()=>[tt],!0)],36),[[e.vShow,e.unref(d)]])]),_:3}))}}),pt="",ot=Y(nt,[["__scopeId","data-v-edec7292"]]),lt={class:"virtualListWrapper"},rt={inheritAttrs:!1},at=e.defineComponent({...rt,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},emits:["scrollEnd"],setup(n,{expose:t,emit:o}){const l=n,r=_e(e.toRef(l,"data"),{itemHeight:p=>l.itemHeight(l.data[p]),overscan:l.overscan,scrollEndHook:()=>{o("scrollEnd")}}),{list:i,containerProps:a,wrapperProps:u,innerProps:y,getItemHeightData:h}=r;return t({vListReturn:r}),(p,d)=>(e.openBlock(),e.createElementBlock("div",lt,[e.createElementVNode("div",e.mergeProps({onScrollPassive:d[0]||(d[0]=(...c)=>e.unref(a).onScroll&&e.unref(a).onScroll(...c)),ref:e.unref(a).ref,class:"virtualList"},p.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(u))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(y))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i),({index:c,data:s})=>(e.openBlock(),e.createElementBlock("div",{key:c,style:e.normalizeStyle({height:`${e.unref(h)(c).height}px`,display:"flex"})},[e.renderSlot(p.$slots,"default",{data:s,index:c},void 0,!0)],4))),128))],16)],16)],16)]))}}),ht="",it=Y(at,[["__scopeId","data-v-4ba97cce"]]);E.ScrollBar=ot,E.SvgIcon=Ze,E.ToastCreator=Xe,E.VirtualList=it,E.allSelectedKey=oe,E.closeDialogKey=we,E.dialogController=Qe,E.isAllSelectedKey=ie,E.isSelectedKey=ne,E.selectAllKey=re,E.selectKey=le,E.toggleAllKey=ee,E.toggleKey=te,E.unselectAllKey=se,E.unselectKey=ae,E.useDragSelect=ue,E.useDragSelectByMobile=We,E.useDragSelectByPc=Ne,E.useSelectable=Ke,E.useSelectableInjectors=ze,E.useVirtualList=_e,Object.defineProperties(E,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(E,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(E=typeof globalThis<"u"?globalThis:E||self,e(E.ui={},E.Vue))})(this,function(E,e){"use strict";var fe;const pe=typeof window<"u";pe&&((fe=window?.navigator)==null?void 0:fe.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function Q(n){return typeof n=="function"?n():e.unref(n)}function he(n,t){function o(...l){n(()=>t.apply(this,l),{fn:t,thisArg:this,args:l})}return o}function Be(n,t={}){let o,l;return i=>{const a=Q(n),u=Q(t.maxWait);if(o&&clearTimeout(o),a<=0||u!==void 0&&u<=0)return l&&(clearTimeout(l),l=null),i();u&&!l&&(l=setTimeout(()=>{o&&clearTimeout(o),l=null,i()},u)),o=setTimeout(()=>{l&&clearTimeout(l),l=null,i()},a)}}function Oe(n,t=!0,o=!0){let l=0,r,i=!0;const a=()=>{r&&(clearTimeout(r),r=void 0)};return y=>{const h=Q(n),p=Date.now()-l;if(a(),h<=0)return l=Date.now(),y();p>h&&(o||!i)?(l=Date.now(),y()):t&&(r=setTimeout(()=>{l=Date.now(),i=!0,a(),y()},h)),!o&&!r&&(r=setTimeout(()=>i=!0,h)),i=!1}}function Ce(n){return n}function De(n){return e.getCurrentScope()?(e.onScopeDispose(n),!0):!1}function me(n,t=200,o={}){return he(Be(t,o),n)}function ve(n,t=200,o=!1,l=!0){return he(Oe(t,o,l),n)}function Re(n,t=!0){e.getCurrentInstance()?e.onMounted(n):t?n():e.nextTick(n)}function ge(n){var t;const o=Q(n);return(t=o?.$el)!=null?t:o}const Ie=pe?window:void 0;function Le(n,t=!1){const o=e.ref(),l=()=>o.value=Boolean(n());return l(),Re(l,t),o}const J=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Z="__vueuse_ssr_handlers__";J[Z]=J[Z]||{},J[Z];var ye=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,He=Object.prototype.propertyIsEnumerable,Pe=(n,t)=>{var o={};for(var l in n)Ae.call(n,l)&&t.indexOf(l)<0&&(o[l]=n[l]);if(n!=null&&ye)for(var l of ye(n))t.indexOf(l)<0&&He.call(n,l)&&(o[l]=n[l]);return o};function Me(n,t,o={}){const l=o,{window:r=Ie}=l,i=Pe(l,["window"]);let a;const u=Le(()=>r&&"ResizeObserver"in r),y=()=>{a&&(a.disconnect(),a=void 0)},h=e.watch(()=>ge(n),d=>{y(),u.value&&r&&d&&(a=new ResizeObserver(t),a.observe(d,i))},{immediate:!0,flush:"post"}),p=()=>{y(),h()};return De(p),{isSupported:u,stop:p}}function $e(n,t={width:0,height:0},o={}){const{box:l="content-box"}=o,r=e.ref(t.width),i=e.ref(t.height);return Me(n,([a])=>{const u=l==="border-box"?a.borderBoxSize:l==="content-box"?a.contentBoxSize:a.devicePixelContentBoxSize;u?(r.value=u.reduce((y,{inlineSize:h})=>y+h,0),i.value=u.reduce((y,{blockSize:h})=>y+h,0)):(r.value=a.contentRect.width,i.value=a.contentRect.height)},o),e.watch(()=>ge(n),a=>{r.value=a?t.width:0,i.value=a?t.height:0}),{width:r,height:i}}var Se;(function(n){n.UP="UP",n.RIGHT="RIGHT",n.DOWN="DOWN",n.LEFT="LEFT",n.NONE="NONE"})(Se||(Se={}));var Fe=Object.defineProperty,be=Object.getOwnPropertySymbols,ke=Object.prototype.hasOwnProperty,Ve=Object.prototype.propertyIsEnumerable,Ee=(n,t,o)=>t in n?Fe(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,je=(n,t)=>{for(var o in t||(t={}))ke.call(t,o)&&Ee(n,o,t[o]);if(be)for(var o of be(t))Ve.call(t,o)&&Ee(n,o,t[o]);return n};je({linear:Ce},{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 _e(n,t){const{scrollEndHook:o,itemHeight:l,overscan:r=5}=t,i=e.ref(null),a=$e(i),u=e.ref(!0),y=me(U,100);let h;const p=e.shallowRef(n),d=e.ref(0),c=e.ref({start:0,end:10});let s=0;const _=e.ref([]),w=e.computed(()=>{let{sum:m,height:S}={sum:0,height:0};return p.value.map((R,D)=>(typeof l=="number"?S=l:S=l(D),m+=S,{height:S,sum:m}))}),g=e.computed(()=>F(c.value.start)),b=e.computed(()=>typeof l=="number"?w.value.length*l:w.value[w.value.length-1]?.sum||0),B=e.computed(()=>{let m=_.value.length-r,S=Math.max(m-s,0);return _.value.slice(S,m)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(h)),e.watch([a.width,a.height,p],([m,S])=>{(m||S)&&j()},{deep:!0}),e.watch(d,()=>{L(),y()});function L(){u.value=!1}function U(){u.value=!0,o?.()}function j(){cancelAnimationFrame(h),h=requestAnimationFrame($)}function $(){if(i.value){d.value=i.value.scrollTop,s=P();let m=A(d.value),S=m+s+r;m=m-r,m=m<0?0:m,S=S>p.value.length?p.value.length:S,c.value={start:m,end:S},_.value=p.value.slice(m,S).map((R,D)=>({data:R,index:D+m}))}}function A(m){let S=0,R=w.value.length-1,D=-1;for(;S<=R;){const O=Math.floor((S+R)/2);w.value[O].sum>=m?(D=O,R=O-1):S=O+1}return Math.max(0,D)}function P(){let m=0,S=0,R=I();for(let D=R;D<w.value.length&&(m++,S+=w.value[D].height,!(S>=a.height.value));D++);return m}function F(m){if(typeof l=="number")return m*l;let S=w.value[m];return S?S.sum-S.height:0}function k(m){return w.value[m]||{sum:0,height:0}}function I(){let m=c.value.start;return m>=r&&(m+=r),m}function z(m){if(i.value){const S=k(m);i.value.scrollTop=S.sum-S.height,$()}}const q=e.computed(()=>({style:{width:"100%",height:`${b.value}px`,pointerEvents:u.value?void 0:"none"}})),V=e.computed(()=>({style:{transform:`translate3d(0, ${g.value}px, 0)`,"will-change":"transform"}})),K={overflowY:"auto"};return{list:_,visiableList:B,getItemHeightData:k,getoffsetTopIndex:A,totalHeight:b,clientHeight:a.height,scrollTo:z,scrollTop:d,isScrollEnd:u,containerProps:{ref:i,onScroll:()=>{j()},style:K},wrapperProps:q,innerProps:V}}const ee=Symbol(),te=Symbol(),ne=Symbol(),oe=Symbol(),le=Symbol(),re=Symbol(),ae=Symbol(),ie=Symbol(),se=Symbol();function ze(){const{voidFn:n,boolFn:t,boolRef:o,arrayRef:l}={voidFn:s=>{},boolFn:s=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},r=e.inject(oe,l),i=e.inject(ne,t),a=e.inject(ie,o),u=e.inject(te,n),y=e.inject(ee,n),h=e.inject(le,n),p=e.inject(re,n),d=e.inject(ae,n),c=e.inject(se,n);return{selected:r,isSelected:i,isAllSelected:a,toggle:u,toggleAll:y,select:h,selectAll:p,unselect:d,unselectAll:c}}function Ke(n,t){const o=e.ref({}),l=e.computed(()=>n.value.filter(c=>o.value[c[t]])),r=e.computed(()=>l.value.length!=0&&Object.keys(o.value).length==n.value.length);function i(){n.value.forEach(c=>{o.value[c[t]]=!0})}function a(){o.value={}}function u(c){c.forEach(s=>{o.value[s[t]]||(o.value[s[t]]=!0)})}function y(c){c.forEach(s=>{o.value[s[t]]&&delete o.value[s[t]]})}function h(c){return!!o.value[c[t]]}function p(c){c.forEach(s=>{h(s)?delete o.value[s[t]]:o.value[s[t]]=!0})}function d(){r.value?a():i()}return e.provide(ee,d),e.provide(te,p),e.provide(ne,h),e.provide(oe,l),e.provide(le,u),e.provide(re,i),e.provide(ae,y),e.provide(ie,r),e.provide(se,a),{selected:l,select:u,selectAll:i,unselect:y,unselectAll:a,toggle:p,toggleAll:d,isSelected:h,isAllSelected:r}}function ce(n){return()=>{console.debug(`\u9ED8\u8BA4${n}\u65B9\u6CD5,\u9700\u8981\u81EA\u5B9A\u4E49\u751F\u6548`)}}function ue({attribute:n,selectWay:t="colum",scrollOptions:o={},getSelectMap:l=()=>({})}){const{select:r=ce("\u9009\u62E9"),unselect:i=ce("\u53D6\u6D88\u9009\u62E9"),unselectAll:a=ce("\u53D6\u6D88\u5168\u9009")}=l();let u={};const y=e.computed(()=>ve(t==="colum"?M:G,50)),h=new Set,p=e.ref(!0),d=e.ref(),c=e.ref(!1),s=e.ref({x:0,y:0}),_=e.ref({x:0,y:0,scrollTop:0}),w=new ResizeObserver(f=>g.value=f[0].target.getBoundingClientRect()),g=e.ref({}),b=e.ref({top:0,height:0,sync(f=!1){b.value.top=d.value?.scrollTop||0,f&&(b.value.height=d.value?.scrollHeight||0)}}),B=e.computed(()=>c.value?{left:Math.min(s.value.x,_.value.x)-g.value.left,top:Math.min(s.value.y,_.value.y)-g.value.top,width:Math.abs(s.value.x-_.value.x),height:Math.abs(s.value.y-_.value.y)}:{left:0,top:0,width:0,height:0}),{margin:L=50,startSpeed:U=30,maxSpeed:j=30}=o;let $;const A=L,P=U,F=j,k=f=>f**1;let I=0;function z(f){if(cancelAnimationFrame($),I=q(f),I=Math.max(Math.min(I,F),-F),I!==0){const v=d.value;if(!v||!c.value)return;const C=b.value.height-g.value.height;let T=b.value.top+Number(I);T=Math.min(Math.max(0,T),C),v.scrollTop=T,K(),$=requestAnimationFrame(()=>z(f))}}function q(f){if(d.value){const C=g.value,T=C.bottom-f;if(T<A)return P*k(1-T/A);const H=f-C.top;if(H<A)return-P*k(1-H/A)}return 0}function V(f){const v={...B.value,right:0,bottom:0};return v.left+=g.value.left,v.top+=g.value.top-b.value.top,v.right=v.width+v.left,v.bottom=v.height+v.top,v.left<f.right&&v.right>f.left&&v.top<f.bottom&&v.bottom>f.top}function K(){b.value.sync();const{top:f,height:v}=b.value;_.value.y=Math.min(v+g.value.top,_.value.y+f-_.value.scrollTop),_.value.scrollTop=f}function m(f,v,C="dynamic-styles"){let T=document.getElementById(C);T||(T=document.createElement("style"),T.id=C,document.head.appendChild(T));const H=T.sheet.cssRules,W=H.length,st=`${f} { ${v} }`;for(let de=0;de<W;de++){const xe=H[de];if(xe.selectorText===f&&xe.style.cssText===v)return}T.sheet.insertRule(st,W)}function S(f,v){p.value=!0,c.value=!0,b.value.height?b.value.sync():b.value.sync(!0),s.value.x=f,s.value.y=v+b.value.top,_.value.x=s.value.x,_.value.y=s.value.y,d.value?.classList.add("disable-scroll-behavior"),h.clear()}function R(f,v,C){!c.value||(p.value&&t==="colum"&&!x()&&(a(),p.value=!1),C?.(),z(v),_.value.x=Math.max(f,g.value.left),_.value.y=Math.min(v+b.value.top,b.value.height+g.value.top),_.value.scrollTop=b.value.top,y.value())}function D(){c.value=!1,d.value?.classList.remove("disable-scroll-behavior")}function O(){!c.value||(I||K(),y.value())}function x(){if(!c.value)return!1;const{width:f,height:v}=B.value;return!(Math.max(f,v)>5)}function N(){x()&&a()}function M(){x()||d.value?.querySelectorAll(`[${n}]`).forEach(f=>{u[`${n}`]=f.getAttribute(`${n}`),V(f.getBoundingClientRect())?r([u]):i([u])})}function G(){const f=[];let v=null,C=0;d.value?.querySelectorAll(`[${n}]`).forEach((T,H)=>{const W=T.getAttribute(`${n}`);f.push(W),V(T.getBoundingClientRect())?(v===null&&(v=H),v=Math.min(v,H),C=Math.max(C,H)):(u[`${n}`]=W,h.has(W)&&i([u]))});for(let T=v;T<C+1;T++)u[`${n}`]=f[T],r([u]),h.add(f[T])}function X(f){return!f?.value||(d.value=f.value,!d?.value)?!1:(w.observe(d.value),m(".disable-scroll-behavior","scroll-behavior: unset !important;"),!0)}return{init:X,dragStart:S,dragMove:R,dragEnd:D,onScroll:O,isSingleClick:x,cancelSelectAllBySingleClick:N,selectFn:y,selectRange:B,isPressing:c,containerEl:d,observer:w}}function Ne(n){const t=ue(n),{observer:o,selectRange:l}=t,{onScroll:r,dragStart:i,dragMove:a,dragEnd:u,cancelSelectAllBySingleClick:y}=t,h=e.computed(()=>({left:`${l.value.left}px`,top:`${l.value.top}px`,width:`${l.value.width}px`,height:`${l.value.height}px`})),p=e.defineComponent({render(){return e.h("div",{id:"selectBoxEl",class:"absolute z-50 bg-blue-200 opacity-50",style:h.value})}});function d(g){g.button===0&&i(g.x,g.y)}function c(g){a(g.x,g.y)}function s(g){g.composedPath().some(B=>B?.getAttribute?.(n.attribute))||y(),u()}function _(g){try{if(!t.init(g))throw"\u521D\u59CB\u5316\u5931\u8D25,Ref\u5143\u7D20\u4E0D\u6B63\u786E";if(!t.containerEl?.value)return!1;e.render(e.h(p),t.containerEl.value),t.containerEl.value?.addEventListener("scroll",r),t.containerEl.value?.addEventListener("mousedown",d),window.addEventListener("mousemove",c),window.addEventListener("mouseup",s)}catch(b){console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25",b)}}function w(){o.disconnect(),t.containerEl.value?.removeEventListener("scroll",r),t.containerEl.value?.removeEventListener("mousedown",d),window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",s)}return{init:_,unMount:w}}function We(n,t,o=600){const l=ue({...n,selectWay:"row",scrollOptions:{startSpeed:5,maxSpeed:5}}),{observer:r}=l,{onScroll:i,dragStart:a,dragMove:u,dragEnd:y}=l;let h;function p(){clearTimeout(h)}function d(g){p(),g.composedPath().some(B=>!!B?.getAttribute(n.attribute))&&(h=setTimeout(()=>{const{clientX:B,clientY:L}=g.targetTouches[0];a(B,L),t?.(),u(B,L,()=>g.preventDefault()),g.preventDefault()},o))}function c(g){p();const{clientX:b,clientY:B}=g.targetTouches[0];u(b,B,()=>g.preventDefault())}function s(){p(),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",d),l.containerEl.value?.addEventListener("touchmove",c),window.addEventListener("touchcancel",s),window.addEventListener("touchend",s)}catch(b){console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25",b)}}function w(){r.disconnect(),l.containerEl.value?.removeEventListener("scroll",i),l.containerEl.value?.removeEventListener("touchstart",d),l.containerEl.value?.removeEventListener("touchmove",c),window.removeEventListener("touchcancel",s),window.removeEventListener("touchEnd",s)}return{init:_,unMount:w}}const we=Symbol(),Ue=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(we,()=>t("update:visiable",!1)),(r,i)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[n.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:l,class:"lzc-modal"},[e.createElementVNode("div",{onClick:i[0]||(i[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["lzc-dialog",n.dialogClass])},[e.renderSlot(r.$slots,"default",{},void 0,!0)],2)])):e.createCommentVNode("",!0)]),_:3}))}}),ut="",Y=(n,t)=>{const o=n.__vccOpts||n;for(const[l,r]of t)o[l]=r;return o},qe=Y(Ue,[["__scopeId","data-v-e171c24d"]]);function Qe(n){function t(o,l){const r=document.createElement("div"),i={setup(){return()=>e.h(qe,{visiable:!0,"onUpdate:visiable":()=>{r?.remove()},...n},{default:()=>e.h(o,l)})}};return document.body.appendChild(r),e.render(e.h(i),r),{close:()=>r?.remove()}}return{create:t}}const Ye=e.defineComponent({__name:"Toast",props:{message:null,position:null},setup(n){const t=n,o=e.ref(),l=e.ref(),r=e.ref(),i=e.computed(()=>{switch(t.position){case"top":return 10;case"middle":return 50;case"bottom":return 85}}),a=e.computed(()=>({position:"absolute",borderRadius:"10px",backgroundColor:"rgba(0, 0, 0, 0.8)",padding:"14px 19px",top:`calc(${i.value}% - ${r.value}px)`,left:`calc(50% - ${l.value}px)`})),u=e.computed(()=>({width:"fit-content",display:"flex",justifyContent:"center",alignItems:"center",color:"white",fontSize:"14px"}));return e.nextTick(()=>{l.value=o.value.offsetWidth/2,r.value=o.value.offsetHeight/2}),(y,h)=>(e.openBlock(),e.createElementBlock("div",{id:"toastWrapper",ref_key:"toastWrapper",ref:o,class:"toastWrapper",style:e.normalizeStyle([e.unref(a),{zIndex:9999}])},[e.createElementVNode("div",{style:e.normalizeStyle(e.unref(u))},[e.createElementVNode("span",null,e.toDisplayString(n.message),1)],4)],4))}}),dt="",Ge=Y(Ye,[["__scopeId","data-v-15ab4094"]]),Te={message:"\u61D2\u732B\u4E91 Yes!!!",position:"middle",duration:1500};class Xe{options;container;constructor(t){this.options=t,this.container=document.createElement("div")}present(){const t=e.h(e.h(Ge),{...Te,...this.options});e.render(t,this.container),document.body.insertBefore(this.container,document.body.firstChild);const o=this.options.duration||Te.duration;setTimeout(()=>{this.dismiss()},o)}dismiss(){if(this.container){const t=this.container.querySelector("#toastWrapper");t.style.opacity="0",t.style.transition="opacity 0.4s ease-in",setTimeout(()=>{this.container&&(e.render(null,this.container),document.body.removeChild(this.container))},500)}}}const Je=["xlink:href","fill","color"],Ze=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(r,i)=>(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,Je)],4))}});function et(n){const{containerEl:t,sliderEl:o,autoHeight:l,performance:r={},maxHeightRatio:i=.9}=n,a=e.ref(!0),u=me(F,100);let y,h="";const p=e.ref(0),d=e.ref(0),c=e.ref(0),s=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),_=e.ref({clientHeight:0}),w=e.computed(()=>!!d.value),g=e.computed(()=>s.value.scrollHeight>s.value.clientHeight),b=e.computed(()=>s.value.clientHeight-_.value.clientHeight),B=e.computed(()=>s.value.scrollHeight-s.value.clientHeight),L=e.computed(()=>Math.max(s.value.clientHeight/s.value.scrollHeight,.05)),U=e.computed(()=>L.value>i?0:L.value*s.value.clientHeight),j=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${c.value}px,0)`,height:l?`${U.value}px`:void 0}));function $(O){P(),d.value=O.clientY-o.value.getBoundingClientRect().top||1,h=getComputedStyle(t.value).scrollBehavior,h==="smooth"&&(t.value.style.scrollBehavior="unset")}function A(){t.value.style.scrollBehavior=h,d.value=0,u()}function P(){a.value=!1}function F(){w.value||(a.value=!0)}function k(O){if(!w.value)return;let x=O.clientY-s.value.top-d.value;x<0?c.value=0:x>=b.value?c.value=b.value:c.value=x,t.value.scrollTo({top:c.value/b.value*B.value})}function I(){w.value||z()}function z(){cancelAnimationFrame(y),y=requestAnimationFrame(q)}function q(){t.value&&(p.value=r.scrollTop?.value??t.value.scrollTop,c.value=p.value/B.value*b.value)}function V(O){let x="addEventListener";O==="add"?x="addEventListener":x="removeEventListener",o.value?.[x]("pointerdown",$,{passive:!0}),window[x]("pointermove",k,{passive:!0}),window[x]("pointerup",A,{passive:!0})}const K=new MutationObserver(O=>{O.map(N=>N.oldValue).join().includes("height")&&m()});function m(){s.value.top=t.value?.getBoundingClientRect().top??0,s.value.scrollHeight=t.value?.scrollHeight??0,s.value.clientHeight=t.value?.clientHeight??0}function S(){P(),setTimeout(()=>{_.value.clientHeight=o.value?.clientHeight??0,F()},150)}function R(O,x,N="dynamic-styles"){let M=document.getElementById(N);M||(M=document.createElement("style"),M.id=N,document.head.appendChild(M));const G=M.sheet.cssRules,X=G.length,f=`${O} { ${x} }`;for(let v=0;v<X;v++){const C=G[v];if(C.selectorText===O&&C.style.cssText===x)return}M.sheet.insertRule(f,X)}function D(){t.value&&o.value?(R(".hide-scrollbar","scrollbar-width: none; -ms-overflow-style: none;"),R(".hide-scrollbar::-webkit-scrollbar","display: none"),t.value.classList.add("hide-scrollbar"),t.value.addEventListener("scroll",I,{passive:!0}),V("add"),K.observe(t.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{m()},100),S()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:t,sliderEl:o})}return e.watch(p,()=>{P(),u()}),{isScrollEnd:a,isDragSlider:w,offsetTop:c,scrollTop:p,scrollable:g,sliderPos:j,init:D,modifySliderEventListener:V}}const tt=(n=>(e.pushScopeId("data-v-edec7292"),n=n(),e.popScopeId(),n))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),nt=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,r=e.ref(null),i=e.computed(()=>o.containerEl),a=et({containerEl:i,sliderEl:r,autoHeight:l?o.autoHeight:!0,performance:o.performance}),{scrollable:u,isScrollEnd:y,sliderPos:h}=a,p=e.ref(!1),d=o.autoHide?e.computed(()=>p.value||!y.value):e.computed(()=>u.value);e.onMounted(()=>{e.nextTick(()=>{a.init()})}),e.onUnmounted(()=>{a.modifySliderEventListener("remove")});function c(){p.value=!0}function s(){p.value=!1}return t({uScrollBarReturn:a}),(_,w)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"sliderRef",ref:r,class:"slider-wrapper",onMouseenter:c,onMouseleave:s,style:e.normalizeStyle(e.unref(h))},[e.renderSlot(_.$slots,"default",{},()=>[tt],!0)],36),[[e.vShow,e.unref(d)]])]),_:3}))}}),pt="",ot=Y(nt,[["__scopeId","data-v-edec7292"]]),lt={class:"virtualListWrapper"},rt={inheritAttrs:!1},at=e.defineComponent({...rt,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},emits:["scrollEnd"],setup(n,{expose:t,emit:o}){const l=n,r=_e(e.toRef(l,"data"),{itemHeight:p=>l.itemHeight(l.data[p]),overscan:l.overscan,scrollEndHook:()=>{o("scrollEnd")}}),{list:i,containerProps:a,wrapperProps:u,innerProps:y,getItemHeightData:h}=r;return t({vListReturn:r}),(p,d)=>(e.openBlock(),e.createElementBlock("div",lt,[e.createElementVNode("div",e.mergeProps({onScrollPassive:d[0]||(d[0]=(...c)=>e.unref(a).onScroll&&e.unref(a).onScroll(...c)),ref:e.unref(a).ref,class:"virtualList"},p.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(u))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(y))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i),({index:c,data:s})=>(e.openBlock(),e.createElementBlock("div",{key:c,style:e.normalizeStyle({height:`${e.unref(h)(c).height}px`,display:"flex"})},[e.renderSlot(p.$slots,"default",{data:s,index:c},void 0,!0)],4))),128))],16)],16)],16)]))}}),ht="",it=Y(at,[["__scopeId","data-v-4ba97cce"]]);E.ScrollBar=ot,E.SvgIcon=Ze,E.ToastCreator=Xe,E.VirtualList=it,E.allSelectedKey=oe,E.closeDialogKey=we,E.dialogController=Qe,E.isAllSelectedKey=ie,E.isSelectedKey=ne,E.selectAllKey=re,E.selectKey=le,E.toggleAllKey=ee,E.toggleKey=te,E.unselectAllKey=se,E.unselectKey=ae,E.useDragSelect=ue,E.useDragSelectByMobile=We,E.useDragSelectByPc=Ne,E.useSelectable=Ke,E.useSelectableInjectors=ze,E.useVirtualList=_e,Object.defineProperties(E,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|