@lazycatcloud/lzc-toolkit 0.0.56 → 0.0.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { unref as B, getCurrentScope as Ke, onScopeDispose as Qe, getCurrentInstance as Ue, onMounted as fe, nextTick as pe, ref as E, watch as ne, shallowRef as qe, computed as S, onUnmounted as Oe, inject as P, provide as H, defineComponent as Z, h as K, render as ae, openBlock as W, createBlock as De, Transition as Re, withCtx as Ce, createElementBlock as J, createElementVNode as F, withModifiers as Ye, normalizeClass as Ge, renderSlot as he, createCommentVNode as Xe, normalizeStyle as le, toDisplayString as Je, useSlots as Ze, withDirectives as et, vShow as tt, pushScopeId as nt, popScopeId as lt, toRef as ot, mergeProps as rt, normalizeProps as ge, guardReactiveProps as ye, Fragment as at, renderList as st } from "vue";
1
+ import { unref as B, getCurrentScope as Ke, onScopeDispose as Qe, getCurrentInstance as Ue, onMounted as fe, nextTick as pe, ref as E, watch as ne, shallowRef as qe, computed as S, onUnmounted as Oe, inject as F, provide as H, defineComponent as Z, h as Q, render as ae, openBlock as k, createBlock as De, Transition as Re, withCtx as Ce, createElementBlock as J, createElementVNode as M, withModifiers as Ye, normalizeClass as Ge, renderSlot as he, createCommentVNode as Xe, normalizeStyle as le, toDisplayString as Je, useSlots as Ze, withDirectives as et, vShow as tt, pushScopeId as nt, popScopeId as lt, toRef as ot, mergeProps as rt, normalizeProps as ge, guardReactiveProps as ye, Fragment as at, renderList as st } from "vue";
2
2
  var be;
3
3
  const Be = typeof window < "u";
4
4
  Be && ((be = window?.navigator) == null ? void 0 : be.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
@@ -149,62 +149,62 @@ function Tt(t, e) {
149
149
  const d = qe(t), c = E(0), u = E({ start: 0, end: 10 });
150
150
  let s = 0;
151
151
  const _ = E([]), w = S(() => {
152
- let { sum: p, height: b } = { sum: 0, height: 0 };
153
- return d.value.map((I, C) => (typeof l == "number" ? b = l : b = l(C), p += b, { height: b, sum: p }));
154
- }), m = S(() => N(u.value.start)), y = S(() => typeof l == "number" ? w.value.length * l : w.value[w.value.length - 1]?.sum || 0), R = S(() => {
155
- let p = _.value.length - o, b = Math.max(p - s, 0);
156
- return _.value.slice(b, p);
152
+ let { sum: p, height: y } = { sum: 0, height: 0 };
153
+ return d.value.map((I, C) => (typeof l == "number" ? y = l : y = l(C), p += y, { height: y, sum: p }));
154
+ }), m = S(() => V(u.value.start)), b = S(() => typeof l == "number" ? w.value.length * l : w.value[w.value.length - 1]?.sum || 0), O = S(() => {
155
+ let p = _.value.length - o, y = Math.max(p - s, 0);
156
+ return _.value.slice(y, p);
157
157
  });
158
158
  fe(() => {
159
159
  }), Oe(() => cancelAnimationFrame(f)), ne(
160
160
  [r.width, r.height, d],
161
- ([p, b]) => {
162
- (p || b) && U();
161
+ ([p, y]) => {
162
+ (p || y) && U();
163
163
  },
164
164
  { deep: !0 }
165
165
  ), ne(c, () => {
166
- Q(), g();
166
+ $(), g();
167
167
  });
168
- function Q() {
168
+ function $() {
169
169
  i.value = !1;
170
170
  }
171
171
  function ee() {
172
172
  i.value = !0, n?.();
173
173
  }
174
174
  function U() {
175
- cancelAnimationFrame(f), f = requestAnimationFrame(k);
175
+ cancelAnimationFrame(f), f = requestAnimationFrame(N);
176
176
  }
177
- function k() {
177
+ function N() {
178
178
  if (a.value) {
179
- c.value = a.value.scrollTop, s = M();
180
- let p = $(c.value), b = p + s + o;
181
- p = p - o, p = p < 0 ? 0 : p, b = b > d.value.length ? d.value.length : b, u.value = { start: p, end: b }, _.value = d.value.slice(p, b).map((I, C) => ({
179
+ c.value = a.value.scrollTop, s = z();
180
+ let p = A(c.value), y = p + s + o;
181
+ p = p - o, p = p < 0 ? 0 : p, y = y > d.value.length ? d.value.length : y, u.value = { start: p, end: y }, _.value = d.value.slice(p, y).map((I, C) => ({
182
182
  data: I,
183
183
  index: C + p
184
184
  }));
185
185
  }
186
186
  }
187
- function $(p) {
188
- let b = 0, I = w.value.length - 1, C = -1;
189
- for (; b <= I; ) {
190
- const O = Math.floor((b + I) / 2);
191
- w.value[O].sum >= p ? (C = O, I = O - 1) : b = O + 1;
187
+ function A(p) {
188
+ let y = 0, I = w.value.length - 1, C = -1;
189
+ for (; y <= I; ) {
190
+ const D = Math.floor((y + I) / 2);
191
+ w.value[D].sum >= p ? (C = D, I = D - 1) : y = D + 1;
192
192
  }
193
193
  return Math.max(0, C);
194
194
  }
195
- function M() {
196
- let p = 0, b = 0, I = L();
197
- for (let C = I; C < w.value.length && (p++, b += w.value[C].height, !(b >= r.height.value)); C++)
195
+ function z() {
196
+ let p = 0, y = 0, I = L();
197
+ for (let C = I; C < w.value.length && (p++, y += w.value[C].height, !(y >= r.height.value)); C++)
198
198
  ;
199
199
  return p;
200
200
  }
201
- function N(p) {
201
+ function V(p) {
202
202
  if (typeof l == "number")
203
203
  return p * l;
204
- let b = w.value[p];
205
- return b ? b.sum - b.height : 0;
204
+ let y = w.value[p];
205
+ return y ? y.sum - y.height : 0;
206
206
  }
207
- function V(p) {
207
+ function j(p) {
208
208
  return w.value[p] || { sum: 0, height: 0 };
209
209
  }
210
210
  function L() {
@@ -213,17 +213,17 @@ function Tt(t, e) {
213
213
  }
214
214
  function q(p) {
215
215
  if (a.value) {
216
- const b = V(p);
217
- a.value.scrollTop = b.sum - b.height, k();
216
+ const y = j(p);
217
+ a.value.scrollTop = y.sum - y.height, N();
218
218
  }
219
219
  }
220
220
  const te = S(() => ({
221
221
  style: {
222
222
  width: "100%",
223
- height: `${y.value}px`,
223
+ height: `${b.value}px`,
224
224
  pointerEvents: i.value ? void 0 : "none"
225
225
  }
226
- })), j = S(() => ({
226
+ })), K = S(() => ({
227
227
  style: {
228
228
  transform: `translate3d(0, ${m.value}px, 0)`,
229
229
  "will-change": "transform"
@@ -233,10 +233,10 @@ function Tt(t, e) {
233
233
  };
234
234
  return {
235
235
  list: _,
236
- visiableList: R,
237
- getItemHeightData: V,
238
- getoffsetTopIndex: $,
239
- totalHeight: y,
236
+ visiableList: O,
237
+ getItemHeightData: j,
238
+ getoffsetTopIndex: A,
239
+ totalHeight: b,
240
240
  clientHeight: r.height,
241
241
  scrollTo: q,
242
242
  scrollTop: c,
@@ -249,7 +249,7 @@ function Tt(t, e) {
249
249
  style: Y
250
250
  },
251
251
  wrapperProps: te,
252
- innerProps: j
252
+ innerProps: K
253
253
  };
254
254
  }
255
255
  const $e = Symbol(), Ae = Symbol(), Pe = Symbol(), Fe = Symbol(), Me = Symbol(), ze = Symbol(), We = Symbol(), ke = Symbol(), Ne = Symbol();
@@ -260,7 +260,7 @@ function Wt() {
260
260
  boolFn: (s) => !1,
261
261
  boolRef: S(() => !1),
262
262
  arrayRef: S(() => [])
263
- }, o = P(Fe, l), a = P(Pe, e), r = P(ke, n), i = P(Ae, t), g = P($e, t), f = P(Me, t), d = P(ze, t), c = P(We, t), u = P(Ne, t);
263
+ }, o = F(Fe, l), a = F(Pe, e), r = F(ke, n), i = F(Ae, t), g = F($e, t), f = F(Me, t), d = F(ze, t), c = F(We, t), u = F(Ne, t);
264
264
  return {
265
265
  selected: o,
266
266
  isSelected: a,
@@ -334,108 +334,108 @@ function Ve({
334
334
  } = l();
335
335
  let i = {};
336
336
  const g = S(
337
- () => Se(e === "colum" ? z : oe, 50)
337
+ () => Se(e === "colum" ? W : oe, 50)
338
338
  ), f = /* @__PURE__ */ new Set(), d = E(!0), c = E(), u = E(!1), s = E({ x: 0, y: 0 }), _ = E({ x: 0, y: 0, scrollTop: 0 }), w = new ResizeObserver(
339
339
  (v) => m.value = v[0].target.getBoundingClientRect()
340
- ), m = E({}), y = E({
340
+ ), m = E({}), b = E({
341
341
  top: 0,
342
342
  height: 0,
343
343
  sync(v = !1) {
344
- y.value.top = c.value?.scrollTop || 0, v && (y.value.height = c.value?.scrollHeight || 0);
344
+ b.value.top = c.value?.scrollTop || 0, v && (b.value.height = c.value?.scrollHeight || 0);
345
345
  }
346
- }), R = S(() => u.value ? {
346
+ }), O = S(() => u.value ? {
347
347
  left: Math.min(s.value.x, _.value.x) - m.value.left,
348
348
  top: Math.min(s.value.y, _.value.y) - m.value.top,
349
349
  width: Math.abs(s.value.x - _.value.x),
350
350
  height: Math.abs(s.value.y - _.value.y)
351
- } : { left: 0, top: 0, width: 0, height: 0 }), { margin: Q = 50, startSpeed: ee = 30, maxSpeed: U = 30 } = n;
352
- let k;
353
- const $ = Q, M = ee, N = U, V = (v) => v ** 1;
351
+ } : { left: 0, top: 0, width: 0, height: 0 }), { margin: $ = 50, startSpeed: ee = 30, maxSpeed: U = 30 } = n;
352
+ let N;
353
+ const A = $, z = ee, V = U, j = (v) => v ** 1;
354
354
  let L = 0;
355
355
  function q(v) {
356
- if (cancelAnimationFrame(k), L = te(v), L = Math.max(
357
- Math.min(L, N),
358
- -N
356
+ if (cancelAnimationFrame(N), L = te(v), L = Math.max(
357
+ Math.min(L, V),
358
+ -V
359
359
  ), L !== 0) {
360
360
  const h = c.value;
361
361
  if (!h || !u.value)
362
362
  return;
363
- const D = y.value.height - m.value.height;
364
- let x = y.value.top + Number(L);
365
- x = Math.min(Math.max(0, x), D), h.scrollTop = x, Y(), k = requestAnimationFrame(() => q(v));
363
+ const R = b.value.height - m.value.height;
364
+ let x = b.value.top + Number(L);
365
+ x = Math.min(Math.max(0, x), R), h.scrollTop = x, Y(), N = requestAnimationFrame(() => q(v));
366
366
  }
367
367
  }
368
368
  function te(v) {
369
369
  if (c.value) {
370
- const D = m.value, x = D.bottom - v;
371
- if (x < $)
372
- return M * V(1 - x / $);
373
- const A = v - D.top;
374
- if (A < $)
375
- return -M * V(1 - A / $);
370
+ const R = m.value, x = R.bottom - v;
371
+ if (x < A)
372
+ return z * j(1 - x / A);
373
+ const P = v - R.top;
374
+ if (P < A)
375
+ return -z * j(1 - P / A);
376
376
  }
377
377
  return 0;
378
378
  }
379
- function j(v) {
380
- const h = { ...R.value, right: 0, bottom: 0 };
381
- return h.left += m.value.left, h.top += m.value.top - y.value.top, h.right = h.width + h.left, h.bottom = h.height + h.top, h.left < v.right && h.right > v.left && h.top < v.bottom && h.bottom > v.top;
379
+ function K(v) {
380
+ const h = { ...O.value, right: 0, bottom: 0 };
381
+ return h.left += m.value.left, h.top += m.value.top - b.value.top, h.right = h.width + h.left, h.bottom = h.height + h.top, h.left < v.right && h.right > v.left && h.top < v.bottom && h.bottom > v.top;
382
382
  }
383
383
  function Y() {
384
- y.value.sync();
385
- const { top: v, height: h } = y.value;
384
+ b.value.sync();
385
+ const { top: v, height: h } = b.value;
386
386
  _.value.y = Math.min(
387
387
  h + m.value.top,
388
388
  _.value.y + v - _.value.scrollTop
389
389
  ), _.value.scrollTop = v;
390
390
  }
391
- function p(v, h, D = "dynamic-styles") {
392
- let x = document.getElementById(D);
393
- x || (x = document.createElement("style"), x.id = D, document.head.appendChild(x));
394
- const A = x.sheet.cssRules, X = A.length, je = `${v} { ${h} }`;
391
+ function p(v, h, R = "dynamic-styles") {
392
+ let x = document.getElementById(R);
393
+ x || (x = document.createElement("style"), x.id = R, document.head.appendChild(x));
394
+ const P = x.sheet.cssRules, X = P.length, je = `${v} { ${h} }`;
395
395
  for (let ie = 0; ie < X; ie++) {
396
- const me = A[ie];
396
+ const me = P[ie];
397
397
  if (me.selectorText === v && me.style.cssText === h)
398
398
  return;
399
399
  }
400
400
  x.sheet.insertRule(je, X);
401
401
  }
402
- function b(v, h) {
403
- d.value = !0, u.value = !0, y.value.height ? y.value.sync() : y.value.sync(!0), s.value.x = v, s.value.y = h + y.value.top, _.value.x = s.value.x, _.value.y = s.value.y, c.value?.classList.add("disable-scroll-behavior"), f.clear();
402
+ function y(v, h) {
403
+ d.value = !0, u.value = !0, b.value.height ? b.value.sync() : b.value.sync(!0), s.value.x = v, s.value.y = h + b.value.top, _.value.x = s.value.x, _.value.y = s.value.y, c.value?.classList.add("disable-scroll-behavior"), f.clear();
404
404
  }
405
- function I(v, h, D) {
406
- !u.value || (d.value && e === "colum" && !T() && (r(), d.value = !1), D?.(), q(h), _.value.x = Math.max(v, m.value.left), _.value.y = Math.min(
407
- h + y.value.top,
408
- y.value.height + m.value.top
409
- ), _.value.scrollTop = y.value.top, g.value());
405
+ function I(v, h, R) {
406
+ !u.value || (d.value && e === "colum" && !T() && (r(), d.value = !1), R?.(), q(h), _.value.x = Math.max(v, m.value.left), _.value.y = Math.min(
407
+ h + b.value.top,
408
+ b.value.height + m.value.top
409
+ ), _.value.scrollTop = b.value.top, g.value());
410
410
  }
411
411
  function C() {
412
412
  u.value = !1, c.value?.classList.remove("disable-scroll-behavior");
413
413
  }
414
- function O() {
414
+ function D() {
415
415
  !u.value || (L || Y(), g.value());
416
416
  }
417
417
  function T() {
418
418
  if (!u.value)
419
419
  return !1;
420
- const { width: v, height: h } = R.value;
420
+ const { width: v, height: h } = O.value;
421
421
  return !(Math.max(v, h) > 5);
422
422
  }
423
423
  function G() {
424
424
  T() && r();
425
425
  }
426
- function z() {
426
+ function W() {
427
427
  T() || c.value?.querySelectorAll(`[${t}]`).forEach((v) => {
428
- i[`${t}`] = v.getAttribute(`${t}`), j(v.getBoundingClientRect()) ? o([i]) : a([i]);
428
+ i[`${t}`] = v.getAttribute(`${t}`), K(v.getBoundingClientRect()) ? o([i]) : a([i]);
429
429
  });
430
430
  }
431
431
  function oe() {
432
432
  const v = [];
433
- let h = null, D = 0;
434
- c.value?.querySelectorAll(`[${t}]`).forEach((x, A) => {
433
+ let h = null, R = 0;
434
+ c.value?.querySelectorAll(`[${t}]`).forEach((x, P) => {
435
435
  const X = x.getAttribute(`${t}`);
436
- v.push(X), j(x.getBoundingClientRect()) ? (h === null && (h = A), h = Math.min(h, A), D = Math.max(D, A)) : (i[`${t}`] = X, f.has(X) && a([i]));
436
+ v.push(X), K(x.getBoundingClientRect()) ? (h === null && (h = P), h = Math.min(h, P), R = Math.max(R, P)) : (i[`${t}`] = X, f.has(X) && a([i]));
437
437
  });
438
- for (let x = h; x < D + 1; x++)
438
+ for (let x = h; x < R + 1; x++)
439
439
  i[`${t}`] = v[x], o([i]), f.add(v[x]);
440
440
  }
441
441
  function re(v) {
@@ -446,14 +446,14 @@ function Ve({
446
446
  }
447
447
  return {
448
448
  init: re,
449
- dragStart: b,
449
+ dragStart: y,
450
450
  dragMove: I,
451
451
  dragEnd: C,
452
- onScroll: O,
452
+ onScroll: D,
453
453
  isSingleClick: T,
454
454
  cancelSelectAllBySingleClick: G,
455
455
  selectFn: g,
456
- selectRange: R,
456
+ selectRange: O,
457
457
  isPressing: u,
458
458
  containerEl: c,
459
459
  observer: w
@@ -473,7 +473,7 @@ function Nt(t) {
473
473
  height: `${l.value.height}px`
474
474
  })), d = Z({
475
475
  render() {
476
- return K("div", {
476
+ return Q("div", {
477
477
  id: "selectBoxEl",
478
478
  class: "absolute z-50 bg-blue-200 opacity-50",
479
479
  style: f.value
@@ -487,7 +487,7 @@ function Nt(t) {
487
487
  r(m.x, m.y);
488
488
  }
489
489
  function s(m) {
490
- m.composedPath().some((R) => R?.getAttribute?.(t.attribute)) || g(), i();
490
+ m.composedPath().some((O) => O?.getAttribute?.(t.attribute)) || g(), i();
491
491
  }
492
492
  function _(m) {
493
493
  try {
@@ -495,9 +495,9 @@ function Nt(t) {
495
495
  throw "\u521D\u59CB\u5316\u5931\u8D25,Ref\u5143\u7D20\u4E0D\u6B63\u786E";
496
496
  if (!e.containerEl?.value)
497
497
  return !1;
498
- ae(K(d), e.containerEl.value), e.containerEl.value?.addEventListener("scroll", o), e.containerEl.value?.addEventListener("mousedown", c), window.addEventListener("mousemove", u), window.addEventListener("mouseup", s);
499
- } catch (y) {
500
- console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25", y);
498
+ ae(Q(d), e.containerEl.value), e.containerEl.value?.addEventListener("scroll", o), e.containerEl.value?.addEventListener("mousedown", c), window.addEventListener("mousemove", u), window.addEventListener("mouseup", s);
499
+ } catch (b) {
500
+ console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25", b);
501
501
  }
502
502
  }
503
503
  function w() {
@@ -519,15 +519,15 @@ function Vt(t, e, n = 600) {
519
519
  clearTimeout(f);
520
520
  }
521
521
  function c(m) {
522
- d(), f = setTimeout(() => {
523
- const { clientX: y, clientY: R } = m.targetTouches[0];
524
- r(y, R), e?.(), i(y, R, () => m.preventDefault()), m.preventDefault();
525
- }, n);
522
+ d(), m.composedPath().some((O) => !!O.getAttribute(t.attribute)) && (f = setTimeout(() => {
523
+ const { clientX: O, clientY: $ } = m.targetTouches[0];
524
+ r(O, $), e?.(), i(O, $, () => m.preventDefault()), m.preventDefault();
525
+ }, n));
526
526
  }
527
527
  function u(m) {
528
528
  d();
529
- const { clientX: y, clientY: R } = m.targetTouches[0];
530
- i(y, R, () => m.preventDefault());
529
+ const { clientX: b, clientY: O } = m.targetTouches[0];
530
+ i(b, O, () => m.preventDefault());
531
531
  }
532
532
  function s() {
533
533
  d(), g();
@@ -539,8 +539,8 @@ function Vt(t, e, n = 600) {
539
539
  if (!l.containerEl?.value)
540
540
  return !1;
541
541
  l.containerEl.value?.addEventListener("scroll", a), l.containerEl.value?.addEventListener("touchstart", c), l.containerEl.value?.addEventListener("touchmove", u), window.addEventListener("touchcancel", s), window.addEventListener("touchend", s);
542
- } catch (y) {
543
- console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25", y);
542
+ } catch (b) {
543
+ console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25", b);
544
544
  }
545
545
  }
546
546
  function w() {
@@ -560,17 +560,17 @@ const Ot = Symbol(), Dt = /* @__PURE__ */ Z({
560
560
  const n = t, l = () => {
561
561
  n.closeOnClickOverlay && e("update:visiable", !1);
562
562
  };
563
- return H(Ot, () => e("update:visiable", !1)), (o, a) => (W(), De(Re, { name: "modal" }, {
563
+ return H(Ot, () => e("update:visiable", !1)), (o, a) => (k(), De(Re, { name: "modal" }, {
564
564
  default: Ce(() => [
565
- t.visiable ? (W(), J("div", {
565
+ t.visiable ? (k(), J("div", {
566
566
  key: 0,
567
567
  onClick: l,
568
- class: "modal"
568
+ class: "lzc-modal"
569
569
  }, [
570
- F("div", {
570
+ M("div", {
571
571
  onClick: a[0] || (a[0] = Ye(() => {
572
572
  }, ["stop"])),
573
- class: Ge(["dialog", t.dialogClass])
573
+ class: Ge(["lzc-dialog", t.dialogClass])
574
574
  }, [
575
575
  he(o.$slots, "default", {}, void 0, !0)
576
576
  ], 2)
@@ -585,12 +585,12 @@ const ue = (t, e) => {
585
585
  for (const [l, o] of e)
586
586
  n[l] = o;
587
587
  return n;
588
- }, Rt = /* @__PURE__ */ ue(Dt, [["__scopeId", "data-v-415900d3"]]);
588
+ }, Rt = /* @__PURE__ */ ue(Dt, [["__scopeId", "data-v-e171c24d"]]);
589
589
  function jt(t) {
590
590
  function e(n, l) {
591
591
  const o = document.createElement("div"), a = {
592
592
  setup() {
593
- return () => K(
593
+ return () => Q(
594
594
  Rt,
595
595
  {
596
596
  visiable: !0,
@@ -600,12 +600,12 @@ function jt(t) {
600
600
  ...t
601
601
  },
602
602
  {
603
- default: () => K(n, l)
603
+ default: () => Q(n, l)
604
604
  }
605
605
  );
606
606
  }
607
607
  };
608
- return document.body.appendChild(o), ae(K(a), o), {
608
+ return document.body.appendChild(o), ae(Q(a), o), {
609
609
  close: () => o?.remove()
610
610
  };
611
611
  }
@@ -646,17 +646,17 @@ const Ct = /* @__PURE__ */ Z({
646
646
  }));
647
647
  return pe(() => {
648
648
  l.value = n.value.offsetWidth / 2, o.value = n.value.offsetHeight / 2;
649
- }), (g, f) => (W(), J("div", {
649
+ }), (g, f) => (k(), J("div", {
650
650
  id: "toastWrapper",
651
651
  ref_key: "toastWrapper",
652
652
  ref: n,
653
653
  class: "toastWrapper",
654
654
  style: le([B(r), { zIndex: 9999 }])
655
655
  }, [
656
- F("div", {
656
+ M("div", {
657
657
  style: le(B(i))
658
658
  }, [
659
- F("span", null, Je(t.message), 1)
659
+ M("span", null, Je(t.message), 1)
660
660
  ], 4)
661
661
  ], 4));
662
662
  }
@@ -673,7 +673,7 @@ class Kt {
673
673
  this.options = e, this.container = document.createElement("div");
674
674
  }
675
675
  present() {
676
- const e = K(K(Bt), { ...Te, ...this.options });
676
+ const e = Q(Q(Bt), { ...Te, ...this.options });
677
677
  ae(e, this.container), document.body.insertBefore(this.container, document.body.firstChild);
678
678
  const n = this.options.duration || Te.duration;
679
679
  setTimeout(() => {
@@ -706,11 +706,11 @@ const It = ["xlink:href", "fill", "color"], Qt = /* @__PURE__ */ Z({
706
706
  height: `${e.height ?? e.width}px`,
707
707
  aspectRatio: e.width && e.height ? void 0 : "1/1"
708
708
  }));
709
- return (o, a) => (W(), J("svg", {
709
+ return (o, a) => (k(), J("svg", {
710
710
  "aria-hidden": "",
711
711
  style: le(B(l))
712
712
  }, [
713
- F("use", {
713
+ M("use", {
714
714
  "xlink:href": B(n),
715
715
  fill: t.color,
716
716
  color: t.color
@@ -725,7 +725,7 @@ function Lt(t) {
725
725
  autoHeight: l,
726
726
  performance: o = {},
727
727
  maxHeightRatio: a = 0.9
728
- } = t, r = E(!0), i = Le(N, 100);
728
+ } = t, r = E(!0), i = Le(V, 100);
729
729
  let g, f = "";
730
730
  const d = E(0), c = E(0), u = E(0), s = E({
731
731
  top: 0,
@@ -734,32 +734,32 @@ function Lt(t) {
734
734
  clientHeight: 0
735
735
  }), _ = E({
736
736
  clientHeight: 0
737
- }), w = S(() => !!c.value), m = S(() => s.value.scrollHeight > s.value.clientHeight), y = S(() => s.value.clientHeight - _.value.clientHeight), R = S(() => s.value.scrollHeight - s.value.clientHeight), Q = S(() => Math.max(
737
+ }), w = S(() => !!c.value), m = S(() => s.value.scrollHeight > s.value.clientHeight), b = S(() => s.value.clientHeight - _.value.clientHeight), O = S(() => s.value.scrollHeight - s.value.clientHeight), $ = S(() => Math.max(
738
738
  s.value.clientHeight / s.value.scrollHeight,
739
739
  0.05
740
- )), ee = S(() => Q.value > a ? 0 : Q.value * s.value.clientHeight), U = S(() => ({
740
+ )), ee = S(() => $.value > a ? 0 : $.value * s.value.clientHeight), U = S(() => ({
741
741
  willChange: "transform",
742
742
  transform: `translate3d(0,${u.value}px,0)`,
743
743
  height: l ? `${ee.value}px` : void 0
744
744
  }));
745
- function k(O) {
746
- M(), c.value = O.clientY - n.value.getBoundingClientRect().top || 1, f = getComputedStyle(e.value).scrollBehavior, f === "smooth" && (e.value.style.scrollBehavior = "unset");
745
+ function N(D) {
746
+ z(), c.value = D.clientY - n.value.getBoundingClientRect().top || 1, f = getComputedStyle(e.value).scrollBehavior, f === "smooth" && (e.value.style.scrollBehavior = "unset");
747
747
  }
748
- function $() {
748
+ function A() {
749
749
  e.value.style.scrollBehavior = f, c.value = 0, i();
750
750
  }
751
- function M() {
751
+ function z() {
752
752
  r.value = !1;
753
753
  }
754
- function N() {
754
+ function V() {
755
755
  w.value || (r.value = !0);
756
756
  }
757
- function V(O) {
757
+ function j(D) {
758
758
  if (!w.value)
759
759
  return;
760
- let T = O.clientY - s.value.top - c.value;
761
- T < 0 ? u.value = 0 : T >= y.value ? u.value = y.value : u.value = T, e.value.scrollTo({
762
- top: u.value / y.value * R.value
760
+ let T = D.clientY - s.value.top - c.value;
761
+ T < 0 ? u.value = 0 : T >= b.value ? u.value = b.value : u.value = T, e.value.scrollTo({
762
+ top: u.value / b.value * O.value
763
763
  });
764
764
  }
765
765
  function L() {
@@ -769,35 +769,35 @@ function Lt(t) {
769
769
  cancelAnimationFrame(g), g = requestAnimationFrame(te);
770
770
  }
771
771
  function te() {
772
- e.value && (d.value = o.scrollTop?.value ?? e.value.scrollTop, u.value = d.value / R.value * y.value);
772
+ e.value && (d.value = o.scrollTop?.value ?? e.value.scrollTop, u.value = d.value / O.value * b.value);
773
773
  }
774
- function j(O) {
774
+ function K(D) {
775
775
  let T = "addEventListener";
776
- O === "add" ? T = "addEventListener" : T = "removeEventListener", n.value?.[T]("pointerdown", k, {
776
+ D === "add" ? T = "addEventListener" : T = "removeEventListener", n.value?.[T]("pointerdown", N, {
777
777
  passive: !0
778
- }), window[T]("pointermove", V, { passive: !0 }), window[T]("pointerup", $, { passive: !0 });
778
+ }), window[T]("pointermove", j, { passive: !0 }), window[T]("pointerup", A, { passive: !0 });
779
779
  }
780
- const Y = new MutationObserver((O) => {
781
- O.map((G) => G.oldValue).join().includes("height") && p();
780
+ const Y = new MutationObserver((D) => {
781
+ D.map((G) => G.oldValue).join().includes("height") && p();
782
782
  });
783
783
  function p() {
784
784
  s.value.top = e.value?.getBoundingClientRect().top ?? 0, s.value.scrollHeight = e.value?.scrollHeight ?? 0, s.value.clientHeight = e.value?.clientHeight ?? 0;
785
785
  }
786
- function b() {
787
- M(), setTimeout(() => {
788
- _.value.clientHeight = n.value?.clientHeight ?? 0, N();
786
+ function y() {
787
+ z(), setTimeout(() => {
788
+ _.value.clientHeight = n.value?.clientHeight ?? 0, V();
789
789
  }, 150);
790
790
  }
791
- function I(O, T, G = "dynamic-styles") {
792
- let z = document.getElementById(G);
793
- z || (z = document.createElement("style"), z.id = G, document.head.appendChild(z));
794
- const oe = z.sheet.cssRules, re = oe.length, v = `${O} { ${T} }`;
791
+ function I(D, T, G = "dynamic-styles") {
792
+ let W = document.getElementById(G);
793
+ W || (W = document.createElement("style"), W.id = G, document.head.appendChild(W));
794
+ const oe = W.sheet.cssRules, re = oe.length, v = `${D} { ${T} }`;
795
795
  for (let h = 0; h < re; h++) {
796
- const D = oe[h];
797
- if (D.selectorText === O && D.style.cssText === T)
796
+ const R = oe[h];
797
+ if (R.selectorText === D && R.style.cssText === T)
798
798
  return;
799
799
  }
800
- z.sheet.insertRule(v, re);
800
+ W.sheet.insertRule(v, re);
801
801
  }
802
802
  function C() {
803
803
  e.value && n.value ? (I(
@@ -805,16 +805,16 @@ function Lt(t) {
805
805
  "scrollbar-width: none; -ms-overflow-style: none;"
806
806
  ), I(".hide-scrollbar::-webkit-scrollbar", "display: none"), e.value.classList.add("hide-scrollbar"), e.value.addEventListener("scroll", L, {
807
807
  passive: !0
808
- }), j("add"), Y.observe(e.value, {
808
+ }), K("add"), Y.observe(e.value, {
809
809
  subtree: !0,
810
810
  attributeOldValue: !0,
811
811
  attributeFilter: ["style"]
812
812
  }), setTimeout(() => {
813
813
  p();
814
- }, 100), b()) : console.error("useScrollBar:", "\u521D\u59CB\u5316\u5931\u8D25!", { containerEl: e, sliderEl: n });
814
+ }, 100), y()) : console.error("useScrollBar:", "\u521D\u59CB\u5316\u5931\u8D25!", { containerEl: e, sliderEl: n });
815
815
  }
816
816
  return ne(d, () => {
817
- M(), i();
817
+ z(), i();
818
818
  }), {
819
819
  isScrollEnd: r,
820
820
  isDragSlider: w,
@@ -823,10 +823,10 @@ function Lt(t) {
823
823
  scrollable: m,
824
824
  sliderPos: U,
825
825
  init: C,
826
- modifySliderEventListener: j
826
+ modifySliderEventListener: K
827
827
  };
828
828
  }
829
- const Ht = (t) => (nt("data-v-edec7292"), t = t(), lt(), t), $t = /* @__PURE__ */ Ht(() => /* @__PURE__ */ F("div", { class: "default-slider" }, null, -1)), At = /* @__PURE__ */ Z({
829
+ const Ht = (t) => (nt("data-v-edec7292"), t = t(), lt(), t), $t = /* @__PURE__ */ Ht(() => /* @__PURE__ */ M("div", { class: "default-slider" }, null, -1)), At = /* @__PURE__ */ Z({
830
830
  __name: "ScrollBar",
831
831
  props: {
832
832
  containerEl: null,
@@ -854,9 +854,9 @@ const Ht = (t) => (nt("data-v-edec7292"), t = t(), lt(), t), $t = /* @__PURE__ *
854
854
  function s() {
855
855
  d.value = !1;
856
856
  }
857
- return e({ uScrollBarReturn: r }), (_, w) => (W(), De(Re, null, {
857
+ return e({ uScrollBarReturn: r }), (_, w) => (k(), De(Re, null, {
858
858
  default: Ce(() => [
859
- et(F("div", {
859
+ et(M("div", {
860
860
  ref_key: "sliderRef",
861
861
  ref: o,
862
862
  class: "slider-wrapper",
@@ -896,15 +896,15 @@ const Ut = /* @__PURE__ */ ue(At, [["__scopeId", "data-v-edec7292"]]), Pt = { cl
896
896
  }), { list: a, containerProps: r, wrapperProps: i, innerProps: g, getItemHeightData: f } = o;
897
897
  return e({
898
898
  vListReturn: o
899
- }), (d, c) => (W(), J("div", Pt, [
900
- F("div", rt({
899
+ }), (d, c) => (k(), J("div", Pt, [
900
+ M("div", rt({
901
901
  onScrollPassive: c[0] || (c[0] = (...u) => B(r).onScroll && B(r).onScroll(...u)),
902
902
  ref: B(r).ref,
903
903
  class: "virtualList"
904
904
  }, d.$attrs), [
905
- F("div", ge(ye(B(i))), [
906
- F("div", ge(ye(B(g))), [
907
- (W(!0), J(at, null, st(B(a), ({ index: u, data: s }) => (W(), J("div", {
905
+ M("div", ge(ye(B(i))), [
906
+ M("div", ge(ye(B(g))), [
907
+ (k(!0), J(at, null, st(B(a), ({ index: u, data: s }) => (k(), J("div", {
908
908
  key: u,
909
909
  style: le({
910
910
  height: `${B(f)(u).height}px`,
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(E,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(E=typeof globalThis<"u"?globalThis:E||self,e(E.ui={},E.Vue))})(this,function(E,e){"use strict";var fe;const pe=typeof window<"u";pe&&((fe=window?.navigator)==null?void 0:fe.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function Q(n){return typeof n=="function"?n():e.unref(n)}function he(n,t){function o(...l){n(()=>t.apply(this,l),{fn:t,thisArg:this,args:l})}return o}function Be(n,t={}){let o,l;return i=>{const a=Q(n),u=Q(t.maxWait);if(o&&clearTimeout(o),a<=0||u!==void 0&&u<=0)return l&&(clearTimeout(l),l=null),i();u&&!l&&(l=setTimeout(()=>{o&&clearTimeout(o),l=null,i()},u)),o=setTimeout(()=>{l&&clearTimeout(l),l=null,i()},a)}}function Oe(n,t=!0,o=!0){let l=0,r,i=!0;const a=()=>{r&&(clearTimeout(r),r=void 0)};return y=>{const h=Q(n),p=Date.now()-l;if(a(),h<=0)return l=Date.now(),y();p>h&&(o||!i)?(l=Date.now(),y()):t&&(r=setTimeout(()=>{l=Date.now(),i=!0,a(),y()},h)),!o&&!r&&(r=setTimeout(()=>i=!0,h)),i=!1}}function Ce(n){return n}function De(n){return e.getCurrentScope()?(e.onScopeDispose(n),!0):!1}function me(n,t=200,o={}){return he(Be(t,o),n)}function ve(n,t=200,o=!1,l=!0){return he(Oe(t,o,l),n)}function Re(n,t=!0){e.getCurrentInstance()?e.onMounted(n):t?n():e.nextTick(n)}function ge(n){var t;const o=Q(n);return(t=o?.$el)!=null?t:o}const Ie=pe?window:void 0;function Le(n,t=!1){const o=e.ref(),l=()=>o.value=Boolean(n());return l(),Re(l,t),o}const J=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Z="__vueuse_ssr_handlers__";J[Z]=J[Z]||{},J[Z];var ye=Object.getOwnPropertySymbols,He=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,Pe=(n,t)=>{var o={};for(var l in n)He.call(n,l)&&t.indexOf(l)<0&&(o[l]=n[l]);if(n!=null&&ye)for(var l of ye(n))t.indexOf(l)<0&&Ae.call(n,l)&&(o[l]=n[l]);return o};function Me(n,t,o={}){const l=o,{window:r=Ie}=l,i=Pe(l,["window"]);let a;const u=Le(()=>r&&"ResizeObserver"in r),y=()=>{a&&(a.disconnect(),a=void 0)},h=e.watch(()=>ge(n),d=>{y(),u.value&&r&&d&&(a=new ResizeObserver(t),a.observe(d,i))},{immediate:!0,flush:"post"}),p=()=>{y(),h()};return De(p),{isSupported:u,stop:p}}function $e(n,t={width:0,height:0},o={}){const{box:l="content-box"}=o,r=e.ref(t.width),i=e.ref(t.height);return Me(n,([a])=>{const u=l==="border-box"?a.borderBoxSize:l==="content-box"?a.contentBoxSize:a.devicePixelContentBoxSize;u?(r.value=u.reduce((y,{inlineSize:h})=>y+h,0),i.value=u.reduce((y,{blockSize:h})=>y+h,0)):(r.value=a.contentRect.width,i.value=a.contentRect.height)},o),e.watch(()=>ge(n),a=>{r.value=a?t.width:0,i.value=a?t.height:0}),{width:r,height:i}}var Se;(function(n){n.UP="UP",n.RIGHT="RIGHT",n.DOWN="DOWN",n.LEFT="LEFT",n.NONE="NONE"})(Se||(Se={}));var Fe=Object.defineProperty,be=Object.getOwnPropertySymbols,ke=Object.prototype.hasOwnProperty,Ve=Object.prototype.propertyIsEnumerable,Ee=(n,t,o)=>t in n?Fe(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,je=(n,t)=>{for(var o in t||(t={}))ke.call(t,o)&&Ee(n,o,t[o]);if(be)for(var o of be(t))Ve.call(t,o)&&Ee(n,o,t[o]);return n};je({linear:Ce},{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 _e(n,t){const{scrollEndHook:o,itemHeight:l,overscan:r=5}=t,i=e.ref(null),a=$e(i),u=e.ref(!0),y=me(U,100);let h;const p=e.shallowRef(n),d=e.ref(0),c=e.ref({start:0,end:10});let s=0;const _=e.ref([]),w=e.computed(()=>{let{sum:m,height:b}={sum:0,height:0};return p.value.map((R,D)=>(typeof l=="number"?b=l:b=l(D),m+=b,{height:b,sum:m}))}),g=e.computed(()=>$(c.value.start)),S=e.computed(()=>typeof l=="number"?w.value.length*l:w.value[w.value.length-1]?.sum||0),C=e.computed(()=>{let m=_.value.length-r,b=Math.max(m-s,0);return _.value.slice(b,m)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(h)),e.watch([a.width,a.height,p],([m,b])=>{(m||b)&&j()},{deep:!0}),e.watch(d,()=>{V(),y()});function V(){u.value=!1}function U(){u.value=!0,o?.()}function j(){cancelAnimationFrame(h),h=requestAnimationFrame(M)}function M(){if(i.value){d.value=i.value.scrollTop,s=A();let m=L(d.value),b=m+s+r;m=m-r,m=m<0?0:m,b=b>p.value.length?p.value.length:b,c.value={start:m,end:b},_.value=p.value.slice(m,b).map((R,D)=>({data:R,index:D+m}))}}function L(m){let b=0,R=w.value.length-1,D=-1;for(;b<=R;){const B=Math.floor((b+R)/2);w.value[B].sum>=m?(D=B,R=B-1):b=B+1}return Math.max(0,D)}function A(){let m=0,b=0,R=I();for(let D=R;D<w.value.length&&(m++,b+=w.value[D].height,!(b>=a.height.value));D++);return m}function $(m){if(typeof l=="number")return m*l;let b=w.value[m];return b?b.sum-b.height:0}function F(m){return w.value[m]||{sum:0,height:0}}function I(){let m=c.value.start;return m>=r&&(m+=r),m}function K(m){if(i.value){const b=F(m);i.value.scrollTop=b.sum-b.height,M()}}const q=e.computed(()=>({style:{width:"100%",height:`${S.value}px`,pointerEvents:u.value?void 0:"none"}})),k=e.computed(()=>({style:{transform:`translate3d(0, ${g.value}px, 0)`,"will-change":"transform"}})),N={overflowY:"auto"};return{list:_,visiableList:C,getItemHeightData:F,getoffsetTopIndex:L,totalHeight:S,clientHeight:a.height,scrollTo:K,scrollTop:d,isScrollEnd:u,containerProps:{ref:i,onScroll:()=>{j()},style:N},wrapperProps:q,innerProps:k}}const ee=Symbol(),te=Symbol(),ne=Symbol(),oe=Symbol(),le=Symbol(),re=Symbol(),ae=Symbol(),ie=Symbol(),se=Symbol();function Ke(){const{voidFn:n,boolFn:t,boolRef:o,arrayRef:l}={voidFn:s=>{},boolFn:s=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},r=e.inject(oe,l),i=e.inject(ne,t),a=e.inject(ie,o),u=e.inject(te,n),y=e.inject(ee,n),h=e.inject(le,n),p=e.inject(re,n),d=e.inject(ae,n),c=e.inject(se,n);return{selected:r,isSelected:i,isAllSelected:a,toggle:u,toggleAll:y,select:h,selectAll:p,unselect:d,unselectAll:c}}function Ne(n,t){const o=e.ref({}),l=e.computed(()=>n.value.filter(c=>o.value[c[t]])),r=e.computed(()=>l.value.length!=0&&Object.keys(o.value).length==n.value.length);function i(){n.value.forEach(c=>{o.value[c[t]]=!0})}function a(){o.value={}}function u(c){c.forEach(s=>{o.value[s[t]]||(o.value[s[t]]=!0)})}function y(c){c.forEach(s=>{o.value[s[t]]&&delete o.value[s[t]]})}function h(c){return!!o.value[c[t]]}function p(c){c.forEach(s=>{h(s)?delete o.value[s[t]]:o.value[s[t]]=!0})}function d(){r.value?a():i()}return e.provide(ee,d),e.provide(te,p),e.provide(ne,h),e.provide(oe,l),e.provide(le,u),e.provide(re,i),e.provide(ae,y),e.provide(ie,r),e.provide(se,a),{selected:l,select:u,selectAll:i,unselect:y,unselectAll:a,toggle:p,toggleAll:d,isSelected:h,isAllSelected:r}}function ce(n){return()=>{console.debug(`\u9ED8\u8BA4${n}\u65B9\u6CD5,\u9700\u8981\u81EA\u5B9A\u4E49\u751F\u6548`)}}function ue({attribute:n,selectWay:t="colum",scrollOptions:o={},getSelectMap:l=()=>({})}){const{select:r=ce("\u9009\u62E9"),unselect:i=ce("\u53D6\u6D88\u9009\u62E9"),unselectAll:a=ce("\u53D6\u6D88\u5168\u9009")}=l();let u={};const y=e.computed(()=>ve(t==="colum"?P:G,50)),h=new Set,p=e.ref(!0),d=e.ref(),c=e.ref(!1),s=e.ref({x:0,y:0}),_=e.ref({x:0,y:0,scrollTop:0}),w=new ResizeObserver(f=>g.value=f[0].target.getBoundingClientRect()),g=e.ref({}),S=e.ref({top:0,height:0,sync(f=!1){S.value.top=d.value?.scrollTop||0,f&&(S.value.height=d.value?.scrollHeight||0)}}),C=e.computed(()=>c.value?{left:Math.min(s.value.x,_.value.x)-g.value.left,top:Math.min(s.value.y,_.value.y)-g.value.top,width:Math.abs(s.value.x-_.value.x),height:Math.abs(s.value.y-_.value.y)}:{left:0,top:0,width:0,height:0}),{margin:V=50,startSpeed:U=30,maxSpeed:j=30}=o;let M;const L=V,A=U,$=j,F=f=>f**1;let I=0;function K(f){if(cancelAnimationFrame(M),I=q(f),I=Math.max(Math.min(I,$),-$),I!==0){const v=d.value;if(!v||!c.value)return;const O=S.value.height-g.value.height;let T=S.value.top+Number(I);T=Math.min(Math.max(0,T),O),v.scrollTop=T,N(),M=requestAnimationFrame(()=>K(f))}}function q(f){if(d.value){const O=g.value,T=O.bottom-f;if(T<L)return A*F(1-T/L);const H=f-O.top;if(H<L)return-A*F(1-H/L)}return 0}function k(f){const v={...C.value,right:0,bottom:0};return v.left+=g.value.left,v.top+=g.value.top-S.value.top,v.right=v.width+v.left,v.bottom=v.height+v.top,v.left<f.right&&v.right>f.left&&v.top<f.bottom&&v.bottom>f.top}function N(){S.value.sync();const{top:f,height:v}=S.value;_.value.y=Math.min(v+g.value.top,_.value.y+f-_.value.scrollTop),_.value.scrollTop=f}function m(f,v,O="dynamic-styles"){let T=document.getElementById(O);T||(T=document.createElement("style"),T.id=O,document.head.appendChild(T));const H=T.sheet.cssRules,W=H.length,st=`${f} { ${v} }`;for(let de=0;de<W;de++){const xe=H[de];if(xe.selectorText===f&&xe.style.cssText===v)return}T.sheet.insertRule(st,W)}function b(f,v){p.value=!0,c.value=!0,S.value.height?S.value.sync():S.value.sync(!0),s.value.x=f,s.value.y=v+S.value.top,_.value.x=s.value.x,_.value.y=s.value.y,d.value?.classList.add("disable-scroll-behavior"),h.clear()}function R(f,v,O){!c.value||(p.value&&t==="colum"&&!x()&&(a(),p.value=!1),O?.(),K(v),_.value.x=Math.max(f,g.value.left),_.value.y=Math.min(v+S.value.top,S.value.height+g.value.top),_.value.scrollTop=S.value.top,y.value())}function D(){c.value=!1,d.value?.classList.remove("disable-scroll-behavior")}function B(){!c.value||(I||N(),y.value())}function x(){if(!c.value)return!1;const{width:f,height:v}=C.value;return!(Math.max(f,v)>5)}function z(){x()&&a()}function P(){x()||d.value?.querySelectorAll(`[${n}]`).forEach(f=>{u[`${n}`]=f.getAttribute(`${n}`),k(f.getBoundingClientRect())?r([u]):i([u])})}function G(){const f=[];let v=null,O=0;d.value?.querySelectorAll(`[${n}]`).forEach((T,H)=>{const W=T.getAttribute(`${n}`);f.push(W),k(T.getBoundingClientRect())?(v===null&&(v=H),v=Math.min(v,H),O=Math.max(O,H)):(u[`${n}`]=W,h.has(W)&&i([u]))});for(let T=v;T<O+1;T++)u[`${n}`]=f[T],r([u]),h.add(f[T])}function X(f){return!f?.value||(d.value=f.value,!d?.value)?!1:(w.observe(d.value),m(".disable-scroll-behavior","scroll-behavior: unset !important;"),!0)}return{init:X,dragStart:b,dragMove:R,dragEnd:D,onScroll:B,isSingleClick:x,cancelSelectAllBySingleClick:z,selectFn:y,selectRange:C,isPressing:c,containerEl:d,observer:w}}function ze(n){const t=ue(n),{observer:o,selectRange:l}=t,{onScroll:r,dragStart:i,dragMove:a,dragEnd:u,cancelSelectAllBySingleClick:y}=t,h=e.computed(()=>({left:`${l.value.left}px`,top:`${l.value.top}px`,width:`${l.value.width}px`,height:`${l.value.height}px`})),p=e.defineComponent({render(){return e.h("div",{id:"selectBoxEl",class:"absolute z-50 bg-blue-200 opacity-50",style:h.value})}});function d(g){g.button===0&&i(g.x,g.y)}function c(g){a(g.x,g.y)}function s(g){g.composedPath().some(C=>C?.getAttribute?.(n.attribute))||y(),u()}function _(g){try{if(!t.init(g))throw"\u521D\u59CB\u5316\u5931\u8D25,Ref\u5143\u7D20\u4E0D\u6B63\u786E";if(!t.containerEl?.value)return!1;e.render(e.h(p),t.containerEl.value),t.containerEl.value?.addEventListener("scroll",r),t.containerEl.value?.addEventListener("mousedown",d),window.addEventListener("mousemove",c),window.addEventListener("mouseup",s)}catch(S){console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25",S)}}function w(){o.disconnect(),t.containerEl.value?.removeEventListener("scroll",r),t.containerEl.value?.removeEventListener("mousedown",d),window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",s)}return{init:_,unMount:w}}function We(n,t,o=600){const l=ue({...n,selectWay:"row",scrollOptions:{startSpeed:5,maxSpeed:5}}),{observer:r}=l,{onScroll:i,dragStart:a,dragMove:u,dragEnd:y}=l;let h;function p(){clearTimeout(h)}function d(g){p(),h=setTimeout(()=>{const{clientX:S,clientY:C}=g.targetTouches[0];a(S,C),t?.(),u(S,C,()=>g.preventDefault()),g.preventDefault()},o)}function c(g){p();const{clientX:S,clientY:C}=g.targetTouches[0];u(S,C,()=>g.preventDefault())}function s(){p(),y()}function _(g){try{if(!l.init(g))throw"\u521D\u59CB\u5316\u5931\u8D25,Ref\u5143\u7D20\u4E0D\u6B63\u786E";if(!l.containerEl?.value)return!1;l.containerEl.value?.addEventListener("scroll",i),l.containerEl.value?.addEventListener("touchstart",d),l.containerEl.value?.addEventListener("touchmove",c),window.addEventListener("touchcancel",s),window.addEventListener("touchend",s)}catch(S){console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25",S)}}function w(){r.disconnect(),l.containerEl.value?.removeEventListener("scroll",i),l.containerEl.value?.removeEventListener("touchstart",d),l.containerEl.value?.removeEventListener("touchmove",c),window.removeEventListener("touchcancel",s),window.removeEventListener("touchEnd",s)}return{init:_,unMount:w}}const we=Symbol(),Ue=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0},dialogClass:{default:""}},emits:["update:visiable"],setup(n,{emit:t}){const o=n,l=()=>{o.closeOnClickOverlay&&t("update:visiable",!1)};return e.provide(we,()=>t("update:visiable",!1)),(r,i)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[n.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:l,class:"modal"},[e.createElementVNode("div",{onClick:i[0]||(i[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog",n.dialogClass])},[e.renderSlot(r.$slots,"default",{},void 0,!0)],2)])):e.createCommentVNode("",!0)]),_:3}))}}),ut="",Y=(n,t)=>{const o=n.__vccOpts||n;for(const[l,r]of t)o[l]=r;return o},qe=Y(Ue,[["__scopeId","data-v-415900d3"]]);function Qe(n){function t(o,l){const r=document.createElement("div"),i={setup(){return()=>e.h(qe,{visiable:!0,"onUpdate:visiable":()=>{r?.remove()},...n},{default:()=>e.h(o,l)})}};return document.body.appendChild(r),e.render(e.h(i),r),{close:()=>r?.remove()}}return{create:t}}const Ye=e.defineComponent({__name:"Toast",props:{message:null,position:null},setup(n){const t=n,o=e.ref(),l=e.ref(),r=e.ref(),i=e.computed(()=>{switch(t.position){case"top":return 10;case"middle":return 50;case"bottom":return 85}}),a=e.computed(()=>({position:"absolute",borderRadius:"10px",backgroundColor:"rgba(0, 0, 0, 0.8)",padding:"14px 19px",top:`calc(${i.value}% - ${r.value}px)`,left:`calc(50% - ${l.value}px)`})),u=e.computed(()=>({width:"fit-content",display:"flex",justifyContent:"center",alignItems:"center",color:"white",fontSize:"14px"}));return e.nextTick(()=>{l.value=o.value.offsetWidth/2,r.value=o.value.offsetHeight/2}),(y,h)=>(e.openBlock(),e.createElementBlock("div",{id:"toastWrapper",ref_key:"toastWrapper",ref:o,class:"toastWrapper",style:e.normalizeStyle([e.unref(a),{zIndex:9999}])},[e.createElementVNode("div",{style:e.normalizeStyle(e.unref(u))},[e.createElementVNode("span",null,e.toDisplayString(n.message),1)],4)],4))}}),dt="",Ge=Y(Ye,[["__scopeId","data-v-15ab4094"]]),Te={message:"\u61D2\u732B\u4E91 Yes!!!",position:"middle",duration:1500};class Xe{options;container;constructor(t){this.options=t,this.container=document.createElement("div")}present(){const t=e.h(e.h(Ge),{...Te,...this.options});e.render(t,this.container),document.body.insertBefore(this.container,document.body.firstChild);const o=this.options.duration||Te.duration;setTimeout(()=>{this.dismiss()},o)}dismiss(){if(this.container){const t=this.container.querySelector("#toastWrapper");t.style.opacity="0",t.style.transition="opacity 0.4s ease-in",setTimeout(()=>{this.container&&(e.render(null,this.container),document.body.removeChild(this.container))},500)}}}const Je=["xlink:href","fill","color"],Ze=e.defineComponent({__name:"SvgIcon",props:{name:null,prefix:{default:"icon"},color:{default:"#FFF"},width:null,height:null},setup(n){const t=n,o=e.computed(()=>`#${t.prefix}-${t.name}`),l=e.computed(()=>({width:`${t.width??t.height}px`,height:`${t.height??t.width}px`,aspectRatio:t.width&&t.height?void 0:"1/1"}));return(r,i)=>(e.openBlock(),e.createElementBlock("svg",{"aria-hidden":"",style:e.normalizeStyle(e.unref(l))},[e.createElementVNode("use",{"xlink:href":e.unref(o),fill:n.color,color:n.color},null,8,Je)],4))}});function et(n){const{containerEl:t,sliderEl:o,autoHeight:l,performance:r={},maxHeightRatio:i=.9}=n,a=e.ref(!0),u=me($,100);let y,h="";const p=e.ref(0),d=e.ref(0),c=e.ref(0),s=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),_=e.ref({clientHeight:0}),w=e.computed(()=>!!d.value),g=e.computed(()=>s.value.scrollHeight>s.value.clientHeight),S=e.computed(()=>s.value.clientHeight-_.value.clientHeight),C=e.computed(()=>s.value.scrollHeight-s.value.clientHeight),V=e.computed(()=>Math.max(s.value.clientHeight/s.value.scrollHeight,.05)),U=e.computed(()=>V.value>i?0:V.value*s.value.clientHeight),j=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${c.value}px,0)`,height:l?`${U.value}px`:void 0}));function M(B){A(),d.value=B.clientY-o.value.getBoundingClientRect().top||1,h=getComputedStyle(t.value).scrollBehavior,h==="smooth"&&(t.value.style.scrollBehavior="unset")}function L(){t.value.style.scrollBehavior=h,d.value=0,u()}function A(){a.value=!1}function $(){w.value||(a.value=!0)}function F(B){if(!w.value)return;let x=B.clientY-s.value.top-d.value;x<0?c.value=0:x>=S.value?c.value=S.value:c.value=x,t.value.scrollTo({top:c.value/S.value*C.value})}function I(){w.value||K()}function K(){cancelAnimationFrame(y),y=requestAnimationFrame(q)}function q(){t.value&&(p.value=r.scrollTop?.value??t.value.scrollTop,c.value=p.value/C.value*S.value)}function k(B){let x="addEventListener";B==="add"?x="addEventListener":x="removeEventListener",o.value?.[x]("pointerdown",M,{passive:!0}),window[x]("pointermove",F,{passive:!0}),window[x]("pointerup",L,{passive:!0})}const N=new MutationObserver(B=>{B.map(z=>z.oldValue).join().includes("height")&&m()});function m(){s.value.top=t.value?.getBoundingClientRect().top??0,s.value.scrollHeight=t.value?.scrollHeight??0,s.value.clientHeight=t.value?.clientHeight??0}function b(){A(),setTimeout(()=>{_.value.clientHeight=o.value?.clientHeight??0,$()},150)}function R(B,x,z="dynamic-styles"){let P=document.getElementById(z);P||(P=document.createElement("style"),P.id=z,document.head.appendChild(P));const G=P.sheet.cssRules,X=G.length,f=`${B} { ${x} }`;for(let v=0;v<X;v++){const O=G[v];if(O.selectorText===B&&O.style.cssText===x)return}P.sheet.insertRule(f,X)}function D(){t.value&&o.value?(R(".hide-scrollbar","scrollbar-width: none; -ms-overflow-style: none;"),R(".hide-scrollbar::-webkit-scrollbar","display: none"),t.value.classList.add("hide-scrollbar"),t.value.addEventListener("scroll",I,{passive:!0}),k("add"),N.observe(t.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{m()},100),b()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:t,sliderEl:o})}return e.watch(p,()=>{A(),u()}),{isScrollEnd:a,isDragSlider:w,offsetTop:c,scrollTop:p,scrollable:g,sliderPos:j,init:D,modifySliderEventListener:k}}const tt=(n=>(e.pushScopeId("data-v-edec7292"),n=n(),e.popScopeId(),n))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),nt=e.defineComponent({__name:"ScrollBar",props:{containerEl:null,autoHide:{type:Boolean},autoHeight:{type:Boolean},performance:null},setup(n,{expose:t}){const o=n,l=!!e.useSlots().default,r=e.ref(null),i=e.computed(()=>o.containerEl),a=et({containerEl:i,sliderEl:r,autoHeight:l?o.autoHeight:!0,performance:o.performance}),{scrollable:u,isScrollEnd:y,sliderPos:h}=a,p=e.ref(!1),d=o.autoHide?e.computed(()=>p.value||!y.value):e.computed(()=>u.value);e.onMounted(()=>{e.nextTick(()=>{a.init()})}),e.onUnmounted(()=>{a.modifySliderEventListener("remove")});function c(){p.value=!0}function s(){p.value=!1}return t({uScrollBarReturn:a}),(_,w)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"sliderRef",ref:r,class:"slider-wrapper",onMouseenter:c,onMouseleave:s,style:e.normalizeStyle(e.unref(h))},[e.renderSlot(_.$slots,"default",{},()=>[tt],!0)],36),[[e.vShow,e.unref(d)]])]),_:3}))}}),pt="",ot=Y(nt,[["__scopeId","data-v-edec7292"]]),lt={class:"virtualListWrapper"},rt={inheritAttrs:!1},at=e.defineComponent({...rt,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},emits:["scrollEnd"],setup(n,{expose:t,emit:o}){const l=n,r=_e(e.toRef(l,"data"),{itemHeight:p=>l.itemHeight(l.data[p]),overscan:l.overscan,scrollEndHook:()=>{o("scrollEnd")}}),{list:i,containerProps:a,wrapperProps:u,innerProps:y,getItemHeightData:h}=r;return t({vListReturn:r}),(p,d)=>(e.openBlock(),e.createElementBlock("div",lt,[e.createElementVNode("div",e.mergeProps({onScrollPassive:d[0]||(d[0]=(...c)=>e.unref(a).onScroll&&e.unref(a).onScroll(...c)),ref:e.unref(a).ref,class:"virtualList"},p.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(u))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(y))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i),({index:c,data:s})=>(e.openBlock(),e.createElementBlock("div",{key:c,style:e.normalizeStyle({height:`${e.unref(h)(c).height}px`,display:"flex"})},[e.renderSlot(p.$slots,"default",{data:s,index:c},void 0,!0)],4))),128))],16)],16)],16)]))}}),ht="",it=Y(at,[["__scopeId","data-v-4ba97cce"]]);E.ScrollBar=ot,E.SvgIcon=Ze,E.ToastCreator=Xe,E.VirtualList=it,E.allSelectedKey=oe,E.closeDialogKey=we,E.dialogController=Qe,E.isAllSelectedKey=ie,E.isSelectedKey=ne,E.selectAllKey=re,E.selectKey=le,E.toggleAllKey=ee,E.toggleKey=te,E.unselectAllKey=se,E.unselectKey=ae,E.useDragSelect=ue,E.useDragSelectByMobile=We,E.useDragSelectByPc=ze,E.useSelectable=Ne,E.useSelectableInjectors=Ke,E.useVirtualList=_e,Object.defineProperties(E,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(E,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(E=typeof globalThis<"u"?globalThis:E||self,e(E.ui={},E.Vue))})(this,function(E,e){"use strict";var fe;const pe=typeof window<"u";pe&&((fe=window?.navigator)==null?void 0:fe.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function Q(n){return typeof n=="function"?n():e.unref(n)}function he(n,t){function o(...l){n(()=>t.apply(this,l),{fn:t,thisArg:this,args:l})}return o}function Be(n,t={}){let o,l;return i=>{const a=Q(n),u=Q(t.maxWait);if(o&&clearTimeout(o),a<=0||u!==void 0&&u<=0)return l&&(clearTimeout(l),l=null),i();u&&!l&&(l=setTimeout(()=>{o&&clearTimeout(o),l=null,i()},u)),o=setTimeout(()=>{l&&clearTimeout(l),l=null,i()},a)}}function Oe(n,t=!0,o=!0){let l=0,r,i=!0;const a=()=>{r&&(clearTimeout(r),r=void 0)};return y=>{const h=Q(n),p=Date.now()-l;if(a(),h<=0)return l=Date.now(),y();p>h&&(o||!i)?(l=Date.now(),y()):t&&(r=setTimeout(()=>{l=Date.now(),i=!0,a(),y()},h)),!o&&!r&&(r=setTimeout(()=>i=!0,h)),i=!1}}function Ce(n){return n}function De(n){return e.getCurrentScope()?(e.onScopeDispose(n),!0):!1}function me(n,t=200,o={}){return he(Be(t,o),n)}function ve(n,t=200,o=!1,l=!0){return he(Oe(t,o,l),n)}function Re(n,t=!0){e.getCurrentInstance()?e.onMounted(n):t?n():e.nextTick(n)}function ge(n){var t;const o=Q(n);return(t=o?.$el)!=null?t:o}const Ie=pe?window:void 0;function Le(n,t=!1){const o=e.ref(),l=()=>o.value=Boolean(n());return l(),Re(l,t),o}const J=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Z="__vueuse_ssr_handlers__";J[Z]=J[Z]||{},J[Z];var ye=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,He=Object.prototype.propertyIsEnumerable,Pe=(n,t)=>{var o={};for(var l in n)Ae.call(n,l)&&t.indexOf(l)<0&&(o[l]=n[l]);if(n!=null&&ye)for(var l of ye(n))t.indexOf(l)<0&&He.call(n,l)&&(o[l]=n[l]);return o};function Me(n,t,o={}){const l=o,{window:r=Ie}=l,i=Pe(l,["window"]);let a;const u=Le(()=>r&&"ResizeObserver"in r),y=()=>{a&&(a.disconnect(),a=void 0)},h=e.watch(()=>ge(n),d=>{y(),u.value&&r&&d&&(a=new ResizeObserver(t),a.observe(d,i))},{immediate:!0,flush:"post"}),p=()=>{y(),h()};return De(p),{isSupported:u,stop:p}}function $e(n,t={width:0,height:0},o={}){const{box:l="content-box"}=o,r=e.ref(t.width),i=e.ref(t.height);return Me(n,([a])=>{const u=l==="border-box"?a.borderBoxSize:l==="content-box"?a.contentBoxSize:a.devicePixelContentBoxSize;u?(r.value=u.reduce((y,{inlineSize:h})=>y+h,0),i.value=u.reduce((y,{blockSize:h})=>y+h,0)):(r.value=a.contentRect.width,i.value=a.contentRect.height)},o),e.watch(()=>ge(n),a=>{r.value=a?t.width:0,i.value=a?t.height:0}),{width:r,height:i}}var Se;(function(n){n.UP="UP",n.RIGHT="RIGHT",n.DOWN="DOWN",n.LEFT="LEFT",n.NONE="NONE"})(Se||(Se={}));var Fe=Object.defineProperty,be=Object.getOwnPropertySymbols,ke=Object.prototype.hasOwnProperty,Ve=Object.prototype.propertyIsEnumerable,Ee=(n,t,o)=>t in n?Fe(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,je=(n,t)=>{for(var o in t||(t={}))ke.call(t,o)&&Ee(n,o,t[o]);if(be)for(var o of be(t))Ve.call(t,o)&&Ee(n,o,t[o]);return n};je({linear:Ce},{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 _e(n,t){const{scrollEndHook:o,itemHeight:l,overscan:r=5}=t,i=e.ref(null),a=$e(i),u=e.ref(!0),y=me(U,100);let h;const p=e.shallowRef(n),d=e.ref(0),c=e.ref({start:0,end:10});let s=0;const _=e.ref([]),w=e.computed(()=>{let{sum:m,height:S}={sum:0,height:0};return p.value.map((R,D)=>(typeof l=="number"?S=l:S=l(D),m+=S,{height:S,sum:m}))}),g=e.computed(()=>F(c.value.start)),b=e.computed(()=>typeof l=="number"?w.value.length*l:w.value[w.value.length-1]?.sum||0),B=e.computed(()=>{let m=_.value.length-r,S=Math.max(m-s,0);return _.value.slice(S,m)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(h)),e.watch([a.width,a.height,p],([m,S])=>{(m||S)&&j()},{deep:!0}),e.watch(d,()=>{L(),y()});function L(){u.value=!1}function U(){u.value=!0,o?.()}function j(){cancelAnimationFrame(h),h=requestAnimationFrame($)}function $(){if(i.value){d.value=i.value.scrollTop,s=P();let m=A(d.value),S=m+s+r;m=m-r,m=m<0?0:m,S=S>p.value.length?p.value.length:S,c.value={start:m,end:S},_.value=p.value.slice(m,S).map((R,D)=>({data:R,index:D+m}))}}function A(m){let S=0,R=w.value.length-1,D=-1;for(;S<=R;){const O=Math.floor((S+R)/2);w.value[O].sum>=m?(D=O,R=O-1):S=O+1}return Math.max(0,D)}function P(){let m=0,S=0,R=I();for(let D=R;D<w.value.length&&(m++,S+=w.value[D].height,!(S>=a.height.value));D++);return m}function F(m){if(typeof l=="number")return m*l;let S=w.value[m];return S?S.sum-S.height:0}function k(m){return w.value[m]||{sum:0,height:0}}function I(){let m=c.value.start;return m>=r&&(m+=r),m}function z(m){if(i.value){const S=k(m);i.value.scrollTop=S.sum-S.height,$()}}const q=e.computed(()=>({style:{width:"100%",height:`${b.value}px`,pointerEvents:u.value?void 0:"none"}})),V=e.computed(()=>({style:{transform:`translate3d(0, ${g.value}px, 0)`,"will-change":"transform"}})),K={overflowY:"auto"};return{list:_,visiableList:B,getItemHeightData:k,getoffsetTopIndex:A,totalHeight:b,clientHeight:a.height,scrollTo:z,scrollTop:d,isScrollEnd:u,containerProps:{ref:i,onScroll:()=>{j()},style:K},wrapperProps:q,innerProps:V}}const ee=Symbol(),te=Symbol(),ne=Symbol(),oe=Symbol(),le=Symbol(),re=Symbol(),ae=Symbol(),ie=Symbol(),se=Symbol();function ze(){const{voidFn:n,boolFn:t,boolRef:o,arrayRef:l}={voidFn:s=>{},boolFn:s=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},r=e.inject(oe,l),i=e.inject(ne,t),a=e.inject(ie,o),u=e.inject(te,n),y=e.inject(ee,n),h=e.inject(le,n),p=e.inject(re,n),d=e.inject(ae,n),c=e.inject(se,n);return{selected:r,isSelected:i,isAllSelected:a,toggle:u,toggleAll:y,select:h,selectAll:p,unselect:d,unselectAll:c}}function Ke(n,t){const o=e.ref({}),l=e.computed(()=>n.value.filter(c=>o.value[c[t]])),r=e.computed(()=>l.value.length!=0&&Object.keys(o.value).length==n.value.length);function i(){n.value.forEach(c=>{o.value[c[t]]=!0})}function a(){o.value={}}function u(c){c.forEach(s=>{o.value[s[t]]||(o.value[s[t]]=!0)})}function y(c){c.forEach(s=>{o.value[s[t]]&&delete o.value[s[t]]})}function h(c){return!!o.value[c[t]]}function p(c){c.forEach(s=>{h(s)?delete o.value[s[t]]:o.value[s[t]]=!0})}function d(){r.value?a():i()}return e.provide(ee,d),e.provide(te,p),e.provide(ne,h),e.provide(oe,l),e.provide(le,u),e.provide(re,i),e.provide(ae,y),e.provide(ie,r),e.provide(se,a),{selected:l,select:u,selectAll:i,unselect:y,unselectAll:a,toggle:p,toggleAll:d,isSelected:h,isAllSelected:r}}function ce(n){return()=>{console.debug(`\u9ED8\u8BA4${n}\u65B9\u6CD5,\u9700\u8981\u81EA\u5B9A\u4E49\u751F\u6548`)}}function ue({attribute:n,selectWay:t="colum",scrollOptions:o={},getSelectMap:l=()=>({})}){const{select:r=ce("\u9009\u62E9"),unselect:i=ce("\u53D6\u6D88\u9009\u62E9"),unselectAll:a=ce("\u53D6\u6D88\u5168\u9009")}=l();let u={};const y=e.computed(()=>ve(t==="colum"?M:G,50)),h=new Set,p=e.ref(!0),d=e.ref(),c=e.ref(!1),s=e.ref({x:0,y:0}),_=e.ref({x:0,y:0,scrollTop:0}),w=new ResizeObserver(f=>g.value=f[0].target.getBoundingClientRect()),g=e.ref({}),b=e.ref({top:0,height:0,sync(f=!1){b.value.top=d.value?.scrollTop||0,f&&(b.value.height=d.value?.scrollHeight||0)}}),B=e.computed(()=>c.value?{left:Math.min(s.value.x,_.value.x)-g.value.left,top:Math.min(s.value.y,_.value.y)-g.value.top,width:Math.abs(s.value.x-_.value.x),height:Math.abs(s.value.y-_.value.y)}:{left:0,top:0,width:0,height:0}),{margin:L=50,startSpeed:U=30,maxSpeed:j=30}=o;let $;const A=L,P=U,F=j,k=f=>f**1;let I=0;function z(f){if(cancelAnimationFrame($),I=q(f),I=Math.max(Math.min(I,F),-F),I!==0){const v=d.value;if(!v||!c.value)return;const C=b.value.height-g.value.height;let T=b.value.top+Number(I);T=Math.min(Math.max(0,T),C),v.scrollTop=T,K(),$=requestAnimationFrame(()=>z(f))}}function q(f){if(d.value){const C=g.value,T=C.bottom-f;if(T<A)return P*k(1-T/A);const H=f-C.top;if(H<A)return-P*k(1-H/A)}return 0}function V(f){const v={...B.value,right:0,bottom:0};return v.left+=g.value.left,v.top+=g.value.top-b.value.top,v.right=v.width+v.left,v.bottom=v.height+v.top,v.left<f.right&&v.right>f.left&&v.top<f.bottom&&v.bottom>f.top}function K(){b.value.sync();const{top:f,height:v}=b.value;_.value.y=Math.min(v+g.value.top,_.value.y+f-_.value.scrollTop),_.value.scrollTop=f}function m(f,v,C="dynamic-styles"){let T=document.getElementById(C);T||(T=document.createElement("style"),T.id=C,document.head.appendChild(T));const H=T.sheet.cssRules,W=H.length,st=`${f} { ${v} }`;for(let de=0;de<W;de++){const xe=H[de];if(xe.selectorText===f&&xe.style.cssText===v)return}T.sheet.insertRule(st,W)}function S(f,v){p.value=!0,c.value=!0,b.value.height?b.value.sync():b.value.sync(!0),s.value.x=f,s.value.y=v+b.value.top,_.value.x=s.value.x,_.value.y=s.value.y,d.value?.classList.add("disable-scroll-behavior"),h.clear()}function R(f,v,C){!c.value||(p.value&&t==="colum"&&!x()&&(a(),p.value=!1),C?.(),z(v),_.value.x=Math.max(f,g.value.left),_.value.y=Math.min(v+b.value.top,b.value.height+g.value.top),_.value.scrollTop=b.value.top,y.value())}function D(){c.value=!1,d.value?.classList.remove("disable-scroll-behavior")}function O(){!c.value||(I||K(),y.value())}function x(){if(!c.value)return!1;const{width:f,height:v}=B.value;return!(Math.max(f,v)>5)}function N(){x()&&a()}function M(){x()||d.value?.querySelectorAll(`[${n}]`).forEach(f=>{u[`${n}`]=f.getAttribute(`${n}`),V(f.getBoundingClientRect())?r([u]):i([u])})}function G(){const f=[];let v=null,C=0;d.value?.querySelectorAll(`[${n}]`).forEach((T,H)=>{const W=T.getAttribute(`${n}`);f.push(W),V(T.getBoundingClientRect())?(v===null&&(v=H),v=Math.min(v,H),C=Math.max(C,H)):(u[`${n}`]=W,h.has(W)&&i([u]))});for(let T=v;T<C+1;T++)u[`${n}`]=f[T],r([u]),h.add(f[T])}function X(f){return!f?.value||(d.value=f.value,!d?.value)?!1:(w.observe(d.value),m(".disable-scroll-behavior","scroll-behavior: unset !important;"),!0)}return{init:X,dragStart:S,dragMove:R,dragEnd:D,onScroll:O,isSingleClick:x,cancelSelectAllBySingleClick:N,selectFn:y,selectRange:B,isPressing:c,containerEl:d,observer:w}}function Ne(n){const t=ue(n),{observer:o,selectRange:l}=t,{onScroll:r,dragStart:i,dragMove:a,dragEnd:u,cancelSelectAllBySingleClick:y}=t,h=e.computed(()=>({left:`${l.value.left}px`,top:`${l.value.top}px`,width:`${l.value.width}px`,height:`${l.value.height}px`})),p=e.defineComponent({render(){return e.h("div",{id:"selectBoxEl",class:"absolute z-50 bg-blue-200 opacity-50",style:h.value})}});function d(g){g.button===0&&i(g.x,g.y)}function c(g){a(g.x,g.y)}function s(g){g.composedPath().some(B=>B?.getAttribute?.(n.attribute))||y(),u()}function _(g){try{if(!t.init(g))throw"\u521D\u59CB\u5316\u5931\u8D25,Ref\u5143\u7D20\u4E0D\u6B63\u786E";if(!t.containerEl?.value)return!1;e.render(e.h(p),t.containerEl.value),t.containerEl.value?.addEventListener("scroll",r),t.containerEl.value?.addEventListener("mousedown",d),window.addEventListener("mousemove",c),window.addEventListener("mouseup",s)}catch(b){console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25",b)}}function w(){o.disconnect(),t.containerEl.value?.removeEventListener("scroll",r),t.containerEl.value?.removeEventListener("mousedown",d),window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",s)}return{init:_,unMount:w}}function We(n,t,o=600){const l=ue({...n,selectWay:"row",scrollOptions:{startSpeed:5,maxSpeed:5}}),{observer:r}=l,{onScroll:i,dragStart:a,dragMove:u,dragEnd:y}=l;let h;function p(){clearTimeout(h)}function d(g){p(),g.composedPath().some(B=>!!B.getAttribute(n.attribute))&&(h=setTimeout(()=>{const{clientX:B,clientY:L}=g.targetTouches[0];a(B,L),t?.(),u(B,L,()=>g.preventDefault()),g.preventDefault()},o))}function c(g){p();const{clientX:b,clientY:B}=g.targetTouches[0];u(b,B,()=>g.preventDefault())}function s(){p(),y()}function _(g){try{if(!l.init(g))throw"\u521D\u59CB\u5316\u5931\u8D25,Ref\u5143\u7D20\u4E0D\u6B63\u786E";if(!l.containerEl?.value)return!1;l.containerEl.value?.addEventListener("scroll",i),l.containerEl.value?.addEventListener("touchstart",d),l.containerEl.value?.addEventListener("touchmove",c),window.addEventListener("touchcancel",s),window.addEventListener("touchend",s)}catch(b){console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25",b)}}function w(){r.disconnect(),l.containerEl.value?.removeEventListener("scroll",i),l.containerEl.value?.removeEventListener("touchstart",d),l.containerEl.value?.removeEventListener("touchmove",c),window.removeEventListener("touchcancel",s),window.removeEventListener("touchEnd",s)}return{init:_,unMount:w}}const we=Symbol(),Ue=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0},dialogClass:{default:""}},emits:["update:visiable"],setup(n,{emit:t}){const o=n,l=()=>{o.closeOnClickOverlay&&t("update:visiable",!1)};return e.provide(we,()=>t("update:visiable",!1)),(r,i)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[n.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:l,class:"lzc-modal"},[e.createElementVNode("div",{onClick:i[0]||(i[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["lzc-dialog",n.dialogClass])},[e.renderSlot(r.$slots,"default",{},void 0,!0)],2)])):e.createCommentVNode("",!0)]),_:3}))}}),ut="",Y=(n,t)=>{const o=n.__vccOpts||n;for(const[l,r]of t)o[l]=r;return o},qe=Y(Ue,[["__scopeId","data-v-e171c24d"]]);function Qe(n){function t(o,l){const r=document.createElement("div"),i={setup(){return()=>e.h(qe,{visiable:!0,"onUpdate:visiable":()=>{r?.remove()},...n},{default:()=>e.h(o,l)})}};return document.body.appendChild(r),e.render(e.h(i),r),{close:()=>r?.remove()}}return{create:t}}const Ye=e.defineComponent({__name:"Toast",props:{message:null,position:null},setup(n){const t=n,o=e.ref(),l=e.ref(),r=e.ref(),i=e.computed(()=>{switch(t.position){case"top":return 10;case"middle":return 50;case"bottom":return 85}}),a=e.computed(()=>({position:"absolute",borderRadius:"10px",backgroundColor:"rgba(0, 0, 0, 0.8)",padding:"14px 19px",top:`calc(${i.value}% - ${r.value}px)`,left:`calc(50% - ${l.value}px)`})),u=e.computed(()=>({width:"fit-content",display:"flex",justifyContent:"center",alignItems:"center",color:"white",fontSize:"14px"}));return e.nextTick(()=>{l.value=o.value.offsetWidth/2,r.value=o.value.offsetHeight/2}),(y,h)=>(e.openBlock(),e.createElementBlock("div",{id:"toastWrapper",ref_key:"toastWrapper",ref:o,class:"toastWrapper",style:e.normalizeStyle([e.unref(a),{zIndex:9999}])},[e.createElementVNode("div",{style:e.normalizeStyle(e.unref(u))},[e.createElementVNode("span",null,e.toDisplayString(n.message),1)],4)],4))}}),dt="",Ge=Y(Ye,[["__scopeId","data-v-15ab4094"]]),Te={message:"\u61D2\u732B\u4E91 Yes!!!",position:"middle",duration:1500};class Xe{options;container;constructor(t){this.options=t,this.container=document.createElement("div")}present(){const t=e.h(e.h(Ge),{...Te,...this.options});e.render(t,this.container),document.body.insertBefore(this.container,document.body.firstChild);const o=this.options.duration||Te.duration;setTimeout(()=>{this.dismiss()},o)}dismiss(){if(this.container){const t=this.container.querySelector("#toastWrapper");t.style.opacity="0",t.style.transition="opacity 0.4s ease-in",setTimeout(()=>{this.container&&(e.render(null,this.container),document.body.removeChild(this.container))},500)}}}const Je=["xlink:href","fill","color"],Ze=e.defineComponent({__name:"SvgIcon",props:{name:null,prefix:{default:"icon"},color:{default:"#FFF"},width:null,height:null},setup(n){const t=n,o=e.computed(()=>`#${t.prefix}-${t.name}`),l=e.computed(()=>({width:`${t.width??t.height}px`,height:`${t.height??t.width}px`,aspectRatio:t.width&&t.height?void 0:"1/1"}));return(r,i)=>(e.openBlock(),e.createElementBlock("svg",{"aria-hidden":"",style:e.normalizeStyle(e.unref(l))},[e.createElementVNode("use",{"xlink:href":e.unref(o),fill:n.color,color:n.color},null,8,Je)],4))}});function et(n){const{containerEl:t,sliderEl:o,autoHeight:l,performance:r={},maxHeightRatio:i=.9}=n,a=e.ref(!0),u=me(F,100);let y,h="";const p=e.ref(0),d=e.ref(0),c=e.ref(0),s=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),_=e.ref({clientHeight:0}),w=e.computed(()=>!!d.value),g=e.computed(()=>s.value.scrollHeight>s.value.clientHeight),b=e.computed(()=>s.value.clientHeight-_.value.clientHeight),B=e.computed(()=>s.value.scrollHeight-s.value.clientHeight),L=e.computed(()=>Math.max(s.value.clientHeight/s.value.scrollHeight,.05)),U=e.computed(()=>L.value>i?0:L.value*s.value.clientHeight),j=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${c.value}px,0)`,height:l?`${U.value}px`:void 0}));function $(O){P(),d.value=O.clientY-o.value.getBoundingClientRect().top||1,h=getComputedStyle(t.value).scrollBehavior,h==="smooth"&&(t.value.style.scrollBehavior="unset")}function A(){t.value.style.scrollBehavior=h,d.value=0,u()}function P(){a.value=!1}function F(){w.value||(a.value=!0)}function k(O){if(!w.value)return;let x=O.clientY-s.value.top-d.value;x<0?c.value=0:x>=b.value?c.value=b.value:c.value=x,t.value.scrollTo({top:c.value/b.value*B.value})}function I(){w.value||z()}function z(){cancelAnimationFrame(y),y=requestAnimationFrame(q)}function q(){t.value&&(p.value=r.scrollTop?.value??t.value.scrollTop,c.value=p.value/B.value*b.value)}function V(O){let x="addEventListener";O==="add"?x="addEventListener":x="removeEventListener",o.value?.[x]("pointerdown",$,{passive:!0}),window[x]("pointermove",k,{passive:!0}),window[x]("pointerup",A,{passive:!0})}const K=new MutationObserver(O=>{O.map(N=>N.oldValue).join().includes("height")&&m()});function m(){s.value.top=t.value?.getBoundingClientRect().top??0,s.value.scrollHeight=t.value?.scrollHeight??0,s.value.clientHeight=t.value?.clientHeight??0}function S(){P(),setTimeout(()=>{_.value.clientHeight=o.value?.clientHeight??0,F()},150)}function R(O,x,N="dynamic-styles"){let M=document.getElementById(N);M||(M=document.createElement("style"),M.id=N,document.head.appendChild(M));const G=M.sheet.cssRules,X=G.length,f=`${O} { ${x} }`;for(let v=0;v<X;v++){const C=G[v];if(C.selectorText===O&&C.style.cssText===x)return}M.sheet.insertRule(f,X)}function D(){t.value&&o.value?(R(".hide-scrollbar","scrollbar-width: none; -ms-overflow-style: none;"),R(".hide-scrollbar::-webkit-scrollbar","display: none"),t.value.classList.add("hide-scrollbar"),t.value.addEventListener("scroll",I,{passive:!0}),V("add"),K.observe(t.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{m()},100),S()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:t,sliderEl:o})}return e.watch(p,()=>{P(),u()}),{isScrollEnd:a,isDragSlider:w,offsetTop:c,scrollTop:p,scrollable:g,sliderPos:j,init:D,modifySliderEventListener:V}}const tt=(n=>(e.pushScopeId("data-v-edec7292"),n=n(),e.popScopeId(),n))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),nt=e.defineComponent({__name:"ScrollBar",props:{containerEl:null,autoHide:{type:Boolean},autoHeight:{type:Boolean},performance:null},setup(n,{expose:t}){const o=n,l=!!e.useSlots().default,r=e.ref(null),i=e.computed(()=>o.containerEl),a=et({containerEl:i,sliderEl:r,autoHeight:l?o.autoHeight:!0,performance:o.performance}),{scrollable:u,isScrollEnd:y,sliderPos:h}=a,p=e.ref(!1),d=o.autoHide?e.computed(()=>p.value||!y.value):e.computed(()=>u.value);e.onMounted(()=>{e.nextTick(()=>{a.init()})}),e.onUnmounted(()=>{a.modifySliderEventListener("remove")});function c(){p.value=!0}function s(){p.value=!1}return t({uScrollBarReturn:a}),(_,w)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"sliderRef",ref:r,class:"slider-wrapper",onMouseenter:c,onMouseleave:s,style:e.normalizeStyle(e.unref(h))},[e.renderSlot(_.$slots,"default",{},()=>[tt],!0)],36),[[e.vShow,e.unref(d)]])]),_:3}))}}),pt="",ot=Y(nt,[["__scopeId","data-v-edec7292"]]),lt={class:"virtualListWrapper"},rt={inheritAttrs:!1},at=e.defineComponent({...rt,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},emits:["scrollEnd"],setup(n,{expose:t,emit:o}){const l=n,r=_e(e.toRef(l,"data"),{itemHeight:p=>l.itemHeight(l.data[p]),overscan:l.overscan,scrollEndHook:()=>{o("scrollEnd")}}),{list:i,containerProps:a,wrapperProps:u,innerProps:y,getItemHeightData:h}=r;return t({vListReturn:r}),(p,d)=>(e.openBlock(),e.createElementBlock("div",lt,[e.createElementVNode("div",e.mergeProps({onScrollPassive:d[0]||(d[0]=(...c)=>e.unref(a).onScroll&&e.unref(a).onScroll(...c)),ref:e.unref(a).ref,class:"virtualList"},p.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(u))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(y))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i),({index:c,data:s})=>(e.openBlock(),e.createElementBlock("div",{key:c,style:e.normalizeStyle({height:`${e.unref(h)(c).height}px`,display:"flex"})},[e.renderSlot(p.$slots,"default",{data:s,index:c},void 0,!0)],4))),128))],16)],16)],16)]))}}),ht="",it=Y(at,[["__scopeId","data-v-4ba97cce"]]);E.ScrollBar=ot,E.SvgIcon=Ze,E.ToastCreator=Xe,E.VirtualList=it,E.allSelectedKey=oe,E.closeDialogKey=we,E.dialogController=Qe,E.isAllSelectedKey=ie,E.isSelectedKey=ne,E.selectAllKey=re,E.selectKey=le,E.toggleAllKey=ee,E.toggleKey=te,E.unselectAllKey=se,E.unselectKey=ae,E.useDragSelect=ue,E.useDragSelectByMobile=We,E.useDragSelectByPc=Ne,E.useSelectable=Ke,E.useSelectableInjectors=ze,E.useVirtualList=_e,Object.defineProperties(E,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .modal[data-v-415900d3]{position:absolute;inset:0;display:flex;z-index:999;background-color:#1c191780}.dialog[data-v-415900d3]{margin:auto;display:flex;flex-direction:column}@keyframes slide-15ab4094{0%{opacity:1}to{opacity:0}}.animate-toastAnimation[data-v-15ab4094]{animation:slide-15ab4094 .3s linear}.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
+ .lzc-modal[data-v-e171c24d]{position:absolute;inset:0;display:flex;z-index:999;background-color:#1c191780}.lzc-dialog[data-v-e171c24d]{margin:auto;display:flex;flex-direction:column}@keyframes slide-15ab4094{0%{opacity:1}to{opacity:0}}.animate-toastAnimation[data-v-15ab4094]{animation:slide-15ab4094 .3s linear}.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.56",
3
+ "version": "0.0.59",
4
4
  "description": "lazycat ui toolkits",
5
5
  "main": "./dist/index.umd.js",
6
6
  "module": "./dist/index.es.js",