@lazycatcloud/lzc-toolkit 0.0.22 → 0.0.24

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