@lazycatcloud/lzc-toolkit 0.0.55 → 0.0.58

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 CHANGED
@@ -565,12 +565,12 @@ const Ot = Symbol(), Dt = /* @__PURE__ */ Z({
565
565
  t.visiable ? (W(), J("div", {
566
566
  key: 0,
567
567
  onClick: l,
568
- class: "modal"
568
+ class: "lzc-modal"
569
569
  }, [
570
570
  F("div", {
571
571
  onClick: a[0] || (a[0] = Ye(() => {
572
572
  }, ["stop"])),
573
- class: Ge(["dialog", t.dialogClass])
573
+ class: Ge(["lzc-dialog", t.dialogClass])
574
574
  }, [
575
575
  he(o.$slots, "default", {}, void 0, !0)
576
576
  ], 2)
@@ -585,7 +585,7 @@ const ue = (t, e) => {
585
585
  for (const [l, o] of e)
586
586
  n[l] = o;
587
587
  return n;
588
- }, Rt = /* @__PURE__ */ ue(Dt, [["__scopeId", "data-v-415900d3"]]);
588
+ }, Rt = /* @__PURE__ */ ue(Dt, [["__scopeId", "data-v-e171c24d"]]);
589
589
  function jt(t) {
590
590
  function e(n, l) {
591
591
  const o = document.createElement("div"), a = {
@@ -803,7 +803,7 @@ function Lt(t) {
803
803
  e.value && n.value ? (I(
804
804
  ".hide-scrollbar",
805
805
  "scrollbar-width: none; -ms-overflow-style: none;"
806
- ), I(".hide-scrollbar::-webkit-scrollbar", "display: none"), e.value.addEventListener("scroll", L, {
806
+ ), I(".hide-scrollbar::-webkit-scrollbar", "display: none"), e.value.classList.add("hide-scrollbar"), e.value.addEventListener("scroll", L, {
807
807
  passive: !0
808
808
  }), j("add"), Y.observe(e.value, {
809
809
  subtree: !0,
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,He=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,Pe=(n,t)=>{var o={};for(var l in n)He.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&&Ae.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:b}={sum:0,height:0};return p.value.map((R,D)=>(typeof l=="number"?b=l:b=l(D),m+=b,{height:b,sum:m}))}),g=e.computed(()=>$(c.value.start)),S=e.computed(()=>typeof l=="number"?w.value.length*l:w.value[w.value.length-1]?.sum||0),C=e.computed(()=>{let m=_.value.length-r,b=Math.max(m-s,0);return _.value.slice(b,m)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(h)),e.watch([a.width,a.height,p],([m,b])=>{(m||b)&&j()},{deep:!0}),e.watch(d,()=>{V(),y()});function V(){u.value=!1}function U(){u.value=!0,o?.()}function j(){cancelAnimationFrame(h),h=requestAnimationFrame(M)}function M(){if(i.value){d.value=i.value.scrollTop,s=A();let m=L(d.value),b=m+s+r;m=m-r,m=m<0?0:m,b=b>p.value.length?p.value.length:b,c.value={start:m,end:b},_.value=p.value.slice(m,b).map((R,D)=>({data:R,index:D+m}))}}function L(m){let b=0,R=w.value.length-1,D=-1;for(;b<=R;){const B=Math.floor((b+R)/2);w.value[B].sum>=m?(D=B,R=B-1):b=B+1}return Math.max(0,D)}function A(){let m=0,b=0,R=I();for(let D=R;D<w.value.length&&(m++,b+=w.value[D].height,!(b>=a.height.value));D++);return m}function $(m){if(typeof l=="number")return m*l;let b=w.value[m];return b?b.sum-b.height:0}function F(m){return w.value[m]||{sum:0,height:0}}function I(){let m=c.value.start;return m>=r&&(m+=r),m}function K(m){if(i.value){const b=F(m);i.value.scrollTop=b.sum-b.height,M()}}const q=e.computed(()=>({style:{width:"100%",height:`${S.value}px`,pointerEvents:u.value?void 0:"none"}})),k=e.computed(()=>({style:{transform:`translate3d(0, ${g.value}px, 0)`,"will-change":"transform"}})),N={overflowY:"auto"};return{list:_,visiableList:C,getItemHeightData:F,getoffsetTopIndex:L,totalHeight:S,clientHeight:a.height,scrollTo:K,scrollTop:d,isScrollEnd:u,containerProps:{ref:i,onScroll:()=>{j()},style:N},wrapperProps:q,innerProps:k}}const ee=Symbol(),te=Symbol(),ne=Symbol(),oe=Symbol(),le=Symbol(),re=Symbol(),ae=Symbol(),ie=Symbol(),se=Symbol();function Ke(){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 Ne(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"?P: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({}),S=e.ref({top:0,height:0,sync(f=!1){S.value.top=d.value?.scrollTop||0,f&&(S.value.height=d.value?.scrollHeight||0)}}),C=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:V=50,startSpeed:U=30,maxSpeed:j=30}=o;let M;const L=V,A=U,$=j,F=f=>f**1;let I=0;function K(f){if(cancelAnimationFrame(M),I=q(f),I=Math.max(Math.min(I,$),-$),I!==0){const v=d.value;if(!v||!c.value)return;const O=S.value.height-g.value.height;let T=S.value.top+Number(I);T=Math.min(Math.max(0,T),O),v.scrollTop=T,N(),M=requestAnimationFrame(()=>K(f))}}function q(f){if(d.value){const O=g.value,T=O.bottom-f;if(T<L)return A*F(1-T/L);const H=f-O.top;if(H<L)return-A*F(1-H/L)}return 0}function k(f){const v={...C.value,right:0,bottom:0};return v.left+=g.value.left,v.top+=g.value.top-S.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 N(){S.value.sync();const{top:f,height:v}=S.value;_.value.y=Math.min(v+g.value.top,_.value.y+f-_.value.scrollTop),_.value.scrollTop=f}function m(f,v,O="dynamic-styles"){let T=document.getElementById(O);T||(T=document.createElement("style"),T.id=O,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 b(f,v){p.value=!0,c.value=!0,S.value.height?S.value.sync():S.value.sync(!0),s.value.x=f,s.value.y=v+S.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,O){!c.value||(p.value&&t==="colum"&&!x()&&(a(),p.value=!1),O?.(),K(v),_.value.x=Math.max(f,g.value.left),_.value.y=Math.min(v+S.value.top,S.value.height+g.value.top),_.value.scrollTop=S.value.top,y.value())}function D(){c.value=!1,d.value?.classList.remove("disable-scroll-behavior")}function B(){!c.value||(I||N(),y.value())}function x(){if(!c.value)return!1;const{width:f,height:v}=C.value;return!(Math.max(f,v)>5)}function z(){x()&&a()}function P(){x()||d.value?.querySelectorAll(`[${n}]`).forEach(f=>{u[`${n}`]=f.getAttribute(`${n}`),k(f.getBoundingClientRect())?r([u]):i([u])})}function G(){const f=[];let v=null,O=0;d.value?.querySelectorAll(`[${n}]`).forEach((T,H)=>{const W=T.getAttribute(`${n}`);f.push(W),k(T.getBoundingClientRect())?(v===null&&(v=H),v=Math.min(v,H),O=Math.max(O,H)):(u[`${n}`]=W,h.has(W)&&i([u]))});for(let T=v;T<O+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:b,dragMove:R,dragEnd:D,onScroll:B,isSingleClick:x,cancelSelectAllBySingleClick:z,selectFn:y,selectRange:C,isPressing:c,containerEl:d,observer:w}}function ze(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(C=>C?.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(S){console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25",S)}}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(),h=setTimeout(()=>{const{clientX:S,clientY:C}=g.targetTouches[0];a(S,C),t?.(),u(S,C,()=>g.preventDefault()),g.preventDefault()},o)}function c(g){p();const{clientX:S,clientY:C}=g.targetTouches[0];u(S,C,()=>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(S){console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25",S)}}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:"modal"},[e.createElementVNode("div",{onClick:i[0]||(i[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["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-415900d3"]]);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($,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),S=e.computed(()=>s.value.clientHeight-_.value.clientHeight),C=e.computed(()=>s.value.scrollHeight-s.value.clientHeight),V=e.computed(()=>Math.max(s.value.clientHeight/s.value.scrollHeight,.05)),U=e.computed(()=>V.value>i?0:V.value*s.value.clientHeight),j=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${c.value}px,0)`,height:l?`${U.value}px`:void 0}));function M(B){A(),d.value=B.clientY-o.value.getBoundingClientRect().top||1,h=getComputedStyle(t.value).scrollBehavior,h==="smooth"&&(t.value.style.scrollBehavior="unset")}function L(){t.value.style.scrollBehavior=h,d.value=0,u()}function A(){a.value=!1}function $(){w.value||(a.value=!0)}function F(B){if(!w.value)return;let x=B.clientY-s.value.top-d.value;x<0?c.value=0:x>=S.value?c.value=S.value:c.value=x,t.value.scrollTo({top:c.value/S.value*C.value})}function I(){w.value||K()}function K(){cancelAnimationFrame(y),y=requestAnimationFrame(q)}function q(){t.value&&(p.value=r.scrollTop?.value??t.value.scrollTop,c.value=p.value/C.value*S.value)}function k(B){let x="addEventListener";B==="add"?x="addEventListener":x="removeEventListener",o.value?.[x]("pointerdown",M,{passive:!0}),window[x]("pointermove",F,{passive:!0}),window[x]("pointerup",L,{passive:!0})}const N=new MutationObserver(B=>{B.map(z=>z.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 b(){A(),setTimeout(()=>{_.value.clientHeight=o.value?.clientHeight??0,$()},150)}function R(B,x,z="dynamic-styles"){let P=document.getElementById(z);P||(P=document.createElement("style"),P.id=z,document.head.appendChild(P));const G=P.sheet.cssRules,X=G.length,f=`${B} { ${x} }`;for(let v=0;v<X;v++){const O=G[v];if(O.selectorText===B&&O.style.cssText===x)return}P.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.addEventListener("scroll",I,{passive:!0}),k("add"),N.observe(t.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{m()},100),b()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:t,sliderEl:o})}return e.watch(p,()=>{A(),u()}),{isScrollEnd:a,isDragSlider:w,offsetTop:c,scrollTop:p,scrollable:g,sliderPos:j,init:D,modifySliderEventListener:k}}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=ze,E.useSelectable=Ne,E.useSelectableInjectors=Ke,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,He=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,Pe=(n,t)=>{var o={};for(var l in n)He.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&&Ae.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:b}={sum:0,height:0};return p.value.map((R,D)=>(typeof l=="number"?b=l:b=l(D),m+=b,{height:b,sum:m}))}),g=e.computed(()=>$(c.value.start)),S=e.computed(()=>typeof l=="number"?w.value.length*l:w.value[w.value.length-1]?.sum||0),C=e.computed(()=>{let m=_.value.length-r,b=Math.max(m-s,0);return _.value.slice(b,m)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(h)),e.watch([a.width,a.height,p],([m,b])=>{(m||b)&&j()},{deep:!0}),e.watch(d,()=>{V(),y()});function V(){u.value=!1}function U(){u.value=!0,o?.()}function j(){cancelAnimationFrame(h),h=requestAnimationFrame(M)}function M(){if(i.value){d.value=i.value.scrollTop,s=A();let m=L(d.value),b=m+s+r;m=m-r,m=m<0?0:m,b=b>p.value.length?p.value.length:b,c.value={start:m,end:b},_.value=p.value.slice(m,b).map((R,D)=>({data:R,index:D+m}))}}function L(m){let b=0,R=w.value.length-1,D=-1;for(;b<=R;){const B=Math.floor((b+R)/2);w.value[B].sum>=m?(D=B,R=B-1):b=B+1}return Math.max(0,D)}function A(){let m=0,b=0,R=I();for(let D=R;D<w.value.length&&(m++,b+=w.value[D].height,!(b>=a.height.value));D++);return m}function $(m){if(typeof l=="number")return m*l;let b=w.value[m];return b?b.sum-b.height:0}function F(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 b=F(m);i.value.scrollTop=b.sum-b.height,M()}}const q=e.computed(()=>({style:{width:"100%",height:`${S.value}px`,pointerEvents:u.value?void 0:"none"}})),k=e.computed(()=>({style:{transform:`translate3d(0, ${g.value}px, 0)`,"will-change":"transform"}})),K={overflowY:"auto"};return{list:_,visiableList:C,getItemHeightData:F,getoffsetTopIndex:L,totalHeight:S,clientHeight:a.height,scrollTo:z,scrollTop:d,isScrollEnd:u,containerProps:{ref:i,onScroll:()=>{j()},style:K},wrapperProps:q,innerProps:k}}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"?P: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({}),S=e.ref({top:0,height:0,sync(f=!1){S.value.top=d.value?.scrollTop||0,f&&(S.value.height=d.value?.scrollHeight||0)}}),C=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:V=50,startSpeed:U=30,maxSpeed:j=30}=o;let M;const L=V,A=U,$=j,F=f=>f**1;let I=0;function z(f){if(cancelAnimationFrame(M),I=q(f),I=Math.max(Math.min(I,$),-$),I!==0){const v=d.value;if(!v||!c.value)return;const O=S.value.height-g.value.height;let T=S.value.top+Number(I);T=Math.min(Math.max(0,T),O),v.scrollTop=T,K(),M=requestAnimationFrame(()=>z(f))}}function q(f){if(d.value){const O=g.value,T=O.bottom-f;if(T<L)return A*F(1-T/L);const H=f-O.top;if(H<L)return-A*F(1-H/L)}return 0}function k(f){const v={...C.value,right:0,bottom:0};return v.left+=g.value.left,v.top+=g.value.top-S.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(){S.value.sync();const{top:f,height:v}=S.value;_.value.y=Math.min(v+g.value.top,_.value.y+f-_.value.scrollTop),_.value.scrollTop=f}function m(f,v,O="dynamic-styles"){let T=document.getElementById(O);T||(T=document.createElement("style"),T.id=O,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 b(f,v){p.value=!0,c.value=!0,S.value.height?S.value.sync():S.value.sync(!0),s.value.x=f,s.value.y=v+S.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,O){!c.value||(p.value&&t==="colum"&&!x()&&(a(),p.value=!1),O?.(),z(v),_.value.x=Math.max(f,g.value.left),_.value.y=Math.min(v+S.value.top,S.value.height+g.value.top),_.value.scrollTop=S.value.top,y.value())}function D(){c.value=!1,d.value?.classList.remove("disable-scroll-behavior")}function B(){!c.value||(I||K(),y.value())}function x(){if(!c.value)return!1;const{width:f,height:v}=C.value;return!(Math.max(f,v)>5)}function N(){x()&&a()}function P(){x()||d.value?.querySelectorAll(`[${n}]`).forEach(f=>{u[`${n}`]=f.getAttribute(`${n}`),k(f.getBoundingClientRect())?r([u]):i([u])})}function G(){const f=[];let v=null,O=0;d.value?.querySelectorAll(`[${n}]`).forEach((T,H)=>{const W=T.getAttribute(`${n}`);f.push(W),k(T.getBoundingClientRect())?(v===null&&(v=H),v=Math.min(v,H),O=Math.max(O,H)):(u[`${n}`]=W,h.has(W)&&i([u]))});for(let T=v;T<O+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:b,dragMove:R,dragEnd:D,onScroll:B,isSingleClick:x,cancelSelectAllBySingleClick:N,selectFn:y,selectRange:C,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(C=>C?.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(S){console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25",S)}}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(),h=setTimeout(()=>{const{clientX:S,clientY:C}=g.targetTouches[0];a(S,C),t?.(),u(S,C,()=>g.preventDefault()),g.preventDefault()},o)}function c(g){p();const{clientX:S,clientY:C}=g.targetTouches[0];u(S,C,()=>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(S){console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25",S)}}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($,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),S=e.computed(()=>s.value.clientHeight-_.value.clientHeight),C=e.computed(()=>s.value.scrollHeight-s.value.clientHeight),V=e.computed(()=>Math.max(s.value.clientHeight/s.value.scrollHeight,.05)),U=e.computed(()=>V.value>i?0:V.value*s.value.clientHeight),j=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${c.value}px,0)`,height:l?`${U.value}px`:void 0}));function M(B){A(),d.value=B.clientY-o.value.getBoundingClientRect().top||1,h=getComputedStyle(t.value).scrollBehavior,h==="smooth"&&(t.value.style.scrollBehavior="unset")}function L(){t.value.style.scrollBehavior=h,d.value=0,u()}function A(){a.value=!1}function $(){w.value||(a.value=!0)}function F(B){if(!w.value)return;let x=B.clientY-s.value.top-d.value;x<0?c.value=0:x>=S.value?c.value=S.value:c.value=x,t.value.scrollTo({top:c.value/S.value*C.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/C.value*S.value)}function k(B){let x="addEventListener";B==="add"?x="addEventListener":x="removeEventListener",o.value?.[x]("pointerdown",M,{passive:!0}),window[x]("pointermove",F,{passive:!0}),window[x]("pointerup",L,{passive:!0})}const K=new MutationObserver(B=>{B.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 b(){A(),setTimeout(()=>{_.value.clientHeight=o.value?.clientHeight??0,$()},150)}function R(B,x,N="dynamic-styles"){let P=document.getElementById(N);P||(P=document.createElement("style"),P.id=N,document.head.appendChild(P));const G=P.sheet.cssRules,X=G.length,f=`${B} { ${x} }`;for(let v=0;v<X;v++){const O=G[v];if(O.selectorText===B&&O.style.cssText===x)return}P.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}),k("add"),K.observe(t.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{m()},100),b()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:t,sliderEl:o})}return e.watch(p,()=>{A(),u()}),{isScrollEnd:a,isDragSlider:w,offsetTop:c,scrollTop:p,scrollable:g,sliderPos:j,init:D,modifySliderEventListener:k}}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"}})});
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .modal[data-v-415900d3]{position:absolute;inset:0;display:flex;z-index:999;background-color:#1c191780}.dialog[data-v-415900d3]{margin:auto;display:flex;flex-direction:column}@keyframes slide-15ab4094{0%{opacity:1}to{opacity:0}}.animate-toastAnimation[data-v-15ab4094]{animation:slide-15ab4094 .3s linear}.v-leave-active[data-v-edec7292]{transition:all .15s ease-out;transition-delay:.9s}.v-leave-to[data-v-edec7292]{opacity:0}.slider-wrapper[data-v-edec7292]{z-index:100;position:absolute;right:0;touch-action:none}.default-slider[data-v-edec7292]{width:6px;height:100%;background-color:#0003;border-radius:3px;margin-right:3px}.virtualList[data-v-4ba97cce]{width:100%;height:100%;position:absolute;overflow-y:auto;scroll-behavior:smooth;user-select:none}.virtualListWrapper[data-v-4ba97cce]{width:100%;height:100%;position:relative}
1
+ .lzc-modal[data-v-e171c24d]{position:absolute;inset:0;display:flex;z-index:999;background-color:#1c191780}.lzc-dialog[data-v-e171c24d]{margin:auto;display:flex;flex-direction:column}@keyframes slide-15ab4094{0%{opacity:1}to{opacity:0}}.animate-toastAnimation[data-v-15ab4094]{animation:slide-15ab4094 .3s linear}.v-leave-active[data-v-edec7292]{transition:all .15s ease-out;transition-delay:.9s}.v-leave-to[data-v-edec7292]{opacity:0}.slider-wrapper[data-v-edec7292]{z-index:100;position:absolute;right:0;touch-action:none}.default-slider[data-v-edec7292]{width:6px;height:100%;background-color:#0003;border-radius:3px;margin-right:3px}.virtualList[data-v-4ba97cce]{width:100%;height:100%;position:absolute;overflow-y:auto;scroll-behavior:smooth;user-select:none}.virtualListWrapper[data-v-4ba97cce]{width:100%;height:100%;position:relative}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazycatcloud/lzc-toolkit",
3
- "version": "0.0.55",
3
+ "version": "0.0.58",
4
4
  "description": "lazycat ui toolkits",
5
5
  "main": "./dist/index.umd.js",
6
6
  "module": "./dist/index.es.js",
@@ -17,7 +17,9 @@
17
17
  "build": "vite build && vue-tsc --emitDeclarationOnly && mv dist/src dist/types",
18
18
  "test": "echo \"Error: no test specified\" && exit 1",
19
19
  "typecheck": "vue-tsc --noEmit",
20
- "prepublishOnly": "npm run build"
20
+ "patch": "npm version patch",
21
+ "prepublishOnly": "run-p build patch",
22
+ "postpublish": "npx npm-mirror-sync"
21
23
  },
22
24
  "author": "",
23
25
  "license": "ISC",
@@ -25,6 +27,8 @@
25
27
  "@vueuse/core": "^9.2.0"
26
28
  },
27
29
  "devDependencies": {
30
+ "npm-run-all": "^4.1.5",
31
+ "npm-mirror-sync": "^1.0.0",
28
32
  "@types/node": "^18.11.9",
29
33
  "@vitejs/plugin-vue": "^3.1.0",
30
34
  "typescript": "^4.8.3",