@lazycatcloud/lzc-toolkit 0.0.24 → 0.0.25
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 +66 -66
- 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 w, getCurrentScope as xe, onScopeDispose as He, getCurrentInstance as Ie, onMounted as Y, nextTick as
|
|
1
|
+
import { unref as w, getCurrentScope as xe, onScopeDispose as He, getCurrentInstance as Ie, onMounted as Y, nextTick as re, ref as b, watch as R, shallowRef as Ee, computed as p, onUnmounted as ae, inject as x, provide as O, defineComponent as L, openBlock as T, createBlock as ie, Transition as se, withCtx as ue, createElementBlock as P, createElementVNode as C, withModifiers as Te, normalizeClass as Ce, renderSlot as G, createCommentVNode as Be, render as Pe, h as Q, normalizeStyle as J, useSlots as Re, withDirectives as Ae, vShow as $e, pushScopeId as Fe, popScopeId as Le, toRef as De, mergeProps as Ve, normalizeProps as X, guardReactiveProps as Z, Fragment as Ke, renderList as je } from "vue";
|
|
2
2
|
var ee;
|
|
3
3
|
const A = typeof window < "u";
|
|
4
4
|
A && ((ee = window?.navigator) == null ? void 0 : ee.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
@@ -13,14 +13,14 @@ function ke(e, l) {
|
|
|
13
13
|
}
|
|
14
14
|
function ze(e, l = {}) {
|
|
15
15
|
let t, n;
|
|
16
|
-
return (
|
|
16
|
+
return (a) => {
|
|
17
17
|
const i = W(e), u = W(l.maxWait);
|
|
18
18
|
if (t && clearTimeout(t), i <= 0 || u !== void 0 && u <= 0)
|
|
19
|
-
return n && (clearTimeout(n), n = null),
|
|
19
|
+
return n && (clearTimeout(n), n = null), a();
|
|
20
20
|
u && !n && (n = setTimeout(() => {
|
|
21
|
-
t && clearTimeout(t), n = null,
|
|
21
|
+
t && clearTimeout(t), n = null, a();
|
|
22
22
|
}, u)), t = setTimeout(() => {
|
|
23
|
-
n && clearTimeout(n), n = null,
|
|
23
|
+
n && clearTimeout(n), n = null, a();
|
|
24
24
|
}, i);
|
|
25
25
|
};
|
|
26
26
|
}
|
|
@@ -34,7 +34,7 @@ function Qe(e, l = 200, t = {}) {
|
|
|
34
34
|
return ke(ze(l, t), e);
|
|
35
35
|
}
|
|
36
36
|
function We(e, l = !0) {
|
|
37
|
-
Ie() ? Y(e) : l ? e() :
|
|
37
|
+
Ie() ? Y(e) : l ? e() : re(e);
|
|
38
38
|
}
|
|
39
39
|
function ce(e) {
|
|
40
40
|
var l;
|
|
@@ -62,12 +62,12 @@ var te = Object.getOwnPropertySymbols, Ye = Object.prototype.hasOwnProperty, Ge
|
|
|
62
62
|
return t;
|
|
63
63
|
};
|
|
64
64
|
function Xe(e, l, t = {}) {
|
|
65
|
-
const n = t, { window:
|
|
65
|
+
const n = t, { window: r = Ue } = n, a = Je(n, ["window"]);
|
|
66
66
|
let i;
|
|
67
|
-
const u = qe(() =>
|
|
67
|
+
const u = qe(() => r && "ResizeObserver" in r), f = () => {
|
|
68
68
|
i && (i.disconnect(), i = void 0);
|
|
69
69
|
}, d = R(() => ce(e), (v) => {
|
|
70
|
-
f(), u.value &&
|
|
70
|
+
f(), u.value && r && v && (i = new ResizeObserver(l), i.observe(v, a));
|
|
71
71
|
}, { immediate: !0, flush: "post" }), h = () => {
|
|
72
72
|
f(), d();
|
|
73
73
|
};
|
|
@@ -77,15 +77,15 @@ function Xe(e, l, t = {}) {
|
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
function Ze(e, l = { width: 0, height: 0 }, t = {}) {
|
|
80
|
-
const { box: n = "content-box" } = t,
|
|
80
|
+
const { box: n = "content-box" } = t, r = b(l.width), a = b(l.height);
|
|
81
81
|
return Xe(e, ([i]) => {
|
|
82
82
|
const u = n === "border-box" ? i.borderBoxSize : n === "content-box" ? i.contentBoxSize : i.devicePixelContentBoxSize;
|
|
83
|
-
u ? (
|
|
83
|
+
u ? (r.value = u.reduce((f, { inlineSize: d }) => f + d, 0), a.value = u.reduce((f, { blockSize: d }) => f + d, 0)) : (r.value = i.contentRect.width, a.value = i.contentRect.height);
|
|
84
84
|
}, t), R(() => ce(e), (i) => {
|
|
85
|
-
|
|
85
|
+
r.value = i ? l.width : 0, a.value = i ? l.height : 0;
|
|
86
86
|
}), {
|
|
87
|
-
width:
|
|
88
|
-
height:
|
|
87
|
+
width: r,
|
|
88
|
+
height: a
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
var le;
|
|
@@ -129,21 +129,21 @@ const ot = {
|
|
|
129
129
|
nt({
|
|
130
130
|
linear: Me
|
|
131
131
|
}, ot);
|
|
132
|
-
function
|
|
133
|
-
const { itemHeight: t, overscan: n = 5 } = l,
|
|
132
|
+
function rt(e, l) {
|
|
133
|
+
const { itemHeight: t, overscan: n = 5 } = l, r = b(), a = Ze(r);
|
|
134
134
|
let i;
|
|
135
135
|
const u = Ee(e), f = b(0), d = b({ start: 0, end: 10 });
|
|
136
136
|
let h = 0;
|
|
137
137
|
const v = b([]), o = p(() => {
|
|
138
138
|
let { sum: s, height: c } = { sum: 0, height: 0 };
|
|
139
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.
|
|
140
|
+
}), g = p(() => K(d.value.start)), H = p(() => typeof t == "number" ? o.value.length * t : o.value[o.value.length - 1]?.sum || 0), D = p(() => {
|
|
141
141
|
let s = v.value.length - n, c = Math.max(s - h, 0);
|
|
142
142
|
return v.value.slice(c, s);
|
|
143
143
|
});
|
|
144
144
|
Y(() => {
|
|
145
|
-
}),
|
|
146
|
-
[
|
|
145
|
+
}), ae(() => cancelAnimationFrame(i)), R(
|
|
146
|
+
[a.width, a.height, u],
|
|
147
147
|
([s, c]) => {
|
|
148
148
|
(s || c) && I();
|
|
149
149
|
},
|
|
@@ -153,8 +153,8 @@ function at(e, l) {
|
|
|
153
153
|
cancelAnimationFrame(i), i = requestAnimationFrame(B);
|
|
154
154
|
}
|
|
155
155
|
function B() {
|
|
156
|
-
if (
|
|
157
|
-
f.value =
|
|
156
|
+
if (r.value) {
|
|
157
|
+
f.value = r.value.scrollTop, h = $();
|
|
158
158
|
let s = V(f.value), c = s + h + n;
|
|
159
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
160
|
data: _,
|
|
@@ -165,7 +165,7 @@ function at(e, l) {
|
|
|
165
165
|
function V(s) {
|
|
166
166
|
let c = Math.floor(o.value.length / 16), _ = -1, y = -1;
|
|
167
167
|
for (let m = 0; m < 16; m++) {
|
|
168
|
-
if (o.value
|
|
168
|
+
if (o.value[c * m].sum >= s) {
|
|
169
169
|
_ = Math.max(0, m - 1);
|
|
170
170
|
break;
|
|
171
171
|
}
|
|
@@ -181,7 +181,7 @@ function at(e, l) {
|
|
|
181
181
|
}
|
|
182
182
|
function $() {
|
|
183
183
|
let s = 0, c = 0, _ = j();
|
|
184
|
-
for (let y = _; y < o.value.length && (s++, c += o.value[y].height, !(c >=
|
|
184
|
+
for (let y = _; y < o.value.length && (s++, c += o.value[y].height, !(c >= a.height.value)); y++)
|
|
185
185
|
;
|
|
186
186
|
return s;
|
|
187
187
|
}
|
|
@@ -192,16 +192,16 @@ function at(e, l) {
|
|
|
192
192
|
return c.sum - c.height;
|
|
193
193
|
}
|
|
194
194
|
function F(s) {
|
|
195
|
-
return o.value
|
|
195
|
+
return o.value[s] || { sum: 0, height: 0 };
|
|
196
196
|
}
|
|
197
197
|
function j() {
|
|
198
198
|
let s = d.value.start;
|
|
199
199
|
return s >= n && (s += n), s;
|
|
200
200
|
}
|
|
201
201
|
function k(s) {
|
|
202
|
-
if (
|
|
202
|
+
if (r.value) {
|
|
203
203
|
const c = F(s);
|
|
204
|
-
|
|
204
|
+
r.value.scrollTop = c.sum - c.height, B();
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
const z = p(() => ({
|
|
@@ -222,11 +222,11 @@ function at(e, l) {
|
|
|
222
222
|
visiableList: D,
|
|
223
223
|
getItemHeightData: F,
|
|
224
224
|
totalHeight: H,
|
|
225
|
-
clientHeight:
|
|
225
|
+
clientHeight: a.height,
|
|
226
226
|
scrollTo: k,
|
|
227
227
|
scrollTop: f,
|
|
228
228
|
containerProps: {
|
|
229
|
-
ref:
|
|
229
|
+
ref: r,
|
|
230
230
|
onScroll: () => {
|
|
231
231
|
I();
|
|
232
232
|
},
|
|
@@ -244,10 +244,10 @@ function mt() {
|
|
|
244
244
|
boolFn: (g) => !1,
|
|
245
245
|
boolRef: p(() => !1),
|
|
246
246
|
arrayRef: p(() => [])
|
|
247
|
-
},
|
|
247
|
+
}, r = x(pe, n), a = x(fe, l), i = x(be, t), u = x(ve, e), f = x(de, e), d = x(he, e), h = x(ge, e), v = x(me, e), o = x(_e, e);
|
|
248
248
|
return {
|
|
249
|
-
selected:
|
|
250
|
-
isSelected:
|
|
249
|
+
selected: r,
|
|
250
|
+
isSelected: a,
|
|
251
251
|
isAllSelected: i,
|
|
252
252
|
toggle: u,
|
|
253
253
|
toggleAll: f,
|
|
@@ -258,8 +258,8 @@ function mt() {
|
|
|
258
258
|
};
|
|
259
259
|
}
|
|
260
260
|
function bt(e, l) {
|
|
261
|
-
const t = b({}), n = p(() => e.value.filter((o) => t.value[o[l]])),
|
|
262
|
-
function
|
|
261
|
+
const t = b({}), n = p(() => e.value.filter((o) => t.value[o[l]])), r = p(() => n.value.length != 0 && Object.keys(t.value).length == e.value.length);
|
|
262
|
+
function a() {
|
|
263
263
|
e.value.forEach((o) => {
|
|
264
264
|
t.value[o[l]] = !0;
|
|
265
265
|
});
|
|
@@ -286,21 +286,21 @@ function bt(e, l) {
|
|
|
286
286
|
});
|
|
287
287
|
}
|
|
288
288
|
function v() {
|
|
289
|
-
|
|
289
|
+
r.value ? i() : a();
|
|
290
290
|
}
|
|
291
|
-
return O(de, v), O(ve, h), O(fe, d), O(pe, n), O(he, u), O(ge,
|
|
291
|
+
return O(de, v), O(ve, h), O(fe, d), O(pe, n), O(he, u), O(ge, a), O(me, f), O(be, r), O(_e, i), {
|
|
292
292
|
selected: n,
|
|
293
293
|
select: u,
|
|
294
|
-
selectAll:
|
|
294
|
+
selectAll: a,
|
|
295
295
|
unselect: f,
|
|
296
296
|
unselectAll: i,
|
|
297
297
|
toggle: h,
|
|
298
298
|
toggleAll: v,
|
|
299
299
|
isSelected: d,
|
|
300
|
-
isAllSelected:
|
|
300
|
+
isAllSelected: r
|
|
301
301
|
};
|
|
302
302
|
}
|
|
303
|
-
const
|
|
303
|
+
const at = Symbol(), it = /* @__PURE__ */ L({
|
|
304
304
|
__name: "Dialog",
|
|
305
305
|
props: {
|
|
306
306
|
visiable: { type: Boolean, default: !1 },
|
|
@@ -312,7 +312,7 @@ const rt = Symbol(), it = /* @__PURE__ */ L({
|
|
|
312
312
|
const t = e, n = () => {
|
|
313
313
|
t.closeOnClickOverlay && l("update:visiable", !1);
|
|
314
314
|
};
|
|
315
|
-
return O(
|
|
315
|
+
return O(at, () => l("update:visiable", !1)), (r, a) => (T(), ie(se, { name: "modal" }, {
|
|
316
316
|
default: ue(() => [
|
|
317
317
|
e.visiable ? (T(), P("div", {
|
|
318
318
|
key: 0,
|
|
@@ -320,11 +320,11 @@ const rt = Symbol(), it = /* @__PURE__ */ L({
|
|
|
320
320
|
class: "modal absolute inset-0 bottom-0 z-50 flex bg-stone-900 bg-opacity-50"
|
|
321
321
|
}, [
|
|
322
322
|
C("div", {
|
|
323
|
-
onClick:
|
|
323
|
+
onClick: a[0] || (a[0] = Te(() => {
|
|
324
324
|
}, ["stop"])),
|
|
325
325
|
class: Ce(["dialog m-auto flex flex-col", e.dialogClass])
|
|
326
326
|
}, [
|
|
327
|
-
G(
|
|
327
|
+
G(r.$slots, "default")
|
|
328
328
|
], 2)
|
|
329
329
|
])) : Be("", !0)
|
|
330
330
|
]),
|
|
@@ -334,14 +334,14 @@ const rt = Symbol(), it = /* @__PURE__ */ L({
|
|
|
334
334
|
});
|
|
335
335
|
function _t(e) {
|
|
336
336
|
function l(t, n) {
|
|
337
|
-
const
|
|
337
|
+
const r = document.createElement("div"), a = {
|
|
338
338
|
setup() {
|
|
339
339
|
return () => Q(
|
|
340
340
|
it,
|
|
341
341
|
{
|
|
342
342
|
visiable: !0,
|
|
343
343
|
"onUpdate:visiable": () => {
|
|
344
|
-
|
|
344
|
+
r?.remove();
|
|
345
345
|
},
|
|
346
346
|
...e
|
|
347
347
|
},
|
|
@@ -351,8 +351,8 @@ function _t(e) {
|
|
|
351
351
|
);
|
|
352
352
|
}
|
|
353
353
|
};
|
|
354
|
-
return document.body.appendChild(
|
|
355
|
-
close: () =>
|
|
354
|
+
return document.body.appendChild(r), Pe(Q(a), r), {
|
|
355
|
+
close: () => r?.remove()
|
|
356
356
|
};
|
|
357
357
|
}
|
|
358
358
|
return {
|
|
@@ -374,7 +374,7 @@ const st = ["xlink:href", "fill", "color"], yt = /* @__PURE__ */ L({
|
|
|
374
374
|
height: l.height,
|
|
375
375
|
aspectRatio: l.width && l.height ? void 0 : "1/1"
|
|
376
376
|
}));
|
|
377
|
-
return (
|
|
377
|
+
return (r, a) => (T(), P("svg", {
|
|
378
378
|
"aria-hidden": "",
|
|
379
379
|
style: J(w(n))
|
|
380
380
|
}, [
|
|
@@ -387,7 +387,7 @@ const st = ["xlink:href", "fill", "color"], yt = /* @__PURE__ */ L({
|
|
|
387
387
|
}
|
|
388
388
|
});
|
|
389
389
|
function ut(e) {
|
|
390
|
-
const { containerEl: l, sliderEl: t, autoHeight: n, performance:
|
|
390
|
+
const { containerEl: l, sliderEl: t, autoHeight: n, performance: r = {} } = e, a = b(!0), i = Qe(z, 1e3);
|
|
391
391
|
let u, f = "";
|
|
392
392
|
const d = b(0), h = b(0), v = b(0), o = b({
|
|
393
393
|
top: 0,
|
|
@@ -411,10 +411,10 @@ function ut(e) {
|
|
|
411
411
|
l.value.style.scrollBehavior = f, h.value = 0, i();
|
|
412
412
|
}
|
|
413
413
|
function k() {
|
|
414
|
-
|
|
414
|
+
a.value = !1;
|
|
415
415
|
}
|
|
416
416
|
function z() {
|
|
417
|
-
H.value || (
|
|
417
|
+
H.value || (a.value = !0);
|
|
418
418
|
}
|
|
419
419
|
function M(E) {
|
|
420
420
|
if (!H.value)
|
|
@@ -431,7 +431,7 @@ function ut(e) {
|
|
|
431
431
|
cancelAnimationFrame(u), u = requestAnimationFrame(c);
|
|
432
432
|
}
|
|
433
433
|
function c() {
|
|
434
|
-
l.value && (d.value =
|
|
434
|
+
l.value && (d.value = r.scrollTop?.value ?? l.value.scrollTop, v.value = d.value / B.value * I.value);
|
|
435
435
|
}
|
|
436
436
|
function _(E) {
|
|
437
437
|
let S = "addEventListener";
|
|
@@ -462,7 +462,7 @@ function ut(e) {
|
|
|
462
462
|
return R(d, () => {
|
|
463
463
|
k(), i();
|
|
464
464
|
}), {
|
|
465
|
-
isScrollEnd:
|
|
465
|
+
isScrollEnd: a,
|
|
466
466
|
isDragSlider: H,
|
|
467
467
|
scrollable: D,
|
|
468
468
|
sliderPos: K,
|
|
@@ -479,23 +479,23 @@ const ct = (e) => (Fe("data-v-9645dfb5"), e = e(), Le(), e), dt = /* @__PURE__ *
|
|
|
479
479
|
performance: null
|
|
480
480
|
},
|
|
481
481
|
setup(e, { expose: l }) {
|
|
482
|
-
const t = e, n = !!Re().default,
|
|
483
|
-
containerEl:
|
|
484
|
-
sliderEl:
|
|
482
|
+
const t = e, n = !!Re().default, r = b(null), a = p(() => t.containerEl), i = ut({
|
|
483
|
+
containerEl: a,
|
|
484
|
+
sliderEl: r,
|
|
485
485
|
autoHeight: n ? t.autoHeight : !0,
|
|
486
486
|
performance: t.performance
|
|
487
487
|
}), { scrollable: u, isScrollEnd: f, sliderPos: d } = i, h = t.autoHide ? p(() => !f.value) : p(() => u.value);
|
|
488
488
|
return Y(() => {
|
|
489
|
-
|
|
489
|
+
re(() => {
|
|
490
490
|
i.init();
|
|
491
491
|
});
|
|
492
|
-
}),
|
|
492
|
+
}), ae(() => {
|
|
493
493
|
i.modifySliderEventListener("remove");
|
|
494
494
|
}), l({ uScrollBarReturn: i }), (v, o) => (T(), ie(se, null, {
|
|
495
495
|
default: ue(() => [
|
|
496
496
|
Ae(C("div", {
|
|
497
497
|
ref_key: "sliderRef",
|
|
498
|
-
ref:
|
|
498
|
+
ref: r,
|
|
499
499
|
class: "slider-wrapper",
|
|
500
500
|
style: J(w(d))
|
|
501
501
|
}, [
|
|
@@ -512,8 +512,8 @@ const ct = (e) => (Fe("data-v-9645dfb5"), e = e(), Le(), e), dt = /* @__PURE__ *
|
|
|
512
512
|
});
|
|
513
513
|
const ye = (e, l) => {
|
|
514
514
|
const t = e.__vccOpts || e;
|
|
515
|
-
for (const [n,
|
|
516
|
-
t[n] =
|
|
515
|
+
for (const [n, r] of l)
|
|
516
|
+
t[n] = r;
|
|
517
517
|
return t;
|
|
518
518
|
}, wt = /* @__PURE__ */ ye(vt, [["__scopeId", "data-v-9645dfb5"]]), ft = { class: "virtualListWrapper" }, pt = {
|
|
519
519
|
inheritAttrs: !1
|
|
@@ -526,21 +526,21 @@ const ye = (e, l) => {
|
|
|
526
526
|
overscan: { default: 10 }
|
|
527
527
|
},
|
|
528
528
|
setup(e, { expose: l }) {
|
|
529
|
-
const t = e, n =
|
|
529
|
+
const t = e, n = rt(De(t, "data"), {
|
|
530
530
|
itemHeight: (d) => t.itemHeight(t.data[d]),
|
|
531
531
|
overscan: t.overscan
|
|
532
|
-
}), { list:
|
|
532
|
+
}), { list: r, containerProps: a, wrapperProps: i, innerProps: u, getItemHeightData: f } = n;
|
|
533
533
|
return l({
|
|
534
534
|
vListReturn: n
|
|
535
535
|
}), (d, h) => (T(), P("div", ft, [
|
|
536
536
|
C("div", Ve({
|
|
537
|
-
onScrollPassive: h[0] || (h[0] = (...v) => w(
|
|
538
|
-
ref: w(
|
|
537
|
+
onScrollPassive: h[0] || (h[0] = (...v) => w(a).onScroll && w(a).onScroll(...v)),
|
|
538
|
+
ref: w(a).ref,
|
|
539
539
|
class: "virtualList"
|
|
540
540
|
}, d.$attrs), [
|
|
541
541
|
C("div", X(Z(w(i))), [
|
|
542
542
|
C("div", X(Z(w(u))), [
|
|
543
|
-
(T(!0), P(Ke, null, je(w(
|
|
543
|
+
(T(!0), P(Ke, null, je(w(r), ({ index: v, data: o }) => (T(), P("div", {
|
|
544
544
|
key: v,
|
|
545
545
|
style: J({
|
|
546
546
|
height: `${w(f)(v).height}px`,
|
|
@@ -564,7 +564,7 @@ export {
|
|
|
564
564
|
yt as SvgIcon,
|
|
565
565
|
St as VirtualList,
|
|
566
566
|
pe as allSelectedKey,
|
|
567
|
-
|
|
567
|
+
at as closeDialogKey,
|
|
568
568
|
_t as dialogController,
|
|
569
569
|
be as isAllSelectedKey,
|
|
570
570
|
fe as isSelectedKey,
|
|
@@ -576,5 +576,5 @@ export {
|
|
|
576
576
|
me as unselectKey,
|
|
577
577
|
bt as useSelectable,
|
|
578
578
|
mt as useSelectableInjectors,
|
|
579
|
-
|
|
579
|
+
rt as useVirtualList
|
|
580
580
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(h,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(h=typeof globalThis<"u"?globalThis:h||self,e(h.ui={},h.Vue))})(this,function(h,e){"use strict";var Y;const H=typeof window<"u";H&&((Y=window?.navigator)==null?void 0:Y.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function C(t){return typeof t=="function"?t():e.unref(t)}function oe(t,n){function l(...o){t(()=>n.apply(this,o),{fn:n,thisArg:this,args:o})}return l}function re(t,n={}){let l,o;return a=>{const s=C(t),u=C(n.maxWait);if(l&&clearTimeout(l),s<=0||u!==void 0&&u<=0)return o&&(clearTimeout(o),o=null),a();u&&!o&&(o=setTimeout(()=>{l&&clearTimeout(l),o=null,a()},u)),l=setTimeout(()=>{o&&clearTimeout(o),o=null,a()},s)}}function ie(t){return t}function ae(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function se(t,n=200,l={}){return oe(re(n,l),t)}function ce(t,n=!0){e.getCurrentInstance()?e.onMounted(t):n?t():e.nextTick(t)}function G(t){var n;const l=C(t);return(n=l?.$el)!=null?n:l}const ue=H?window:void 0;H&&window.document,H&&window.navigator,H&&window.location;function de(t,n=!1){const l=e.ref(),o=()=>l.value=Boolean(t());return o(),ce(o,n),l}const P=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},x="__vueuse_ssr_handlers__";P[x]=P[x]||{},P[x];var J=Object.getOwnPropertySymbols,fe=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable,he=(t,n)=>{var l={};for(var o in t)fe.call(t,o)&&n.indexOf(o)<0&&(l[o]=t[o]);if(t!=null&&J)for(var o of J(t))n.indexOf(o)<0&&pe.call(t,o)&&(l[o]=t[o]);return l};function me(t,n,l={}){const o=l,{window:i=ue}=o,a=he(o,["window"]);let s;const u=de(()=>i&&"ResizeObserver"in i),m=()=>{s&&(s.disconnect(),s=void 0)},f=e.watch(()=>G(t),p=>{m(),u.value&&i&&p&&(s=new ResizeObserver(n),s.observe(p,a))},{immediate:!0,flush:"post"}),g=()=>{m(),f()};return ae(g),{isSupported:u,stop:g}}function ge(t,n={width:0,height:0},l={}){const{box:o="content-box"}=l,i=e.ref(n.width),a=e.ref(n.height);return me(t,([s])=>{const u=o==="border-box"?s.borderBoxSize:o==="content-box"?s.contentBoxSize:s.devicePixelContentBoxSize;u?(i.value=u.reduce((m,{inlineSize:f})=>m+f,0),a.value=u.reduce((m,{blockSize:f})=>m+f,0)):(i.value=s.contentRect.width,a.value=s.contentRect.height)},l),e.watch(()=>G(t),s=>{i.value=s?n.width:0,a.value=s?n.height:0}),{width:i,height:a}}var X;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(X||(X={}));var ve=Object.defineProperty,Z=Object.getOwnPropertySymbols,ye=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable,ee=(t,n,l)=>n in t?ve(t,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[n]=l,_e=(t,n)=>{for(var l in n||(n={}))ye.call(n,l)&&ee(t,l,n[l]);if(Z)for(var l of Z(n))be.call(n,l)&&ee(t,l,n[l]);return t};_e({linear:ie},{easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]});function te(t,n){const{itemHeight:l,overscan:o=5}=n,i=e.ref(),a=ge(i);let s;const u=e.shallowRef(t),m=e.ref(0),f=e.ref({start:0,end:10});let g=0;const p=e.ref([]),r=e.computed(()=>{let{sum:c,height:d}={sum:0,height:0};return u.value.map((b,_)=>(typeof l=="number"?d=l:d=l(_),c+=d,{height:d,sum:c}))}),v=e.computed(()=>M(f.value.start)),w=e.computed(()=>typeof l=="number"?r.value.length*l:r.value.at(-1)?.sum||0),D=e.computed(()=>{let c=p.value.length-o,d=Math.max(c-g,0);return p.value.slice(d,c)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(s)),e.watch([a.width,a.height,u],([c,d])=>{(c||d)&&O()},{deep:!0});function O(){cancelAnimationFrame(s),s=requestAnimationFrame(I)}function I(){if(i.value){m.value=i.value.scrollTop,g=B();let c=N(m.value),d=c+g+o;c=c-o,c=c<0?0:c,d=d>u.value.length?u.value.length:d,f.value={start:c,end:d},p.value=u.value.slice(c,d).map((b,_)=>({data:b,index:_+c}))}}function N(c){let d=Math.floor(r.value.length/16),b=-1,_=-1;for(let y=0;y<16;y++){if(r.value.at(d*y).sum>=c){b=Math.max(0,y-1);break}y===15&&(b=y)}b*=d;for(let y=b;y<r.value.length;y++)if(r.value[y].sum>=c){_=y;break}return Math.max(0,_)}function B(){let c=0,d=0,b=z();for(let _=b;_<r.value.length&&(c++,d+=r.value[_].height,!(d>=a.height.value));_++);return c}function M(c){if(typeof l=="number")return c*l;let d=r.value[c];return d.sum-d.height}function T(c){return r.value.at(c)||{sum:0,height:0}}function z(){let c=f.value.start;return c>=o&&(c+=o),c}function Q(c){if(i.value){const d=T(c);i.value.scrollTop=d.sum-d.height,I()}}const U=e.computed(()=>({style:{width:"100%",height:`${w.value}px`}})),W=e.computed(()=>({style:{transform:`translate3d(0, ${v.value}px, 0)`,"will-change":"transform"}})),q={overflowY:"auto"};return{list:p,visiableList:D,getItemHeightData:T,totalHeight:w,clientHeight:a.height,scrollTo:Q,scrollTop:m,containerProps:{ref:i,onScroll:()=>{O()},style:q},wrapperProps:U,innerProps:W}}const R=Symbol(),A=Symbol(),k=Symbol(),j=Symbol(),K=Symbol(),L=Symbol(),V=Symbol(),$=Symbol(),F=Symbol();function Se(){const{voidFn:t,boolFn:n,boolRef:l,arrayRef:o}={voidFn:v=>{},boolFn:v=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},i=e.inject(j,o),a=e.inject(k,n),s=e.inject($,l),u=e.inject(A,t),m=e.inject(R,t),f=e.inject(K,t),g=e.inject(L,t),p=e.inject(V,t),r=e.inject(F,t);return{selected:i,isSelected:a,isAllSelected:s,toggle:u,toggleAll:m,select:f,selectAll:g,unselect:p,unselectAll:r}}function we(t,n){const l=e.ref({}),o=e.computed(()=>t.value.filter(r=>l.value[r[n]])),i=e.computed(()=>o.value.length!=0&&Object.keys(l.value).length==t.value.length);function a(){t.value.forEach(r=>{l.value[r[n]]=!0})}function s(){l.value={}}function u(r){r.forEach(v=>{l.value[v[n]]||(l.value[v[n]]=!0)})}function m(r){r.forEach(v=>{l.value[v[n]]&&delete l.value[v[n]]})}function f(r){return!!l.value[r[n]]}function g(r){r.forEach(v=>{f(v)?delete l.value[v[n]]:l.value[v[n]]=!0})}function p(){i.value?s():a()}return e.provide(R,p),e.provide(A,g),e.provide(k,f),e.provide(j,o),e.provide(K,u),e.provide(L,a),e.provide(V,m),e.provide($,i),e.provide(F,s),{selected:o,select:u,selectAll:a,unselect:m,unselectAll:s,toggle:g,toggleAll:p,isSelected:f,isAllSelected:i}}const le=Symbol(),Oe=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0},dialogClass:{default:""}},emits:["update:visiable"],setup(t,{emit:n}){const l=t,o=()=>{l.closeOnClickOverlay&&n("update:visiable",!1)};return e.provide(le,()=>n("update:visiable",!1)),(i,a)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[t.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:o,class:"modal absolute inset-0 bottom-0 z-50 flex bg-stone-900 bg-opacity-50"},[e.createElementVNode("div",{onClick:a[0]||(a[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog m-auto flex flex-col",t.dialogClass])},[e.renderSlot(i.$slots,"default")],2)])):e.createCommentVNode("",!0)]),_:3}))}});function Ee(t){function n(l,o){const i=document.createElement("div"),a={setup(){return()=>e.h(Oe,{visiable:!0,"onUpdate:visiable":()=>{i?.remove()},...t},{default:()=>e.h(l,o)})}};return document.body.appendChild(i),e.render(e.h(a),i),{close:()=>i?.remove()}}return{create:n}}const He=["xlink:href","fill","color"],Ie=e.defineComponent({__name:"SvgIcon",props:{name:null,prefix:{default:"icon"},color:{default:"#FFF"},width:null,height:null},setup(t){const n=t,l=e.computed(()=>`#${n.prefix}-${n.name}`),o=e.computed(()=>({width:n.width,height:n.height,aspectRatio:n.width&&n.height?void 0:"1/1"}));return(i,a)=>(e.openBlock(),e.createElementBlock("svg",{"aria-hidden":"",style:e.normalizeStyle(e.unref(o))},[e.createElementVNode("use",{"xlink:href":e.unref(l),fill:t.color,color:t.color},null,8,He)],4))}});function Be(t){const{containerEl:n,sliderEl:l,autoHeight:o,performance:i={}}=t,a=e.ref(!0),s=se(U,1e3);let u,m="";const f=e.ref(0),g=e.ref(0),p=e.ref(0),r=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),v=e.ref({clientHeight:0}),w=e.computed(()=>!!g.value),D=e.computed(()=>r.value.scrollHeight>r.value.clientHeight),O=e.computed(()=>r.value.clientHeight-v.value.clientHeight),I=e.computed(()=>r.value.scrollHeight-r.value.clientHeight),N=e.computed(()=>Math.max(r.value.clientHeight/r.value.scrollHeight,.05)),B=e.computed(()=>N.value*r.value.clientHeight),M=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${p.value}px,0)`,height:o?`${B.value}px`:void 0}));function T(E){g.value=E.clientY-l.value.getBoundingClientRect().top||1,m=getComputedStyle(n.value).scrollBehavior,m==="smooth"&&(n.value.style.scrollBehavior="unset")}function z(){n.value.style.scrollBehavior=m,g.value=0,s()}function Q(){a.value=!1}function U(){w.value||(a.value=!0)}function W(E){if(!w.value)return;let S=E.clientY-r.value.top-g.value;S<0?p.value=0:S>=O.value?p.value=O.value:p.value=S,n.value.scrollTo({top:p.value/O.value*I.value})}function q(){w.value||c()}function c(){cancelAnimationFrame(u),u=requestAnimationFrame(d)}function d(){n.value&&(f.value=i.scrollTop?.value??n.value.scrollTop,p.value=f.value/I.value*O.value)}function b(E){let S="addEventListener";E==="add"?S="addEventListener":S="removeEventListener",l.value?.[S]("pointerdown",T,{passive:!0}),window[S]("pointermove",W,{passive:!0}),window[S]("pointerup",z,{passive:!0})}const _=new MutationObserver(E=>{E.map(Le=>Le.oldValue).join().includes("height")?y():v.value.clientHeight||y()});function y(){r.value.top=n.value?.getBoundingClientRect().top??0,r.value.scrollHeight=n.value?.scrollHeight??0,r.value.clientHeight=n.value?.clientHeight??0,o?v.value.clientHeight=B.value:v.value.clientHeight=l.value?.clientHeight??0}function je(){n.value&&l.value?(n.value.addEventListener("scroll",q,{passive:!0}),b("add"),_.observe(n.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{y()},100)):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:n,sliderEl:l})}const Ke=e.watch(f,()=>{v.value.clientHeight?Ke():y()});return e.watch(f,()=>{Q(),s()}),{isScrollEnd:a,isDragSlider:w,scrollable:D,sliderPos:M,init:je,modifySliderEventListener:b}}const Te=(t=>(e.pushScopeId("data-v-9645dfb5"),t=t(),e.popScopeId(),t))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),Ce=e.defineComponent({__name:"ScrollBar",props:{containerEl:null,autoHide:{type:Boolean},autoHeight:{type:Boolean},performance:null},setup(t,{expose:n}){const l=t,o=!!e.useSlots().default,i=e.ref(null),a=e.computed(()=>l.containerEl),s=Be({containerEl:a,sliderEl:i,autoHeight:o?l.autoHeight:!0,performance:l.performance}),{scrollable:u,isScrollEnd:m,sliderPos:f}=s,g=l.autoHide?e.computed(()=>!m.value):e.computed(()=>u.value);return e.onMounted(()=>{e.nextTick(()=>{s.init()})}),e.onUnmounted(()=>{s.modifySliderEventListener("remove")}),n({uScrollBarReturn:s}),(p,r)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"sliderRef",ref:i,class:"slider-wrapper",style:e.normalizeStyle(e.unref(f))},[e.renderSlot(p.$slots,"default",{},()=>[Te],!0)],4),[[e.vShow,e.unref(g)]])]),_:3}))}}),Fe="",ne=(t,n)=>{const l=t.__vccOpts||t;for(const[o,i]of n)l[o]=i;return l},Pe=ne(Ce,[["__scopeId","data-v-9645dfb5"]]),xe={class:"virtualListWrapper"},Re={inheritAttrs:!1},Ae=e.defineComponent({...Re,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},setup(t,{expose:n}){const l=t,o=te(e.toRef(l,"data"),{itemHeight:f=>l.itemHeight(l.data[f]),overscan:l.overscan}),{list:i,containerProps:a,wrapperProps:s,innerProps:u,getItemHeightData:m}=o;return n({vListReturn:o}),(f,g)=>(e.openBlock(),e.createElementBlock("div",xe,[e.createElementVNode("div",e.mergeProps({onScrollPassive:g[0]||(g[0]=(...p)=>e.unref(a).onScroll&&e.unref(a).onScroll(...p)),ref:e.unref(a).ref,class:"virtualList"},f.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(s))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(u))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i),({index:p,data:r})=>(e.openBlock(),e.createElementBlock("div",{key:p,style:e.normalizeStyle({height:`${e.unref(m)(p).height}px`,display:"flex"})},[e.renderSlot(f.$slots,"default",{data:r,index:p},void 0,!0)],4))),128))],16)],16)],16)]))}}),De="",ke=ne(Ae,[["__scopeId","data-v-134ad8ab"]]);h.ScrollBar=Pe,h.SvgIcon=Ie,h.VirtualList=ke,h.allSelectedKey=j,h.closeDialogKey=le,h.dialogController=Ee,h.isAllSelectedKey=$,h.isSelectedKey=k,h.selectAllKey=L,h.selectKey=K,h.toggleAllKey=R,h.toggleKey=A,h.unselectAllKey=F,h.unselectKey=V,h.useSelectable=we,h.useSelectableInjectors=Se,h.useVirtualList=te,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(h,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(h=typeof globalThis<"u"?globalThis:h||self,e(h.ui={},h.Vue))})(this,function(h,e){"use strict";var Y;const H=typeof window<"u";H&&((Y=window?.navigator)==null?void 0:Y.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function C(t){return typeof t=="function"?t():e.unref(t)}function oe(t,n){function l(...o){t(()=>n.apply(this,o),{fn:n,thisArg:this,args:o})}return l}function re(t,n={}){let l,o;return a=>{const s=C(t),u=C(n.maxWait);if(l&&clearTimeout(l),s<=0||u!==void 0&&u<=0)return o&&(clearTimeout(o),o=null),a();u&&!o&&(o=setTimeout(()=>{l&&clearTimeout(l),o=null,a()},u)),l=setTimeout(()=>{o&&clearTimeout(o),o=null,a()},s)}}function ie(t){return t}function ae(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function se(t,n=200,l={}){return oe(re(n,l),t)}function ce(t,n=!0){e.getCurrentInstance()?e.onMounted(t):n?t():e.nextTick(t)}function G(t){var n;const l=C(t);return(n=l?.$el)!=null?n:l}const ue=H?window:void 0;H&&window.document,H&&window.navigator,H&&window.location;function de(t,n=!1){const l=e.ref(),o=()=>l.value=Boolean(t());return o(),ce(o,n),l}const P=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},x="__vueuse_ssr_handlers__";P[x]=P[x]||{},P[x];var J=Object.getOwnPropertySymbols,fe=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable,he=(t,n)=>{var l={};for(var o in t)fe.call(t,o)&&n.indexOf(o)<0&&(l[o]=t[o]);if(t!=null&&J)for(var o of J(t))n.indexOf(o)<0&&pe.call(t,o)&&(l[o]=t[o]);return l};function me(t,n,l={}){const o=l,{window:i=ue}=o,a=he(o,["window"]);let s;const u=de(()=>i&&"ResizeObserver"in i),m=()=>{s&&(s.disconnect(),s=void 0)},f=e.watch(()=>G(t),p=>{m(),u.value&&i&&p&&(s=new ResizeObserver(n),s.observe(p,a))},{immediate:!0,flush:"post"}),g=()=>{m(),f()};return ae(g),{isSupported:u,stop:g}}function ge(t,n={width:0,height:0},l={}){const{box:o="content-box"}=l,i=e.ref(n.width),a=e.ref(n.height);return me(t,([s])=>{const u=o==="border-box"?s.borderBoxSize:o==="content-box"?s.contentBoxSize:s.devicePixelContentBoxSize;u?(i.value=u.reduce((m,{inlineSize:f})=>m+f,0),a.value=u.reduce((m,{blockSize:f})=>m+f,0)):(i.value=s.contentRect.width,a.value=s.contentRect.height)},l),e.watch(()=>G(t),s=>{i.value=s?n.width:0,a.value=s?n.height:0}),{width:i,height:a}}var X;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(X||(X={}));var ve=Object.defineProperty,Z=Object.getOwnPropertySymbols,ye=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable,ee=(t,n,l)=>n in t?ve(t,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[n]=l,_e=(t,n)=>{for(var l in n||(n={}))ye.call(n,l)&&ee(t,l,n[l]);if(Z)for(var l of Z(n))be.call(n,l)&&ee(t,l,n[l]);return t};_e({linear:ie},{easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]});function te(t,n){const{itemHeight:l,overscan:o=5}=n,i=e.ref(),a=ge(i);let s;const u=e.shallowRef(t),m=e.ref(0),f=e.ref({start:0,end:10});let g=0;const p=e.ref([]),r=e.computed(()=>{let{sum:c,height:d}={sum:0,height:0};return u.value.map((b,_)=>(typeof l=="number"?d=l:d=l(_),c+=d,{height:d,sum:c}))}),v=e.computed(()=>M(f.value.start)),w=e.computed(()=>typeof l=="number"?r.value.length*l:r.value[r.value.length-1]?.sum||0),D=e.computed(()=>{let c=p.value.length-o,d=Math.max(c-g,0);return p.value.slice(d,c)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(s)),e.watch([a.width,a.height,u],([c,d])=>{(c||d)&&O()},{deep:!0});function O(){cancelAnimationFrame(s),s=requestAnimationFrame(I)}function I(){if(i.value){m.value=i.value.scrollTop,g=B();let c=N(m.value),d=c+g+o;c=c-o,c=c<0?0:c,d=d>u.value.length?u.value.length:d,f.value={start:c,end:d},p.value=u.value.slice(c,d).map((b,_)=>({data:b,index:_+c}))}}function N(c){let d=Math.floor(r.value.length/16),b=-1,_=-1;for(let y=0;y<16;y++){if(r.value[d*y].sum>=c){b=Math.max(0,y-1);break}y===15&&(b=y)}b*=d;for(let y=b;y<r.value.length;y++)if(r.value[y].sum>=c){_=y;break}return Math.max(0,_)}function B(){let c=0,d=0,b=z();for(let _=b;_<r.value.length&&(c++,d+=r.value[_].height,!(d>=a.height.value));_++);return c}function M(c){if(typeof l=="number")return c*l;let d=r.value[c];return d.sum-d.height}function T(c){return r.value[c]||{sum:0,height:0}}function z(){let c=f.value.start;return c>=o&&(c+=o),c}function Q(c){if(i.value){const d=T(c);i.value.scrollTop=d.sum-d.height,I()}}const U=e.computed(()=>({style:{width:"100%",height:`${w.value}px`}})),W=e.computed(()=>({style:{transform:`translate3d(0, ${v.value}px, 0)`,"will-change":"transform"}})),q={overflowY:"auto"};return{list:p,visiableList:D,getItemHeightData:T,totalHeight:w,clientHeight:a.height,scrollTo:Q,scrollTop:m,containerProps:{ref:i,onScroll:()=>{O()},style:q},wrapperProps:U,innerProps:W}}const R=Symbol(),A=Symbol(),k=Symbol(),j=Symbol(),K=Symbol(),L=Symbol(),V=Symbol(),$=Symbol(),F=Symbol();function Se(){const{voidFn:t,boolFn:n,boolRef:l,arrayRef:o}={voidFn:v=>{},boolFn:v=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},i=e.inject(j,o),a=e.inject(k,n),s=e.inject($,l),u=e.inject(A,t),m=e.inject(R,t),f=e.inject(K,t),g=e.inject(L,t),p=e.inject(V,t),r=e.inject(F,t);return{selected:i,isSelected:a,isAllSelected:s,toggle:u,toggleAll:m,select:f,selectAll:g,unselect:p,unselectAll:r}}function we(t,n){const l=e.ref({}),o=e.computed(()=>t.value.filter(r=>l.value[r[n]])),i=e.computed(()=>o.value.length!=0&&Object.keys(l.value).length==t.value.length);function a(){t.value.forEach(r=>{l.value[r[n]]=!0})}function s(){l.value={}}function u(r){r.forEach(v=>{l.value[v[n]]||(l.value[v[n]]=!0)})}function m(r){r.forEach(v=>{l.value[v[n]]&&delete l.value[v[n]]})}function f(r){return!!l.value[r[n]]}function g(r){r.forEach(v=>{f(v)?delete l.value[v[n]]:l.value[v[n]]=!0})}function p(){i.value?s():a()}return e.provide(R,p),e.provide(A,g),e.provide(k,f),e.provide(j,o),e.provide(K,u),e.provide(L,a),e.provide(V,m),e.provide($,i),e.provide(F,s),{selected:o,select:u,selectAll:a,unselect:m,unselectAll:s,toggle:g,toggleAll:p,isSelected:f,isAllSelected:i}}const le=Symbol(),Oe=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0},dialogClass:{default:""}},emits:["update:visiable"],setup(t,{emit:n}){const l=t,o=()=>{l.closeOnClickOverlay&&n("update:visiable",!1)};return e.provide(le,()=>n("update:visiable",!1)),(i,a)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[t.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:o,class:"modal absolute inset-0 bottom-0 z-50 flex bg-stone-900 bg-opacity-50"},[e.createElementVNode("div",{onClick:a[0]||(a[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog m-auto flex flex-col",t.dialogClass])},[e.renderSlot(i.$slots,"default")],2)])):e.createCommentVNode("",!0)]),_:3}))}});function Ee(t){function n(l,o){const i=document.createElement("div"),a={setup(){return()=>e.h(Oe,{visiable:!0,"onUpdate:visiable":()=>{i?.remove()},...t},{default:()=>e.h(l,o)})}};return document.body.appendChild(i),e.render(e.h(a),i),{close:()=>i?.remove()}}return{create:n}}const He=["xlink:href","fill","color"],Ie=e.defineComponent({__name:"SvgIcon",props:{name:null,prefix:{default:"icon"},color:{default:"#FFF"},width:null,height:null},setup(t){const n=t,l=e.computed(()=>`#${n.prefix}-${n.name}`),o=e.computed(()=>({width:n.width,height:n.height,aspectRatio:n.width&&n.height?void 0:"1/1"}));return(i,a)=>(e.openBlock(),e.createElementBlock("svg",{"aria-hidden":"",style:e.normalizeStyle(e.unref(o))},[e.createElementVNode("use",{"xlink:href":e.unref(l),fill:t.color,color:t.color},null,8,He)],4))}});function Be(t){const{containerEl:n,sliderEl:l,autoHeight:o,performance:i={}}=t,a=e.ref(!0),s=se(U,1e3);let u,m="";const f=e.ref(0),g=e.ref(0),p=e.ref(0),r=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),v=e.ref({clientHeight:0}),w=e.computed(()=>!!g.value),D=e.computed(()=>r.value.scrollHeight>r.value.clientHeight),O=e.computed(()=>r.value.clientHeight-v.value.clientHeight),I=e.computed(()=>r.value.scrollHeight-r.value.clientHeight),N=e.computed(()=>Math.max(r.value.clientHeight/r.value.scrollHeight,.05)),B=e.computed(()=>N.value*r.value.clientHeight),M=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${p.value}px,0)`,height:o?`${B.value}px`:void 0}));function T(E){g.value=E.clientY-l.value.getBoundingClientRect().top||1,m=getComputedStyle(n.value).scrollBehavior,m==="smooth"&&(n.value.style.scrollBehavior="unset")}function z(){n.value.style.scrollBehavior=m,g.value=0,s()}function Q(){a.value=!1}function U(){w.value||(a.value=!0)}function W(E){if(!w.value)return;let S=E.clientY-r.value.top-g.value;S<0?p.value=0:S>=O.value?p.value=O.value:p.value=S,n.value.scrollTo({top:p.value/O.value*I.value})}function q(){w.value||c()}function c(){cancelAnimationFrame(u),u=requestAnimationFrame(d)}function d(){n.value&&(f.value=i.scrollTop?.value??n.value.scrollTop,p.value=f.value/I.value*O.value)}function b(E){let S="addEventListener";E==="add"?S="addEventListener":S="removeEventListener",l.value?.[S]("pointerdown",T,{passive:!0}),window[S]("pointermove",W,{passive:!0}),window[S]("pointerup",z,{passive:!0})}const _=new MutationObserver(E=>{E.map(Le=>Le.oldValue).join().includes("height")?y():v.value.clientHeight||y()});function y(){r.value.top=n.value?.getBoundingClientRect().top??0,r.value.scrollHeight=n.value?.scrollHeight??0,r.value.clientHeight=n.value?.clientHeight??0,o?v.value.clientHeight=B.value:v.value.clientHeight=l.value?.clientHeight??0}function je(){n.value&&l.value?(n.value.addEventListener("scroll",q,{passive:!0}),b("add"),_.observe(n.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{y()},100)):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:n,sliderEl:l})}const Ke=e.watch(f,()=>{v.value.clientHeight?Ke():y()});return e.watch(f,()=>{Q(),s()}),{isScrollEnd:a,isDragSlider:w,scrollable:D,sliderPos:M,init:je,modifySliderEventListener:b}}const Te=(t=>(e.pushScopeId("data-v-9645dfb5"),t=t(),e.popScopeId(),t))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),Ce=e.defineComponent({__name:"ScrollBar",props:{containerEl:null,autoHide:{type:Boolean},autoHeight:{type:Boolean},performance:null},setup(t,{expose:n}){const l=t,o=!!e.useSlots().default,i=e.ref(null),a=e.computed(()=>l.containerEl),s=Be({containerEl:a,sliderEl:i,autoHeight:o?l.autoHeight:!0,performance:l.performance}),{scrollable:u,isScrollEnd:m,sliderPos:f}=s,g=l.autoHide?e.computed(()=>!m.value):e.computed(()=>u.value);return e.onMounted(()=>{e.nextTick(()=>{s.init()})}),e.onUnmounted(()=>{s.modifySliderEventListener("remove")}),n({uScrollBarReturn:s}),(p,r)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"sliderRef",ref:i,class:"slider-wrapper",style:e.normalizeStyle(e.unref(f))},[e.renderSlot(p.$slots,"default",{},()=>[Te],!0)],4),[[e.vShow,e.unref(g)]])]),_:3}))}}),Fe="",ne=(t,n)=>{const l=t.__vccOpts||t;for(const[o,i]of n)l[o]=i;return l},Pe=ne(Ce,[["__scopeId","data-v-9645dfb5"]]),xe={class:"virtualListWrapper"},Re={inheritAttrs:!1},Ae=e.defineComponent({...Re,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},setup(t,{expose:n}){const l=t,o=te(e.toRef(l,"data"),{itemHeight:f=>l.itemHeight(l.data[f]),overscan:l.overscan}),{list:i,containerProps:a,wrapperProps:s,innerProps:u,getItemHeightData:m}=o;return n({vListReturn:o}),(f,g)=>(e.openBlock(),e.createElementBlock("div",xe,[e.createElementVNode("div",e.mergeProps({onScrollPassive:g[0]||(g[0]=(...p)=>e.unref(a).onScroll&&e.unref(a).onScroll(...p)),ref:e.unref(a).ref,class:"virtualList"},f.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(s))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(u))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i),({index:p,data:r})=>(e.openBlock(),e.createElementBlock("div",{key:p,style:e.normalizeStyle({height:`${e.unref(m)(p).height}px`,display:"flex"})},[e.renderSlot(f.$slots,"default",{data:r,index:p},void 0,!0)],4))),128))],16)],16)],16)]))}}),De="",ke=ne(Ae,[["__scopeId","data-v-134ad8ab"]]);h.ScrollBar=Pe,h.SvgIcon=Ie,h.VirtualList=ke,h.allSelectedKey=j,h.closeDialogKey=le,h.dialogController=Ee,h.isAllSelectedKey=$,h.isSelectedKey=k,h.selectAllKey=L,h.selectKey=K,h.toggleAllKey=R,h.toggleKey=A,h.unselectAllKey=F,h.unselectKey=V,h.useSelectable=we,h.useSelectableInjectors=Se,h.useVirtualList=te,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|