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