@lazycatcloud/lzc-toolkit 0.0.43 → 0.0.44

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,7 +1,7 @@
1
- import { unref as S, getCurrentScope as $e, onScopeDispose as Ae, getCurrentInstance as Fe, onMounted as le, nextTick as he, ref as m, watch as $, shallowRef as Le, computed as h, onUnmounted as ge, inject as H, provide as x, defineComponent as N, openBlock as T, createBlock as me, Transition as be, withCtx as ye, createElementBlock as P, createElementVNode as R, withModifiers as De, normalizeClass as Me, renderSlot as ne, createCommentVNode as Ve, render as ke, h as X, normalizeStyle as oe, useSlots as ze, withDirectives as Ke, vShow as je, pushScopeId as Ne, popScopeId as Qe, toRef as We, mergeProps as Ue, normalizeProps as ie, guardReactiveProps as ue, Fragment as qe, renderList as Ye } from "vue";
2
- var ce;
1
+ import { unref as S, getCurrentScope as $e, onScopeDispose as Ae, getCurrentInstance as Fe, onMounted as le, nextTick as ge, ref as m, watch as $, shallowRef as Le, computed as h, onUnmounted as me, inject as H, provide as E, defineComponent as N, openBlock as T, createBlock as _e, Transition as ye, withCtx as be, createElementBlock as P, createElementVNode as R, withModifiers as De, normalizeClass as Me, renderSlot as ne, createCommentVNode as Ve, render as ke, h as X, normalizeStyle as oe, useSlots as Ke, withDirectives as je, vShow as ze, pushScopeId as Ne, popScopeId as Qe, toRef as We, mergeProps as Ue, normalizeProps as ue, guardReactiveProps as ce, Fragment as qe, renderList as Ye } from "vue";
2
+ var de;
3
3
  const A = typeof window < "u";
4
- A && ((ce = window?.navigator) == null ? void 0 : ce.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
4
+ A && ((de = window?.navigator) == null ? void 0 : de.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
5
5
  function Z(e) {
6
6
  return typeof e == "function" ? e() : S(e);
7
7
  }
@@ -30,13 +30,13 @@ function Xe(e) {
30
30
  function Ze(e) {
31
31
  return $e() ? (Ae(e), !0) : !1;
32
32
  }
33
- function _e(e, t = 200, l = {}) {
33
+ function we(e, t = 200, l = {}) {
34
34
  return Ge(Je(t, l), e);
35
35
  }
36
36
  function et(e, t = !0) {
37
- Fe() ? le(e) : t ? e() : he(e);
37
+ Fe() ? le(e) : t ? e() : ge(e);
38
38
  }
39
- function we(e) {
39
+ function Se(e) {
40
40
  var t;
41
41
  const l = Z(e);
42
42
  return (t = l?.$el) != null ? t : l;
@@ -52,12 +52,12 @@ function lt(e, t = !1) {
52
52
  const ee = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, te = "__vueuse_ssr_handlers__";
53
53
  ee[te] = ee[te] || {};
54
54
  ee[te];
55
- var de = Object.getOwnPropertySymbols, nt = Object.prototype.hasOwnProperty, ot = Object.prototype.propertyIsEnumerable, rt = (e, t) => {
55
+ var ve = Object.getOwnPropertySymbols, nt = Object.prototype.hasOwnProperty, ot = Object.prototype.propertyIsEnumerable, rt = (e, t) => {
56
56
  var l = {};
57
57
  for (var n in e)
58
58
  nt.call(e, n) && t.indexOf(n) < 0 && (l[n] = e[n]);
59
- if (e != null && de)
60
- for (var n of de(e))
59
+ if (e != null && ve)
60
+ for (var n of ve(e))
61
61
  t.indexOf(n) < 0 && ot.call(e, n) && (l[n] = e[n]);
62
62
  return l;
63
63
  };
@@ -66,7 +66,7 @@ function st(e, t, l = {}) {
66
66
  let o;
67
67
  const d = lt(() => r && "ResizeObserver" in r), g = () => {
68
68
  o && (o.disconnect(), o = void 0);
69
- }, f = $(() => we(e), (p) => {
69
+ }, f = $(() => Se(e), (p) => {
70
70
  g(), d.value && r && p && (o = new ResizeObserver(t), o.observe(p, a));
71
71
  }, { immediate: !0, flush: "post" }), v = () => {
72
72
  g(), f();
@@ -81,23 +81,23 @@ function at(e, t = { width: 0, height: 0 }, l = {}) {
81
81
  return st(e, ([o]) => {
82
82
  const d = n === "border-box" ? o.borderBoxSize : n === "content-box" ? o.contentBoxSize : o.devicePixelContentBoxSize;
83
83
  d ? (r.value = d.reduce((g, { inlineSize: f }) => g + f, 0), a.value = d.reduce((g, { blockSize: f }) => g + f, 0)) : (r.value = o.contentRect.width, a.value = o.contentRect.height);
84
- }, l), $(() => we(e), (o) => {
84
+ }, l), $(() => Se(e), (o) => {
85
85
  r.value = o ? t.width : 0, a.value = o ? t.height : 0;
86
86
  }), {
87
87
  width: r,
88
88
  height: a
89
89
  };
90
90
  }
91
- var ve;
91
+ var fe;
92
92
  (function(e) {
93
93
  e.UP = "UP", e.RIGHT = "RIGHT", e.DOWN = "DOWN", e.LEFT = "LEFT", e.NONE = "NONE";
94
- })(ve || (ve = {}));
95
- var it = Object.defineProperty, fe = Object.getOwnPropertySymbols, ut = Object.prototype.hasOwnProperty, ct = Object.prototype.propertyIsEnumerable, pe = (e, t, l) => t in e ? it(e, t, { enumerable: !0, configurable: !0, writable: !0, value: l }) : e[t] = l, dt = (e, t) => {
94
+ })(fe || (fe = {}));
95
+ var it = Object.defineProperty, pe = Object.getOwnPropertySymbols, ut = Object.prototype.hasOwnProperty, ct = Object.prototype.propertyIsEnumerable, he = (e, t, l) => t in e ? it(e, t, { enumerable: !0, configurable: !0, writable: !0, value: l }) : e[t] = l, dt = (e, t) => {
96
96
  for (var l in t || (t = {}))
97
- ut.call(t, l) && pe(e, l, t[l]);
98
- if (fe)
99
- for (var l of fe(t))
100
- ct.call(t, l) && pe(e, l, t[l]);
97
+ ut.call(t, l) && he(e, l, t[l]);
98
+ if (pe)
99
+ for (var l of pe(t))
100
+ ct.call(t, l) && he(e, l, t[l]);
101
101
  return e;
102
102
  };
103
103
  const vt = {
@@ -130,19 +130,19 @@ dt({
130
130
  linear: Xe
131
131
  }, vt);
132
132
  function ft(e, t) {
133
- const { scrollEndHook: l, itemHeight: n, overscan: r = 5 } = t, a = m(null), o = at(a), d = m(!0), g = _e(W, 100);
133
+ const { scrollEndHook: l, itemHeight: n, overscan: r = 5 } = t, a = m(null), o = at(a), d = m(!0), g = we(W, 100);
134
134
  let f;
135
135
  const v = Le(e), p = m(0), i = m({ start: 0, end: 10 });
136
136
  let u = 0;
137
- const E = m([]), b = h(() => {
137
+ const x = m([]), _ = h(() => {
138
138
  let { sum: s, height: c } = { sum: 0, height: 0 };
139
139
  return v.value.map((O, w) => (typeof n == "number" ? c = n : c = n(w), s += c, { height: c, sum: s }));
140
- }), Q = h(() => k(i.value.start)), I = h(() => typeof n == "number" ? b.value.length * n : b.value[b.value.length - 1]?.sum || 0), F = h(() => {
141
- let s = E.value.length - r, c = Math.max(s - u, 0);
142
- return E.value.slice(c, s);
140
+ }), Q = h(() => k(i.value.start)), I = h(() => typeof n == "number" ? _.value.length * n : _.value[_.value.length - 1]?.sum || 0), F = h(() => {
141
+ let s = x.value.length - r, c = Math.max(s - u, 0);
142
+ return x.value.slice(c, s);
143
143
  });
144
144
  le(() => {
145
- }), ge(() => cancelAnimationFrame(f)), $(
145
+ }), me(() => cancelAnimationFrame(f)), $(
146
146
  [o.width, o.height, v],
147
147
  ([s, c]) => {
148
148
  (s || c) && D();
@@ -164,34 +164,34 @@ function ft(e, t) {
164
164
  if (a.value) {
165
165
  p.value = a.value.scrollTop, u = B();
166
166
  let s = V(p.value), c = s + u + r;
167
- s = s - r, s = s < 0 ? 0 : s, c = c > v.value.length ? v.value.length : c, i.value = { start: s, end: c }, E.value = v.value.slice(s, c).map((O, w) => ({
167
+ s = s - r, s = s < 0 ? 0 : s, c = c > v.value.length ? v.value.length : c, i.value = { start: s, end: c }, x.value = v.value.slice(s, c).map((O, w) => ({
168
168
  data: O,
169
169
  index: w + s
170
170
  }));
171
171
  }
172
172
  }
173
173
  function V(s) {
174
- let c = 0, O = b.value.length - 1, w = -1;
174
+ let c = 0, O = _.value.length - 1, w = -1;
175
175
  for (; c <= O; ) {
176
176
  const y = Math.floor((c + O) / 2);
177
- b.value[y].sum >= s ? (w = y, O = y - 1) : c = y + 1;
177
+ _.value[y].sum >= s ? (w = y, O = y - 1) : c = y + 1;
178
178
  }
179
179
  return Math.max(0, w);
180
180
  }
181
181
  function B() {
182
182
  let s = 0, c = 0, O = U();
183
- for (let w = O; w < b.value.length && (s++, c += b.value[w].height, !(c >= o.height.value)); w++)
183
+ for (let w = O; w < _.value.length && (s++, c += _.value[w].height, !(c >= o.height.value)); w++)
184
184
  ;
185
185
  return s;
186
186
  }
187
187
  function k(s) {
188
188
  if (typeof n == "number")
189
189
  return s * n;
190
- let c = b.value[s];
190
+ let c = _.value[s];
191
191
  return c ? c.sum - c.height : 0;
192
192
  }
193
- function z(s) {
194
- return b.value[s] || { sum: 0, height: 0 };
193
+ function K(s) {
194
+ return _.value[s] || { sum: 0, height: 0 };
195
195
  }
196
196
  function U() {
197
197
  let s = i.value.start;
@@ -199,7 +199,7 @@ function ft(e, t) {
199
199
  }
200
200
  function q(s) {
201
201
  if (a.value) {
202
- const c = z(s);
202
+ const c = K(s);
203
203
  a.value.scrollTop = c.sum - c.height, M();
204
204
  }
205
205
  }
@@ -209,7 +209,7 @@ function ft(e, t) {
209
209
  height: `${I.value}px`,
210
210
  pointerEvents: d.value ? void 0 : "none"
211
211
  }
212
- })), K = h(() => ({
212
+ })), j = h(() => ({
213
213
  style: {
214
214
  transform: `translate3d(0, ${Q.value}px, 0)`,
215
215
  "will-change": "transform"
@@ -218,9 +218,9 @@ function ft(e, t) {
218
218
  overflowY: "auto"
219
219
  };
220
220
  return {
221
- list: E,
221
+ list: x,
222
222
  visiableList: F,
223
- getItemHeightData: z,
223
+ getItemHeightData: K,
224
224
  getoffsetTopIndex: V,
225
225
  totalHeight: I,
226
226
  clientHeight: o.height,
@@ -235,18 +235,18 @@ function ft(e, t) {
235
235
  style: G
236
236
  },
237
237
  wrapperProps: Y,
238
- innerProps: K
238
+ innerProps: j
239
239
  };
240
240
  }
241
- const Se = Symbol(), Oe = Symbol(), xe = Symbol(), Ee = Symbol(), He = Symbol(), Ie = Symbol(), Te = Symbol(), Re = Symbol(), Ce = Symbol();
242
- function Et() {
241
+ const Oe = Symbol(), Ee = Symbol(), xe = Symbol(), He = Symbol(), Ie = Symbol(), Te = Symbol(), Re = Symbol(), Ce = Symbol(), Be = Symbol();
242
+ function Ht() {
243
243
  const { voidFn: e, boolFn: t, boolRef: l, arrayRef: n } = {
244
244
  voidFn: (u) => {
245
245
  },
246
246
  boolFn: (u) => !1,
247
247
  boolRef: h(() => !1),
248
248
  arrayRef: h(() => [])
249
- }, r = H(Ee, n), a = H(xe, t), o = H(Re, l), d = H(Oe, e), g = H(Se, e), f = H(He, e), v = H(Ie, e), p = H(Te, e), i = H(Ce, e);
249
+ }, r = H(He, n), a = H(xe, t), o = H(Ce, l), d = H(Ee, e), g = H(Oe, e), f = H(Ie, e), v = H(Te, e), p = H(Re, e), i = H(Be, e);
250
250
  return {
251
251
  selected: r,
252
252
  isSelected: a,
@@ -259,7 +259,7 @@ function Et() {
259
259
  unselectAll: i
260
260
  };
261
261
  }
262
- function Ht(e, t) {
262
+ function It(e, t) {
263
263
  const l = m({}), n = h(() => e.value.filter((i) => l.value[i[t]])), r = h(() => n.value.length != 0 && Object.keys(l.value).length == e.value.length);
264
264
  function a() {
265
265
  e.value.forEach((i) => {
@@ -290,7 +290,7 @@ function Ht(e, t) {
290
290
  function p() {
291
291
  r.value ? o() : a();
292
292
  }
293
- return x(Se, p), x(Oe, v), x(xe, f), x(Ee, n), x(He, d), x(Ie, a), x(Te, g), x(Re, r), x(Ce, o), {
293
+ return E(Oe, p), E(Ee, v), E(xe, f), E(He, n), E(Ie, d), E(Te, a), E(Re, g), E(Ce, r), E(Be, o), {
294
294
  selected: n,
295
295
  select: d,
296
296
  selectAll: a,
@@ -314,19 +314,19 @@ const pt = Symbol(), ht = /* @__PURE__ */ N({
314
314
  const l = e, n = () => {
315
315
  l.closeOnClickOverlay && t("update:visiable", !1);
316
316
  };
317
- return x(pt, () => t("update:visiable", !1)), (r, a) => (T(), me(be, { name: "modal" }, {
318
- default: ye(() => [
317
+ return E(pt, () => t("update:visiable", !1)), (r, a) => (T(), _e(ye, { name: "modal" }, {
318
+ default: be(() => [
319
319
  e.visiable ? (T(), P("div", {
320
320
  key: 0,
321
321
  onClick: n,
322
- class: "modal absolute inset-0 bottom-0 flex bg-stone-900 bg-opacity-50 z-[999]"
322
+ class: "modal"
323
323
  }, [
324
324
  R("div", {
325
325
  onClick: a[0] || (a[0] = De(() => {
326
326
  }, ["stop"])),
327
- class: Me(["dialog m-auto flex flex-col", e.dialogClass])
327
+ class: Me(["dialog", e.dialogClass])
328
328
  }, [
329
- ne(r.$slots, "default")
329
+ ne(r.$slots, "default", {}, void 0, !0)
330
330
  ], 2)
331
331
  ])) : Ve("", !0)
332
332
  ]),
@@ -334,12 +334,18 @@ const pt = Symbol(), ht = /* @__PURE__ */ N({
334
334
  }));
335
335
  }
336
336
  });
337
- function It(e) {
337
+ const re = (e, t) => {
338
+ const l = e.__vccOpts || e;
339
+ for (const [n, r] of t)
340
+ l[n] = r;
341
+ return l;
342
+ }, gt = /* @__PURE__ */ re(ht, [["__scopeId", "data-v-c9f7a6a8"]]);
343
+ function Tt(e) {
338
344
  function t(l, n) {
339
345
  const r = document.createElement("div"), a = {
340
346
  setup() {
341
347
  return () => X(
342
- ht,
348
+ gt,
343
349
  {
344
350
  visiable: !0,
345
351
  "onUpdate:visiable": () => {
@@ -361,7 +367,7 @@ function It(e) {
361
367
  create: t
362
368
  };
363
369
  }
364
- const gt = ["xlink:href", "fill", "color"], Tt = /* @__PURE__ */ N({
370
+ const mt = ["xlink:href", "fill", "color"], Rt = /* @__PURE__ */ N({
365
371
  __name: "SvgIcon",
366
372
  props: {
367
373
  name: null,
@@ -384,27 +390,27 @@ const gt = ["xlink:href", "fill", "color"], Tt = /* @__PURE__ */ N({
384
390
  "xlink:href": S(l),
385
391
  fill: e.color,
386
392
  color: e.color
387
- }, null, 8, gt)
393
+ }, null, 8, mt)
388
394
  ], 4));
389
395
  }
390
396
  });
391
- function mt(e) {
397
+ function _t(e) {
392
398
  const {
393
399
  containerEl: t,
394
400
  sliderEl: l,
395
401
  autoHeight: n,
396
402
  performance: r = {},
397
403
  maxHeightRatio: a = 0.9
398
- } = e, o = m(!0), d = _e(k, 100);
404
+ } = e, o = m(!0), d = we(k, 100);
399
405
  let g, f = "";
400
406
  const v = m(0), p = m(0), i = m(0), u = m({
401
407
  top: 0,
402
408
  scrollTop: 0,
403
409
  scrollHeight: 0,
404
410
  clientHeight: 0
405
- }), E = m({
411
+ }), x = m({
406
412
  clientHeight: 0
407
- }), b = h(() => !!p.value), Q = h(() => u.value.scrollHeight > u.value.clientHeight), I = h(() => u.value.clientHeight - E.value.clientHeight), F = h(() => u.value.scrollHeight - u.value.clientHeight), L = h(() => Math.max(
413
+ }), _ = h(() => !!p.value), Q = h(() => u.value.scrollHeight > u.value.clientHeight), I = h(() => u.value.clientHeight - x.value.clientHeight), F = h(() => u.value.scrollHeight - u.value.clientHeight), L = h(() => Math.max(
408
414
  u.value.clientHeight / u.value.scrollHeight,
409
415
  0.05
410
416
  )), W = h(() => L.value > a ? 0 : L.value * u.value.clientHeight), D = h(() => ({
@@ -422,18 +428,18 @@ function mt(e) {
422
428
  o.value = !1;
423
429
  }
424
430
  function k() {
425
- b.value || (o.value = !0);
431
+ _.value || (o.value = !0);
426
432
  }
427
- function z(y) {
428
- if (!b.value)
433
+ function K(y) {
434
+ if (!_.value)
429
435
  return;
430
- let _ = y.clientY - u.value.top - p.value;
431
- _ < 0 ? i.value = 0 : _ >= I.value ? i.value = I.value : i.value = _, t.value.scrollTo({
436
+ let b = y.clientY - u.value.top - p.value;
437
+ b < 0 ? i.value = 0 : b >= I.value ? i.value = I.value : i.value = b, t.value.scrollTo({
432
438
  top: i.value / I.value * F.value
433
439
  });
434
440
  }
435
441
  function U() {
436
- b.value || q();
442
+ _.value || q();
437
443
  }
438
444
  function q() {
439
445
  cancelAnimationFrame(g), g = requestAnimationFrame(Y);
@@ -441,33 +447,33 @@ function mt(e) {
441
447
  function Y() {
442
448
  t.value && (v.value = r.scrollTop?.value ?? t.value.scrollTop, i.value = v.value / F.value * I.value);
443
449
  }
444
- function K(y) {
445
- let _ = "addEventListener";
446
- y === "add" ? _ = "addEventListener" : _ = "removeEventListener", l.value?.[_]("pointerdown", M, {
450
+ function j(y) {
451
+ let b = "addEventListener";
452
+ y === "add" ? b = "addEventListener" : b = "removeEventListener", l.value?.[b]("pointerdown", M, {
447
453
  passive: !0
448
- }), window[_]("pointermove", z, { passive: !0 }), window[_]("pointerup", V, { passive: !0 });
454
+ }), window[b]("pointermove", K, { passive: !0 }), window[b]("pointerup", V, { passive: !0 });
449
455
  }
450
456
  const G = new MutationObserver((y) => {
451
- y.map((j) => j.oldValue).join().includes("height") && s();
457
+ y.map((z) => z.oldValue).join().includes("height") && s();
452
458
  });
453
459
  function s() {
454
460
  u.value.top = t.value?.getBoundingClientRect().top ?? 0, u.value.scrollHeight = t.value?.scrollHeight ?? 0, u.value.clientHeight = t.value?.clientHeight ?? 0;
455
461
  }
456
462
  function c() {
457
463
  B(), setTimeout(() => {
458
- E.value.clientHeight = l.value?.clientHeight ?? 0, k();
464
+ x.value.clientHeight = l.value?.clientHeight ?? 0, k();
459
465
  }, 150);
460
466
  }
461
- function O(y, _, j = "dynamic-styles") {
462
- let C = document.getElementById(j);
463
- C || (C = document.createElement("style"), C.id = j, document.head.appendChild(C));
464
- const re = C.sheet.cssRules, se = re.length, Pe = `${y} { ${_} }`;
465
- for (let J = 0; J < se; J++) {
466
- const ae = re[J];
467
- if (ae.selectorText === y && ae.style.cssText === _)
467
+ function O(y, b, z = "dynamic-styles") {
468
+ let C = document.getElementById(z);
469
+ C || (C = document.createElement("style"), C.id = z, document.head.appendChild(C));
470
+ const se = C.sheet.cssRules, ae = se.length, Pe = `${y} { ${b} }`;
471
+ for (let J = 0; J < ae; J++) {
472
+ const ie = se[J];
473
+ if (ie.selectorText === y && ie.style.cssText === b)
468
474
  return;
469
475
  }
470
- C.sheet.insertRule(Pe, se);
476
+ C.sheet.insertRule(Pe, ae);
471
477
  }
472
478
  function w() {
473
479
  t.value && l.value ? (O(
@@ -475,7 +481,7 @@ function mt(e) {
475
481
  "scrollbar-width: none; -ms-overflow-style: none;"
476
482
  ), O(".hide-scrollbar::-webkit-scrollbar", "display: none"), t.value.addEventListener("scroll", U, {
477
483
  passive: !0
478
- }), K("add"), G.observe(t.value, {
484
+ }), j("add"), G.observe(t.value, {
479
485
  subtree: !0,
480
486
  attributeOldValue: !0,
481
487
  attributeFilter: ["style"]
@@ -487,16 +493,16 @@ function mt(e) {
487
493
  B(), d();
488
494
  }), {
489
495
  isScrollEnd: o,
490
- isDragSlider: b,
496
+ isDragSlider: _,
491
497
  offsetTop: i,
492
498
  scrollTop: v,
493
499
  scrollable: Q,
494
500
  sliderPos: D,
495
501
  init: w,
496
- modifySliderEventListener: K
502
+ modifySliderEventListener: j
497
503
  };
498
504
  }
499
- const bt = (e) => (Ne("data-v-edec7292"), e = e(), Qe(), e), yt = /* @__PURE__ */ bt(() => /* @__PURE__ */ R("div", { class: "default-slider" }, null, -1)), _t = /* @__PURE__ */ N({
505
+ const yt = (e) => (Ne("data-v-edec7292"), e = e(), Qe(), e), bt = /* @__PURE__ */ yt(() => /* @__PURE__ */ R("div", { class: "default-slider" }, null, -1)), wt = /* @__PURE__ */ N({
500
506
  __name: "ScrollBar",
501
507
  props: {
502
508
  containerEl: null,
@@ -505,17 +511,17 @@ const bt = (e) => (Ne("data-v-edec7292"), e = e(), Qe(), e), yt = /* @__PURE__ *
505
511
  performance: null
506
512
  },
507
513
  setup(e, { expose: t }) {
508
- const l = e, n = !!ze().default, r = m(null), a = h(() => l.containerEl), o = mt({
514
+ const l = e, n = !!Ke().default, r = m(null), a = h(() => l.containerEl), o = _t({
509
515
  containerEl: a,
510
516
  sliderEl: r,
511
517
  autoHeight: n ? l.autoHeight : !0,
512
518
  performance: l.performance
513
519
  }), { scrollable: d, isScrollEnd: g, sliderPos: f } = o, v = m(!1), p = l.autoHide ? h(() => v.value || !g.value) : h(() => d.value);
514
520
  le(() => {
515
- he(() => {
521
+ ge(() => {
516
522
  o.init();
517
523
  });
518
- }), ge(() => {
524
+ }), me(() => {
519
525
  o.modifySliderEventListener("remove");
520
526
  });
521
527
  function i() {
@@ -524,9 +530,9 @@ const bt = (e) => (Ne("data-v-edec7292"), e = e(), Qe(), e), yt = /* @__PURE__ *
524
530
  function u() {
525
531
  v.value = !1;
526
532
  }
527
- return t({ uScrollBarReturn: o }), (E, b) => (T(), me(be, null, {
528
- default: ye(() => [
529
- Ke(R("div", {
533
+ return t({ uScrollBarReturn: o }), (x, _) => (T(), _e(ye, null, {
534
+ default: be(() => [
535
+ je(R("div", {
530
536
  ref_key: "sliderRef",
531
537
  ref: r,
532
538
  class: "slider-wrapper",
@@ -534,26 +540,21 @@ const bt = (e) => (Ne("data-v-edec7292"), e = e(), Qe(), e), yt = /* @__PURE__ *
534
540
  onMouseleave: u,
535
541
  style: oe(S(f))
536
542
  }, [
537
- ne(E.$slots, "default", {}, () => [
538
- yt
543
+ ne(x.$slots, "default", {}, () => [
544
+ bt
539
545
  ], !0)
540
546
  ], 36), [
541
- [je, S(p)]
547
+ [ze, S(p)]
542
548
  ])
543
549
  ]),
544
550
  _: 3
545
551
  }));
546
552
  }
547
553
  });
548
- const Be = (e, t) => {
549
- const l = e.__vccOpts || e;
550
- for (const [n, r] of t)
551
- l[n] = r;
552
- return l;
553
- }, Rt = /* @__PURE__ */ Be(_t, [["__scopeId", "data-v-edec7292"]]), wt = { class: "virtualListWrapper" }, St = {
554
+ const Ct = /* @__PURE__ */ re(wt, [["__scopeId", "data-v-edec7292"]]), St = { class: "virtualListWrapper" }, Ot = {
554
555
  inheritAttrs: !1
555
- }, Ot = /* @__PURE__ */ N({
556
- ...St,
556
+ }, Et = /* @__PURE__ */ N({
557
+ ...Ot,
557
558
  __name: "VirtualList",
558
559
  props: {
559
560
  data: null,
@@ -571,14 +572,14 @@ const Be = (e, t) => {
571
572
  }), { list: a, containerProps: o, wrapperProps: d, innerProps: g, getItemHeightData: f } = r;
572
573
  return t({
573
574
  vListReturn: r
574
- }), (v, p) => (T(), P("div", wt, [
575
+ }), (v, p) => (T(), P("div", St, [
575
576
  R("div", Ue({
576
577
  onScrollPassive: p[0] || (p[0] = (...i) => S(o).onScroll && S(o).onScroll(...i)),
577
578
  ref: S(o).ref,
578
579
  class: "virtualList"
579
580
  }, v.$attrs), [
580
- R("div", ie(ue(S(d))), [
581
- R("div", ie(ue(S(g))), [
581
+ R("div", ue(ce(S(d))), [
582
+ R("div", ue(ce(S(g))), [
582
583
  (T(!0), P(qe, null, Ye(S(a), ({ index: i, data: u }) => (T(), P("div", {
583
584
  key: i,
584
585
  style: oe({
@@ -597,23 +598,23 @@ const Be = (e, t) => {
597
598
  ]));
598
599
  }
599
600
  });
600
- const Ct = /* @__PURE__ */ Be(Ot, [["__scopeId", "data-v-4ba97cce"]]);
601
+ const Bt = /* @__PURE__ */ re(Et, [["__scopeId", "data-v-4ba97cce"]]);
601
602
  export {
602
- Rt as ScrollBar,
603
- Tt as SvgIcon,
604
- Ct as VirtualList,
605
- Ee as allSelectedKey,
603
+ Ct as ScrollBar,
604
+ Rt as SvgIcon,
605
+ Bt as VirtualList,
606
+ He as allSelectedKey,
606
607
  pt as closeDialogKey,
607
- It as dialogController,
608
- Re as isAllSelectedKey,
608
+ Tt as dialogController,
609
+ Ce as isAllSelectedKey,
609
610
  xe as isSelectedKey,
610
- Ie as selectAllKey,
611
- He as selectKey,
612
- Se as toggleAllKey,
613
- Oe as toggleKey,
614
- Ce as unselectAllKey,
615
- Te as unselectKey,
616
- Ht as useSelectable,
617
- Et as useSelectableInjectors,
611
+ Te as selectAllKey,
612
+ Ie as selectKey,
613
+ Oe as toggleAllKey,
614
+ Ee as toggleKey,
615
+ Be as unselectAllKey,
616
+ Re as unselectKey,
617
+ It as useSelectable,
618
+ Ht as useSelectableInjectors,
618
619
  ft as useVirtualList
619
620
  };
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(h,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(h=typeof globalThis<"u"?globalThis:h||self,e(h.ui={},h.Vue))})(this,function(h,e){"use strict";var le;const B=typeof window<"u";B&&((le=window?.navigator)==null?void 0:le.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function j(t){return typeof t=="function"?t():e.unref(t)}function me(t,l){function n(...o){t(()=>l.apply(this,o),{fn:l,thisArg:this,args:o})}return n}function ge(t,l={}){let n,o;return s=>{const r=j(t),f=j(l.maxWait);if(n&&clearTimeout(n),r<=0||f!==void 0&&f<=0)return o&&(clearTimeout(o),o=null),s();f&&!o&&(o=setTimeout(()=>{n&&clearTimeout(n),o=null,s()},f)),n=setTimeout(()=>{o&&clearTimeout(o),o=null,s()},r)}}function ve(t){return t}function ye(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function ne(t,l=200,n={}){return me(ge(l,n),t)}function be(t,l=!0){e.getCurrentInstance()?e.onMounted(t):l?t():e.nextTick(t)}function oe(t){var l;const n=j(t);return(l=n?.$el)!=null?l:n}const _e=B?window:void 0;B&&window.document,B&&window.navigator,B&&window.location;function we(t,l=!1){const n=e.ref(),o=()=>n.value=Boolean(t());return o(),be(o,l),n}const K=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},V="__vueuse_ssr_handlers__";K[V]=K[V]||{},K[V];var re=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,Oe=(t,l)=>{var n={};for(var o in t)Se.call(t,o)&&l.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&re)for(var o of re(t))l.indexOf(o)<0&&Ee.call(t,o)&&(n[o]=t[o]);return n};function Te(t,l,n={}){const o=n,{window:i=_e}=o,s=Oe(o,["window"]);let r;const f=we(()=>i&&"ResizeObserver"in i),v=()=>{r&&(r.disconnect(),r=void 0)},m=e.watch(()=>oe(t),g=>{v(),f.value&&i&&g&&(r=new ResizeObserver(l),r.observe(g,s))},{immediate:!0,flush:"post"}),p=()=>{v(),m()};return ye(p),{isSupported:f,stop:p}}function Be(t,l={width:0,height:0},n={}){const{box:o="content-box"}=n,i=e.ref(l.width),s=e.ref(l.height);return Te(t,([r])=>{const f=o==="border-box"?r.borderBoxSize:o==="content-box"?r.contentBoxSize:r.devicePixelContentBoxSize;f?(i.value=f.reduce((v,{inlineSize:m})=>v+m,0),s.value=f.reduce((v,{blockSize:m})=>v+m,0)):(i.value=r.contentRect.width,s.value=r.contentRect.height)},n),e.watch(()=>oe(t),r=>{i.value=r?l.width:0,s.value=r?l.height:0}),{width:i,height:s}}var ie;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(ie||(ie={}));var He=Object.defineProperty,ae=Object.getOwnPropertySymbols,Ie=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable,se=(t,l,n)=>l in t?He(t,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[l]=n,Re=(t,l)=>{for(var n in l||(l={}))Ie.call(l,n)&&se(t,n,l[n]);if(ae)for(var n of ae(l))Ce.call(l,n)&&se(t,n,l[n]);return t};Re({linear:ve},{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 ce(t,l){const{scrollEndHook:n,itemHeight:o,overscan:i=5}=l,s=e.ref(null),r=Be(s),f=e.ref(!0),v=ne(G,100);let m;const p=e.shallowRef(t),g=e.ref(0),c=e.ref({start:0,end:10});let u=0;const E=e.ref([]),y=e.computed(()=>{let{sum:a,height:d}={sum:0,height:0};return p.value.map((S,w)=>(typeof o=="number"?d=o:d=o(w),a+=d,{height:d,sum:a}))}),Y=e.computed(()=>A(c.value.start)),O=e.computed(()=>typeof o=="number"?y.value.length*o:y.value[y.value.length-1]?.sum||0),I=e.computed(()=>{let a=E.value.length-i,d=Math.max(a-u,0);return E.value.slice(d,a)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(m)),e.watch([r.width,r.height,p],([a,d])=>{(a||d)&&R()},{deep:!0}),e.watch(g,()=>{C(),v()});function C(){f.value=!1}function G(){f.value=!0,n?.()}function R(){cancelAnimationFrame(m),m=requestAnimationFrame(x)}function x(){if(s.value){g.value=s.value.scrollTop,u=H();let a=P(g.value),d=a+u+i;a=a-i,a=a<0?0:a,d=d>p.value.length?p.value.length:d,c.value={start:a,end:d},E.value=p.value.slice(a,d).map((S,w)=>({data:S,index:w+a}))}}function P(a){let d=0,S=y.value.length-1,w=-1;for(;d<=S;){const b=Math.floor((d+S)/2);y.value[b].sum>=a?(w=b,S=b-1):d=b+1}return Math.max(0,w)}function H(){let a=0,d=0,S=J();for(let w=S;w<y.value.length&&(a++,d+=y.value[w].height,!(d>=r.height.value));w++);return a}function A(a){if(typeof o=="number")return a*o;let d=y.value[a];return d?d.sum-d.height:0}function $(a){return y.value[a]||{sum:0,height:0}}function J(){let a=c.value.start;return a>=i&&(a+=i),a}function X(a){if(s.value){const d=$(a);s.value.scrollTop=d.sum-d.height,x()}}const Z=e.computed(()=>({style:{width:"100%",height:`${O.value}px`,pointerEvents:f.value?void 0:"none"}})),k=e.computed(()=>({style:{transform:`translate3d(0, ${Y.value}px, 0)`,"will-change":"transform"}})),ee={overflowY:"auto"};return{list:E,visiableList:I,getItemHeightData:$,getoffsetTopIndex:P,totalHeight:O,clientHeight:r.height,scrollTo:X,scrollTop:g,isScrollEnd:f,containerProps:{ref:s,onScroll:()=>{R()},style:ee},wrapperProps:Z,innerProps:k}}const F=Symbol(),D=Symbol(),M=Symbol(),N=Symbol(),z=Symbol(),Q=Symbol(),U=Symbol(),W=Symbol(),q=Symbol();function xe(){const{voidFn:t,boolFn:l,boolRef:n,arrayRef:o}={voidFn:u=>{},boolFn:u=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},i=e.inject(N,o),s=e.inject(M,l),r=e.inject(W,n),f=e.inject(D,t),v=e.inject(F,t),m=e.inject(z,t),p=e.inject(Q,t),g=e.inject(U,t),c=e.inject(q,t);return{selected:i,isSelected:s,isAllSelected:r,toggle:f,toggleAll:v,select:m,selectAll:p,unselect:g,unselectAll:c}}function Pe(t,l){const n=e.ref({}),o=e.computed(()=>t.value.filter(c=>n.value[c[l]])),i=e.computed(()=>o.value.length!=0&&Object.keys(n.value).length==t.value.length);function s(){t.value.forEach(c=>{n.value[c[l]]=!0})}function r(){n.value={}}function f(c){c.forEach(u=>{n.value[u[l]]||(n.value[u[l]]=!0)})}function v(c){c.forEach(u=>{n.value[u[l]]&&delete n.value[u[l]]})}function m(c){return!!n.value[c[l]]}function p(c){c.forEach(u=>{m(u)?delete n.value[u[l]]:n.value[u[l]]=!0})}function g(){i.value?r():s()}return e.provide(F,g),e.provide(D,p),e.provide(M,m),e.provide(N,o),e.provide(z,f),e.provide(Q,s),e.provide(U,v),e.provide(W,i),e.provide(q,r),{selected:o,select:f,selectAll:s,unselect:v,unselectAll:r,toggle:p,toggleAll:g,isSelected:m,isAllSelected:i}}const ue=Symbol(),Ae=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0},dialogClass:{default:""}},emits:["update:visiable"],setup(t,{emit:l}){const n=t,o=()=>{n.closeOnClickOverlay&&l("update:visiable",!1)};return e.provide(ue,()=>l("update:visiable",!1)),(i,s)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[t.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:o,class:"modal absolute inset-0 bottom-0 flex bg-stone-900 bg-opacity-50 z-[999]"},[e.createElementVNode("div",{onClick:s[0]||(s[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog m-auto flex flex-col",t.dialogClass])},[e.renderSlot(i.$slots,"default")],2)])):e.createCommentVNode("",!0)]),_:3}))}});function $e(t){function l(n,o){const i=document.createElement("div"),s={setup(){return()=>e.h(Ae,{visiable:!0,"onUpdate:visiable":()=>{i?.remove()},...t},{default:()=>e.h(n,o)})}};return document.body.appendChild(i),e.render(e.h(s),i),{close:()=>i?.remove()}}return{create:l}}const ke=["xlink:href","fill","color"],Le=e.defineComponent({__name:"SvgIcon",props:{name:null,prefix:{default:"icon"},color:{default:"#FFF"},width:null,height:null},setup(t){const l=t,n=e.computed(()=>`#${l.prefix}-${l.name}`),o=e.computed(()=>({width:`${l.width??l.height}px`,height:`${l.height??l.width}px`,aspectRatio:l.width&&l.height?void 0:"1/1"}));return(i,s)=>(e.openBlock(),e.createElementBlock("svg",{"aria-hidden":"",style:e.normalizeStyle(e.unref(o))},[e.createElementVNode("use",{"xlink:href":e.unref(n),fill:t.color,color:t.color},null,8,ke)],4))}});function je(t){const{containerEl:l,sliderEl:n,autoHeight:o,performance:i={},maxHeightRatio:s=.9}=t,r=e.ref(!0),f=ne(A,100);let v,m="";const p=e.ref(0),g=e.ref(0),c=e.ref(0),u=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),E=e.ref({clientHeight:0}),y=e.computed(()=>!!g.value),Y=e.computed(()=>u.value.scrollHeight>u.value.clientHeight),O=e.computed(()=>u.value.clientHeight-E.value.clientHeight),I=e.computed(()=>u.value.scrollHeight-u.value.clientHeight),C=e.computed(()=>Math.max(u.value.clientHeight/u.value.scrollHeight,.05)),G=e.computed(()=>C.value>s?0:C.value*u.value.clientHeight),R=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${c.value}px,0)`,height:o?`${G.value}px`:void 0}));function x(b){H(),g.value=b.clientY-n.value.getBoundingClientRect().top||1,m=getComputedStyle(l.value).scrollBehavior,m==="smooth"&&(l.value.style.scrollBehavior="unset")}function P(){l.value.style.scrollBehavior=m,g.value=0,f()}function H(){r.value=!1}function A(){y.value||(r.value=!0)}function $(b){if(!y.value)return;let _=b.clientY-u.value.top-g.value;_<0?c.value=0:_>=O.value?c.value=O.value:c.value=_,l.value.scrollTo({top:c.value/O.value*I.value})}function J(){y.value||X()}function X(){cancelAnimationFrame(v),v=requestAnimationFrame(Z)}function Z(){l.value&&(p.value=i.scrollTop?.value??l.value.scrollTop,c.value=p.value/I.value*O.value)}function k(b){let _="addEventListener";b==="add"?_="addEventListener":_="removeEventListener",n.value?.[_]("pointerdown",x,{passive:!0}),window[_]("pointermove",$,{passive:!0}),window[_]("pointerup",P,{passive:!0})}const ee=new MutationObserver(b=>{b.map(L=>L.oldValue).join().includes("height")&&a()});function a(){u.value.top=l.value?.getBoundingClientRect().top??0,u.value.scrollHeight=l.value?.scrollHeight??0,u.value.clientHeight=l.value?.clientHeight??0}function d(){H(),setTimeout(()=>{E.value.clientHeight=n.value?.clientHeight??0,A()},150)}function S(b,_,L="dynamic-styles"){let T=document.getElementById(L);T||(T=document.createElement("style"),T.id=L,document.head.appendChild(T));const fe=T.sheet.cssRules,pe=fe.length,Qe=`${b} { ${_} }`;for(let te=0;te<pe;te++){const he=fe[te];if(he.selectorText===b&&he.style.cssText===_)return}T.sheet.insertRule(Qe,pe)}function w(){l.value&&n.value?(S(".hide-scrollbar","scrollbar-width: none; -ms-overflow-style: none;"),S(".hide-scrollbar::-webkit-scrollbar","display: none"),l.value.addEventListener("scroll",J,{passive:!0}),k("add"),ee.observe(l.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{a()},100),d()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:l,sliderEl:n})}return e.watch(p,()=>{H(),f()}),{isScrollEnd:r,isDragSlider:y,offsetTop:c,scrollTop:p,scrollable:Y,sliderPos:R,init:w,modifySliderEventListener:k}}const Ke=(t=>(e.pushScopeId("data-v-edec7292"),t=t(),e.popScopeId(),t))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),Ve=e.defineComponent({__name:"ScrollBar",props:{containerEl:null,autoHide:{type:Boolean},autoHeight:{type:Boolean},performance:null},setup(t,{expose:l}){const n=t,o=!!e.useSlots().default,i=e.ref(null),s=e.computed(()=>n.containerEl),r=je({containerEl:s,sliderEl:i,autoHeight:o?n.autoHeight:!0,performance:n.performance}),{scrollable:f,isScrollEnd:v,sliderPos:m}=r,p=e.ref(!1),g=n.autoHide?e.computed(()=>p.value||!v.value):e.computed(()=>f.value);e.onMounted(()=>{e.nextTick(()=>{r.init()})}),e.onUnmounted(()=>{r.modifySliderEventListener("remove")});function c(){p.value=!0}function u(){p.value=!1}return l({uScrollBarReturn:r}),(E,y)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"sliderRef",ref:i,class:"slider-wrapper",onMouseenter:c,onMouseleave:u,style:e.normalizeStyle(e.unref(m))},[e.renderSlot(E.$slots,"default",{},()=>[Ke],!0)],36),[[e.vShow,e.unref(g)]])]),_:3}))}}),qe="",de=(t,l)=>{const n=t.__vccOpts||t;for(const[o,i]of l)n[o]=i;return n},Fe=de(Ve,[["__scopeId","data-v-edec7292"]]),De={class:"virtualListWrapper"},Me={inheritAttrs:!1},Ne=e.defineComponent({...Me,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},emits:["scrollEnd"],setup(t,{expose:l,emit:n}){const o=t,i=ce(e.toRef(o,"data"),{itemHeight:p=>o.itemHeight(o.data[p]),overscan:o.overscan,scrollEndHook:()=>{n("scrollEnd")}}),{list:s,containerProps:r,wrapperProps:f,innerProps:v,getItemHeightData:m}=i;return l({vListReturn:i}),(p,g)=>(e.openBlock(),e.createElementBlock("div",De,[e.createElementVNode("div",e.mergeProps({onScrollPassive:g[0]||(g[0]=(...c)=>e.unref(r).onScroll&&e.unref(r).onScroll(...c)),ref:e.unref(r).ref,class:"virtualList"},p.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(f))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(v))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),({index:c,data:u})=>(e.openBlock(),e.createElementBlock("div",{key:c,style:e.normalizeStyle({height:`${e.unref(m)(c).height}px`,display:"flex"})},[e.renderSlot(p.$slots,"default",{data:u,index:c},void 0,!0)],4))),128))],16)],16)],16)]))}}),Ye="",ze=de(Ne,[["__scopeId","data-v-4ba97cce"]]);h.ScrollBar=Fe,h.SvgIcon=Le,h.VirtualList=ze,h.allSelectedKey=N,h.closeDialogKey=ue,h.dialogController=$e,h.isAllSelectedKey=W,h.isSelectedKey=M,h.selectAllKey=Q,h.selectKey=z,h.toggleAllKey=F,h.toggleKey=D,h.unselectAllKey=q,h.unselectKey=U,h.useSelectable=Pe,h.useSelectableInjectors=xe,h.useVirtualList=ce,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(h,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(h=typeof globalThis<"u"?globalThis:h||self,e(h.ui={},h.Vue))})(this,function(h,e){"use strict";var ne;const B=typeof window<"u";B&&((ne=window?.navigator)==null?void 0:ne.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function j(t){return typeof t=="function"?t():e.unref(t)}function me(t,l){function n(...o){t(()=>l.apply(this,o),{fn:l,thisArg:this,args:o})}return n}function ge(t,l={}){let n,o;return s=>{const r=j(t),f=j(l.maxWait);if(n&&clearTimeout(n),r<=0||f!==void 0&&f<=0)return o&&(clearTimeout(o),o=null),s();f&&!o&&(o=setTimeout(()=>{n&&clearTimeout(n),o=null,s()},f)),n=setTimeout(()=>{o&&clearTimeout(o),o=null,s()},r)}}function ve(t){return t}function ye(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function oe(t,l=200,n={}){return me(ge(l,n),t)}function _e(t,l=!0){e.getCurrentInstance()?e.onMounted(t):l?t():e.nextTick(t)}function re(t){var l;const n=j(t);return(l=n?.$el)!=null?l:n}const be=B?window:void 0;B&&window.document,B&&window.navigator,B&&window.location;function we(t,l=!1){const n=e.ref(),o=()=>n.value=Boolean(t());return o(),_e(o,l),n}const K=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},V="__vueuse_ssr_handlers__";K[V]=K[V]||{},K[V];var ie=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,Oe=(t,l)=>{var n={};for(var o in t)Se.call(t,o)&&l.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&ie)for(var o of ie(t))l.indexOf(o)<0&&Ee.call(t,o)&&(n[o]=t[o]);return n};function Te(t,l,n={}){const o=n,{window:i=be}=o,s=Oe(o,["window"]);let r;const f=we(()=>i&&"ResizeObserver"in i),v=()=>{r&&(r.disconnect(),r=void 0)},m=e.watch(()=>re(t),g=>{v(),f.value&&i&&g&&(r=new ResizeObserver(l),r.observe(g,s))},{immediate:!0,flush:"post"}),p=()=>{v(),m()};return ye(p),{isSupported:f,stop:p}}function Be(t,l={width:0,height:0},n={}){const{box:o="content-box"}=n,i=e.ref(l.width),s=e.ref(l.height);return Te(t,([r])=>{const f=o==="border-box"?r.borderBoxSize:o==="content-box"?r.contentBoxSize:r.devicePixelContentBoxSize;f?(i.value=f.reduce((v,{inlineSize:m})=>v+m,0),s.value=f.reduce((v,{blockSize:m})=>v+m,0)):(i.value=r.contentRect.width,s.value=r.contentRect.height)},n),e.watch(()=>re(t),r=>{i.value=r?l.width:0,s.value=r?l.height:0}),{width:i,height:s}}var ae;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(ae||(ae={}));var He=Object.defineProperty,se=Object.getOwnPropertySymbols,Ie=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable,ce=(t,l,n)=>l in t?He(t,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[l]=n,Re=(t,l)=>{for(var n in l||(l={}))Ie.call(l,n)&&ce(t,n,l[n]);if(se)for(var n of se(l))Ce.call(l,n)&&ce(t,n,l[n]);return t};Re({linear:ve},{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 ue(t,l){const{scrollEndHook:n,itemHeight:o,overscan:i=5}=l,s=e.ref(null),r=Be(s),f=e.ref(!0),v=oe(J,100);let m;const p=e.shallowRef(t),g=e.ref(0),c=e.ref({start:0,end:10});let u=0;const E=e.ref([]),y=e.computed(()=>{let{sum:a,height:d}={sum:0,height:0};return p.value.map((S,w)=>(typeof o=="number"?d=o:d=o(w),a+=d,{height:d,sum:a}))}),G=e.computed(()=>A(c.value.start)),O=e.computed(()=>typeof o=="number"?y.value.length*o:y.value[y.value.length-1]?.sum||0),I=e.computed(()=>{let a=E.value.length-i,d=Math.max(a-u,0);return E.value.slice(d,a)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(m)),e.watch([r.width,r.height,p],([a,d])=>{(a||d)&&R()},{deep:!0}),e.watch(g,()=>{C(),v()});function C(){f.value=!1}function J(){f.value=!0,n?.()}function R(){cancelAnimationFrame(m),m=requestAnimationFrame(P)}function P(){if(s.value){g.value=s.value.scrollTop,u=H();let a=x(g.value),d=a+u+i;a=a-i,a=a<0?0:a,d=d>p.value.length?p.value.length:d,c.value={start:a,end:d},E.value=p.value.slice(a,d).map((S,w)=>({data:S,index:w+a}))}}function x(a){let d=0,S=y.value.length-1,w=-1;for(;d<=S;){const _=Math.floor((d+S)/2);y.value[_].sum>=a?(w=_,S=_-1):d=_+1}return Math.max(0,w)}function H(){let a=0,d=0,S=X();for(let w=S;w<y.value.length&&(a++,d+=y.value[w].height,!(d>=r.height.value));w++);return a}function A(a){if(typeof o=="number")return a*o;let d=y.value[a];return d?d.sum-d.height:0}function $(a){return y.value[a]||{sum:0,height:0}}function X(){let a=c.value.start;return a>=i&&(a+=i),a}function Z(a){if(s.value){const d=$(a);s.value.scrollTop=d.sum-d.height,P()}}const ee=e.computed(()=>({style:{width:"100%",height:`${O.value}px`,pointerEvents:f.value?void 0:"none"}})),k=e.computed(()=>({style:{transform:`translate3d(0, ${G.value}px, 0)`,"will-change":"transform"}})),te={overflowY:"auto"};return{list:E,visiableList:I,getItemHeightData:$,getoffsetTopIndex:x,totalHeight:O,clientHeight:r.height,scrollTo:Z,scrollTop:g,isScrollEnd:f,containerProps:{ref:s,onScroll:()=>{R()},style:te},wrapperProps:ee,innerProps:k}}const D=Symbol(),F=Symbol(),M=Symbol(),N=Symbol(),z=Symbol(),Q=Symbol(),U=Symbol(),W=Symbol(),q=Symbol();function Pe(){const{voidFn:t,boolFn:l,boolRef:n,arrayRef:o}={voidFn:u=>{},boolFn:u=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},i=e.inject(N,o),s=e.inject(M,l),r=e.inject(W,n),f=e.inject(F,t),v=e.inject(D,t),m=e.inject(z,t),p=e.inject(Q,t),g=e.inject(U,t),c=e.inject(q,t);return{selected:i,isSelected:s,isAllSelected:r,toggle:f,toggleAll:v,select:m,selectAll:p,unselect:g,unselectAll:c}}function xe(t,l){const n=e.ref({}),o=e.computed(()=>t.value.filter(c=>n.value[c[l]])),i=e.computed(()=>o.value.length!=0&&Object.keys(n.value).length==t.value.length);function s(){t.value.forEach(c=>{n.value[c[l]]=!0})}function r(){n.value={}}function f(c){c.forEach(u=>{n.value[u[l]]||(n.value[u[l]]=!0)})}function v(c){c.forEach(u=>{n.value[u[l]]&&delete n.value[u[l]]})}function m(c){return!!n.value[c[l]]}function p(c){c.forEach(u=>{m(u)?delete n.value[u[l]]:n.value[u[l]]=!0})}function g(){i.value?r():s()}return e.provide(D,g),e.provide(F,p),e.provide(M,m),e.provide(N,o),e.provide(z,f),e.provide(Q,s),e.provide(U,v),e.provide(W,i),e.provide(q,r),{selected:o,select:f,selectAll:s,unselect:v,unselectAll:r,toggle:p,toggleAll:g,isSelected:m,isAllSelected:i}}const de=Symbol(),Ae=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0},dialogClass:{default:""}},emits:["update:visiable"],setup(t,{emit:l}){const n=t,o=()=>{n.closeOnClickOverlay&&l("update:visiable",!1)};return e.provide(de,()=>l("update:visiable",!1)),(i,s)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[t.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:o,class:"modal"},[e.createElementVNode("div",{onClick:s[0]||(s[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog",t.dialogClass])},[e.renderSlot(i.$slots,"default",{},void 0,!0)],2)])):e.createCommentVNode("",!0)]),_:3}))}}),qe="",Y=(t,l)=>{const n=t.__vccOpts||t;for(const[o,i]of l)n[o]=i;return n},$e=Y(Ae,[["__scopeId","data-v-c9f7a6a8"]]);function ke(t){function l(n,o){const i=document.createElement("div"),s={setup(){return()=>e.h($e,{visiable:!0,"onUpdate:visiable":()=>{i?.remove()},...t},{default:()=>e.h(n,o)})}};return document.body.appendChild(i),e.render(e.h(s),i),{close:()=>i?.remove()}}return{create:l}}const Le=["xlink:href","fill","color"],je=e.defineComponent({__name:"SvgIcon",props:{name:null,prefix:{default:"icon"},color:{default:"#FFF"},width:null,height:null},setup(t){const l=t,n=e.computed(()=>`#${l.prefix}-${l.name}`),o=e.computed(()=>({width:`${l.width??l.height}px`,height:`${l.height??l.width}px`,aspectRatio:l.width&&l.height?void 0:"1/1"}));return(i,s)=>(e.openBlock(),e.createElementBlock("svg",{"aria-hidden":"",style:e.normalizeStyle(e.unref(o))},[e.createElementVNode("use",{"xlink:href":e.unref(n),fill:t.color,color:t.color},null,8,Le)],4))}});function Ke(t){const{containerEl:l,sliderEl:n,autoHeight:o,performance:i={},maxHeightRatio:s=.9}=t,r=e.ref(!0),f=oe(A,100);let v,m="";const p=e.ref(0),g=e.ref(0),c=e.ref(0),u=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),E=e.ref({clientHeight:0}),y=e.computed(()=>!!g.value),G=e.computed(()=>u.value.scrollHeight>u.value.clientHeight),O=e.computed(()=>u.value.clientHeight-E.value.clientHeight),I=e.computed(()=>u.value.scrollHeight-u.value.clientHeight),C=e.computed(()=>Math.max(u.value.clientHeight/u.value.scrollHeight,.05)),J=e.computed(()=>C.value>s?0:C.value*u.value.clientHeight),R=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${c.value}px,0)`,height:o?`${J.value}px`:void 0}));function P(_){H(),g.value=_.clientY-n.value.getBoundingClientRect().top||1,m=getComputedStyle(l.value).scrollBehavior,m==="smooth"&&(l.value.style.scrollBehavior="unset")}function x(){l.value.style.scrollBehavior=m,g.value=0,f()}function H(){r.value=!1}function A(){y.value||(r.value=!0)}function $(_){if(!y.value)return;let b=_.clientY-u.value.top-g.value;b<0?c.value=0:b>=O.value?c.value=O.value:c.value=b,l.value.scrollTo({top:c.value/O.value*I.value})}function X(){y.value||Z()}function Z(){cancelAnimationFrame(v),v=requestAnimationFrame(ee)}function ee(){l.value&&(p.value=i.scrollTop?.value??l.value.scrollTop,c.value=p.value/I.value*O.value)}function k(_){let b="addEventListener";_==="add"?b="addEventListener":b="removeEventListener",n.value?.[b]("pointerdown",P,{passive:!0}),window[b]("pointermove",$,{passive:!0}),window[b]("pointerup",x,{passive:!0})}const te=new MutationObserver(_=>{_.map(L=>L.oldValue).join().includes("height")&&a()});function a(){u.value.top=l.value?.getBoundingClientRect().top??0,u.value.scrollHeight=l.value?.scrollHeight??0,u.value.clientHeight=l.value?.clientHeight??0}function d(){H(),setTimeout(()=>{E.value.clientHeight=n.value?.clientHeight??0,A()},150)}function S(_,b,L="dynamic-styles"){let T=document.getElementById(L);T||(T=document.createElement("style"),T.id=L,document.head.appendChild(T));const fe=T.sheet.cssRules,pe=fe.length,Ue=`${_} { ${b} }`;for(let le=0;le<pe;le++){const he=fe[le];if(he.selectorText===_&&he.style.cssText===b)return}T.sheet.insertRule(Ue,pe)}function w(){l.value&&n.value?(S(".hide-scrollbar","scrollbar-width: none; -ms-overflow-style: none;"),S(".hide-scrollbar::-webkit-scrollbar","display: none"),l.value.addEventListener("scroll",X,{passive:!0}),k("add"),te.observe(l.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{a()},100),d()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:l,sliderEl:n})}return e.watch(p,()=>{H(),f()}),{isScrollEnd:r,isDragSlider:y,offsetTop:c,scrollTop:p,scrollable:G,sliderPos:R,init:w,modifySliderEventListener:k}}const Ve=(t=>(e.pushScopeId("data-v-edec7292"),t=t(),e.popScopeId(),t))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),De=e.defineComponent({__name:"ScrollBar",props:{containerEl:null,autoHide:{type:Boolean},autoHeight:{type:Boolean},performance:null},setup(t,{expose:l}){const n=t,o=!!e.useSlots().default,i=e.ref(null),s=e.computed(()=>n.containerEl),r=Ke({containerEl:s,sliderEl:i,autoHeight:o?n.autoHeight:!0,performance:n.performance}),{scrollable:f,isScrollEnd:v,sliderPos:m}=r,p=e.ref(!1),g=n.autoHide?e.computed(()=>p.value||!v.value):e.computed(()=>f.value);e.onMounted(()=>{e.nextTick(()=>{r.init()})}),e.onUnmounted(()=>{r.modifySliderEventListener("remove")});function c(){p.value=!0}function u(){p.value=!1}return l({uScrollBarReturn:r}),(E,y)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"sliderRef",ref:i,class:"slider-wrapper",onMouseenter:c,onMouseleave:u,style:e.normalizeStyle(e.unref(m))},[e.renderSlot(E.$slots,"default",{},()=>[Ve],!0)],36),[[e.vShow,e.unref(g)]])]),_:3}))}}),Ge="",Fe=Y(De,[["__scopeId","data-v-edec7292"]]),Me={class:"virtualListWrapper"},Ne={inheritAttrs:!1},ze=e.defineComponent({...Ne,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},emits:["scrollEnd"],setup(t,{expose:l,emit:n}){const o=t,i=ue(e.toRef(o,"data"),{itemHeight:p=>o.itemHeight(o.data[p]),overscan:o.overscan,scrollEndHook:()=>{n("scrollEnd")}}),{list:s,containerProps:r,wrapperProps:f,innerProps:v,getItemHeightData:m}=i;return l({vListReturn:i}),(p,g)=>(e.openBlock(),e.createElementBlock("div",Me,[e.createElementVNode("div",e.mergeProps({onScrollPassive:g[0]||(g[0]=(...c)=>e.unref(r).onScroll&&e.unref(r).onScroll(...c)),ref:e.unref(r).ref,class:"virtualList"},p.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(f))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(v))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),({index:c,data:u})=>(e.openBlock(),e.createElementBlock("div",{key:c,style:e.normalizeStyle({height:`${e.unref(m)(c).height}px`,display:"flex"})},[e.renderSlot(p.$slots,"default",{data:u,index:c},void 0,!0)],4))),128))],16)],16)],16)]))}}),Je="",Qe=Y(ze,[["__scopeId","data-v-4ba97cce"]]);h.ScrollBar=Fe,h.SvgIcon=je,h.VirtualList=Qe,h.allSelectedKey=N,h.closeDialogKey=de,h.dialogController=ke,h.isAllSelectedKey=W,h.isSelectedKey=M,h.selectAllKey=Q,h.selectKey=z,h.toggleAllKey=D,h.toggleKey=F,h.unselectAllKey=q,h.unselectKey=U,h.useSelectable=xe,h.useSelectableInjectors=Pe,h.useVirtualList=ue,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .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
+ .modal[data-v-c9f7a6a8]{position:absolute;display:flex;inset:0;background-color:#1c1917;z-index:999}.dialog[data-v-c9f7a6a8]{margin:auto;display:flex;flex-direction:column}.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.43",
3
+ "version": "0.0.44",
4
4
  "description": "lazycat ui toolkits",
5
5
  "main": "./dist/index.umd.js",
6
6
  "module": "./dist/index.es.js",