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