@lazycatcloud/lzc-toolkit 0.0.50 → 0.0.51

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,26 +1,26 @@
1
- import { unref as b, getCurrentScope as Ce, onScopeDispose as Re, getCurrentInstance as Be, onMounted as te, nextTick as oe, ref as g, watch as $, shallowRef as Pe, computed as f, onUnmounted as fe, inject as T, provide as x, defineComponent as F, openBlock as I, createBlock as pe, Transition as he, withCtx as me, createElementBlock as R, createElementVNode as H, withModifiers as $e, normalizeClass as Fe, renderSlot as ne, createCommentVNode as Ae, render as J, h as P, normalizeStyle as j, toDisplayString as Le, useSlots as De, withDirectives as We, vShow as Me, pushScopeId as ke, popScopeId as Ve, toRef as ze, mergeProps as Ke, normalizeProps as se, guardReactiveProps as re, Fragment as je, renderList as Ne } from "vue";
2
- var ae;
3
- const A = typeof window < "u";
4
- A && ((ae = window?.navigator) == null ? void 0 : ae.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
1
+ import { unref as y, getCurrentScope as Ce, onScopeDispose as Re, getCurrentInstance as Be, onMounted as te, nextTick as ne, ref as g, watch as $, shallowRef as Pe, computed as f, onUnmounted as ve, inject as T, provide as x, defineComponent as A, openBlock as I, createBlock as fe, Transition as pe, withCtx as he, createElementBlock as R, createElementVNode as H, withModifiers as $e, normalizeClass as Fe, renderSlot as oe, createCommentVNode as Ae, render as J, h as P, normalizeStyle as F, toDisplayString as Le, useSlots as De, withDirectives as We, vShow as Me, pushScopeId as ke, popScopeId as ze, toRef as Ve, mergeProps as je, normalizeProps as le, guardReactiveProps as se, Fragment as Ke, renderList as Ne } from "vue";
2
+ var re;
3
+ const L = typeof window < "u";
4
+ L && ((re = window?.navigator) == null ? void 0 : re.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
5
5
  function X(t) {
6
- return typeof t == "function" ? t() : b(t);
6
+ return typeof t == "function" ? t() : y(t);
7
7
  }
8
8
  function Qe(t, e) {
9
- function o(...n) {
10
- t(() => e.apply(this, n), { fn: e, thisArg: this, args: n });
9
+ function n(...o) {
10
+ t(() => e.apply(this, o), { fn: e, thisArg: this, args: o });
11
11
  }
12
- return o;
12
+ return n;
13
13
  }
14
14
  function Ue(t, e = {}) {
15
- let o, n;
15
+ let n, o;
16
16
  return (r) => {
17
- const l = X(t), d = X(e.maxWait);
18
- if (o && clearTimeout(o), l <= 0 || d !== void 0 && d <= 0)
19
- return n && (clearTimeout(n), n = null), r();
20
- d && !n && (n = setTimeout(() => {
21
- o && clearTimeout(o), n = null, r();
22
- }, d)), o = setTimeout(() => {
23
- n && clearTimeout(n), n = null, r();
17
+ const l = X(t), c = X(e.maxWait);
18
+ if (n && clearTimeout(n), l <= 0 || c !== void 0 && c <= 0)
19
+ return o && (clearTimeout(o), o = null), r();
20
+ c && !o && (o = setTimeout(() => {
21
+ n && clearTimeout(n), o = null, r();
22
+ }, c)), n = setTimeout(() => {
23
+ o && clearTimeout(o), o = null, r();
24
24
  }, l);
25
25
  };
26
26
  }
@@ -30,74 +30,74 @@ function qe(t) {
30
30
  function Ye(t) {
31
31
  return Ce() ? (Re(t), !0) : !1;
32
32
  }
33
- function ge(t, e = 200, o = {}) {
34
- return Qe(Ue(e, o), t);
33
+ function me(t, e = 200, n = {}) {
34
+ return Qe(Ue(e, n), t);
35
35
  }
36
36
  function Ge(t, e = !0) {
37
- Be() ? te(t) : e ? t() : oe(t);
37
+ Be() ? te(t) : e ? t() : ne(t);
38
38
  }
39
- function _e(t) {
39
+ function ge(t) {
40
40
  var e;
41
- const o = X(t);
42
- return (e = o?.$el) != null ? e : o;
41
+ const n = X(t);
42
+ return (e = n?.$el) != null ? e : n;
43
43
  }
44
- const Je = A ? window : void 0;
45
- A && window.document;
46
- A && window.navigator;
47
- A && window.location;
44
+ const Je = L ? window : void 0;
45
+ L && window.document;
46
+ L && window.navigator;
47
+ L && window.location;
48
48
  function Xe(t, e = !1) {
49
- const o = g(), n = () => o.value = Boolean(t());
50
- return n(), Ge(n, e), o;
49
+ const n = g(), o = () => n.value = Boolean(t());
50
+ return o(), Ge(o, e), n;
51
51
  }
52
52
  const Z = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, ee = "__vueuse_ssr_handlers__";
53
53
  Z[ee] = Z[ee] || {};
54
54
  Z[ee];
55
- var ie = Object.getOwnPropertySymbols, Ze = Object.prototype.hasOwnProperty, et = Object.prototype.propertyIsEnumerable, tt = (t, e) => {
56
- var o = {};
57
- for (var n in t)
58
- Ze.call(t, n) && e.indexOf(n) < 0 && (o[n] = t[n]);
59
- if (t != null && ie)
60
- for (var n of ie(t))
61
- e.indexOf(n) < 0 && et.call(t, n) && (o[n] = t[n]);
62
- return o;
55
+ var ae = Object.getOwnPropertySymbols, Ze = Object.prototype.hasOwnProperty, et = Object.prototype.propertyIsEnumerable, tt = (t, e) => {
56
+ var n = {};
57
+ for (var o in t)
58
+ Ze.call(t, o) && e.indexOf(o) < 0 && (n[o] = t[o]);
59
+ if (t != null && ae)
60
+ for (var o of ae(t))
61
+ e.indexOf(o) < 0 && et.call(t, o) && (n[o] = t[o]);
62
+ return n;
63
63
  };
64
- function ot(t, e, o = {}) {
65
- const n = o, { window: s = Je } = n, r = tt(n, ["window"]);
64
+ function nt(t, e, n = {}) {
65
+ const o = n, { window: s = Je } = o, r = tt(o, ["window"]);
66
66
  let l;
67
- const d = Xe(() => s && "ResizeObserver" in s), m = () => {
67
+ const c = Xe(() => s && "ResizeObserver" in s), m = () => {
68
68
  l && (l.disconnect(), l = void 0);
69
- }, p = $(() => _e(t), (h) => {
70
- m(), d.value && s && h && (l = new ResizeObserver(e), l.observe(h, r));
69
+ }, p = $(() => ge(t), (h) => {
70
+ m(), c.value && s && h && (l = new ResizeObserver(e), l.observe(h, r));
71
71
  }, { immediate: !0, flush: "post" }), v = () => {
72
72
  m(), p();
73
73
  };
74
74
  return Ye(v), {
75
- isSupported: d,
75
+ isSupported: c,
76
76
  stop: v
77
77
  };
78
78
  }
79
- function nt(t, e = { width: 0, height: 0 }, o = {}) {
80
- const { box: n = "content-box" } = o, s = g(e.width), r = g(e.height);
81
- return ot(t, ([l]) => {
82
- const d = n === "border-box" ? l.borderBoxSize : n === "content-box" ? l.contentBoxSize : l.devicePixelContentBoxSize;
83
- d ? (s.value = d.reduce((m, { inlineSize: p }) => m + p, 0), r.value = d.reduce((m, { blockSize: p }) => m + p, 0)) : (s.value = l.contentRect.width, r.value = l.contentRect.height);
84
- }, o), $(() => _e(t), (l) => {
79
+ function ot(t, e = { width: 0, height: 0 }, n = {}) {
80
+ const { box: o = "content-box" } = n, s = g(e.width), r = g(e.height);
81
+ return nt(t, ([l]) => {
82
+ const c = o === "border-box" ? l.borderBoxSize : o === "content-box" ? l.contentBoxSize : l.devicePixelContentBoxSize;
83
+ c ? (s.value = c.reduce((m, { inlineSize: p }) => m + p, 0), r.value = c.reduce((m, { blockSize: p }) => m + p, 0)) : (s.value = l.contentRect.width, r.value = l.contentRect.height);
84
+ }, n), $(() => ge(t), (l) => {
85
85
  s.value = l ? e.width : 0, r.value = l ? e.height : 0;
86
86
  }), {
87
87
  width: s,
88
88
  height: r
89
89
  };
90
90
  }
91
- var ue;
91
+ var ie;
92
92
  (function(t) {
93
93
  t.UP = "UP", t.RIGHT = "RIGHT", t.DOWN = "DOWN", t.LEFT = "LEFT", t.NONE = "NONE";
94
- })(ue || (ue = {}));
95
- var lt = Object.defineProperty, ce = Object.getOwnPropertySymbols, st = Object.prototype.hasOwnProperty, rt = Object.prototype.propertyIsEnumerable, de = (t, e, o) => e in t ? lt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o, at = (t, e) => {
96
- for (var o in e || (e = {}))
97
- st.call(e, o) && de(t, o, e[o]);
98
- if (ce)
99
- for (var o of ce(e))
100
- rt.call(e, o) && de(t, o, e[o]);
94
+ })(ie || (ie = {}));
95
+ var lt = Object.defineProperty, ue = Object.getOwnPropertySymbols, st = Object.prototype.hasOwnProperty, rt = Object.prototype.propertyIsEnumerable, ce = (t, e, n) => e in t ? lt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, at = (t, e) => {
96
+ for (var n in e || (e = {}))
97
+ st.call(e, n) && ce(t, n, e[n]);
98
+ if (ue)
99
+ for (var n of ue(e))
100
+ rt.call(e, n) && ce(t, n, e[n]);
101
101
  return t;
102
102
  };
103
103
  const it = {
@@ -130,68 +130,68 @@ at({
130
130
  linear: qe
131
131
  }, it);
132
132
  function ut(t, e) {
133
- const { scrollEndHook: o, itemHeight: n, overscan: s = 5 } = e, r = g(null), l = nt(r), d = g(!0), m = ge(Q, 100);
133
+ const { scrollEndHook: n, itemHeight: o, overscan: s = 5 } = e, r = g(null), l = ot(r), c = g(!0), m = me(Q, 100);
134
134
  let p;
135
135
  const v = Pe(t), h = g(0), i = g({ start: 0, end: 10 });
136
136
  let u = 0;
137
- const E = g([]), _ = f(() => {
138
- let { sum: a, height: c } = { sum: 0, height: 0 };
139
- return v.value.map((w, y) => (typeof n == "number" ? c = n : c = n(y), a += c, { height: c, sum: a }));
140
- }), N = f(() => V(i.value.start)), C = f(() => typeof n == "number" ? _.value.length * n : _.value[_.value.length - 1]?.sum || 0), L = f(() => {
141
- let a = E.value.length - s, c = Math.max(a - u, 0);
142
- return E.value.slice(c, a);
137
+ const E = g([]), b = f(() => {
138
+ let { sum: a, height: d } = { sum: 0, height: 0 };
139
+ return v.value.map((w, _) => (typeof o == "number" ? d = o : d = o(_), a += d, { height: d, sum: a }));
140
+ }), N = f(() => V(i.value.start)), C = f(() => typeof o == "number" ? b.value.length * o : b.value[b.value.length - 1]?.sum || 0), D = f(() => {
141
+ let a = E.value.length - s, d = Math.max(a - u, 0);
142
+ return E.value.slice(d, a);
143
143
  });
144
144
  te(() => {
145
- }), fe(() => cancelAnimationFrame(p)), $(
145
+ }), ve(() => cancelAnimationFrame(p)), $(
146
146
  [l.width, l.height, v],
147
- ([a, c]) => {
148
- (a || c) && W();
147
+ ([a, d]) => {
148
+ (a || d) && M();
149
149
  },
150
150
  { deep: !0 }
151
151
  ), $(h, () => {
152
- D(), m();
152
+ W(), m();
153
153
  });
154
- function D() {
155
- d.value = !1;
154
+ function W() {
155
+ c.value = !1;
156
156
  }
157
157
  function Q() {
158
- d.value = !0, o?.();
159
- }
160
- function W() {
161
- cancelAnimationFrame(p), p = requestAnimationFrame(M);
158
+ c.value = !0, n?.();
162
159
  }
163
160
  function M() {
161
+ cancelAnimationFrame(p), p = requestAnimationFrame(k);
162
+ }
163
+ function k() {
164
164
  if (r.value) {
165
165
  h.value = r.value.scrollTop, u = B();
166
- let a = k(h.value), c = a + u + s;
167
- a = a - s, a = a < 0 ? 0 : a, c = c > v.value.length ? v.value.length : c, i.value = { start: a, end: c }, E.value = v.value.slice(a, c).map((w, y) => ({
166
+ let a = z(h.value), d = a + u + s;
167
+ a = a - s, a = a < 0 ? 0 : a, d = d > v.value.length ? v.value.length : d, i.value = { start: a, end: d }, E.value = v.value.slice(a, d).map((w, _) => ({
168
168
  data: w,
169
- index: y + a
169
+ index: _ + a
170
170
  }));
171
171
  }
172
172
  }
173
- function k(a) {
174
- let c = 0, w = _.value.length - 1, y = -1;
175
- for (; c <= w; ) {
176
- const S = Math.floor((c + w) / 2);
177
- _.value[S].sum >= a ? (y = S, w = S - 1) : c = S + 1;
173
+ function z(a) {
174
+ let d = 0, w = b.value.length - 1, _ = -1;
175
+ for (; d <= w; ) {
176
+ const S = Math.floor((d + w) / 2);
177
+ b.value[S].sum >= a ? (_ = S, w = S - 1) : d = S + 1;
178
178
  }
179
- return Math.max(0, y);
179
+ return Math.max(0, _);
180
180
  }
181
181
  function B() {
182
- let a = 0, c = 0, w = U();
183
- for (let y = w; y < _.value.length && (a++, c += _.value[y].height, !(c >= l.height.value)); y++)
182
+ let a = 0, d = 0, w = U();
183
+ for (let _ = w; _ < b.value.length && (a++, d += b.value[_].height, !(d >= l.height.value)); _++)
184
184
  ;
185
185
  return a;
186
186
  }
187
187
  function V(a) {
188
- if (typeof n == "number")
189
- return a * n;
190
- let c = _.value[a];
191
- return c ? c.sum - c.height : 0;
188
+ if (typeof o == "number")
189
+ return a * o;
190
+ let d = b.value[a];
191
+ return d ? d.sum - d.height : 0;
192
192
  }
193
- function z(a) {
194
- return _.value[a] || { sum: 0, height: 0 };
193
+ function j(a) {
194
+ return b.value[a] || { sum: 0, height: 0 };
195
195
  }
196
196
  function U() {
197
197
  let a = i.value.start;
@@ -199,15 +199,15 @@ function ut(t, e) {
199
199
  }
200
200
  function q(a) {
201
201
  if (r.value) {
202
- const c = z(a);
203
- r.value.scrollTop = c.sum - c.height, M();
202
+ const d = j(a);
203
+ r.value.scrollTop = d.sum - d.height, k();
204
204
  }
205
205
  }
206
206
  const Y = f(() => ({
207
207
  style: {
208
208
  width: "100%",
209
209
  height: `${C.value}px`,
210
- pointerEvents: d.value ? void 0 : "none"
210
+ pointerEvents: c.value ? void 0 : "none"
211
211
  }
212
212
  })), K = f(() => ({
213
213
  style: {
@@ -219,18 +219,18 @@ function ut(t, e) {
219
219
  };
220
220
  return {
221
221
  list: E,
222
- visiableList: L,
223
- getItemHeightData: z,
224
- getoffsetTopIndex: k,
222
+ visiableList: D,
223
+ getItemHeightData: j,
224
+ getoffsetTopIndex: z,
225
225
  totalHeight: C,
226
226
  clientHeight: l.height,
227
227
  scrollTo: q,
228
228
  scrollTop: h,
229
- isScrollEnd: d,
229
+ isScrollEnd: c,
230
230
  containerProps: {
231
231
  ref: r,
232
232
  onScroll: () => {
233
- W();
233
+ M();
234
234
  },
235
235
  style: G
236
236
  },
@@ -238,20 +238,20 @@ function ut(t, e) {
238
238
  innerProps: K
239
239
  };
240
240
  }
241
- const be = Symbol(), ye = Symbol(), Se = Symbol(), we = Symbol(), Oe = Symbol(), xe = Symbol(), Ee = Symbol(), Te = Symbol(), He = Symbol();
242
- function xt() {
243
- const { voidFn: t, boolFn: e, boolRef: o, arrayRef: n } = {
241
+ const be = Symbol(), ye = Symbol(), _e = Symbol(), Se = Symbol(), we = Symbol(), Oe = Symbol(), xe = Symbol(), Ee = Symbol(), Te = Symbol();
242
+ function wt() {
243
+ const { voidFn: t, boolFn: e, boolRef: n, arrayRef: o } = {
244
244
  voidFn: (u) => {
245
245
  },
246
246
  boolFn: (u) => !1,
247
247
  boolRef: f(() => !1),
248
248
  arrayRef: f(() => [])
249
- }, s = T(we, n), r = T(Se, e), l = T(Te, o), d = T(ye, t), m = T(be, t), p = T(Oe, t), v = T(xe, t), h = T(Ee, t), i = T(He, t);
249
+ }, s = T(Se, o), r = T(_e, e), l = T(Ee, n), c = T(ye, t), m = T(be, t), p = T(we, t), v = T(Oe, t), h = T(xe, t), i = T(Te, t);
250
250
  return {
251
251
  selected: s,
252
252
  isSelected: r,
253
253
  isAllSelected: l,
254
- toggle: d,
254
+ toggle: c,
255
255
  toggleAll: m,
256
256
  select: p,
257
257
  selectAll: v,
@@ -259,40 +259,40 @@ function xt() {
259
259
  unselectAll: i
260
260
  };
261
261
  }
262
- function Et(t, e) {
263
- const o = g({}), n = f(() => t.value.filter((i) => o.value[i[e]])), s = f(() => n.value.length != 0 && Object.keys(o.value).length == t.value.length);
262
+ function Ot(t, e) {
263
+ const n = g({}), o = f(() => t.value.filter((i) => n.value[i[e]])), s = f(() => o.value.length != 0 && Object.keys(n.value).length == t.value.length);
264
264
  function r() {
265
265
  t.value.forEach((i) => {
266
- o.value[i[e]] = !0;
266
+ n.value[i[e]] = !0;
267
267
  });
268
268
  }
269
269
  function l() {
270
- o.value = {};
270
+ n.value = {};
271
271
  }
272
- function d(i) {
272
+ function c(i) {
273
273
  i.forEach((u) => {
274
- o.value[u[e]] || (o.value[u[e]] = !0);
274
+ n.value[u[e]] || (n.value[u[e]] = !0);
275
275
  });
276
276
  }
277
277
  function m(i) {
278
278
  i.forEach((u) => {
279
- o.value[u[e]] && delete o.value[u[e]];
279
+ n.value[u[e]] && delete n.value[u[e]];
280
280
  });
281
281
  }
282
282
  function p(i) {
283
- return !!o.value[i[e]];
283
+ return !!n.value[i[e]];
284
284
  }
285
285
  function v(i) {
286
286
  i.forEach((u) => {
287
- p(u) ? delete o.value[u[e]] : o.value[u[e]] = !0;
287
+ p(u) ? delete n.value[u[e]] : n.value[u[e]] = !0;
288
288
  });
289
289
  }
290
290
  function h() {
291
291
  s.value ? l() : r();
292
292
  }
293
- return x(be, h), x(ye, v), x(Se, p), x(we, n), x(Oe, d), x(xe, r), x(Ee, m), x(Te, s), x(He, l), {
294
- selected: n,
295
- select: d,
293
+ return x(be, h), x(ye, v), x(_e, p), x(Se, o), x(we, c), x(Oe, r), x(xe, m), x(Ee, s), x(Te, l), {
294
+ selected: o,
295
+ select: c,
296
296
  selectAll: r,
297
297
  unselect: m,
298
298
  unselectAll: l,
@@ -302,7 +302,7 @@ function Et(t, e) {
302
302
  isAllSelected: s
303
303
  };
304
304
  }
305
- const ct = Symbol(), dt = /* @__PURE__ */ F({
305
+ const ct = Symbol(), dt = /* @__PURE__ */ A({
306
306
  __name: "Dialog",
307
307
  props: {
308
308
  visiable: { type: Boolean, default: !1 },
@@ -311,14 +311,14 @@ const ct = Symbol(), dt = /* @__PURE__ */ F({
311
311
  },
312
312
  emits: ["update:visiable"],
313
313
  setup(t, { emit: e }) {
314
- const o = t, n = () => {
315
- o.closeOnClickOverlay && e("update:visiable", !1);
314
+ const n = t, o = () => {
315
+ n.closeOnClickOverlay && e("update:visiable", !1);
316
316
  };
317
- return x(ct, () => e("update:visiable", !1)), (s, r) => (I(), pe(he, { name: "modal" }, {
318
- default: me(() => [
317
+ return x(ct, () => e("update:visiable", !1)), (s, r) => (I(), fe(pe, { name: "modal" }, {
318
+ default: he(() => [
319
319
  t.visiable ? (I(), R("div", {
320
320
  key: 0,
321
- onClick: n,
321
+ onClick: o,
322
322
  class: "modal absolute inset-0 bottom-0 flex bg-stone-900 bg-opacity-50 z-[999]"
323
323
  }, [
324
324
  H("div", {
@@ -326,7 +326,7 @@ const ct = Symbol(), dt = /* @__PURE__ */ F({
326
326
  }, ["stop"])),
327
327
  class: Fe(["dialog m-auto flex flex-col", t.dialogClass])
328
328
  }, [
329
- ne(s.$slots, "default")
329
+ oe(s.$slots, "default")
330
330
  ], 2)
331
331
  ])) : Ae("", !0)
332
332
  ]),
@@ -334,8 +334,8 @@ const ct = Symbol(), dt = /* @__PURE__ */ F({
334
334
  }));
335
335
  }
336
336
  });
337
- function Tt(t) {
338
- function e(o, n) {
337
+ function xt(t) {
338
+ function e(n, o) {
339
339
  const s = document.createElement("div"), r = {
340
340
  setup() {
341
341
  return () => P(
@@ -348,7 +348,7 @@ function Tt(t) {
348
348
  ...t
349
349
  },
350
350
  {
351
- default: () => P(o, n)
351
+ default: () => P(n, o)
352
352
  }
353
353
  );
354
354
  }
@@ -361,14 +361,14 @@ function Tt(t) {
361
361
  create: e
362
362
  };
363
363
  }
364
- const vt = { class: "toast" }, ft = /* @__PURE__ */ F({
364
+ const vt = /* @__PURE__ */ A({
365
365
  __name: "Toast",
366
366
  props: {
367
367
  message: null,
368
368
  position: null
369
369
  },
370
370
  setup(t) {
371
- const e = t, o = g(), n = g(), s = g(), r = f(() => {
371
+ const e = t, n = g(), o = g(), s = g(), r = f(() => {
372
372
  switch (e.position) {
373
373
  case "top":
374
374
  return 10;
@@ -383,46 +383,49 @@ const vt = { class: "toast" }, ft = /* @__PURE__ */ F({
383
383
  backgroundColor: "rgba(0, 0, 0, 0.8)",
384
384
  padding: "14px 19px",
385
385
  top: `calc(${r.value}% - ${s.value}px)`,
386
- left: `calc(50% - ${n.value}px)`
386
+ left: `calc(50% - ${o.value}px)`
387
+ })), c = f(() => ({
388
+ width: "fit-content",
389
+ display: "flex",
390
+ justifyContent: "center",
391
+ alignItems: "center",
392
+ color: "white",
393
+ fontSize: "14px"
387
394
  }));
388
- return oe(() => {
389
- n.value = o.value.offsetWidth / 2, s.value = o.value.offsetHeight / 2;
390
- }), (d, m) => (I(), R("div", {
395
+ return ne(() => {
396
+ o.value = n.value.offsetWidth / 2, s.value = n.value.offsetHeight / 2;
397
+ }), (m, p) => (I(), R("div", {
391
398
  id: "toastWrapper",
392
399
  ref_key: "toastWrapper",
393
- ref: o,
400
+ ref: n,
394
401
  class: "toastWrapper",
395
- style: j([b(l), { zIndex: 9999 }])
402
+ style: F([y(l), { zIndex: 9999 }])
396
403
  }, [
397
- H("div", vt, [
404
+ H("div", {
405
+ style: F(y(c))
406
+ }, [
398
407
  H("span", null, Le(t.message), 1)
399
- ])
408
+ ], 4)
400
409
  ], 4));
401
410
  }
402
- });
403
- const le = (t, e) => {
404
- const o = t.__vccOpts || t;
405
- for (const [n, s] of e)
406
- o[n] = s;
407
- return o;
408
- }, pt = /* @__PURE__ */ le(ft, [["__scopeId", "data-v-4a518cee"]]), ve = {
411
+ }), de = {
409
412
  message: "\u61D2\u732B\u4E91 Yes!!!",
410
413
  position: "middle",
411
414
  duration: 1500
412
415
  };
413
- class Ht {
416
+ class Et {
414
417
  options;
415
418
  container;
416
419
  constructor(e) {
417
420
  this.options = e, this.container = document.createElement("div");
418
421
  }
419
422
  present() {
420
- const e = P(P(pt), { ...ve, ...this.options });
423
+ const e = P(P(vt), { ...de, ...this.options });
421
424
  J(e, this.container), document.body.insertBefore(this.container, document.body.firstChild);
422
- const o = this.options.duration || ve.duration;
425
+ const n = this.options.duration || de.duration;
423
426
  setTimeout(() => {
424
427
  this.dismiss();
425
- }, o);
428
+ }, n);
426
429
  }
427
430
  dismiss() {
428
431
  this.container && (this.container.querySelector("#toastWrapper")?.classList.add("animate-toastAnimation"), setTimeout(() => {
@@ -430,7 +433,7 @@ class Ht {
430
433
  }, 500));
431
434
  }
432
435
  }
433
- const ht = ["xlink:href", "fill", "color"], It = /* @__PURE__ */ F({
436
+ const ft = ["xlink:href", "fill", "color"], Tt = /* @__PURE__ */ A({
434
437
  __name: "SvgIcon",
435
438
  props: {
436
439
  name: null,
@@ -440,31 +443,31 @@ const ht = ["xlink:href", "fill", "color"], It = /* @__PURE__ */ F({
440
443
  height: null
441
444
  },
442
445
  setup(t) {
443
- const e = t, o = f(() => `#${e.prefix}-${e.name}`), n = f(() => ({
446
+ const e = t, n = f(() => `#${e.prefix}-${e.name}`), o = f(() => ({
444
447
  width: `${e.width ?? e.height}px`,
445
448
  height: `${e.height ?? e.width}px`,
446
449
  aspectRatio: e.width && e.height ? void 0 : "1/1"
447
450
  }));
448
451
  return (s, r) => (I(), R("svg", {
449
452
  "aria-hidden": "",
450
- style: j(b(n))
453
+ style: F(y(o))
451
454
  }, [
452
455
  H("use", {
453
- "xlink:href": b(o),
456
+ "xlink:href": y(n),
454
457
  fill: t.color,
455
458
  color: t.color
456
- }, null, 8, ht)
459
+ }, null, 8, ft)
457
460
  ], 4));
458
461
  }
459
462
  });
460
- function mt(t) {
463
+ function pt(t) {
461
464
  const {
462
465
  containerEl: e,
463
- sliderEl: o,
464
- autoHeight: n,
466
+ sliderEl: n,
467
+ autoHeight: o,
465
468
  performance: s = {},
466
469
  maxHeightRatio: r = 0.9
467
- } = t, l = g(!0), d = ge(V, 100);
470
+ } = t, l = g(!0), c = me(V, 100);
468
471
  let m, p = "";
469
472
  const v = g(0), h = g(0), i = g(0), u = g({
470
473
  top: 0,
@@ -473,48 +476,48 @@ function mt(t) {
473
476
  clientHeight: 0
474
477
  }), E = g({
475
478
  clientHeight: 0
476
- }), _ = f(() => !!h.value), N = f(() => u.value.scrollHeight > u.value.clientHeight), C = f(() => u.value.clientHeight - E.value.clientHeight), L = f(() => u.value.scrollHeight - u.value.clientHeight), D = f(() => Math.max(
479
+ }), b = f(() => !!h.value), N = f(() => u.value.scrollHeight > u.value.clientHeight), C = f(() => u.value.clientHeight - E.value.clientHeight), D = f(() => u.value.scrollHeight - u.value.clientHeight), W = f(() => Math.max(
477
480
  u.value.clientHeight / u.value.scrollHeight,
478
481
  0.05
479
- )), Q = f(() => D.value > r ? 0 : D.value * u.value.clientHeight), W = f(() => ({
482
+ )), Q = f(() => W.value > r ? 0 : W.value * u.value.clientHeight), M = f(() => ({
480
483
  willChange: "transform",
481
484
  transform: `translate3d(0,${i.value}px,0)`,
482
- height: n ? `${Q.value}px` : void 0
485
+ height: o ? `${Q.value}px` : void 0
483
486
  }));
484
- function M(S) {
485
- B(), h.value = S.clientY - o.value.getBoundingClientRect().top || 1, p = getComputedStyle(e.value).scrollBehavior, p === "smooth" && (e.value.style.scrollBehavior = "unset");
487
+ function k(S) {
488
+ B(), h.value = S.clientY - n.value.getBoundingClientRect().top || 1, p = getComputedStyle(e.value).scrollBehavior, p === "smooth" && (e.value.style.scrollBehavior = "unset");
486
489
  }
487
- function k() {
488
- e.value.style.scrollBehavior = p, h.value = 0, d();
490
+ function z() {
491
+ e.value.style.scrollBehavior = p, h.value = 0, c();
489
492
  }
490
493
  function B() {
491
494
  l.value = !1;
492
495
  }
493
496
  function V() {
494
- _.value || (l.value = !0);
497
+ b.value || (l.value = !0);
495
498
  }
496
- function z(S) {
497
- if (!_.value)
499
+ function j(S) {
500
+ if (!b.value)
498
501
  return;
499
502
  let O = S.clientY - u.value.top - h.value;
500
503
  O < 0 ? i.value = 0 : O >= C.value ? i.value = C.value : i.value = O, e.value.scrollTo({
501
- top: i.value / C.value * L.value
504
+ top: i.value / C.value * D.value
502
505
  });
503
506
  }
504
507
  function U() {
505
- _.value || q();
508
+ b.value || q();
506
509
  }
507
510
  function q() {
508
511
  cancelAnimationFrame(m), m = requestAnimationFrame(Y);
509
512
  }
510
513
  function Y() {
511
- e.value && (v.value = s.scrollTop?.value ?? e.value.scrollTop, i.value = v.value / L.value * C.value);
514
+ e.value && (v.value = s.scrollTop?.value ?? e.value.scrollTop, i.value = v.value / D.value * C.value);
512
515
  }
513
516
  function K(S) {
514
517
  let O = "addEventListener";
515
- S === "add" ? O = "addEventListener" : O = "removeEventListener", o.value?.[O]("pointerdown", M, {
518
+ S === "add" ? O = "addEventListener" : O = "removeEventListener", n.value?.[O]("pointerdown", k, {
516
519
  passive: !0
517
- }), window[O]("pointermove", z, { passive: !0 }), window[O]("pointerup", k, { passive: !0 });
520
+ }), window[O]("pointermove", j, { passive: !0 }), window[O]("pointerup", z, { passive: !0 });
518
521
  }
519
522
  const G = new MutationObserver((S) => {
520
523
  S.map((Ie) => Ie.oldValue).join().includes("height") && a();
@@ -522,9 +525,9 @@ function mt(t) {
522
525
  function a() {
523
526
  u.value.top = e.value?.getBoundingClientRect().top ?? 0, u.value.scrollHeight = e.value?.scrollHeight ?? 0, u.value.clientHeight = e.value?.clientHeight ?? 0;
524
527
  }
525
- function c() {
528
+ function d() {
526
529
  B(), setTimeout(() => {
527
- E.value.clientHeight = o.value?.clientHeight ?? 0, V();
530
+ E.value.clientHeight = n.value?.clientHeight ?? 0, V();
528
531
  }, 150);
529
532
  }
530
533
  function w() {
@@ -536,8 +539,8 @@ function mt(t) {
536
539
  0
537
540
  ), e.value?.classList.add("hide-scrollbar");
538
541
  }
539
- function y() {
540
- e.value && o.value ? (w(), e.value.addEventListener("scroll", U, {
542
+ function _() {
543
+ e.value && n.value ? (w(), e.value.addEventListener("scroll", U, {
541
544
  passive: !0
542
545
  }), K("add"), G.observe(e.value, {
543
546
  subtree: !0,
@@ -545,22 +548,22 @@ function mt(t) {
545
548
  attributeFilter: ["style"]
546
549
  }), setTimeout(() => {
547
550
  a();
548
- }, 100), c()) : console.error("useScrollBar:", "\u521D\u59CB\u5316\u5931\u8D25!", { containerEl: e, sliderEl: o });
551
+ }, 100), d()) : console.error("useScrollBar:", "\u521D\u59CB\u5316\u5931\u8D25!", { containerEl: e, sliderEl: n });
549
552
  }
550
553
  return $(v, () => {
551
- B(), d();
554
+ B(), c();
552
555
  }), {
553
556
  isScrollEnd: l,
554
- isDragSlider: _,
557
+ isDragSlider: b,
555
558
  offsetTop: i,
556
559
  scrollTop: v,
557
560
  scrollable: N,
558
- sliderPos: W,
559
- init: y,
561
+ sliderPos: M,
562
+ init: _,
560
563
  modifySliderEventListener: K
561
564
  };
562
565
  }
563
- const gt = (t) => (ke("data-v-edec7292"), t = t(), Ve(), t), _t = /* @__PURE__ */ gt(() => /* @__PURE__ */ H("div", { class: "default-slider" }, null, -1)), bt = /* @__PURE__ */ F({
566
+ const ht = (t) => (ke("data-v-edec7292"), t = t(), ze(), t), mt = /* @__PURE__ */ ht(() => /* @__PURE__ */ H("div", { class: "default-slider" }, null, -1)), gt = /* @__PURE__ */ A({
564
567
  __name: "ScrollBar",
565
568
  props: {
566
569
  containerEl: null,
@@ -569,17 +572,17 @@ const gt = (t) => (ke("data-v-edec7292"), t = t(), Ve(), t), _t = /* @__PURE__ *
569
572
  performance: null
570
573
  },
571
574
  setup(t, { expose: e }) {
572
- const o = t, n = !!De().default, s = g(null), r = f(() => o.containerEl), l = mt({
575
+ const n = t, o = !!De().default, s = g(null), r = f(() => n.containerEl), l = pt({
573
576
  containerEl: r,
574
577
  sliderEl: s,
575
- autoHeight: n ? o.autoHeight : !0,
576
- performance: o.performance
577
- }), { scrollable: d, isScrollEnd: m, sliderPos: p } = l, v = g(!1), h = o.autoHide ? f(() => v.value || !m.value) : f(() => d.value);
578
+ autoHeight: o ? n.autoHeight : !0,
579
+ performance: n.performance
580
+ }), { scrollable: c, isScrollEnd: m, sliderPos: p } = l, v = g(!1), h = n.autoHide ? f(() => v.value || !m.value) : f(() => c.value);
578
581
  te(() => {
579
- oe(() => {
582
+ ne(() => {
580
583
  l.init();
581
584
  });
582
- }), fe(() => {
585
+ }), ve(() => {
583
586
  l.modifySliderEventListener("remove");
584
587
  });
585
588
  function i() {
@@ -588,31 +591,36 @@ const gt = (t) => (ke("data-v-edec7292"), t = t(), Ve(), t), _t = /* @__PURE__ *
588
591
  function u() {
589
592
  v.value = !1;
590
593
  }
591
- return e({ uScrollBarReturn: l }), (E, _) => (I(), pe(he, null, {
592
- default: me(() => [
594
+ return e({ uScrollBarReturn: l }), (E, b) => (I(), fe(pe, null, {
595
+ default: he(() => [
593
596
  We(H("div", {
594
597
  ref_key: "sliderRef",
595
598
  ref: s,
596
599
  class: "slider-wrapper",
597
600
  onMouseenter: i,
598
601
  onMouseleave: u,
599
- style: j(b(p))
602
+ style: F(y(p))
600
603
  }, [
601
- ne(E.$slots, "default", {}, () => [
602
- _t
604
+ oe(E.$slots, "default", {}, () => [
605
+ mt
603
606
  ], !0)
604
607
  ], 36), [
605
- [Me, b(h)]
608
+ [Me, y(h)]
606
609
  ])
607
610
  ]),
608
611
  _: 3
609
612
  }));
610
613
  }
611
614
  });
612
- const Ct = /* @__PURE__ */ le(bt, [["__scopeId", "data-v-edec7292"]]), yt = { class: "virtualListWrapper" }, St = {
615
+ const He = (t, e) => {
616
+ const n = t.__vccOpts || t;
617
+ for (const [o, s] of e)
618
+ n[o] = s;
619
+ return n;
620
+ }, Ht = /* @__PURE__ */ He(gt, [["__scopeId", "data-v-edec7292"]]), bt = { class: "virtualListWrapper" }, yt = {
613
621
  inheritAttrs: !1
614
- }, wt = /* @__PURE__ */ F({
615
- ...St,
622
+ }, _t = /* @__PURE__ */ A({
623
+ ...yt,
616
624
  __name: "VirtualList",
617
625
  props: {
618
626
  data: null,
@@ -620,32 +628,32 @@ const Ct = /* @__PURE__ */ le(bt, [["__scopeId", "data-v-edec7292"]]), yt = { cl
620
628
  overscan: { default: 10 }
621
629
  },
622
630
  emits: ["scrollEnd"],
623
- setup(t, { expose: e, emit: o }) {
624
- const n = t, s = ut(ze(n, "data"), {
625
- itemHeight: (v) => n.itemHeight(n.data[v]),
626
- overscan: n.overscan,
631
+ setup(t, { expose: e, emit: n }) {
632
+ const o = t, s = ut(Ve(o, "data"), {
633
+ itemHeight: (v) => o.itemHeight(o.data[v]),
634
+ overscan: o.overscan,
627
635
  scrollEndHook: () => {
628
- o("scrollEnd");
636
+ n("scrollEnd");
629
637
  }
630
- }), { list: r, containerProps: l, wrapperProps: d, innerProps: m, getItemHeightData: p } = s;
638
+ }), { list: r, containerProps: l, wrapperProps: c, innerProps: m, getItemHeightData: p } = s;
631
639
  return e({
632
640
  vListReturn: s
633
- }), (v, h) => (I(), R("div", yt, [
634
- H("div", Ke({
635
- onScrollPassive: h[0] || (h[0] = (...i) => b(l).onScroll && b(l).onScroll(...i)),
636
- ref: b(l).ref,
641
+ }), (v, h) => (I(), R("div", bt, [
642
+ H("div", je({
643
+ onScrollPassive: h[0] || (h[0] = (...i) => y(l).onScroll && y(l).onScroll(...i)),
644
+ ref: y(l).ref,
637
645
  class: "virtualList"
638
646
  }, v.$attrs), [
639
- H("div", se(re(b(d))), [
640
- H("div", se(re(b(m))), [
641
- (I(!0), R(je, null, Ne(b(r), ({ index: i, data: u }) => (I(), R("div", {
647
+ H("div", le(se(y(c))), [
648
+ H("div", le(se(y(m))), [
649
+ (I(!0), R(Ke, null, Ne(y(r), ({ index: i, data: u }) => (I(), R("div", {
642
650
  key: i,
643
- style: j({
644
- height: `${b(p)(i).height}px`,
651
+ style: F({
652
+ height: `${y(p)(i).height}px`,
645
653
  display: "flex"
646
654
  })
647
655
  }, [
648
- ne(v.$slots, "default", {
656
+ oe(v.$slots, "default", {
649
657
  data: u,
650
658
  index: i
651
659
  }, void 0, !0)
@@ -656,24 +664,24 @@ const Ct = /* @__PURE__ */ le(bt, [["__scopeId", "data-v-edec7292"]]), yt = { cl
656
664
  ]));
657
665
  }
658
666
  });
659
- const Rt = /* @__PURE__ */ le(wt, [["__scopeId", "data-v-4ba97cce"]]);
667
+ const It = /* @__PURE__ */ He(_t, [["__scopeId", "data-v-4ba97cce"]]);
660
668
  export {
661
- Ct as ScrollBar,
662
- It as SvgIcon,
663
- Ht as ToastCreator,
664
- Rt as VirtualList,
665
- we as allSelectedKey,
669
+ Ht as ScrollBar,
670
+ Tt as SvgIcon,
671
+ Et as ToastCreator,
672
+ It as VirtualList,
673
+ Se as allSelectedKey,
666
674
  ct as closeDialogKey,
667
- Tt as dialogController,
668
- Te as isAllSelectedKey,
669
- Se as isSelectedKey,
670
- xe as selectAllKey,
671
- Oe as selectKey,
675
+ xt as dialogController,
676
+ Ee as isAllSelectedKey,
677
+ _e as isSelectedKey,
678
+ Oe as selectAllKey,
679
+ we as selectKey,
672
680
  be as toggleAllKey,
673
681
  ye as toggleKey,
674
- He as unselectAllKey,
675
- Ee as unselectKey,
676
- Et as useSelectable,
677
- xt as useSelectableInjectors,
682
+ Te as unselectAllKey,
683
+ xe as unselectKey,
684
+ Ot as useSelectable,
685
+ wt as useSelectableInjectors,
678
686
  ut as useVirtualList
679
687
  };
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(h,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(h=typeof globalThis<"u"?globalThis:h||self,e(h.ui={},h.Vue))})(this,function(h,e){"use strict";var ee;const T=typeof window<"u";T&&((ee=window?.navigator)==null?void 0:ee.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function $(n){return typeof n=="function"?n():e.unref(n)}function ue(n,t){function o(...l){n(()=>t.apply(this,l),{fn:t,thisArg:this,args:l})}return o}function de(n,t={}){let o,l;return a=>{const r=$(n),f=$(t.maxWait);if(o&&clearTimeout(o),r<=0||f!==void 0&&f<=0)return l&&(clearTimeout(l),l=null),a();f&&!l&&(l=setTimeout(()=>{o&&clearTimeout(o),l=null,a()},f)),o=setTimeout(()=>{l&&clearTimeout(l),l=null,a()},r)}}function fe(n){return n}function pe(n){return e.getCurrentScope()?(e.onScopeDispose(n),!0):!1}function te(n,t=200,o={}){return ue(de(t,o),n)}function he(n,t=!0){e.getCurrentInstance()?e.onMounted(n):t?n():e.nextTick(n)}function ne(n){var t;const o=$(n);return(t=o?.$el)!=null?t:o}const me=T?window:void 0;T&&window.document,T&&window.navigator,T&&window.location;function ge(n,t=!1){const o=e.ref(),l=()=>o.value=Boolean(n());return l(),he(l,t),o}const F=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},L="__vueuse_ssr_handlers__";F[L]=F[L]||{},F[L];var oe=Object.getOwnPropertySymbols,_e=Object.prototype.hasOwnProperty,ye=Object.prototype.propertyIsEnumerable,ve=(n,t)=>{var o={};for(var l in n)_e.call(n,l)&&t.indexOf(l)<0&&(o[l]=n[l]);if(n!=null&&oe)for(var l of oe(n))t.indexOf(l)<0&&ye.call(n,l)&&(o[l]=n[l]);return o};function be(n,t,o={}){const l=o,{window:i=me}=l,a=ve(l,["window"]);let r;const f=ge(()=>i&&"ResizeObserver"in i),_=()=>{r&&(r.disconnect(),r=void 0)},m=e.watch(()=>ne(n),g=>{_(),f.value&&i&&g&&(r=new ResizeObserver(t),r.observe(g,a))},{immediate:!0,flush:"post"}),p=()=>{_(),m()};return pe(p),{isSupported:f,stop:p}}function Se(n,t={width:0,height:0},o={}){const{box:l="content-box"}=o,i=e.ref(t.width),a=e.ref(t.height);return be(n,([r])=>{const f=l==="border-box"?r.borderBoxSize:l==="content-box"?r.contentBoxSize:r.devicePixelContentBoxSize;f?(i.value=f.reduce((_,{inlineSize:m})=>_+m,0),a.value=f.reduce((_,{blockSize:m})=>_+m,0)):(i.value=r.contentRect.width,a.value=r.contentRect.height)},o),e.watch(()=>ne(n),r=>{i.value=r?t.width:0,a.value=r?t.height:0}),{width:i,height:a}}var le;(function(n){n.UP="UP",n.RIGHT="RIGHT",n.DOWN="DOWN",n.LEFT="LEFT",n.NONE="NONE"})(le||(le={}));var we=Object.defineProperty,re=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,ie=(n,t,o)=>t in n?we(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,Te=(n,t)=>{for(var o in t||(t={}))Ee.call(t,o)&&ie(n,o,t[o]);if(re)for(var o of re(t))Oe.call(t,o)&&ie(n,o,t[o]);return n};Te({linear:fe},{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 ae(n,t){const{scrollEndHook:o,itemHeight:l,overscan:i=5}=t,a=e.ref(null),r=Se(a),f=e.ref(!0),_=te(Y,100);let m;const p=e.shallowRef(n),g=e.ref(0),c=e.ref({start:0,end:10});let u=0;const E=e.ref([]),y=e.computed(()=>{let{sum:s,height:d}={sum:0,height:0};return p.value.map((S,v)=>(typeof l=="number"?d=l:d=l(v),s+=d,{height:d,sum:s}))}),q=e.computed(()=>R(c.value.start)),O=e.computed(()=>typeof l=="number"?y.value.length*l:y.value[y.value.length-1]?.sum||0),I=e.computed(()=>{let s=E.value.length-i,d=Math.max(s-u,0);return E.value.slice(d,s)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(m)),e.watch([r.width,r.height,p],([s,d])=>{(s||d)&&C()},{deep:!0}),e.watch(g,()=>{H(),_()});function H(){f.value=!1}function Y(){f.value=!0,o?.()}function C(){cancelAnimationFrame(m),m=requestAnimationFrame(x)}function x(){if(a.value){g.value=a.value.scrollTop,u=B();let s=P(g.value),d=s+u+i;s=s-i,s=s<0?0:s,d=d>p.value.length?p.value.length:d,c.value={start:s,end:d},E.value=p.value.slice(s,d).map((S,v)=>({data:S,index:v+s}))}}function P(s){let d=0,S=y.value.length-1,v=-1;for(;d<=S;){const b=Math.floor((d+S)/2);y.value[b].sum>=s?(v=b,S=b-1):d=b+1}return Math.max(0,v)}function B(){let s=0,d=0,S=G();for(let v=S;v<y.value.length&&(s++,d+=y.value[v].height,!(d>=r.height.value));v++);return s}function R(s){if(typeof l=="number")return s*l;let d=y.value[s];return d?d.sum-d.height:0}function k(s){return y.value[s]||{sum:0,height:0}}function G(){let s=c.value.start;return s>=i&&(s+=i),s}function J(s){if(a.value){const d=k(s);a.value.scrollTop=d.sum-d.height,x()}}const X=e.computed(()=>({style:{width:"100%",height:`${O.value}px`,pointerEvents:f.value?void 0:"none"}})),A=e.computed(()=>({style:{transform:`translate3d(0, ${q.value}px, 0)`,"will-change":"transform"}})),Z={overflowY:"auto"};return{list:E,visiableList:I,getItemHeightData:k,getoffsetTopIndex:P,totalHeight:O,clientHeight:r.height,scrollTo:J,scrollTop:g,isScrollEnd:f,containerProps:{ref:a,onScroll:()=>{C()},style:Z},wrapperProps:X,innerProps:A}}const D=Symbol(),V=Symbol(),j=Symbol(),K=Symbol(),M=Symbol(),N=Symbol(),W=Symbol(),z=Symbol(),Q=Symbol();function Be(){const{voidFn:n,boolFn:t,boolRef:o,arrayRef:l}={voidFn:u=>{},boolFn:u=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},i=e.inject(K,l),a=e.inject(j,t),r=e.inject(z,o),f=e.inject(V,n),_=e.inject(D,n),m=e.inject(M,n),p=e.inject(N,n),g=e.inject(W,n),c=e.inject(Q,n);return{selected:i,isSelected:a,isAllSelected:r,toggle:f,toggleAll:_,select:m,selectAll:p,unselect:g,unselectAll:c}}function Ie(n,t){const o=e.ref({}),l=e.computed(()=>n.value.filter(c=>o.value[c[t]])),i=e.computed(()=>l.value.length!=0&&Object.keys(o.value).length==n.value.length);function a(){n.value.forEach(c=>{o.value[c[t]]=!0})}function r(){o.value={}}function f(c){c.forEach(u=>{o.value[u[t]]||(o.value[u[t]]=!0)})}function _(c){c.forEach(u=>{o.value[u[t]]&&delete o.value[u[t]]})}function m(c){return!!o.value[c[t]]}function p(c){c.forEach(u=>{m(u)?delete o.value[u[t]]:o.value[u[t]]=!0})}function g(){i.value?r():a()}return e.provide(D,g),e.provide(V,p),e.provide(j,m),e.provide(K,l),e.provide(M,f),e.provide(N,a),e.provide(W,_),e.provide(z,i),e.provide(Q,r),{selected:l,select:f,selectAll:a,unselect:_,unselectAll:r,toggle:p,toggleAll:g,isSelected:m,isAllSelected:i}}const se=Symbol(),He=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(se,()=>t("update:visiable",!1)),(i,a)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[n.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:l,class:"modal absolute inset-0 bottom-0 flex bg-stone-900 bg-opacity-50 z-[999]"},[e.createElementVNode("div",{onClick:a[0]||(a[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog m-auto flex flex-col",n.dialogClass])},[e.renderSlot(i.$slots,"default")],2)])):e.createCommentVNode("",!0)]),_:3}))}});function Ce(n){function t(o,l){const i=document.createElement("div"),a={setup(){return()=>e.h(He,{visiable:!0,"onUpdate:visiable":()=>{i?.remove()},...n},{default:()=>e.h(o,l)})}};return document.body.appendChild(i),e.render(e.h(a),i),{close:()=>i?.remove()}}return{create:t}}const xe={class:"toast"},Pe=e.defineComponent({__name:"Toast",props:{message:null,position:null},setup(n){const t=n,o=e.ref(),l=e.ref(),i=e.ref(),a=e.computed(()=>{switch(t.position){case"top":return 10;case"middle":return 50;case"bottom":return 85}}),r=e.computed(()=>({position:"absolute",borderRadius:"10px",backgroundColor:"rgba(0, 0, 0, 0.8)",padding:"14px 19px",top:`calc(${a.value}% - ${i.value}px)`,left:`calc(50% - ${l.value}px)`}));return e.nextTick(()=>{l.value=o.value.offsetWidth/2,i.value=o.value.offsetHeight/2}),(f,_)=>(e.openBlock(),e.createElementBlock("div",{id:"toastWrapper",ref_key:"toastWrapper",ref:o,class:"toastWrapper",style:e.normalizeStyle([e.unref(r),{zIndex:9999}])},[e.createElementVNode("div",xe,[e.createElementVNode("span",null,e.toDisplayString(n.message),1)])],4))}}),Qe="",U=(n,t)=>{const o=n.__vccOpts||n;for(const[l,i]of t)o[l]=i;return o},Re=U(Pe,[["__scopeId","data-v-4a518cee"]]),ce={message:"\u61D2\u732B\u4E91 Yes!!!",position:"middle",duration:1500};class ke{options;container;constructor(t){this.options=t,this.container=document.createElement("div")}present(){const t=e.h(e.h(Re),{...ce,...this.options});e.render(t,this.container),document.body.insertBefore(this.container,document.body.firstChild);const o=this.options.duration||ce.duration;setTimeout(()=>{this.dismiss()},o)}dismiss(){this.container&&(this.container.querySelector("#toastWrapper")?.classList.add("animate-toastAnimation"),setTimeout(()=>{this.container&&(e.render(null,this.container),document.body.removeChild(this.container))},500))}}const Ae=["xlink:href","fill","color"],$e=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(i,a)=>(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,Ae)],4))}});function Fe(n){const{containerEl:t,sliderEl:o,autoHeight:l,performance:i={},maxHeightRatio:a=.9}=n,r=e.ref(!0),f=te(R,100);let _,m="";const p=e.ref(0),g=e.ref(0),c=e.ref(0),u=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),E=e.ref({clientHeight:0}),y=e.computed(()=>!!g.value),q=e.computed(()=>u.value.scrollHeight>u.value.clientHeight),O=e.computed(()=>u.value.clientHeight-E.value.clientHeight),I=e.computed(()=>u.value.scrollHeight-u.value.clientHeight),H=e.computed(()=>Math.max(u.value.clientHeight/u.value.scrollHeight,.05)),Y=e.computed(()=>H.value>a?0:H.value*u.value.clientHeight),C=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${c.value}px,0)`,height:l?`${Y.value}px`:void 0}));function x(b){B(),g.value=b.clientY-o.value.getBoundingClientRect().top||1,m=getComputedStyle(t.value).scrollBehavior,m==="smooth"&&(t.value.style.scrollBehavior="unset")}function P(){t.value.style.scrollBehavior=m,g.value=0,f()}function B(){r.value=!1}function R(){y.value||(r.value=!0)}function k(b){if(!y.value)return;let w=b.clientY-u.value.top-g.value;w<0?c.value=0:w>=O.value?c.value=O.value:c.value=w,t.value.scrollTo({top:c.value/O.value*I.value})}function G(){y.value||J()}function J(){cancelAnimationFrame(_),_=requestAnimationFrame(X)}function X(){t.value&&(p.value=i.scrollTop?.value??t.value.scrollTop,c.value=p.value/I.value*O.value)}function A(b){let w="addEventListener";b==="add"?w="addEventListener":w="removeEventListener",o.value?.[w]("pointerdown",x,{passive:!0}),window[w]("pointermove",k,{passive:!0}),window[w]("pointerup",P,{passive:!0})}const Z=new MutationObserver(b=>{b.map(We=>We.oldValue).join().includes("height")&&s()});function s(){u.value.top=t.value?.getBoundingClientRect().top??0,u.value.scrollHeight=t.value?.scrollHeight??0,u.value.clientHeight=t.value?.clientHeight??0}function d(){B(),setTimeout(()=>{E.value.clientHeight=o.value?.clientHeight??0,R()},150)}function S(){document.styleSheets[0].insertRule(".hide-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }",0),document.styleSheets[0].insertRule(".hide-scrollbar::-webkit-scrollbar{ display: none }",0),t.value?.classList.add("hide-scrollbar")}function v(){t.value&&o.value?(S(),t.value.addEventListener("scroll",G,{passive:!0}),A("add"),Z.observe(t.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{s()},100),d()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:t,sliderEl:o})}return e.watch(p,()=>{B(),f()}),{isScrollEnd:r,isDragSlider:y,offsetTop:c,scrollTop:p,scrollable:q,sliderPos:C,init:v,modifySliderEventListener:A}}const Le=(n=>(e.pushScopeId("data-v-edec7292"),n=n(),e.popScopeId(),n))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),De=e.defineComponent({__name:"ScrollBar",props:{containerEl:null,autoHide:{type:Boolean},autoHeight:{type:Boolean},performance:null},setup(n,{expose:t}){const o=n,l=!!e.useSlots().default,i=e.ref(null),a=e.computed(()=>o.containerEl),r=Fe({containerEl:a,sliderEl:i,autoHeight:l?o.autoHeight:!0,performance:o.performance}),{scrollable:f,isScrollEnd:_,sliderPos:m}=r,p=e.ref(!1),g=o.autoHide?e.computed(()=>p.value||!_.value):e.computed(()=>f.value);e.onMounted(()=>{e.nextTick(()=>{r.init()})}),e.onUnmounted(()=>{r.modifySliderEventListener("remove")});function c(){p.value=!0}function u(){p.value=!1}return t({uScrollBarReturn:r}),(E,y)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"sliderRef",ref:i,class:"slider-wrapper",onMouseenter:c,onMouseleave:u,style:e.normalizeStyle(e.unref(m))},[e.renderSlot(E.$slots,"default",{},()=>[Le],!0)],36),[[e.vShow,e.unref(g)]])]),_:3}))}}),qe="",Ve=U(De,[["__scopeId","data-v-edec7292"]]),je={class:"virtualListWrapper"},Ke={inheritAttrs:!1},Me=e.defineComponent({...Ke,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},emits:["scrollEnd"],setup(n,{expose:t,emit:o}){const l=n,i=ae(e.toRef(l,"data"),{itemHeight:p=>l.itemHeight(l.data[p]),overscan:l.overscan,scrollEndHook:()=>{o("scrollEnd")}}),{list:a,containerProps:r,wrapperProps:f,innerProps:_,getItemHeightData:m}=i;return t({vListReturn:i}),(p,g)=>(e.openBlock(),e.createElementBlock("div",je,[e.createElementVNode("div",e.mergeProps({onScrollPassive:g[0]||(g[0]=(...c)=>e.unref(r).onScroll&&e.unref(r).onScroll(...c)),ref:e.unref(r).ref,class:"virtualList"},p.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(f))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(_))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a),({index:c,data:u})=>(e.openBlock(),e.createElementBlock("div",{key:c,style:e.normalizeStyle({height:`${e.unref(m)(c).height}px`,display:"flex"})},[e.renderSlot(p.$slots,"default",{data:u,index:c},void 0,!0)],4))),128))],16)],16)],16)]))}}),Ye="",Ne=U(Me,[["__scopeId","data-v-4ba97cce"]]);h.ScrollBar=Ve,h.SvgIcon=$e,h.ToastCreator=ke,h.VirtualList=Ne,h.allSelectedKey=K,h.closeDialogKey=se,h.dialogController=Ce,h.isAllSelectedKey=z,h.isSelectedKey=j,h.selectAllKey=N,h.selectKey=M,h.toggleAllKey=D,h.toggleKey=V,h.unselectAllKey=Q,h.unselectKey=W,h.useSelectable=Ie,h.useSelectableInjectors=Be,h.useVirtualList=ae,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(h,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(h=typeof globalThis<"u"?globalThis:h||self,e(h.ui={},h.Vue))})(this,function(h,e){"use strict";var Z;const T=typeof window<"u";T&&((Z=window?.navigator)==null?void 0:Z.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function $(n){return typeof n=="function"?n():e.unref(n)}function ue(n,t){function o(...l){n(()=>t.apply(this,l),{fn:t,thisArg:this,args:l})}return o}function de(n,t={}){let o,l;return a=>{const r=$(n),d=$(t.maxWait);if(o&&clearTimeout(o),r<=0||d!==void 0&&d<=0)return l&&(clearTimeout(l),l=null),a();d&&!l&&(l=setTimeout(()=>{o&&clearTimeout(o),l=null,a()},d)),o=setTimeout(()=>{l&&clearTimeout(l),l=null,a()},r)}}function fe(n){return n}function pe(n){return e.getCurrentScope()?(e.onScopeDispose(n),!0):!1}function ee(n,t=200,o={}){return ue(de(t,o),n)}function he(n,t=!0){e.getCurrentInstance()?e.onMounted(n):t?n():e.nextTick(n)}function te(n){var t;const o=$(n);return(t=o?.$el)!=null?t:o}const me=T?window:void 0;T&&window.document,T&&window.navigator,T&&window.location;function ge(n,t=!1){const o=e.ref(),l=()=>o.value=Boolean(n());return l(),he(l,t),o}const F=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},L="__vueuse_ssr_handlers__";F[L]=F[L]||{},F[L];var ne=Object.getOwnPropertySymbols,ye=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable,ve=(n,t)=>{var o={};for(var l in n)ye.call(n,l)&&t.indexOf(l)<0&&(o[l]=n[l]);if(n!=null&&ne)for(var l of ne(n))t.indexOf(l)<0&&be.call(n,l)&&(o[l]=n[l]);return o};function _e(n,t,o={}){const l=o,{window:i=me}=l,a=ve(l,["window"]);let r;const d=ge(()=>i&&"ResizeObserver"in i),y=()=>{r&&(r.disconnect(),r=void 0)},m=e.watch(()=>te(n),g=>{y(),d.value&&i&&g&&(r=new ResizeObserver(t),r.observe(g,a))},{immediate:!0,flush:"post"}),p=()=>{y(),m()};return pe(p),{isSupported:d,stop:p}}function Se(n,t={width:0,height:0},o={}){const{box:l="content-box"}=o,i=e.ref(t.width),a=e.ref(t.height);return _e(n,([r])=>{const d=l==="border-box"?r.borderBoxSize:l==="content-box"?r.contentBoxSize:r.devicePixelContentBoxSize;d?(i.value=d.reduce((y,{inlineSize:m})=>y+m,0),a.value=d.reduce((y,{blockSize:m})=>y+m,0)):(i.value=r.contentRect.width,a.value=r.contentRect.height)},o),e.watch(()=>te(n),r=>{i.value=r?t.width:0,a.value=r?t.height:0}),{width:i,height:a}}var oe;(function(n){n.UP="UP",n.RIGHT="RIGHT",n.DOWN="DOWN",n.LEFT="LEFT",n.NONE="NONE"})(oe||(oe={}));var we=Object.defineProperty,le=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,re=(n,t,o)=>t in n?we(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,Te=(n,t)=>{for(var o in t||(t={}))Ee.call(t,o)&&re(n,o,t[o]);if(le)for(var o of le(t))Oe.call(t,o)&&re(n,o,t[o]);return n};Te({linear:fe},{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 ie(n,t){const{scrollEndHook:o,itemHeight:l,overscan:i=5}=t,a=e.ref(null),r=Se(a),d=e.ref(!0),y=ee(q,100);let m;const p=e.shallowRef(n),g=e.ref(0),c=e.ref({start:0,end:10});let u=0;const E=e.ref([]),b=e.computed(()=>{let{sum:s,height:f}={sum:0,height:0};return p.value.map((S,v)=>(typeof l=="number"?f=l:f=l(v),s+=f,{height:f,sum:s}))}),U=e.computed(()=>R(c.value.start)),O=e.computed(()=>typeof l=="number"?b.value.length*l:b.value[b.value.length-1]?.sum||0),I=e.computed(()=>{let s=E.value.length-i,f=Math.max(s-u,0);return E.value.slice(f,s)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(m)),e.watch([r.width,r.height,p],([s,f])=>{(s||f)&&H()},{deep:!0}),e.watch(g,()=>{C(),y()});function C(){d.value=!1}function q(){d.value=!0,o?.()}function H(){cancelAnimationFrame(m),m=requestAnimationFrame(x)}function x(){if(a.value){g.value=a.value.scrollTop,u=B();let s=P(g.value),f=s+u+i;s=s-i,s=s<0?0:s,f=f>p.value.length?p.value.length:f,c.value={start:s,end:f},E.value=p.value.slice(s,f).map((S,v)=>({data:S,index:v+s}))}}function P(s){let f=0,S=b.value.length-1,v=-1;for(;f<=S;){const _=Math.floor((f+S)/2);b.value[_].sum>=s?(v=_,S=_-1):f=_+1}return Math.max(0,v)}function B(){let s=0,f=0,S=Y();for(let v=S;v<b.value.length&&(s++,f+=b.value[v].height,!(f>=r.height.value));v++);return s}function R(s){if(typeof l=="number")return s*l;let f=b.value[s];return f?f.sum-f.height:0}function k(s){return b.value[s]||{sum:0,height:0}}function Y(){let s=c.value.start;return s>=i&&(s+=i),s}function G(s){if(a.value){const f=k(s);a.value.scrollTop=f.sum-f.height,x()}}const J=e.computed(()=>({style:{width:"100%",height:`${O.value}px`,pointerEvents:d.value?void 0:"none"}})),A=e.computed(()=>({style:{transform:`translate3d(0, ${U.value}px, 0)`,"will-change":"transform"}})),X={overflowY:"auto"};return{list:E,visiableList:I,getItemHeightData:k,getoffsetTopIndex:P,totalHeight:O,clientHeight:r.height,scrollTo:G,scrollTop:g,isScrollEnd:d,containerProps:{ref:a,onScroll:()=>{H()},style:X},wrapperProps:J,innerProps:A}}const D=Symbol(),V=Symbol(),j=Symbol(),K=Symbol(),M=Symbol(),N=Symbol(),z=Symbol(),W=Symbol(),Q=Symbol();function Be(){const{voidFn:n,boolFn:t,boolRef:o,arrayRef:l}={voidFn:u=>{},boolFn:u=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},i=e.inject(K,l),a=e.inject(j,t),r=e.inject(W,o),d=e.inject(V,n),y=e.inject(D,n),m=e.inject(M,n),p=e.inject(N,n),g=e.inject(z,n),c=e.inject(Q,n);return{selected:i,isSelected:a,isAllSelected:r,toggle:d,toggleAll:y,select:m,selectAll:p,unselect:g,unselectAll:c}}function Ie(n,t){const o=e.ref({}),l=e.computed(()=>n.value.filter(c=>o.value[c[t]])),i=e.computed(()=>l.value.length!=0&&Object.keys(o.value).length==n.value.length);function a(){n.value.forEach(c=>{o.value[c[t]]=!0})}function r(){o.value={}}function d(c){c.forEach(u=>{o.value[u[t]]||(o.value[u[t]]=!0)})}function y(c){c.forEach(u=>{o.value[u[t]]&&delete o.value[u[t]]})}function m(c){return!!o.value[c[t]]}function p(c){c.forEach(u=>{m(u)?delete o.value[u[t]]:o.value[u[t]]=!0})}function g(){i.value?r():a()}return e.provide(D,g),e.provide(V,p),e.provide(j,m),e.provide(K,l),e.provide(M,d),e.provide(N,a),e.provide(z,y),e.provide(W,i),e.provide(Q,r),{selected:l,select:d,selectAll:a,unselect:y,unselectAll:r,toggle:p,toggleAll:g,isSelected:m,isAllSelected:i}}const ae=Symbol(),Ce=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(ae,()=>t("update:visiable",!1)),(i,a)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[n.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:l,class:"modal absolute inset-0 bottom-0 flex bg-stone-900 bg-opacity-50 z-[999]"},[e.createElementVNode("div",{onClick:a[0]||(a[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog m-auto flex flex-col",n.dialogClass])},[e.renderSlot(i.$slots,"default")],2)])):e.createCommentVNode("",!0)]),_:3}))}});function He(n){function t(o,l){const i=document.createElement("div"),a={setup(){return()=>e.h(Ce,{visiable:!0,"onUpdate:visiable":()=>{i?.remove()},...n},{default:()=>e.h(o,l)})}};return document.body.appendChild(i),e.render(e.h(a),i),{close:()=>i?.remove()}}return{create:t}}const xe=e.defineComponent({__name:"Toast",props:{message:null,position:null},setup(n){const t=n,o=e.ref(),l=e.ref(),i=e.ref(),a=e.computed(()=>{switch(t.position){case"top":return 10;case"middle":return 50;case"bottom":return 85}}),r=e.computed(()=>({position:"absolute",borderRadius:"10px",backgroundColor:"rgba(0, 0, 0, 0.8)",padding:"14px 19px",top:`calc(${a.value}% - ${i.value}px)`,left:`calc(50% - ${l.value}px)`})),d=e.computed(()=>({width:"fit-content",display:"flex",justifyContent:"center",alignItems:"center",color:"white",fontSize:"14px"}));return e.nextTick(()=>{l.value=o.value.offsetWidth/2,i.value=o.value.offsetHeight/2}),(y,m)=>(e.openBlock(),e.createElementBlock("div",{id:"toastWrapper",ref_key:"toastWrapper",ref:o,class:"toastWrapper",style:e.normalizeStyle([e.unref(r),{zIndex:9999}])},[e.createElementVNode("div",{style:e.normalizeStyle(e.unref(d))},[e.createElementVNode("span",null,e.toDisplayString(n.message),1)],4)],4))}}),se={message:"\u61D2\u732B\u4E91 Yes!!!",position:"middle",duration:1500};class Pe{options;container;constructor(t){this.options=t,this.container=document.createElement("div")}present(){const t=e.h(e.h(xe),{...se,...this.options});e.render(t,this.container),document.body.insertBefore(this.container,document.body.firstChild);const o=this.options.duration||se.duration;setTimeout(()=>{this.dismiss()},o)}dismiss(){this.container&&(this.container.querySelector("#toastWrapper")?.classList.add("animate-toastAnimation"),setTimeout(()=>{this.container&&(e.render(null,this.container),document.body.removeChild(this.container))},500))}}const Re=["xlink:href","fill","color"],ke=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(i,a)=>(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,Re)],4))}});function Ae(n){const{containerEl:t,sliderEl:o,autoHeight:l,performance:i={},maxHeightRatio:a=.9}=n,r=e.ref(!0),d=ee(R,100);let y,m="";const p=e.ref(0),g=e.ref(0),c=e.ref(0),u=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),E=e.ref({clientHeight:0}),b=e.computed(()=>!!g.value),U=e.computed(()=>u.value.scrollHeight>u.value.clientHeight),O=e.computed(()=>u.value.clientHeight-E.value.clientHeight),I=e.computed(()=>u.value.scrollHeight-u.value.clientHeight),C=e.computed(()=>Math.max(u.value.clientHeight/u.value.scrollHeight,.05)),q=e.computed(()=>C.value>a?0:C.value*u.value.clientHeight),H=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${c.value}px,0)`,height:l?`${q.value}px`:void 0}));function x(_){B(),g.value=_.clientY-o.value.getBoundingClientRect().top||1,m=getComputedStyle(t.value).scrollBehavior,m==="smooth"&&(t.value.style.scrollBehavior="unset")}function P(){t.value.style.scrollBehavior=m,g.value=0,d()}function B(){r.value=!1}function R(){b.value||(r.value=!0)}function k(_){if(!b.value)return;let w=_.clientY-u.value.top-g.value;w<0?c.value=0:w>=O.value?c.value=O.value:c.value=w,t.value.scrollTo({top:c.value/O.value*I.value})}function Y(){b.value||G()}function G(){cancelAnimationFrame(y),y=requestAnimationFrame(J)}function J(){t.value&&(p.value=i.scrollTop?.value??t.value.scrollTop,c.value=p.value/I.value*O.value)}function A(_){let w="addEventListener";_==="add"?w="addEventListener":w="removeEventListener",o.value?.[w]("pointerdown",x,{passive:!0}),window[w]("pointermove",k,{passive:!0}),window[w]("pointerup",P,{passive:!0})}const X=new MutationObserver(_=>{_.map(Me=>Me.oldValue).join().includes("height")&&s()});function s(){u.value.top=t.value?.getBoundingClientRect().top??0,u.value.scrollHeight=t.value?.scrollHeight??0,u.value.clientHeight=t.value?.clientHeight??0}function f(){B(),setTimeout(()=>{E.value.clientHeight=o.value?.clientHeight??0,R()},150)}function S(){document.styleSheets[0].insertRule(".hide-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }",0),document.styleSheets[0].insertRule(".hide-scrollbar::-webkit-scrollbar{ display: none }",0),t.value?.classList.add("hide-scrollbar")}function v(){t.value&&o.value?(S(),t.value.addEventListener("scroll",Y,{passive:!0}),A("add"),X.observe(t.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{s()},100),f()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:t,sliderEl:o})}return e.watch(p,()=>{B(),d()}),{isScrollEnd:r,isDragSlider:b,offsetTop:c,scrollTop:p,scrollable:U,sliderPos:H,init:v,modifySliderEventListener:A}}const $e=(n=>(e.pushScopeId("data-v-edec7292"),n=n(),e.popScopeId(),n))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),Fe=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,i=e.ref(null),a=e.computed(()=>o.containerEl),r=Ae({containerEl:a,sliderEl:i,autoHeight:l?o.autoHeight:!0,performance:o.performance}),{scrollable:d,isScrollEnd:y,sliderPos:m}=r,p=e.ref(!1),g=o.autoHide?e.computed(()=>p.value||!y.value):e.computed(()=>d.value);e.onMounted(()=>{e.nextTick(()=>{r.init()})}),e.onUnmounted(()=>{r.modifySliderEventListener("remove")});function c(){p.value=!0}function u(){p.value=!1}return t({uScrollBarReturn:r}),(E,b)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"sliderRef",ref:i,class:"slider-wrapper",onMouseenter:c,onMouseleave:u,style:e.normalizeStyle(e.unref(m))},[e.renderSlot(E.$slots,"default",{},()=>[$e],!0)],36),[[e.vShow,e.unref(g)]])]),_:3}))}}),We="",ce=(n,t)=>{const o=n.__vccOpts||n;for(const[l,i]of t)o[l]=i;return o},Le=ce(Fe,[["__scopeId","data-v-edec7292"]]),De={class:"virtualListWrapper"},Ve={inheritAttrs:!1},je=e.defineComponent({...Ve,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},emits:["scrollEnd"],setup(n,{expose:t,emit:o}){const l=n,i=ie(e.toRef(l,"data"),{itemHeight:p=>l.itemHeight(l.data[p]),overscan:l.overscan,scrollEndHook:()=>{o("scrollEnd")}}),{list:a,containerProps:r,wrapperProps:d,innerProps:y,getItemHeightData:m}=i;return t({vListReturn:i}),(p,g)=>(e.openBlock(),e.createElementBlock("div",De,[e.createElementVNode("div",e.mergeProps({onScrollPassive:g[0]||(g[0]=(...c)=>e.unref(r).onScroll&&e.unref(r).onScroll(...c)),ref:e.unref(r).ref,class:"virtualList"},p.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(d))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(y))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a),({index:c,data:u})=>(e.openBlock(),e.createElementBlock("div",{key:c,style:e.normalizeStyle({height:`${e.unref(m)(c).height}px`,display:"flex"})},[e.renderSlot(p.$slots,"default",{data:u,index:c},void 0,!0)],4))),128))],16)],16)],16)]))}}),Qe="",Ke=ce(je,[["__scopeId","data-v-4ba97cce"]]);h.ScrollBar=Le,h.SvgIcon=ke,h.ToastCreator=Pe,h.VirtualList=Ke,h.allSelectedKey=K,h.closeDialogKey=ae,h.dialogController=He,h.isAllSelectedKey=W,h.isSelectedKey=j,h.selectAllKey=N,h.selectKey=M,h.toggleAllKey=D,h.toggleKey=V,h.unselectAllKey=Q,h.unselectKey=z,h.useSelectable=Ie,h.useSelectableInjectors=Be,h.useVirtualList=ie,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .toast[data-v-4a518cee]{width:fit-content;display:flex;justify-content:center;align-items:center;color:#fff;font-size:14px}.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
+ .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.50",
3
+ "version": "0.0.51",
4
4
  "description": "lazycat ui toolkits",
5
5
  "main": "./dist/index.umd.js",
6
6
  "module": "./dist/index.es.js",