@lazycatcloud/lzc-toolkit 0.0.24 → 0.0.26

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