@lazycatcloud/lzc-toolkit 0.0.22 → 0.0.23

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,11 +1,11 @@
1
- import { unref as y, getCurrentScope as He, onScopeDispose as Ie, getCurrentInstance as Te, onMounted as G, nextTick as ae, ref as m, watch as V, shallowRef as Ee, computed as g, onUnmounted as ie, inject as x, provide as O, defineComponent as z, openBlock as E, createBlock as se, Transition as ue, withCtx as ce, createElementBlock as P, createElementVNode as C, withModifiers as Ce, normalizeClass as Be, renderSlot as J, createCommentVNode as Pe, render as Re, h as U, normalizeStyle as X, useSlots as Fe, withDirectives as Ae, vShow as De, pushScopeId as $e, popScopeId as Le, toRef as Ve, mergeProps as ze, normalizeProps as Z, guardReactiveProps as ee, Fragment as Ke, renderList as je } from "vue";
1
+ import { unref as y, getCurrentScope as He, onScopeDispose as Ie, getCurrentInstance as Te, onMounted as G, nextTick as ae, ref as m, watch as V, shallowRef as Ee, computed as g, onUnmounted as ie, inject as x, provide as O, defineComponent as K, openBlock as E, createBlock as se, Transition as ue, withCtx as ce, createElementBlock as P, createElementVNode as C, withModifiers as Ce, normalizeClass as Be, renderSlot as J, createCommentVNode as Pe, render as Re, h as U, normalizeStyle as X, useSlots as Fe, withDirectives as Ae, vShow as De, pushScopeId as $e, popScopeId as Le, toRef as Ve, mergeProps as Ke, normalizeProps as Z, guardReactiveProps as ee, Fragment as je, renderList as ze } from "vue";
2
2
  var te;
3
3
  const R = typeof window < "u";
4
4
  R && ((te = window?.navigator) == null ? void 0 : te.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
5
5
  function L(e) {
6
6
  return typeof e == "function" ? e() : y(e);
7
7
  }
8
- function de(e, l) {
8
+ function fe(e, l) {
9
9
  function t(...n) {
10
10
  e(() => l.apply(this, n), { fn: l, thisArg: this, args: n });
11
11
  }
@@ -24,36 +24,36 @@ function Me(e, l = {}) {
24
24
  }, a);
25
25
  };
26
26
  }
27
- function ke(e, l = !0, t = !0) {
27
+ function Ne(e, l = !0, t = !0) {
28
28
  let n = 0, o, r = !0;
29
29
  const a = () => {
30
30
  o && (clearTimeout(o), o = void 0);
31
31
  };
32
- return (f) => {
32
+ return (d) => {
33
33
  const u = L(e), h = Date.now() - n;
34
34
  if (a(), u <= 0)
35
- return n = Date.now(), f();
36
- h > u && (t || !r) ? (n = Date.now(), f()) : l && (o = setTimeout(() => {
37
- n = Date.now(), r = !0, a(), f();
35
+ return n = Date.now(), d();
36
+ h > u && (t || !r) ? (n = Date.now(), d()) : l && (o = setTimeout(() => {
37
+ n = Date.now(), r = !0, a(), d();
38
38
  }, u)), !t && !o && (o = setTimeout(() => r = !0, u)), r = !1;
39
39
  };
40
40
  }
41
- function Ne(e) {
41
+ function Qe(e) {
42
42
  return e;
43
43
  }
44
- function Qe(e) {
44
+ function ke(e) {
45
45
  return He() ? (Ie(e), !0) : !1;
46
46
  }
47
47
  function We(e, l = 200, t = {}) {
48
- return de(Me(l, t), e);
48
+ return fe(Me(l, t), e);
49
49
  }
50
50
  function Ue(e, l = 200, t = !1, n = !0) {
51
- return de(ke(l, t, n), e);
51
+ return fe(Ne(l, t, n), e);
52
52
  }
53
53
  function qe(e, l = !0) {
54
54
  Te() ? G(e) : l ? e() : ae(e);
55
55
  }
56
- function fe(e) {
56
+ function de(e) {
57
57
  var l;
58
58
  const t = L(e);
59
59
  return (l = t?.$el) != null ? l : t;
@@ -81,14 +81,14 @@ var le = Object.getOwnPropertySymbols, Je = Object.prototype.hasOwnProperty, Xe
81
81
  function et(e, l, t = {}) {
82
82
  const n = t, { window: o = Ye } = n, r = Ze(n, ["window"]);
83
83
  let a;
84
- const c = Ge(() => o && "ResizeObserver" in o), f = () => {
84
+ const c = Ge(() => o && "ResizeObserver" in o), d = () => {
85
85
  a && (a.disconnect(), a = void 0);
86
- }, u = V(() => fe(e), (p) => {
87
- f(), c.value && o && p && (a = new ResizeObserver(l), a.observe(p, r));
86
+ }, u = V(() => de(e), (p) => {
87
+ d(), c.value && o && p && (a = new ResizeObserver(l), a.observe(p, r));
88
88
  }, { immediate: !0, flush: "post" }), h = () => {
89
- f(), u();
89
+ d(), u();
90
90
  };
91
- return Qe(h), {
91
+ return ke(h), {
92
92
  isSupported: c,
93
93
  stop: h
94
94
  };
@@ -97,8 +97,8 @@ function tt(e, l = { width: 0, height: 0 }, t = {}) {
97
97
  const { box: n = "content-box" } = t, o = m(l.width), r = m(l.height);
98
98
  return et(e, ([a]) => {
99
99
  const c = n === "border-box" ? a.borderBoxSize : n === "content-box" ? a.contentBoxSize : a.devicePixelContentBoxSize;
100
- c ? (o.value = c.reduce((f, { inlineSize: u }) => f + u, 0), r.value = c.reduce((f, { blockSize: u }) => f + u, 0)) : (o.value = a.contentRect.width, r.value = a.contentRect.height);
101
- }, t), V(() => fe(e), (a) => {
100
+ c ? (o.value = c.reduce((d, { inlineSize: u }) => d + u, 0), r.value = c.reduce((d, { blockSize: u }) => d + u, 0)) : (o.value = a.contentRect.width, r.value = a.contentRect.height);
101
+ }, t), V(() => de(e), (a) => {
102
102
  o.value = a ? l.width : 0, r.value = a ? l.height : 0;
103
103
  }), {
104
104
  width: o,
@@ -144,25 +144,25 @@ const at = {
144
144
  easeInOutBack: [0.68, -0.6, 0.32, 1.6]
145
145
  };
146
146
  rt({
147
- linear: Ne
147
+ linear: Qe
148
148
  }, at);
149
149
  function it(e, l) {
150
150
  const { itemHeight: t, overscan: n = 5 } = l, o = m(), r = tt(o);
151
151
  let a;
152
- const c = Ee(e), f = m(0), u = m({ start: 0, end: 10 });
152
+ const c = Ee(e), d = m(0), u = m({ start: 0, end: 10 });
153
153
  let h = 0;
154
154
  const p = m([]), s = g(() => {
155
- let { sum: i, height: d } = { sum: 0, height: 0 };
156
- return c.value.map((w, b) => (typeof t == "number" ? d = t : d = t(b), i += d, { height: d, sum: i }));
155
+ let { sum: i, height: f } = { sum: 0, height: 0 };
156
+ return c.value.map((w, b) => (typeof t == "number" ? f = t : f = t(b), i += f, { height: f, sum: i }));
157
157
  }), v = g(() => D(u.value.start)), H = g(() => typeof t == "number" ? s.value.length * t : s.value.at(-1)?.sum || 0), B = g(() => {
158
- let i = p.value.length - n, d = Math.max(i - h, 0);
159
- return p.value.slice(d, i);
158
+ let i = p.value.length - n, f = Math.max(i - h, 0);
159
+ return p.value.slice(f, i);
160
160
  });
161
161
  G(() => {
162
162
  }), ie(() => cancelAnimationFrame(a)), V(
163
163
  [r.width, r.height, c],
164
- ([i, d]) => {
165
- (i || d) && F();
164
+ ([i, f]) => {
165
+ (i || f) && F();
166
166
  },
167
167
  { deep: !0 }
168
168
  );
@@ -171,24 +171,24 @@ function it(e, l) {
171
171
  }
172
172
  function I() {
173
173
  if (o.value) {
174
- f.value = o.value.scrollTop, h = K();
175
- let i = A(f.value), d = i + h + n;
176
- i = i - n, i = i < 0 ? 0 : i, d = d > c.value.length ? c.value.length : d, u.value = { start: i, end: d }, p.value = c.value.slice(i, d).map((w, b) => ({
174
+ d.value = o.value.scrollTop, h = j();
175
+ let i = A(d.value), f = i + h + n;
176
+ i = i - n, i = i < 0 ? 0 : i, f = f > c.value.length ? c.value.length : f, u.value = { start: i, end: f }, p.value = c.value.slice(i, f).map((w, b) => ({
177
177
  data: w,
178
178
  index: b + i
179
179
  }));
180
180
  }
181
181
  }
182
182
  function A(i) {
183
- let d = Math.floor(s.value.length / 16), w = -1, b = -1;
183
+ let f = Math.floor(s.value.length / 16), w = -1, b = -1;
184
184
  for (let _ = 0; _ < 16; _++) {
185
- if (s.value.at(d * _).sum >= i) {
185
+ if (s.value.at(f * _).sum >= i) {
186
186
  w = Math.max(0, _ - 1);
187
187
  break;
188
188
  }
189
189
  _ === 15 && (w = _);
190
190
  }
191
- w *= d;
191
+ w *= f;
192
192
  for (let _ = w; _ < s.value.length; _++)
193
193
  if (s.value[_].sum >= i) {
194
194
  b = _;
@@ -196,42 +196,42 @@ function it(e, l) {
196
196
  }
197
197
  return Math.max(0, b);
198
198
  }
199
- function K() {
200
- let i = 0, d = 0, w = j();
201
- for (let b = w; b < s.value.length && (d += s.value[b].height, !(d >= r.height.value)); b++, i++)
199
+ function j() {
200
+ let i = 0, f = 0, w = z();
201
+ for (let b = w; b < s.value.length && (i++, f += s.value[b].height, !(f >= r.height.value)); b++)
202
202
  ;
203
203
  return i;
204
204
  }
205
205
  function D(i) {
206
206
  if (typeof t == "number")
207
207
  return i * t;
208
- let d = s.value[i];
209
- return d.sum - d.height;
208
+ let f = s.value[i];
209
+ return f.sum - f.height;
210
210
  }
211
211
  function $(i) {
212
212
  return s.value.at(i) || { sum: 0, height: 0 };
213
213
  }
214
- function j() {
214
+ function z() {
215
215
  let i = u.value.start;
216
216
  return i >= n && (i += n), i;
217
217
  }
218
218
  function M(i) {
219
219
  if (o.value) {
220
- const d = $(i);
221
- o.value.scrollTop = d.sum - d.height, I();
220
+ const f = $(i);
221
+ o.value.scrollTop = f.sum - f.height, I();
222
222
  }
223
223
  }
224
- const k = g(() => ({
224
+ const N = g(() => ({
225
225
  style: {
226
226
  width: "100%",
227
227
  height: `${H.value}px`
228
228
  }
229
- })), N = g(() => ({
229
+ })), Q = g(() => ({
230
230
  style: {
231
231
  transform: `translate3d(0, ${v.value}px, 0)`,
232
232
  "will-change": "transform"
233
233
  }
234
- })), Q = {
234
+ })), k = {
235
235
  overflowY: "auto"
236
236
  };
237
237
  return {
@@ -241,16 +241,16 @@ function it(e, l) {
241
241
  totalHeight: H,
242
242
  clientHeight: r.height,
243
243
  scrollTo: M,
244
- scrollTop: f,
244
+ scrollTop: d,
245
245
  containerProps: {
246
246
  ref: o,
247
247
  onScroll: () => {
248
248
  F();
249
249
  },
250
- style: Q
250
+ style: k
251
251
  },
252
- wrapperProps: k,
253
- innerProps: N
252
+ wrapperProps: N,
253
+ innerProps: Q
254
254
  };
255
255
  }
256
256
  const ve = Symbol(), pe = Symbol(), he = Symbol(), ge = Symbol(), me = Symbol(), be = Symbol(), _e = Symbol(), ye = Symbol(), we = Symbol();
@@ -261,13 +261,13 @@ function _t() {
261
261
  boolFn: (v) => !1,
262
262
  boolRef: g(() => !1),
263
263
  arrayRef: g(() => [])
264
- }, o = x(ge, n), r = x(he, l), a = x(ye, t), c = x(pe, e), f = x(ve, e), u = x(me, e), h = x(be, e), p = x(_e, e), s = x(we, e);
264
+ }, o = x(ge, n), r = x(he, l), a = x(ye, t), c = x(pe, e), d = x(ve, e), u = x(me, e), h = x(be, e), p = x(_e, e), s = x(we, e);
265
265
  return {
266
266
  selected: o,
267
267
  isSelected: r,
268
268
  isAllSelected: a,
269
269
  toggle: c,
270
- toggleAll: f,
270
+ toggleAll: d,
271
271
  select: u,
272
272
  selectAll: h,
273
273
  unselect: p,
@@ -289,7 +289,7 @@ function yt(e, l) {
289
289
  t.value[v[l]] || (t.value[v[l]] = !0);
290
290
  });
291
291
  }
292
- function f(s) {
292
+ function d(s) {
293
293
  s.forEach((v) => {
294
294
  t.value[v[l]] && delete t.value[v[l]];
295
295
  });
@@ -305,11 +305,11 @@ function yt(e, l) {
305
305
  function p() {
306
306
  o.value ? a() : r();
307
307
  }
308
- return O(ve, p), O(pe, h), O(he, u), O(ge, n), O(me, c), O(be, r), O(_e, f), O(ye, o), O(we, a), {
308
+ return O(ve, p), O(pe, h), O(he, u), O(ge, n), O(me, c), O(be, r), O(_e, d), O(ye, o), O(we, a), {
309
309
  selected: n,
310
310
  select: c,
311
311
  selectAll: r,
312
- unselect: f,
312
+ unselect: d,
313
313
  unselectAll: a,
314
314
  toggle: h,
315
315
  toggleAll: p,
@@ -317,7 +317,7 @@ function yt(e, l) {
317
317
  isAllSelected: o
318
318
  };
319
319
  }
320
- const st = Symbol(), ut = /* @__PURE__ */ z({
320
+ const st = Symbol(), ut = /* @__PURE__ */ K({
321
321
  __name: "Dialog",
322
322
  props: {
323
323
  visiable: { type: Boolean, default: !1 },
@@ -376,7 +376,7 @@ function wt(e) {
376
376
  create: l
377
377
  };
378
378
  }
379
- const ct = ["xlink:href", "fill", "color"], St = /* @__PURE__ */ z({
379
+ const ct = ["xlink:href", "fill", "color"], St = /* @__PURE__ */ K({
380
380
  __name: "SvgIcon",
381
381
  props: {
382
382
  name: null,
@@ -403,9 +403,9 @@ const ct = ["xlink:href", "fill", "color"], St = /* @__PURE__ */ z({
403
403
  ], 4));
404
404
  }
405
405
  });
406
- function dt(e) {
407
- const { containerEl: l, sliderEl: t, autoHeight: n, performance: o = {} } = e, r = m(!0), a = We(N, 1e3), c = Ue(W, 1e3, !0, !0);
408
- let f, u = "";
406
+ function ft(e) {
407
+ const { containerEl: l, sliderEl: t, autoHeight: n, performance: o = {} } = e, r = m(!0), a = We(Q, 1e3), c = Ue(W, 1e3, !0, !0);
408
+ let d, u = "";
409
409
  const h = m(0), p = m(0), s = m(0), v = m({
410
410
  top: 0,
411
411
  scrollTop: 0,
@@ -413,27 +413,27 @@ function dt(e) {
413
413
  clientHeight: 0
414
414
  }), H = m({
415
415
  clientHeight: 0
416
- }), B = g(() => !!p.value), F = g(() => v.value.scrollHeight > v.value.clientHeight), I = g(() => v.value.clientHeight - H.value.clientHeight), A = g(() => v.value.scrollHeight - v.value.clientHeight), K = g(() => Math.max(
416
+ }), B = g(() => !!p.value), F = g(() => v.value.scrollHeight > v.value.clientHeight), I = g(() => v.value.clientHeight - H.value.clientHeight), A = g(() => v.value.scrollHeight - v.value.clientHeight), j = g(() => Math.max(
417
417
  v.value.clientHeight / v.value.scrollHeight,
418
418
  0.05
419
- )), D = g(() => K.value * v.value.clientHeight), $ = g(() => ({
419
+ )), D = g(() => j.value * v.value.clientHeight), $ = g(() => ({
420
420
  willChange: "transform",
421
421
  transform: `translate3d(0,${s.value}px,0)`,
422
422
  height: n ? `${D.value}px` : void 0
423
423
  }));
424
- function j(T) {
424
+ function z(T) {
425
425
  p.value = T.clientY - t.value.getBoundingClientRect().top || 1, u = getComputedStyle(l.value).scrollBehavior, u === "smooth" && (l.value.style.scrollBehavior = "unset");
426
426
  }
427
427
  function M() {
428
428
  l.value.style.scrollBehavior = u, p.value = 0, a();
429
429
  }
430
- function k() {
430
+ function N() {
431
431
  r.value = !1;
432
432
  }
433
- function N() {
433
+ function Q() {
434
434
  B.value || (r.value = !0);
435
435
  }
436
- function Q(T) {
436
+ function k(T) {
437
437
  if (!B.value)
438
438
  return;
439
439
  let S = T.clientY - v.value.top - p.value;
@@ -442,19 +442,19 @@ function dt(e) {
442
442
  });
443
443
  }
444
444
  function i() {
445
- B.value || d();
445
+ B.value || f();
446
446
  }
447
- function d() {
448
- cancelAnimationFrame(f), f = requestAnimationFrame(w);
447
+ function f() {
448
+ cancelAnimationFrame(d), d = requestAnimationFrame(w);
449
449
  }
450
450
  function w() {
451
451
  l.value && (h.value = o.scrollTop?.value ?? l.value.scrollTop, s.value = h.value / A.value * I.value);
452
452
  }
453
453
  function b(T) {
454
454
  let S = "addEventListener";
455
- T === "add" ? S = "addEventListener" : S = "removeEventListener", t.value?.[S]("pointerdown", j, {
455
+ T === "add" ? S = "addEventListener" : S = "removeEventListener", t.value?.[S]("pointerdown", z, {
456
456
  passive: !0
457
- }), window[S]("pointermove", Q, { passive: !0 }), window[S]("pointerup", M, { passive: !0 });
457
+ }), window[S]("pointermove", k, { passive: !0 }), window[S]("pointerup", M, { passive: !0 });
458
458
  }
459
459
  const _ = new MutationObserver((T) => {
460
460
  T.map((xe) => xe.oldValue).join().includes("height") ? W() : H.value.clientHeight === 0 && c();
@@ -474,7 +474,7 @@ function dt(e) {
474
474
  }, 100)) : console.error("useScrollBar:", "\u521D\u59CB\u5316\u5931\u8D25!", { containerEl: l, sliderEl: t });
475
475
  }
476
476
  return V(h, () => {
477
- k(), a();
477
+ N(), a();
478
478
  }), {
479
479
  isScrollEnd: r,
480
480
  isDragSlider: B,
@@ -484,13 +484,7 @@ function dt(e) {
484
484
  modifySliderEventListener: b
485
485
  };
486
486
  }
487
- const ft = (e) => ($e("data-v-d564e88d"), e = e(), Le(), e), vt = /* @__PURE__ */ ft(() => /* @__PURE__ */ C("div", {
488
- w: "6px",
489
- h: "full",
490
- bg: "black/20",
491
- rounded: "3px",
492
- mr: "3px"
493
- }, null, -1)), pt = /* @__PURE__ */ z({
487
+ const dt = (e) => ($e("data-v-9645dfb5"), e = e(), Le(), e), vt = /* @__PURE__ */ dt(() => /* @__PURE__ */ C("div", { class: "default-slider" }, null, -1)), pt = /* @__PURE__ */ K({
494
488
  __name: "ScrollBar",
495
489
  props: {
496
490
  containerEl: null,
@@ -499,12 +493,12 @@ const ft = (e) => ($e("data-v-d564e88d"), e = e(), Le(), e), vt = /* @__PURE__ *
499
493
  performance: null
500
494
  },
501
495
  setup(e, { expose: l }) {
502
- const t = e, n = !!Fe().default, o = m(null), r = g(() => t.containerEl), a = dt({
496
+ const t = e, n = !!Fe().default, o = m(null), r = g(() => t.containerEl), a = ft({
503
497
  containerEl: r,
504
498
  sliderEl: o,
505
499
  autoHeight: n ? t.autoHeight : !0,
506
500
  performance: t.performance
507
- }), { scrollable: c, isScrollEnd: f, sliderPos: u } = a, h = t.autoHide ? g(() => !f.value) : g(() => c.value);
501
+ }), { scrollable: c, isScrollEnd: d, sliderPos: u } = a, h = t.autoHide ? g(() => !d.value) : g(() => c.value);
508
502
  return G(() => {
509
503
  ae(() => {
510
504
  a.init();
@@ -516,8 +510,8 @@ const ft = (e) => ($e("data-v-d564e88d"), e = e(), Le(), e), vt = /* @__PURE__ *
516
510
  Ae(C("div", {
517
511
  ref_key: "sliderRef",
518
512
  ref: o,
519
- class: "z-100 absolute right-0",
520
- style: X([{ "touch-action": "none" }, y(u)])
513
+ class: "slider-wrapper",
514
+ style: X(y(u))
521
515
  }, [
522
516
  J(p.$slots, "default", {}, () => [
523
517
  vt
@@ -535,9 +529,9 @@ const Se = (e, l) => {
535
529
  for (const [n, o] of l)
536
530
  t[n] = o;
537
531
  return t;
538
- }, Ot = /* @__PURE__ */ Se(pt, [["__scopeId", "data-v-d564e88d"]]), ht = { class: "virtualListWrapper" }, gt = {
532
+ }, Ot = /* @__PURE__ */ Se(pt, [["__scopeId", "data-v-9645dfb5"]]), ht = { class: "virtualListWrapper" }, gt = {
539
533
  inheritAttrs: !1
540
- }, mt = /* @__PURE__ */ z({
534
+ }, mt = /* @__PURE__ */ K({
541
535
  ...gt,
542
536
  __name: "VirtualList",
543
537
  props: {
@@ -549,21 +543,21 @@ const Se = (e, l) => {
549
543
  const t = e, n = it(Ve(t, "data"), {
550
544
  itemHeight: (u) => t.itemHeight(t.data[u]),
551
545
  overscan: t.overscan
552
- }), { list: o, containerProps: r, wrapperProps: a, innerProps: c, getItemHeightData: f } = n;
546
+ }), { list: o, containerProps: r, wrapperProps: a, innerProps: c, getItemHeightData: d } = n;
553
547
  return l({
554
548
  vListReturn: n
555
549
  }), (u, h) => (E(), P("div", ht, [
556
- C("div", ze({
550
+ C("div", Ke({
557
551
  onScrollPassive: h[0] || (h[0] = (...p) => y(r).onScroll && y(r).onScroll(...p)),
558
552
  ref: y(r).ref,
559
553
  class: "virtualList"
560
554
  }, u.$attrs), [
561
555
  C("div", Z(ee(y(a))), [
562
556
  C("div", Z(ee(y(c))), [
563
- (E(!0), P(Ke, null, je(y(o), ({ index: p, data: s }) => (E(), P("div", {
557
+ (E(!0), P(je, null, ze(y(o), ({ index: p, data: s }) => (E(), P("div", {
564
558
  key: p,
565
559
  style: X({
566
- height: `${y(f)(p).height}px`,
560
+ height: `${y(d)(p).height}px`,
567
561
  display: "flex"
568
562
  })
569
563
  }, [
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(g,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(g=typeof globalThis<"u"?globalThis:g||self,e(g.ui={},g.Vue))})(this,function(g,e){"use strict";var G;const I=typeof window<"u";I&&((G=window?.navigator)==null?void 0:G.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function B(t){return typeof t=="function"?t():e.unref(t)}function J(t,l){function n(...o){t(()=>l.apply(this,o),{fn:l,thisArg:this,args:o})}return n}function ie(t,l={}){let n,o;return i=>{const a=B(t),d=B(l.maxWait);if(n&&clearTimeout(n),a<=0||d!==void 0&&d<=0)return o&&(clearTimeout(o),o=null),i();d&&!o&&(o=setTimeout(()=>{n&&clearTimeout(n),o=null,i()},d)),n=setTimeout(()=>{o&&clearTimeout(o),o=null,i()},a)}}function ae(t,l=!0,n=!0){let o=0,r,i=!0;const a=()=>{r&&(clearTimeout(r),r=void 0)};return p=>{const u=B(t),v=Date.now()-o;if(a(),u<=0)return o=Date.now(),p();v>u&&(n||!i)?(o=Date.now(),p()):l&&(r=setTimeout(()=>{o=Date.now(),i=!0,a(),p()},u)),!n&&!r&&(r=setTimeout(()=>i=!0,u)),i=!1}}function se(t){return t}function ce(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function ue(t,l=200,n={}){return J(ie(l,n),t)}function de(t,l=200,n=!1,o=!0){return J(ae(l,n,o),t)}function fe(t,l=!0){e.getCurrentInstance()?e.onMounted(t):l?t():e.nextTick(t)}function X(t){var l;const n=B(t);return(l=n?.$el)!=null?l:n}const pe=I?window:void 0;I&&window.document,I&&window.navigator,I&&window.location;function he(t,l=!1){const n=e.ref(),o=()=>n.value=Boolean(t());return o(),fe(o,l),n}const R=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},A="__vueuse_ssr_handlers__";R[A]=R[A]||{},R[A];var Z=Object.getOwnPropertySymbols,me=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable,ve=(t,l)=>{var n={};for(var o in t)me.call(t,o)&&l.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&Z)for(var o of Z(t))l.indexOf(o)<0&&ge.call(t,o)&&(n[o]=t[o]);return n};function be(t,l,n={}){const o=n,{window:r=pe}=o,i=ve(o,["window"]);let a;const d=he(()=>r&&"ResizeObserver"in r),p=()=>{a&&(a.disconnect(),a=void 0)},u=e.watch(()=>X(t),m=>{p(),d.value&&r&&m&&(a=new ResizeObserver(l),a.observe(m,i))},{immediate:!0,flush:"post"}),v=()=>{p(),u()};return ce(v),{isSupported:d,stop:v}}function ye(t,l={width:0,height:0},n={}){const{box:o="content-box"}=n,r=e.ref(l.width),i=e.ref(l.height);return be(t,([a])=>{const d=o==="border-box"?a.borderBoxSize:o==="content-box"?a.contentBoxSize:a.devicePixelContentBoxSize;d?(r.value=d.reduce((p,{inlineSize:u})=>p+u,0),i.value=d.reduce((p,{blockSize:u})=>p+u,0)):(r.value=a.contentRect.width,i.value=a.contentRect.height)},n),e.watch(()=>X(t),a=>{r.value=a?l.width:0,i.value=a?l.height:0}),{width:r,height:i}}var ee;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(ee||(ee={}));var _e=Object.defineProperty,te=Object.getOwnPropertySymbols,we=Object.prototype.hasOwnProperty,Se=Object.prototype.propertyIsEnumerable,ne=(t,l,n)=>l in t?_e(t,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[l]=n,Oe=(t,l)=>{for(var n in l||(l={}))we.call(l,n)&&ne(t,n,l[n]);if(te)for(var n of te(l))Se.call(l,n)&&ne(t,n,l[n]);return t};Oe({linear:se},{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 le(t,l){const{itemHeight:n,overscan:o=5}=l,r=e.ref(),i=ye(r);let a;const d=e.shallowRef(t),p=e.ref(0),u=e.ref({start:0,end:10});let v=0;const m=e.ref([]),c=e.computed(()=>{let{sum:s,height:f}={sum:0,height:0};return d.value.map((_,b)=>(typeof n=="number"?f=n:f=n(b),s+=f,{height:f,sum:s}))}),h=e.computed(()=>x(u.value.start)),S=e.computed(()=>typeof n=="number"?c.value.length*n:c.value.at(-1)?.sum||0),T=e.computed(()=>{let s=m.value.length-o,f=Math.max(s-v,0);return m.value.slice(f,s)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(a)),e.watch([i.width,i.height,d],([s,f])=>{(s||f)&&H()},{deep:!0});function H(){cancelAnimationFrame(a),a=requestAnimationFrame(O)}function O(){if(r.value){p.value=r.value.scrollTop,v=z();let s=C(p.value),f=s+v+o;s=s-o,s=s<0?0:s,f=f>d.value.length?d.value.length:f,u.value={start:s,end:f},m.value=d.value.slice(s,f).map((_,b)=>({data:_,index:b+s}))}}function C(s){let f=Math.floor(c.value.length/16),_=-1,b=-1;for(let y=0;y<16;y++){if(c.value.at(f*y).sum>=s){_=Math.max(0,y-1);break}y===15&&(_=y)}_*=f;for(let y=_;y<c.value.length;y++)if(c.value[y].sum>=s){b=y;break}return Math.max(0,b)}function z(){let s=0,f=0,_=M();for(let b=_;b<c.value.length&&(f+=c.value[b].height,!(f>=i.height.value));b++,s++);return s}function x(s){if(typeof n=="number")return s*n;let f=c.value[s];return f.sum-f.height}function P(s){return c.value.at(s)||{sum:0,height:0}}function M(){let s=u.value.start;return s>=o&&(s+=o),s}function Q(s){if(r.value){const f=P(s);r.value.scrollTop=f.sum-f.height,O()}}const U=e.computed(()=>({style:{width:"100%",height:`${S.value}px`}})),W=e.computed(()=>({style:{transform:`translate3d(0, ${h.value}px, 0)`,"will-change":"transform"}})),q={overflowY:"auto"};return{list:m,visiableList:T,getItemHeightData:P,totalHeight:S,clientHeight:i.height,scrollTo:Q,scrollTop:p,containerProps:{ref:r,onScroll:()=>{H()},style:q},wrapperProps:U,innerProps:W}}const D=Symbol(),F=Symbol(),L=Symbol(),j=Symbol(),k=Symbol(),K=Symbol(),V=Symbol(),$=Symbol(),N=Symbol();function Ee(){const{voidFn:t,boolFn:l,boolRef:n,arrayRef:o}={voidFn:h=>{},boolFn:h=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},r=e.inject(j,o),i=e.inject(L,l),a=e.inject($,n),d=e.inject(F,t),p=e.inject(D,t),u=e.inject(k,t),v=e.inject(K,t),m=e.inject(V,t),c=e.inject(N,t);return{selected:r,isSelected:i,isAllSelected:a,toggle:d,toggleAll:p,select:u,selectAll:v,unselect:m,unselectAll:c}}function Te(t,l){const n=e.ref({}),o=e.computed(()=>t.value.filter(c=>n.value[c[l]])),r=e.computed(()=>o.value.length!=0&&Object.keys(n.value).length==t.value.length);function i(){t.value.forEach(c=>{n.value[c[l]]=!0})}function a(){n.value={}}function d(c){c.forEach(h=>{n.value[h[l]]||(n.value[h[l]]=!0)})}function p(c){c.forEach(h=>{n.value[h[l]]&&delete n.value[h[l]]})}function u(c){return!!n.value[c[l]]}function v(c){c.forEach(h=>{u(h)?delete n.value[h[l]]:n.value[h[l]]=!0})}function m(){r.value?a():i()}return e.provide(D,m),e.provide(F,v),e.provide(L,u),e.provide(j,o),e.provide(k,d),e.provide(K,i),e.provide(V,p),e.provide($,r),e.provide(N,a),{selected:o,select:d,selectAll:i,unselect:p,unselectAll:a,toggle:v,toggleAll:m,isSelected:u,isAllSelected:r}}const oe=Symbol(),Ie=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(oe,()=>l("update:visiable",!1)),(r,i)=>(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 z-50 flex bg-stone-900 bg-opacity-50"},[e.createElementVNode("div",{onClick:i[0]||(i[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog m-auto flex flex-col",t.dialogClass])},[e.renderSlot(r.$slots,"default")],2)])):e.createCommentVNode("",!0)]),_:3}))}});function Be(t){function l(n,o){const r=document.createElement("div"),i={setup(){return()=>e.h(Ie,{visiable:!0,"onUpdate:visiable":()=>{r?.remove()},...t},{default:()=>e.h(n,o)})}};return document.body.appendChild(r),e.render(e.h(i),r),{close:()=>r?.remove()}}return{create:l}}const He=["xlink:href","fill","color"],Ce=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,height:l.height,aspectRatio:l.width&&l.height?void 0:"1/1"}));return(r,i)=>(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,He)],4))}});function xe(t){const{containerEl:l,sliderEl:n,autoHeight:o,performance:r={}}=t,i=e.ref(!0),a=ue(W,1e3),d=de(Y,1e3,!0,!0);let p,u="";const v=e.ref(0),m=e.ref(0),c=e.ref(0),h=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),S=e.ref({clientHeight:0}),T=e.computed(()=>!!m.value),H=e.computed(()=>h.value.scrollHeight>h.value.clientHeight),O=e.computed(()=>h.value.clientHeight-S.value.clientHeight),C=e.computed(()=>h.value.scrollHeight-h.value.clientHeight),z=e.computed(()=>Math.max(h.value.clientHeight/h.value.scrollHeight,.05)),x=e.computed(()=>z.value*h.value.clientHeight),P=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${c.value}px,0)`,height:o?`${x.value}px`:void 0}));function M(E){m.value=E.clientY-n.value.getBoundingClientRect().top||1,u=getComputedStyle(l.value).scrollBehavior,u==="smooth"&&(l.value.style.scrollBehavior="unset")}function Q(){l.value.style.scrollBehavior=u,m.value=0,a()}function U(){i.value=!1}function W(){T.value||(i.value=!0)}function q(E){if(!T.value)return;let w=E.clientY-h.value.top-m.value;w<0?c.value=0:w>=O.value?c.value=O.value:c.value=w,l.value.scrollTo({top:c.value/O.value*C.value})}function s(){T.value||f()}function f(){cancelAnimationFrame(p),p=requestAnimationFrame(_)}function _(){l.value&&(v.value=r.scrollTop?.value??l.value.scrollTop,c.value=v.value/C.value*O.value)}function b(E){let w="addEventListener";E==="add"?w="addEventListener":w="removeEventListener",n.value?.[w]("pointerdown",M,{passive:!0}),window[w]("pointermove",q,{passive:!0}),window[w]("pointerup",Q,{passive:!0})}const y=new MutationObserver(E=>{E.map(Ke=>Ke.oldValue).join().includes("height")?Y():S.value.clientHeight===0&&d()});function Y(){h.value.top=l.value?.getBoundingClientRect().top??0,h.value.scrollHeight=l.value?.scrollHeight??0,h.value.clientHeight=l.value?.clientHeight??0,o?S.value.clientHeight=x.value:S.value.clientHeight=n.value?.clientHeight??0}function ke(){l.value&&n.value?(l.value.addEventListener("scroll",s,{passive:!0}),b("add"),y.observe(l.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{Y()},100)):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:l,sliderEl:n})}return e.watch(v,()=>{U(),a()}),{isScrollEnd:i,isDragSlider:T,scrollable:H,sliderPos:P,init:ke,modifySliderEventListener:b}}const Pe=(t=>(e.pushScopeId("data-v-d564e88d"),t=t(),e.popScopeId(),t))(()=>e.createElementVNode("div",{w:"6px",h:"full",bg:"black/20",rounded:"3px",mr:"3px"},null,-1)),Re=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,r=e.ref(null),i=e.computed(()=>n.containerEl),a=xe({containerEl:i,sliderEl:r,autoHeight:o?n.autoHeight:!0,performance:n.performance}),{scrollable:d,isScrollEnd:p,sliderPos:u}=a,v=n.autoHide?e.computed(()=>!p.value):e.computed(()=>d.value);return e.onMounted(()=>{e.nextTick(()=>{a.init()})}),e.onUnmounted(()=>{a.modifySliderEventListener("remove")}),l({uScrollBarReturn:a}),(m,c)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"sliderRef",ref:r,class:"z-100 absolute right-0",style:e.normalizeStyle([{"touch-action":"none"},e.unref(u)])},[e.renderSlot(m.$slots,"default",{},()=>[Pe],!0)],4),[[e.vShow,e.unref(v)]])]),_:3}))}}),Ne="",re=(t,l)=>{const n=t.__vccOpts||t;for(const[o,r]of l)n[o]=r;return n},Ae=re(Re,[["__scopeId","data-v-d564e88d"]]),De={class:"virtualListWrapper"},Fe={inheritAttrs:!1},Le=e.defineComponent({...Fe,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},setup(t,{expose:l}){const n=t,o=le(e.toRef(n,"data"),{itemHeight:u=>n.itemHeight(n.data[u]),overscan:n.overscan}),{list:r,containerProps:i,wrapperProps:a,innerProps:d,getItemHeightData:p}=o;return l({vListReturn:o}),(u,v)=>(e.openBlock(),e.createElementBlock("div",De,[e.createElementVNode("div",e.mergeProps({onScrollPassive:v[0]||(v[0]=(...m)=>e.unref(i).onScroll&&e.unref(i).onScroll(...m)),ref:e.unref(i).ref,class:"virtualList"},u.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(a))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(d))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),({index:m,data:c})=>(e.openBlock(),e.createElementBlock("div",{key:m,style:e.normalizeStyle({height:`${e.unref(p)(m).height}px`,display:"flex"})},[e.renderSlot(u.$slots,"default",{data:c,index:m},void 0,!0)],4))),128))],16)],16)],16)]))}}),ze="",je=re(Le,[["__scopeId","data-v-134ad8ab"]]);g.ScrollBar=Ae,g.SvgIcon=Ce,g.VirtualList=je,g.allSelectedKey=j,g.closeDialogKey=oe,g.dialogController=Be,g.isAllSelectedKey=$,g.isSelectedKey=L,g.selectAllKey=K,g.selectKey=k,g.toggleAllKey=D,g.toggleKey=F,g.unselectAllKey=N,g.unselectKey=V,g.useSelectable=Te,g.useSelectableInjectors=Ee,g.useVirtualList=le,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(g,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(g=typeof globalThis<"u"?globalThis:g||self,e(g.ui={},g.Vue))})(this,function(g,e){"use strict";var G;const I=typeof window<"u";I&&((G=window?.navigator)==null?void 0:G.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function B(t){return typeof t=="function"?t():e.unref(t)}function J(t,n){function l(...o){t(()=>n.apply(this,o),{fn:n,thisArg:this,args:o})}return l}function ie(t,n={}){let l,o;return i=>{const a=B(t),d=B(n.maxWait);if(l&&clearTimeout(l),a<=0||d!==void 0&&d<=0)return o&&(clearTimeout(o),o=null),i();d&&!o&&(o=setTimeout(()=>{l&&clearTimeout(l),o=null,i()},d)),l=setTimeout(()=>{o&&clearTimeout(o),o=null,i()},a)}}function ae(t,n=!0,l=!0){let o=0,r,i=!0;const a=()=>{r&&(clearTimeout(r),r=void 0)};return p=>{const u=B(t),v=Date.now()-o;if(a(),u<=0)return o=Date.now(),p();v>u&&(l||!i)?(o=Date.now(),p()):n&&(r=setTimeout(()=>{o=Date.now(),i=!0,a(),p()},u)),!l&&!r&&(r=setTimeout(()=>i=!0,u)),i=!1}}function se(t){return t}function ce(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function ue(t,n=200,l={}){return J(ie(n,l),t)}function de(t,n=200,l=!1,o=!0){return J(ae(n,l,o),t)}function fe(t,n=!0){e.getCurrentInstance()?e.onMounted(t):n?t():e.nextTick(t)}function X(t){var n;const l=B(t);return(n=l?.$el)!=null?n:l}const pe=I?window:void 0;I&&window.document,I&&window.navigator,I&&window.location;function he(t,n=!1){const l=e.ref(),o=()=>l.value=Boolean(t());return o(),fe(o,n),l}const R=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},A="__vueuse_ssr_handlers__";R[A]=R[A]||{},R[A];var Z=Object.getOwnPropertySymbols,me=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable,ve=(t,n)=>{var l={};for(var o in t)me.call(t,o)&&n.indexOf(o)<0&&(l[o]=t[o]);if(t!=null&&Z)for(var o of Z(t))n.indexOf(o)<0&&ge.call(t,o)&&(l[o]=t[o]);return l};function be(t,n,l={}){const o=l,{window:r=pe}=o,i=ve(o,["window"]);let a;const d=he(()=>r&&"ResizeObserver"in r),p=()=>{a&&(a.disconnect(),a=void 0)},u=e.watch(()=>X(t),m=>{p(),d.value&&r&&m&&(a=new ResizeObserver(n),a.observe(m,i))},{immediate:!0,flush:"post"}),v=()=>{p(),u()};return ce(v),{isSupported:d,stop:v}}function ye(t,n={width:0,height:0},l={}){const{box:o="content-box"}=l,r=e.ref(n.width),i=e.ref(n.height);return be(t,([a])=>{const d=o==="border-box"?a.borderBoxSize:o==="content-box"?a.contentBoxSize:a.devicePixelContentBoxSize;d?(r.value=d.reduce((p,{inlineSize:u})=>p+u,0),i.value=d.reduce((p,{blockSize:u})=>p+u,0)):(r.value=a.contentRect.width,i.value=a.contentRect.height)},l),e.watch(()=>X(t),a=>{r.value=a?n.width:0,i.value=a?n.height:0}),{width:r,height:i}}var ee;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(ee||(ee={}));var _e=Object.defineProperty,te=Object.getOwnPropertySymbols,we=Object.prototype.hasOwnProperty,Se=Object.prototype.propertyIsEnumerable,le=(t,n,l)=>n in t?_e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[n]=l,Oe=(t,n)=>{for(var l in n||(n={}))we.call(n,l)&&le(t,l,n[l]);if(te)for(var l of te(n))Se.call(n,l)&&le(t,l,n[l]);return t};Oe({linear:se},{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 ne(t,n){const{itemHeight:l,overscan:o=5}=n,r=e.ref(),i=ye(r);let a;const d=e.shallowRef(t),p=e.ref(0),u=e.ref({start:0,end:10});let v=0;const m=e.ref([]),c=e.computed(()=>{let{sum:s,height:f}={sum:0,height:0};return d.value.map((_,b)=>(typeof l=="number"?f=l:f=l(b),s+=f,{height:f,sum:s}))}),h=e.computed(()=>P(u.value.start)),S=e.computed(()=>typeof l=="number"?c.value.length*l:c.value.at(-1)?.sum||0),T=e.computed(()=>{let s=m.value.length-o,f=Math.max(s-v,0);return m.value.slice(f,s)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(a)),e.watch([i.width,i.height,d],([s,f])=>{(s||f)&&H()},{deep:!0});function H(){cancelAnimationFrame(a),a=requestAnimationFrame(O)}function O(){if(r.value){p.value=r.value.scrollTop,v=M();let s=C(p.value),f=s+v+o;s=s-o,s=s<0?0:s,f=f>d.value.length?d.value.length:f,u.value={start:s,end:f},m.value=d.value.slice(s,f).map((_,b)=>({data:_,index:b+s}))}}function C(s){let f=Math.floor(c.value.length/16),_=-1,b=-1;for(let y=0;y<16;y++){if(c.value.at(f*y).sum>=s){_=Math.max(0,y-1);break}y===15&&(_=y)}_*=f;for(let y=_;y<c.value.length;y++)if(c.value[y].sum>=s){b=y;break}return Math.max(0,b)}function M(){let s=0,f=0,_=z();for(let b=_;b<c.value.length&&(s++,f+=c.value[b].height,!(f>=i.height.value));b++);return s}function P(s){if(typeof l=="number")return s*l;let f=c.value[s];return f.sum-f.height}function x(s){return c.value.at(s)||{sum:0,height:0}}function z(){let s=u.value.start;return s>=o&&(s+=o),s}function Q(s){if(r.value){const f=x(s);r.value.scrollTop=f.sum-f.height,O()}}const U=e.computed(()=>({style:{width:"100%",height:`${S.value}px`}})),W=e.computed(()=>({style:{transform:`translate3d(0, ${h.value}px, 0)`,"will-change":"transform"}})),q={overflowY:"auto"};return{list:m,visiableList:T,getItemHeightData:x,totalHeight:S,clientHeight:i.height,scrollTo:Q,scrollTop:p,containerProps:{ref:r,onScroll:()=>{H()},style:q},wrapperProps:U,innerProps:W}}const D=Symbol(),F=Symbol(),L=Symbol(),j=Symbol(),K=Symbol(),V=Symbol(),$=Symbol(),k=Symbol(),N=Symbol();function Ee(){const{voidFn:t,boolFn:n,boolRef:l,arrayRef:o}={voidFn:h=>{},boolFn:h=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},r=e.inject(j,o),i=e.inject(L,n),a=e.inject(k,l),d=e.inject(F,t),p=e.inject(D,t),u=e.inject(K,t),v=e.inject(V,t),m=e.inject($,t),c=e.inject(N,t);return{selected:r,isSelected:i,isAllSelected:a,toggle:d,toggleAll:p,select:u,selectAll:v,unselect:m,unselectAll:c}}function Te(t,n){const l=e.ref({}),o=e.computed(()=>t.value.filter(c=>l.value[c[n]])),r=e.computed(()=>o.value.length!=0&&Object.keys(l.value).length==t.value.length);function i(){t.value.forEach(c=>{l.value[c[n]]=!0})}function a(){l.value={}}function d(c){c.forEach(h=>{l.value[h[n]]||(l.value[h[n]]=!0)})}function p(c){c.forEach(h=>{l.value[h[n]]&&delete l.value[h[n]]})}function u(c){return!!l.value[c[n]]}function v(c){c.forEach(h=>{u(h)?delete l.value[h[n]]:l.value[h[n]]=!0})}function m(){r.value?a():i()}return e.provide(D,m),e.provide(F,v),e.provide(L,u),e.provide(j,o),e.provide(K,d),e.provide(V,i),e.provide($,p),e.provide(k,r),e.provide(N,a),{selected:o,select:d,selectAll:i,unselect:p,unselectAll:a,toggle:v,toggleAll:m,isSelected:u,isAllSelected:r}}const oe=Symbol(),Ie=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0},dialogClass:{default:""}},emits:["update:visiable"],setup(t,{emit:n}){const l=t,o=()=>{l.closeOnClickOverlay&&n("update:visiable",!1)};return e.provide(oe,()=>n("update:visiable",!1)),(r,i)=>(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 z-50 flex bg-stone-900 bg-opacity-50"},[e.createElementVNode("div",{onClick:i[0]||(i[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog m-auto flex flex-col",t.dialogClass])},[e.renderSlot(r.$slots,"default")],2)])):e.createCommentVNode("",!0)]),_:3}))}});function Be(t){function n(l,o){const r=document.createElement("div"),i={setup(){return()=>e.h(Ie,{visiable:!0,"onUpdate:visiable":()=>{r?.remove()},...t},{default:()=>e.h(l,o)})}};return document.body.appendChild(r),e.render(e.h(i),r),{close:()=>r?.remove()}}return{create:n}}const He=["xlink:href","fill","color"],Ce=e.defineComponent({__name:"SvgIcon",props:{name:null,prefix:{default:"icon"},color:{default:"#FFF"},width:null,height:null},setup(t){const n=t,l=e.computed(()=>`#${n.prefix}-${n.name}`),o=e.computed(()=>({width:n.width,height:n.height,aspectRatio:n.width&&n.height?void 0:"1/1"}));return(r,i)=>(e.openBlock(),e.createElementBlock("svg",{"aria-hidden":"",style:e.normalizeStyle(e.unref(o))},[e.createElementVNode("use",{"xlink:href":e.unref(l),fill:t.color,color:t.color},null,8,He)],4))}});function Pe(t){const{containerEl:n,sliderEl:l,autoHeight:o,performance:r={}}=t,i=e.ref(!0),a=ue(W,1e3),d=de(Y,1e3,!0,!0);let p,u="";const v=e.ref(0),m=e.ref(0),c=e.ref(0),h=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),S=e.ref({clientHeight:0}),T=e.computed(()=>!!m.value),H=e.computed(()=>h.value.scrollHeight>h.value.clientHeight),O=e.computed(()=>h.value.clientHeight-S.value.clientHeight),C=e.computed(()=>h.value.scrollHeight-h.value.clientHeight),M=e.computed(()=>Math.max(h.value.clientHeight/h.value.scrollHeight,.05)),P=e.computed(()=>M.value*h.value.clientHeight),x=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${c.value}px,0)`,height:o?`${P.value}px`:void 0}));function z(E){m.value=E.clientY-l.value.getBoundingClientRect().top||1,u=getComputedStyle(n.value).scrollBehavior,u==="smooth"&&(n.value.style.scrollBehavior="unset")}function Q(){n.value.style.scrollBehavior=u,m.value=0,a()}function U(){i.value=!1}function W(){T.value||(i.value=!0)}function q(E){if(!T.value)return;let w=E.clientY-h.value.top-m.value;w<0?c.value=0:w>=O.value?c.value=O.value:c.value=w,n.value.scrollTo({top:c.value/O.value*C.value})}function s(){T.value||f()}function f(){cancelAnimationFrame(p),p=requestAnimationFrame(_)}function _(){n.value&&(v.value=r.scrollTop?.value??n.value.scrollTop,c.value=v.value/C.value*O.value)}function b(E){let w="addEventListener";E==="add"?w="addEventListener":w="removeEventListener",l.value?.[w]("pointerdown",z,{passive:!0}),window[w]("pointermove",q,{passive:!0}),window[w]("pointerup",Q,{passive:!0})}const y=new MutationObserver(E=>{E.map(Ve=>Ve.oldValue).join().includes("height")?Y():S.value.clientHeight===0&&d()});function Y(){h.value.top=n.value?.getBoundingClientRect().top??0,h.value.scrollHeight=n.value?.scrollHeight??0,h.value.clientHeight=n.value?.clientHeight??0,o?S.value.clientHeight=P.value:S.value.clientHeight=l.value?.clientHeight??0}function Ke(){n.value&&l.value?(n.value.addEventListener("scroll",s,{passive:!0}),b("add"),y.observe(n.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{Y()},100)):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:n,sliderEl:l})}return e.watch(v,()=>{U(),a()}),{isScrollEnd:i,isDragSlider:T,scrollable:H,sliderPos:x,init:Ke,modifySliderEventListener:b}}const xe=(t=>(e.pushScopeId("data-v-9645dfb5"),t=t(),e.popScopeId(),t))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),Re=e.defineComponent({__name:"ScrollBar",props:{containerEl:null,autoHide:{type:Boolean},autoHeight:{type:Boolean},performance:null},setup(t,{expose:n}){const l=t,o=!!e.useSlots().default,r=e.ref(null),i=e.computed(()=>l.containerEl),a=Pe({containerEl:i,sliderEl:r,autoHeight:o?l.autoHeight:!0,performance:l.performance}),{scrollable:d,isScrollEnd:p,sliderPos:u}=a,v=l.autoHide?e.computed(()=>!p.value):e.computed(()=>d.value);return e.onMounted(()=>{e.nextTick(()=>{a.init()})}),e.onUnmounted(()=>{a.modifySliderEventListener("remove")}),n({uScrollBarReturn:a}),(m,c)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"sliderRef",ref:r,class:"slider-wrapper",style:e.normalizeStyle(e.unref(u))},[e.renderSlot(m.$slots,"default",{},()=>[xe],!0)],4),[[e.vShow,e.unref(v)]])]),_:3}))}}),Ne="",re=(t,n)=>{const l=t.__vccOpts||t;for(const[o,r]of n)l[o]=r;return l},Ae=re(Re,[["__scopeId","data-v-9645dfb5"]]),De={class:"virtualListWrapper"},Fe={inheritAttrs:!1},Le=e.defineComponent({...Fe,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},setup(t,{expose:n}){const l=t,o=ne(e.toRef(l,"data"),{itemHeight:u=>l.itemHeight(l.data[u]),overscan:l.overscan}),{list:r,containerProps:i,wrapperProps:a,innerProps:d,getItemHeightData:p}=o;return n({vListReturn:o}),(u,v)=>(e.openBlock(),e.createElementBlock("div",De,[e.createElementVNode("div",e.mergeProps({onScrollPassive:v[0]||(v[0]=(...m)=>e.unref(i).onScroll&&e.unref(i).onScroll(...m)),ref:e.unref(i).ref,class:"virtualList"},u.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(a))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(d))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),({index:m,data:c})=>(e.openBlock(),e.createElementBlock("div",{key:m,style:e.normalizeStyle({height:`${e.unref(p)(m).height}px`,display:"flex"})},[e.renderSlot(u.$slots,"default",{data:c,index:m},void 0,!0)],4))),128))],16)],16)],16)]))}}),Me="",je=re(Le,[["__scopeId","data-v-134ad8ab"]]);g.ScrollBar=Ae,g.SvgIcon=Ce,g.VirtualList=je,g.allSelectedKey=j,g.closeDialogKey=oe,g.dialogController=Be,g.isAllSelectedKey=k,g.isSelectedKey=L,g.selectAllKey=V,g.selectKey=K,g.toggleAllKey=D,g.toggleKey=F,g.unselectAllKey=N,g.unselectKey=$,g.useSelectable=Te,g.useSelectableInjectors=Ee,g.useVirtualList=ne,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .v-enter-active[data-v-d564e88d]{opacity:0}.v-leave-active[data-v-d564e88d]{transition:all .15s ease-out}.v-leave-to[data-v-d564e88d]{opacity:0}.virtualListWrapper[data-v-134ad8ab]{width:100%;height:100%;position:relative}.virtualList[data-v-134ad8ab] ::-webkit-scrollbar{display:none}.virtualList[data-v-134ad8ab]{width:100%;height:100%;position:absolute;overflow-y:auto;scroll-behavior:smooth;user-select:none}.virtualList[data-v-134ad8ab]::-webkit-scrollbar{display:none}
1
+ .v-enter-active[data-v-9645dfb5]{opacity:0}.v-leave-active[data-v-9645dfb5]{transition:all .15s ease-out}.v-leave-to[data-v-9645dfb5]{opacity:0}.slider-wrapper[data-v-9645dfb5]{z-index:100;position:absolute;right:0;touch-action:none}.default-slider[data-v-9645dfb5]{width:6px;height:100%;background-color:#0003;border-radius:3px;margin-right:3px}.virtualListWrapper[data-v-134ad8ab]{width:100%;height:100%;position:relative}.virtualList[data-v-134ad8ab] ::-webkit-scrollbar{display:none}.virtualList[data-v-134ad8ab]{width:100%;height:100%;position:absolute;overflow-y:auto;scroll-behavior:smooth;user-select:none}.virtualList[data-v-134ad8ab]::-webkit-scrollbar{display:none}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazycatcloud/lzc-toolkit",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "description": "lazycat ui toolkits",
5
5
  "main": "./dist/index.umd.js",
6
6
  "module": "./dist/index.es.js",