@lazycatcloud/lzc-toolkit 0.0.26 → 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 +56 -55
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unref as S, getCurrentScope as
|
|
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
2
|
var ne;
|
|
3
3
|
const A = typeof window < "u";
|
|
4
4
|
A && ((ne = window?.navigator) == null ? void 0 : ne.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
@@ -14,12 +14,12 @@ function ze(e, t) {
|
|
|
14
14
|
function Me(e, t = {}) {
|
|
15
15
|
let l, n;
|
|
16
16
|
return (a) => {
|
|
17
|
-
const o = Y(e),
|
|
18
|
-
if (l && clearTimeout(l), o <= 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
21
|
l && clearTimeout(l), n = null, a();
|
|
22
|
-
},
|
|
22
|
+
}, u)), l = setTimeout(() => {
|
|
23
23
|
n && clearTimeout(n), n = null, a();
|
|
24
24
|
}, o);
|
|
25
25
|
};
|
|
@@ -28,7 +28,7 @@ function Ne(e) {
|
|
|
28
28
|
return e;
|
|
29
29
|
}
|
|
30
30
|
function Qe(e) {
|
|
31
|
-
return
|
|
31
|
+
return xe() ? (He(e), !0) : !1;
|
|
32
32
|
}
|
|
33
33
|
function fe(e, t = 200, l = {}) {
|
|
34
34
|
return ze(Me(t, l), e);
|
|
@@ -64,23 +64,23 @@ var oe = Object.getOwnPropertySymbols, Ye = Object.prototype.hasOwnProperty, Ge
|
|
|
64
64
|
function Xe(e, t, l = {}) {
|
|
65
65
|
const n = l, { window: r = Ue } = n, a = Je(n, ["window"]);
|
|
66
66
|
let o;
|
|
67
|
-
const
|
|
67
|
+
const u = qe(() => r && "ResizeObserver" in r), h = () => {
|
|
68
68
|
o && (o.disconnect(), o = void 0);
|
|
69
69
|
}, f = R(() => pe(e), (v) => {
|
|
70
|
-
h(),
|
|
70
|
+
h(), u.value && r && v && (o = new ResizeObserver(t), o.observe(v, a));
|
|
71
71
|
}, { immediate: !0, flush: "post" }), d = () => {
|
|
72
72
|
h(), f();
|
|
73
73
|
};
|
|
74
74
|
return Qe(d), {
|
|
75
|
-
isSupported:
|
|
75
|
+
isSupported: u,
|
|
76
76
|
stop: d
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
function Ze(e, t = { width: 0, height: 0 }, l = {}) {
|
|
80
80
|
const { box: n = "content-box" } = l, r = _(t.width), a = _(t.height);
|
|
81
81
|
return Xe(e, ([o]) => {
|
|
82
|
-
const
|
|
83
|
-
|
|
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
84
|
}, l), R(() => pe(e), (o) => {
|
|
85
85
|
r.value = o ? t.width : 0, a.value = o ? t.height : 0;
|
|
86
86
|
}), {
|
|
@@ -130,32 +130,32 @@ nt({
|
|
|
130
130
|
linear: Ne
|
|
131
131
|
}, ot);
|
|
132
132
|
function rt(e, t) {
|
|
133
|
-
const { scrollEndHook: l, itemHeight: n, overscan: r = 5 } = t, a = _(), o = Ze(a),
|
|
133
|
+
const { scrollEndHook: l, itemHeight: n, overscan: r = 5 } = t, a = _(), o = Ze(a), u = _(!0), h = fe(M, 100);
|
|
134
134
|
let f;
|
|
135
135
|
const d = Te(e), v = _(0), s = _({ start: 0, end: 10 });
|
|
136
136
|
let m = 0;
|
|
137
|
-
const
|
|
138
|
-
let { sum: i, height:
|
|
139
|
-
return d.value.map((b, g) => (typeof n == "number" ?
|
|
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
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 =
|
|
142
|
-
return
|
|
141
|
+
let i = E.value.length - r, c = Math.max(i - m, 0);
|
|
142
|
+
return E.value.slice(c, i);
|
|
143
143
|
});
|
|
144
144
|
X(() => {
|
|
145
145
|
}), ue(() => cancelAnimationFrame(f)), R(
|
|
146
146
|
[o.width, o.height, d],
|
|
147
|
-
([i,
|
|
148
|
-
(i ||
|
|
147
|
+
([i, c]) => {
|
|
148
|
+
(i || c) && $();
|
|
149
149
|
},
|
|
150
150
|
{ deep: !0 }
|
|
151
151
|
), R(v, () => {
|
|
152
152
|
z(), h();
|
|
153
153
|
});
|
|
154
154
|
function z() {
|
|
155
|
-
|
|
155
|
+
u.value = !1;
|
|
156
156
|
}
|
|
157
157
|
function M() {
|
|
158
|
-
|
|
158
|
+
u.value = !0, l?.();
|
|
159
159
|
}
|
|
160
160
|
function $() {
|
|
161
161
|
cancelAnimationFrame(f), f = requestAnimationFrame(F);
|
|
@@ -163,23 +163,23 @@ function rt(e, t) {
|
|
|
163
163
|
function F() {
|
|
164
164
|
if (a.value) {
|
|
165
165
|
v.value = a.value.scrollTop, m = L();
|
|
166
|
-
let i = B(v.value),
|
|
167
|
-
i = i - r, i = i < 0 ? 0 : i,
|
|
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
168
|
data: b,
|
|
169
169
|
index: g + i
|
|
170
170
|
}));
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
function B(i) {
|
|
174
|
-
let
|
|
174
|
+
let c = Math.floor(y.value.length / 16), b = -1, g = -1;
|
|
175
175
|
for (let w = 0; w < 16; w++) {
|
|
176
|
-
if (y.value[
|
|
176
|
+
if (y.value[c * w].sum >= i) {
|
|
177
177
|
b = Math.max(0, w - 1);
|
|
178
178
|
break;
|
|
179
179
|
}
|
|
180
180
|
w === 15 && (b = w);
|
|
181
181
|
}
|
|
182
|
-
b *=
|
|
182
|
+
b *= c;
|
|
183
183
|
for (let w = b; w < y.value.length; w++)
|
|
184
184
|
if (y.value[w].sum >= i) {
|
|
185
185
|
g = w;
|
|
@@ -188,16 +188,16 @@ function rt(e, t) {
|
|
|
188
188
|
return Math.max(0, g);
|
|
189
189
|
}
|
|
190
190
|
function L() {
|
|
191
|
-
let i = 0,
|
|
192
|
-
for (let g = b; g < y.value.length && (i++,
|
|
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++)
|
|
193
193
|
;
|
|
194
194
|
return i;
|
|
195
195
|
}
|
|
196
196
|
function N(i) {
|
|
197
197
|
if (typeof n == "number")
|
|
198
198
|
return i * n;
|
|
199
|
-
let
|
|
200
|
-
return
|
|
199
|
+
let c = y.value[i];
|
|
200
|
+
return c.sum - c.height;
|
|
201
201
|
}
|
|
202
202
|
function D(i) {
|
|
203
203
|
return y.value[i] || { sum: 0, height: 0 };
|
|
@@ -208,14 +208,15 @@ function rt(e, t) {
|
|
|
208
208
|
}
|
|
209
209
|
function W(i) {
|
|
210
210
|
if (a.value) {
|
|
211
|
-
const
|
|
212
|
-
a.value.scrollTop =
|
|
211
|
+
const c = D(i);
|
|
212
|
+
a.value.scrollTop = c.sum - c.height, F();
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
const k = p(() => ({
|
|
216
216
|
style: {
|
|
217
217
|
width: "100%",
|
|
218
|
-
height: `${C.value}px
|
|
218
|
+
height: `${C.value}px`,
|
|
219
|
+
pointerEvents: u.value ? void 0 : "none"
|
|
219
220
|
}
|
|
220
221
|
})), U = p(() => ({
|
|
221
222
|
style: {
|
|
@@ -226,14 +227,14 @@ function rt(e, t) {
|
|
|
226
227
|
overflowY: "auto"
|
|
227
228
|
};
|
|
228
229
|
return {
|
|
229
|
-
list:
|
|
230
|
+
list: E,
|
|
230
231
|
visiableList: j,
|
|
231
232
|
getItemHeightData: D,
|
|
232
233
|
totalHeight: C,
|
|
233
234
|
clientHeight: o.height,
|
|
234
235
|
scrollTo: W,
|
|
235
236
|
scrollTop: v,
|
|
236
|
-
isScrollEnd:
|
|
237
|
+
isScrollEnd: u,
|
|
237
238
|
containerProps: {
|
|
238
239
|
ref: a,
|
|
239
240
|
onScroll: () => {
|
|
@@ -253,12 +254,12 @@ function mt() {
|
|
|
253
254
|
boolFn: (m) => !1,
|
|
254
255
|
boolRef: p(() => !1),
|
|
255
256
|
arrayRef: p(() => [])
|
|
256
|
-
}, r =
|
|
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);
|
|
257
258
|
return {
|
|
258
259
|
selected: r,
|
|
259
260
|
isSelected: a,
|
|
260
261
|
isAllSelected: o,
|
|
261
|
-
toggle:
|
|
262
|
+
toggle: u,
|
|
262
263
|
toggleAll: h,
|
|
263
264
|
select: f,
|
|
264
265
|
selectAll: d,
|
|
@@ -276,7 +277,7 @@ function bt(e, t) {
|
|
|
276
277
|
function o() {
|
|
277
278
|
l.value = {};
|
|
278
279
|
}
|
|
279
|
-
function
|
|
280
|
+
function u(s) {
|
|
280
281
|
s.forEach((m) => {
|
|
281
282
|
l.value[m[t]] || (l.value[m[t]] = !0);
|
|
282
283
|
});
|
|
@@ -297,9 +298,9 @@ function bt(e, t) {
|
|
|
297
298
|
function v() {
|
|
298
299
|
r.value ? o() : a();
|
|
299
300
|
}
|
|
300
|
-
return O(he, v), O(ge, d), O(me, f), O(be, n), O(_e,
|
|
301
|
+
return O(he, v), O(ge, d), O(me, f), O(be, n), O(_e, u), O(ye, a), O(we, h), O(Se, r), O(Oe, o), {
|
|
301
302
|
selected: n,
|
|
302
|
-
select:
|
|
303
|
+
select: u,
|
|
303
304
|
selectAll: a,
|
|
304
305
|
unselect: h,
|
|
305
306
|
unselectAll: o,
|
|
@@ -397,7 +398,7 @@ const it = ["xlink:href", "fill", "color"], yt = /* @__PURE__ */ K({
|
|
|
397
398
|
});
|
|
398
399
|
function ut(e) {
|
|
399
400
|
const { containerEl: t, sliderEl: l, autoHeight: n, performance: r = {} } = e, a = _(!0), o = fe(L, 100);
|
|
400
|
-
let
|
|
401
|
+
let u, h = "";
|
|
401
402
|
const f = _(0), d = _(0), v = _(0), s = _({
|
|
402
403
|
top: 0,
|
|
403
404
|
scrollTop: 0,
|
|
@@ -405,7 +406,7 @@ function ut(e) {
|
|
|
405
406
|
clientHeight: 0
|
|
406
407
|
}), m = _({
|
|
407
408
|
clientHeight: 0
|
|
408
|
-
}),
|
|
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(
|
|
409
410
|
s.value.clientHeight / s.value.scrollHeight,
|
|
410
411
|
0.05
|
|
411
412
|
)), z = p(() => j.value * s.value.clientHeight), M = p(() => ({
|
|
@@ -423,10 +424,10 @@ function ut(e) {
|
|
|
423
424
|
a.value = !1;
|
|
424
425
|
}
|
|
425
426
|
function L() {
|
|
426
|
-
|
|
427
|
+
E.value || (a.value = !0);
|
|
427
428
|
}
|
|
428
429
|
function N(b) {
|
|
429
|
-
if (!
|
|
430
|
+
if (!E.value)
|
|
430
431
|
return;
|
|
431
432
|
let g = b.clientY - s.value.top - d.value;
|
|
432
433
|
g < 0 ? v.value = 0 : g >= T.value ? v.value = T.value : v.value = g, t.value.scrollTo({
|
|
@@ -434,10 +435,10 @@ function ut(e) {
|
|
|
434
435
|
});
|
|
435
436
|
}
|
|
436
437
|
function D() {
|
|
437
|
-
|
|
438
|
+
E.value || Q();
|
|
438
439
|
}
|
|
439
440
|
function Q() {
|
|
440
|
-
cancelAnimationFrame(
|
|
441
|
+
cancelAnimationFrame(u), u = requestAnimationFrame(W);
|
|
441
442
|
}
|
|
442
443
|
function W() {
|
|
443
444
|
t.value && (f.value = r.scrollTop?.value ?? t.value.scrollTop, v.value = f.value / C.value * T.value);
|
|
@@ -459,7 +460,7 @@ function ut(e) {
|
|
|
459
460
|
m.value.clientHeight = l.value?.clientHeight ?? 0, L();
|
|
460
461
|
}, 150);
|
|
461
462
|
}
|
|
462
|
-
function
|
|
463
|
+
function c() {
|
|
463
464
|
t.value && l.value ? (t.value.addEventListener("scroll", D, {
|
|
464
465
|
passive: !0
|
|
465
466
|
}), k("add"), U.observe(t.value, {
|
|
@@ -474,10 +475,10 @@ function ut(e) {
|
|
|
474
475
|
B(), o();
|
|
475
476
|
}), {
|
|
476
477
|
isScrollEnd: a,
|
|
477
|
-
isDragSlider:
|
|
478
|
+
isDragSlider: E,
|
|
478
479
|
scrollable: y,
|
|
479
480
|
sliderPos: M,
|
|
480
|
-
init:
|
|
481
|
+
init: c,
|
|
481
482
|
modifySliderEventListener: k
|
|
482
483
|
};
|
|
483
484
|
}
|
|
@@ -495,7 +496,7 @@ const ct = (e) => (Le("data-v-e4f66100"), e = e(), De(), e), dt = /* @__PURE__ *
|
|
|
495
496
|
sliderEl: r,
|
|
496
497
|
autoHeight: n ? l.autoHeight : !0,
|
|
497
498
|
performance: l.performance
|
|
498
|
-
}), { scrollable:
|
|
499
|
+
}), { scrollable: u, isScrollEnd: h, sliderPos: f } = o, d = l.autoHide ? p(() => !h.value) : p(() => u.value);
|
|
499
500
|
return X(() => {
|
|
500
501
|
ie(() => {
|
|
501
502
|
o.init();
|
|
@@ -521,12 +522,12 @@ const ct = (e) => (Le("data-v-e4f66100"), e = e(), De(), e), dt = /* @__PURE__ *
|
|
|
521
522
|
}));
|
|
522
523
|
}
|
|
523
524
|
});
|
|
524
|
-
const
|
|
525
|
+
const Ee = (e, t) => {
|
|
525
526
|
const l = e.__vccOpts || e;
|
|
526
527
|
for (const [n, r] of t)
|
|
527
528
|
l[n] = r;
|
|
528
529
|
return l;
|
|
529
|
-
}, wt = /* @__PURE__ */
|
|
530
|
+
}, wt = /* @__PURE__ */ Ee(vt, [["__scopeId", "data-v-e4f66100"]]), ft = { class: "virtualListWrapper" }, pt = {
|
|
530
531
|
inheritAttrs: !1
|
|
531
532
|
}, ht = /* @__PURE__ */ K({
|
|
532
533
|
...pt,
|
|
@@ -544,7 +545,7 @@ const xe = (e, t) => {
|
|
|
544
545
|
scrollEndHook: () => {
|
|
545
546
|
l("scrollEnd");
|
|
546
547
|
}
|
|
547
|
-
}), { list: a, containerProps: o, wrapperProps:
|
|
548
|
+
}), { list: a, containerProps: o, wrapperProps: u, innerProps: h, getItemHeightData: f } = r;
|
|
548
549
|
return t({
|
|
549
550
|
vListReturn: r
|
|
550
551
|
}), (d, v) => (H(), P("div", ft, [
|
|
@@ -553,7 +554,7 @@ const xe = (e, t) => {
|
|
|
553
554
|
ref: S(o).ref,
|
|
554
555
|
class: "virtualList"
|
|
555
556
|
}, d.$attrs), [
|
|
556
|
-
I("div", te(le(S(
|
|
557
|
+
I("div", te(le(S(u))), [
|
|
557
558
|
I("div", te(le(S(h))), [
|
|
558
559
|
(H(!0), P(Ke, null, je(S(a), ({ index: s, data: m }) => (H(), P("div", {
|
|
559
560
|
key: s,
|
|
@@ -573,7 +574,7 @@ const xe = (e, t) => {
|
|
|
573
574
|
]));
|
|
574
575
|
}
|
|
575
576
|
});
|
|
576
|
-
const St = /* @__PURE__ */
|
|
577
|
+
const St = /* @__PURE__ */ Ee(ht, [["__scopeId", "data-v-b228d073"]]);
|
|
577
578
|
export {
|
|
578
579
|
wt as ScrollBar,
|
|
579
580
|
yt as SvgIcon,
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(h,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(h=typeof globalThis<"u"?globalThis:h||self,e(h.ui={},h.Vue))})(this,function(h,e){"use strict";var X;const E=typeof window<"u";E&&((X=window?.navigator)==null?void 0:X.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function A(t){return typeof t=="function"?t():e.unref(t)}function se(t,l){function n(...o){t(()=>l.apply(this,o),{fn:l,thisArg:this,args:o})}return n}function ce(t,l={}){let n,o;return a=>{const r=A(t),d=A(l.maxWait);if(n&&clearTimeout(n),r<=0||d!==void 0&&d<=0)return o&&(clearTimeout(o),o=null),a();d&&!o&&(o=setTimeout(()=>{n&&clearTimeout(n),o=null,a()},d)),n=setTimeout(()=>{o&&clearTimeout(o),o=null,a()},r)}}function ue(t){return t}function de(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function Z(t,l=200,n={}){return se(ce(l,n),t)}function fe(t,l=!0){e.getCurrentInstance()?e.onMounted(t):l?t():e.nextTick(t)}function ee(t){var l;const n=A(t);return(l=n?.$el)!=null?l:n}const pe=E?window:void 0;E&&window.document,E&&window.navigator,E&&window.location;function he(t,l=!1){const n=e.ref(),o=()=>n.value=Boolean(t());return o(),fe(o,l),n}const k=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},j="__vueuse_ssr_handlers__";k[j]=k[j]||{},k[j];var te=Object.getOwnPropertySymbols,me=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable,ve=(t,l)=>{var n={};for(var o in t)me.call(t,o)&&l.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&te)for(var o of te(t))l.indexOf(o)<0&&ge.call(t,o)&&(n[o]=t[o]);return n};function ye(t,l,n={}){const o=n,{window:i=pe}=o,a=ve(o,["window"]);let r;const d=he(()=>i&&"ResizeObserver"in i),g=()=>{r&&(r.disconnect(),r=void 0)},m=e.watch(()=>ee(t),p=>{g(),d.value&&i&&p&&(r=new ResizeObserver(l),r.observe(p,a))},{immediate:!0,flush:"post"}),f=()=>{g(),m()};return de(f),{isSupported:d,stop:f}}function be(t,l={width:0,height:0},n={}){const{box:o="content-box"}=n,i=e.ref(l.width),a=e.ref(l.height);return ye(t,([r])=>{const d=o==="border-box"?r.borderBoxSize:o==="content-box"?r.contentBoxSize:r.devicePixelContentBoxSize;d?(i.value=d.reduce((g,{inlineSize:m})=>g+m,0),a.value=d.reduce((g,{blockSize:m})=>g+m,0)):(i.value=r.contentRect.width,a.value=r.contentRect.height)},n),e.watch(()=>ee(t),r=>{i.value=r?l.width:0,a.value=r?l.height:0}),{width:i,height:a}}var le;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(le||(le={}));var _e=Object.defineProperty,ne=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable,oe=(t,l,n)=>l in t?_e(t,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[l]=n,Oe=(t,l)=>{for(var n in l||(l={}))Se.call(l,n)&&oe(t,n,l[n]);if(ne)for(var n of ne(l))we.call(l,n)&&oe(t,n,l[n]);return t};Oe({linear:ue},{easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]});function re(t,l){const{scrollEndHook:n,itemHeight:o,overscan:i=5}=l,a=e.ref(),r=be(a),d=e.ref(!0),g=Z(W,100);let m;const f=e.shallowRef(t),p=e.ref(0),s=e.ref({start:0,end:10});let y=0;const w=e.ref([]),_=e.computed(()=>{let{sum:c,height:u}={sum:0,height:0};return f.value.map((b,v)=>(typeof o=="number"?u=o:u=o(v),c+=u,{height:u,sum:c}))}),O=e.computed(()=>q(s.value.start)),I=e.computed(()=>typeof o=="number"?_.value.length*o:_.value[_.value.length-1]?.sum||0),Q=e.computed(()=>{let c=w.value.length-i,u=Math.max(c-y,0);return w.value.slice(u,c)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(m)),e.watch([r.width,r.height,f],([c,u])=>{(c||u)&&H()},{deep:!0}),e.watch(p,()=>{U(),g()});function U(){d.value=!1}function W(){d.value=!0,n?.()}function H(){cancelAnimationFrame(m),m=requestAnimationFrame(T)}function T(){if(a.value){p.value=a.value.scrollTop,y=C();let c=B(p.value),u=c+y+i;c=c-i,c=c<0?0:c,u=u>f.value.length?f.value.length:u,s.value={start:c,end:u},w.value=f.value.slice(c,u).map((b,v)=>({data:b,index:v+c}))}}function B(c){let u=Math.floor(_.value.length/16),b=-1,v=-1;for(let S=0;S<16;S++){if(_.value[u*S].sum>=c){b=Math.max(0,S-1);break}S===15&&(b=S)}b*=u;for(let S=b;S<_.value.length;S++)if(_.value[S].sum>=c){v=S;break}return Math.max(0,v)}function C(){let c=0,u=0,b=Y();for(let v=b;v<_.value.length&&(c++,u+=_.value[v].height,!(u>=r.height.value));v++);return c}function q(c){if(typeof o=="number")return c*o;let u=_.value[c];return u.sum-u.height}function P(c){return _.value[c]||{sum:0,height:0}}function Y(){let c=s.value.start;return c>=i&&(c+=i),c}function G(c){if(a.value){const u=P(c);a.value.scrollTop=u.sum-u.height,T()}}const R=e.computed(()=>({style:{width:"100%",height:`${I.value}px`}})),J=e.computed(()=>({style:{transform:`translate3d(0, ${O.value}px, 0)`,"will-change":"transform"}})),x={overflowY:"auto"};return{list:w,visiableList:Q,getItemHeightData:P,totalHeight:I,clientHeight:r.height,scrollTo:G,scrollTop:p,isScrollEnd:d,containerProps:{ref:a,onScroll:()=>{H()},style:x},wrapperProps:R,innerProps:J}}const K=Symbol(),L=Symbol(),V=Symbol(),$=Symbol(),F=Symbol(),D=Symbol(),N=Symbol(),M=Symbol(),z=Symbol();function Ee(){const{voidFn:t,boolFn:l,boolRef:n,arrayRef:o}={voidFn:y=>{},boolFn:y=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},i=e.inject($,o),a=e.inject(V,l),r=e.inject(M,n),d=e.inject(L,t),g=e.inject(K,t),m=e.inject(F,t),f=e.inject(D,t),p=e.inject(N,t),s=e.inject(z,t);return{selected:i,isSelected:a,isAllSelected:r,toggle:d,toggleAll:g,select:m,selectAll:f,unselect:p,unselectAll:s}}function Ie(t,l){const n=e.ref({}),o=e.computed(()=>t.value.filter(s=>n.value[s[l]])),i=e.computed(()=>o.value.length!=0&&Object.keys(n.value).length==t.value.length);function a(){t.value.forEach(s=>{n.value[s[l]]=!0})}function r(){n.value={}}function d(s){s.forEach(y=>{n.value[y[l]]||(n.value[y[l]]=!0)})}function g(s){s.forEach(y=>{n.value[y[l]]&&delete n.value[y[l]]})}function m(s){return!!n.value[s[l]]}function f(s){s.forEach(y=>{m(y)?delete n.value[y[l]]:n.value[y[l]]=!0})}function p(){i.value?r():a()}return e.provide(K,p),e.provide(L,f),e.provide(V,m),e.provide($,o),e.provide(F,d),e.provide(D,a),e.provide(N,g),e.provide(M,i),e.provide(z,r),{selected:o,select:d,selectAll:a,unselect:g,unselectAll:r,toggle:f,toggleAll:p,isSelected:m,isAllSelected:i}}const ie=Symbol(),Be=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0},dialogClass:{default:""}},emits:["update:visiable"],setup(t,{emit:l}){const n=t,o=()=>{n.closeOnClickOverlay&&l("update:visiable",!1)};return e.provide(ie,()=>l("update:visiable",!1)),(i,a)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[t.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:o,class:"modal absolute inset-0 bottom-0 z-50 flex bg-stone-900 bg-opacity-50"},[e.createElementVNode("div",{onClick:a[0]||(a[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog m-auto flex flex-col",t.dialogClass])},[e.renderSlot(i.$slots,"default")],2)])):e.createCommentVNode("",!0)]),_:3}))}});function He(t){function l(n,o){const i=document.createElement("div"),a={setup(){return()=>e.h(Be,{visiable:!0,"onUpdate:visiable":()=>{i?.remove()},...t},{default:()=>e.h(n,o)})}};return document.body.appendChild(i),e.render(e.h(a),i),{close:()=>i?.remove()}}return{create:l}}const Te=["xlink:href","fill","color"],Ce=e.defineComponent({__name:"SvgIcon",props:{name:null,prefix:{default:"icon"},color:{default:"#FFF"},width:null,height:null},setup(t){const l=t,n=e.computed(()=>`#${l.prefix}-${l.name}`),o=e.computed(()=>({width:l.width,height:l.height,aspectRatio:l.width&&l.height?void 0:"1/1"}));return(i,a)=>(e.openBlock(),e.createElementBlock("svg",{"aria-hidden":"",style:e.normalizeStyle(e.unref(o))},[e.createElementVNode("use",{"xlink:href":e.unref(n),fill:t.color,color:t.color},null,8,Te)],4))}});function Pe(t){const{containerEl:l,sliderEl:n,autoHeight:o,performance:i={}}=t,a=e.ref(!0),r=Z(C,100);let d,g="";const m=e.ref(0),f=e.ref(0),p=e.ref(0),s=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),y=e.ref({clientHeight:0}),w=e.computed(()=>!!f.value),_=e.computed(()=>s.value.scrollHeight>s.value.clientHeight),O=e.computed(()=>s.value.clientHeight-y.value.clientHeight),I=e.computed(()=>s.value.scrollHeight-s.value.clientHeight),Q=e.computed(()=>Math.max(s.value.clientHeight/s.value.scrollHeight,.05)),U=e.computed(()=>Q.value*s.value.clientHeight),W=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${p.value}px,0)`,height:o?`${U.value}px`:void 0}));function H(b){B(),f.value=b.clientY-n.value.getBoundingClientRect().top||1,g=getComputedStyle(l.value).scrollBehavior,g==="smooth"&&(l.value.style.scrollBehavior="unset")}function T(){l.value.style.scrollBehavior=g,f.value=0,r()}function B(){a.value=!1}function C(){w.value||(a.value=!0)}function q(b){if(!w.value)return;let v=b.clientY-s.value.top-f.value;v<0?p.value=0:v>=O.value?p.value=O.value:p.value=v,l.value.scrollTo({top:p.value/O.value*I.value})}function P(){w.value||Y()}function Y(){cancelAnimationFrame(d),d=requestAnimationFrame(G)}function G(){l.value&&(m.value=i.scrollTop?.value??l.value.scrollTop,p.value=m.value/I.value*O.value)}function R(b){let v="addEventListener";b==="add"?v="addEventListener":v="removeEventListener",n.value?.[v]("pointerdown",H,{passive:!0}),window[v]("pointermove",q,{passive:!0}),window[v]("pointerup",T,{passive:!0})}const J=new MutationObserver(b=>{b.map(S=>S.oldValue).join().includes("height")&&x()});function x(){s.value.top=l.value?.getBoundingClientRect().top??0,s.value.scrollHeight=l.value?.scrollHeight??0,s.value.clientHeight=l.value?.clientHeight??0}function c(){B(),setTimeout(()=>{y.value.clientHeight=n.value?.clientHeight??0,C()},150)}function u(){l.value&&n.value?(l.value.addEventListener("scroll",P,{passive:!0}),R("add"),J.observe(l.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{x()},100),c()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:l,sliderEl:n})}return e.watch(m,()=>{B(),r()}),{isScrollEnd:a,isDragSlider:w,scrollable:_,sliderPos:W,init:u,modifySliderEventListener:R}}const Re=(t=>(e.pushScopeId("data-v-e4f66100"),t=t(),e.popScopeId(),t))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),xe=e.defineComponent({__name:"ScrollBar",props:{containerEl:null,autoHide:{type:Boolean},autoHeight:{type:Boolean},performance:null},setup(t,{expose:l}){const n=t,o=!!e.useSlots().default,i=e.ref(null),a=e.computed(()=>n.containerEl),r=Pe({containerEl:a,sliderEl:i,autoHeight:o?n.autoHeight:!0,performance:n.performance}),{scrollable:d,isScrollEnd:g,sliderPos:m}=r,f=n.autoHide?e.computed(()=>!g.value):e.computed(()=>d.value);return e.onMounted(()=>{e.nextTick(()=>{r.init()})}),e.onUnmounted(()=>{r.modifySliderEventListener("remove")}),l({uScrollBarReturn:r}),(p,s)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"sliderRef",ref:i,class:"slider-wrapper",style:e.normalizeStyle(e.unref(m))},[e.renderSlot(p.$slots,"default",{},()=>[Re],!0)],4),[[e.vShow,e.unref(f)]])]),_:3}))}}),Fe="",ae=(t,l)=>{const n=t.__vccOpts||t;for(const[o,i]of l)n[o]=i;return n},Ae=ae(xe,[["__scopeId","data-v-e4f66100"]]),ke={class:"virtualListWrapper"},je={inheritAttrs:!1},Ke=e.defineComponent({...je,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},emits:["scrollEnd"],setup(t,{expose:l,emit:n}){const o=t,i=re(e.toRef(o,"data"),{itemHeight:f=>o.itemHeight(o.data[f]),overscan:o.overscan,scrollEndHook:()=>{n("scrollEnd")}}),{list:a,containerProps:r,wrapperProps:d,innerProps:g,getItemHeightData:m}=i;return l({vListReturn:i}),(f,p)=>(e.openBlock(),e.createElementBlock("div",ke,[e.createElementVNode("div",e.mergeProps({onScrollPassive:p[0]||(p[0]=(...s)=>e.unref(r).onScroll&&e.unref(r).onScroll(...s)),ref:e.unref(r).ref,class:"virtualList"},f.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(d))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(g))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a),({index:s,data:y})=>(e.openBlock(),e.createElementBlock("div",{key:s,style:e.normalizeStyle({height:`${e.unref(m)(s).height}px`,display:"flex"})},[e.renderSlot(f.$slots,"default",{data:y,index:s},void 0,!0)],4))),128))],16)],16)],16)]))}}),De="",Le=ae(Ke,[["__scopeId","data-v-b228d073"]]);h.ScrollBar=Ae,h.SvgIcon=Ce,h.VirtualList=Le,h.allSelectedKey=$,h.closeDialogKey=ie,h.dialogController=He,h.isAllSelectedKey=M,h.isSelectedKey=V,h.selectAllKey=D,h.selectKey=F,h.toggleAllKey=K,h.toggleKey=L,h.unselectAllKey=z,h.unselectKey=N,h.useSelectable=Ie,h.useSelectableInjectors=Ee,h.useVirtualList=re,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
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"}})});
|