@lazycatcloud/lzc-toolkit 0.0.30 → 0.0.31
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 +61 -52
- package/dist/index.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unref as w, getCurrentScope as Ie, onScopeDispose as Te, getCurrentInstance as Re, onMounted as Z, nextTick as ue, ref as _, watch as P, shallowRef as Ce, computed as h, onUnmounted as ce, inject as
|
|
1
|
+
import { unref as w, getCurrentScope as Ie, onScopeDispose as Te, getCurrentInstance as Re, onMounted as Z, nextTick as ue, ref as _, watch as P, shallowRef as Ce, computed as h, onUnmounted as ce, inject as H, provide as x, defineComponent as K, openBlock as T, createBlock as de, Transition as ve, withCtx as fe, createElementBlock as B, createElementVNode as R, withModifiers as Be, normalizeClass as Pe, renderSlot as ee, createCommentVNode as $e, render as Ae, h as Y, normalizeStyle as te, useSlots as Le, withDirectives as Fe, vShow as De, pushScopeId as Me, popScopeId as ke, toRef as Ve, mergeProps as Ke, normalizeProps as le, guardReactiveProps as ne, Fragment as je, renderList as ze } from "vue";
|
|
2
2
|
var oe;
|
|
3
3
|
const $ = typeof window < "u";
|
|
4
4
|
$ && ((oe = window?.navigator) == null ? void 0 : oe.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
@@ -130,41 +130,41 @@ rt({
|
|
|
130
130
|
linear: We
|
|
131
131
|
}, at);
|
|
132
132
|
function st(e, t) {
|
|
133
|
-
const { scrollEndHook: l, itemHeight: n, overscan: r = 5 } = t, s = _(), o = tt(s), d = _(!0), g = pe(
|
|
133
|
+
const { scrollEndHook: l, itemHeight: n, overscan: r = 5 } = t, s = _(), o = tt(s), d = _(!0), g = pe(z, 100);
|
|
134
134
|
let f;
|
|
135
135
|
const v = Ce(e), p = _(0), i = _({ start: 0, end: 10 });
|
|
136
136
|
let u = 0;
|
|
137
|
-
const
|
|
137
|
+
const E = _([]), b = h(() => {
|
|
138
138
|
let { sum: a, height: c } = { sum: 0, height: 0 };
|
|
139
139
|
return v.value.map((S, y) => (typeof n == "number" ? c = n : c = n(y), a += c, { height: c, sum: a }));
|
|
140
|
-
}),
|
|
141
|
-
let a =
|
|
142
|
-
return
|
|
140
|
+
}), j = h(() => M(i.value.start)), I = h(() => typeof n == "number" ? b.value.length * n : b.value[b.value.length - 1]?.sum || 0), A = h(() => {
|
|
141
|
+
let a = E.value.length - r, c = Math.max(a - u, 0);
|
|
142
|
+
return E.value.slice(c, a);
|
|
143
143
|
});
|
|
144
144
|
Z(() => {
|
|
145
145
|
}), ce(() => cancelAnimationFrame(f)), P(
|
|
146
146
|
[o.width, o.height, v],
|
|
147
147
|
([a, c]) => {
|
|
148
|
-
(a || c) &&
|
|
148
|
+
(a || c) && F();
|
|
149
149
|
},
|
|
150
150
|
{ deep: !0 }
|
|
151
151
|
), P(p, () => {
|
|
152
|
-
|
|
152
|
+
L(), g();
|
|
153
153
|
});
|
|
154
|
-
function
|
|
154
|
+
function L() {
|
|
155
155
|
d.value = !1;
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function z() {
|
|
158
158
|
d.value = !0, l?.();
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function F() {
|
|
161
161
|
cancelAnimationFrame(f), f = requestAnimationFrame(D);
|
|
162
162
|
}
|
|
163
163
|
function D() {
|
|
164
164
|
if (s.value) {
|
|
165
165
|
p.value = s.value.scrollTop, u = C();
|
|
166
166
|
let a = N(p.value), c = a + u + r;
|
|
167
|
-
a = a - r, a = a < 0 ? 0 : a, c = c > v.value.length ? v.value.length : c, i.value = { start: a, end: c },
|
|
167
|
+
a = a - r, a = a < 0 ? 0 : a, c = c > v.value.length ? v.value.length : c, i.value = { start: a, end: c }, E.value = v.value.slice(a, c).map((S, y) => ({
|
|
168
168
|
data: S,
|
|
169
169
|
index: y + a
|
|
170
170
|
}));
|
|
@@ -193,13 +193,13 @@ function st(e, t) {
|
|
|
193
193
|
;
|
|
194
194
|
return a;
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function M(a) {
|
|
197
197
|
if (typeof n == "number")
|
|
198
198
|
return a * n;
|
|
199
199
|
let c = b.value[a];
|
|
200
200
|
return c ? c.sum - c.height : 0;
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function k(a) {
|
|
203
203
|
return b.value[a] || { sum: 0, height: 0 };
|
|
204
204
|
}
|
|
205
205
|
function Q() {
|
|
@@ -208,7 +208,7 @@ function st(e, t) {
|
|
|
208
208
|
}
|
|
209
209
|
function W(a) {
|
|
210
210
|
if (s.value) {
|
|
211
|
-
const c =
|
|
211
|
+
const c = k(a);
|
|
212
212
|
s.value.scrollTop = c.sum - c.height, D();
|
|
213
213
|
}
|
|
214
214
|
}
|
|
@@ -218,18 +218,18 @@ function st(e, t) {
|
|
|
218
218
|
height: `${I.value}px`,
|
|
219
219
|
pointerEvents: d.value ? void 0 : "none"
|
|
220
220
|
}
|
|
221
|
-
})),
|
|
221
|
+
})), V = h(() => ({
|
|
222
222
|
style: {
|
|
223
|
-
transform: `translate3d(0, ${
|
|
223
|
+
transform: `translate3d(0, ${j.value}px, 0)`,
|
|
224
224
|
"will-change": "transform"
|
|
225
225
|
}
|
|
226
226
|
})), q = {
|
|
227
227
|
overflowY: "auto"
|
|
228
228
|
};
|
|
229
229
|
return {
|
|
230
|
-
list:
|
|
230
|
+
list: E,
|
|
231
231
|
visiableList: A,
|
|
232
|
-
getItemHeightData:
|
|
232
|
+
getItemHeightData: k,
|
|
233
233
|
totalHeight: I,
|
|
234
234
|
clientHeight: o.height,
|
|
235
235
|
scrollTo: W,
|
|
@@ -238,12 +238,12 @@ function st(e, t) {
|
|
|
238
238
|
containerProps: {
|
|
239
239
|
ref: s,
|
|
240
240
|
onScroll: () => {
|
|
241
|
-
|
|
241
|
+
F();
|
|
242
242
|
},
|
|
243
243
|
style: q
|
|
244
244
|
},
|
|
245
245
|
wrapperProps: U,
|
|
246
|
-
innerProps:
|
|
246
|
+
innerProps: V
|
|
247
247
|
};
|
|
248
248
|
}
|
|
249
249
|
const ge = Symbol(), me = Symbol(), be = Symbol(), _e = Symbol(), ye = Symbol(), we = Symbol(), Se = Symbol(), Oe = Symbol(), xe = Symbol();
|
|
@@ -254,7 +254,7 @@ function _t() {
|
|
|
254
254
|
boolFn: (u) => !1,
|
|
255
255
|
boolRef: h(() => !1),
|
|
256
256
|
arrayRef: h(() => [])
|
|
257
|
-
}, r =
|
|
257
|
+
}, r = H(_e, n), s = H(be, t), o = H(Oe, l), d = H(me, e), g = H(ge, e), f = H(ye, e), v = H(we, e), p = H(Se, e), i = H(xe, e);
|
|
258
258
|
return {
|
|
259
259
|
selected: r,
|
|
260
260
|
isSelected: s,
|
|
@@ -310,7 +310,7 @@ function yt(e, t) {
|
|
|
310
310
|
isAllSelected: r
|
|
311
311
|
};
|
|
312
312
|
}
|
|
313
|
-
const it = Symbol(), ut = /* @__PURE__ */
|
|
313
|
+
const it = Symbol(), ut = /* @__PURE__ */ K({
|
|
314
314
|
__name: "Dialog",
|
|
315
315
|
props: {
|
|
316
316
|
visiable: { type: Boolean, default: !1 },
|
|
@@ -369,7 +369,7 @@ function wt(e) {
|
|
|
369
369
|
create: t
|
|
370
370
|
};
|
|
371
371
|
}
|
|
372
|
-
const ct = ["xlink:href", "fill", "color"], St = /* @__PURE__ */
|
|
372
|
+
const ct = ["xlink:href", "fill", "color"], St = /* @__PURE__ */ K({
|
|
373
373
|
__name: "SvgIcon",
|
|
374
374
|
props: {
|
|
375
375
|
name: null,
|
|
@@ -403,22 +403,22 @@ function dt(e) {
|
|
|
403
403
|
autoHeight: n,
|
|
404
404
|
performance: r = {},
|
|
405
405
|
maxHeightRatio: s = 0.9
|
|
406
|
-
} = e, o = _(!0), d = pe(
|
|
406
|
+
} = e, o = _(!0), d = pe(M, 100);
|
|
407
407
|
let g, f = "";
|
|
408
408
|
const v = _(0), p = _(0), i = _(0), u = _({
|
|
409
409
|
top: 0,
|
|
410
410
|
scrollTop: 0,
|
|
411
411
|
scrollHeight: 0,
|
|
412
412
|
clientHeight: 0
|
|
413
|
-
}),
|
|
413
|
+
}), E = _({
|
|
414
414
|
clientHeight: 0
|
|
415
|
-
}), b = h(() => !!p.value),
|
|
415
|
+
}), b = h(() => !!p.value), j = h(() => u.value.scrollHeight > u.value.clientHeight), I = h(() => u.value.clientHeight - E.value.clientHeight), A = h(() => u.value.scrollHeight - u.value.clientHeight), L = h(() => Math.max(
|
|
416
416
|
u.value.clientHeight / u.value.scrollHeight,
|
|
417
417
|
0.05
|
|
418
|
-
)),
|
|
418
|
+
)), z = h(() => L.value > s ? 0 : L.value * u.value.clientHeight), F = h(() => ({
|
|
419
419
|
willChange: "transform",
|
|
420
420
|
transform: `translate3d(0,${i.value}px,0)`,
|
|
421
|
-
height: n ? `${
|
|
421
|
+
height: n ? `${z.value}px` : void 0
|
|
422
422
|
}));
|
|
423
423
|
function D(m) {
|
|
424
424
|
C(), p.value = m.clientY - l.value.getBoundingClientRect().top || 1, f = getComputedStyle(t.value).scrollBehavior, f === "smooth" && (t.value.style.scrollBehavior = "unset");
|
|
@@ -429,10 +429,10 @@ function dt(e) {
|
|
|
429
429
|
function C() {
|
|
430
430
|
o.value = !1;
|
|
431
431
|
}
|
|
432
|
-
function
|
|
432
|
+
function M() {
|
|
433
433
|
b.value || (o.value = !0);
|
|
434
434
|
}
|
|
435
|
-
function
|
|
435
|
+
function k(m) {
|
|
436
436
|
if (!b.value)
|
|
437
437
|
return;
|
|
438
438
|
let O = m.clientY - u.value.top - p.value;
|
|
@@ -449,11 +449,11 @@ function dt(e) {
|
|
|
449
449
|
function U() {
|
|
450
450
|
t.value && (v.value = r.scrollTop?.value ?? t.value.scrollTop, i.value = v.value / A.value * I.value);
|
|
451
451
|
}
|
|
452
|
-
function
|
|
452
|
+
function V(m) {
|
|
453
453
|
let O = "addEventListener";
|
|
454
454
|
m === "add" ? O = "addEventListener" : O = "removeEventListener", l.value?.[O]("pointerdown", D, {
|
|
455
455
|
passive: !0
|
|
456
|
-
}), window[O]("pointermove",
|
|
456
|
+
}), window[O]("pointermove", k, { passive: !0 }), window[O]("pointerup", N, { passive: !0 });
|
|
457
457
|
}
|
|
458
458
|
const q = new MutationObserver((m) => {
|
|
459
459
|
m.map((He) => He.oldValue).join().includes("height") && a();
|
|
@@ -463,7 +463,7 @@ function dt(e) {
|
|
|
463
463
|
}
|
|
464
464
|
function c() {
|
|
465
465
|
C(), setTimeout(() => {
|
|
466
|
-
|
|
466
|
+
E.value.clientHeight = l.value?.clientHeight ?? 0, M();
|
|
467
467
|
}, 150);
|
|
468
468
|
}
|
|
469
469
|
function S() {
|
|
@@ -478,7 +478,7 @@ function dt(e) {
|
|
|
478
478
|
function y() {
|
|
479
479
|
t.value && l.value ? (S(), t.value.addEventListener("scroll", Q, {
|
|
480
480
|
passive: !0
|
|
481
|
-
}),
|
|
481
|
+
}), V("add"), q.observe(t.value, {
|
|
482
482
|
subtree: !0,
|
|
483
483
|
attributeOldValue: !0,
|
|
484
484
|
attributeFilter: ["style"]
|
|
@@ -491,13 +491,13 @@ function dt(e) {
|
|
|
491
491
|
}), {
|
|
492
492
|
isScrollEnd: o,
|
|
493
493
|
isDragSlider: b,
|
|
494
|
-
scrollable:
|
|
495
|
-
sliderPos:
|
|
494
|
+
scrollable: j,
|
|
495
|
+
sliderPos: F,
|
|
496
496
|
init: y,
|
|
497
|
-
modifySliderEventListener:
|
|
497
|
+
modifySliderEventListener: V
|
|
498
498
|
};
|
|
499
499
|
}
|
|
500
|
-
const vt = (e) => (
|
|
500
|
+
const vt = (e) => (Me("data-v-edec7292"), e = e(), ke(), e), ft = /* @__PURE__ */ vt(() => /* @__PURE__ */ R("div", { class: "default-slider" }, null, -1)), pt = /* @__PURE__ */ K({
|
|
501
501
|
__name: "ScrollBar",
|
|
502
502
|
props: {
|
|
503
503
|
containerEl: null,
|
|
@@ -506,31 +506,40 @@ const vt = (e) => (ke("data-v-e4f66100"), e = e(), Ve(), e), ft = /* @__PURE__ *
|
|
|
506
506
|
performance: null
|
|
507
507
|
},
|
|
508
508
|
setup(e, { expose: t }) {
|
|
509
|
-
const l = e, n = !!
|
|
509
|
+
const l = e, n = !!Le().default, r = _(null), s = h(() => l.containerEl), o = dt({
|
|
510
510
|
containerEl: s,
|
|
511
511
|
sliderEl: r,
|
|
512
512
|
autoHeight: n ? l.autoHeight : !0,
|
|
513
513
|
performance: l.performance
|
|
514
|
-
}), { scrollable: d, isScrollEnd: g, sliderPos: f } = o, v = l.autoHide ? h(() => !g.value) : h(() => d.value);
|
|
515
|
-
|
|
514
|
+
}), { scrollable: d, isScrollEnd: g, sliderPos: f } = o, v = _(!1), p = l.autoHide ? h(() => v.value || !g.value) : h(() => d.value);
|
|
515
|
+
Z(() => {
|
|
516
516
|
ue(() => {
|
|
517
517
|
o.init();
|
|
518
518
|
});
|
|
519
519
|
}), ce(() => {
|
|
520
520
|
o.modifySliderEventListener("remove");
|
|
521
|
-
})
|
|
521
|
+
});
|
|
522
|
+
function i() {
|
|
523
|
+
v.value = !0;
|
|
524
|
+
}
|
|
525
|
+
function u() {
|
|
526
|
+
v.value = !1;
|
|
527
|
+
}
|
|
528
|
+
return t({ uScrollBarReturn: o }), (E, b) => (T(), de(ve, null, {
|
|
522
529
|
default: fe(() => [
|
|
523
|
-
|
|
530
|
+
Fe(R("div", {
|
|
524
531
|
ref_key: "sliderRef",
|
|
525
532
|
ref: r,
|
|
526
533
|
class: "slider-wrapper",
|
|
534
|
+
onMouseenter: i,
|
|
535
|
+
onMouseleave: u,
|
|
527
536
|
style: te(w(f))
|
|
528
537
|
}, [
|
|
529
|
-
ee(
|
|
538
|
+
ee(E.$slots, "default", {}, () => [
|
|
530
539
|
ft
|
|
531
540
|
], !0)
|
|
532
|
-
],
|
|
533
|
-
[De, w(
|
|
541
|
+
], 36), [
|
|
542
|
+
[De, w(p)]
|
|
534
543
|
])
|
|
535
544
|
]),
|
|
536
545
|
_: 3
|
|
@@ -542,9 +551,9 @@ const Ee = (e, t) => {
|
|
|
542
551
|
for (const [n, r] of t)
|
|
543
552
|
l[n] = r;
|
|
544
553
|
return l;
|
|
545
|
-
}, Ot = /* @__PURE__ */ Ee(pt, [["__scopeId", "data-v-
|
|
554
|
+
}, Ot = /* @__PURE__ */ Ee(pt, [["__scopeId", "data-v-edec7292"]]), ht = { class: "virtualListWrapper" }, gt = {
|
|
546
555
|
inheritAttrs: !1
|
|
547
|
-
}, mt = /* @__PURE__ */
|
|
556
|
+
}, mt = /* @__PURE__ */ K({
|
|
548
557
|
...gt,
|
|
549
558
|
__name: "VirtualList",
|
|
550
559
|
props: {
|
|
@@ -554,7 +563,7 @@ const Ee = (e, t) => {
|
|
|
554
563
|
},
|
|
555
564
|
emits: ["scrollEnd"],
|
|
556
565
|
setup(e, { expose: t, emit: l }) {
|
|
557
|
-
const n = e, r = st(
|
|
566
|
+
const n = e, r = st(Ve(n, "data"), {
|
|
558
567
|
itemHeight: (v) => n.itemHeight(n.data[v]),
|
|
559
568
|
overscan: n.overscan,
|
|
560
569
|
scrollEndHook: () => {
|
|
@@ -564,14 +573,14 @@ const Ee = (e, t) => {
|
|
|
564
573
|
return t({
|
|
565
574
|
vListReturn: r
|
|
566
575
|
}), (v, p) => (T(), B("div", ht, [
|
|
567
|
-
R("div",
|
|
576
|
+
R("div", Ke({
|
|
568
577
|
onScrollPassive: p[0] || (p[0] = (...i) => w(o).onScroll && w(o).onScroll(...i)),
|
|
569
578
|
ref: w(o).ref,
|
|
570
579
|
class: "virtualList"
|
|
571
580
|
}, v.$attrs), [
|
|
572
581
|
R("div", le(ne(w(d))), [
|
|
573
582
|
R("div", le(ne(w(g))), [
|
|
574
|
-
(T(!0), B(
|
|
583
|
+
(T(!0), B(je, null, ze(w(s), ({ index: i, data: u }) => (T(), B("div", {
|
|
575
584
|
key: i,
|
|
576
585
|
style: te({
|
|
577
586
|
height: `${w(f)(i).height}px`,
|
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 Z;const B=typeof window<"u";B&&((Z=window?.navigator)==null?void 0:Z.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function A(t){return typeof t=="function"?t():e.unref(t)}function ce(t,l){function n(...o){t(()=>l.apply(this,o),{fn:l,thisArg:this,args:o})}return n}function ue(t,l={}){let n,o;return s=>{const r=A(t),f=A(l.maxWait);if(n&&clearTimeout(n),r<=0||f!==void 0&&f<=0)return o&&(clearTimeout(o),o=null),s();f&&!o&&(o=setTimeout(()=>{n&&clearTimeout(n),o=null,s()},f)),n=setTimeout(()=>{o&&clearTimeout(o),o=null,s()},r)}}function de(t){return t}function fe(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function ee(t,l=200,n={}){return ce(ue(l,n),t)}function pe(t,l=!0){e.getCurrentInstance()?e.onMounted(t):l?t():e.nextTick(t)}function te(t){var l;const n=A(t);return(l=n?.$el)!=null?l:n}const he=B?window:void 0;B&&window.document,B&&window.navigator,B&&window.location;function me(t,l=!1){const n=e.ref(),o=()=>n.value=Boolean(t());return o(),pe(o,l),n}const $=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},L="__vueuse_ssr_handlers__";$[L]=$[L]||{},$[L];var le=Object.getOwnPropertySymbols,ge=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable,ye=(t,l)=>{var n={};for(var o in t)ge.call(t,o)&&l.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&le)for(var o of le(t))l.indexOf(o)<0&&ve.call(t,o)&&(n[o]=t[o]);return n};function be(t,l,n={}){const o=n,{window:i=he}=o,s=ye(o,["window"]);let r;const f=me(()=>i&&"ResizeObserver"in i),v=()=>{r&&(r.disconnect(),r=void 0)},m=e.watch(()=>te(t),g=>{v(),f.value&&i&&g&&(r=new ResizeObserver(l),r.observe(g,s))},{immediate:!0,flush:"post"}),p=()=>{v(),m()};return fe(p),{isSupported:f,stop:p}}function _e(t,l={width:0,height:0},n={}){const{box:o="content-box"}=n,i=e.ref(l.width),s=e.ref(l.height);return be(t,([r])=>{const f=o==="border-box"?r.borderBoxSize:o==="content-box"?r.contentBoxSize:r.devicePixelContentBoxSize;f?(i.value=f.reduce((v,{inlineSize:m})=>v+m,0),s.value=f.reduce((v,{blockSize:m})=>v+m,0)):(i.value=r.contentRect.width,s.value=r.contentRect.height)},n),e.watch(()=>te(t),r=>{i.value=r?l.width:0,s.value=r?l.height:0}),{width:i,height:s}}var ne;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(ne||(ne={}));var Se=Object.defineProperty,oe=Object.getOwnPropertySymbols,we=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,re=(t,l,n)=>l in t?Se(t,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[l]=n,Ee=(t,l)=>{for(var n in l||(l={}))we.call(l,n)&&re(t,n,l[n]);if(oe)for(var n of oe(l))Oe.call(l,n)&&re(t,n,l[n]);return t};Ee({linear:de},{easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]});function ie(t,l){const{scrollEndHook:n,itemHeight:o,overscan:i=5}=l,s=e.ref(),r=_e(s),f=e.ref(!0),v=ee(W,100);let m;const p=e.shallowRef(t),g=e.ref(0),c=e.ref({start:0,end:10});let u=0;const O=e.ref([]),b=e.computed(()=>{let{sum:a,height:d}={sum:0,height:0};return p.value.map((S,_)=>(typeof o=="number"?d=o:d=o(_),a+=d,{height:d,sum:a}))}),U=e.computed(()=>R(c.value.start)),E=e.computed(()=>typeof o=="number"?b.value.length*o:b.value[b.value.length-1]?.sum||0),H=e.computed(()=>{let a=O.value.length-i,d=Math.max(a-u,0);return O.value.slice(d,a)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(m)),e.watch([r.width,r.height,p],([a,d])=>{(a||d)&&C()},{deep:!0}),e.watch(g,()=>{T(),v()});function T(){f.value=!1}function W(){f.value=!0,n?.()}function C(){cancelAnimationFrame(m),m=requestAnimationFrame(P)}function P(){if(s.value){g.value=s.value.scrollTop,u=I();let a=q(g.value),d=a+u+i;a=a-i,a=a<0?0:a,d=d>p.value.length?p.value.length:d,c.value={start:a,end:d},O.value=p.value.slice(a,d).map((S,_)=>({data:S,index:_+a}))}}function q(a){let d=Math.floor(b.value.length/16),S=-1,_=-1;for(let y=0;y<16;y++){if(b.value[d*y].sum>=a){S=Math.max(0,y-1);break}y===15&&(S=y)}S*=d;for(let y=S;y<b.value.length;y++)if(b.value[y].sum>=a){_=y;break}return Math.max(0,_)}function I(){let a=0,d=0,S=Y();for(let _=S;_<b.value.length&&(a++,d+=b.value[_].height,!(d>=r.height.value));_++);return a}function R(a){if(typeof o=="number")return a*o;let d=b.value[a];return d?d.sum-d.height:0}function x(a){return b.value[a]||{sum:0,height:0}}function Y(){let a=c.value.start;return a>=i&&(a+=i),a}function G(a){if(s.value){const d=x(a);s.value.scrollTop=d.sum-d.height,P()}}const J=e.computed(()=>({style:{width:"100%",height:`${E.value}px`,pointerEvents:f.value?void 0:"none"}})),k=e.computed(()=>({style:{transform:`translate3d(0, ${U.value}px, 0)`,"will-change":"transform"}})),X={overflowY:"auto"};return{list:O,visiableList:H,getItemHeightData:x,totalHeight:E,clientHeight:r.height,scrollTo:G,scrollTop:g,isScrollEnd:f,containerProps:{ref:s,onScroll:()=>{C()},style:X},wrapperProps:J,innerProps:k}}const j=Symbol(),K=Symbol(),V=Symbol(),F=Symbol(),D=Symbol(),N=Symbol(),M=Symbol(),z=Symbol(),Q=Symbol();function Be(){const{voidFn:t,boolFn:l,boolRef:n,arrayRef:o}={voidFn:u=>{},boolFn:u=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},i=e.inject(F,o),s=e.inject(V,l),r=e.inject(z,n),f=e.inject(K,t),v=e.inject(j,t),m=e.inject(D,t),p=e.inject(N,t),g=e.inject(M,t),c=e.inject(Q,t);return{selected:i,isSelected:s,isAllSelected:r,toggle:f,toggleAll:v,select:m,selectAll:p,unselect:g,unselectAll:c}}function Ie(t,l){const n=e.ref({}),o=e.computed(()=>t.value.filter(c=>n.value[c[l]])),i=e.computed(()=>o.value.length!=0&&Object.keys(n.value).length==t.value.length);function s(){t.value.forEach(c=>{n.value[c[l]]=!0})}function r(){n.value={}}function f(c){c.forEach(u=>{n.value[u[l]]||(n.value[u[l]]=!0)})}function v(c){c.forEach(u=>{n.value[u[l]]&&delete n.value[u[l]]})}function m(c){return!!n.value[c[l]]}function p(c){c.forEach(u=>{m(u)?delete n.value[u[l]]:n.value[u[l]]=!0})}function g(){i.value?r():s()}return e.provide(j,g),e.provide(K,p),e.provide(V,m),e.provide(F,o),e.provide(D,f),e.provide(N,s),e.provide(M,v),e.provide(z,i),e.provide(Q,r),{selected:o,select:f,selectAll:s,unselect:v,unselectAll:r,toggle:p,toggleAll:g,isSelected:m,isAllSelected:i}}const ae=Symbol(),He=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0},dialogClass:{default:""}},emits:["update:visiable"],setup(t,{emit:l}){const n=t,o=()=>{n.closeOnClickOverlay&&l("update:visiable",!1)};return e.provide(ae,()=>l("update:visiable",!1)),(i,s)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[t.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:o,class:"modal absolute inset-0 bottom-0 z-50 flex bg-stone-900 bg-opacity-50"},[e.createElementVNode("div",{onClick:s[0]||(s[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog m-auto flex flex-col",t.dialogClass])},[e.renderSlot(i.$slots,"default")],2)])):e.createCommentVNode("",!0)]),_:3}))}});function Te(t){function l(n,o){const i=document.createElement("div"),s={setup(){return()=>e.h(He,{visiable:!0,"onUpdate:visiable":()=>{i?.remove()},...t},{default:()=>e.h(n,o)})}};return document.body.appendChild(i),e.render(e.h(s),i),{close:()=>i?.remove()}}return{create:l}}const Ce=["xlink:href","fill","color"],Pe=e.defineComponent({__name:"SvgIcon",props:{name:null,prefix:{default:"icon"},color:{default:"#FFF"},width:null,height:null},setup(t){const l=t,n=e.computed(()=>`#${l.prefix}-${l.name}`),o=e.computed(()=>({width:`${l.width}px`,height:`${l.height}px`,aspectRatio:l.width&&l.height?void 0:"1/1"}));return(i,s)=>(e.openBlock(),e.createElementBlock("svg",{"aria-hidden":"",style:e.normalizeStyle(e.unref(o))},[e.createElementVNode("use",{"xlink:href":e.unref(n),fill:t.color,color:t.color},null,8,Ce)],4))}});function Re(t){const{containerEl:l,sliderEl:n,autoHeight:o,performance:i={},maxHeightRatio:s=.9}=t,r=e.ref(!0),f=ee(R,100);let v,m="";const p=e.ref(0),g=e.ref(0),c=e.ref(0),u=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),O=e.ref({clientHeight:0}),b=e.computed(()=>!!g.value),U=e.computed(()=>u.value.scrollHeight>u.value.clientHeight),E=e.computed(()=>u.value.clientHeight-O.value.clientHeight),H=e.computed(()=>u.value.scrollHeight-u.value.clientHeight),T=e.computed(()=>Math.max(u.value.clientHeight/u.value.scrollHeight,.05)),W=e.computed(()=>T.value>s?0:T.value*u.value.clientHeight),C=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${c.value}px,0)`,height:o?`${W.value}px`:void 0}));function P(y){I(),g.value=y.clientY-n.value.getBoundingClientRect().top||1,m=getComputedStyle(l.value).scrollBehavior,m==="smooth"&&(l.value.style.scrollBehavior="unset")}function q(){l.value.style.scrollBehavior=m,g.value=0,f()}function I(){r.value=!1}function R(){b.value||(r.value=!0)}function x(y){if(!b.value)return;let w=y.clientY-u.value.top-g.value;w<0?c.value=0:w>=E.value?c.value=E.value:c.value=w,l.value.scrollTo({top:c.value/E.value*H.value})}function Y(){b.value||G()}function G(){cancelAnimationFrame(v),v=requestAnimationFrame(J)}function J(){l.value&&(p.value=i.scrollTop?.value??l.value.scrollTop,c.value=p.value/H.value*E.value)}function k(y){let w="addEventListener";y==="add"?w="addEventListener":w="removeEventListener",n.value?.[w]("pointerdown",P,{passive:!0}),window[w]("pointermove",x,{passive:!0}),window[w]("pointerup",q,{passive:!0})}const X=new MutationObserver(y=>{y.map(Ve=>Ve.oldValue).join().includes("height")&&a()});function a(){u.value.top=l.value?.getBoundingClientRect().top??0,u.value.scrollHeight=l.value?.scrollHeight??0,u.value.clientHeight=l.value?.clientHeight??0}function d(){I(),setTimeout(()=>{O.value.clientHeight=n.value?.clientHeight??0,R()},150)}function S(){document.styleSheets[0].insertRule(".hide-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }",0),document.styleSheets[0].insertRule(".hide-scrollbar::-webkit-scrollbar{ display: none }",0),l.value?.classList.add("hide-scrollbar")}function _(){l.value&&n.value?(S(),l.value.addEventListener("scroll",Y,{passive:!0}),k("add"),X.observe(l.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{a()},100),d()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:l,sliderEl:n})}return e.watch(p,()=>{I(),f()}),{isScrollEnd:r,isDragSlider:b,scrollable:U,sliderPos:C,init:_,modifySliderEventListener:k}}const xe=(t=>(e.pushScopeId("data-v-e4f66100"),t=t(),e.popScopeId(),t))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),ke=e.defineComponent({__name:"ScrollBar",props:{containerEl:null,autoHide:{type:Boolean},autoHeight:{type:Boolean},performance:null},setup(t,{expose:l}){const n=t,o=!!e.useSlots().default,i=e.ref(null),s=e.computed(()=>n.containerEl),r=Re({containerEl:s,sliderEl:i,autoHeight:o?n.autoHeight:!0,performance:n.performance}),{scrollable:f,isScrollEnd:v,sliderPos:m}=r,p=n.autoHide?e.computed(()=>!v.value):e.computed(()=>f.value);return e.onMounted(()=>{e.nextTick(()=>{r.init()})}),e.onUnmounted(()=>{r.modifySliderEventListener("remove")}),l({uScrollBarReturn:r}),(g,c)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"sliderRef",ref:i,class:"slider-wrapper",style:e.normalizeStyle(e.unref(m))},[e.renderSlot(g.$slots,"default",{},()=>[xe],!0)],4),[[e.vShow,e.unref(p)]])]),_:3}))}}),Ne="",se=(t,l)=>{const n=t.__vccOpts||t;for(const[o,i]of l)n[o]=i;return n},Ae=se(ke,[["__scopeId","data-v-e4f66100"]]),$e={class:"virtualListWrapper"},Le={inheritAttrs:!1},je=e.defineComponent({...Le,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},emits:["scrollEnd"],setup(t,{expose:l,emit:n}){const o=t,i=ie(e.toRef(o,"data"),{itemHeight:p=>o.itemHeight(o.data[p]),overscan:o.overscan,scrollEndHook:()=>{n("scrollEnd")}}),{list:s,containerProps:r,wrapperProps:f,innerProps:v,getItemHeightData:m}=i;return l({vListReturn:i}),(p,g)=>(e.openBlock(),e.createElementBlock("div",$e,[e.createElementVNode("div",e.mergeProps({onScrollPassive:g[0]||(g[0]=(...c)=>e.unref(r).onScroll&&e.unref(r).onScroll(...c)),ref:e.unref(r).ref,class:"virtualList"},p.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(f))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(v))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),({index:c,data:u})=>(e.openBlock(),e.createElementBlock("div",{key:c,style:e.normalizeStyle({height:`${e.unref(m)(c).height}px`,display:"flex"})},[e.renderSlot(p.$slots,"default",{data:u,index:c},void 0,!0)],4))),128))],16)],16)],16)]))}}),Me="",Ke=se(je,[["__scopeId","data-v-4ba97cce"]]);h.ScrollBar=Ae,h.SvgIcon=Pe,h.VirtualList=Ke,h.allSelectedKey=F,h.closeDialogKey=ae,h.dialogController=Te,h.isAllSelectedKey=z,h.isSelectedKey=V,h.selectAllKey=N,h.selectKey=D,h.toggleAllKey=j,h.toggleKey=K,h.unselectAllKey=Q,h.unselectKey=M,h.useSelectable=Ie,h.useSelectableInjectors=Be,h.useVirtualList=ie,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(h,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(h=typeof globalThis<"u"?globalThis:h||self,e(h.ui={},h.Vue))})(this,function(h,e){"use strict";var Z;const B=typeof window<"u";B&&((Z=window?.navigator)==null?void 0:Z.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function A(t){return typeof t=="function"?t():e.unref(t)}function ce(t,l){function n(...o){t(()=>l.apply(this,o),{fn:l,thisArg:this,args:o})}return n}function ue(t,l={}){let n,o;return s=>{const r=A(t),f=A(l.maxWait);if(n&&clearTimeout(n),r<=0||f!==void 0&&f<=0)return o&&(clearTimeout(o),o=null),s();f&&!o&&(o=setTimeout(()=>{n&&clearTimeout(n),o=null,s()},f)),n=setTimeout(()=>{o&&clearTimeout(o),o=null,s()},r)}}function de(t){return t}function fe(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function ee(t,l=200,n={}){return ce(ue(l,n),t)}function pe(t,l=!0){e.getCurrentInstance()?e.onMounted(t):l?t():e.nextTick(t)}function te(t){var l;const n=A(t);return(l=n?.$el)!=null?l:n}const he=B?window:void 0;B&&window.document,B&&window.navigator,B&&window.location;function me(t,l=!1){const n=e.ref(),o=()=>n.value=Boolean(t());return o(),pe(o,l),n}const L=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},$="__vueuse_ssr_handlers__";L[$]=L[$]||{},L[$];var le=Object.getOwnPropertySymbols,ge=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable,ye=(t,l)=>{var n={};for(var o in t)ge.call(t,o)&&l.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&le)for(var o of le(t))l.indexOf(o)<0&&ve.call(t,o)&&(n[o]=t[o]);return n};function be(t,l,n={}){const o=n,{window:i=he}=o,s=ye(o,["window"]);let r;const f=me(()=>i&&"ResizeObserver"in i),v=()=>{r&&(r.disconnect(),r=void 0)},m=e.watch(()=>te(t),g=>{v(),f.value&&i&&g&&(r=new ResizeObserver(l),r.observe(g,s))},{immediate:!0,flush:"post"}),p=()=>{v(),m()};return fe(p),{isSupported:f,stop:p}}function _e(t,l={width:0,height:0},n={}){const{box:o="content-box"}=n,i=e.ref(l.width),s=e.ref(l.height);return be(t,([r])=>{const f=o==="border-box"?r.borderBoxSize:o==="content-box"?r.contentBoxSize:r.devicePixelContentBoxSize;f?(i.value=f.reduce((v,{inlineSize:m})=>v+m,0),s.value=f.reduce((v,{blockSize:m})=>v+m,0)):(i.value=r.contentRect.width,s.value=r.contentRect.height)},n),e.watch(()=>te(t),r=>{i.value=r?l.width:0,s.value=r?l.height:0}),{width:i,height:s}}var ne;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(ne||(ne={}));var Se=Object.defineProperty,oe=Object.getOwnPropertySymbols,we=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,re=(t,l,n)=>l in t?Se(t,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[l]=n,Ee=(t,l)=>{for(var n in l||(l={}))we.call(l,n)&&re(t,n,l[n]);if(oe)for(var n of oe(l))Oe.call(l,n)&&re(t,n,l[n]);return t};Ee({linear:de},{easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]});function ie(t,l){const{scrollEndHook:n,itemHeight:o,overscan:i=5}=l,s=e.ref(),r=_e(s),f=e.ref(!0),v=ee(W,100);let m;const p=e.shallowRef(t),g=e.ref(0),c=e.ref({start:0,end:10});let u=0;const O=e.ref([]),b=e.computed(()=>{let{sum:a,height:d}={sum:0,height:0};return p.value.map((S,_)=>(typeof o=="number"?d=o:d=o(_),a+=d,{height:d,sum:a}))}),U=e.computed(()=>R(c.value.start)),E=e.computed(()=>typeof o=="number"?b.value.length*o:b.value[b.value.length-1]?.sum||0),I=e.computed(()=>{let a=O.value.length-i,d=Math.max(a-u,0);return O.value.slice(d,a)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(m)),e.watch([r.width,r.height,p],([a,d])=>{(a||d)&&C()},{deep:!0}),e.watch(g,()=>{T(),v()});function T(){f.value=!1}function W(){f.value=!0,n?.()}function C(){cancelAnimationFrame(m),m=requestAnimationFrame(P)}function P(){if(s.value){g.value=s.value.scrollTop,u=H();let a=q(g.value),d=a+u+i;a=a-i,a=a<0?0:a,d=d>p.value.length?p.value.length:d,c.value={start:a,end:d},O.value=p.value.slice(a,d).map((S,_)=>({data:S,index:_+a}))}}function q(a){let d=Math.floor(b.value.length/16),S=-1,_=-1;for(let y=0;y<16;y++){if(b.value[d*y].sum>=a){S=Math.max(0,y-1);break}y===15&&(S=y)}S*=d;for(let y=S;y<b.value.length;y++)if(b.value[y].sum>=a){_=y;break}return Math.max(0,_)}function H(){let a=0,d=0,S=Y();for(let _=S;_<b.value.length&&(a++,d+=b.value[_].height,!(d>=r.height.value));_++);return a}function R(a){if(typeof o=="number")return a*o;let d=b.value[a];return d?d.sum-d.height:0}function x(a){return b.value[a]||{sum:0,height:0}}function Y(){let a=c.value.start;return a>=i&&(a+=i),a}function G(a){if(s.value){const d=x(a);s.value.scrollTop=d.sum-d.height,P()}}const J=e.computed(()=>({style:{width:"100%",height:`${E.value}px`,pointerEvents:f.value?void 0:"none"}})),k=e.computed(()=>({style:{transform:`translate3d(0, ${U.value}px, 0)`,"will-change":"transform"}})),X={overflowY:"auto"};return{list:O,visiableList:I,getItemHeightData:x,totalHeight:E,clientHeight:r.height,scrollTo:G,scrollTop:g,isScrollEnd:f,containerProps:{ref:s,onScroll:()=>{C()},style:X},wrapperProps:J,innerProps:k}}const j=Symbol(),K=Symbol(),V=Symbol(),F=Symbol(),D=Symbol(),M=Symbol(),N=Symbol(),z=Symbol(),Q=Symbol();function Be(){const{voidFn:t,boolFn:l,boolRef:n,arrayRef:o}={voidFn:u=>{},boolFn:u=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},i=e.inject(F,o),s=e.inject(V,l),r=e.inject(z,n),f=e.inject(K,t),v=e.inject(j,t),m=e.inject(D,t),p=e.inject(M,t),g=e.inject(N,t),c=e.inject(Q,t);return{selected:i,isSelected:s,isAllSelected:r,toggle:f,toggleAll:v,select:m,selectAll:p,unselect:g,unselectAll:c}}function He(t,l){const n=e.ref({}),o=e.computed(()=>t.value.filter(c=>n.value[c[l]])),i=e.computed(()=>o.value.length!=0&&Object.keys(n.value).length==t.value.length);function s(){t.value.forEach(c=>{n.value[c[l]]=!0})}function r(){n.value={}}function f(c){c.forEach(u=>{n.value[u[l]]||(n.value[u[l]]=!0)})}function v(c){c.forEach(u=>{n.value[u[l]]&&delete n.value[u[l]]})}function m(c){return!!n.value[c[l]]}function p(c){c.forEach(u=>{m(u)?delete n.value[u[l]]:n.value[u[l]]=!0})}function g(){i.value?r():s()}return e.provide(j,g),e.provide(K,p),e.provide(V,m),e.provide(F,o),e.provide(D,f),e.provide(M,s),e.provide(N,v),e.provide(z,i),e.provide(Q,r),{selected:o,select:f,selectAll:s,unselect:v,unselectAll:r,toggle:p,toggleAll:g,isSelected:m,isAllSelected:i}}const ae=Symbol(),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(ae,()=>l("update:visiable",!1)),(i,s)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[t.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:o,class:"modal absolute inset-0 bottom-0 z-50 flex bg-stone-900 bg-opacity-50"},[e.createElementVNode("div",{onClick:s[0]||(s[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog m-auto flex flex-col",t.dialogClass])},[e.renderSlot(i.$slots,"default")],2)])):e.createCommentVNode("",!0)]),_:3}))}});function Te(t){function l(n,o){const i=document.createElement("div"),s={setup(){return()=>e.h(Ie,{visiable:!0,"onUpdate:visiable":()=>{i?.remove()},...t},{default:()=>e.h(n,o)})}};return document.body.appendChild(i),e.render(e.h(s),i),{close:()=>i?.remove()}}return{create:l}}const Ce=["xlink:href","fill","color"],Pe=e.defineComponent({__name:"SvgIcon",props:{name:null,prefix:{default:"icon"},color:{default:"#FFF"},width:null,height:null},setup(t){const l=t,n=e.computed(()=>`#${l.prefix}-${l.name}`),o=e.computed(()=>({width:`${l.width}px`,height:`${l.height}px`,aspectRatio:l.width&&l.height?void 0:"1/1"}));return(i,s)=>(e.openBlock(),e.createElementBlock("svg",{"aria-hidden":"",style:e.normalizeStyle(e.unref(o))},[e.createElementVNode("use",{"xlink:href":e.unref(n),fill:t.color,color:t.color},null,8,Ce)],4))}});function Re(t){const{containerEl:l,sliderEl:n,autoHeight:o,performance:i={},maxHeightRatio:s=.9}=t,r=e.ref(!0),f=ee(R,100);let v,m="";const p=e.ref(0),g=e.ref(0),c=e.ref(0),u=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),O=e.ref({clientHeight:0}),b=e.computed(()=>!!g.value),U=e.computed(()=>u.value.scrollHeight>u.value.clientHeight),E=e.computed(()=>u.value.clientHeight-O.value.clientHeight),I=e.computed(()=>u.value.scrollHeight-u.value.clientHeight),T=e.computed(()=>Math.max(u.value.clientHeight/u.value.scrollHeight,.05)),W=e.computed(()=>T.value>s?0:T.value*u.value.clientHeight),C=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${c.value}px,0)`,height:o?`${W.value}px`:void 0}));function P(y){H(),g.value=y.clientY-n.value.getBoundingClientRect().top||1,m=getComputedStyle(l.value).scrollBehavior,m==="smooth"&&(l.value.style.scrollBehavior="unset")}function q(){l.value.style.scrollBehavior=m,g.value=0,f()}function H(){r.value=!1}function R(){b.value||(r.value=!0)}function x(y){if(!b.value)return;let w=y.clientY-u.value.top-g.value;w<0?c.value=0:w>=E.value?c.value=E.value:c.value=w,l.value.scrollTo({top:c.value/E.value*I.value})}function Y(){b.value||G()}function G(){cancelAnimationFrame(v),v=requestAnimationFrame(J)}function J(){l.value&&(p.value=i.scrollTop?.value??l.value.scrollTop,c.value=p.value/I.value*E.value)}function k(y){let w="addEventListener";y==="add"?w="addEventListener":w="removeEventListener",n.value?.[w]("pointerdown",P,{passive:!0}),window[w]("pointermove",x,{passive:!0}),window[w]("pointerup",q,{passive:!0})}const X=new MutationObserver(y=>{y.map(Ve=>Ve.oldValue).join().includes("height")&&a()});function a(){u.value.top=l.value?.getBoundingClientRect().top??0,u.value.scrollHeight=l.value?.scrollHeight??0,u.value.clientHeight=l.value?.clientHeight??0}function d(){H(),setTimeout(()=>{O.value.clientHeight=n.value?.clientHeight??0,R()},150)}function S(){document.styleSheets[0].insertRule(".hide-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }",0),document.styleSheets[0].insertRule(".hide-scrollbar::-webkit-scrollbar{ display: none }",0),l.value?.classList.add("hide-scrollbar")}function _(){l.value&&n.value?(S(),l.value.addEventListener("scroll",Y,{passive:!0}),k("add"),X.observe(l.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{a()},100),d()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:l,sliderEl:n})}return e.watch(p,()=>{H(),f()}),{isScrollEnd:r,isDragSlider:b,scrollable:U,sliderPos:C,init:_,modifySliderEventListener:k}}const xe=(t=>(e.pushScopeId("data-v-edec7292"),t=t(),e.popScopeId(),t))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),ke=e.defineComponent({__name:"ScrollBar",props:{containerEl:null,autoHide:{type:Boolean},autoHeight:{type:Boolean},performance:null},setup(t,{expose:l}){const n=t,o=!!e.useSlots().default,i=e.ref(null),s=e.computed(()=>n.containerEl),r=Re({containerEl:s,sliderEl:i,autoHeight:o?n.autoHeight:!0,performance:n.performance}),{scrollable:f,isScrollEnd:v,sliderPos:m}=r,p=e.ref(!1),g=n.autoHide?e.computed(()=>p.value||!v.value):e.computed(()=>f.value);e.onMounted(()=>{e.nextTick(()=>{r.init()})}),e.onUnmounted(()=>{r.modifySliderEventListener("remove")});function c(){p.value=!0}function u(){p.value=!1}return l({uScrollBarReturn:r}),(O,b)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"sliderRef",ref:i,class:"slider-wrapper",onMouseenter:c,onMouseleave:u,style:e.normalizeStyle(e.unref(m))},[e.renderSlot(O.$slots,"default",{},()=>[xe],!0)],36),[[e.vShow,e.unref(g)]])]),_:3}))}}),Me="",se=(t,l)=>{const n=t.__vccOpts||t;for(const[o,i]of l)n[o]=i;return n},Ae=se(ke,[["__scopeId","data-v-edec7292"]]),Le={class:"virtualListWrapper"},$e={inheritAttrs:!1},je=e.defineComponent({...$e,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},emits:["scrollEnd"],setup(t,{expose:l,emit:n}){const o=t,i=ie(e.toRef(o,"data"),{itemHeight:p=>o.itemHeight(o.data[p]),overscan:o.overscan,scrollEndHook:()=>{n("scrollEnd")}}),{list:s,containerProps:r,wrapperProps:f,innerProps:v,getItemHeightData:m}=i;return l({vListReturn:i}),(p,g)=>(e.openBlock(),e.createElementBlock("div",Le,[e.createElementVNode("div",e.mergeProps({onScrollPassive:g[0]||(g[0]=(...c)=>e.unref(r).onScroll&&e.unref(r).onScroll(...c)),ref:e.unref(r).ref,class:"virtualList"},p.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(f))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(v))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),({index:c,data:u})=>(e.openBlock(),e.createElementBlock("div",{key:c,style:e.normalizeStyle({height:`${e.unref(m)(c).height}px`,display:"flex"})},[e.renderSlot(p.$slots,"default",{data:u,index:c},void 0,!0)],4))),128))],16)],16)],16)]))}}),Ne="",Ke=se(je,[["__scopeId","data-v-4ba97cce"]]);h.ScrollBar=Ae,h.SvgIcon=Pe,h.VirtualList=Ke,h.allSelectedKey=F,h.closeDialogKey=ae,h.dialogController=Te,h.isAllSelectedKey=z,h.isSelectedKey=V,h.selectAllKey=M,h.selectKey=D,h.toggleAllKey=j,h.toggleKey=K,h.unselectAllKey=Q,h.unselectKey=N,h.useSelectable=He,h.useSelectableInjectors=Be,h.useVirtualList=ie,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.v-leave-active[data-v-
|
|
1
|
+
.v-leave-active[data-v-edec7292]{transition:all .15s ease-out;transition-delay:.9s}.v-leave-to[data-v-edec7292]{opacity:0}.slider-wrapper[data-v-edec7292]{z-index:100;position:absolute;right:0;touch-action:none}.default-slider[data-v-edec7292]{width:6px;height:100%;background-color:#0003;border-radius:3px;margin-right:3px}.virtualList[data-v-4ba97cce]{width:100%;height:100%;position:absolute;overflow-y:auto;scroll-behavior:smooth;user-select:none}.virtualListWrapper[data-v-4ba97cce]{width:100%;height:100%;position:relative}
|