@lazycatcloud/lzc-toolkit 0.0.19 → 0.0.21
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 +275 -232
- package/dist/index.umd.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types/scroll-bar/ScrollBar.vue.d.ts +98 -0
- package/dist/types/scroll-bar/index.d.ts +2 -0
- package/dist/types/scroll-bar/use/scrollBar.d.ts +10 -0
- package/dist/types/scroll-bar/use/type.d.ts +9 -0
- package/dist/types/svgIcon/SvgIcon.vue.d.ts +2 -8
- package/dist/types/useSelectable/index.d.ts +9 -8
- package/dist/types/useSelectable/keys.d.ts +1 -0
- package/dist/types/useVirtualList/VirtualList.vue.d.ts +45 -16
- package/dist/types/useVirtualList/index.d.ts +5 -0
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
import { unref as
|
|
2
|
-
var
|
|
1
|
+
import { unref as _, getCurrentScope as de, onScopeDispose as ve, getCurrentInstance as pe, onMounted as D, nextTick as he, ref as S, watch as $, shallowRef as ge, computed as g, onUnmounted as me, inject as O, provide as y, defineComponent as T, openBlock as I, createBlock as be, Transition as ye, withCtx as _e, createElementBlock as x, createElementVNode as C, withModifiers as we, normalizeClass as Oe, renderSlot as M, createCommentVNode as Se, render as Ie, h as E, normalizeStyle as U, toRef as xe, mergeProps as Ce, normalizeProps as k, guardReactiveProps as K, Fragment as Pe, renderList as Ee } from "vue";
|
|
2
|
+
var z;
|
|
3
3
|
const P = typeof window < "u";
|
|
4
|
-
P && ((
|
|
5
|
-
function
|
|
6
|
-
return typeof e == "function" ? e() :
|
|
4
|
+
P && ((z = window?.navigator) == null ? void 0 : z.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
5
|
+
function Re(e) {
|
|
6
|
+
return typeof e == "function" ? e() : _(e);
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function Ae(e) {
|
|
9
9
|
return e;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
return
|
|
11
|
+
function $e(e) {
|
|
12
|
+
return de() ? (ve(e), !0) : !1;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
14
|
+
function Te(e, n = !0) {
|
|
15
|
+
pe() ? D(e) : n ? e() : he(e);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
var
|
|
19
|
-
const
|
|
20
|
-
return (
|
|
17
|
+
function W(e) {
|
|
18
|
+
var n;
|
|
19
|
+
const t = Re(e);
|
|
20
|
+
return (n = t?.$el) != null ? n : t;
|
|
21
21
|
}
|
|
22
|
-
const
|
|
22
|
+
const Fe = P ? window : void 0;
|
|
23
23
|
P && window.document;
|
|
24
24
|
P && window.navigator;
|
|
25
25
|
P && window.location;
|
|
26
|
-
function
|
|
27
|
-
const
|
|
28
|
-
return o(),
|
|
26
|
+
function Le(e, n = !1) {
|
|
27
|
+
const t = S(), o = () => t.value = Boolean(e());
|
|
28
|
+
return o(), Te(o, n), t;
|
|
29
29
|
}
|
|
30
|
-
const
|
|
31
|
-
A
|
|
32
|
-
A
|
|
33
|
-
var
|
|
34
|
-
var
|
|
30
|
+
const R = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, A = "__vueuse_ssr_handlers__";
|
|
31
|
+
R[A] = R[A] || {};
|
|
32
|
+
R[A];
|
|
33
|
+
var j = Object.getOwnPropertySymbols, Be = Object.prototype.hasOwnProperty, He = Object.prototype.propertyIsEnumerable, ke = (e, n) => {
|
|
34
|
+
var t = {};
|
|
35
35
|
for (var o in e)
|
|
36
|
-
|
|
37
|
-
if (e != null &&
|
|
38
|
-
for (var o of
|
|
39
|
-
|
|
40
|
-
return
|
|
36
|
+
Be.call(e, o) && n.indexOf(o) < 0 && (t[o] = e[o]);
|
|
37
|
+
if (e != null && j)
|
|
38
|
+
for (var o of j(e))
|
|
39
|
+
n.indexOf(o) < 0 && He.call(e, o) && (t[o] = e[o]);
|
|
40
|
+
return t;
|
|
41
41
|
};
|
|
42
|
-
function
|
|
43
|
-
const o =
|
|
44
|
-
let
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
}, { immediate: !0, flush: "post" }),
|
|
50
|
-
|
|
42
|
+
function Ke(e, n, t = {}) {
|
|
43
|
+
const o = t, { window: a = Fe } = o, s = ke(o, ["window"]);
|
|
44
|
+
let r;
|
|
45
|
+
const f = Le(() => a && "ResizeObserver" in a), v = () => {
|
|
46
|
+
r && (r.disconnect(), r = void 0);
|
|
47
|
+
}, c = $(() => W(e), (d) => {
|
|
48
|
+
v(), f.value && a && d && (r = new ResizeObserver(n), r.observe(d, s));
|
|
49
|
+
}, { immediate: !0, flush: "post" }), p = () => {
|
|
50
|
+
v(), c();
|
|
51
51
|
};
|
|
52
|
-
return
|
|
53
|
-
isSupported:
|
|
54
|
-
stop:
|
|
52
|
+
return $e(p), {
|
|
53
|
+
isSupported: f,
|
|
54
|
+
stop: p
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
const { box: o = "content-box" } =
|
|
59
|
-
return
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
|
|
57
|
+
function ze(e, n = { width: 0, height: 0 }, t = {}) {
|
|
58
|
+
const { box: o = "content-box" } = t, a = S(n.width), s = S(n.height);
|
|
59
|
+
return Ke(e, ([r]) => {
|
|
60
|
+
const f = o === "border-box" ? r.borderBoxSize : o === "content-box" ? r.contentBoxSize : r.devicePixelContentBoxSize;
|
|
61
|
+
f ? (a.value = f.reduce((v, { inlineSize: c }) => v + c, 0), s.value = f.reduce((v, { blockSize: c }) => v + c, 0)) : (a.value = r.contentRect.width, s.value = r.contentRect.height);
|
|
62
|
+
}, t), $(() => W(e), (r) => {
|
|
63
|
+
a.value = r ? n.width : 0, s.value = r ? n.height : 0;
|
|
64
64
|
}), {
|
|
65
|
-
width:
|
|
66
|
-
height:
|
|
65
|
+
width: a,
|
|
66
|
+
height: s
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
var N;
|
|
70
70
|
(function(e) {
|
|
71
71
|
e.UP = "UP", e.RIGHT = "RIGHT", e.DOWN = "DOWN", e.LEFT = "LEFT", e.NONE = "NONE";
|
|
72
72
|
})(N || (N = {}));
|
|
73
|
-
var
|
|
74
|
-
for (var
|
|
75
|
-
|
|
73
|
+
var je = Object.defineProperty, Q = Object.getOwnPropertySymbols, Ne = Object.prototype.hasOwnProperty, Qe = Object.prototype.propertyIsEnumerable, V = (e, n, t) => n in e ? je(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t, Ve = (e, n) => {
|
|
74
|
+
for (var t in n || (n = {}))
|
|
75
|
+
Ne.call(n, t) && V(e, t, n[t]);
|
|
76
76
|
if (Q)
|
|
77
|
-
for (var
|
|
78
|
-
|
|
77
|
+
for (var t of Q(n))
|
|
78
|
+
Qe.call(n, t) && V(e, t, n[t]);
|
|
79
79
|
return e;
|
|
80
80
|
};
|
|
81
|
-
const
|
|
81
|
+
const De = {
|
|
82
82
|
easeInSine: [0.12, 0, 0.39, 0],
|
|
83
83
|
easeOutSine: [0.61, 1, 0.88, 1],
|
|
84
84
|
easeInOutSine: [0.37, 0, 0.63, 1],
|
|
@@ -104,142 +104,181 @@ const je = {
|
|
|
104
104
|
easeOutBack: [0.34, 1.56, 0.64, 1],
|
|
105
105
|
easeInOutBack: [0.68, -0.6, 0.32, 1.6]
|
|
106
106
|
};
|
|
107
|
-
|
|
108
|
-
linear:
|
|
109
|
-
},
|
|
110
|
-
function
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
107
|
+
Ve({
|
|
108
|
+
linear: Ae
|
|
109
|
+
}, De);
|
|
110
|
+
function Me(e, n) {
|
|
111
|
+
const { itemHeight: t, overscan: o = 5 } = n, a = S(), s = ze(a);
|
|
112
|
+
let r;
|
|
113
|
+
const f = ge(e), v = S(0), c = S({ start: 0, end: 10 });
|
|
114
|
+
let p = 0;
|
|
115
|
+
const d = S([]), i = g(() => {
|
|
116
|
+
let { sum: l, height: u } = { sum: 0, height: 0 };
|
|
117
|
+
return f.value.map((w, b) => (typeof t == "number" ? u = t : u = t(b), l += u, { height: u, sum: l }));
|
|
118
|
+
}), h = g(() => se(c.value.start)), F = g(() => typeof t == "number" ? i.value.length * t : i.value.at(-1)?.sum || 0), oe = g(() => {
|
|
119
|
+
let l = d.value.length - o, u = Math.max(l - p, 0);
|
|
120
|
+
return d.value.slice(u, l);
|
|
121
|
+
});
|
|
122
|
+
D(() => {
|
|
123
|
+
}), me(() => cancelAnimationFrame(r)), $(
|
|
124
|
+
[s.width, s.height, f],
|
|
125
|
+
([l, u]) => {
|
|
126
|
+
(l || u) && L();
|
|
127
|
+
},
|
|
128
|
+
{ deep: !0 }
|
|
129
|
+
);
|
|
130
|
+
function L() {
|
|
131
|
+
cancelAnimationFrame(r), r = requestAnimationFrame(B);
|
|
132
|
+
}
|
|
133
|
+
function B() {
|
|
134
|
+
if (a.value) {
|
|
135
|
+
v.value = a.value.scrollTop, p = ae();
|
|
136
|
+
let l = le(v.value), u = l + p + o;
|
|
137
|
+
l = l - o, l = l < 0 ? 0 : l, u = u > f.value.length ? f.value.length : u, c.value = { start: l, end: u }, d.value = f.value.slice(l, u).map((w, b) => ({
|
|
138
|
+
data: w,
|
|
139
|
+
index: b + l
|
|
140
|
+
}));
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function le(l) {
|
|
144
|
+
let u = Math.floor(i.value.length / 16), w = -1, b = -1;
|
|
145
|
+
for (let m = 0; m < 16; m++) {
|
|
146
|
+
if (i.value.at(u * m).sum >= l) {
|
|
147
|
+
w = Math.max(0, m - 1);
|
|
117
148
|
break;
|
|
118
149
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
for (let
|
|
123
|
-
if (
|
|
124
|
-
|
|
150
|
+
m === 15 && (w = m);
|
|
151
|
+
}
|
|
152
|
+
w *= u;
|
|
153
|
+
for (let m = w; m < i.value.length; m++)
|
|
154
|
+
if (i.value[m].sum >= l) {
|
|
155
|
+
b = m;
|
|
125
156
|
break;
|
|
126
157
|
}
|
|
127
|
-
return
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
158
|
+
return Math.max(0, b);
|
|
159
|
+
}
|
|
160
|
+
function ae() {
|
|
161
|
+
let l = 0, u = 0, w = re();
|
|
162
|
+
for (let b = w; b < i.value.length && (u += i.value[b].height, !(u >= s.height.value)); b++, l++)
|
|
163
|
+
;
|
|
164
|
+
return l;
|
|
165
|
+
}
|
|
166
|
+
function se(l) {
|
|
167
|
+
if (typeof t == "number")
|
|
168
|
+
return l * t;
|
|
169
|
+
let u = i.value[l];
|
|
170
|
+
return u.sum - u.height;
|
|
171
|
+
}
|
|
172
|
+
function H(l) {
|
|
173
|
+
return i.value.at(l) || { sum: 0, height: 0 };
|
|
174
|
+
}
|
|
175
|
+
function re() {
|
|
176
|
+
let l = c.value.start;
|
|
177
|
+
return l >= o && (l += o), l;
|
|
178
|
+
}
|
|
179
|
+
function ie(l) {
|
|
180
|
+
if (a.value) {
|
|
181
|
+
const u = H(l);
|
|
182
|
+
a.value.scrollTop = u.sum - u.height, B();
|
|
143
183
|
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
}), ve(() => {
|
|
147
|
-
cancelAnimationFrame(d);
|
|
148
|
-
}), R(
|
|
149
|
-
[o.width, o.height, l],
|
|
150
|
-
() => {
|
|
151
|
-
f();
|
|
152
|
-
},
|
|
153
|
-
{ deep: !0 }
|
|
154
|
-
);
|
|
155
|
-
const z = w(() => typeof r == "number" ? l.value.length * r : l.value.reduce((c, h, v) => c + r(v), 0)), te = (c) => typeof r == "number" ? c * r : l.value.slice(0, c).reduce((v, p, g) => v + r(g), 0), ne = (c) => {
|
|
156
|
-
n.value && (n.value.scrollTop = c, k());
|
|
157
|
-
}, oe = w(() => te(i.value.start)), le = w(() => ({
|
|
184
|
+
}
|
|
185
|
+
const ue = g(() => ({
|
|
158
186
|
style: {
|
|
159
187
|
width: "100%",
|
|
160
|
-
height: `${
|
|
188
|
+
height: `${F.value}px`
|
|
161
189
|
}
|
|
162
|
-
})),
|
|
190
|
+
})), ce = g(() => ({
|
|
163
191
|
style: {
|
|
164
|
-
transform: `translate3d(0, ${
|
|
192
|
+
transform: `translate3d(0, ${h.value}px, 0)`,
|
|
165
193
|
"will-change": "transform"
|
|
166
194
|
}
|
|
167
|
-
})),
|
|
195
|
+
})), fe = {
|
|
196
|
+
overflowY: "auto"
|
|
197
|
+
};
|
|
168
198
|
return {
|
|
169
|
-
list:
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
199
|
+
list: d,
|
|
200
|
+
visiableList: oe,
|
|
201
|
+
getItemHeightData: H,
|
|
202
|
+
totalHeight: F,
|
|
203
|
+
clientHeight: s.height,
|
|
204
|
+
scrollTo: ie,
|
|
205
|
+
scrollTop: v,
|
|
174
206
|
containerProps: {
|
|
175
|
-
ref:
|
|
176
|
-
onScroll: (
|
|
177
|
-
|
|
207
|
+
ref: a,
|
|
208
|
+
onScroll: () => {
|
|
209
|
+
L();
|
|
178
210
|
},
|
|
179
|
-
style:
|
|
211
|
+
style: fe
|
|
180
212
|
},
|
|
181
|
-
wrapperProps:
|
|
182
|
-
innerProps:
|
|
213
|
+
wrapperProps: ue,
|
|
214
|
+
innerProps: ce
|
|
183
215
|
};
|
|
184
216
|
}
|
|
185
|
-
const
|
|
186
|
-
function
|
|
187
|
-
const
|
|
217
|
+
const q = Symbol(), G = Symbol(), Y = Symbol(), J = Symbol(), X = Symbol(), Z = Symbol(), ee = Symbol(), te = Symbol(), ne = Symbol();
|
|
218
|
+
function et() {
|
|
219
|
+
const { voidFn: e, boolFn: n, boolRef: t, arrayRef: o } = {
|
|
220
|
+
voidFn: (h) => {
|
|
221
|
+
},
|
|
222
|
+
boolFn: (h) => !1,
|
|
223
|
+
boolRef: g(() => !1),
|
|
224
|
+
arrayRef: g(() => [])
|
|
225
|
+
}, a = O(J, o), s = O(Y, n), r = O(te, t), f = O(G, e), v = O(q, e), c = O(X, e), p = O(Z, e), d = O(ee, e), i = O(ne, e);
|
|
188
226
|
return {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
227
|
+
selected: a,
|
|
228
|
+
isSelected: s,
|
|
229
|
+
isAllSelected: r,
|
|
230
|
+
toggle: f,
|
|
231
|
+
toggleAll: v,
|
|
232
|
+
select: c,
|
|
233
|
+
selectAll: p,
|
|
234
|
+
unselect: d,
|
|
196
235
|
unselectAll: i
|
|
197
236
|
};
|
|
198
237
|
}
|
|
199
|
-
function
|
|
200
|
-
const
|
|
201
|
-
function
|
|
202
|
-
e.value.forEach((
|
|
203
|
-
|
|
238
|
+
function tt(e, n) {
|
|
239
|
+
const t = S({}), o = g(() => e.value.filter((i) => t.value[i[n]])), a = g(() => o.value.length != 0 && Object.keys(t.value).length == e.value.length);
|
|
240
|
+
function s() {
|
|
241
|
+
e.value.forEach((i) => {
|
|
242
|
+
t.value[i[n]] = !0;
|
|
204
243
|
});
|
|
205
244
|
}
|
|
206
|
-
function
|
|
207
|
-
|
|
245
|
+
function r() {
|
|
246
|
+
t.value = {};
|
|
208
247
|
}
|
|
209
|
-
function i
|
|
210
|
-
|
|
211
|
-
|
|
248
|
+
function f(i) {
|
|
249
|
+
i.forEach((h) => {
|
|
250
|
+
t.value[h[n]] || (t.value[h[n]] = !0);
|
|
212
251
|
});
|
|
213
252
|
}
|
|
214
|
-
function
|
|
215
|
-
|
|
216
|
-
|
|
253
|
+
function v(i) {
|
|
254
|
+
i.forEach((h) => {
|
|
255
|
+
t.value[h[n]] && delete t.value[h[n]];
|
|
217
256
|
});
|
|
218
257
|
}
|
|
219
|
-
function
|
|
220
|
-
return !!
|
|
258
|
+
function c(i) {
|
|
259
|
+
return !!t.value[i[n]];
|
|
221
260
|
}
|
|
222
|
-
function
|
|
223
|
-
|
|
224
|
-
|
|
261
|
+
function p(i) {
|
|
262
|
+
i.forEach((h) => {
|
|
263
|
+
c(h) ? delete t.value[h[n]] : t.value[h[n]] = !0;
|
|
225
264
|
});
|
|
226
265
|
}
|
|
227
|
-
function
|
|
228
|
-
|
|
266
|
+
function d() {
|
|
267
|
+
a.value ? r() : s();
|
|
229
268
|
}
|
|
230
|
-
return
|
|
269
|
+
return y(q, d), y(G, p), y(Y, c), y(J, o), y(X, f), y(Z, s), y(ee, v), y(te, a), y(ne, r), {
|
|
231
270
|
selected: o,
|
|
232
|
-
select:
|
|
233
|
-
selectAll:
|
|
234
|
-
unselect:
|
|
235
|
-
unselectAll:
|
|
236
|
-
toggle:
|
|
237
|
-
toggleAll:
|
|
238
|
-
isSelected:
|
|
239
|
-
isAllSelected:
|
|
271
|
+
select: f,
|
|
272
|
+
selectAll: s,
|
|
273
|
+
unselect: v,
|
|
274
|
+
unselectAll: r,
|
|
275
|
+
toggle: p,
|
|
276
|
+
toggleAll: d,
|
|
277
|
+
isSelected: c,
|
|
278
|
+
isAllSelected: a
|
|
240
279
|
};
|
|
241
280
|
}
|
|
242
|
-
const
|
|
281
|
+
const Ue = Symbol(), We = /* @__PURE__ */ T({
|
|
243
282
|
__name: "Dialog",
|
|
244
283
|
props: {
|
|
245
284
|
visiable: { type: Boolean, default: !1 },
|
|
@@ -247,143 +286,147 @@ const Ne = Symbol(), Qe = /* @__PURE__ */ B({
|
|
|
247
286
|
dialogClass: { default: "" }
|
|
248
287
|
},
|
|
249
288
|
emits: ["update:visiable"],
|
|
250
|
-
setup(e, { emit:
|
|
251
|
-
const
|
|
252
|
-
|
|
289
|
+
setup(e, { emit: n }) {
|
|
290
|
+
const t = e, o = () => {
|
|
291
|
+
t.closeOnClickOverlay && n("update:visiable", !1);
|
|
253
292
|
};
|
|
254
|
-
return
|
|
255
|
-
default:
|
|
293
|
+
return y(Ue, () => n("update:visiable", !1)), (a, s) => (I(), be(ye, { name: "modal" }, {
|
|
294
|
+
default: _e(() => [
|
|
256
295
|
e.visiable ? (I(), x("div", {
|
|
257
296
|
key: 0,
|
|
258
297
|
onClick: o,
|
|
259
298
|
class: "modal absolute inset-0 bottom-0 z-50 flex bg-stone-900 bg-opacity-50"
|
|
260
299
|
}, [
|
|
261
300
|
C("div", {
|
|
262
|
-
onClick:
|
|
301
|
+
onClick: s[0] || (s[0] = we(() => {
|
|
263
302
|
}, ["stop"])),
|
|
264
|
-
class:
|
|
303
|
+
class: Oe(["dialog m-auto flex flex-col", e.dialogClass])
|
|
265
304
|
}, [
|
|
266
|
-
|
|
305
|
+
M(a.$slots, "default")
|
|
267
306
|
], 2)
|
|
268
|
-
])) :
|
|
307
|
+
])) : Se("", !0)
|
|
269
308
|
]),
|
|
270
309
|
_: 3
|
|
271
310
|
}));
|
|
272
311
|
}
|
|
273
312
|
});
|
|
274
|
-
function
|
|
275
|
-
function t
|
|
276
|
-
const
|
|
313
|
+
function nt(e) {
|
|
314
|
+
function n(t, o) {
|
|
315
|
+
const a = document.createElement("div"), s = {
|
|
277
316
|
setup() {
|
|
278
317
|
return () => E(
|
|
279
|
-
|
|
318
|
+
We,
|
|
280
319
|
{
|
|
281
320
|
visiable: !0,
|
|
282
321
|
"onUpdate:visiable": () => {
|
|
283
|
-
|
|
322
|
+
a?.remove();
|
|
284
323
|
},
|
|
285
324
|
...e
|
|
286
325
|
},
|
|
287
326
|
{
|
|
288
|
-
default: () => E(
|
|
327
|
+
default: () => E(t, o)
|
|
289
328
|
}
|
|
290
329
|
);
|
|
291
330
|
}
|
|
292
331
|
};
|
|
293
|
-
return document.body.appendChild(
|
|
294
|
-
close: () =>
|
|
332
|
+
return document.body.appendChild(a), Ie(E(s), a), {
|
|
333
|
+
close: () => a?.remove()
|
|
295
334
|
};
|
|
296
335
|
}
|
|
297
336
|
return {
|
|
298
|
-
create:
|
|
337
|
+
create: n
|
|
299
338
|
};
|
|
300
339
|
}
|
|
301
|
-
const
|
|
340
|
+
const qe = ["xlink:href", "fill", "color"], ot = /* @__PURE__ */ T({
|
|
302
341
|
__name: "SvgIcon",
|
|
303
342
|
props: {
|
|
304
|
-
prefix: { default: "icon" },
|
|
305
343
|
name: null,
|
|
344
|
+
prefix: { default: "icon" },
|
|
306
345
|
color: { default: "#FFF" },
|
|
307
|
-
width:
|
|
308
|
-
height:
|
|
346
|
+
width: null,
|
|
347
|
+
height: null
|
|
309
348
|
},
|
|
310
349
|
setup(e) {
|
|
311
|
-
const
|
|
312
|
-
width:
|
|
313
|
-
height:
|
|
350
|
+
const n = e, t = g(() => `#${n.prefix}-${n.name}`), o = g(() => ({
|
|
351
|
+
width: n.width,
|
|
352
|
+
height: n.height,
|
|
353
|
+
aspectRatio: n.width && n.height ? void 0 : "1/1"
|
|
314
354
|
}));
|
|
315
|
-
return (
|
|
355
|
+
return (a, s) => (I(), x("svg", {
|
|
316
356
|
"aria-hidden": "",
|
|
317
|
-
style:
|
|
357
|
+
style: U(_(o))
|
|
318
358
|
}, [
|
|
319
359
|
C("use", {
|
|
320
|
-
"xlink:href":
|
|
360
|
+
"xlink:href": _(t),
|
|
321
361
|
fill: e.color,
|
|
322
362
|
color: e.color
|
|
323
|
-
}, null, 8,
|
|
363
|
+
}, null, 8, qe)
|
|
324
364
|
], 4));
|
|
325
365
|
}
|
|
326
|
-
}),
|
|
366
|
+
}), Ge = { class: "virtualListWrapper" }, Ye = {
|
|
367
|
+
inheritAttrs: !1
|
|
368
|
+
}, Je = /* @__PURE__ */ T({
|
|
369
|
+
...Ye,
|
|
327
370
|
__name: "VirtualList",
|
|
328
371
|
props: {
|
|
329
372
|
data: null,
|
|
330
|
-
itemHeight: null
|
|
373
|
+
itemHeight: null,
|
|
374
|
+
overscan: { default: 10 }
|
|
331
375
|
},
|
|
332
|
-
setup(e) {
|
|
333
|
-
const t = e,
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
)
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
ref: m(o).ref,
|
|
344
|
-
style: T(m(o).style),
|
|
376
|
+
setup(e, { expose: n }) {
|
|
377
|
+
const t = e, o = Me(xe(t, "data"), {
|
|
378
|
+
itemHeight: (c) => t.itemHeight(t.data[c]),
|
|
379
|
+
overscan: t.overscan
|
|
380
|
+
}), { list: a, containerProps: s, wrapperProps: r, innerProps: f, getItemHeightData: v } = o;
|
|
381
|
+
return n({
|
|
382
|
+
vListReturn: o
|
|
383
|
+
}), (c, p) => (I(), x("div", Ge, [
|
|
384
|
+
C("div", Ce({
|
|
385
|
+
onScrollPassive: p[0] || (p[0] = (...d) => _(s).onScroll && _(s).onScroll(...d)),
|
|
386
|
+
ref: _(s).ref,
|
|
345
387
|
class: "virtualList"
|
|
346
|
-
}, [
|
|
347
|
-
C("div", K(
|
|
348
|
-
C("div", K(
|
|
349
|
-
(I(!0), x(
|
|
350
|
-
key:
|
|
351
|
-
style:
|
|
352
|
-
height: `${
|
|
388
|
+
}, c.$attrs), [
|
|
389
|
+
C("div", k(K(_(r))), [
|
|
390
|
+
C("div", k(K(_(f))), [
|
|
391
|
+
(I(!0), x(Pe, null, Ee(_(a), ({ index: d, data: i }) => (I(), x("div", {
|
|
392
|
+
key: d,
|
|
393
|
+
style: U({
|
|
394
|
+
height: `${_(v)(d).height}px`,
|
|
353
395
|
display: "flex"
|
|
354
396
|
})
|
|
355
397
|
}, [
|
|
356
|
-
|
|
357
|
-
data:
|
|
358
|
-
index:
|
|
398
|
+
M(c.$slots, "default", {
|
|
399
|
+
data: i,
|
|
400
|
+
index: d
|
|
359
401
|
}, void 0, !0)
|
|
360
402
|
], 4))), 128))
|
|
361
403
|
], 16)
|
|
362
404
|
], 16)
|
|
363
|
-
],
|
|
405
|
+
], 16)
|
|
364
406
|
]));
|
|
365
407
|
}
|
|
366
408
|
});
|
|
367
|
-
const
|
|
368
|
-
const
|
|
369
|
-
for (const [o,
|
|
370
|
-
|
|
371
|
-
return
|
|
372
|
-
},
|
|
409
|
+
const Xe = (e, n) => {
|
|
410
|
+
const t = e.__vccOpts || e;
|
|
411
|
+
for (const [o, a] of n)
|
|
412
|
+
t[o] = a;
|
|
413
|
+
return t;
|
|
414
|
+
}, lt = /* @__PURE__ */ Xe(Je, [["__scopeId", "data-v-134ad8ab"]]);
|
|
373
415
|
export {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
q as
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
416
|
+
ot as SvgIcon,
|
|
417
|
+
lt as VirtualList,
|
|
418
|
+
J as allSelectedKey,
|
|
419
|
+
Ue as closeDialogKey,
|
|
420
|
+
nt as dialogController,
|
|
421
|
+
te as isAllSelectedKey,
|
|
422
|
+
Y as isSelectedKey,
|
|
423
|
+
Z as selectAllKey,
|
|
424
|
+
X as selectKey,
|
|
425
|
+
q as toggleAllKey,
|
|
426
|
+
G as toggleKey,
|
|
427
|
+
ne as unselectAllKey,
|
|
428
|
+
ee as unselectKey,
|
|
429
|
+
tt as useSelectable,
|
|
430
|
+
et as useSelectableInjectors,
|
|
431
|
+
Me as useVirtualList
|
|
389
432
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(d,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(d=typeof globalThis<"u"?globalThis:d||self,e(d.ui={},d.Vue))})(this,function(d,e){"use strict";var k;const O=typeof window<"u";O&&((k=window?.navigator)==null?void 0:k.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function D(t){return typeof t=="function"?t():e.unref(t)}function U(t){return t}function W(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function q(t,o=!0){e.getCurrentInstance()?e.onMounted(t):o?t():e.nextTick(t)}function R(t){var o;const n=D(t);return(o=n?.$el)!=null?o:n}const G=O?window:void 0;O&&window.document,O&&window.navigator,O&&window.location;function Y(t,o=!1){const n=e.ref(),l=()=>n.value=Boolean(t());return l(),q(l,o),n}const S=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},v="__vueuse_ssr_handlers__";S[v]=S[v]||{},S[v];var T=Object.getOwnPropertySymbols,J=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,Z=(t,o)=>{var n={};for(var l in t)J.call(t,l)&&o.indexOf(l)<0&&(n[l]=t[l]);if(t!=null&&T)for(var l of T(t))o.indexOf(l)<0&&X.call(t,l)&&(n[l]=t[l]);return n};function ee(t,o,n={}){const l=n,{window:a=G}=l,i=Z(l,["window"]);let s;const p=Y(()=>a&&"ResizeObserver"in a),h=()=>{s&&(s.disconnect(),s=void 0)},f=e.watch(()=>R(t),m=>{h(),p.value&&a&&m&&(s=new ResizeObserver(o),s.observe(m,i))},{immediate:!0,flush:"post"}),g=()=>{h(),f()};return W(g),{isSupported:p,stop:g}}function te(t,o={width:0,height:0},n={}){const{box:l="content-box"}=n,a=e.ref(o.width),i=e.ref(o.height);return ee(t,([s])=>{const p=l==="border-box"?s.borderBoxSize:l==="content-box"?s.contentBoxSize:s.devicePixelContentBoxSize;p?(a.value=p.reduce((h,{inlineSize:f})=>h+f,0),i.value=p.reduce((h,{blockSize:f})=>h+f,0)):(a.value=s.contentRect.width,i.value=s.contentRect.height)},n),e.watch(()=>R(t),s=>{a.value=s?o.width:0,i.value=s?o.height:0}),{width:a,height:i}}var V;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(V||(V={}));var ne=Object.defineProperty,$=Object.getOwnPropertySymbols,oe=Object.prototype.hasOwnProperty,le=Object.prototype.propertyIsEnumerable,L=(t,o,n)=>o in t?ne(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n,re=(t,o)=>{for(var n in o||(o={}))oe.call(o,n)&&L(t,n,o[n]);if($)for(var n of $(o))le.call(o,n)&&L(t,n,o[n]);return t};re({linear:U},{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 F(t,o){const{itemHeight:n,overscan:l=5}=o,a=e.ref(),i=te(a);let s;const p=e.shallowRef(t),h=e.ref(0),f=e.ref({start:0,end:10});let g=0;const m=e.ref([]),c=e.computed(()=>{let{sum:r,height:u}={sum:0,height:0};return p.value.map((w,_)=>(typeof n=="number"?u=n:u=n(_),r+=u,{height:u,sum:r}))}),b=e.computed(()=>_e(f.value.start)),z=e.computed(()=>typeof n=="number"?c.value.length*n:c.value.at(-1)?.sum||0),ge=e.computed(()=>{let r=m.value.length-l,u=Math.max(r-g,0);return m.value.slice(u,r)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(s)),e.watch([i.width,i.height,p],([r,u])=>{(r||u)&&H()},{deep:!0});function H(){cancelAnimationFrame(s),s=requestAnimationFrame(M)}function M(){if(a.value){h.value=a.value.scrollTop,g=ye();let r=be(h.value),u=r+g+l;r=r-l,r=r<0?0:r,u=u>p.value.length?p.value.length:u,f.value={start:r,end:u},m.value=p.value.slice(r,u).map((w,_)=>({data:w,index:_+r}))}}function be(r){let u=Math.floor(c.value.length/16),w=-1,_=-1;for(let y=0;y<16;y++){if(c.value.at(u*y).sum>=r){w=Math.max(0,y-1);break}y===15&&(w=y)}w*=u;for(let y=w;y<c.value.length;y++)if(c.value[y].sum>=r){_=y;break}return Math.max(0,_)}function ye(){let r=0,u=0,w=we();for(let _=w;_<c.value.length&&(u+=c.value[_].height,!(u>=i.height.value));_++,r++);return r}function _e(r){if(typeof n=="number")return r*n;let u=c.value[r];return u.sum-u.height}function Q(r){return c.value.at(r)||{sum:0,height:0}}function we(){let r=f.value.start;return r>=l&&(r+=l),r}function Oe(r){if(a.value){const u=Q(r);a.value.scrollTop=u.sum-u.height,M()}}const Se=e.computed(()=>({style:{width:"100%",height:`${z.value}px`}})),ve=e.computed(()=>({style:{transform:`translate3d(0, ${b.value}px, 0)`,"will-change":"transform"}})),Ie={overflowY:"auto"};return{list:m,visiableList:ge,getItemHeightData:Q,totalHeight:z,clientHeight:i.height,scrollTo:Oe,scrollTop:h,containerProps:{ref:a,onScroll:()=>{H()},style:Ie},wrapperProps:Se,innerProps:ve}}const I=Symbol(),P=Symbol(),C=Symbol(),E=Symbol(),A=Symbol(),x=Symbol(),B=Symbol(),K=Symbol(),j=Symbol();function ae(){const{voidFn:t,boolFn:o,boolRef:n,arrayRef:l}={voidFn:b=>{},boolFn:b=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},a=e.inject(E,l),i=e.inject(C,o),s=e.inject(K,n),p=e.inject(P,t),h=e.inject(I,t),f=e.inject(A,t),g=e.inject(x,t),m=e.inject(B,t),c=e.inject(j,t);return{selected:a,isSelected:i,isAllSelected:s,toggle:p,toggleAll:h,select:f,selectAll:g,unselect:m,unselectAll:c}}function ie(t,o){const n=e.ref({}),l=e.computed(()=>t.value.filter(c=>n.value[c[o]])),a=e.computed(()=>l.value.length!=0&&Object.keys(n.value).length==t.value.length);function i(){t.value.forEach(c=>{n.value[c[o]]=!0})}function s(){n.value={}}function p(c){c.forEach(b=>{n.value[b[o]]||(n.value[b[o]]=!0)})}function h(c){c.forEach(b=>{n.value[b[o]]&&delete n.value[b[o]]})}function f(c){return!!n.value[c[o]]}function g(c){c.forEach(b=>{f(b)?delete n.value[b[o]]:n.value[b[o]]=!0})}function m(){a.value?s():i()}return e.provide(I,m),e.provide(P,g),e.provide(C,f),e.provide(E,l),e.provide(A,p),e.provide(x,i),e.provide(B,h),e.provide(K,a),e.provide(j,s),{selected:l,select:p,selectAll:i,unselect:h,unselectAll:s,toggle:g,toggleAll:m,isSelected:f,isAllSelected:a}}const N=Symbol(),se=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0},dialogClass:{default:""}},emits:["update:visiable"],setup(t,{emit:o}){const n=t,l=()=>{n.closeOnClickOverlay&&o("update:visiable",!1)};return e.provide(N,()=>o("update:visiable",!1)),(a,i)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[t.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:l,class:"modal absolute inset-0 bottom-0 z-50 flex bg-stone-900 bg-opacity-50"},[e.createElementVNode("div",{onClick:i[0]||(i[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog m-auto flex flex-col",t.dialogClass])},[e.renderSlot(a.$slots,"default")],2)])):e.createCommentVNode("",!0)]),_:3}))}});function ce(t){function o(n,l){const a=document.createElement("div"),i={setup(){return()=>e.h(se,{visiable:!0,"onUpdate:visiable":()=>{a?.remove()},...t},{default:()=>e.h(n,l)})}};return document.body.appendChild(a),e.render(e.h(i),a),{close:()=>a?.remove()}}return{create:o}}const ue=["xlink:href","fill","color"],de=e.defineComponent({__name:"SvgIcon",props:{name:null,prefix:{default:"icon"},color:{default:"#FFF"},width:null,height:null},setup(t){const o=t,n=e.computed(()=>`#${o.prefix}-${o.name}`),l=e.computed(()=>({width:o.width,height:o.height,aspectRatio:o.width&&o.height?void 0:"1/1"}));return(a,i)=>(e.openBlock(),e.createElementBlock("svg",{"aria-hidden":"",style:e.normalizeStyle(e.unref(l))},[e.createElementVNode("use",{"xlink:href":e.unref(n),fill:t.color,color:t.color},null,8,ue)],4))}}),fe={class:"virtualListWrapper"},pe={inheritAttrs:!1},me=e.defineComponent({...pe,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},setup(t,{expose:o}){const n=t,l=F(e.toRef(n,"data"),{itemHeight:f=>n.itemHeight(n.data[f]),overscan:n.overscan}),{list:a,containerProps:i,wrapperProps:s,innerProps:p,getItemHeightData:h}=l;return o({vListReturn:l}),(f,g)=>(e.openBlock(),e.createElementBlock("div",fe,[e.createElementVNode("div",e.mergeProps({onScrollPassive:g[0]||(g[0]=(...m)=>e.unref(i).onScroll&&e.unref(i).onScroll(...m)),ref:e.unref(i).ref,class:"virtualList"},f.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(s))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(p))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a),({index:m,data:c})=>(e.openBlock(),e.createElementBlock("div",{key:m,style:e.normalizeStyle({height:`${e.unref(h)(m).height}px`,display:"flex"})},[e.renderSlot(f.$slots,"default",{data:c,index:m},void 0,!0)],4))),128))],16)],16)],16)]))}}),Ce="",he=((t,o)=>{const n=t.__vccOpts||t;for(const[l,a]of o)n[l]=a;return n})(me,[["__scopeId","data-v-134ad8ab"]]);d.SvgIcon=de,d.VirtualList=he,d.allSelectedKey=E,d.closeDialogKey=N,d.dialogController=ce,d.isAllSelectedKey=K,d.isSelectedKey=C,d.selectAllKey=x,d.selectKey=A,d.toggleAllKey=I,d.toggleKey=P,d.unselectAllKey=j,d.unselectKey=B,d.useSelectable=ie,d.useSelectableInjectors=ae,d.useVirtualList=F,Object.defineProperties(d,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.virtualListWrapper[data-v-
|
|
1
|
+
.virtualListWrapper[data-v-134ad8ab]{width:100%;height:100%;position:relative}.virtualList[data-v-134ad8ab] ::-webkit-scrollbar{display:none}.virtualList[data-v-134ad8ab]{width:100%;height:100%;position:absolute;overflow-y:auto;scroll-behavior:smooth;user-select:none}.virtualList[data-v-134ad8ab]::-webkit-scrollbar{display:none}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { nextTick, type Ref } from "vue";
|
|
2
|
+
export interface Props {
|
|
3
|
+
containerEl: null | HTMLElement;
|
|
4
|
+
autoHide?: boolean;
|
|
5
|
+
autoHeight?: boolean;
|
|
6
|
+
performance?: {
|
|
7
|
+
scrollTop?: Ref<number>;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
declare const _default: {
|
|
11
|
+
new (...args: any[]): {
|
|
12
|
+
$: import("vue").ComponentInternalInstance;
|
|
13
|
+
$data: {};
|
|
14
|
+
$props: Partial<{}> & Omit<Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {}>>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>;
|
|
15
|
+
$attrs: {
|
|
16
|
+
[x: string]: unknown;
|
|
17
|
+
};
|
|
18
|
+
$refs: {
|
|
19
|
+
[x: string]: unknown;
|
|
20
|
+
};
|
|
21
|
+
$slots: Readonly<{
|
|
22
|
+
[name: string]: import("vue").Slot | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
$root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
|
|
25
|
+
$parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
|
|
26
|
+
$emit: (event: string, ...args: any[]) => void;
|
|
27
|
+
$el: any;
|
|
28
|
+
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {}>>>, {
|
|
29
|
+
uScrollBarReturn: {
|
|
30
|
+
isScrollEnd: Ref<boolean>;
|
|
31
|
+
isDragSlider: import("vue").ComputedRef<boolean>;
|
|
32
|
+
scrollable: import("vue").ComputedRef<boolean>;
|
|
33
|
+
sliderPos: import("vue").ComputedRef<import("vue").CSSProperties>;
|
|
34
|
+
init: () => void;
|
|
35
|
+
modifySliderEventListener: (action: "add" | "remove") => void;
|
|
36
|
+
};
|
|
37
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}> & {
|
|
38
|
+
beforeCreate?: ((() => void) | (() => void)[]) | undefined;
|
|
39
|
+
created?: ((() => void) | (() => void)[]) | undefined;
|
|
40
|
+
beforeMount?: ((() => void) | (() => void)[]) | undefined;
|
|
41
|
+
mounted?: ((() => void) | (() => void)[]) | undefined;
|
|
42
|
+
beforeUpdate?: ((() => void) | (() => void)[]) | undefined;
|
|
43
|
+
updated?: ((() => void) | (() => void)[]) | undefined;
|
|
44
|
+
activated?: ((() => void) | (() => void)[]) | undefined;
|
|
45
|
+
deactivated?: ((() => void) | (() => void)[]) | undefined;
|
|
46
|
+
beforeDestroy?: ((() => void) | (() => void)[]) | undefined;
|
|
47
|
+
beforeUnmount?: ((() => void) | (() => void)[]) | undefined;
|
|
48
|
+
destroyed?: ((() => void) | (() => void)[]) | undefined;
|
|
49
|
+
unmounted?: ((() => void) | (() => void)[]) | undefined;
|
|
50
|
+
renderTracked?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
|
|
51
|
+
renderTriggered?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
|
|
52
|
+
errorCaptured?: (((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void)[]) | undefined;
|
|
53
|
+
};
|
|
54
|
+
$forceUpdate: () => void;
|
|
55
|
+
$nextTick: typeof nextTick;
|
|
56
|
+
$watch(source: string | Function, cb: Function, options?: import("vue").WatchOptions<boolean> | undefined): import("vue").WatchStopHandle;
|
|
57
|
+
} & Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {}>>> & import("vue").ShallowUnwrapRef<{
|
|
58
|
+
uScrollBarReturn: {
|
|
59
|
+
isScrollEnd: Ref<boolean>;
|
|
60
|
+
isDragSlider: import("vue").ComputedRef<boolean>;
|
|
61
|
+
scrollable: import("vue").ComputedRef<boolean>;
|
|
62
|
+
sliderPos: import("vue").ComputedRef<import("vue").CSSProperties>;
|
|
63
|
+
init: () => void;
|
|
64
|
+
modifySliderEventListener: (action: "add" | "remove") => void;
|
|
65
|
+
};
|
|
66
|
+
}> & {} & import("vue").ComponentCustomProperties;
|
|
67
|
+
__isFragment?: undefined;
|
|
68
|
+
__isTeleport?: undefined;
|
|
69
|
+
__isSuspense?: undefined;
|
|
70
|
+
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {}>>>, {
|
|
71
|
+
uScrollBarReturn: {
|
|
72
|
+
isScrollEnd: Ref<boolean>;
|
|
73
|
+
isDragSlider: import("vue").ComputedRef<boolean>;
|
|
74
|
+
scrollable: import("vue").ComputedRef<boolean>;
|
|
75
|
+
sliderPos: import("vue").ComputedRef<import("vue").CSSProperties>;
|
|
76
|
+
init: () => void;
|
|
77
|
+
modifySliderEventListener: (action: "add" | "remove") => void;
|
|
78
|
+
};
|
|
79
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
80
|
+
$slots: {
|
|
81
|
+
default: (_: {}) => any;
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
export default _default;
|
|
85
|
+
declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
86
|
+
declare type __VLS_TypePropsToRuntimeProps<T> = {
|
|
87
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
88
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
89
|
+
} : {
|
|
90
|
+
type: import('vue').PropType<T[K]>;
|
|
91
|
+
required: true;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
declare type __VLS_WithDefaults<P, D> = {
|
|
95
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
|
|
96
|
+
default: D[K];
|
|
97
|
+
} : P[K];
|
|
98
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CSSProperties } from "vue";
|
|
2
|
+
import type { ScrollBarOptions } from "./type";
|
|
3
|
+
export declare function useScrollBar(options: ScrollBarOptions): {
|
|
4
|
+
isScrollEnd: import("vue").Ref<boolean>;
|
|
5
|
+
isDragSlider: import("vue").ComputedRef<boolean>;
|
|
6
|
+
scrollable: import("vue").ComputedRef<boolean>;
|
|
7
|
+
sliderPos: import("vue").ComputedRef<CSSProperties>;
|
|
8
|
+
init: () => void;
|
|
9
|
+
modifySliderEventListener: (action: "add" | "remove") => void;
|
|
10
|
+
};
|
|
@@ -1,30 +1,24 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
-
prefix: string;
|
|
3
2
|
name: string;
|
|
3
|
+
prefix?: string | undefined;
|
|
4
4
|
color?: string | undefined;
|
|
5
5
|
width?: number | undefined;
|
|
6
6
|
height?: number | undefined;
|
|
7
7
|
}>, {
|
|
8
8
|
prefix: string;
|
|
9
9
|
color: string;
|
|
10
|
-
width: number;
|
|
11
|
-
height: number;
|
|
12
10
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
13
|
-
prefix: string;
|
|
14
11
|
name: string;
|
|
12
|
+
prefix?: string | undefined;
|
|
15
13
|
color?: string | undefined;
|
|
16
14
|
width?: number | undefined;
|
|
17
15
|
height?: number | undefined;
|
|
18
16
|
}>, {
|
|
19
17
|
prefix: string;
|
|
20
18
|
color: string;
|
|
21
|
-
width: number;
|
|
22
|
-
height: number;
|
|
23
19
|
}>>>, {
|
|
24
20
|
prefix: string;
|
|
25
21
|
color: string;
|
|
26
|
-
width: number;
|
|
27
|
-
height: number;
|
|
28
22
|
}>;
|
|
29
23
|
export default _default;
|
|
30
24
|
declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { type ComputedRef, type Ref } from "vue";
|
|
2
2
|
export * from "./keys";
|
|
3
3
|
export declare function useSelectableInjectors(): {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
selected: ComputedRef<any[]>;
|
|
5
|
+
isSelected: (_?: any) => boolean;
|
|
6
|
+
isAllSelected: ComputedRef<boolean>;
|
|
7
|
+
toggle: (a: any[]) => void;
|
|
8
|
+
toggleAll: (_?: any) => void;
|
|
9
|
+
select: (_?: any) => void;
|
|
10
|
+
selectAll: (_?: any) => void;
|
|
11
|
+
unselect: (_?: any) => void;
|
|
12
|
+
unselectAll: (_?: any) => void;
|
|
12
13
|
};
|
|
13
14
|
export declare function useSelectable<T extends Record<K, string | number>, K extends keyof T>(data: Ref<Array<T>>, key: K): {
|
|
14
15
|
selected: ComputedRef<T[]>;
|
|
@@ -4,6 +4,7 @@ export declare const toggleKey: InjectionKey<(a: Array<any>) => void>;
|
|
|
4
4
|
export declare const isSelectedKey: InjectionKey<(a: any) => boolean>;
|
|
5
5
|
export declare const allSelectedKey: InjectionKey<ComputedRef<any[]>>;
|
|
6
6
|
export declare const selectKey: InjectionKey<(a: any) => void>;
|
|
7
|
+
export declare const selectAllKey: InjectionKey<() => void>;
|
|
7
8
|
export declare const unselectKey: InjectionKey<(a: any) => void>;
|
|
8
9
|
export declare const isAllSelectedKey: InjectionKey<ComputedRef<boolean>>;
|
|
9
10
|
export declare const unselectAllKey: InjectionKey<() => void>;
|
|
@@ -2,10 +2,15 @@ declare const _default: {
|
|
|
2
2
|
new (...args: any[]): {
|
|
3
3
|
$: import("vue").ComponentInternalInstance;
|
|
4
4
|
$data: {};
|
|
5
|
-
$props: Partial<{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
$props: Partial<{
|
|
6
|
+
overscan: number;
|
|
7
|
+
}> & Omit<Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
8
|
+
data: any[];
|
|
9
|
+
itemHeight: (d: any) => number;
|
|
10
|
+
overscan?: number | undefined;
|
|
11
|
+
}>, {
|
|
12
|
+
overscan: number;
|
|
13
|
+
}>>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "overscan">;
|
|
9
14
|
$attrs: {
|
|
10
15
|
[x: string]: unknown;
|
|
11
16
|
};
|
|
@@ -19,10 +24,17 @@ declare const _default: {
|
|
|
19
24
|
$parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
|
|
20
25
|
$emit: (event: string, ...args: any[]) => void;
|
|
21
26
|
$el: any;
|
|
22
|
-
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
23
|
-
data: any;
|
|
24
|
-
itemHeight: (
|
|
25
|
-
|
|
27
|
+
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
28
|
+
data: any[];
|
|
29
|
+
itemHeight: (d: any) => number;
|
|
30
|
+
overscan?: number | undefined;
|
|
31
|
+
}>, {
|
|
32
|
+
overscan: number;
|
|
33
|
+
}>>>, {
|
|
34
|
+
vListReturn: import("./index").UseVirtualListReturn<any>;
|
|
35
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
36
|
+
overscan: number;
|
|
37
|
+
}> & {
|
|
26
38
|
beforeCreate?: ((() => void) | (() => void)[]) | undefined;
|
|
27
39
|
created?: ((() => void) | (() => void)[]) | undefined;
|
|
28
40
|
beforeMount?: ((() => void) | (() => void)[]) | undefined;
|
|
@@ -42,17 +54,29 @@ declare const _default: {
|
|
|
42
54
|
$forceUpdate: () => void;
|
|
43
55
|
$nextTick: typeof import("vue").nextTick;
|
|
44
56
|
$watch(source: string | Function, cb: Function, options?: import("vue").WatchOptions<boolean> | undefined): import("vue").WatchStopHandle;
|
|
45
|
-
} & Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
46
|
-
data: any;
|
|
47
|
-
itemHeight: (
|
|
48
|
-
|
|
57
|
+
} & Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
58
|
+
data: any[];
|
|
59
|
+
itemHeight: (d: any) => number;
|
|
60
|
+
overscan?: number | undefined;
|
|
61
|
+
}>, {
|
|
62
|
+
overscan: number;
|
|
63
|
+
}>>> & import("vue").ShallowUnwrapRef<{
|
|
64
|
+
vListReturn: import("./index").UseVirtualListReturn<any>;
|
|
65
|
+
}> & {} & import("vue").ComponentCustomProperties;
|
|
49
66
|
__isFragment?: undefined;
|
|
50
67
|
__isTeleport?: undefined;
|
|
51
68
|
__isSuspense?: undefined;
|
|
52
|
-
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
53
|
-
data: any;
|
|
54
|
-
itemHeight: (
|
|
55
|
-
|
|
69
|
+
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
70
|
+
data: any[];
|
|
71
|
+
itemHeight: (d: any) => number;
|
|
72
|
+
overscan?: number | undefined;
|
|
73
|
+
}>, {
|
|
74
|
+
overscan: number;
|
|
75
|
+
}>>>, {
|
|
76
|
+
vListReturn: import("./index").UseVirtualListReturn<any>;
|
|
77
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
78
|
+
overscan: number;
|
|
79
|
+
}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
56
80
|
$slots: {
|
|
57
81
|
default: (_: {
|
|
58
82
|
data: any;
|
|
@@ -70,3 +94,8 @@ declare type __VLS_TypePropsToRuntimeProps<T> = {
|
|
|
70
94
|
required: true;
|
|
71
95
|
};
|
|
72
96
|
};
|
|
97
|
+
declare type __VLS_WithDefaults<P, D> = {
|
|
98
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
|
|
99
|
+
default: D[K];
|
|
100
|
+
} : P[K];
|
|
101
|
+
};
|
|
@@ -19,6 +19,11 @@ export interface UseVirtualListItem<T> {
|
|
|
19
19
|
}
|
|
20
20
|
export interface UseVirtualListReturn<T> {
|
|
21
21
|
list: Ref<UseVirtualListItem<T>[]>;
|
|
22
|
+
visiableList: ComputedRef<UseVirtualListItem<T>[]>;
|
|
23
|
+
getItemHeightData: (index: number) => {
|
|
24
|
+
sum: number;
|
|
25
|
+
height: number;
|
|
26
|
+
};
|
|
22
27
|
scrollTo: (index: number) => void;
|
|
23
28
|
totalHeight: Ref<number>;
|
|
24
29
|
clientHeight: Ref<number>;
|