@lazycatcloud/lzc-toolkit 0.0.25 → 0.0.27

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 re, ref as b, watch as R, shallowRef as Ee, computed as p, onUnmounted as ae, 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 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;
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;
14
+ function Me(e, t = {}) {
15
+ let l, n;
16
16
  return (a) => {
17
- const i = W(e), u = W(l.maxWait);
18
- if (t && clearTimeout(t), i <= 0 || u !== void 0 && u <= 0)
17
+ const o = Y(e), u = Y(t.maxWait);
18
+ if (l && clearTimeout(l), o <= 0 || u !== void 0 && u <= 0)
19
19
  return n && (clearTimeout(n), n = null), a();
20
20
  u && !n && (n = setTimeout(() => {
21
- t && clearTimeout(t), n = null, a();
22
- }, u)), t = setTimeout(() => {
21
+ l && clearTimeout(l), n = null, a();
22
+ }, u)), l = setTimeout(() => {
23
23
  n && clearTimeout(n), n = null, a();
24
- }, i);
24
+ }, o);
25
25
  };
26
26
  }
27
- function Me(e) {
27
+ function Ne(e) {
28
28
  return e;
29
29
  }
30
- function Ne(e) {
30
+ function Qe(e) {
31
31
  return xe() ? (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() : re(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: r = Ue } = n, a = Je(n, ["window"]);
66
- let i;
67
- const u = qe(() => r && "ResizeObserver" in r), f = () => {
68
- i && (i.disconnect(), i = void 0);
69
- }, d = R(() => ce(e), (v) => {
70
- f(), u.value && r && v && (i = new ResizeObserver(l), i.observe(v, a));
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 u = qe(() => r && "ResizeObserver" in r), h = () => {
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();
73
73
  };
74
- return Ne(h), {
74
+ return Qe(d), {
75
75
  isSupported: u,
76
- stop: h
76
+ stop: d
77
77
  };
78
78
  }
79
- function Ze(e, l = { width: 0, height: 0 }, t = {}) {
80
- const { box: n = "content-box" } = t, r = b(l.width), a = 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 ? (r.value = u.reduce((f, { inlineSize: d }) => f + d, 0), a.value = u.reduce((f, { blockSize: d }) => f + d, 0)) : (r.value = i.contentRect.width, a.value = i.contentRect.height);
84
- }, t), R(() => ce(e), (i) => {
85
- r.value = i ? l.width : 0, a.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 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;
86
86
  }), {
87
87
  width: r,
88
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,190 @@ 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 rt(e, l) {
133
- const { itemHeight: t, overscan: n = 5 } = l, r = b(), a = Ze(r);
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[o.value.length - 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), u = _(!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 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);
143
143
  });
144
- Y(() => {
145
- }), ae(() => cancelAnimationFrame(i)), R(
146
- [a.width, a.height, u],
147
- ([s, c]) => {
148
- (s || c) && I();
144
+ X(() => {
145
+ }), ue(() => cancelAnimationFrame(f)), R(
146
+ [o.width, o.height, d],
147
+ ([i, c]) => {
148
+ (i || c) && $();
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
+ u.value = !1;
154
156
  }
155
- function B() {
156
- if (r.value) {
157
- f.value = r.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
157
+ function M() {
158
+ u.value = !0, l?.();
159
+ }
160
+ function $() {
161
+ cancelAnimationFrame(f), f = requestAnimationFrame(F);
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
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[c * m].sum >= s) {
169
- _ = Math.max(0, m - 1);
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);
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 *= c;
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 >= a.height.value)); y++)
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++)
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];
196
+ function N(i) {
197
+ if (typeof n == "number")
198
+ return i * n;
199
+ let c = y.value[i];
192
200
  return c.sum - c.height;
193
201
  }
194
- function F(s) {
195
- return o.value[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) {
202
- if (r.value) {
203
- const c = F(s);
204
- r.value.scrollTop = c.sum - c.height, B();
209
+ function W(i) {
210
+ if (a.value) {
211
+ const c = D(i);
212
+ a.value.scrollTop = c.sum - c.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`,
219
+ pointerEvents: u.value ? void 0 : "none"
211
220
  }
212
- })), M = p(() => ({
221
+ })), U = p(() => ({
213
222
  style: {
214
- transform: `translate3d(0, ${g.value}px, 0)`,
223
+ transform: `translate3d(0, ${T.value}px, 0)`,
215
224
  "will-change": "transform"
216
225
  }
217
- })), N = {
226
+ })), V = {
218
227
  overflowY: "auto"
219
228
  };
220
229
  return {
221
- list: v,
222
- visiableList: D,
223
- getItemHeightData: F,
224
- totalHeight: H,
225
- clientHeight: a.height,
226
- scrollTo: k,
227
- scrollTop: f,
230
+ list: E,
231
+ visiableList: j,
232
+ getItemHeightData: D,
233
+ totalHeight: C,
234
+ clientHeight: o.height,
235
+ scrollTo: W,
236
+ scrollTop: v,
237
+ isScrollEnd: u,
228
238
  containerProps: {
229
- ref: r,
239
+ ref: a,
230
240
  onScroll: () => {
231
- I();
241
+ $();
232
242
  },
233
- style: N
243
+ style: V
234
244
  },
235
- wrapperProps: z,
236
- innerProps: M
245
+ wrapperProps: k,
246
+ innerProps: U
237
247
  };
238
248
  }
239
- const de = Symbol(), ve = Symbol(), fe = Symbol(), pe = Symbol(), he = Symbol(), ge = Symbol(), me = Symbol(), be = Symbol(), _e = Symbol();
249
+ const he = Symbol(), ge = Symbol(), me = Symbol(), be = Symbol(), _e = Symbol(), ye = Symbol(), we = Symbol(), Se = Symbol(), Oe = Symbol();
240
250
  function mt() {
241
- const { voidFn: e, boolFn: l, boolRef: t, arrayRef: n } = {
242
- voidFn: (g) => {
251
+ const { voidFn: e, boolFn: t, boolRef: l, arrayRef: n } = {
252
+ voidFn: (m) => {
243
253
  },
244
- boolFn: (g) => !1,
254
+ boolFn: (m) => !1,
245
255
  boolRef: p(() => !1),
246
256
  arrayRef: p(() => [])
247
- }, r = x(pe, n), a = 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);
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);
248
258
  return {
249
259
  selected: r,
250
260
  isSelected: a,
251
- isAllSelected: i,
261
+ isAllSelected: o,
252
262
  toggle: u,
253
- toggleAll: f,
254
- select: d,
255
- selectAll: h,
263
+ toggleAll: h,
264
+ select: f,
265
+ selectAll: d,
256
266
  unselect: v,
257
- unselectAll: o
267
+ unselectAll: s
258
268
  };
259
269
  }
260
- function bt(e, l) {
261
- const t = b({}), n = p(() => e.value.filter((o) => t.value[o[l]])), r = p(() => n.value.length != 0 && Object.keys(t.value).length == e.value.length);
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);
262
272
  function a() {
263
- e.value.forEach((o) => {
264
- t.value[o[l]] = !0;
273
+ e.value.forEach((s) => {
274
+ l.value[s[t]] = !0;
265
275
  });
266
276
  }
267
- function i() {
268
- t.value = {};
277
+ function o() {
278
+ l.value = {};
269
279
  }
270
- function u(o) {
271
- o.forEach((g) => {
272
- t.value[g[l]] || (t.value[g[l]] = !0);
280
+ function u(s) {
281
+ s.forEach((m) => {
282
+ l.value[m[t]] || (l.value[m[t]] = !0);
273
283
  });
274
284
  }
275
- function f(o) {
276
- o.forEach((g) => {
277
- t.value[g[l]] && delete t.value[g[l]];
285
+ function h(s) {
286
+ s.forEach((m) => {
287
+ l.value[m[t]] && delete l.value[m[t]];
278
288
  });
279
289
  }
280
- function d(o) {
281
- return !!t.value[o[l]];
290
+ function f(s) {
291
+ return !!l.value[s[t]];
282
292
  }
283
- function h(o) {
284
- o.forEach((g) => {
285
- d(g) ? delete t.value[g[l]] : t.value[g[l]] = !0;
293
+ function d(s) {
294
+ s.forEach((m) => {
295
+ f(m) ? delete l.value[m[t]] : l.value[m[t]] = !0;
286
296
  });
287
297
  }
288
298
  function v() {
289
- r.value ? i() : a();
299
+ r.value ? o() : a();
290
300
  }
291
- return O(de, v), O(ve, h), O(fe, d), O(pe, n), O(he, u), O(ge, a), O(me, f), O(be, r), O(_e, i), {
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), {
292
302
  selected: n,
293
303
  select: u,
294
304
  selectAll: a,
295
- unselect: f,
296
- unselectAll: i,
297
- toggle: h,
305
+ unselect: h,
306
+ unselectAll: o,
307
+ toggle: d,
298
308
  toggleAll: v,
299
- isSelected: d,
309
+ isSelected: f,
300
310
  isAllSelected: r
301
311
  };
302
312
  }
303
- const at = Symbol(), it = /* @__PURE__ */ L({
313
+ const at = Symbol(), st = /* @__PURE__ */ K({
304
314
  __name: "Dialog",
305
315
  props: {
306
316
  visiable: { type: Boolean, default: !1 },
@@ -308,36 +318,36 @@ const at = Symbol(), it = /* @__PURE__ */ L({
308
318
  dialogClass: { default: "" }
309
319
  },
310
320
  emits: ["update:visiable"],
311
- setup(e, { emit: l }) {
312
- const t = e, n = () => {
313
- t.closeOnClickOverlay && l("update:visiable", !1);
321
+ setup(e, { emit: t }) {
322
+ const l = e, n = () => {
323
+ l.closeOnClickOverlay && t("update:visiable", !1);
314
324
  };
315
- return O(at, () => l("update:visiable", !1)), (r, a) => (T(), ie(se, { name: "modal" }, {
316
- default: ue(() => [
317
- e.visiable ? (T(), P("div", {
325
+ return O(at, () => t("update:visiable", !1)), (r, a) => (H(), ce(de, { name: "modal" }, {
326
+ default: ve(() => [
327
+ e.visiable ? (H(), P("div", {
318
328
  key: 0,
319
329
  onClick: n,
320
330
  class: "modal absolute inset-0 bottom-0 z-50 flex bg-stone-900 bg-opacity-50"
321
331
  }, [
322
- C("div", {
323
- onClick: a[0] || (a[0] = Te(() => {
332
+ I("div", {
333
+ onClick: a[0] || (a[0] = Ce(() => {
324
334
  }, ["stop"])),
325
- class: Ce(["dialog m-auto flex flex-col", e.dialogClass])
335
+ class: Be(["dialog m-auto flex flex-col", e.dialogClass])
326
336
  }, [
327
- G(r.$slots, "default")
337
+ Z(r.$slots, "default")
328
338
  ], 2)
329
- ])) : Be("", !0)
339
+ ])) : Pe("", !0)
330
340
  ]),
331
341
  _: 3
332
342
  }));
333
343
  }
334
344
  });
335
345
  function _t(e) {
336
- function l(t, n) {
346
+ function t(l, n) {
337
347
  const r = document.createElement("div"), a = {
338
348
  setup() {
339
- return () => Q(
340
- it,
349
+ return () => q(
350
+ st,
341
351
  {
342
352
  visiable: !0,
343
353
  "onUpdate:visiable": () => {
@@ -346,20 +356,20 @@ function _t(e) {
346
356
  ...e
347
357
  },
348
358
  {
349
- default: () => Q(t, n)
359
+ default: () => q(l, n)
350
360
  }
351
361
  );
352
362
  }
353
363
  };
354
- return document.body.appendChild(r), Pe(Q(a), r), {
364
+ return document.body.appendChild(r), Re(q(a), r), {
355
365
  close: () => r?.remove()
356
366
  };
357
367
  }
358
368
  return {
359
- create: l
369
+ create: t
360
370
  };
361
371
  }
362
- const st = ["xlink:href", "fill", "color"], yt = /* @__PURE__ */ L({
372
+ const it = ["xlink:href", "fill", "color"], yt = /* @__PURE__ */ K({
363
373
  __name: "SvgIcon",
364
374
  props: {
365
375
  name: null,
@@ -369,108 +379,110 @@ const st = ["xlink:href", "fill", "color"], yt = /* @__PURE__ */ L({
369
379
  height: null
370
380
  },
371
381
  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"
382
+ const t = e, l = p(() => `#${t.prefix}-${t.name}`), n = p(() => ({
383
+ width: t.width,
384
+ height: t.height,
385
+ aspectRatio: t.width && t.height ? void 0 : "1/1"
376
386
  }));
377
- return (r, a) => (T(), P("svg", {
387
+ return (r, a) => (H(), P("svg", {
378
388
  "aria-hidden": "",
379
- style: J(w(n))
389
+ style: ee(S(n))
380
390
  }, [
381
- C("use", {
382
- "xlink:href": w(t),
391
+ I("use", {
392
+ "xlink:href": S(l),
383
393
  fill: e.color,
384
394
  color: e.color
385
- }, null, 8, st)
395
+ }, null, 8, it)
386
396
  ], 4));
387
397
  }
388
398
  });
389
399
  function ut(e) {
390
- const { containerEl: l, sliderEl: t, autoHeight: n, performance: r = {} } = e, a = b(!0), i = Qe(z, 1e3);
391
- let u, f = "";
392
- const d = b(0), h = b(0), v = b(0), o = b({
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 = _({
393
403
  top: 0,
394
404
  scrollTop: 0,
395
405
  scrollHeight: 0,
396
406
  clientHeight: 0
397
- }), g = b({
407
+ }), m = _({
398
408
  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,
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,
401
411
  0.05
402
- )), $ = p(() => V.value * o.value.clientHeight), K = p(() => ({
412
+ )), z = p(() => j.value * s.value.clientHeight), M = p(() => ({
403
413
  willChange: "transform",
404
414
  transform: `translate3d(0,${v.value}px,0)`,
405
- height: n ? `${$.value}px` : void 0
415
+ height: n ? `${z.value}px` : void 0
406
416
  }));
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");
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");
409
419
  }
410
- function j() {
411
- l.value.style.scrollBehavior = f, h.value = 0, i();
420
+ function F() {
421
+ t.value.style.scrollBehavior = h, d.value = 0, o();
412
422
  }
413
- function k() {
423
+ function B() {
414
424
  a.value = !1;
415
425
  }
416
- function z() {
417
- H.value || (a.value = !0);
426
+ function L() {
427
+ E.value || (a.value = !0);
418
428
  }
419
- function M(E) {
420
- if (!H.value)
429
+ function N(b) {
430
+ if (!E.value)
421
431
  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
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
425
435
  });
426
436
  }
427
- function N() {
428
- H.value || s();
437
+ function D() {
438
+ E.value || Q();
429
439
  }
430
- function s() {
431
- cancelAnimationFrame(u), u = requestAnimationFrame(c);
440
+ function Q() {
441
+ cancelAnimationFrame(u), u = requestAnimationFrame(W);
432
442
  }
433
- function c() {
434
- l.value && (d.value = r.scrollTop?.value ?? l.value.scrollTop, v.value = d.value / B.value * I.value);
443
+ function W() {
444
+ t.value && (f.value = r.scrollTop?.value ?? t.value.scrollTop, v.value = f.value / C.value * T.value);
435
445
  }
436
- function _(E) {
437
- let S = "addEventListener";
438
- E === "add" ? S = "addEventListener" : S = "removeEventListener", t.value?.[S]("pointerdown", F, {
446
+ function k(b) {
447
+ let g = "addEventListener";
448
+ b === "add" ? g = "addEventListener" : g = "removeEventListener", l.value?.[g]("pointerdown", $, {
439
449
  passive: !0
440
- }), window[S]("pointermove", M, { passive: !0 }), window[S]("pointerup", j, { passive: !0 });
450
+ }), window[g]("pointermove", N, { passive: !0 }), window[g]("pointerup", F, { passive: !0 });
441
451
  }
442
- const y = new MutationObserver((E) => {
443
- E.map((Oe) => Oe.oldValue).join().includes("height") ? m() : g.value.clientHeight || m();
452
+ const U = new MutationObserver((b) => {
453
+ b.map((w) => w.oldValue).join().includes("height") && V();
444
454
  });
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;
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;
457
+ }
458
+ function i() {
459
+ B(), setTimeout(() => {
460
+ m.value.clientHeight = l.value?.clientHeight ?? 0, L();
461
+ }, 150);
447
462
  }
448
- function we() {
449
- l.value && t.value ? (l.value.addEventListener("scroll", N, {
463
+ function c() {
464
+ t.value && l.value ? (t.value.addEventListener("scroll", D, {
450
465
  passive: !0
451
- }), _("add"), y.observe(l.value, {
466
+ }), k("add"), U.observe(t.value, {
452
467
  subtree: !0,
453
468
  attributeOldValue: !0,
454
469
  attributeFilter: ["style"]
455
470
  }), setTimeout(() => {
456
- m();
457
- }, 100)) : console.error("useScrollBar:", "\u521D\u59CB\u5316\u5931\u8D25!", { containerEl: l, sliderEl: t });
471
+ V();
472
+ }, 100), i()) : console.error("useScrollBar:", "\u521D\u59CB\u5316\u5931\u8D25!", { containerEl: t, sliderEl: l });
458
473
  }
459
- const Se = R(d, () => {
460
- g.value.clientHeight ? Se() : m();
461
- });
462
- return R(d, () => {
463
- k(), i();
474
+ return R(f, () => {
475
+ B(), o();
464
476
  }), {
465
477
  isScrollEnd: a,
466
- isDragSlider: H,
467
- scrollable: D,
468
- sliderPos: K,
469
- init: we,
470
- modifySliderEventListener: _
478
+ isDragSlider: E,
479
+ scrollable: y,
480
+ sliderPos: M,
481
+ init: c,
482
+ modifySliderEventListener: k
471
483
  };
472
484
  }
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({
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({
474
486
  __name: "ScrollBar",
475
487
  props: {
476
488
  containerEl: null,
@@ -478,46 +490,46 @@ const ct = (e) => (Fe("data-v-9645dfb5"), e = e(), Le(), e), dt = /* @__PURE__ *
478
490
  autoHeight: { type: Boolean },
479
491
  performance: null
480
492
  },
481
- setup(e, { expose: l }) {
482
- const t = e, n = !!Re().default, r = b(null), a = p(() => t.containerEl), i = ut({
493
+ setup(e, { expose: t }) {
494
+ const l = e, n = !!Ae().default, r = _(null), a = p(() => l.containerEl), o = ut({
483
495
  containerEl: a,
484
496
  sliderEl: r,
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
- re(() => {
490
- i.init();
497
+ autoHeight: n ? l.autoHeight : !0,
498
+ 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(() => {
502
+ o.init();
491
503
  });
492
- }), ae(() => {
493
- i.modifySliderEventListener("remove");
494
- }), l({ uScrollBarReturn: i }), (v, o) => (T(), ie(se, null, {
495
- default: ue(() => [
496
- Ae(C("div", {
504
+ }), ue(() => {
505
+ o.modifySliderEventListener("remove");
506
+ }), t({ uScrollBarReturn: o }), (v, s) => (H(), ce(de, null, {
507
+ default: ve(() => [
508
+ $e(I("div", {
497
509
  ref_key: "sliderRef",
498
510
  ref: r,
499
511
  class: "slider-wrapper",
500
- style: J(w(d))
512
+ style: ee(S(f))
501
513
  }, [
502
- G(v.$slots, "default", {}, () => [
514
+ Z(v.$slots, "default", {}, () => [
503
515
  dt
504
516
  ], !0)
505
517
  ], 4), [
506
- [$e, w(h)]
518
+ [Fe, S(d)]
507
519
  ])
508
520
  ]),
509
521
  _: 3
510
522
  }));
511
523
  }
512
524
  });
513
- const ye = (e, l) => {
514
- const t = e.__vccOpts || e;
515
- for (const [n, r] of l)
516
- t[n] = r;
517
- return t;
518
- }, wt = /* @__PURE__ */ ye(vt, [["__scopeId", "data-v-9645dfb5"]]), ft = { class: "virtualListWrapper" }, pt = {
525
+ const Ee = (e, t) => {
526
+ const l = e.__vccOpts || e;
527
+ for (const [n, r] of t)
528
+ l[n] = r;
529
+ return l;
530
+ }, wt = /* @__PURE__ */ Ee(vt, [["__scopeId", "data-v-e4f66100"]]), ft = { class: "virtualListWrapper" }, pt = {
519
531
  inheritAttrs: !1
520
- }, ht = /* @__PURE__ */ L({
532
+ }, ht = /* @__PURE__ */ K({
521
533
  ...pt,
522
534
  __name: "VirtualList",
523
535
  props: {
@@ -525,31 +537,35 @@ const ye = (e, l) => {
525
537
  itemHeight: null,
526
538
  overscan: { default: 10 }
527
539
  },
528
- setup(e, { expose: l }) {
529
- const t = e, n = rt(De(t, "data"), {
530
- itemHeight: (d) => t.itemHeight(t.data[d]),
531
- overscan: t.overscan
532
- }), { list: r, containerProps: a, 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(a).onScroll && w(a).onScroll(...v)),
538
- ref: w(a).ref,
540
+ emits: ["scrollEnd"],
541
+ setup(e, { expose: t, emit: l }) {
542
+ const n = e, r = rt(ke(n, "data"), {
543
+ itemHeight: (d) => n.itemHeight(n.data[d]),
544
+ overscan: n.overscan,
545
+ scrollEndHook: () => {
546
+ l("scrollEnd");
547
+ }
548
+ }), { list: a, containerProps: o, wrapperProps: u, innerProps: h, getItemHeightData: f } = r;
549
+ return t({
550
+ 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,
539
555
  class: "virtualList"
540
556
  }, d.$attrs), [
541
- C("div", X(Z(w(i))), [
542
- C("div", X(Z(w(u))), [
543
- (T(!0), P(Ke, null, je(w(r), ({ index: v, data: o }) => (T(), P("div", {
544
- key: v,
545
- style: J({
546
- height: `${w(f)(v).height}px`,
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`,
547
563
  display: "flex"
548
564
  })
549
565
  }, [
550
- G(d.$slots, "default", {
551
- data: o,
552
- index: v
566
+ Z(d.$slots, "default", {
567
+ data: m,
568
+ index: s
553
569
  }, void 0, !0)
554
570
  ], 4))), 128))
555
571
  ], 16)
@@ -558,22 +574,22 @@ const ye = (e, l) => {
558
574
  ]));
559
575
  }
560
576
  });
561
- const St = /* @__PURE__ */ ye(ht, [["__scopeId", "data-v-134ad8ab"]]);
577
+ const St = /* @__PURE__ */ Ee(ht, [["__scopeId", "data-v-b228d073"]]);
562
578
  export {
563
579
  wt as ScrollBar,
564
580
  yt as SvgIcon,
565
581
  St as VirtualList,
566
- pe as allSelectedKey,
582
+ be as allSelectedKey,
567
583
  at as closeDialogKey,
568
584
  _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,
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,
577
593
  bt as useSelectable,
578
594
  mt as useSelectableInjectors,
579
595
  rt as useVirtualList
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[r.value.length-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[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[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),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"}})});
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.25",
3
+ "version": "0.0.27",
4
4
  "description": "lazycat ui toolkits",
5
5
  "main": "./dist/index.umd.js",
6
6
  "module": "./dist/index.es.js",