@lazycatcloud/lzc-toolkit 0.0.27 → 0.0.29

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,106 +1,106 @@
1
- import { unref as S, getCurrentScope as xe, onScopeDispose as He, getCurrentInstance as Ie, onMounted as X, nextTick as ie, ref as _, watch as R, shallowRef as Te, computed as p, onUnmounted as ue, inject as x, provide as O, defineComponent as K, openBlock as H, createBlock as ce, Transition as de, withCtx as ve, createElementBlock as P, createElementVNode as I, withModifiers as Ce, normalizeClass as Be, renderSlot as Z, createCommentVNode as Pe, render as Re, h as q, normalizeStyle as ee, useSlots as Ae, withDirectives as $e, vShow as Fe, pushScopeId as Le, popScopeId as De, toRef as ke, mergeProps as Ve, normalizeProps as te, guardReactiveProps as le, Fragment as Ke, renderList as je } from "vue";
2
- var ne;
1
+ import { unref as w, getCurrentScope as Ie, onScopeDispose as Te, getCurrentInstance as Re, onMounted as Z, nextTick as ue, ref as _, watch as P, shallowRef as Ce, computed as h, onUnmounted as ce, inject as E, provide as x, defineComponent as j, openBlock as T, createBlock as de, Transition as ve, withCtx as fe, createElementBlock as B, createElementVNode as R, withModifiers as Be, normalizeClass as Pe, renderSlot as ee, createCommentVNode as Ae, render as $e, h as Y, normalizeStyle as te, useSlots as Fe, withDirectives as Le, vShow as De, pushScopeId as ke, popScopeId as Ve, toRef as Ke, mergeProps as je, normalizeProps as le, guardReactiveProps as ne, Fragment as ze, renderList as Me } from "vue";
2
+ var oe;
3
3
  const A = typeof window < "u";
4
- A && ((ne = window?.navigator) == null ? void 0 : ne.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
5
- function Y(e) {
6
- return typeof e == "function" ? e() : S(e);
4
+ A && ((oe = window?.navigator) == null ? void 0 : oe.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
5
+ function G(e) {
6
+ return typeof e == "function" ? e() : w(e);
7
7
  }
8
- function ze(e, t) {
8
+ function Ne(e, t) {
9
9
  function l(...n) {
10
10
  e(() => t.apply(this, n), { fn: t, thisArg: this, args: n });
11
11
  }
12
12
  return l;
13
13
  }
14
- function Me(e, t = {}) {
14
+ function Qe(e, t = {}) {
15
15
  let l, n;
16
- return (a) => {
17
- const o = Y(e), u = Y(t.maxWait);
18
- if (l && clearTimeout(l), o <= 0 || u !== void 0 && u <= 0)
19
- return n && (clearTimeout(n), n = null), a();
20
- u && !n && (n = setTimeout(() => {
21
- l && clearTimeout(l), n = null, a();
22
- }, u)), l = setTimeout(() => {
23
- n && clearTimeout(n), n = null, a();
16
+ return (s) => {
17
+ const o = G(e), d = G(t.maxWait);
18
+ if (l && clearTimeout(l), o <= 0 || d !== void 0 && d <= 0)
19
+ return n && (clearTimeout(n), n = null), s();
20
+ d && !n && (n = setTimeout(() => {
21
+ l && clearTimeout(l), n = null, s();
22
+ }, d)), l = setTimeout(() => {
23
+ n && clearTimeout(n), n = null, s();
24
24
  }, o);
25
25
  };
26
26
  }
27
- function Ne(e) {
27
+ function We(e) {
28
28
  return e;
29
29
  }
30
- function Qe(e) {
31
- return xe() ? (He(e), !0) : !1;
30
+ function Ue(e) {
31
+ return Ie() ? (Te(e), !0) : !1;
32
32
  }
33
- function fe(e, t = 200, l = {}) {
34
- return ze(Me(t, l), e);
33
+ function pe(e, t = 200, l = {}) {
34
+ return Ne(Qe(t, l), e);
35
35
  }
36
- function We(e, t = !0) {
37
- Ie() ? X(e) : t ? e() : ie(e);
36
+ function qe(e, t = !0) {
37
+ Re() ? Z(e) : t ? e() : ue(e);
38
38
  }
39
- function pe(e) {
39
+ function he(e) {
40
40
  var t;
41
- const l = Y(e);
41
+ const l = G(e);
42
42
  return (t = l?.$el) != null ? t : l;
43
43
  }
44
- const Ue = A ? window : void 0;
44
+ const Ye = A ? window : void 0;
45
45
  A && window.document;
46
46
  A && window.navigator;
47
47
  A && window.location;
48
- function qe(e, t = !1) {
48
+ function Ge(e, t = !1) {
49
49
  const l = _(), n = () => l.value = Boolean(e());
50
- return n(), We(n, t), l;
50
+ return n(), qe(n, t), l;
51
51
  }
52
- const G = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, J = "__vueuse_ssr_handlers__";
53
- G[J] = G[J] || {};
54
- G[J];
55
- var oe = Object.getOwnPropertySymbols, Ye = Object.prototype.hasOwnProperty, Ge = Object.prototype.propertyIsEnumerable, Je = (e, t) => {
52
+ const J = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, X = "__vueuse_ssr_handlers__";
53
+ J[X] = J[X] || {};
54
+ J[X];
55
+ var re = Object.getOwnPropertySymbols, Je = Object.prototype.hasOwnProperty, Xe = Object.prototype.propertyIsEnumerable, Ze = (e, t) => {
56
56
  var l = {};
57
57
  for (var n in e)
58
- Ye.call(e, n) && t.indexOf(n) < 0 && (l[n] = e[n]);
59
- if (e != null && oe)
60
- for (var n of oe(e))
61
- t.indexOf(n) < 0 && Ge.call(e, n) && (l[n] = e[n]);
58
+ Je.call(e, n) && t.indexOf(n) < 0 && (l[n] = e[n]);
59
+ if (e != null && re)
60
+ for (var n of re(e))
61
+ t.indexOf(n) < 0 && Xe.call(e, n) && (l[n] = e[n]);
62
62
  return l;
63
63
  };
64
- function Xe(e, t, l = {}) {
65
- const n = l, { window: r = Ue } = n, a = Je(n, ["window"]);
64
+ function et(e, t, l = {}) {
65
+ const n = l, { window: r = Ye } = n, s = Ze(n, ["window"]);
66
66
  let o;
67
- const u = qe(() => r && "ResizeObserver" in r), h = () => {
67
+ const d = Ge(() => r && "ResizeObserver" in r), g = () => {
68
68
  o && (o.disconnect(), o = void 0);
69
- }, f = R(() => pe(e), (v) => {
70
- h(), u.value && r && v && (o = new ResizeObserver(t), o.observe(v, a));
71
- }, { immediate: !0, flush: "post" }), d = () => {
72
- h(), f();
69
+ }, f = P(() => he(e), (p) => {
70
+ g(), d.value && r && p && (o = new ResizeObserver(t), o.observe(p, s));
71
+ }, { immediate: !0, flush: "post" }), v = () => {
72
+ g(), f();
73
73
  };
74
- return Qe(d), {
75
- isSupported: u,
76
- stop: d
74
+ return Ue(v), {
75
+ isSupported: d,
76
+ stop: v
77
77
  };
78
78
  }
79
- function Ze(e, t = { width: 0, height: 0 }, l = {}) {
80
- const { box: n = "content-box" } = l, r = _(t.width), a = _(t.height);
81
- return Xe(e, ([o]) => {
82
- const u = n === "border-box" ? o.borderBoxSize : n === "content-box" ? o.contentBoxSize : o.devicePixelContentBoxSize;
83
- u ? (r.value = u.reduce((h, { inlineSize: f }) => h + f, 0), a.value = u.reduce((h, { blockSize: f }) => h + f, 0)) : (r.value = o.contentRect.width, a.value = o.contentRect.height);
84
- }, l), R(() => pe(e), (o) => {
85
- r.value = o ? t.width : 0, a.value = o ? t.height : 0;
79
+ function tt(e, t = { width: 0, height: 0 }, l = {}) {
80
+ const { box: n = "content-box" } = l, r = _(t.width), s = _(t.height);
81
+ return et(e, ([o]) => {
82
+ const d = n === "border-box" ? o.borderBoxSize : n === "content-box" ? o.contentBoxSize : o.devicePixelContentBoxSize;
83
+ d ? (r.value = d.reduce((g, { inlineSize: f }) => g + f, 0), s.value = d.reduce((g, { blockSize: f }) => g + f, 0)) : (r.value = o.contentRect.width, s.value = o.contentRect.height);
84
+ }, l), P(() => he(e), (o) => {
85
+ r.value = o ? t.width : 0, s.value = o ? t.height : 0;
86
86
  }), {
87
87
  width: r,
88
- height: a
88
+ height: s
89
89
  };
90
90
  }
91
- var re;
91
+ var ae;
92
92
  (function(e) {
93
93
  e.UP = "UP", e.RIGHT = "RIGHT", e.DOWN = "DOWN", e.LEFT = "LEFT", e.NONE = "NONE";
94
- })(re || (re = {}));
95
- var et = Object.defineProperty, ae = Object.getOwnPropertySymbols, tt = Object.prototype.hasOwnProperty, lt = Object.prototype.propertyIsEnumerable, se = (e, t, l) => t in e ? et(e, t, { enumerable: !0, configurable: !0, writable: !0, value: l }) : e[t] = l, nt = (e, t) => {
94
+ })(ae || (ae = {}));
95
+ var lt = Object.defineProperty, se = Object.getOwnPropertySymbols, nt = Object.prototype.hasOwnProperty, ot = Object.prototype.propertyIsEnumerable, ie = (e, t, l) => t in e ? lt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: l }) : e[t] = l, rt = (e, t) => {
96
96
  for (var l in t || (t = {}))
97
- tt.call(t, l) && se(e, l, t[l]);
98
- if (ae)
99
- for (var l of ae(t))
100
- lt.call(t, l) && se(e, l, t[l]);
97
+ nt.call(t, l) && ie(e, l, t[l]);
98
+ if (se)
99
+ for (var l of se(t))
100
+ ot.call(t, l) && ie(e, l, t[l]);
101
101
  return e;
102
102
  };
103
- const ot = {
103
+ const at = {
104
104
  easeInSine: [0.12, 0, 0.39, 0],
105
105
  easeOutSine: [0.61, 1, 0.88, 1],
106
106
  easeInOutSine: [0.37, 0, 0.63, 1],
@@ -126,191 +126,191 @@ const ot = {
126
126
  easeOutBack: [0.34, 1.56, 0.64, 1],
127
127
  easeInOutBack: [0.68, -0.6, 0.32, 1.6]
128
128
  };
129
- nt({
130
- linear: Ne
131
- }, ot);
132
- function rt(e, t) {
133
- const { scrollEndHook: l, itemHeight: n, overscan: r = 5 } = t, a = _(), o = Ze(a), u = _(!0), h = fe(M, 100);
129
+ rt({
130
+ linear: We
131
+ }, at);
132
+ function st(e, t) {
133
+ const { scrollEndHook: l, itemHeight: n, overscan: r = 5 } = t, s = _(), o = tt(s), d = _(!0), g = pe(M, 100);
134
134
  let f;
135
- const d = Te(e), v = _(0), s = _({ start: 0, end: 10 });
136
- let m = 0;
137
- const E = _([]), y = p(() => {
138
- let { sum: i, height: c } = { sum: 0, height: 0 };
139
- return d.value.map((b, g) => (typeof n == "number" ? c = n : c = n(g), i += c, { height: c, sum: i }));
140
- }), T = p(() => N(s.value.start)), C = p(() => typeof n == "number" ? y.value.length * n : y.value[y.value.length - 1]?.sum || 0), j = p(() => {
141
- let i = E.value.length - r, c = Math.max(i - m, 0);
142
- return E.value.slice(c, i);
135
+ const v = Ce(e), p = _(0), i = _({ start: 0, end: 10 });
136
+ let u = 0;
137
+ const H = _([]), b = h(() => {
138
+ let { sum: a, height: c } = { sum: 0, height: 0 };
139
+ return v.value.map((S, y) => (typeof n == "number" ? c = n : c = n(y), a += c, { height: c, sum: a }));
140
+ }), z = h(() => k(i.value.start)), I = h(() => typeof n == "number" ? b.value.length * n : b.value[b.value.length - 1]?.sum || 0), $ = h(() => {
141
+ let a = H.value.length - r, c = Math.max(a - u, 0);
142
+ return H.value.slice(c, a);
143
143
  });
144
- X(() => {
145
- }), ue(() => cancelAnimationFrame(f)), R(
146
- [o.width, o.height, d],
147
- ([i, c]) => {
148
- (i || c) && $();
144
+ Z(() => {
145
+ }), ce(() => cancelAnimationFrame(f)), P(
146
+ [o.width, o.height, v],
147
+ ([a, c]) => {
148
+ (a || c) && L();
149
149
  },
150
150
  { deep: !0 }
151
- ), R(v, () => {
152
- z(), h();
151
+ ), P(p, () => {
152
+ F(), g();
153
153
  });
154
- function z() {
155
- u.value = !1;
154
+ function F() {
155
+ d.value = !1;
156
156
  }
157
157
  function M() {
158
- u.value = !0, l?.();
158
+ d.value = !0, l?.();
159
159
  }
160
- function $() {
161
- cancelAnimationFrame(f), f = requestAnimationFrame(F);
160
+ function L() {
161
+ cancelAnimationFrame(f), f = requestAnimationFrame(D);
162
162
  }
163
- function F() {
164
- if (a.value) {
165
- v.value = a.value.scrollTop, m = L();
166
- let i = B(v.value), c = i + m + r;
167
- i = i - r, i = i < 0 ? 0 : i, c = c > d.value.length ? d.value.length : c, s.value = { start: i, end: c }, E.value = d.value.slice(i, c).map((b, g) => ({
168
- data: b,
169
- index: g + i
163
+ function D() {
164
+ if (s.value) {
165
+ p.value = s.value.scrollTop, u = C();
166
+ let a = N(p.value), c = a + u + r;
167
+ a = a - r, a = a < 0 ? 0 : a, c = c > v.value.length ? v.value.length : c, i.value = { start: a, end: c }, H.value = v.value.slice(a, c).map((S, y) => ({
168
+ data: S,
169
+ index: y + a
170
170
  }));
171
171
  }
172
172
  }
173
- function B(i) {
174
- let c = Math.floor(y.value.length / 16), b = -1, g = -1;
175
- for (let w = 0; w < 16; w++) {
176
- if (y.value[c * w].sum >= i) {
177
- b = Math.max(0, w - 1);
173
+ function N(a) {
174
+ let c = Math.floor(b.value.length / 16), S = -1, y = -1;
175
+ for (let m = 0; m < 16; m++) {
176
+ if (b.value[c * m].sum >= a) {
177
+ S = Math.max(0, m - 1);
178
178
  break;
179
179
  }
180
- w === 15 && (b = w);
180
+ m === 15 && (S = m);
181
181
  }
182
- b *= c;
183
- for (let w = b; w < y.value.length; w++)
184
- if (y.value[w].sum >= i) {
185
- g = w;
182
+ S *= c;
183
+ for (let m = S; m < b.value.length; m++)
184
+ if (b.value[m].sum >= a) {
185
+ y = m;
186
186
  break;
187
187
  }
188
- return Math.max(0, g);
188
+ return Math.max(0, y);
189
189
  }
190
- function L() {
191
- let i = 0, c = 0, b = Q();
192
- for (let g = b; g < y.value.length && (i++, c += y.value[g].height, !(c >= o.height.value)); g++)
190
+ function C() {
191
+ let a = 0, c = 0, S = Q();
192
+ for (let y = S; y < b.value.length && (a++, c += b.value[y].height, !(c >= o.height.value)); y++)
193
193
  ;
194
- return i;
194
+ return a;
195
195
  }
196
- function N(i) {
196
+ function k(a) {
197
197
  if (typeof n == "number")
198
- return i * n;
199
- let c = y.value[i];
200
- return c.sum - c.height;
198
+ return a * n;
199
+ let c = b.value[a];
200
+ return c ? c.sum - c.height : 0;
201
201
  }
202
- function D(i) {
203
- return y.value[i] || { sum: 0, height: 0 };
202
+ function V(a) {
203
+ return b.value[a] || { sum: 0, height: 0 };
204
204
  }
205
205
  function Q() {
206
- let i = s.value.start;
207
- return i >= r && (i += r), i;
206
+ let a = i.value.start;
207
+ return a >= r && (a += r), a;
208
208
  }
209
- function W(i) {
210
- if (a.value) {
211
- const c = D(i);
212
- a.value.scrollTop = c.sum - c.height, F();
209
+ function W(a) {
210
+ if (s.value) {
211
+ const c = V(a);
212
+ s.value.scrollTop = c.sum - c.height, D();
213
213
  }
214
214
  }
215
- const k = p(() => ({
215
+ const U = h(() => ({
216
216
  style: {
217
217
  width: "100%",
218
- height: `${C.value}px`,
219
- pointerEvents: u.value ? void 0 : "none"
218
+ height: `${I.value}px`,
219
+ pointerEvents: d.value ? void 0 : "none"
220
220
  }
221
- })), U = p(() => ({
221
+ })), K = h(() => ({
222
222
  style: {
223
- transform: `translate3d(0, ${T.value}px, 0)`,
223
+ transform: `translate3d(0, ${z.value}px, 0)`,
224
224
  "will-change": "transform"
225
225
  }
226
- })), V = {
226
+ })), q = {
227
227
  overflowY: "auto"
228
228
  };
229
229
  return {
230
- list: E,
231
- visiableList: j,
232
- getItemHeightData: D,
233
- totalHeight: C,
230
+ list: H,
231
+ visiableList: $,
232
+ getItemHeightData: V,
233
+ totalHeight: I,
234
234
  clientHeight: o.height,
235
235
  scrollTo: W,
236
- scrollTop: v,
237
- isScrollEnd: u,
236
+ scrollTop: p,
237
+ isScrollEnd: d,
238
238
  containerProps: {
239
- ref: a,
239
+ ref: s,
240
240
  onScroll: () => {
241
- $();
241
+ L();
242
242
  },
243
- style: V
243
+ style: q
244
244
  },
245
- wrapperProps: k,
246
- innerProps: U
245
+ wrapperProps: U,
246
+ innerProps: K
247
247
  };
248
248
  }
249
- const he = Symbol(), ge = Symbol(), me = Symbol(), be = Symbol(), _e = Symbol(), ye = Symbol(), we = Symbol(), Se = Symbol(), Oe = Symbol();
250
- function mt() {
249
+ const ge = Symbol(), me = Symbol(), be = Symbol(), _e = Symbol(), ye = Symbol(), we = Symbol(), Se = Symbol(), Oe = Symbol(), xe = Symbol();
250
+ function _t() {
251
251
  const { voidFn: e, boolFn: t, boolRef: l, arrayRef: n } = {
252
- voidFn: (m) => {
252
+ voidFn: (u) => {
253
253
  },
254
- boolFn: (m) => !1,
255
- boolRef: p(() => !1),
256
- arrayRef: p(() => [])
257
- }, r = x(be, n), a = x(me, t), o = x(Se, l), u = x(ge, e), h = x(he, e), f = x(_e, e), d = x(ye, e), v = x(we, e), s = x(Oe, e);
254
+ boolFn: (u) => !1,
255
+ boolRef: h(() => !1),
256
+ arrayRef: h(() => [])
257
+ }, r = E(_e, n), s = E(be, t), o = E(Oe, l), d = E(me, e), g = E(ge, e), f = E(ye, e), v = E(we, e), p = E(Se, e), i = E(xe, e);
258
258
  return {
259
259
  selected: r,
260
- isSelected: a,
260
+ isSelected: s,
261
261
  isAllSelected: o,
262
- toggle: u,
263
- toggleAll: h,
262
+ toggle: d,
263
+ toggleAll: g,
264
264
  select: f,
265
- selectAll: d,
266
- unselect: v,
267
- unselectAll: s
265
+ selectAll: v,
266
+ unselect: p,
267
+ unselectAll: i
268
268
  };
269
269
  }
270
- function bt(e, t) {
271
- const l = _({}), n = p(() => e.value.filter((s) => l.value[s[t]])), r = p(() => n.value.length != 0 && Object.keys(l.value).length == e.value.length);
272
- function a() {
273
- e.value.forEach((s) => {
274
- l.value[s[t]] = !0;
270
+ function yt(e, t) {
271
+ const l = _({}), n = h(() => e.value.filter((i) => l.value[i[t]])), r = h(() => n.value.length != 0 && Object.keys(l.value).length == e.value.length);
272
+ function s() {
273
+ e.value.forEach((i) => {
274
+ l.value[i[t]] = !0;
275
275
  });
276
276
  }
277
277
  function o() {
278
278
  l.value = {};
279
279
  }
280
- function u(s) {
281
- s.forEach((m) => {
282
- l.value[m[t]] || (l.value[m[t]] = !0);
280
+ function d(i) {
281
+ i.forEach((u) => {
282
+ l.value[u[t]] || (l.value[u[t]] = !0);
283
283
  });
284
284
  }
285
- function h(s) {
286
- s.forEach((m) => {
287
- l.value[m[t]] && delete l.value[m[t]];
285
+ function g(i) {
286
+ i.forEach((u) => {
287
+ l.value[u[t]] && delete l.value[u[t]];
288
288
  });
289
289
  }
290
- function f(s) {
291
- return !!l.value[s[t]];
290
+ function f(i) {
291
+ return !!l.value[i[t]];
292
292
  }
293
- function d(s) {
294
- s.forEach((m) => {
295
- f(m) ? delete l.value[m[t]] : l.value[m[t]] = !0;
293
+ function v(i) {
294
+ i.forEach((u) => {
295
+ f(u) ? delete l.value[u[t]] : l.value[u[t]] = !0;
296
296
  });
297
297
  }
298
- function v() {
299
- r.value ? o() : a();
298
+ function p() {
299
+ r.value ? o() : s();
300
300
  }
301
- return O(he, v), O(ge, d), O(me, f), O(be, n), O(_e, u), O(ye, a), O(we, h), O(Se, r), O(Oe, o), {
301
+ return x(ge, p), x(me, v), x(be, f), x(_e, n), x(ye, d), x(we, s), x(Se, g), x(Oe, r), x(xe, o), {
302
302
  selected: n,
303
- select: u,
304
- selectAll: a,
305
- unselect: h,
303
+ select: d,
304
+ selectAll: s,
305
+ unselect: g,
306
306
  unselectAll: o,
307
- toggle: d,
308
- toggleAll: v,
307
+ toggle: v,
308
+ toggleAll: p,
309
309
  isSelected: f,
310
310
  isAllSelected: r
311
311
  };
312
312
  }
313
- const at = Symbol(), st = /* @__PURE__ */ K({
313
+ const it = Symbol(), ut = /* @__PURE__ */ j({
314
314
  __name: "Dialog",
315
315
  props: {
316
316
  visiable: { type: Boolean, default: !1 },
@@ -322,32 +322,32 @@ const at = Symbol(), st = /* @__PURE__ */ K({
322
322
  const l = e, n = () => {
323
323
  l.closeOnClickOverlay && t("update:visiable", !1);
324
324
  };
325
- return O(at, () => t("update:visiable", !1)), (r, a) => (H(), ce(de, { name: "modal" }, {
326
- default: ve(() => [
327
- e.visiable ? (H(), P("div", {
325
+ return x(it, () => t("update:visiable", !1)), (r, s) => (T(), de(ve, { name: "modal" }, {
326
+ default: fe(() => [
327
+ e.visiable ? (T(), B("div", {
328
328
  key: 0,
329
329
  onClick: n,
330
330
  class: "modal absolute inset-0 bottom-0 z-50 flex bg-stone-900 bg-opacity-50"
331
331
  }, [
332
- I("div", {
333
- onClick: a[0] || (a[0] = Ce(() => {
332
+ R("div", {
333
+ onClick: s[0] || (s[0] = Be(() => {
334
334
  }, ["stop"])),
335
- class: Be(["dialog m-auto flex flex-col", e.dialogClass])
335
+ class: Pe(["dialog m-auto flex flex-col", e.dialogClass])
336
336
  }, [
337
- Z(r.$slots, "default")
337
+ ee(r.$slots, "default")
338
338
  ], 2)
339
- ])) : Pe("", !0)
339
+ ])) : Ae("", !0)
340
340
  ]),
341
341
  _: 3
342
342
  }));
343
343
  }
344
344
  });
345
- function _t(e) {
345
+ function wt(e) {
346
346
  function t(l, n) {
347
- const r = document.createElement("div"), a = {
347
+ const r = document.createElement("div"), s = {
348
348
  setup() {
349
- return () => q(
350
- st,
349
+ return () => Y(
350
+ ut,
351
351
  {
352
352
  visiable: !0,
353
353
  "onUpdate:visiable": () => {
@@ -356,12 +356,12 @@ function _t(e) {
356
356
  ...e
357
357
  },
358
358
  {
359
- default: () => q(l, n)
359
+ default: () => Y(l, n)
360
360
  }
361
361
  );
362
362
  }
363
363
  };
364
- return document.body.appendChild(r), Re(q(a), r), {
364
+ return document.body.appendChild(r), $e(Y(s), r), {
365
365
  close: () => r?.remove()
366
366
  };
367
367
  }
@@ -369,7 +369,7 @@ function _t(e) {
369
369
  create: t
370
370
  };
371
371
  }
372
- const it = ["xlink:href", "fill", "color"], yt = /* @__PURE__ */ K({
372
+ const ct = ["xlink:href", "fill", "color"], St = /* @__PURE__ */ j({
373
373
  __name: "SvgIcon",
374
374
  props: {
375
375
  name: null,
@@ -379,110 +379,125 @@ const it = ["xlink:href", "fill", "color"], yt = /* @__PURE__ */ K({
379
379
  height: null
380
380
  },
381
381
  setup(e) {
382
- const t = e, l = p(() => `#${t.prefix}-${t.name}`), n = p(() => ({
382
+ const t = e, l = h(() => `#${t.prefix}-${t.name}`), n = h(() => ({
383
383
  width: t.width,
384
384
  height: t.height,
385
385
  aspectRatio: t.width && t.height ? void 0 : "1/1"
386
386
  }));
387
- return (r, a) => (H(), P("svg", {
387
+ return (r, s) => (T(), B("svg", {
388
388
  "aria-hidden": "",
389
- style: ee(S(n))
389
+ style: te(w(n))
390
390
  }, [
391
- I("use", {
392
- "xlink:href": S(l),
391
+ R("use", {
392
+ "xlink:href": w(l),
393
393
  fill: e.color,
394
394
  color: e.color
395
- }, null, 8, it)
395
+ }, null, 8, ct)
396
396
  ], 4));
397
397
  }
398
398
  });
399
- function ut(e) {
400
- const { containerEl: t, sliderEl: l, autoHeight: n, performance: r = {} } = e, a = _(!0), o = fe(L, 100);
401
- let u, h = "";
402
- const f = _(0), d = _(0), v = _(0), s = _({
399
+ function dt(e) {
400
+ const {
401
+ containerEl: t,
402
+ sliderEl: l,
403
+ autoHeight: n,
404
+ performance: r = {},
405
+ maxHeightRatio: s = 0.9
406
+ } = e, o = _(!0), d = pe(k, 100);
407
+ let g, f = "";
408
+ const v = _(0), p = _(0), i = _(0), u = _({
403
409
  top: 0,
404
410
  scrollTop: 0,
405
411
  scrollHeight: 0,
406
412
  clientHeight: 0
407
- }), m = _({
413
+ }), H = _({
408
414
  clientHeight: 0
409
- }), E = p(() => !!d.value), y = p(() => s.value.scrollHeight > s.value.clientHeight), T = p(() => s.value.clientHeight - m.value.clientHeight), C = p(() => s.value.scrollHeight - s.value.clientHeight), j = p(() => Math.max(
410
- s.value.clientHeight / s.value.scrollHeight,
415
+ }), b = h(() => !!p.value), z = h(() => u.value.scrollHeight > u.value.clientHeight), I = h(() => u.value.clientHeight - H.value.clientHeight), $ = h(() => u.value.scrollHeight - u.value.clientHeight), F = h(() => Math.max(
416
+ u.value.clientHeight / u.value.scrollHeight,
411
417
  0.05
412
- )), z = p(() => j.value * s.value.clientHeight), M = p(() => ({
418
+ )), M = h(() => F.value > s ? 0 : F.value * u.value.clientHeight), L = h(() => ({
413
419
  willChange: "transform",
414
- transform: `translate3d(0,${v.value}px,0)`,
415
- height: n ? `${z.value}px` : void 0
420
+ transform: `translate3d(0,${i.value}px,0)`,
421
+ height: n ? `${M.value}px` : void 0
416
422
  }));
417
- function $(b) {
418
- B(), d.value = b.clientY - l.value.getBoundingClientRect().top || 1, h = getComputedStyle(t.value).scrollBehavior, h === "smooth" && (t.value.style.scrollBehavior = "unset");
423
+ function D(m) {
424
+ C(), p.value = m.clientY - l.value.getBoundingClientRect().top || 1, f = getComputedStyle(t.value).scrollBehavior, f === "smooth" && (t.value.style.scrollBehavior = "unset");
419
425
  }
420
- function F() {
421
- t.value.style.scrollBehavior = h, d.value = 0, o();
426
+ function N() {
427
+ t.value.style.scrollBehavior = f, p.value = 0, d();
422
428
  }
423
- function B() {
424
- a.value = !1;
429
+ function C() {
430
+ o.value = !1;
425
431
  }
426
- function L() {
427
- E.value || (a.value = !0);
432
+ function k() {
433
+ b.value || (o.value = !0);
428
434
  }
429
- function N(b) {
430
- if (!E.value)
435
+ function V(m) {
436
+ if (!b.value)
431
437
  return;
432
- let g = b.clientY - s.value.top - d.value;
433
- g < 0 ? v.value = 0 : g >= T.value ? v.value = T.value : v.value = g, t.value.scrollTo({
434
- top: v.value / T.value * C.value
438
+ let O = m.clientY - u.value.top - p.value;
439
+ O < 0 ? i.value = 0 : O >= I.value ? i.value = I.value : i.value = O, t.value.scrollTo({
440
+ top: i.value / I.value * $.value
435
441
  });
436
442
  }
437
- function D() {
438
- E.value || Q();
439
- }
440
443
  function Q() {
441
- cancelAnimationFrame(u), u = requestAnimationFrame(W);
444
+ b.value || W();
442
445
  }
443
446
  function W() {
444
- t.value && (f.value = r.scrollTop?.value ?? t.value.scrollTop, v.value = f.value / C.value * T.value);
447
+ cancelAnimationFrame(g), g = requestAnimationFrame(U);
445
448
  }
446
- function k(b) {
447
- let g = "addEventListener";
448
- b === "add" ? g = "addEventListener" : g = "removeEventListener", l.value?.[g]("pointerdown", $, {
449
+ function U() {
450
+ t.value && (v.value = r.scrollTop?.value ?? t.value.scrollTop, i.value = v.value / $.value * I.value);
451
+ }
452
+ function K(m) {
453
+ let O = "addEventListener";
454
+ m === "add" ? O = "addEventListener" : O = "removeEventListener", l.value?.[O]("pointerdown", D, {
449
455
  passive: !0
450
- }), window[g]("pointermove", N, { passive: !0 }), window[g]("pointerup", F, { passive: !0 });
456
+ }), window[O]("pointermove", V, { passive: !0 }), window[O]("pointerup", N, { passive: !0 });
451
457
  }
452
- const U = new MutationObserver((b) => {
453
- b.map((w) => w.oldValue).join().includes("height") && V();
458
+ const q = new MutationObserver((m) => {
459
+ m.map((He) => He.oldValue).join().includes("height") && a();
454
460
  });
455
- function V() {
456
- s.value.top = t.value?.getBoundingClientRect().top ?? 0, s.value.scrollHeight = t.value?.scrollHeight ?? 0, s.value.clientHeight = t.value?.clientHeight ?? 0;
461
+ function a() {
462
+ u.value.top = t.value?.getBoundingClientRect().top ?? 0, u.value.scrollHeight = t.value?.scrollHeight ?? 0, u.value.clientHeight = t.value?.clientHeight ?? 0;
457
463
  }
458
- function i() {
459
- B(), setTimeout(() => {
460
- m.value.clientHeight = l.value?.clientHeight ?? 0, L();
464
+ function c() {
465
+ C(), setTimeout(() => {
466
+ H.value.clientHeight = l.value?.clientHeight ?? 0, k();
461
467
  }, 150);
462
468
  }
463
- function c() {
464
- t.value && l.value ? (t.value.addEventListener("scroll", D, {
469
+ function S() {
470
+ document.styleSheets[0].insertRule(
471
+ ".hide-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }",
472
+ 0
473
+ ), document.styleSheets[0].insertRule(
474
+ ".hide-scrollbar::-webkit-scrollbar{ display: none }",
475
+ 0
476
+ ), t.value?.classList.add("hide-scrollbar");
477
+ }
478
+ function y() {
479
+ t.value && l.value ? (S(), t.value.addEventListener("scroll", Q, {
465
480
  passive: !0
466
- }), k("add"), U.observe(t.value, {
481
+ }), K("add"), q.observe(t.value, {
467
482
  subtree: !0,
468
483
  attributeOldValue: !0,
469
484
  attributeFilter: ["style"]
470
485
  }), setTimeout(() => {
471
- V();
472
- }, 100), i()) : console.error("useScrollBar:", "\u521D\u59CB\u5316\u5931\u8D25!", { containerEl: t, sliderEl: l });
486
+ a();
487
+ }, 100), c()) : console.error("useScrollBar:", "\u521D\u59CB\u5316\u5931\u8D25!", { containerEl: t, sliderEl: l });
473
488
  }
474
- return R(f, () => {
475
- B(), o();
489
+ return P(v, () => {
490
+ C(), d();
476
491
  }), {
477
- isScrollEnd: a,
478
- isDragSlider: E,
479
- scrollable: y,
480
- sliderPos: M,
481
- init: c,
482
- modifySliderEventListener: k
492
+ isScrollEnd: o,
493
+ isDragSlider: b,
494
+ scrollable: z,
495
+ sliderPos: L,
496
+ init: y,
497
+ modifySliderEventListener: K
483
498
  };
484
499
  }
485
- const ct = (e) => (Le("data-v-e4f66100"), e = e(), De(), e), dt = /* @__PURE__ */ ct(() => /* @__PURE__ */ I("div", { class: "default-slider" }, null, -1)), vt = /* @__PURE__ */ K({
500
+ const vt = (e) => (ke("data-v-e4f66100"), e = e(), Ve(), e), ft = /* @__PURE__ */ vt(() => /* @__PURE__ */ R("div", { class: "default-slider" }, null, -1)), pt = /* @__PURE__ */ j({
486
501
  __name: "ScrollBar",
487
502
  props: {
488
503
  containerEl: null,
@@ -491,31 +506,31 @@ const ct = (e) => (Le("data-v-e4f66100"), e = e(), De(), e), dt = /* @__PURE__ *
491
506
  performance: null
492
507
  },
493
508
  setup(e, { expose: t }) {
494
- const l = e, n = !!Ae().default, r = _(null), a = p(() => l.containerEl), o = ut({
495
- containerEl: a,
509
+ const l = e, n = !!Fe().default, r = _(null), s = h(() => l.containerEl), o = dt({
510
+ containerEl: s,
496
511
  sliderEl: r,
497
512
  autoHeight: n ? l.autoHeight : !0,
498
513
  performance: l.performance
499
- }), { scrollable: u, isScrollEnd: h, sliderPos: f } = o, d = l.autoHide ? p(() => !h.value) : p(() => u.value);
500
- return X(() => {
501
- ie(() => {
514
+ }), { scrollable: d, isScrollEnd: g, sliderPos: f } = o, v = l.autoHide ? h(() => !g.value) : h(() => d.value);
515
+ return Z(() => {
516
+ ue(() => {
502
517
  o.init();
503
518
  });
504
- }), ue(() => {
519
+ }), ce(() => {
505
520
  o.modifySliderEventListener("remove");
506
- }), t({ uScrollBarReturn: o }), (v, s) => (H(), ce(de, null, {
507
- default: ve(() => [
508
- $e(I("div", {
521
+ }), t({ uScrollBarReturn: o }), (p, i) => (T(), de(ve, null, {
522
+ default: fe(() => [
523
+ Le(R("div", {
509
524
  ref_key: "sliderRef",
510
525
  ref: r,
511
526
  class: "slider-wrapper",
512
- style: ee(S(f))
527
+ style: te(w(f))
513
528
  }, [
514
- Z(v.$slots, "default", {}, () => [
515
- dt
529
+ ee(p.$slots, "default", {}, () => [
530
+ ft
516
531
  ], !0)
517
532
  ], 4), [
518
- [Fe, S(d)]
533
+ [De, w(v)]
519
534
  ])
520
535
  ]),
521
536
  _: 3
@@ -527,10 +542,10 @@ const Ee = (e, t) => {
527
542
  for (const [n, r] of t)
528
543
  l[n] = r;
529
544
  return l;
530
- }, wt = /* @__PURE__ */ Ee(vt, [["__scopeId", "data-v-e4f66100"]]), ft = { class: "virtualListWrapper" }, pt = {
545
+ }, Ot = /* @__PURE__ */ Ee(pt, [["__scopeId", "data-v-e4f66100"]]), ht = { class: "virtualListWrapper" }, gt = {
531
546
  inheritAttrs: !1
532
- }, ht = /* @__PURE__ */ K({
533
- ...pt,
547
+ }, mt = /* @__PURE__ */ j({
548
+ ...gt,
534
549
  __name: "VirtualList",
535
550
  props: {
536
551
  data: null,
@@ -539,33 +554,33 @@ const Ee = (e, t) => {
539
554
  },
540
555
  emits: ["scrollEnd"],
541
556
  setup(e, { expose: t, emit: l }) {
542
- const n = e, r = rt(ke(n, "data"), {
543
- itemHeight: (d) => n.itemHeight(n.data[d]),
557
+ const n = e, r = st(Ke(n, "data"), {
558
+ itemHeight: (v) => n.itemHeight(n.data[v]),
544
559
  overscan: n.overscan,
545
560
  scrollEndHook: () => {
546
561
  l("scrollEnd");
547
562
  }
548
- }), { list: a, containerProps: o, wrapperProps: u, innerProps: h, getItemHeightData: f } = r;
563
+ }), { list: s, containerProps: o, wrapperProps: d, innerProps: g, getItemHeightData: f } = r;
549
564
  return t({
550
565
  vListReturn: r
551
- }), (d, v) => (H(), P("div", ft, [
552
- I("div", Ve({
553
- onScrollPassive: v[0] || (v[0] = (...s) => S(o).onScroll && S(o).onScroll(...s)),
554
- ref: S(o).ref,
566
+ }), (v, p) => (T(), B("div", ht, [
567
+ R("div", je({
568
+ onScrollPassive: p[0] || (p[0] = (...i) => w(o).onScroll && w(o).onScroll(...i)),
569
+ ref: w(o).ref,
555
570
  class: "virtualList"
556
- }, d.$attrs), [
557
- I("div", te(le(S(u))), [
558
- I("div", te(le(S(h))), [
559
- (H(!0), P(Ke, null, je(S(a), ({ index: s, data: m }) => (H(), P("div", {
560
- key: s,
561
- style: ee({
562
- height: `${S(f)(s).height}px`,
571
+ }, v.$attrs), [
572
+ R("div", le(ne(w(d))), [
573
+ R("div", le(ne(w(g))), [
574
+ (T(!0), B(ze, null, Me(w(s), ({ index: i, data: u }) => (T(), B("div", {
575
+ key: i,
576
+ style: te({
577
+ height: `${w(f)(i).height}px`,
563
578
  display: "flex"
564
579
  })
565
580
  }, [
566
- Z(d.$slots, "default", {
567
- data: m,
568
- index: s
581
+ ee(v.$slots, "default", {
582
+ data: u,
583
+ index: i
569
584
  }, void 0, !0)
570
585
  ], 4))), 128))
571
586
  ], 16)
@@ -574,23 +589,23 @@ const Ee = (e, t) => {
574
589
  ]));
575
590
  }
576
591
  });
577
- const St = /* @__PURE__ */ Ee(ht, [["__scopeId", "data-v-b228d073"]]);
592
+ const xt = /* @__PURE__ */ Ee(mt, [["__scopeId", "data-v-d54bbd42"]]);
578
593
  export {
579
- wt as ScrollBar,
580
- yt as SvgIcon,
581
- St as VirtualList,
582
- be as allSelectedKey,
583
- at as closeDialogKey,
584
- _t as dialogController,
585
- Se as isAllSelectedKey,
586
- me as isSelectedKey,
587
- ye as selectAllKey,
588
- _e as selectKey,
589
- he as toggleAllKey,
590
- ge as toggleKey,
591
- Oe as unselectAllKey,
592
- we as unselectKey,
593
- bt as useSelectable,
594
- mt as useSelectableInjectors,
595
- rt as useVirtualList
594
+ Ot as ScrollBar,
595
+ St as SvgIcon,
596
+ xt as VirtualList,
597
+ _e as allSelectedKey,
598
+ it as closeDialogKey,
599
+ wt as dialogController,
600
+ Oe as isAllSelectedKey,
601
+ be as isSelectedKey,
602
+ we as selectAllKey,
603
+ ye as selectKey,
604
+ ge as toggleAllKey,
605
+ me as toggleKey,
606
+ xe as unselectAllKey,
607
+ Se as unselectKey,
608
+ yt as useSelectable,
609
+ _t as useSelectableInjectors,
610
+ st as useVirtualList
596
611
  };
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 X;const E=typeof window<"u";E&&((X=window?.navigator)==null?void 0:X.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function A(t){return typeof t=="function"?t():e.unref(t)}function se(t,l){function n(...o){t(()=>l.apply(this,o),{fn:l,thisArg:this,args:o})}return n}function ce(t,l={}){let n,o;return a=>{const r=A(t),u=A(l.maxWait);if(n&&clearTimeout(n),r<=0||u!==void 0&&u<=0)return o&&(clearTimeout(o),o=null),a();u&&!o&&(o=setTimeout(()=>{n&&clearTimeout(n),o=null,a()},u)),n=setTimeout(()=>{o&&clearTimeout(o),o=null,a()},r)}}function ue(t){return t}function de(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function Z(t,l=200,n={}){return se(ce(l,n),t)}function fe(t,l=!0){e.getCurrentInstance()?e.onMounted(t):l?t():e.nextTick(t)}function ee(t){var l;const n=A(t);return(l=n?.$el)!=null?l:n}const pe=E?window:void 0;E&&window.document,E&&window.navigator,E&&window.location;function he(t,l=!1){const n=e.ref(),o=()=>n.value=Boolean(t());return o(),fe(o,l),n}const k=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},j="__vueuse_ssr_handlers__";k[j]=k[j]||{},k[j];var te=Object.getOwnPropertySymbols,me=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable,ve=(t,l)=>{var n={};for(var o in t)me.call(t,o)&&l.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&te)for(var o of te(t))l.indexOf(o)<0&&ge.call(t,o)&&(n[o]=t[o]);return n};function ye(t,l,n={}){const o=n,{window:i=pe}=o,a=ve(o,["window"]);let r;const u=he(()=>i&&"ResizeObserver"in i),g=()=>{r&&(r.disconnect(),r=void 0)},m=e.watch(()=>ee(t),p=>{g(),u.value&&i&&p&&(r=new ResizeObserver(l),r.observe(p,a))},{immediate:!0,flush:"post"}),f=()=>{g(),m()};return de(f),{isSupported:u,stop:f}}function be(t,l={width:0,height:0},n={}){const{box:o="content-box"}=n,i=e.ref(l.width),a=e.ref(l.height);return ye(t,([r])=>{const u=o==="border-box"?r.borderBoxSize:o==="content-box"?r.contentBoxSize:r.devicePixelContentBoxSize;u?(i.value=u.reduce((g,{inlineSize:m})=>g+m,0),a.value=u.reduce((g,{blockSize:m})=>g+m,0)):(i.value=r.contentRect.width,a.value=r.contentRect.height)},n),e.watch(()=>ee(t),r=>{i.value=r?l.width:0,a.value=r?l.height:0}),{width:i,height:a}}var le;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(le||(le={}));var _e=Object.defineProperty,ne=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable,oe=(t,l,n)=>l in t?_e(t,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[l]=n,Oe=(t,l)=>{for(var n in l||(l={}))Se.call(l,n)&&oe(t,n,l[n]);if(ne)for(var n of ne(l))we.call(l,n)&&oe(t,n,l[n]);return t};Oe({linear:ue},{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 re(t,l){const{scrollEndHook:n,itemHeight:o,overscan:i=5}=l,a=e.ref(),r=be(a),u=e.ref(!0),g=Z(W,100);let m;const f=e.shallowRef(t),p=e.ref(0),s=e.ref({start:0,end:10});let y=0;const w=e.ref([]),_=e.computed(()=>{let{sum:c,height:d}={sum:0,height:0};return f.value.map((b,v)=>(typeof o=="number"?d=o:d=o(v),c+=d,{height:d,sum:c}))}),O=e.computed(()=>q(s.value.start)),I=e.computed(()=>typeof o=="number"?_.value.length*o:_.value[_.value.length-1]?.sum||0),Q=e.computed(()=>{let c=w.value.length-i,d=Math.max(c-y,0);return w.value.slice(d,c)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(m)),e.watch([r.width,r.height,f],([c,d])=>{(c||d)&&H()},{deep:!0}),e.watch(p,()=>{U(),g()});function U(){u.value=!1}function W(){u.value=!0,n?.()}function H(){cancelAnimationFrame(m),m=requestAnimationFrame(T)}function T(){if(a.value){p.value=a.value.scrollTop,y=C();let c=B(p.value),d=c+y+i;c=c-i,c=c<0?0:c,d=d>f.value.length?f.value.length:d,s.value={start:c,end:d},w.value=f.value.slice(c,d).map((b,v)=>({data:b,index:v+c}))}}function B(c){let d=Math.floor(_.value.length/16),b=-1,v=-1;for(let S=0;S<16;S++){if(_.value[d*S].sum>=c){b=Math.max(0,S-1);break}S===15&&(b=S)}b*=d;for(let S=b;S<_.value.length;S++)if(_.value[S].sum>=c){v=S;break}return Math.max(0,v)}function C(){let c=0,d=0,b=Y();for(let v=b;v<_.value.length&&(c++,d+=_.value[v].height,!(d>=r.height.value));v++);return c}function q(c){if(typeof o=="number")return c*o;let d=_.value[c];return d.sum-d.height}function P(c){return _.value[c]||{sum:0,height:0}}function Y(){let c=s.value.start;return c>=i&&(c+=i),c}function G(c){if(a.value){const d=P(c);a.value.scrollTop=d.sum-d.height,T()}}const R=e.computed(()=>({style:{width:"100%",height:`${I.value}px`,pointerEvents:u.value?void 0:"none"}})),J=e.computed(()=>({style:{transform:`translate3d(0, ${O.value}px, 0)`,"will-change":"transform"}})),x={overflowY:"auto"};return{list:w,visiableList:Q,getItemHeightData:P,totalHeight:I,clientHeight:r.height,scrollTo:G,scrollTop:p,isScrollEnd:u,containerProps:{ref:a,onScroll:()=>{H()},style:x},wrapperProps:R,innerProps:J}}const K=Symbol(),L=Symbol(),V=Symbol(),$=Symbol(),F=Symbol(),D=Symbol(),N=Symbol(),M=Symbol(),z=Symbol();function Ee(){const{voidFn:t,boolFn:l,boolRef:n,arrayRef:o}={voidFn:y=>{},boolFn:y=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},i=e.inject($,o),a=e.inject(V,l),r=e.inject(M,n),u=e.inject(L,t),g=e.inject(K,t),m=e.inject(F,t),f=e.inject(D,t),p=e.inject(N,t),s=e.inject(z,t);return{selected:i,isSelected:a,isAllSelected:r,toggle:u,toggleAll:g,select:m,selectAll:f,unselect:p,unselectAll:s}}function Ie(t,l){const n=e.ref({}),o=e.computed(()=>t.value.filter(s=>n.value[s[l]])),i=e.computed(()=>o.value.length!=0&&Object.keys(n.value).length==t.value.length);function a(){t.value.forEach(s=>{n.value[s[l]]=!0})}function r(){n.value={}}function u(s){s.forEach(y=>{n.value[y[l]]||(n.value[y[l]]=!0)})}function g(s){s.forEach(y=>{n.value[y[l]]&&delete n.value[y[l]]})}function m(s){return!!n.value[s[l]]}function f(s){s.forEach(y=>{m(y)?delete n.value[y[l]]:n.value[y[l]]=!0})}function p(){i.value?r():a()}return e.provide(K,p),e.provide(L,f),e.provide(V,m),e.provide($,o),e.provide(F,u),e.provide(D,a),e.provide(N,g),e.provide(M,i),e.provide(z,r),{selected:o,select:u,selectAll:a,unselect:g,unselectAll:r,toggle:f,toggleAll:p,isSelected:m,isAllSelected:i}}const ie=Symbol(),Be=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0},dialogClass:{default:""}},emits:["update:visiable"],setup(t,{emit:l}){const n=t,o=()=>{n.closeOnClickOverlay&&l("update:visiable",!1)};return e.provide(ie,()=>l("update:visiable",!1)),(i,a)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[t.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:o,class:"modal absolute inset-0 bottom-0 z-50 flex bg-stone-900 bg-opacity-50"},[e.createElementVNode("div",{onClick:a[0]||(a[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog m-auto flex flex-col",t.dialogClass])},[e.renderSlot(i.$slots,"default")],2)])):e.createCommentVNode("",!0)]),_:3}))}});function He(t){function l(n,o){const i=document.createElement("div"),a={setup(){return()=>e.h(Be,{visiable:!0,"onUpdate:visiable":()=>{i?.remove()},...t},{default:()=>e.h(n,o)})}};return document.body.appendChild(i),e.render(e.h(a),i),{close:()=>i?.remove()}}return{create:l}}const Te=["xlink:href","fill","color"],Ce=e.defineComponent({__name:"SvgIcon",props:{name:null,prefix:{default:"icon"},color:{default:"#FFF"},width:null,height:null},setup(t){const l=t,n=e.computed(()=>`#${l.prefix}-${l.name}`),o=e.computed(()=>({width:l.width,height:l.height,aspectRatio:l.width&&l.height?void 0:"1/1"}));return(i,a)=>(e.openBlock(),e.createElementBlock("svg",{"aria-hidden":"",style:e.normalizeStyle(e.unref(o))},[e.createElementVNode("use",{"xlink:href":e.unref(n),fill:t.color,color:t.color},null,8,Te)],4))}});function Pe(t){const{containerEl:l,sliderEl:n,autoHeight:o,performance:i={}}=t,a=e.ref(!0),r=Z(C,100);let u,g="";const m=e.ref(0),f=e.ref(0),p=e.ref(0),s=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),y=e.ref({clientHeight:0}),w=e.computed(()=>!!f.value),_=e.computed(()=>s.value.scrollHeight>s.value.clientHeight),O=e.computed(()=>s.value.clientHeight-y.value.clientHeight),I=e.computed(()=>s.value.scrollHeight-s.value.clientHeight),Q=e.computed(()=>Math.max(s.value.clientHeight/s.value.scrollHeight,.05)),U=e.computed(()=>Q.value*s.value.clientHeight),W=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${p.value}px,0)`,height:o?`${U.value}px`:void 0}));function H(b){B(),f.value=b.clientY-n.value.getBoundingClientRect().top||1,g=getComputedStyle(l.value).scrollBehavior,g==="smooth"&&(l.value.style.scrollBehavior="unset")}function T(){l.value.style.scrollBehavior=g,f.value=0,r()}function B(){a.value=!1}function C(){w.value||(a.value=!0)}function q(b){if(!w.value)return;let v=b.clientY-s.value.top-f.value;v<0?p.value=0:v>=O.value?p.value=O.value:p.value=v,l.value.scrollTo({top:p.value/O.value*I.value})}function P(){w.value||Y()}function Y(){cancelAnimationFrame(u),u=requestAnimationFrame(G)}function G(){l.value&&(m.value=i.scrollTop?.value??l.value.scrollTop,p.value=m.value/I.value*O.value)}function R(b){let v="addEventListener";b==="add"?v="addEventListener":v="removeEventListener",n.value?.[v]("pointerdown",H,{passive:!0}),window[v]("pointermove",q,{passive:!0}),window[v]("pointerup",T,{passive:!0})}const J=new MutationObserver(b=>{b.map(S=>S.oldValue).join().includes("height")&&x()});function x(){s.value.top=l.value?.getBoundingClientRect().top??0,s.value.scrollHeight=l.value?.scrollHeight??0,s.value.clientHeight=l.value?.clientHeight??0}function c(){B(),setTimeout(()=>{y.value.clientHeight=n.value?.clientHeight??0,C()},150)}function d(){l.value&&n.value?(l.value.addEventListener("scroll",P,{passive:!0}),R("add"),J.observe(l.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{x()},100),c()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:l,sliderEl:n})}return e.watch(m,()=>{B(),r()}),{isScrollEnd:a,isDragSlider:w,scrollable:_,sliderPos:W,init:d,modifySliderEventListener:R}}const Re=(t=>(e.pushScopeId("data-v-e4f66100"),t=t(),e.popScopeId(),t))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),xe=e.defineComponent({__name:"ScrollBar",props:{containerEl:null,autoHide:{type:Boolean},autoHeight:{type:Boolean},performance:null},setup(t,{expose:l}){const n=t,o=!!e.useSlots().default,i=e.ref(null),a=e.computed(()=>n.containerEl),r=Pe({containerEl:a,sliderEl:i,autoHeight:o?n.autoHeight:!0,performance:n.performance}),{scrollable:u,isScrollEnd:g,sliderPos:m}=r,f=n.autoHide?e.computed(()=>!g.value):e.computed(()=>u.value);return e.onMounted(()=>{e.nextTick(()=>{r.init()})}),e.onUnmounted(()=>{r.modifySliderEventListener("remove")}),l({uScrollBarReturn:r}),(p,s)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"sliderRef",ref:i,class:"slider-wrapper",style:e.normalizeStyle(e.unref(m))},[e.renderSlot(p.$slots,"default",{},()=>[Re],!0)],4),[[e.vShow,e.unref(f)]])]),_:3}))}}),Fe="",ae=(t,l)=>{const n=t.__vccOpts||t;for(const[o,i]of l)n[o]=i;return n},Ae=ae(xe,[["__scopeId","data-v-e4f66100"]]),ke={class:"virtualListWrapper"},je={inheritAttrs:!1},Ke=e.defineComponent({...je,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},emits:["scrollEnd"],setup(t,{expose:l,emit:n}){const o=t,i=re(e.toRef(o,"data"),{itemHeight:f=>o.itemHeight(o.data[f]),overscan:o.overscan,scrollEndHook:()=>{n("scrollEnd")}}),{list:a,containerProps:r,wrapperProps:u,innerProps:g,getItemHeightData:m}=i;return l({vListReturn:i}),(f,p)=>(e.openBlock(),e.createElementBlock("div",ke,[e.createElementVNode("div",e.mergeProps({onScrollPassive:p[0]||(p[0]=(...s)=>e.unref(r).onScroll&&e.unref(r).onScroll(...s)),ref:e.unref(r).ref,class:"virtualList"},f.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(u))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(g))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a),({index:s,data:y})=>(e.openBlock(),e.createElementBlock("div",{key:s,style:e.normalizeStyle({height:`${e.unref(m)(s).height}px`,display:"flex"})},[e.renderSlot(f.$slots,"default",{data:y,index:s},void 0,!0)],4))),128))],16)],16)],16)]))}}),De="",Le=ae(Ke,[["__scopeId","data-v-b228d073"]]);h.ScrollBar=Ae,h.SvgIcon=Ce,h.VirtualList=Le,h.allSelectedKey=$,h.closeDialogKey=ie,h.dialogController=He,h.isAllSelectedKey=M,h.isSelectedKey=V,h.selectAllKey=D,h.selectKey=F,h.toggleAllKey=K,h.toggleKey=L,h.unselectAllKey=z,h.unselectKey=N,h.useSelectable=Ie,h.useSelectableInjectors=Ee,h.useVirtualList=re,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 B=typeof window<"u";B&&((Z=window?.navigator)==null?void 0:Z.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function A(t){return typeof t=="function"?t():e.unref(t)}function ce(t,l){function n(...o){t(()=>l.apply(this,o),{fn:l,thisArg:this,args:o})}return n}function ue(t,l={}){let n,o;return s=>{const r=A(t),f=A(l.maxWait);if(n&&clearTimeout(n),r<=0||f!==void 0&&f<=0)return o&&(clearTimeout(o),o=null),s();f&&!o&&(o=setTimeout(()=>{n&&clearTimeout(n),o=null,s()},f)),n=setTimeout(()=>{o&&clearTimeout(o),o=null,s()},r)}}function de(t){return t}function fe(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function ee(t,l=200,n={}){return ce(ue(l,n),t)}function pe(t,l=!0){e.getCurrentInstance()?e.onMounted(t):l?t():e.nextTick(t)}function te(t){var l;const n=A(t);return(l=n?.$el)!=null?l:n}const he=B?window:void 0;B&&window.document,B&&window.navigator,B&&window.location;function me(t,l=!1){const n=e.ref(),o=()=>n.value=Boolean(t());return o(),pe(o,l),n}const L=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},j="__vueuse_ssr_handlers__";L[j]=L[j]||{},L[j];var le=Object.getOwnPropertySymbols,ge=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable,be=(t,l)=>{var n={};for(var o in t)ge.call(t,o)&&l.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&le)for(var o of le(t))l.indexOf(o)<0&&ve.call(t,o)&&(n[o]=t[o]);return n};function ye(t,l,n={}){const o=n,{window:i=he}=o,s=be(o,["window"]);let r;const f=me(()=>i&&"ResizeObserver"in i),v=()=>{r&&(r.disconnect(),r=void 0)},m=e.watch(()=>te(t),g=>{v(),f.value&&i&&g&&(r=new ResizeObserver(l),r.observe(g,s))},{immediate:!0,flush:"post"}),p=()=>{v(),m()};return fe(p),{isSupported:f,stop:p}}function _e(t,l={width:0,height:0},n={}){const{box:o="content-box"}=n,i=e.ref(l.width),s=e.ref(l.height);return ye(t,([r])=>{const f=o==="border-box"?r.borderBoxSize:o==="content-box"?r.contentBoxSize:r.devicePixelContentBoxSize;f?(i.value=f.reduce((v,{inlineSize:m})=>v+m,0),s.value=f.reduce((v,{blockSize:m})=>v+m,0)):(i.value=r.contentRect.width,s.value=r.contentRect.height)},n),e.watch(()=>te(t),r=>{i.value=r?l.width:0,s.value=r?l.height:0}),{width:i,height:s}}var ne;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(ne||(ne={}));var Se=Object.defineProperty,oe=Object.getOwnPropertySymbols,we=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,re=(t,l,n)=>l in t?Se(t,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[l]=n,Ee=(t,l)=>{for(var n in l||(l={}))we.call(l,n)&&re(t,n,l[n]);if(oe)for(var n of oe(l))Oe.call(l,n)&&re(t,n,l[n]);return t};Ee({linear:de},{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(t,l){const{scrollEndHook:n,itemHeight:o,overscan:i=5}=l,s=e.ref(),r=_e(s),f=e.ref(!0),v=ee(W,100);let m;const p=e.shallowRef(t),g=e.ref(0),c=e.ref({start:0,end:10});let u=0;const O=e.ref([]),y=e.computed(()=>{let{sum:a,height:d}={sum:0,height:0};return p.value.map((S,_)=>(typeof o=="number"?d=o:d=o(_),a+=d,{height:d,sum:a}))}),U=e.computed(()=>R(c.value.start)),E=e.computed(()=>typeof o=="number"?y.value.length*o:y.value[y.value.length-1]?.sum||0),H=e.computed(()=>{let a=O.value.length-i,d=Math.max(a-u,0);return O.value.slice(d,a)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(m)),e.watch([r.width,r.height,p],([a,d])=>{(a||d)&&C()},{deep:!0}),e.watch(g,()=>{T(),v()});function T(){f.value=!1}function W(){f.value=!0,n?.()}function C(){cancelAnimationFrame(m),m=requestAnimationFrame(P)}function P(){if(s.value){g.value=s.value.scrollTop,u=I();let a=q(g.value),d=a+u+i;a=a-i,a=a<0?0:a,d=d>p.value.length?p.value.length:d,c.value={start:a,end:d},O.value=p.value.slice(a,d).map((S,_)=>({data:S,index:_+a}))}}function q(a){let d=Math.floor(y.value.length/16),S=-1,_=-1;for(let b=0;b<16;b++){if(y.value[d*b].sum>=a){S=Math.max(0,b-1);break}b===15&&(S=b)}S*=d;for(let b=S;b<y.value.length;b++)if(y.value[b].sum>=a){_=b;break}return Math.max(0,_)}function I(){let a=0,d=0,S=Y();for(let _=S;_<y.value.length&&(a++,d+=y.value[_].height,!(d>=r.height.value));_++);return a}function R(a){if(typeof o=="number")return a*o;let d=y.value[a];return d?d.sum-d.height:0}function x(a){return y.value[a]||{sum:0,height:0}}function Y(){let a=c.value.start;return a>=i&&(a+=i),a}function G(a){if(s.value){const d=x(a);s.value.scrollTop=d.sum-d.height,P()}}const J=e.computed(()=>({style:{width:"100%",height:`${E.value}px`,pointerEvents:f.value?void 0:"none"}})),k=e.computed(()=>({style:{transform:`translate3d(0, ${U.value}px, 0)`,"will-change":"transform"}})),X={overflowY:"auto"};return{list:O,visiableList:H,getItemHeightData:x,totalHeight:E,clientHeight:r.height,scrollTo:G,scrollTop:g,isScrollEnd:f,containerProps:{ref:s,onScroll:()=>{C()},style:X},wrapperProps:J,innerProps:k}}const K=Symbol(),V=Symbol(),$=Symbol(),F=Symbol(),D=Symbol(),N=Symbol(),M=Symbol(),z=Symbol(),Q=Symbol();function Be(){const{voidFn:t,boolFn:l,boolRef:n,arrayRef:o}={voidFn:u=>{},boolFn:u=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},i=e.inject(F,o),s=e.inject($,l),r=e.inject(z,n),f=e.inject(V,t),v=e.inject(K,t),m=e.inject(D,t),p=e.inject(N,t),g=e.inject(M,t),c=e.inject(Q,t);return{selected:i,isSelected:s,isAllSelected:r,toggle:f,toggleAll:v,select:m,selectAll:p,unselect:g,unselectAll:c}}function Ie(t,l){const n=e.ref({}),o=e.computed(()=>t.value.filter(c=>n.value[c[l]])),i=e.computed(()=>o.value.length!=0&&Object.keys(n.value).length==t.value.length);function s(){t.value.forEach(c=>{n.value[c[l]]=!0})}function r(){n.value={}}function f(c){c.forEach(u=>{n.value[u[l]]||(n.value[u[l]]=!0)})}function v(c){c.forEach(u=>{n.value[u[l]]&&delete n.value[u[l]]})}function m(c){return!!n.value[c[l]]}function p(c){c.forEach(u=>{m(u)?delete n.value[u[l]]:n.value[u[l]]=!0})}function g(){i.value?r():s()}return e.provide(K,g),e.provide(V,p),e.provide($,m),e.provide(F,o),e.provide(D,f),e.provide(N,s),e.provide(M,v),e.provide(z,i),e.provide(Q,r),{selected:o,select:f,selectAll:s,unselect:v,unselectAll:r,toggle:p,toggleAll:g,isSelected:m,isAllSelected:i}}const ae=Symbol(),He=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0},dialogClass:{default:""}},emits:["update:visiable"],setup(t,{emit:l}){const n=t,o=()=>{n.closeOnClickOverlay&&l("update:visiable",!1)};return e.provide(ae,()=>l("update:visiable",!1)),(i,s)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[t.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:o,class:"modal absolute inset-0 bottom-0 z-50 flex bg-stone-900 bg-opacity-50"},[e.createElementVNode("div",{onClick:s[0]||(s[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog m-auto flex flex-col",t.dialogClass])},[e.renderSlot(i.$slots,"default")],2)])):e.createCommentVNode("",!0)]),_:3}))}});function Te(t){function l(n,o){const i=document.createElement("div"),s={setup(){return()=>e.h(He,{visiable:!0,"onUpdate:visiable":()=>{i?.remove()},...t},{default:()=>e.h(n,o)})}};return document.body.appendChild(i),e.render(e.h(s),i),{close:()=>i?.remove()}}return{create:l}}const Ce=["xlink:href","fill","color"],Pe=e.defineComponent({__name:"SvgIcon",props:{name:null,prefix:{default:"icon"},color:{default:"#FFF"},width:null,height:null},setup(t){const l=t,n=e.computed(()=>`#${l.prefix}-${l.name}`),o=e.computed(()=>({width:l.width,height:l.height,aspectRatio:l.width&&l.height?void 0:"1/1"}));return(i,s)=>(e.openBlock(),e.createElementBlock("svg",{"aria-hidden":"",style:e.normalizeStyle(e.unref(o))},[e.createElementVNode("use",{"xlink:href":e.unref(n),fill:t.color,color:t.color},null,8,Ce)],4))}});function Re(t){const{containerEl:l,sliderEl:n,autoHeight:o,performance:i={},maxHeightRatio:s=.9}=t,r=e.ref(!0),f=ee(R,100);let v,m="";const p=e.ref(0),g=e.ref(0),c=e.ref(0),u=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),O=e.ref({clientHeight:0}),y=e.computed(()=>!!g.value),U=e.computed(()=>u.value.scrollHeight>u.value.clientHeight),E=e.computed(()=>u.value.clientHeight-O.value.clientHeight),H=e.computed(()=>u.value.scrollHeight-u.value.clientHeight),T=e.computed(()=>Math.max(u.value.clientHeight/u.value.scrollHeight,.05)),W=e.computed(()=>T.value>s?0:T.value*u.value.clientHeight),C=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${c.value}px,0)`,height:o?`${W.value}px`:void 0}));function P(b){I(),g.value=b.clientY-n.value.getBoundingClientRect().top||1,m=getComputedStyle(l.value).scrollBehavior,m==="smooth"&&(l.value.style.scrollBehavior="unset")}function q(){l.value.style.scrollBehavior=m,g.value=0,f()}function I(){r.value=!1}function R(){y.value||(r.value=!0)}function x(b){if(!y.value)return;let w=b.clientY-u.value.top-g.value;w<0?c.value=0:w>=E.value?c.value=E.value:c.value=w,l.value.scrollTo({top:c.value/E.value*H.value})}function Y(){y.value||G()}function G(){cancelAnimationFrame(v),v=requestAnimationFrame(J)}function J(){l.value&&(p.value=i.scrollTop?.value??l.value.scrollTop,c.value=p.value/H.value*E.value)}function k(b){let w="addEventListener";b==="add"?w="addEventListener":w="removeEventListener",n.value?.[w]("pointerdown",P,{passive:!0}),window[w]("pointermove",x,{passive:!0}),window[w]("pointerup",q,{passive:!0})}const X=new MutationObserver(b=>{b.map($e=>$e.oldValue).join().includes("height")&&a()});function a(){u.value.top=l.value?.getBoundingClientRect().top??0,u.value.scrollHeight=l.value?.scrollHeight??0,u.value.clientHeight=l.value?.clientHeight??0}function d(){I(),setTimeout(()=>{O.value.clientHeight=n.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),l.value?.classList.add("hide-scrollbar")}function _(){l.value&&n.value?(S(),l.value.addEventListener("scroll",Y,{passive:!0}),k("add"),X.observe(l.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{a()},100),d()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:l,sliderEl:n})}return e.watch(p,()=>{I(),f()}),{isScrollEnd:r,isDragSlider:y,scrollable:U,sliderPos:C,init:_,modifySliderEventListener:k}}const xe=(t=>(e.pushScopeId("data-v-e4f66100"),t=t(),e.popScopeId(),t))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),ke=e.defineComponent({__name:"ScrollBar",props:{containerEl:null,autoHide:{type:Boolean},autoHeight:{type:Boolean},performance:null},setup(t,{expose:l}){const n=t,o=!!e.useSlots().default,i=e.ref(null),s=e.computed(()=>n.containerEl),r=Re({containerEl:s,sliderEl:i,autoHeight:o?n.autoHeight:!0,performance:n.performance}),{scrollable:f,isScrollEnd:v,sliderPos:m}=r,p=n.autoHide?e.computed(()=>!v.value):e.computed(()=>f.value);return e.onMounted(()=>{e.nextTick(()=>{r.init()})}),e.onUnmounted(()=>{r.modifySliderEventListener("remove")}),l({uScrollBarReturn:r}),(g,c)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"sliderRef",ref:i,class:"slider-wrapper",style:e.normalizeStyle(e.unref(m))},[e.renderSlot(g.$slots,"default",{},()=>[xe],!0)],4),[[e.vShow,e.unref(p)]])]),_:3}))}}),Ne="",se=(t,l)=>{const n=t.__vccOpts||t;for(const[o,i]of l)n[o]=i;return n},Ae=se(ke,[["__scopeId","data-v-e4f66100"]]),Le={class:"virtualListWrapper"},je={inheritAttrs:!1},Ke=e.defineComponent({...je,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},emits:["scrollEnd"],setup(t,{expose:l,emit:n}){const o=t,i=ie(e.toRef(o,"data"),{itemHeight:p=>o.itemHeight(o.data[p]),overscan:o.overscan,scrollEndHook:()=>{n("scrollEnd")}}),{list:s,containerProps:r,wrapperProps:f,innerProps:v,getItemHeightData:m}=i;return l({vListReturn:i}),(p,g)=>(e.openBlock(),e.createElementBlock("div",Le,[e.createElementVNode("div",e.mergeProps({onScrollPassive:g[0]||(g[0]=(...c)=>e.unref(r).onScroll&&e.unref(r).onScroll(...c)),ref:e.unref(r).ref,class:"virtualList"},p.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(f))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(v))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),({index:c,data:u})=>(e.openBlock(),e.createElementBlock("div",{key:c,style:e.normalizeStyle({height:`${e.unref(m)(c).height}px`,display:"flex"})},[e.renderSlot(p.$slots,"default",{data:u,index:c},void 0,!0)],4))),128))],16)],16)],16)]))}}),Me="",Ve=se(Ke,[["__scopeId","data-v-d54bbd42"]]);h.ScrollBar=Ae,h.SvgIcon=Pe,h.VirtualList=Ve,h.allSelectedKey=F,h.closeDialogKey=ae,h.dialogController=Te,h.isAllSelectedKey=z,h.isSelectedKey=$,h.selectAllKey=N,h.selectKey=D,h.toggleAllKey=K,h.toggleKey=V,h.unselectAllKey=Q,h.unselectKey=M,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
- .v-leave-active[data-v-e4f66100]{transition:all .15s ease-out;transition-delay:.9s}.v-leave-to[data-v-e4f66100]{opacity:0}.slider-wrapper[data-v-e4f66100]{z-index:100;position:absolute;right:0;touch-action:none}.default-slider[data-v-e4f66100]{width:6px;height:100%;background-color:#0003;border-radius:3px;margin-right:3px}.virtualListWrapper[data-v-b228d073]{width:100%;height:100%;position:relative}.virtualList[data-v-b228d073] ::-webkit-scrollbar{display:none}.virtualList[data-v-b228d073]{width:100%;height:100%;position:absolute;overflow-y:auto;scroll-behavior:smooth;user-select:none}.virtualList[data-v-b228d073]::-webkit-scrollbar{display:none}
1
+ .v-leave-active[data-v-e4f66100]{transition:all .15s ease-out;transition-delay:.9s}.v-leave-to[data-v-e4f66100]{opacity:0}.slider-wrapper[data-v-e4f66100]{z-index:100;position:absolute;right:0;touch-action:none}.default-slider[data-v-e4f66100]{width:6px;height:100%;background-color:#0003;border-radius:3px;margin-right:3px}.virtualListWrapper[data-v-d54bbd42]{width:100%;height:100%;position:relative}.virtualList[data-v-d54bbd42]{width:100%;height:100%;position:absolute;overflow-y:auto;scroll-behavior:smooth;user-select:none}
@@ -6,4 +6,5 @@ export declare type ScrollBarOptions = {
6
6
  performance?: {
7
7
  scrollTop?: Ref<number>;
8
8
  };
9
+ maxHeightRatio?: number;
9
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazycatcloud/lzc-toolkit",
3
- "version": "0.0.27",
3
+ "version": "0.0.29",
4
4
  "description": "lazycat ui toolkits",
5
5
  "main": "./dist/index.umd.js",
6
6
  "module": "./dist/index.es.js",