@lazycatcloud/lzc-toolkit 0.0.10 → 0.0.12

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);
@@ -11,41 +11,41 @@ function ge(e) {
11
11
  function me(e) {
12
12
  return ee() ? (te(e), !0) : !1;
13
13
  }
14
- function be(e, t = !0) {
15
- ne() ? j(e) : t ? e() : oe(e);
14
+ function be(e, n = !0) {
15
+ ne() ? j(e) : n ? e() : oe(e);
16
16
  }
17
17
  function M(e) {
18
- var t;
19
- const n = he(e);
20
- return (t = n?.$el) != null ? t : n;
18
+ var n;
19
+ const t = he(e);
20
+ return (n = t?.$el) != null ? n : t;
21
21
  }
22
22
  const ye = P ? window : void 0;
23
23
  P && window.document;
24
24
  P && window.navigator;
25
25
  P && window.location;
26
- function we(e, t = !1) {
27
- const n = b(), l = () => n.value = Boolean(e());
28
- return l(), be(l, t), n;
26
+ function we(e, n = !1) {
27
+ const t = b(), l = () => t.value = Boolean(e());
28
+ return l(), be(l, n), t;
29
29
  }
30
30
  const C = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, E = "__vueuse_ssr_handlers__";
31
31
  C[E] = C[E] || {};
32
32
  C[E];
33
- var z = Object.getOwnPropertySymbols, _e = Object.prototype.hasOwnProperty, Oe = Object.prototype.propertyIsEnumerable, Se = (e, t) => {
34
- var n = {};
33
+ var z = Object.getOwnPropertySymbols, _e = Object.prototype.hasOwnProperty, Oe = Object.prototype.propertyIsEnumerable, Se = (e, n) => {
34
+ var t = {};
35
35
  for (var l in e)
36
- _e.call(e, l) && t.indexOf(l) < 0 && (n[l] = e[l]);
36
+ _e.call(e, l) && n.indexOf(l) < 0 && (t[l] = e[l]);
37
37
  if (e != null && z)
38
38
  for (var l of z(e))
39
- t.indexOf(l) < 0 && Oe.call(e, l) && (n[l] = e[l]);
40
- return n;
39
+ n.indexOf(l) < 0 && Oe.call(e, l) && (t[l] = e[l]);
40
+ return t;
41
41
  };
42
- function Pe(e, t, n = {}) {
43
- const l = n, { window: a = ye } = l, i = Se(l, ["window"]);
42
+ function Pe(e, n, t = {}) {
43
+ const l = t, { window: a = ye } = l, i = Se(l, ["window"]);
44
44
  let o;
45
45
  const r = we(() => a && "ResizeObserver" in a), s = () => {
46
46
  o && (o.disconnect(), o = void 0);
47
47
  }, c = T(() => M(e), (_) => {
48
- s(), r.value && a && _ && (o = new ResizeObserver(t), o.observe(_, i));
48
+ s(), r.value && a && _ && (o = new ResizeObserver(n), o.observe(_, i));
49
49
  }, { immediate: !0, flush: "post" }), w = () => {
50
50
  s(), c();
51
51
  };
@@ -54,13 +54,13 @@ function Pe(e, t, n = {}) {
54
54
  stop: w
55
55
  };
56
56
  }
57
- function Ie(e, t = { width: 0, height: 0 }, n = {}) {
58
- const { box: l = "content-box" } = n, a = b(t.width), i = b(t.height);
57
+ function Ie(e, n = { width: 0, height: 0 }, t = {}) {
58
+ const { box: l = "content-box" } = t, a = b(n.width), i = b(n.height);
59
59
  return Pe(e, ([o]) => {
60
60
  const r = l === "border-box" ? o.borderBoxSize : l === "content-box" ? o.contentBoxSize : o.devicePixelContentBoxSize;
61
61
  r ? (a.value = r.reduce((s, { inlineSize: c }) => s + c, 0), i.value = r.reduce((s, { blockSize: c }) => s + c, 0)) : (a.value = o.contentRect.width, i.value = o.contentRect.height);
62
- }, n), T(() => M(e), (o) => {
63
- a.value = o ? t.width : 0, i.value = o ? t.height : 0;
62
+ }, t), T(() => M(e), (o) => {
63
+ a.value = o ? n.width : 0, i.value = o ? n.height : 0;
64
64
  }), {
65
65
  width: a,
66
66
  height: i
@@ -70,12 +70,12 @@ var Q;
70
70
  (function(e) {
71
71
  e.UP = "UP", e.RIGHT = "RIGHT", e.DOWN = "DOWN", e.LEFT = "LEFT", e.NONE = "NONE";
72
72
  })(Q || (Q = {}));
73
- var xe = Object.defineProperty, k = Object.getOwnPropertySymbols, Ce = Object.prototype.hasOwnProperty, Ee = Object.prototype.propertyIsEnumerable, L = (e, t, n) => t in e ? xe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Te = (e, t) => {
74
- for (var n in t || (t = {}))
75
- Ce.call(t, n) && L(e, n, t[n]);
73
+ var xe = Object.defineProperty, k = Object.getOwnPropertySymbols, Ce = Object.prototype.hasOwnProperty, Ee = Object.prototype.propertyIsEnumerable, L = (e, n, t) => n in e ? xe(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t, Te = (e, n) => {
74
+ for (var t in n || (n = {}))
75
+ Ce.call(n, t) && L(e, t, n[t]);
76
76
  if (k)
77
- for (var n of k(t))
78
- Ee.call(t, n) && L(e, n, t[n]);
77
+ for (var t of k(n))
78
+ Ee.call(n, t) && L(e, t, n[t]);
79
79
  return e;
80
80
  };
81
81
  const Be = {
@@ -107,8 +107,8 @@ const Be = {
107
107
  Te({
108
108
  linear: ge
109
109
  }, Be);
110
- function Ae(e, t) {
111
- const n = b(), l = Ie(n), a = b([]), i = b(0), o = le(e), r = b({ start: 0, end: 10 }), { itemHeight: s, overscan: c = 5 } = t, w = (u) => {
110
+ function Ae(e, n) {
111
+ const t = b(), l = Ie(t), a = b([]), i = b(0), o = le(e), r = b({ start: 0, end: 10 }), { itemHeight: s, overscan: c = 5 } = n, w = (u) => {
112
112
  const { start: h = 0 } = r.value;
113
113
  let v = 0, p = 0;
114
114
  for (let g = h; g < o.value.length; g++)
@@ -126,11 +126,11 @@ 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
- const u = n.value;
133
+ const u = t.value;
134
134
  if (u) {
135
135
  const h = _(u.scrollTop), v = w(u.clientHeight), p = h - c, g = h + v + c;
136
136
  r.value = {
@@ -144,16 +144,16 @@ 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
  );
155
155
  const A = O(() => typeof s == "number" ? o.value.length * s : o.value.reduce((u, h, v) => u + s(v), 0)), W = (u) => typeof s == "number" ? u * s : o.value.slice(0, u).reduce((v, p, g) => v + s(g), 0), q = (u) => {
156
- n.value && (n.value.scrollTop = u, B());
156
+ t.value && (t.value.scrollTop = u, B());
157
157
  }, G = O(() => W(r.value.start)), Y = O(() => ({
158
158
  style: {
159
159
  width: "100%",
@@ -172,9 +172,9 @@ function Ae(e, t) {
172
172
  scrollTo: q,
173
173
  scrollTop: i,
174
174
  containerProps: {
175
- ref: n,
175
+ ref: t,
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
  },
@@ -183,32 +183,32 @@ function Ae(e, t) {
183
183
  };
184
184
  }
185
185
  const Re = Symbol(), Ne = Symbol(), $e = Symbol(), He = Symbol(), Ke = Symbol(), Ve = Symbol(), ze = Symbol(), Qe = Symbol();
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);
186
+ function Ue(e, n) {
187
+ const t = b({}), l = O(() => e.value.filter((f) => t.value[f[n]])), a = O(() => l.value.length != 0 && Object.keys(t.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
+ t.value[f[n]] = !0;
191
191
  });
192
192
  }
193
193
  function o() {
194
- n.value = {};
194
+ t.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
+ t.value[d[n]] || (t.value[d[n]] = !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
+ t.value[d[n]] && delete t.value[d[n]];
204
204
  });
205
205
  }
206
- function c(d) {
207
- return !!n.value[d[t]];
206
+ function c(f) {
207
+ return !!t.value[f[n]];
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 t.value[d[n]] : t.value[d[n]] = !0;
212
212
  });
213
213
  }
214
214
  function _() {
@@ -233,11 +233,11 @@ const ke = Symbol(), Le = /* @__PURE__ */ D({
233
233
  closeOnClickOverlay: { type: Boolean, default: !0 }
234
234
  },
235
235
  emits: ["update:show"],
236
- setup(e, { emit: t }) {
237
- const n = e, l = () => {
238
- n.closeOnClickOverlay && t("update:show", !1);
236
+ setup(e, { emit: n }) {
237
+ const t = e, l = () => {
238
+ t.closeOnClickOverlay && n("update:show", !1);
239
239
  };
240
- return m(ke, () => t("update:show", !1)), (a, i) => (S(), re(se, { name: "modal" }, {
240
+ return m(ke, () => n("update:show", !1)), (a, i) => (S(), re(se, { name: "modal" }, {
241
241
  default: ae(() => [
242
242
  e.visiable ? (S(), I("div", {
243
243
  key: 0,
@@ -258,47 +258,47 @@ const ke = Symbol(), Le = /* @__PURE__ */ D({
258
258
  }
259
259
  });
260
260
  function Me() {
261
- let e = null, t = null;
262
- const n = b({});
261
+ let e = null, n = null;
262
+ const t = b({});
263
263
  function l(o, r, s = !0) {
264
- return n.value[o] ? (n.value[o].visiable = s, !0) : (n.value[o] = {
264
+ return t.value[o] ? (t.value[o].visiable = s, !0) : (t.value[o] = {
265
265
  visiable: s,
266
266
  componentProps: r
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) => {
271
- t?.removeChild(r);
272
- });
270
+ t.value[o] && (t.value[o].visiable = !1), n && n.childNodes.length > 0 && n.childNodes.forEach((r) => {
271
+ n?.removeChild(r);
272
+ }), t.value = {};
273
273
  }
274
274
  function i(o) {
275
- const r = o.component.name;
276
- if (!l(r, o.componentProps || {})) {
275
+ const r = "0";
276
+ if (a(r), !l(r, o.componentProps || {})) {
277
277
  const s = {
278
278
  setup() {
279
279
  return () => N(
280
280
  Le,
281
281
  {
282
- visiable: n.value[r].visiable,
282
+ visiable: t.value[r]?.visiable || !1,
283
283
  "onUpdate:show": () => {
284
- a(r);
284
+ t.value[r].visiable = !1;
285
285
  }
286
286
  },
287
287
  {
288
288
  default: () => N(
289
289
  o.component,
290
- n.value[r].componentProps
290
+ t.value[r].componentProps
291
291
  )
292
292
  }
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), n || (n = document.createElement("div"), n.setAttribute("id", "dialog"), e.appendChild(n)), ce(fe(s), n);
297
297
  }
298
298
  return { close: () => a(r) };
299
299
  }
300
300
  return F(() => {
301
- t && e && e.removeChild(t);
301
+ n && e && e.removeChild(n);
302
302
  }), {
303
303
  create: i
304
304
  };
@@ -310,10 +310,10 @@ const je = /* @__PURE__ */ D({
310
310
  itemHeight: null
311
311
  },
312
312
  setup(e) {
313
- const t = e, { list: n, containerProps: l, wrapperProps: a, innerProps: i } = Ae(
314
- fe(t, "data"),
313
+ const n = e, { list: t, containerProps: l, wrapperProps: a, innerProps: i } = Ae(
314
+ de(n, "data"),
315
315
  {
316
- itemHeight: (o) => t.itemHeight(0),
316
+ itemHeight: (o) => n.itemHeight(0),
317
317
  overscan: 10
318
318
  }
319
319
  );
@@ -325,7 +325,7 @@ const je = /* @__PURE__ */ D({
325
325
  }, [
326
326
  x("div", H(K(y(a))), [
327
327
  x("div", H(K(y(i))), [
328
- (S(!0), I(ve, null, pe(y(n), ({ index: s, data: c }) => (S(), I("div", {
328
+ (S(!0), I(ve, null, pe(y(t), ({ index: s, data: c }) => (S(), I("div", {
329
329
  key: s,
330
330
  style: $({
331
331
  height: `${e.itemHeight(c)}px`,
@@ -342,11 +342,11 @@ const je = /* @__PURE__ */ D({
342
342
  ], 36));
343
343
  }
344
344
  });
345
- const Fe = (e, t) => {
346
- const n = e.__vccOpts || e;
347
- for (const [l, a] of t)
348
- n[l] = a;
349
- return n;
345
+ const Fe = (e, n) => {
346
+ const t = e.__vccOpts || e;
347
+ for (const [l, a] of n)
348
+ t[l] = a;
349
+ return t;
350
350
  }, We = /* @__PURE__ */ Fe(je, [["__scopeId", "data-v-b9b7f6cb"]]);
351
351
  export {
352
352
  Me as DialogController,
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,o=!0){e.getCurrentInstance()?e.onMounted(t):o?t():e.nextTick(t)}function C(t){var o;const n=D(t);return(o=n?.$el)!=null?o:n}const q=w?window:void 0;w&&window.document,w&&window.navigator,w&&window.location;function W(t,o=!1){const n=e.ref(),r=()=>n.value=Boolean(t());return r(),U(r,o),n}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,o)=>{var n={};for(var r in t)G.call(t,r)&&o.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&E)for(var r of E(t))o.indexOf(r)<0&&Y.call(t,r)&&(n[r]=t[r]);return n};function X(t,o,n={}){const r=n,{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(o),l.observe(_,u))},{immediate:!0,flush:"post"}),v=()=>{s(),f()};return F(v),{isSupported:a,stop:v}}function Z(t,o={width:0,height:0},n={}){const{box:r="content-box"}=n,i=e.ref(o.width),u=e.ref(o.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)},n),e.watch(()=>C(t),l=>{i.value=l?o.width:0,u.value=l?o.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,o,n)=>o in t?ee(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n,oe=(t,o)=>{for(var n in o||(o={}))te.call(o,n)&&T(t,n,o[n]);if(B)for(var n of B(o))ne.call(o,n)&&T(t,n,o[n]);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,o){const n=e.ref(),r=Z(n),i=e.ref([]),u=e.ref(0),l=e.shallowRef(t),a=e.ref({start:0,end:10}),{itemHeight:s,overscan:f=5}=o,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=n.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=>{n.value&&(n.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:n,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,o){const n=e.ref({}),r=e.computed(()=>t.value.filter(p=>n.value[p[o]])),i=e.computed(()=>r.value.length!=0&&Object.keys(n.value).length==t.value.length);function u(){t.value.forEach(p=>{n.value[p[o]]=!0})}function l(){n.value={}}function a(p){p.forEach(h=>{n.value[h[o]]||(n.value[h[o]]=!0)})}function s(p){p.forEach(h=>{n.value[h[o]]&&delete n.value[h[o]]})}function f(p){return!!n.value[p[o]]}function v(p){p.forEach(h=>{f(h)?delete n.value[h[o]]:n.value[h[o]]=!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:o}){const n=t,r=()=>{n.closeOnClickOverlay&&o("update:show",!1)};return e.provide(H,()=>o("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,o=null;const n=e.ref({});function r(l,a,s=!0){return n.value[l]?(n.value[l].visiable=s,!0):(n.value[l]={visiable:s,componentProps:a},!1)}function i(l){n.value[l]&&(n.value[l].visiable=!1),o&&o.childNodes.length>0&&o.childNodes.forEach(a=>{o?.removeChild(a)}),n.value={}}function u(l){const a="0";if(i(a),!r(a,l.componentProps||{})){const s={setup(){return()=>e.h(re,{visiable:n.value[a]?.visiable||!1,"onUpdate:show":()=>{n.value[a].visiable=!1}},{default:()=>e.h(l.component,n.value[a].componentProps)})}};t||(t=document.body.querySelector("#app")||document.body),o||(o=document.createElement("div"),o.setAttribute("id","dialog"),t.appendChild(o)),e.render(e.createVNode(s),o)}return{close:()=>i(a)}}return e.onUnmounted(()=>{o&&t&&t.removeChild(o)}),{create:u}}const se=e.defineComponent({__name:"VirtualList",props:{data:null,itemHeight:null},setup(t){const o=t,{list:n,containerProps:r,wrapperProps:i,innerProps:u}=K(e.toRef(o,"data"),{itemHeight:l=>o.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(n),({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,o)=>{const n=t.__vccOpts||t;for(const[r,i]of o)n[r]=i;return n})(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.10",
3
+ "version": "0.0.12",
4
4
  "description": "lazycat ui toolkits",
5
5
  "main": "./dist/index.umd.js",
6
6
  "module": "./dist/index.es.js",