@lazycatcloud/lzc-toolkit 0.0.3 → 0.0.5
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 +3 -2
- package/dist/index.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -325,7 +325,8 @@ const je = /* @__PURE__ */ D({
|
|
|
325
325
|
(S(!0), I(ve, null, pe(y(n), ({ index: a, data: c }) => (S(), I("div", {
|
|
326
326
|
key: a,
|
|
327
327
|
style: H({
|
|
328
|
-
height: `${e.itemHeight(c)}px
|
|
328
|
+
height: `${e.itemHeight(c)}px`,
|
|
329
|
+
display: "flex"
|
|
329
330
|
})
|
|
330
331
|
}, [
|
|
331
332
|
U(l.$slots, "default", {
|
|
@@ -343,7 +344,7 @@ const Fe = (e, t) => {
|
|
|
343
344
|
for (const [o, r] of t)
|
|
344
345
|
n[o] = r;
|
|
345
346
|
return n;
|
|
346
|
-
}, We = /* @__PURE__ */ Fe(je, [["__scopeId", "data-v-
|
|
347
|
+
}, We = /* @__PURE__ */ Fe(je, [["__scopeId", "data-v-b9b7f6cb"]]);
|
|
347
348
|
export {
|
|
348
349
|
Me as DialogController,
|
|
349
350
|
We as VirtualList,
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(u,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(u=typeof globalThis<"u"?globalThis:u||self,e(u.ui={},u.Vue))})(this,function(u,e){"use strict";var P;const v=typeof window<"u";v&&((P=window?.navigator)==null?void 0:P.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function D(t){return typeof t=="function"?t():e.unref(t)}function M(t){return t}function F(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function U(t,n=!0){e.getCurrentInstance()?e.onMounted(t):n?t():e.nextTick(t)}function C(t){var n;const o=D(t);return(n=o?.$el)!=null?n:o}const W=v?window:void 0;v&&window.document,v&&window.navigator,v&&window.location;function q(t,n=!1){const o=e.ref(),l=()=>o.value=Boolean(t());return l(),U(l,n),o}const O=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},S="__vueuse_ssr_handlers__";O[S]=O[S]||{},O[S];var I=Object.getOwnPropertySymbols,G=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable,J=(t,n)=>{var o={};for(var l in t)G.call(t,l)&&n.indexOf(l)<0&&(o[l]=t[l]);if(t!=null&&I)for(var l of I(t))n.indexOf(l)<0&&Y.call(t,l)&&(o[l]=t[l]);return o};function X(t,n,o={}){const l=o,{window:a=W}=l,s=J(l,["window"]);let r;const c=q(()=>a&&"ResizeObserver"in a),i=()=>{r&&(r.disconnect(),r=void 0)},f=e.watch(()=>C(t),w=>{i(),c.value&&a&&w&&(r=new ResizeObserver(n),r.observe(w,s))},{immediate:!0,flush:"post"}),_=()=>{i(),f()};return F(_),{isSupported:c,stop:_}}function Z(t,n={width:0,height:0},o={}){const{box:l="content-box"}=o,a=e.ref(n.width),s=e.ref(n.height);return X(t,([r])=>{const c=l==="border-box"?r.borderBoxSize:l==="content-box"?r.contentBoxSize:r.devicePixelContentBoxSize;c?(a.value=c.reduce((i,{inlineSize:f})=>i+f,0),s.value=c.reduce((i,{blockSize:f})=>i+f,0)):(a.value=r.contentRect.width,s.value=r.contentRect.height)},o),e.watch(()=>C(t),r=>{a.value=r?n.width:0,s.value=r?n.height:0}),{width:a,height:s}}var E;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(E||(E={}));var ee=Object.defineProperty,B=Object.getOwnPropertySymbols,te=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable,T=(t,n,o)=>n in t?ee(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,oe=(t,n)=>{for(var o in n||(n={}))te.call(n,o)&&T(t,o,n[o]);if(B)for(var o of B(n))ne.call(n,o)&&T(t,o,n[o]);return t};oe({linear:M},{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 K(t,n){const o=e.ref(),l=Z(o),a=e.ref([]),s=e.ref(0),r=e.shallowRef(t),c=e.ref({start:0,end:10}),{itemHeight:i,overscan:f=5}=n,_=d=>{const{start:y=0}=c.value;let m=0,g=0;for(let b=y;b<r.value.length;b++)if(m+=i(b),m>=d){g=b;break}return g-y},w=d=>{let y=0,m=0;for(let g=0;g<r.value.length;g++)if(y+=i(g),y>=d){m=g;break}return m};let p;const h=()=>{cancelAnimationFrame(p),p=requestAnimationFrame(L)},L=()=>{const d=o.value;if(d){const y=w(d.scrollTop),m=_(d.clientHeight),g=y-f,b=y+m+f;c.value={start:g<0?0:g,end:b>r.value.length?r.value.length:b},a.value=r.value.slice(c.value.start,c.value.end).map((Q,me)=>({data:Q,index:me+c.value.start}))}};e.onMounted(()=>{}),e.onUnmounted(()=>{cancelAnimationFrame(p)}),e.watch([l.width,l.height,r],()=>{h()},{deep:!0});const j=e.computed(()=>typeof i=="number"?r.value.length*i:r.value.reduce((d,y,m)=>d+i(m),0)),ce=d=>typeof i=="number"?d*i:r.value.slice(0,d).reduce((m,g,b)=>m+i(b),0),ue=d=>{o.value&&(o.value.scrollTop=d,L())},de=e.computed(()=>ce(c.value.start)),fe=e.computed(()=>({style:{width:"100%",height:`${j.value}px`}})),pe=e.computed(()=>({style:{transform:`translate3d(0, ${de.value}px, 0)`,"will-change":"transform"}})),he={overflowY:"auto"};return{list:a,totalHeight:j,clientHeight:l.height,scrollTo:ue,scrollTop:s,containerProps:{ref:o,onScroll:d=>{d.target&&(s.value=d.target.scrollTop),h()},style:he},wrapperProps:fe,innerProps:pe}}const A=Symbol(),k=Symbol(),
|
|
1
|
+
(function(u,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(u=typeof globalThis<"u"?globalThis:u||self,e(u.ui={},u.Vue))})(this,function(u,e){"use strict";var P;const v=typeof window<"u";v&&((P=window?.navigator)==null?void 0:P.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function D(t){return typeof t=="function"?t():e.unref(t)}function M(t){return t}function F(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function U(t,n=!0){e.getCurrentInstance()?e.onMounted(t):n?t():e.nextTick(t)}function C(t){var n;const o=D(t);return(n=o?.$el)!=null?n:o}const W=v?window:void 0;v&&window.document,v&&window.navigator,v&&window.location;function q(t,n=!1){const o=e.ref(),l=()=>o.value=Boolean(t());return l(),U(l,n),o}const O=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},S="__vueuse_ssr_handlers__";O[S]=O[S]||{},O[S];var I=Object.getOwnPropertySymbols,G=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable,J=(t,n)=>{var o={};for(var l in t)G.call(t,l)&&n.indexOf(l)<0&&(o[l]=t[l]);if(t!=null&&I)for(var l of I(t))n.indexOf(l)<0&&Y.call(t,l)&&(o[l]=t[l]);return o};function X(t,n,o={}){const l=o,{window:a=W}=l,s=J(l,["window"]);let r;const c=q(()=>a&&"ResizeObserver"in a),i=()=>{r&&(r.disconnect(),r=void 0)},f=e.watch(()=>C(t),w=>{i(),c.value&&a&&w&&(r=new ResizeObserver(n),r.observe(w,s))},{immediate:!0,flush:"post"}),_=()=>{i(),f()};return F(_),{isSupported:c,stop:_}}function Z(t,n={width:0,height:0},o={}){const{box:l="content-box"}=o,a=e.ref(n.width),s=e.ref(n.height);return X(t,([r])=>{const c=l==="border-box"?r.borderBoxSize:l==="content-box"?r.contentBoxSize:r.devicePixelContentBoxSize;c?(a.value=c.reduce((i,{inlineSize:f})=>i+f,0),s.value=c.reduce((i,{blockSize:f})=>i+f,0)):(a.value=r.contentRect.width,s.value=r.contentRect.height)},o),e.watch(()=>C(t),r=>{a.value=r?n.width:0,s.value=r?n.height:0}),{width:a,height:s}}var E;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(E||(E={}));var ee=Object.defineProperty,B=Object.getOwnPropertySymbols,te=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable,T=(t,n,o)=>n in t?ee(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,oe=(t,n)=>{for(var o in n||(n={}))te.call(n,o)&&T(t,o,n[o]);if(B)for(var o of B(n))ne.call(n,o)&&T(t,o,n[o]);return t};oe({linear:M},{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 K(t,n){const o=e.ref(),l=Z(o),a=e.ref([]),s=e.ref(0),r=e.shallowRef(t),c=e.ref({start:0,end:10}),{itemHeight:i,overscan:f=5}=n,_=d=>{const{start:y=0}=c.value;let m=0,g=0;for(let b=y;b<r.value.length;b++)if(m+=i(b),m>=d){g=b;break}return g-y},w=d=>{let y=0,m=0;for(let g=0;g<r.value.length;g++)if(y+=i(g),y>=d){m=g;break}return m};let p;const h=()=>{cancelAnimationFrame(p),p=requestAnimationFrame(L)},L=()=>{const d=o.value;if(d){const y=w(d.scrollTop),m=_(d.clientHeight),g=y-f,b=y+m+f;c.value={start:g<0?0:g,end:b>r.value.length?r.value.length:b},a.value=r.value.slice(c.value.start,c.value.end).map((Q,me)=>({data:Q,index:me+c.value.start}))}};e.onMounted(()=>{}),e.onUnmounted(()=>{cancelAnimationFrame(p)}),e.watch([l.width,l.height,r],()=>{h()},{deep:!0});const j=e.computed(()=>typeof i=="number"?r.value.length*i:r.value.reduce((d,y,m)=>d+i(m),0)),ce=d=>typeof i=="number"?d*i:r.value.slice(0,d).reduce((m,g,b)=>m+i(b),0),ue=d=>{o.value&&(o.value.scrollTop=d,L())},de=e.computed(()=>ce(c.value.start)),fe=e.computed(()=>({style:{width:"100%",height:`${j.value}px`}})),pe=e.computed(()=>({style:{transform:`translate3d(0, ${de.value}px, 0)`,"will-change":"transform"}})),he={overflowY:"auto"};return{list:a,totalHeight:j,clientHeight:l.height,scrollTo:ue,scrollTop:s,containerProps:{ref:o,onScroll:d=>{d.target&&(s.value=d.target.scrollTop),h()},style:he},wrapperProps:fe,innerProps:pe}}const A=Symbol(),k=Symbol(),x=Symbol(),V=Symbol(),R=Symbol(),N=Symbol(),z=Symbol(),$=Symbol();function le(t,n){const o=e.ref({}),l=e.computed(()=>t.value.filter(p=>o.value[p[n]])),a=e.computed(()=>Object.keys(o.value).length==t.value.length);function s(){t.value.forEach(p=>{o.value[p[n]]=!0})}function r(){o.value={}}function c(p){p.forEach(h=>{o.value[h[n]]||(o.value[h[n]]=!0)})}function i(p){p.forEach(h=>{o.value[h[n]]&&delete o.value[h[n]]})}function f(p){return!!o.value[p[n]]}function _(p){p.forEach(h=>{f(h)?delete o.value[h[n]]:o.value[h[n]]=!0})}function w(){a.value?r():s()}return e.provide(A,w),e.provide(k,_),e.provide(x,f),e.provide(V,l),e.provide(R,c),e.provide(N,i),e.provide(z,a),e.provide($,r),{selected:l,select:c,selectAll:s,unselect:i,unselectAll:r,toggle:_,toggleAll:w,isSelected:f,isAllSelected:a}}const H=Symbol(),re=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0}},emits:["update:show"],setup(t,{emit:n}){const o=t,l=()=>{o.closeOnClickOverlay&&n("update:show",!1)};return e.provide(H,()=>n("update:show",!1)),(a,s)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[t.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:l,class:"modal absolute inset-0 bottom-0 z-50 flex bg-stone-900 bg-opacity-50"},[e.createElementVNode("div",{onClick:s[0]||(s[0]=e.withModifiers(()=>{},["stop"])),class:"dialog m-auto flex flex-col"},[e.renderSlot(a.$slots,"default")])])):e.createCommentVNode("",!0)]),_:3}))}});function ae(){let t=null;const n=e.ref({});function o(a,s,r=!0){return n.value[a]?(n.value[a].visiable=r,!0):(n.value[a]={visiable:r,componentProps:s},!1)}function l(a){const s=a.component.name;if(!o(s,a.componentProps||{})){const r={setup(){return()=>e.h(re,{visiable:n.value[s].visiable,"onUpdate:show":c=>{n.value[s].visiable=c}},{default:()=>e.h(a.component,n.value[s].componentProps)})}};t||(t=document.createElement("div"),t.setAttribute("id","dialog"),document.body.appendChild(t)),e.render(e.createVNode(r),t)}return{close:()=>n.value[s].visiable=!1}}return e.onUnmounted(()=>{t&&document.body.removeChild(t)}),{create:l}}const se=e.defineComponent({__name:"VirtualList",props:{data:null,itemHeight:null},setup(t){const n=t,{list:o,containerProps:l,wrapperProps:a,innerProps:s}=K(e.toRef(n,"data"),{itemHeight:r=>n.itemHeight(0),overscan:10});return(r,c)=>(e.openBlock(),e.createElementBlock("div",{ref:e.unref(l).ref,onScrollPassive:c[0]||(c[0]=(...i)=>e.unref(l).onScroll&&e.unref(l).onScroll(...i)),class:"hiddenScorllBar-firefox hiddenScorllBar h-full overflow-hidden",style:e.normalizeStyle(e.unref(l).style)},[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(a))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(s))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(o),({index:i,data:f})=>(e.openBlock(),e.createElementBlock("div",{key:i,style:e.normalizeStyle({height:`${t.itemHeight(f)}px`,display:"flex"})},[e.renderSlot(r.$slots,"default",{data:f,index:i},void 0,!0)],4))),128))],16)],16)],36))}}),ye="",ie=((t,n)=>{const o=t.__vccOpts||t;for(const[l,a]of n)o[l]=a;return o})(se,[["__scopeId","data-v-b9b7f6cb"]]);u.DialogController=ae,u.VirtualList=ie,u.allSelectedKey=V,u.closeDialogKey=H,u.isAllSelectedKey=z,u.isSelectedKey=x,u.selectKey=R,u.toggleAllKey=A,u.toggleKey=k,u.unselectAllKey=$,u.unselectKey=N,u.useSelectable=le,u.useVirtualList=K,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.hiddenScorllBar[data-v-
|
|
1
|
+
.hiddenScorllBar[data-v-b9b7f6cb]::-webkit-scrollbar{display:none}.hiddenScorllBar-firefox[data-v-b9b7f6cb]{-ms-overflow-style:none;scrollbar-width:none}.h-full[data-v-b9b7f6cb]{height:100%}.overflow-hidden[data-v-b9b7f6cb]{overflow:hidden}
|