@lazycatcloud/lzc-toolkit 0.0.9 → 0.0.11

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
@@ -1,4 +1,4 @@
1
- import { unref as y, getCurrentScope as ee, onScopeDispose as te, getCurrentInstance as ne, onMounted as j, nextTick as oe, ref as b, watch as T, shallowRef as le, onUnmounted as F, computed as O, provide as m, defineComponent as D, openBlock as S, createBlock as re, Transition as se, withCtx as ae, createElementBlock as I, createElementVNode as x, withModifiers as ie, renderSlot as U, createCommentVNode as ue, render as ce, createVNode as de, h as N, toRef as fe, normalizeStyle as $, normalizeProps as H, guardReactiveProps as K, Fragment as ve, renderList as pe } from "vue";
1
+ import { unref as y, getCurrentScope as ee, onScopeDispose as te, getCurrentInstance as ne, onMounted as j, nextTick as oe, ref as b, watch as T, shallowRef as le, onUnmounted as F, computed as O, provide as m, defineComponent as D, openBlock as S, createBlock as re, Transition as se, withCtx as ae, createElementBlock as I, createElementVNode as x, withModifiers as ie, renderSlot as U, createCommentVNode as ue, render as ce, createVNode as fe, h as N, toRef as de, normalizeStyle as $, normalizeProps as H, guardReactiveProps as K, Fragment as ve, renderList as pe } from "vue";
2
2
  var V;
3
3
  const P = typeof window < "u";
4
4
  P && ((V = window?.navigator) == null ? void 0 : V.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
@@ -126,9 +126,9 @@ function Ae(e, t) {
126
126
  }
127
127
  return v;
128
128
  };
129
- let d;
130
- const f = () => {
131
- cancelAnimationFrame(d), d = requestAnimationFrame(B);
129
+ let f;
130
+ const d = () => {
131
+ cancelAnimationFrame(f), f = requestAnimationFrame(B);
132
132
  }, B = () => {
133
133
  const u = n.value;
134
134
  if (u) {
@@ -144,11 +144,11 @@ function Ae(e, t) {
144
144
  };
145
145
  j(() => {
146
146
  }), F(() => {
147
- cancelAnimationFrame(d);
147
+ cancelAnimationFrame(f);
148
148
  }), T(
149
149
  [l.width, l.height, o],
150
150
  () => {
151
- f();
151
+ d();
152
152
  },
153
153
  { deep: !0 }
154
154
  );
@@ -174,7 +174,7 @@ function Ae(e, t) {
174
174
  containerProps: {
175
175
  ref: n,
176
176
  onScroll: (u) => {
177
- u.target && (i.value = u.target.scrollTop), f();
177
+ u.target && (i.value = u.target.scrollTop), d();
178
178
  },
179
179
  style: X
180
180
  },
@@ -184,31 +184,31 @@ function Ae(e, t) {
184
184
  }
185
185
  const Re = Symbol(), Ne = Symbol(), $e = Symbol(), He = Symbol(), Ke = Symbol(), Ve = Symbol(), ze = Symbol(), Qe = Symbol();
186
186
  function Ue(e, t) {
187
- const n = b({}), l = O(() => e.value.filter((d) => n.value[d[t]])), a = O(() => l.value.length != 0 && Object.keys(n.value).length == e.value.length);
187
+ const n = b({}), l = O(() => e.value.filter((f) => n.value[f[t]])), a = O(() => l.value.length != 0 && Object.keys(n.value).length == e.value.length);
188
188
  function i() {
189
- e.value.forEach((d) => {
190
- n.value[d[t]] = !0;
189
+ e.value.forEach((f) => {
190
+ n.value[f[t]] = !0;
191
191
  });
192
192
  }
193
193
  function o() {
194
194
  n.value = {};
195
195
  }
196
- function r(d) {
197
- d.forEach((f) => {
198
- n.value[f[t]] || (n.value[f[t]] = !0);
196
+ function r(f) {
197
+ f.forEach((d) => {
198
+ n.value[d[t]] || (n.value[d[t]] = !0);
199
199
  });
200
200
  }
201
- function s(d) {
202
- d.forEach((f) => {
203
- n.value[f[t]] && delete n.value[f[t]];
201
+ function s(f) {
202
+ f.forEach((d) => {
203
+ n.value[d[t]] && delete n.value[d[t]];
204
204
  });
205
205
  }
206
- function c(d) {
207
- return !!n.value[d[t]];
206
+ function c(f) {
207
+ return !!n.value[f[t]];
208
208
  }
209
- function w(d) {
210
- d.forEach((f) => {
211
- c(f) ? delete n.value[f[t]] : n.value[f[t]] = !0;
209
+ function w(f) {
210
+ f.forEach((d) => {
211
+ c(d) ? delete n.value[d[t]] : n.value[d[t]] = !0;
212
212
  });
213
213
  }
214
214
  function _() {
@@ -267,7 +267,7 @@ function Me() {
267
267
  }, !1);
268
268
  }
269
269
  function a(o) {
270
- n.value[o].visiable = !1, n.value = {}, t && t.childNodes.length > 0 && t.childNodes.forEach((r) => {
270
+ n.value[o] && (n.value[o].visiable = !1), n.value = {}, t && t.childNodes.length > 0 && t.childNodes.forEach((r) => {
271
271
  t?.removeChild(r);
272
272
  });
273
273
  }
@@ -279,7 +279,7 @@ function Me() {
279
279
  return () => N(
280
280
  Le,
281
281
  {
282
- visiable: n.value[r].visiable,
282
+ visiable: n.value[r]?.visiable || !1,
283
283
  "onUpdate:show": () => {
284
284
  a(r);
285
285
  }
@@ -293,7 +293,7 @@ function Me() {
293
293
  );
294
294
  }
295
295
  };
296
- e || (e = document.body.querySelector("#app") || document.body), t || (t = document.createElement("div"), t.setAttribute("id", "dialog"), e.appendChild(t)), ce(de(s), t);
296
+ e || (e = document.body.querySelector("#app") || document.body), t || (t = document.createElement("div"), t.setAttribute("id", "dialog"), e.appendChild(t)), ce(fe(s), t);
297
297
  }
298
298
  return { close: () => a(r) };
299
299
  }
@@ -311,7 +311,7 @@ const je = /* @__PURE__ */ D({
311
311
  },
312
312
  setup(e) {
313
313
  const t = e, { list: n, containerProps: l, wrapperProps: a, innerProps: i } = Ae(
314
- fe(t, "data"),
314
+ de(t, "data"),
315
315
  {
316
316
  itemHeight: (o) => t.itemHeight(0),
317
317
  overscan: 10
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(c,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(c=typeof globalThis<"u"?globalThis:c||self,e(c.ui={},c.Vue))})(this,function(c,e){"use strict";var P;const w=typeof window<"u";w&&((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 q=w?window:void 0;w&&window.document,w&&window.navigator,w&&window.location;function W(t,n=!1){const o=e.ref(),r=()=>o.value=Boolean(t());return r(),U(r,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 E=Object.getOwnPropertySymbols,G=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable,J=(t,n)=>{var o={};for(var r in t)G.call(t,r)&&n.indexOf(r)<0&&(o[r]=t[r]);if(t!=null&&E)for(var r of E(t))n.indexOf(r)<0&&Y.call(t,r)&&(o[r]=t[r]);return o};function X(t,n,o={}){const r=o,{window:i=q}=r,u=J(r,["window"]);let l;const a=W(()=>i&&"ResizeObserver"in i),s=()=>{l&&(l.disconnect(),l=void 0)},f=e.watch(()=>C(t),v=>{s(),a.value&&i&&v&&(l=new ResizeObserver(n),l.observe(v,u))},{immediate:!0,flush:"post"}),_=()=>{s(),f()};return F(_),{isSupported:a,stop:_}}function Z(t,n={width:0,height:0},o={}){const{box:r="content-box"}=o,i=e.ref(n.width),u=e.ref(n.height);return X(t,([l])=>{const a=r==="border-box"?l.borderBoxSize:r==="content-box"?l.contentBoxSize:l.devicePixelContentBoxSize;a?(i.value=a.reduce((s,{inlineSize:f})=>s+f,0),u.value=a.reduce((s,{blockSize:f})=>s+f,0)):(i.value=l.contentRect.width,u.value=l.contentRect.height)},o),e.watch(()=>C(t),l=>{i.value=l?n.width:0,u.value=l?n.height:0}),{width:i,height:u}}var I;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(I||(I={}));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(),r=Z(o),i=e.ref([]),u=e.ref(0),l=e.shallowRef(t),a=e.ref({start:0,end:10}),{itemHeight:s,overscan:f=5}=n,_=d=>{const{start:y=0}=a.value;let g=0,m=0;for(let b=y;b<l.value.length;b++)if(g+=s(b),g>=d){m=b;break}return m-y},v=d=>{let y=0,g=0;for(let m=0;m<l.value.length;m++)if(y+=s(m),y>=d){g=m;break}return g};let p;const h=()=>{cancelAnimationFrame(p),p=requestAnimationFrame(L)},L=()=>{const d=o.value;if(d){const y=v(d.scrollTop),g=_(d.clientHeight),m=y-f,b=y+g+f;a.value={start:m<0?0:m,end:b>l.value.length?l.value.length:b},i.value=l.value.slice(a.value.start,a.value.end).map((Q,ge)=>({data:Q,index:ge+a.value.start}))}};e.onMounted(()=>{}),e.onUnmounted(()=>{cancelAnimationFrame(p)}),e.watch([r.width,r.height,l],()=>{h()},{deep:!0});const j=e.computed(()=>typeof s=="number"?l.value.length*s:l.value.reduce((d,y,g)=>d+s(g),0)),ce=d=>typeof s=="number"?d*s:l.value.slice(0,d).reduce((g,m,b)=>g+s(b),0),ue=d=>{o.value&&(o.value.scrollTop=d,L())},de=e.computed(()=>ce(a.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:i,totalHeight:j,clientHeight:r.height,scrollTo:ue,scrollTop:u,containerProps:{ref:o,onScroll:d=>{d.target&&(u.value=d.target.scrollTop),h()},style:he},wrapperProps:fe,innerProps:pe}}const A=Symbol(),k=Symbol(),x=Symbol(),V=Symbol(),N=Symbol(),R=Symbol(),z=Symbol(),$=Symbol();function le(t,n){const o=e.ref({}),r=e.computed(()=>t.value.filter(p=>o.value[p[n]])),i=e.computed(()=>r.value.length!=0&&Object.keys(o.value).length==t.value.length);function u(){t.value.forEach(p=>{o.value[p[n]]=!0})}function l(){o.value={}}function a(p){p.forEach(h=>{o.value[h[n]]||(o.value[h[n]]=!0)})}function s(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 v(){i.value?l():u()}return e.provide(A,v),e.provide(k,_),e.provide(x,f),e.provide(V,r),e.provide(N,a),e.provide(R,s),e.provide(z,i),e.provide($,l),{selected:r,select:a,selectAll:u,unselect:s,unselectAll:l,toggle:_,toggleAll:v,isSelected:f,isAllSelected:i}}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,r=()=>{o.closeOnClickOverlay&&n("update:show",!1)};return e.provide(H,()=>n("update:show",!1)),(i,u)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[t.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:r,class:"modal absolute inset-0 bottom-0 z-50 flex bg-stone-900 bg-opacity-50"},[e.createElementVNode("div",{onClick:u[0]||(u[0]=e.withModifiers(()=>{},["stop"])),class:"dialog m-auto flex flex-col"},[e.renderSlot(i.$slots,"default")])])):e.createCommentVNode("",!0)]),_:3}))}});function ae(){let t=null,n=null;const o=e.ref({});function r(l,a,s=!0){return o.value[l]?(o.value[l].visiable=s,!0):(o.value[l]={visiable:s,componentProps:a},!1)}function i(l){o.value[l].visiable=!1,o.value={},n&&n.childNodes.length>0&&n.childNodes.forEach(a=>{n?.removeChild(a)})}function u(l){const a=l.component.name;if(!r(a,l.componentProps||{})){const s={setup(){return()=>e.h(re,{visiable:o.value[a].visiable,"onUpdate:show":()=>{i(a)}},{default:()=>e.h(l.component,o.value[a].componentProps)})}};t||(t=document.body.querySelector("#app")||document.body),n||(n=document.createElement("div"),n.setAttribute("id","dialog"),t.appendChild(n)),e.render(e.createVNode(s),n)}return{close:()=>i(a)}}return e.onUnmounted(()=>{n&&t&&t.removeChild(n)}),{create:u}}const se=e.defineComponent({__name:"VirtualList",props:{data:null,itemHeight:null},setup(t){const n=t,{list:o,containerProps:r,wrapperProps:i,innerProps:u}=K(e.toRef(n,"data"),{itemHeight:l=>n.itemHeight(0),overscan:10});return(l,a)=>(e.openBlock(),e.createElementBlock("div",{ref:e.unref(r).ref,onScrollPassive:a[0]||(a[0]=(...s)=>e.unref(r).onScroll&&e.unref(r).onScroll(...s)),class:"hiddenScorllBar-firefox hiddenScorllBar h-full overflow-hidden",style:e.normalizeStyle(e.unref(r).style)},[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(i))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(u))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(o),({index:s,data:f})=>(e.openBlock(),e.createElementBlock("div",{key:s,style:e.normalizeStyle({height:`${t.itemHeight(f)}px`,display:"flex"})},[e.renderSlot(l.$slots,"default",{data:f,index:s},void 0,!0)],4))),128))],16)],16)],36))}}),ye="",ie=((t,n)=>{const o=t.__vccOpts||t;for(const[r,i]of n)o[r]=i;return o})(se,[["__scopeId","data-v-b9b7f6cb"]]);c.DialogController=ae,c.VirtualList=ie,c.allSelectedKey=V,c.closeDialogKey=H,c.isAllSelectedKey=z,c.isSelectedKey=x,c.selectKey=N,c.toggleAllKey=A,c.toggleKey=k,c.unselectAllKey=$,c.unselectKey=R,c.useSelectable=le,c.useVirtualList=K,Object.defineProperties(c,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(c,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(c=typeof globalThis<"u"?globalThis:c||self,e(c.ui={},c.Vue))})(this,function(c,e){"use strict";var P;const w=typeof window<"u";w&&((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 q=w?window:void 0;w&&window.document,w&&window.navigator,w&&window.location;function W(t,n=!1){const o=e.ref(),r=()=>o.value=Boolean(t());return r(),U(r,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 E=Object.getOwnPropertySymbols,G=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable,J=(t,n)=>{var o={};for(var r in t)G.call(t,r)&&n.indexOf(r)<0&&(o[r]=t[r]);if(t!=null&&E)for(var r of E(t))n.indexOf(r)<0&&Y.call(t,r)&&(o[r]=t[r]);return o};function X(t,n,o={}){const r=o,{window:i=q}=r,u=J(r,["window"]);let l;const a=W(()=>i&&"ResizeObserver"in i),s=()=>{l&&(l.disconnect(),l=void 0)},f=e.watch(()=>C(t),_=>{s(),a.value&&i&&_&&(l=new ResizeObserver(n),l.observe(_,u))},{immediate:!0,flush:"post"}),v=()=>{s(),f()};return F(v),{isSupported:a,stop:v}}function Z(t,n={width:0,height:0},o={}){const{box:r="content-box"}=o,i=e.ref(n.width),u=e.ref(n.height);return X(t,([l])=>{const a=r==="border-box"?l.borderBoxSize:r==="content-box"?l.contentBoxSize:l.devicePixelContentBoxSize;a?(i.value=a.reduce((s,{inlineSize:f})=>s+f,0),u.value=a.reduce((s,{blockSize:f})=>s+f,0)):(i.value=l.contentRect.width,u.value=l.contentRect.height)},o),e.watch(()=>C(t),l=>{i.value=l?n.width:0,u.value=l?n.height:0}),{width:i,height:u}}var I;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(I||(I={}));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(),r=Z(o),i=e.ref([]),u=e.ref(0),l=e.shallowRef(t),a=e.ref({start:0,end:10}),{itemHeight:s,overscan:f=5}=n,v=d=>{const{start:y=0}=a.value;let g=0,m=0;for(let b=y;b<l.value.length;b++)if(g+=s(b),g>=d){m=b;break}return m-y},_=d=>{let y=0,g=0;for(let m=0;m<l.value.length;m++)if(y+=s(m),y>=d){g=m;break}return g};let p;const h=()=>{cancelAnimationFrame(p),p=requestAnimationFrame(L)},L=()=>{const d=o.value;if(d){const y=_(d.scrollTop),g=v(d.clientHeight),m=y-f,b=y+g+f;a.value={start:m<0?0:m,end:b>l.value.length?l.value.length:b},i.value=l.value.slice(a.value.start,a.value.end).map((Q,ge)=>({data:Q,index:ge+a.value.start}))}};e.onMounted(()=>{}),e.onUnmounted(()=>{cancelAnimationFrame(p)}),e.watch([r.width,r.height,l],()=>{h()},{deep:!0});const j=e.computed(()=>typeof s=="number"?l.value.length*s:l.value.reduce((d,y,g)=>d+s(g),0)),ce=d=>typeof s=="number"?d*s:l.value.slice(0,d).reduce((g,m,b)=>g+s(b),0),ue=d=>{o.value&&(o.value.scrollTop=d,L())},de=e.computed(()=>ce(a.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:i,totalHeight:j,clientHeight:r.height,scrollTo:ue,scrollTop:u,containerProps:{ref:o,onScroll:d=>{d.target&&(u.value=d.target.scrollTop),h()},style:he},wrapperProps:fe,innerProps:pe}}const A=Symbol(),k=Symbol(),x=Symbol(),V=Symbol(),N=Symbol(),R=Symbol(),z=Symbol(),$=Symbol();function le(t,n){const o=e.ref({}),r=e.computed(()=>t.value.filter(p=>o.value[p[n]])),i=e.computed(()=>r.value.length!=0&&Object.keys(o.value).length==t.value.length);function u(){t.value.forEach(p=>{o.value[p[n]]=!0})}function l(){o.value={}}function a(p){p.forEach(h=>{o.value[h[n]]||(o.value[h[n]]=!0)})}function s(p){p.forEach(h=>{o.value[h[n]]&&delete o.value[h[n]]})}function f(p){return!!o.value[p[n]]}function v(p){p.forEach(h=>{f(h)?delete o.value[h[n]]:o.value[h[n]]=!0})}function _(){i.value?l():u()}return e.provide(A,_),e.provide(k,v),e.provide(x,f),e.provide(V,r),e.provide(N,a),e.provide(R,s),e.provide(z,i),e.provide($,l),{selected:r,select:a,selectAll:u,unselect:s,unselectAll:l,toggle:v,toggleAll:_,isSelected:f,isAllSelected:i}}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,r=()=>{o.closeOnClickOverlay&&n("update:show",!1)};return e.provide(H,()=>n("update:show",!1)),(i,u)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[t.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:r,class:"modal absolute inset-0 bottom-0 z-50 flex bg-stone-900 bg-opacity-50"},[e.createElementVNode("div",{onClick:u[0]||(u[0]=e.withModifiers(()=>{},["stop"])),class:"dialog m-auto flex flex-col"},[e.renderSlot(i.$slots,"default")])])):e.createCommentVNode("",!0)]),_:3}))}});function ae(){let t=null,n=null;const o=e.ref({});function r(l,a,s=!0){return o.value[l]?(o.value[l].visiable=s,!0):(o.value[l]={visiable:s,componentProps:a},!1)}function i(l){o.value[l]&&(o.value[l].visiable=!1),o.value={},n&&n.childNodes.length>0&&n.childNodes.forEach(a=>{n?.removeChild(a)})}function u(l){const a=l.component.name;if(!r(a,l.componentProps||{})){const s={setup(){return()=>e.h(re,{visiable:o.value[a]?.visiable||!1,"onUpdate:show":()=>{i(a)}},{default:()=>e.h(l.component,o.value[a].componentProps)})}};t||(t=document.body.querySelector("#app")||document.body),n||(n=document.createElement("div"),n.setAttribute("id","dialog"),t.appendChild(n)),e.render(e.createVNode(s),n)}return{close:()=>i(a)}}return e.onUnmounted(()=>{n&&t&&t.removeChild(n)}),{create:u}}const se=e.defineComponent({__name:"VirtualList",props:{data:null,itemHeight:null},setup(t){const n=t,{list:o,containerProps:r,wrapperProps:i,innerProps:u}=K(e.toRef(n,"data"),{itemHeight:l=>n.itemHeight(0),overscan:10});return(l,a)=>(e.openBlock(),e.createElementBlock("div",{ref:e.unref(r).ref,onScrollPassive:a[0]||(a[0]=(...s)=>e.unref(r).onScroll&&e.unref(r).onScroll(...s)),class:"hiddenScorllBar-firefox hiddenScorllBar h-full overflow-hidden",style:e.normalizeStyle(e.unref(r).style)},[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(i))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(u))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(o),({index:s,data:f})=>(e.openBlock(),e.createElementBlock("div",{key:s,style:e.normalizeStyle({height:`${t.itemHeight(f)}px`,display:"flex"})},[e.renderSlot(l.$slots,"default",{data:f,index:s},void 0,!0)],4))),128))],16)],16)],36))}}),ye="",ie=((t,n)=>{const o=t.__vccOpts||t;for(const[r,i]of n)o[r]=i;return o})(se,[["__scopeId","data-v-b9b7f6cb"]]);c.DialogController=ae,c.VirtualList=ie,c.allSelectedKey=V,c.closeDialogKey=H,c.isAllSelectedKey=z,c.isSelectedKey=x,c.selectKey=N,c.toggleAllKey=A,c.toggleKey=k,c.unselectAllKey=$,c.unselectKey=R,c.useSelectable=le,c.useVirtualList=K,Object.defineProperties(c,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazycatcloud/lzc-toolkit",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "lazycat ui toolkits",
5
5
  "main": "./dist/index.umd.js",
6
6
  "module": "./dist/index.es.js",