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