@lazycatcloud/lzc-toolkit 0.0.48 → 0.0.49
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 +188 -186
- package/dist/index.umd.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { unref as
|
|
2
|
-
var
|
|
1
|
+
import { unref as b, getCurrentScope as Ce, onScopeDispose as Be, getCurrentInstance as Pe, onMounted as te, nextTick as ne, ref as g, watch as $, shallowRef as Re, computed as f, onUnmounted as fe, inject as x, provide as E, defineComponent as F, openBlock as I, createBlock as pe, Transition as he, withCtx as me, createElementBlock as B, createElementVNode as H, withModifiers as $e, normalizeClass as Fe, renderSlot as oe, createCommentVNode as Ae, render as J, h as R, normalizeStyle as j, toDisplayString as Le, useSlots as De, withDirectives as We, vShow as Me, pushScopeId as ke, popScopeId as Ve, toRef as ze, mergeProps as Ke, normalizeProps as se, guardReactiveProps as re, Fragment as je, renderList as Ne } from "vue";
|
|
2
|
+
var ae;
|
|
3
3
|
const A = typeof window < "u";
|
|
4
|
-
A && ((
|
|
4
|
+
A && ((ae = window?.navigator) == null ? void 0 : ae.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
5
5
|
function X(t) {
|
|
6
|
-
return typeof t == "function" ? t() :
|
|
6
|
+
return typeof t == "function" ? t() : b(t);
|
|
7
7
|
}
|
|
8
8
|
function Qe(t, e) {
|
|
9
9
|
function n(...o) {
|
|
@@ -30,13 +30,13 @@ function qe(t) {
|
|
|
30
30
|
function Ye(t) {
|
|
31
31
|
return Ce() ? (Be(t), !0) : !1;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function ge(t, e = 200, n = {}) {
|
|
34
34
|
return Qe(Ue(e, n), t);
|
|
35
35
|
}
|
|
36
36
|
function Ge(t, e = !0) {
|
|
37
37
|
Pe() ? te(t) : e ? t() : ne(t);
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function _e(t) {
|
|
40
40
|
var e;
|
|
41
41
|
const n = X(t);
|
|
42
42
|
return (e = n?.$el) != null ? e : n;
|
|
@@ -52,12 +52,12 @@ function Xe(t, e = !1) {
|
|
|
52
52
|
const Z = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, ee = "__vueuse_ssr_handlers__";
|
|
53
53
|
Z[ee] = Z[ee] || {};
|
|
54
54
|
Z[ee];
|
|
55
|
-
var
|
|
55
|
+
var ie = Object.getOwnPropertySymbols, Ze = Object.prototype.hasOwnProperty, et = Object.prototype.propertyIsEnumerable, tt = (t, e) => {
|
|
56
56
|
var n = {};
|
|
57
57
|
for (var o in t)
|
|
58
58
|
Ze.call(t, o) && e.indexOf(o) < 0 && (n[o] = t[o]);
|
|
59
|
-
if (t != null &&
|
|
60
|
-
for (var o of
|
|
59
|
+
if (t != null && ie)
|
|
60
|
+
for (var o of ie(t))
|
|
61
61
|
e.indexOf(o) < 0 && et.call(t, o) && (n[o] = t[o]);
|
|
62
62
|
return n;
|
|
63
63
|
};
|
|
@@ -66,7 +66,7 @@ function nt(t, e, n = {}) {
|
|
|
66
66
|
let l;
|
|
67
67
|
const d = Xe(() => s && "ResizeObserver" in s), m = () => {
|
|
68
68
|
l && (l.disconnect(), l = void 0);
|
|
69
|
-
}, p = $(() =>
|
|
69
|
+
}, p = $(() => _e(t), (h) => {
|
|
70
70
|
m(), d.value && s && h && (l = new ResizeObserver(e), l.observe(h, r));
|
|
71
71
|
}, { immediate: !0, flush: "post" }), v = () => {
|
|
72
72
|
m(), p();
|
|
@@ -81,23 +81,23 @@ function ot(t, e = { width: 0, height: 0 }, n = {}) {
|
|
|
81
81
|
return nt(t, ([l]) => {
|
|
82
82
|
const d = o === "border-box" ? l.borderBoxSize : o === "content-box" ? l.contentBoxSize : l.devicePixelContentBoxSize;
|
|
83
83
|
d ? (s.value = d.reduce((m, { inlineSize: p }) => m + p, 0), r.value = d.reduce((m, { blockSize: p }) => m + p, 0)) : (s.value = l.contentRect.width, r.value = l.contentRect.height);
|
|
84
|
-
}, n), $(() =>
|
|
84
|
+
}, n), $(() => _e(t), (l) => {
|
|
85
85
|
s.value = l ? e.width : 0, r.value = l ? e.height : 0;
|
|
86
86
|
}), {
|
|
87
87
|
width: s,
|
|
88
88
|
height: r
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
-
var
|
|
91
|
+
var ue;
|
|
92
92
|
(function(t) {
|
|
93
93
|
t.UP = "UP", t.RIGHT = "RIGHT", t.DOWN = "DOWN", t.LEFT = "LEFT", t.NONE = "NONE";
|
|
94
|
-
})(
|
|
95
|
-
var lt = Object.defineProperty,
|
|
94
|
+
})(ue || (ue = {}));
|
|
95
|
+
var lt = Object.defineProperty, ce = Object.getOwnPropertySymbols, st = Object.prototype.hasOwnProperty, rt = Object.prototype.propertyIsEnumerable, de = (t, e, n) => e in t ? lt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, at = (t, e) => {
|
|
96
96
|
for (var n in e || (e = {}))
|
|
97
|
-
st.call(e, n) &&
|
|
98
|
-
if (
|
|
99
|
-
for (var n of
|
|
100
|
-
rt.call(e, n) &&
|
|
97
|
+
st.call(e, n) && de(t, n, e[n]);
|
|
98
|
+
if (ce)
|
|
99
|
+
for (var n of ce(e))
|
|
100
|
+
rt.call(e, n) && de(t, n, e[n]);
|
|
101
101
|
return t;
|
|
102
102
|
};
|
|
103
103
|
const it = {
|
|
@@ -130,22 +130,22 @@ at({
|
|
|
130
130
|
linear: qe
|
|
131
131
|
}, it);
|
|
132
132
|
function ut(t, e) {
|
|
133
|
-
const { scrollEndHook: n, itemHeight: o, overscan: s = 5 } = e, r = g(null), l = ot(r), d = g(!0), m =
|
|
133
|
+
const { scrollEndHook: n, itemHeight: o, overscan: s = 5 } = e, r = g(null), l = ot(r), d = g(!0), m = ge(Q, 100);
|
|
134
134
|
let p;
|
|
135
135
|
const v = Re(t), h = g(0), i = g({ start: 0, end: 10 });
|
|
136
136
|
let u = 0;
|
|
137
|
-
const
|
|
137
|
+
const T = g([]), _ = f(() => {
|
|
138
138
|
let { sum: a, height: c } = { sum: 0, height: 0 };
|
|
139
|
-
return v.value.map((
|
|
140
|
-
}), N = f(() => V(i.value.start)), C = f(() => typeof o == "number" ?
|
|
141
|
-
let a =
|
|
142
|
-
return
|
|
139
|
+
return v.value.map((w, y) => (typeof o == "number" ? c = o : c = o(y), a += c, { height: c, sum: a }));
|
|
140
|
+
}), N = f(() => V(i.value.start)), C = f(() => typeof o == "number" ? _.value.length * o : _.value[_.value.length - 1]?.sum || 0), L = f(() => {
|
|
141
|
+
let a = T.value.length - s, c = Math.max(a - u, 0);
|
|
142
|
+
return T.value.slice(c, a);
|
|
143
143
|
});
|
|
144
144
|
te(() => {
|
|
145
|
-
}),
|
|
145
|
+
}), fe(() => cancelAnimationFrame(p)), $(
|
|
146
146
|
[l.width, l.height, v],
|
|
147
147
|
([a, c]) => {
|
|
148
|
-
(a || c) &&
|
|
148
|
+
(a || c) && W();
|
|
149
149
|
},
|
|
150
150
|
{ deep: !0 }
|
|
151
151
|
), $(h, () => {
|
|
@@ -157,41 +157,41 @@ function ut(t, e) {
|
|
|
157
157
|
function Q() {
|
|
158
158
|
d.value = !0, n?.();
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function W() {
|
|
161
161
|
cancelAnimationFrame(p), p = requestAnimationFrame(M);
|
|
162
162
|
}
|
|
163
163
|
function M() {
|
|
164
164
|
if (r.value) {
|
|
165
165
|
h.value = r.value.scrollTop, u = P();
|
|
166
|
-
let a =
|
|
167
|
-
a = a - s, a = a < 0 ? 0 : a, c = c > v.value.length ? v.value.length : c, i.value = { start: a, end: c },
|
|
168
|
-
data:
|
|
166
|
+
let a = k(h.value), c = a + u + s;
|
|
167
|
+
a = a - s, a = a < 0 ? 0 : a, c = c > v.value.length ? v.value.length : c, i.value = { start: a, end: c }, T.value = v.value.slice(a, c).map((w, y) => ({
|
|
168
|
+
data: w,
|
|
169
169
|
index: y + a
|
|
170
170
|
}));
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
function
|
|
174
|
-
let c = 0,
|
|
175
|
-
for (; c <=
|
|
176
|
-
const
|
|
177
|
-
|
|
173
|
+
function k(a) {
|
|
174
|
+
let c = 0, w = _.value.length - 1, y = -1;
|
|
175
|
+
for (; c <= w; ) {
|
|
176
|
+
const S = Math.floor((c + w) / 2);
|
|
177
|
+
_.value[S].sum >= a ? (y = S, w = S - 1) : c = S + 1;
|
|
178
178
|
}
|
|
179
179
|
return Math.max(0, y);
|
|
180
180
|
}
|
|
181
181
|
function P() {
|
|
182
|
-
let a = 0, c = 0,
|
|
183
|
-
for (let y =
|
|
182
|
+
let a = 0, c = 0, w = U();
|
|
183
|
+
for (let y = w; y < _.value.length && (a++, c += _.value[y].height, !(c >= l.height.value)); y++)
|
|
184
184
|
;
|
|
185
185
|
return a;
|
|
186
186
|
}
|
|
187
187
|
function V(a) {
|
|
188
188
|
if (typeof o == "number")
|
|
189
189
|
return a * o;
|
|
190
|
-
let c =
|
|
190
|
+
let c = _.value[a];
|
|
191
191
|
return c ? c.sum - c.height : 0;
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
return
|
|
193
|
+
function z(a) {
|
|
194
|
+
return _.value[a] || { sum: 0, height: 0 };
|
|
195
195
|
}
|
|
196
196
|
function U() {
|
|
197
197
|
let a = i.value.start;
|
|
@@ -199,7 +199,7 @@ function ut(t, e) {
|
|
|
199
199
|
}
|
|
200
200
|
function q(a) {
|
|
201
201
|
if (r.value) {
|
|
202
|
-
const c =
|
|
202
|
+
const c = z(a);
|
|
203
203
|
r.value.scrollTop = c.sum - c.height, M();
|
|
204
204
|
}
|
|
205
205
|
}
|
|
@@ -209,7 +209,7 @@ function ut(t, e) {
|
|
|
209
209
|
height: `${C.value}px`,
|
|
210
210
|
pointerEvents: d.value ? void 0 : "none"
|
|
211
211
|
}
|
|
212
|
-
})),
|
|
212
|
+
})), K = f(() => ({
|
|
213
213
|
style: {
|
|
214
214
|
transform: `translate3d(0, ${N.value}px, 0)`,
|
|
215
215
|
"will-change": "transform"
|
|
@@ -218,10 +218,10 @@ function ut(t, e) {
|
|
|
218
218
|
overflowY: "auto"
|
|
219
219
|
};
|
|
220
220
|
return {
|
|
221
|
-
list:
|
|
221
|
+
list: T,
|
|
222
222
|
visiableList: L,
|
|
223
|
-
getItemHeightData:
|
|
224
|
-
getoffsetTopIndex:
|
|
223
|
+
getItemHeightData: z,
|
|
224
|
+
getoffsetTopIndex: k,
|
|
225
225
|
totalHeight: C,
|
|
226
226
|
clientHeight: l.height,
|
|
227
227
|
scrollTo: q,
|
|
@@ -230,23 +230,23 @@ function ut(t, e) {
|
|
|
230
230
|
containerProps: {
|
|
231
231
|
ref: r,
|
|
232
232
|
onScroll: () => {
|
|
233
|
-
|
|
233
|
+
W();
|
|
234
234
|
},
|
|
235
235
|
style: G
|
|
236
236
|
},
|
|
237
237
|
wrapperProps: Y,
|
|
238
|
-
innerProps:
|
|
238
|
+
innerProps: K
|
|
239
239
|
};
|
|
240
240
|
}
|
|
241
|
-
const be = Symbol(),
|
|
242
|
-
function
|
|
241
|
+
const be = Symbol(), ye = Symbol(), Se = Symbol(), we = Symbol(), Oe = Symbol(), Ee = Symbol(), Te = Symbol(), xe = Symbol(), He = Symbol();
|
|
242
|
+
function Et() {
|
|
243
243
|
const { voidFn: t, boolFn: e, boolRef: n, arrayRef: o } = {
|
|
244
244
|
voidFn: (u) => {
|
|
245
245
|
},
|
|
246
246
|
boolFn: (u) => !1,
|
|
247
247
|
boolRef: f(() => !1),
|
|
248
248
|
arrayRef: f(() => [])
|
|
249
|
-
}, s =
|
|
249
|
+
}, s = x(we, o), r = x(Se, e), l = x(xe, n), d = x(ye, t), m = x(be, t), p = x(Oe, t), v = x(Ee, t), h = x(Te, t), i = x(He, t);
|
|
250
250
|
return {
|
|
251
251
|
selected: s,
|
|
252
252
|
isSelected: r,
|
|
@@ -259,7 +259,7 @@ function xt() {
|
|
|
259
259
|
unselectAll: i
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
|
-
function
|
|
262
|
+
function Tt(t, e) {
|
|
263
263
|
const n = g({}), o = f(() => t.value.filter((i) => n.value[i[e]])), s = f(() => o.value.length != 0 && Object.keys(n.value).length == t.value.length);
|
|
264
264
|
function r() {
|
|
265
265
|
t.value.forEach((i) => {
|
|
@@ -290,7 +290,7 @@ function Et(t, e) {
|
|
|
290
290
|
function h() {
|
|
291
291
|
s.value ? l() : r();
|
|
292
292
|
}
|
|
293
|
-
return
|
|
293
|
+
return E(be, h), E(ye, v), E(Se, p), E(we, o), E(Oe, d), E(Ee, r), E(Te, m), E(xe, s), E(He, l), {
|
|
294
294
|
selected: o,
|
|
295
295
|
select: d,
|
|
296
296
|
selectAll: r,
|
|
@@ -314,8 +314,8 @@ const ct = Symbol(), dt = /* @__PURE__ */ F({
|
|
|
314
314
|
const n = t, o = () => {
|
|
315
315
|
n.closeOnClickOverlay && e("update:visiable", !1);
|
|
316
316
|
};
|
|
317
|
-
return
|
|
318
|
-
default:
|
|
317
|
+
return E(ct, () => e("update:visiable", !1)), (s, r) => (I(), pe(he, { name: "modal" }, {
|
|
318
|
+
default: me(() => [
|
|
319
319
|
t.visiable ? (I(), B("div", {
|
|
320
320
|
key: 0,
|
|
321
321
|
onClick: o,
|
|
@@ -334,7 +334,7 @@ const ct = Symbol(), dt = /* @__PURE__ */ F({
|
|
|
334
334
|
}));
|
|
335
335
|
}
|
|
336
336
|
});
|
|
337
|
-
function
|
|
337
|
+
function xt(t) {
|
|
338
338
|
function e(n, o) {
|
|
339
339
|
const s = document.createElement("div"), r = {
|
|
340
340
|
setup() {
|
|
@@ -361,7 +361,73 @@ function Tt(t) {
|
|
|
361
361
|
create: e
|
|
362
362
|
};
|
|
363
363
|
}
|
|
364
|
-
const vt =
|
|
364
|
+
const vt = { class: "toast" }, ft = /* @__PURE__ */ F({
|
|
365
|
+
__name: "Toast",
|
|
366
|
+
props: {
|
|
367
|
+
message: null,
|
|
368
|
+
position: null
|
|
369
|
+
},
|
|
370
|
+
setup(t) {
|
|
371
|
+
const e = t, n = g(), o = g(), s = g(), r = f(() => {
|
|
372
|
+
switch (e.position) {
|
|
373
|
+
case "top":
|
|
374
|
+
return 10;
|
|
375
|
+
case "middle":
|
|
376
|
+
return 50;
|
|
377
|
+
case "bottom":
|
|
378
|
+
return 85;
|
|
379
|
+
}
|
|
380
|
+
}), l = f(() => ({
|
|
381
|
+
top: `calc(${r.value}% - ${s.value}px)`,
|
|
382
|
+
left: `calc(50% - ${o.value}px)`,
|
|
383
|
+
backgroundColor: "black"
|
|
384
|
+
}));
|
|
385
|
+
return ne(() => {
|
|
386
|
+
o.value = n.value.offsetWidth / 2, s.value = n.value.offsetHeight / 2;
|
|
387
|
+
}), (d, m) => (I(), B("div", {
|
|
388
|
+
id: "toastWrapper",
|
|
389
|
+
ref_key: "toastWrapper",
|
|
390
|
+
ref: n,
|
|
391
|
+
class: "toastWrapper",
|
|
392
|
+
style: j([b(l), { zIndex: 9999 }])
|
|
393
|
+
}, [
|
|
394
|
+
H("div", vt, [
|
|
395
|
+
H("span", null, Le(t.message), 1)
|
|
396
|
+
])
|
|
397
|
+
], 4));
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
const le = (t, e) => {
|
|
401
|
+
const n = t.__vccOpts || t;
|
|
402
|
+
for (const [o, s] of e)
|
|
403
|
+
n[o] = s;
|
|
404
|
+
return n;
|
|
405
|
+
}, pt = /* @__PURE__ */ le(ft, [["__scopeId", "data-v-aef44c80"]]), ve = {
|
|
406
|
+
message: "\u61D2\u732B\u4E91 Yes!!!",
|
|
407
|
+
position: "middle",
|
|
408
|
+
duration: 1500
|
|
409
|
+
};
|
|
410
|
+
class Ht {
|
|
411
|
+
options;
|
|
412
|
+
container;
|
|
413
|
+
constructor(e) {
|
|
414
|
+
this.options = e, this.container = document.createElement("div");
|
|
415
|
+
}
|
|
416
|
+
present() {
|
|
417
|
+
const e = R(R(pt), { ...ve, ...this.options });
|
|
418
|
+
J(e, this.container), document.body.insertBefore(this.container, document.body.firstChild);
|
|
419
|
+
const n = this.options.duration || ve.duration;
|
|
420
|
+
setTimeout(() => {
|
|
421
|
+
this.dismiss();
|
|
422
|
+
}, n);
|
|
423
|
+
}
|
|
424
|
+
dismiss() {
|
|
425
|
+
this.container && (this.container.querySelector("#toastWrapper")?.classList.add("animate-toastAnimation"), setTimeout(() => {
|
|
426
|
+
this.container && (J(null, this.container), document.body.removeChild(this.container));
|
|
427
|
+
}, 500));
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
const ht = ["xlink:href", "fill", "color"], It = /* @__PURE__ */ F({
|
|
365
431
|
__name: "SvgIcon",
|
|
366
432
|
props: {
|
|
367
433
|
name: null,
|
|
@@ -378,62 +444,62 @@ const vt = ["xlink:href", "fill", "color"], Ht = /* @__PURE__ */ F({
|
|
|
378
444
|
}));
|
|
379
445
|
return (s, r) => (I(), B("svg", {
|
|
380
446
|
"aria-hidden": "",
|
|
381
|
-
style:
|
|
447
|
+
style: j(b(o))
|
|
382
448
|
}, [
|
|
383
449
|
H("use", {
|
|
384
|
-
"xlink:href":
|
|
450
|
+
"xlink:href": b(n),
|
|
385
451
|
fill: t.color,
|
|
386
452
|
color: t.color
|
|
387
|
-
}, null, 8,
|
|
453
|
+
}, null, 8, ht)
|
|
388
454
|
], 4));
|
|
389
455
|
}
|
|
390
456
|
});
|
|
391
|
-
function
|
|
457
|
+
function mt(t) {
|
|
392
458
|
const {
|
|
393
459
|
containerEl: e,
|
|
394
460
|
sliderEl: n,
|
|
395
461
|
autoHeight: o,
|
|
396
462
|
performance: s = {},
|
|
397
463
|
maxHeightRatio: r = 0.9
|
|
398
|
-
} = t, l = g(!0), d =
|
|
464
|
+
} = t, l = g(!0), d = ge(V, 100);
|
|
399
465
|
let m, p = "";
|
|
400
466
|
const v = g(0), h = g(0), i = g(0), u = g({
|
|
401
467
|
top: 0,
|
|
402
468
|
scrollTop: 0,
|
|
403
469
|
scrollHeight: 0,
|
|
404
470
|
clientHeight: 0
|
|
405
|
-
}),
|
|
471
|
+
}), T = g({
|
|
406
472
|
clientHeight: 0
|
|
407
|
-
}),
|
|
473
|
+
}), _ = f(() => !!h.value), N = f(() => u.value.scrollHeight > u.value.clientHeight), C = f(() => u.value.clientHeight - T.value.clientHeight), L = f(() => u.value.scrollHeight - u.value.clientHeight), D = f(() => Math.max(
|
|
408
474
|
u.value.clientHeight / u.value.scrollHeight,
|
|
409
475
|
0.05
|
|
410
|
-
)), Q = f(() => D.value > r ? 0 : D.value * u.value.clientHeight),
|
|
476
|
+
)), Q = f(() => D.value > r ? 0 : D.value * u.value.clientHeight), W = f(() => ({
|
|
411
477
|
willChange: "transform",
|
|
412
478
|
transform: `translate3d(0,${i.value}px,0)`,
|
|
413
479
|
height: o ? `${Q.value}px` : void 0
|
|
414
480
|
}));
|
|
415
|
-
function M(
|
|
416
|
-
P(), h.value =
|
|
481
|
+
function M(S) {
|
|
482
|
+
P(), h.value = S.clientY - n.value.getBoundingClientRect().top || 1, p = getComputedStyle(e.value).scrollBehavior, p === "smooth" && (e.value.style.scrollBehavior = "unset");
|
|
417
483
|
}
|
|
418
|
-
function
|
|
484
|
+
function k() {
|
|
419
485
|
e.value.style.scrollBehavior = p, h.value = 0, d();
|
|
420
486
|
}
|
|
421
487
|
function P() {
|
|
422
488
|
l.value = !1;
|
|
423
489
|
}
|
|
424
490
|
function V() {
|
|
425
|
-
|
|
491
|
+
_.value || (l.value = !0);
|
|
426
492
|
}
|
|
427
|
-
function
|
|
428
|
-
if (!
|
|
493
|
+
function z(S) {
|
|
494
|
+
if (!_.value)
|
|
429
495
|
return;
|
|
430
|
-
let O =
|
|
496
|
+
let O = S.clientY - u.value.top - h.value;
|
|
431
497
|
O < 0 ? i.value = 0 : O >= C.value ? i.value = C.value : i.value = O, e.value.scrollTo({
|
|
432
498
|
top: i.value / C.value * L.value
|
|
433
499
|
});
|
|
434
500
|
}
|
|
435
501
|
function U() {
|
|
436
|
-
|
|
502
|
+
_.value || q();
|
|
437
503
|
}
|
|
438
504
|
function q() {
|
|
439
505
|
cancelAnimationFrame(m), m = requestAnimationFrame(Y);
|
|
@@ -441,24 +507,24 @@ function ft(t) {
|
|
|
441
507
|
function Y() {
|
|
442
508
|
e.value && (v.value = s.scrollTop?.value ?? e.value.scrollTop, i.value = v.value / L.value * C.value);
|
|
443
509
|
}
|
|
444
|
-
function
|
|
510
|
+
function K(S) {
|
|
445
511
|
let O = "addEventListener";
|
|
446
|
-
|
|
512
|
+
S === "add" ? O = "addEventListener" : O = "removeEventListener", n.value?.[O]("pointerdown", M, {
|
|
447
513
|
passive: !0
|
|
448
|
-
}), window[O]("pointermove",
|
|
514
|
+
}), window[O]("pointermove", z, { passive: !0 }), window[O]("pointerup", k, { passive: !0 });
|
|
449
515
|
}
|
|
450
|
-
const G = new MutationObserver((
|
|
451
|
-
|
|
516
|
+
const G = new MutationObserver((S) => {
|
|
517
|
+
S.map((Ie) => Ie.oldValue).join().includes("height") && a();
|
|
452
518
|
});
|
|
453
519
|
function a() {
|
|
454
520
|
u.value.top = e.value?.getBoundingClientRect().top ?? 0, u.value.scrollHeight = e.value?.scrollHeight ?? 0, u.value.clientHeight = e.value?.clientHeight ?? 0;
|
|
455
521
|
}
|
|
456
522
|
function c() {
|
|
457
523
|
P(), setTimeout(() => {
|
|
458
|
-
|
|
524
|
+
T.value.clientHeight = n.value?.clientHeight ?? 0, V();
|
|
459
525
|
}, 150);
|
|
460
526
|
}
|
|
461
|
-
function
|
|
527
|
+
function w() {
|
|
462
528
|
document.styleSheets[0].insertRule(
|
|
463
529
|
".hide-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }",
|
|
464
530
|
0
|
|
@@ -468,9 +534,9 @@ function ft(t) {
|
|
|
468
534
|
), e.value?.classList.add("hide-scrollbar");
|
|
469
535
|
}
|
|
470
536
|
function y() {
|
|
471
|
-
e.value && n.value ? (
|
|
537
|
+
e.value && n.value ? (w(), e.value.addEventListener("scroll", U, {
|
|
472
538
|
passive: !0
|
|
473
|
-
}),
|
|
539
|
+
}), K("add"), G.observe(e.value, {
|
|
474
540
|
subtree: !0,
|
|
475
541
|
attributeOldValue: !0,
|
|
476
542
|
attributeFilter: ["style"]
|
|
@@ -482,16 +548,16 @@ function ft(t) {
|
|
|
482
548
|
P(), d();
|
|
483
549
|
}), {
|
|
484
550
|
isScrollEnd: l,
|
|
485
|
-
isDragSlider:
|
|
551
|
+
isDragSlider: _,
|
|
486
552
|
offsetTop: i,
|
|
487
553
|
scrollTop: v,
|
|
488
554
|
scrollable: N,
|
|
489
|
-
sliderPos:
|
|
555
|
+
sliderPos: W,
|
|
490
556
|
init: y,
|
|
491
|
-
modifySliderEventListener:
|
|
557
|
+
modifySliderEventListener: K
|
|
492
558
|
};
|
|
493
559
|
}
|
|
494
|
-
const
|
|
560
|
+
const gt = (t) => (ke("data-v-edec7292"), t = t(), Ve(), t), _t = /* @__PURE__ */ gt(() => /* @__PURE__ */ H("div", { class: "default-slider" }, null, -1)), bt = /* @__PURE__ */ F({
|
|
495
561
|
__name: "ScrollBar",
|
|
496
562
|
props: {
|
|
497
563
|
containerEl: null,
|
|
@@ -500,7 +566,7 @@ const pt = (t) => (Me("data-v-edec7292"), t = t(), We(), t), ht = /* @__PURE__ *
|
|
|
500
566
|
performance: null
|
|
501
567
|
},
|
|
502
568
|
setup(t, { expose: e }) {
|
|
503
|
-
const n = t, o = !!
|
|
569
|
+
const n = t, o = !!De().default, s = g(null), r = f(() => n.containerEl), l = mt({
|
|
504
570
|
containerEl: r,
|
|
505
571
|
sliderEl: s,
|
|
506
572
|
autoHeight: o ? n.autoHeight : !0,
|
|
@@ -510,7 +576,7 @@ const pt = (t) => (Me("data-v-edec7292"), t = t(), We(), t), ht = /* @__PURE__ *
|
|
|
510
576
|
ne(() => {
|
|
511
577
|
l.init();
|
|
512
578
|
});
|
|
513
|
-
}),
|
|
579
|
+
}), fe(() => {
|
|
514
580
|
l.modifySliderEventListener("remove");
|
|
515
581
|
});
|
|
516
582
|
function i() {
|
|
@@ -519,36 +585,31 @@ const pt = (t) => (Me("data-v-edec7292"), t = t(), We(), t), ht = /* @__PURE__ *
|
|
|
519
585
|
function u() {
|
|
520
586
|
v.value = !1;
|
|
521
587
|
}
|
|
522
|
-
return e({ uScrollBarReturn: l }), (
|
|
523
|
-
default:
|
|
524
|
-
|
|
588
|
+
return e({ uScrollBarReturn: l }), (T, _) => (I(), pe(he, null, {
|
|
589
|
+
default: me(() => [
|
|
590
|
+
We(H("div", {
|
|
525
591
|
ref_key: "sliderRef",
|
|
526
592
|
ref: s,
|
|
527
593
|
class: "slider-wrapper",
|
|
528
594
|
onMouseenter: i,
|
|
529
595
|
onMouseleave: u,
|
|
530
|
-
style:
|
|
596
|
+
style: j(b(p))
|
|
531
597
|
}, [
|
|
532
|
-
oe(
|
|
533
|
-
|
|
598
|
+
oe(T.$slots, "default", {}, () => [
|
|
599
|
+
_t
|
|
534
600
|
], !0)
|
|
535
601
|
], 36), [
|
|
536
|
-
[
|
|
602
|
+
[Me, b(h)]
|
|
537
603
|
])
|
|
538
604
|
]),
|
|
539
605
|
_: 3
|
|
540
606
|
}));
|
|
541
607
|
}
|
|
542
608
|
});
|
|
543
|
-
const
|
|
544
|
-
const n = t.__vccOpts || t;
|
|
545
|
-
for (const [o, s] of e)
|
|
546
|
-
n[o] = s;
|
|
547
|
-
return n;
|
|
548
|
-
}, It = /* @__PURE__ */ He(mt, [["__scopeId", "data-v-edec7292"]]), gt = { class: "virtualListWrapper" }, bt = {
|
|
609
|
+
const Ct = /* @__PURE__ */ le(bt, [["__scopeId", "data-v-edec7292"]]), yt = { class: "virtualListWrapper" }, St = {
|
|
549
610
|
inheritAttrs: !1
|
|
550
|
-
},
|
|
551
|
-
...
|
|
611
|
+
}, wt = /* @__PURE__ */ F({
|
|
612
|
+
...St,
|
|
552
613
|
__name: "VirtualList",
|
|
553
614
|
props: {
|
|
554
615
|
data: null,
|
|
@@ -557,7 +618,7 @@ const He = (t, e) => {
|
|
|
557
618
|
},
|
|
558
619
|
emits: ["scrollEnd"],
|
|
559
620
|
setup(t, { expose: e, emit: n }) {
|
|
560
|
-
const o = t, s = ut(
|
|
621
|
+
const o = t, s = ut(ze(o, "data"), {
|
|
561
622
|
itemHeight: (v) => o.itemHeight(o.data[v]),
|
|
562
623
|
overscan: o.overscan,
|
|
563
624
|
scrollEndHook: () => {
|
|
@@ -566,18 +627,18 @@ const He = (t, e) => {
|
|
|
566
627
|
}), { list: r, containerProps: l, wrapperProps: d, innerProps: m, getItemHeightData: p } = s;
|
|
567
628
|
return e({
|
|
568
629
|
vListReturn: s
|
|
569
|
-
}), (v, h) => (I(), B("div",
|
|
570
|
-
H("div",
|
|
571
|
-
onScrollPassive: h[0] || (h[0] = (...i) =>
|
|
572
|
-
ref:
|
|
630
|
+
}), (v, h) => (I(), B("div", yt, [
|
|
631
|
+
H("div", Ke({
|
|
632
|
+
onScrollPassive: h[0] || (h[0] = (...i) => b(l).onScroll && b(l).onScroll(...i)),
|
|
633
|
+
ref: b(l).ref,
|
|
573
634
|
class: "virtualList"
|
|
574
635
|
}, v.$attrs), [
|
|
575
|
-
H("div",
|
|
576
|
-
H("div",
|
|
577
|
-
(I(!0), B(
|
|
636
|
+
H("div", se(re(b(d))), [
|
|
637
|
+
H("div", se(re(b(m))), [
|
|
638
|
+
(I(!0), B(je, null, Ne(b(r), ({ index: i, data: u }) => (I(), B("div", {
|
|
578
639
|
key: i,
|
|
579
|
-
style:
|
|
580
|
-
height: `${
|
|
640
|
+
style: j({
|
|
641
|
+
height: `${b(p)(i).height}px`,
|
|
581
642
|
display: "flex"
|
|
582
643
|
})
|
|
583
644
|
}, [
|
|
@@ -592,83 +653,24 @@ const He = (t, e) => {
|
|
|
592
653
|
]));
|
|
593
654
|
}
|
|
594
655
|
});
|
|
595
|
-
const
|
|
596
|
-
__name: "Toast",
|
|
597
|
-
props: {
|
|
598
|
-
message: null,
|
|
599
|
-
position: null
|
|
600
|
-
},
|
|
601
|
-
setup(t) {
|
|
602
|
-
const e = t, n = g(), o = g(), s = g(), r = f(() => {
|
|
603
|
-
switch (e.position) {
|
|
604
|
-
case "top":
|
|
605
|
-
return 10;
|
|
606
|
-
case "middle":
|
|
607
|
-
return 50;
|
|
608
|
-
case "bottom":
|
|
609
|
-
return 85;
|
|
610
|
-
}
|
|
611
|
-
}), l = f(() => ({
|
|
612
|
-
top: `calc(${r.value}% - ${s.value}px)`,
|
|
613
|
-
left: `calc(50% - ${o.value}px)`,
|
|
614
|
-
backgroundColor: "black"
|
|
615
|
-
}));
|
|
616
|
-
return ne(() => {
|
|
617
|
-
o.value = n.value.offsetWidth / 2, s.value = n.value.offsetHeight / 2;
|
|
618
|
-
}), (d, m) => (I(), B("div", {
|
|
619
|
-
id: "toastWrapper",
|
|
620
|
-
ref_key: "toastWrapper",
|
|
621
|
-
ref: n,
|
|
622
|
-
class: "absolute rounded-[8px] bg-black px-[14px] py-[12px] opacity-[0.79]",
|
|
623
|
-
style: K([_(l), { zIndex: 9999 }])
|
|
624
|
-
}, [
|
|
625
|
-
H("div", yt, [
|
|
626
|
-
H("span", wt, Ne(t.message), 1)
|
|
627
|
-
])
|
|
628
|
-
], 4));
|
|
629
|
-
}
|
|
630
|
-
}), de = {
|
|
631
|
-
message: "\u61D2\u732B\u4E91 Yes!!!",
|
|
632
|
-
position: "middle",
|
|
633
|
-
duration: 1500
|
|
634
|
-
};
|
|
635
|
-
class Bt {
|
|
636
|
-
options;
|
|
637
|
-
container;
|
|
638
|
-
constructor(e) {
|
|
639
|
-
this.options = e, this.container = document.createElement("div");
|
|
640
|
-
}
|
|
641
|
-
present() {
|
|
642
|
-
const e = R(R(St), { ...de, ...this.options });
|
|
643
|
-
J(e, this.container), document.body.insertBefore(this.container, document.body.firstChild);
|
|
644
|
-
const n = this.options.duration || de.duration;
|
|
645
|
-
setTimeout(() => {
|
|
646
|
-
this.dismiss();
|
|
647
|
-
}, n);
|
|
648
|
-
}
|
|
649
|
-
dismiss() {
|
|
650
|
-
this.container && (this.container.querySelector("#toastWrapper")?.classList.add("animate-toastAnimation"), setTimeout(() => {
|
|
651
|
-
this.container && (J(null, this.container), document.body.removeChild(this.container));
|
|
652
|
-
}, 500));
|
|
653
|
-
}
|
|
654
|
-
}
|
|
656
|
+
const Bt = /* @__PURE__ */ le(wt, [["__scopeId", "data-v-4ba97cce"]]);
|
|
655
657
|
export {
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
658
|
+
Ct as ScrollBar,
|
|
659
|
+
It as SvgIcon,
|
|
660
|
+
Ht as ToastCreator,
|
|
661
|
+
Bt as VirtualList,
|
|
660
662
|
we as allSelectedKey,
|
|
661
663
|
ct as closeDialogKey,
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
664
|
+
xt as dialogController,
|
|
665
|
+
xe as isAllSelectedKey,
|
|
666
|
+
Se as isSelectedKey,
|
|
667
|
+
Ee as selectAllKey,
|
|
668
|
+
Oe as selectKey,
|
|
667
669
|
be as toggleAllKey,
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
670
|
+
ye as toggleKey,
|
|
671
|
+
He as unselectAllKey,
|
|
672
|
+
Te as unselectKey,
|
|
673
|
+
Tt as useSelectable,
|
|
674
|
+
Et as useSelectableInjectors,
|
|
673
675
|
ut as useVirtualList
|
|
674
676
|
};
|
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 T=typeof window<"u";T&&((Z=window?.navigator)==null?void 0:Z.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function $(n){return typeof n=="function"?n():e.unref(n)}function ue(n,t){function o(...l){n(()=>t.apply(this,l),{fn:t,thisArg:this,args:l})}return o}function de(n,t={}){let o,l;return s=>{const r=$(n),f=$(t.maxWait);if(o&&clearTimeout(o),r<=0||f!==void 0&&f<=0)return l&&(clearTimeout(l),l=null),s();f&&!l&&(l=setTimeout(()=>{o&&clearTimeout(o),l=null,s()},f)),o=setTimeout(()=>{l&&clearTimeout(l),l=null,s()},r)}}function fe(n){return n}function pe(n){return e.getCurrentScope()?(e.onScopeDispose(n),!0):!1}function ee(n,t=200,o={}){return ue(de(t,o),n)}function he(n,t=!0){e.getCurrentInstance()?e.onMounted(n):t?n():e.nextTick(n)}function te(n){var t;const o=$(n);return(t=o?.$el)!=null?t:o}const me=T?window:void 0;T&&window.document,T&&window.navigator,T&&window.location;function ge(n,t=!1){const o=e.ref(),l=()=>o.value=Boolean(n());return l(),he(l,t),o}const F=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},L="__vueuse_ssr_handlers__";F[L]=F[L]||{},F[L];var ne=Object.getOwnPropertySymbols,ye=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable,be=(n,t)=>{var o={};for(var l in n)ye.call(n,l)&&t.indexOf(l)<0&&(o[l]=n[l]);if(n!=null&&ne)for(var l of ne(n))t.indexOf(l)<0&&ve.call(n,l)&&(o[l]=n[l]);return o};function _e(n,t,o={}){const l=o,{window:i=me}=l,s=be(l,["window"]);let r;const f=ge(()=>i&&"ResizeObserver"in i),y=()=>{r&&(r.disconnect(),r=void 0)},m=e.watch(()=>te(n),g=>{y(),f.value&&i&&g&&(r=new ResizeObserver(t),r.observe(g,s))},{immediate:!0,flush:"post"}),p=()=>{y(),m()};return pe(p),{isSupported:f,stop:p}}function Se(n,t={width:0,height:0},o={}){const{box:l="content-box"}=o,i=e.ref(t.width),s=e.ref(t.height);return _e(n,([r])=>{const f=l==="border-box"?r.borderBoxSize:l==="content-box"?r.contentBoxSize:r.devicePixelContentBoxSize;f?(i.value=f.reduce((y,{inlineSize:m})=>y+m,0),s.value=f.reduce((y,{blockSize:m})=>y+m,0)):(i.value=r.contentRect.width,s.value=r.contentRect.height)},o),e.watch(()=>te(n),r=>{i.value=r?t.width:0,s.value=r?t.height:0}),{width:i,height:s}}var oe;(function(n){n.UP="UP",n.RIGHT="RIGHT",n.DOWN="DOWN",n.LEFT="LEFT",n.NONE="NONE"})(oe||(oe={}));var we=Object.defineProperty,le=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,re=(n,t,o)=>t in n?we(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,Te=(n,t)=>{for(var o in t||(t={}))Ee.call(t,o)&&re(n,o,t[o]);if(le)for(var o of le(t))Oe.call(t,o)&&re(n,o,t[o]);return n};Te({linear:fe},{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(n,t){const{scrollEndHook:o,itemHeight:l,overscan:i=5}=t,s=e.ref(null),r=Se(s),f=e.ref(!0),y=ee(q,100);let m;const p=e.shallowRef(n),g=e.ref(0),c=e.ref({start:0,end:10});let u=0;const E=e.ref([]),v=e.computed(()=>{let{sum:a,height:d}={sum:0,height:0};return p.value.map((S,b)=>(typeof l=="number"?d=l:d=l(b),a+=d,{height:d,sum:a}))}),U=e.computed(()=>R(c.value.start)),O=e.computed(()=>typeof l=="number"?v.value.length*l:v.value[v.value.length-1]?.sum||0),x=e.computed(()=>{let a=E.value.length-i,d=Math.max(a-u,0);return E.value.slice(d,a)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(m)),e.watch([r.width,r.height,p],([a,d])=>{(a||d)&&I()},{deep:!0}),e.watch(g,()=>{H(),y()});function H(){f.value=!1}function q(){f.value=!0,o?.()}function I(){cancelAnimationFrame(m),m=requestAnimationFrame(C)}function C(){if(s.value){g.value=s.value.scrollTop,u=B();let a=P(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},E.value=p.value.slice(a,d).map((S,b)=>({data:S,index:b+a}))}}function P(a){let d=0,S=v.value.length-1,b=-1;for(;d<=S;){const _=Math.floor((d+S)/2);v.value[_].sum>=a?(b=_,S=_-1):d=_+1}return Math.max(0,b)}function B(){let a=0,d=0,S=Y();for(let b=S;b<v.value.length&&(a++,d+=v.value[b].height,!(d>=r.height.value));b++);return a}function R(a){if(typeof l=="number")return a*l;let d=v.value[a];return d?d.sum-d.height:0}function k(a){return v.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=k(a);s.value.scrollTop=d.sum-d.height,C()}}const J=e.computed(()=>({style:{width:"100%",height:`${O.value}px`,pointerEvents:f.value?void 0:"none"}})),A=e.computed(()=>({style:{transform:`translate3d(0, ${U.value}px, 0)`,"will-change":"transform"}})),X={overflowY:"auto"};return{list:E,visiableList:x,getItemHeightData:k,getoffsetTopIndex:P,totalHeight:O,clientHeight:r.height,scrollTo:G,scrollTop:g,isScrollEnd:f,containerProps:{ref:s,onScroll:()=>{I()},style:X},wrapperProps:J,innerProps:A}}const D=Symbol(),V=Symbol(),j=Symbol(),K=Symbol(),M=Symbol(),N=Symbol(),z=Symbol(),W=Symbol(),Q=Symbol();function Be(){const{voidFn:n,boolFn:t,boolRef:o,arrayRef:l}={voidFn:u=>{},boolFn:u=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},i=e.inject(K,l),s=e.inject(j,t),r=e.inject(W,o),f=e.inject(V,n),y=e.inject(D,n),m=e.inject(M,n),p=e.inject(N,n),g=e.inject(z,n),c=e.inject(Q,n);return{selected:i,isSelected:s,isAllSelected:r,toggle:f,toggleAll:y,select:m,selectAll:p,unselect:g,unselectAll:c}}function xe(n,t){const o=e.ref({}),l=e.computed(()=>n.value.filter(c=>o.value[c[t]])),i=e.computed(()=>l.value.length!=0&&Object.keys(o.value).length==n.value.length);function s(){n.value.forEach(c=>{o.value[c[t]]=!0})}function r(){o.value={}}function f(c){c.forEach(u=>{o.value[u[t]]||(o.value[u[t]]=!0)})}function y(c){c.forEach(u=>{o.value[u[t]]&&delete o.value[u[t]]})}function m(c){return!!o.value[c[t]]}function p(c){c.forEach(u=>{m(u)?delete o.value[u[t]]:o.value[u[t]]=!0})}function g(){i.value?r():s()}return e.provide(D,g),e.provide(V,p),e.provide(j,m),e.provide(K,l),e.provide(M,f),e.provide(N,s),e.provide(z,y),e.provide(W,i),e.provide(Q,r),{selected:l,select:f,selectAll:s,unselect:y,unselectAll:r,toggle:p,toggleAll:g,isSelected:m,isAllSelected:i}}const se=Symbol(),He=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0},dialogClass:{default:""}},emits:["update:visiable"],setup(n,{emit:t}){const o=n,l=()=>{o.closeOnClickOverlay&&t("update:visiable",!1)};return e.provide(se,()=>t("update:visiable",!1)),(i,s)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[n.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:l,class:"modal absolute inset-0 bottom-0 flex bg-stone-900 bg-opacity-50 z-[999]"},[e.createElementVNode("div",{onClick:s[0]||(s[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog m-auto flex flex-col",n.dialogClass])},[e.renderSlot(i.$slots,"default")],2)])):e.createCommentVNode("",!0)]),_:3}))}});function Ie(n){function t(o,l){const i=document.createElement("div"),s={setup(){return()=>e.h(He,{visiable:!0,"onUpdate:visiable":()=>{i?.remove()},...n},{default:()=>e.h(o,l)})}};return document.body.appendChild(i),e.render(e.h(s),i),{close:()=>i?.remove()}}return{create:t}}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(n){const t=n,o=e.computed(()=>`#${t.prefix}-${t.name}`),l=e.computed(()=>({width:`${t.width??t.height}px`,height:`${t.height??t.width}px`,aspectRatio:t.width&&t.height?void 0:"1/1"}));return(i,s)=>(e.openBlock(),e.createElementBlock("svg",{"aria-hidden":"",style:e.normalizeStyle(e.unref(l))},[e.createElementVNode("use",{"xlink:href":e.unref(o),fill:n.color,color:n.color},null,8,Ce)],4))}});function Re(n){const{containerEl:t,sliderEl:o,autoHeight:l,performance:i={},maxHeightRatio:s=.9}=n,r=e.ref(!0),f=ee(R,100);let y,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}),E=e.ref({clientHeight:0}),v=e.computed(()=>!!g.value),U=e.computed(()=>u.value.scrollHeight>u.value.clientHeight),O=e.computed(()=>u.value.clientHeight-E.value.clientHeight),x=e.computed(()=>u.value.scrollHeight-u.value.clientHeight),H=e.computed(()=>Math.max(u.value.clientHeight/u.value.scrollHeight,.05)),q=e.computed(()=>H.value>s?0:H.value*u.value.clientHeight),I=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${c.value}px,0)`,height:l?`${q.value}px`:void 0}));function C(_){B(),g.value=_.clientY-o.value.getBoundingClientRect().top||1,m=getComputedStyle(t.value).scrollBehavior,m==="smooth"&&(t.value.style.scrollBehavior="unset")}function P(){t.value.style.scrollBehavior=m,g.value=0,f()}function B(){r.value=!1}function R(){v.value||(r.value=!0)}function k(_){if(!v.value)return;let w=_.clientY-u.value.top-g.value;w<0?c.value=0:w>=O.value?c.value=O.value:c.value=w,t.value.scrollTo({top:c.value/O.value*x.value})}function Y(){v.value||G()}function G(){cancelAnimationFrame(y),y=requestAnimationFrame(J)}function J(){t.value&&(p.value=i.scrollTop?.value??t.value.scrollTop,c.value=p.value/x.value*O.value)}function A(_){let w="addEventListener";_==="add"?w="addEventListener":w="removeEventListener",o.value?.[w]("pointerdown",C,{passive:!0}),window[w]("pointermove",k,{passive:!0}),window[w]("pointerup",P,{passive:!0})}const X=new MutationObserver(_=>{_.map(ze=>ze.oldValue).join().includes("height")&&a()});function a(){u.value.top=t.value?.getBoundingClientRect().top??0,u.value.scrollHeight=t.value?.scrollHeight??0,u.value.clientHeight=t.value?.clientHeight??0}function d(){B(),setTimeout(()=>{E.value.clientHeight=o.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),t.value?.classList.add("hide-scrollbar")}function b(){t.value&&o.value?(S(),t.value.addEventListener("scroll",Y,{passive:!0}),A("add"),X.observe(t.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{a()},100),d()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:t,sliderEl:o})}return e.watch(p,()=>{B(),f()}),{isScrollEnd:r,isDragSlider:v,offsetTop:c,scrollTop:p,scrollable:U,sliderPos:I,init:b,modifySliderEventListener:A}}const ke=(n=>(e.pushScopeId("data-v-edec7292"),n=n(),e.popScopeId(),n))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),Ae=e.defineComponent({__name:"ScrollBar",props:{containerEl:null,autoHide:{type:Boolean},autoHeight:{type:Boolean},performance:null},setup(n,{expose:t}){const o=n,l=!!e.useSlots().default,i=e.ref(null),s=e.computed(()=>o.containerEl),r=Re({containerEl:s,sliderEl:i,autoHeight:l?o.autoHeight:!0,performance:o.performance}),{scrollable:f,isScrollEnd:y,sliderPos:m}=r,p=e.ref(!1),g=o.autoHide?e.computed(()=>p.value||!y.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 t({uScrollBarReturn:r}),(E,v)=>(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(E.$slots,"default",{},()=>[ke],!0)],36),[[e.vShow,e.unref(g)]])]),_:3}))}}),Ue="",ae=(n,t)=>{const o=n.__vccOpts||n;for(const[l,i]of t)o[l]=i;return o},$e=ae(Ae,[["__scopeId","data-v-edec7292"]]),Fe={class:"virtualListWrapper"},Le={inheritAttrs:!1},De=e.defineComponent({...Le,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},emits:["scrollEnd"],setup(n,{expose:t,emit:o}){const l=n,i=ie(e.toRef(l,"data"),{itemHeight:p=>l.itemHeight(l.data[p]),overscan:l.overscan,scrollEndHook:()=>{o("scrollEnd")}}),{list:s,containerProps:r,wrapperProps:f,innerProps:y,getItemHeightData:m}=i;return t({vListReturn:i}),(p,g)=>(e.openBlock(),e.createElementBlock("div",Fe,[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(y))),[(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)]))}}),qe="",Ve=ae(De,[["__scopeId","data-v-4ba97cce"]]),je={class:"flex w-full max-w-[700px] items-center justify-center"},Ke={class:"text-[14px] text-white"},Me=e.defineComponent({__name:"Toast",props:{message:null,position:null},setup(n){const t=n,o=e.ref(),l=e.ref(),i=e.ref(),s=e.computed(()=>{switch(t.position){case"top":return 10;case"middle":return 50;case"bottom":return 85}}),r=e.computed(()=>({top:`calc(${s.value}% - ${i.value}px)`,left:`calc(50% - ${l.value}px)`,backgroundColor:"black"}));return e.nextTick(()=>{l.value=o.value.offsetWidth/2,i.value=o.value.offsetHeight/2}),(f,y)=>(e.openBlock(),e.createElementBlock("div",{id:"toastWrapper",ref_key:"toastWrapper",ref:o,class:"absolute rounded-[8px] bg-black px-[14px] py-[12px] opacity-[0.79]",style:e.normalizeStyle([e.unref(r),{zIndex:9999}])},[e.createElementVNode("div",je,[e.createElementVNode("span",Ke,e.toDisplayString(n.message),1)])],4))}}),ce={message:"\u61D2\u732B\u4E91 Yes!!!",position:"middle",duration:1500};class Ne{options;container;constructor(t){this.options=t,this.container=document.createElement("div")}present(){const t=e.h(e.h(Me),{...ce,...this.options});e.render(t,this.container),document.body.insertBefore(this.container,document.body.firstChild);const o=this.options.duration||ce.duration;setTimeout(()=>{this.dismiss()},o)}dismiss(){this.container&&(this.container.querySelector("#toastWrapper")?.classList.add("animate-toastAnimation"),setTimeout(()=>{this.container&&(e.render(null,this.container),document.body.removeChild(this.container))},500))}}h.ScrollBar=$e,h.SvgIcon=Pe,h.ToastCreator=Ne,h.VirtualList=Ve,h.allSelectedKey=K,h.closeDialogKey=se,h.dialogController=Ie,h.isAllSelectedKey=W,h.isSelectedKey=j,h.selectAllKey=N,h.selectKey=M,h.toggleAllKey=D,h.toggleKey=V,h.unselectAllKey=Q,h.unselectKey=z,h.useSelectable=xe,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 ee;const T=typeof window<"u";T&&((ee=window?.navigator)==null?void 0:ee.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function $(n){return typeof n=="function"?n():e.unref(n)}function ue(n,t){function o(...l){n(()=>t.apply(this,l),{fn:t,thisArg:this,args:l})}return o}function de(n,t={}){let o,l;return a=>{const r=$(n),f=$(t.maxWait);if(o&&clearTimeout(o),r<=0||f!==void 0&&f<=0)return l&&(clearTimeout(l),l=null),a();f&&!l&&(l=setTimeout(()=>{o&&clearTimeout(o),l=null,a()},f)),o=setTimeout(()=>{l&&clearTimeout(l),l=null,a()},r)}}function fe(n){return n}function pe(n){return e.getCurrentScope()?(e.onScopeDispose(n),!0):!1}function te(n,t=200,o={}){return ue(de(t,o),n)}function he(n,t=!0){e.getCurrentInstance()?e.onMounted(n):t?n():e.nextTick(n)}function ne(n){var t;const o=$(n);return(t=o?.$el)!=null?t:o}const me=T?window:void 0;T&&window.document,T&&window.navigator,T&&window.location;function ge(n,t=!1){const o=e.ref(),l=()=>o.value=Boolean(n());return l(),he(l,t),o}const F=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},L="__vueuse_ssr_handlers__";F[L]=F[L]||{},F[L];var oe=Object.getOwnPropertySymbols,_e=Object.prototype.hasOwnProperty,ye=Object.prototype.propertyIsEnumerable,ve=(n,t)=>{var o={};for(var l in n)_e.call(n,l)&&t.indexOf(l)<0&&(o[l]=n[l]);if(n!=null&&oe)for(var l of oe(n))t.indexOf(l)<0&&ye.call(n,l)&&(o[l]=n[l]);return o};function be(n,t,o={}){const l=o,{window:i=me}=l,a=ve(l,["window"]);let r;const f=ge(()=>i&&"ResizeObserver"in i),_=()=>{r&&(r.disconnect(),r=void 0)},m=e.watch(()=>ne(n),g=>{_(),f.value&&i&&g&&(r=new ResizeObserver(t),r.observe(g,a))},{immediate:!0,flush:"post"}),p=()=>{_(),m()};return pe(p),{isSupported:f,stop:p}}function Se(n,t={width:0,height:0},o={}){const{box:l="content-box"}=o,i=e.ref(t.width),a=e.ref(t.height);return be(n,([r])=>{const f=l==="border-box"?r.borderBoxSize:l==="content-box"?r.contentBoxSize:r.devicePixelContentBoxSize;f?(i.value=f.reduce((_,{inlineSize:m})=>_+m,0),a.value=f.reduce((_,{blockSize:m})=>_+m,0)):(i.value=r.contentRect.width,a.value=r.contentRect.height)},o),e.watch(()=>ne(n),r=>{i.value=r?t.width:0,a.value=r?t.height:0}),{width:i,height:a}}var le;(function(n){n.UP="UP",n.RIGHT="RIGHT",n.DOWN="DOWN",n.LEFT="LEFT",n.NONE="NONE"})(le||(le={}));var we=Object.defineProperty,re=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,ie=(n,t,o)=>t in n?we(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,Te=(n,t)=>{for(var o in t||(t={}))Ee.call(t,o)&&ie(n,o,t[o]);if(re)for(var o of re(t))Oe.call(t,o)&&ie(n,o,t[o]);return n};Te({linear:fe},{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 ae(n,t){const{scrollEndHook:o,itemHeight:l,overscan:i=5}=t,a=e.ref(null),r=Se(a),f=e.ref(!0),_=te(Y,100);let m;const p=e.shallowRef(n),g=e.ref(0),c=e.ref({start:0,end:10});let u=0;const E=e.ref([]),y=e.computed(()=>{let{sum:s,height:d}={sum:0,height:0};return p.value.map((S,v)=>(typeof l=="number"?d=l:d=l(v),s+=d,{height:d,sum:s}))}),q=e.computed(()=>R(c.value.start)),O=e.computed(()=>typeof l=="number"?y.value.length*l:y.value[y.value.length-1]?.sum||0),I=e.computed(()=>{let s=E.value.length-i,d=Math.max(s-u,0);return E.value.slice(d,s)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(m)),e.watch([r.width,r.height,p],([s,d])=>{(s||d)&&C()},{deep:!0}),e.watch(g,()=>{H(),_()});function H(){f.value=!1}function Y(){f.value=!0,o?.()}function C(){cancelAnimationFrame(m),m=requestAnimationFrame(P)}function P(){if(a.value){g.value=a.value.scrollTop,u=B();let s=x(g.value),d=s+u+i;s=s-i,s=s<0?0:s,d=d>p.value.length?p.value.length:d,c.value={start:s,end:d},E.value=p.value.slice(s,d).map((S,v)=>({data:S,index:v+s}))}}function x(s){let d=0,S=y.value.length-1,v=-1;for(;d<=S;){const b=Math.floor((d+S)/2);y.value[b].sum>=s?(v=b,S=b-1):d=b+1}return Math.max(0,v)}function B(){let s=0,d=0,S=G();for(let v=S;v<y.value.length&&(s++,d+=y.value[v].height,!(d>=r.height.value));v++);return s}function R(s){if(typeof l=="number")return s*l;let d=y.value[s];return d?d.sum-d.height:0}function k(s){return y.value[s]||{sum:0,height:0}}function G(){let s=c.value.start;return s>=i&&(s+=i),s}function J(s){if(a.value){const d=k(s);a.value.scrollTop=d.sum-d.height,P()}}const X=e.computed(()=>({style:{width:"100%",height:`${O.value}px`,pointerEvents:f.value?void 0:"none"}})),A=e.computed(()=>({style:{transform:`translate3d(0, ${q.value}px, 0)`,"will-change":"transform"}})),Z={overflowY:"auto"};return{list:E,visiableList:I,getItemHeightData:k,getoffsetTopIndex:x,totalHeight:O,clientHeight:r.height,scrollTo:J,scrollTop:g,isScrollEnd:f,containerProps:{ref:a,onScroll:()=>{C()},style:Z},wrapperProps:X,innerProps:A}}const D=Symbol(),V=Symbol(),j=Symbol(),K=Symbol(),M=Symbol(),N=Symbol(),W=Symbol(),z=Symbol(),Q=Symbol();function Be(){const{voidFn:n,boolFn:t,boolRef:o,arrayRef:l}={voidFn:u=>{},boolFn:u=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},i=e.inject(K,l),a=e.inject(j,t),r=e.inject(z,o),f=e.inject(V,n),_=e.inject(D,n),m=e.inject(M,n),p=e.inject(N,n),g=e.inject(W,n),c=e.inject(Q,n);return{selected:i,isSelected:a,isAllSelected:r,toggle:f,toggleAll:_,select:m,selectAll:p,unselect:g,unselectAll:c}}function Ie(n,t){const o=e.ref({}),l=e.computed(()=>n.value.filter(c=>o.value[c[t]])),i=e.computed(()=>l.value.length!=0&&Object.keys(o.value).length==n.value.length);function a(){n.value.forEach(c=>{o.value[c[t]]=!0})}function r(){o.value={}}function f(c){c.forEach(u=>{o.value[u[t]]||(o.value[u[t]]=!0)})}function _(c){c.forEach(u=>{o.value[u[t]]&&delete o.value[u[t]]})}function m(c){return!!o.value[c[t]]}function p(c){c.forEach(u=>{m(u)?delete o.value[u[t]]:o.value[u[t]]=!0})}function g(){i.value?r():a()}return e.provide(D,g),e.provide(V,p),e.provide(j,m),e.provide(K,l),e.provide(M,f),e.provide(N,a),e.provide(W,_),e.provide(z,i),e.provide(Q,r),{selected:l,select:f,selectAll:a,unselect:_,unselectAll:r,toggle:p,toggleAll:g,isSelected:m,isAllSelected:i}}const se=Symbol(),He=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0},dialogClass:{default:""}},emits:["update:visiable"],setup(n,{emit:t}){const o=n,l=()=>{o.closeOnClickOverlay&&t("update:visiable",!1)};return e.provide(se,()=>t("update:visiable",!1)),(i,a)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[n.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:l,class:"modal absolute inset-0 bottom-0 flex bg-stone-900 bg-opacity-50 z-[999]"},[e.createElementVNode("div",{onClick:a[0]||(a[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog m-auto flex flex-col",n.dialogClass])},[e.renderSlot(i.$slots,"default")],2)])):e.createCommentVNode("",!0)]),_:3}))}});function Ce(n){function t(o,l){const i=document.createElement("div"),a={setup(){return()=>e.h(He,{visiable:!0,"onUpdate:visiable":()=>{i?.remove()},...n},{default:()=>e.h(o,l)})}};return document.body.appendChild(i),e.render(e.h(a),i),{close:()=>i?.remove()}}return{create:t}}const Pe={class:"toast"},xe=e.defineComponent({__name:"Toast",props:{message:null,position:null},setup(n){const t=n,o=e.ref(),l=e.ref(),i=e.ref(),a=e.computed(()=>{switch(t.position){case"top":return 10;case"middle":return 50;case"bottom":return 85}}),r=e.computed(()=>({top:`calc(${a.value}% - ${i.value}px)`,left:`calc(50% - ${l.value}px)`,backgroundColor:"black"}));return e.nextTick(()=>{l.value=o.value.offsetWidth/2,i.value=o.value.offsetHeight/2}),(f,_)=>(e.openBlock(),e.createElementBlock("div",{id:"toastWrapper",ref_key:"toastWrapper",ref:o,class:"toastWrapper",style:e.normalizeStyle([e.unref(r),{zIndex:9999}])},[e.createElementVNode("div",Pe,[e.createElementVNode("span",null,e.toDisplayString(n.message),1)])],4))}}),Qe="",U=(n,t)=>{const o=n.__vccOpts||n;for(const[l,i]of t)o[l]=i;return o},Re=U(xe,[["__scopeId","data-v-aef44c80"]]),ce={message:"\u61D2\u732B\u4E91 Yes!!!",position:"middle",duration:1500};class ke{options;container;constructor(t){this.options=t,this.container=document.createElement("div")}present(){const t=e.h(e.h(Re),{...ce,...this.options});e.render(t,this.container),document.body.insertBefore(this.container,document.body.firstChild);const o=this.options.duration||ce.duration;setTimeout(()=>{this.dismiss()},o)}dismiss(){this.container&&(this.container.querySelector("#toastWrapper")?.classList.add("animate-toastAnimation"),setTimeout(()=>{this.container&&(e.render(null,this.container),document.body.removeChild(this.container))},500))}}const Ae=["xlink:href","fill","color"],$e=e.defineComponent({__name:"SvgIcon",props:{name:null,prefix:{default:"icon"},color:{default:"#FFF"},width:null,height:null},setup(n){const t=n,o=e.computed(()=>`#${t.prefix}-${t.name}`),l=e.computed(()=>({width:`${t.width??t.height}px`,height:`${t.height??t.width}px`,aspectRatio:t.width&&t.height?void 0:"1/1"}));return(i,a)=>(e.openBlock(),e.createElementBlock("svg",{"aria-hidden":"",style:e.normalizeStyle(e.unref(l))},[e.createElementVNode("use",{"xlink:href":e.unref(o),fill:n.color,color:n.color},null,8,Ae)],4))}});function Fe(n){const{containerEl:t,sliderEl:o,autoHeight:l,performance:i={},maxHeightRatio:a=.9}=n,r=e.ref(!0),f=te(R,100);let _,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}),E=e.ref({clientHeight:0}),y=e.computed(()=>!!g.value),q=e.computed(()=>u.value.scrollHeight>u.value.clientHeight),O=e.computed(()=>u.value.clientHeight-E.value.clientHeight),I=e.computed(()=>u.value.scrollHeight-u.value.clientHeight),H=e.computed(()=>Math.max(u.value.clientHeight/u.value.scrollHeight,.05)),Y=e.computed(()=>H.value>a?0:H.value*u.value.clientHeight),C=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${c.value}px,0)`,height:l?`${Y.value}px`:void 0}));function P(b){B(),g.value=b.clientY-o.value.getBoundingClientRect().top||1,m=getComputedStyle(t.value).scrollBehavior,m==="smooth"&&(t.value.style.scrollBehavior="unset")}function x(){t.value.style.scrollBehavior=m,g.value=0,f()}function B(){r.value=!1}function R(){y.value||(r.value=!0)}function k(b){if(!y.value)return;let w=b.clientY-u.value.top-g.value;w<0?c.value=0:w>=O.value?c.value=O.value:c.value=w,t.value.scrollTo({top:c.value/O.value*I.value})}function G(){y.value||J()}function J(){cancelAnimationFrame(_),_=requestAnimationFrame(X)}function X(){t.value&&(p.value=i.scrollTop?.value??t.value.scrollTop,c.value=p.value/I.value*O.value)}function A(b){let w="addEventListener";b==="add"?w="addEventListener":w="removeEventListener",o.value?.[w]("pointerdown",P,{passive:!0}),window[w]("pointermove",k,{passive:!0}),window[w]("pointerup",x,{passive:!0})}const Z=new MutationObserver(b=>{b.map(We=>We.oldValue).join().includes("height")&&s()});function s(){u.value.top=t.value?.getBoundingClientRect().top??0,u.value.scrollHeight=t.value?.scrollHeight??0,u.value.clientHeight=t.value?.clientHeight??0}function d(){B(),setTimeout(()=>{E.value.clientHeight=o.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),t.value?.classList.add("hide-scrollbar")}function v(){t.value&&o.value?(S(),t.value.addEventListener("scroll",G,{passive:!0}),A("add"),Z.observe(t.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{s()},100),d()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:t,sliderEl:o})}return e.watch(p,()=>{B(),f()}),{isScrollEnd:r,isDragSlider:y,offsetTop:c,scrollTop:p,scrollable:q,sliderPos:C,init:v,modifySliderEventListener:A}}const Le=(n=>(e.pushScopeId("data-v-edec7292"),n=n(),e.popScopeId(),n))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),De=e.defineComponent({__name:"ScrollBar",props:{containerEl:null,autoHide:{type:Boolean},autoHeight:{type:Boolean},performance:null},setup(n,{expose:t}){const o=n,l=!!e.useSlots().default,i=e.ref(null),a=e.computed(()=>o.containerEl),r=Fe({containerEl:a,sliderEl:i,autoHeight:l?o.autoHeight:!0,performance:o.performance}),{scrollable:f,isScrollEnd:_,sliderPos:m}=r,p=e.ref(!1),g=o.autoHide?e.computed(()=>p.value||!_.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 t({uScrollBarReturn:r}),(E,y)=>(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(E.$slots,"default",{},()=>[Le],!0)],36),[[e.vShow,e.unref(g)]])]),_:3}))}}),qe="",Ve=U(De,[["__scopeId","data-v-edec7292"]]),je={class:"virtualListWrapper"},Ke={inheritAttrs:!1},Me=e.defineComponent({...Ke,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},emits:["scrollEnd"],setup(n,{expose:t,emit:o}){const l=n,i=ae(e.toRef(l,"data"),{itemHeight:p=>l.itemHeight(l.data[p]),overscan:l.overscan,scrollEndHook:()=>{o("scrollEnd")}}),{list:a,containerProps:r,wrapperProps:f,innerProps:_,getItemHeightData:m}=i;return t({vListReturn:i}),(p,g)=>(e.openBlock(),e.createElementBlock("div",je,[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(_))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a),({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)]))}}),Ye="",Ne=U(Me,[["__scopeId","data-v-4ba97cce"]]);h.ScrollBar=Ve,h.SvgIcon=$e,h.ToastCreator=ke,h.VirtualList=Ne,h.allSelectedKey=K,h.closeDialogKey=se,h.dialogController=Ce,h.isAllSelectedKey=z,h.isSelectedKey=j,h.selectAllKey=N,h.selectKey=M,h.toggleAllKey=D,h.toggleKey=V,h.unselectAllKey=Q,h.unselectKey=W,h.useSelectable=Ie,h.useSelectableInjectors=Be,h.useVirtualList=ae,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
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}
|
|
1
|
+
.toastWrapper[data-v-aef44c80]{position:absolute;border-radius:10px;background-color:#000c;padding:14px 19px}.toast[data-v-aef44c80]{width:fit-content;display:flex;justify-content:center;align-items:center;color:#fff;font-size:14px}.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}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from "./useVirtualList";
|
|
2
2
|
export * from "./useSelectable";
|
|
3
3
|
export * from "./dialog";
|
|
4
|
+
export { ToastCreator } from "./toast/ToastCreator";
|
|
4
5
|
export { default as SvgIcon } from "./svgIcon/SvgIcon.vue";
|
|
5
6
|
export { default as ScrollBar } from "./scroll-bar";
|
|
6
7
|
export { default as VirtualList } from "./useVirtualList/VirtualList.vue";
|
|
7
|
-
export { ToastCreator } from "./toast/ToastCreator";
|