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