@lazycatcloud/lzc-toolkit 0.0.52 → 0.0.54
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 +218 -211
- package/dist/index.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { unref as B, getCurrentScope as Ke, onScopeDispose as Qe, getCurrentInstance as Ue, onMounted as
|
|
2
|
-
var
|
|
3
|
-
const
|
|
4
|
-
|
|
1
|
+
import { unref as B, getCurrentScope as Ke, onScopeDispose as Qe, getCurrentInstance as Ue, onMounted as fe, nextTick as pe, ref as E, watch as ne, shallowRef as qe, computed as S, onUnmounted as Oe, inject as F, provide as $, defineComponent as Z, h as Q, render as ae, openBlock as k, createBlock as De, Transition as Re, withCtx as Ce, createElementBlock as J, createElementVNode as M, withModifiers as Ye, normalizeClass as Ge, renderSlot as he, createCommentVNode as Xe, normalizeStyle as le, toDisplayString as Je, useSlots as Ze, withDirectives as et, vShow as tt, pushScopeId as nt, popScopeId as lt, toRef as ot, mergeProps as rt, normalizeProps as ge, guardReactiveProps as ye, Fragment as at, renderList as st } from "vue";
|
|
2
|
+
var be;
|
|
3
|
+
const Be = typeof window < "u";
|
|
4
|
+
Be && ((be = window?.navigator) == null ? void 0 : be.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
5
5
|
function se(t) {
|
|
6
6
|
return typeof t == "function" ? t() : B(t);
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function Ie(t, e) {
|
|
9
9
|
function n(...l) {
|
|
10
10
|
t(() => e.apply(this, l), { fn: e, thisArg: this, args: l });
|
|
11
11
|
}
|
|
@@ -30,12 +30,12 @@ function it(t, e = !0, n = !0) {
|
|
|
30
30
|
o && (clearTimeout(o), o = void 0);
|
|
31
31
|
};
|
|
32
32
|
return (m) => {
|
|
33
|
-
const
|
|
34
|
-
if (r(),
|
|
33
|
+
const h = se(t), d = Date.now() - l;
|
|
34
|
+
if (r(), h <= 0)
|
|
35
35
|
return l = Date.now(), m();
|
|
36
|
-
d >
|
|
36
|
+
d > h && (n || !a) ? (l = Date.now(), m()) : e && (o = setTimeout(() => {
|
|
37
37
|
l = Date.now(), a = !0, r(), m();
|
|
38
|
-
},
|
|
38
|
+
}, h)), !n && !o && (o = setTimeout(() => a = !0, h)), a = !1;
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
function ct(t) {
|
|
@@ -44,46 +44,46 @@ function ct(t) {
|
|
|
44
44
|
function vt(t) {
|
|
45
45
|
return Ke() ? (Qe(t), !0) : !1;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
return
|
|
47
|
+
function Le(t, e = 200, n = {}) {
|
|
48
|
+
return Ie(ut(e, n), t);
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
return
|
|
50
|
+
function Se(t, e = 200, n = !1, l = !0) {
|
|
51
|
+
return Ie(it(e, n, l), t);
|
|
52
52
|
}
|
|
53
53
|
function dt(t, e = !0) {
|
|
54
|
-
Ue() ?
|
|
54
|
+
Ue() ? fe(t) : e ? t() : pe(t);
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function He(t) {
|
|
57
57
|
var e;
|
|
58
58
|
const n = se(t);
|
|
59
59
|
return (e = n?.$el) != null ? e : n;
|
|
60
60
|
}
|
|
61
|
-
const ft =
|
|
62
|
-
function
|
|
63
|
-
const n =
|
|
61
|
+
const ft = Be ? window : void 0;
|
|
62
|
+
function pt(t, e = !1) {
|
|
63
|
+
const n = E(), l = () => n.value = Boolean(t());
|
|
64
64
|
return l(), dt(l, e), n;
|
|
65
65
|
}
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
var
|
|
66
|
+
const ve = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, de = "__vueuse_ssr_handlers__";
|
|
67
|
+
ve[de] = ve[de] || {};
|
|
68
|
+
ve[de];
|
|
69
|
+
var _e = Object.getOwnPropertySymbols, ht = Object.prototype.hasOwnProperty, mt = Object.prototype.propertyIsEnumerable, gt = (t, e) => {
|
|
70
70
|
var n = {};
|
|
71
71
|
for (var l in t)
|
|
72
|
-
|
|
73
|
-
if (t != null &&
|
|
74
|
-
for (var l of
|
|
72
|
+
ht.call(t, l) && e.indexOf(l) < 0 && (n[l] = t[l]);
|
|
73
|
+
if (t != null && _e)
|
|
74
|
+
for (var l of _e(t))
|
|
75
75
|
e.indexOf(l) < 0 && mt.call(t, l) && (n[l] = t[l]);
|
|
76
76
|
return n;
|
|
77
77
|
};
|
|
78
78
|
function yt(t, e, n = {}) {
|
|
79
79
|
const l = n, { window: o = ft } = l, a = gt(l, ["window"]);
|
|
80
80
|
let r;
|
|
81
|
-
const i =
|
|
81
|
+
const i = pt(() => o && "ResizeObserver" in o), m = () => {
|
|
82
82
|
r && (r.disconnect(), r = void 0);
|
|
83
|
-
},
|
|
83
|
+
}, h = ne(() => He(t), (c) => {
|
|
84
84
|
m(), i.value && o && c && (r = new ResizeObserver(e), r.observe(c, a));
|
|
85
85
|
}, { immediate: !0, flush: "post" }), d = () => {
|
|
86
|
-
m(),
|
|
86
|
+
m(), h();
|
|
87
87
|
};
|
|
88
88
|
return vt(d), {
|
|
89
89
|
isSupported: i,
|
|
@@ -91,11 +91,11 @@ function yt(t, e, n = {}) {
|
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
93
|
function bt(t, e = { width: 0, height: 0 }, n = {}) {
|
|
94
|
-
const { box: l = "content-box" } = n, o =
|
|
94
|
+
const { box: l = "content-box" } = n, o = E(e.width), a = E(e.height);
|
|
95
95
|
return yt(t, ([r]) => {
|
|
96
96
|
const i = l === "border-box" ? r.borderBoxSize : l === "content-box" ? r.contentBoxSize : r.devicePixelContentBoxSize;
|
|
97
|
-
i ? (o.value = i.reduce((m, { inlineSize:
|
|
98
|
-
}, n), ne(() =>
|
|
97
|
+
i ? (o.value = i.reduce((m, { inlineSize: h }) => m + h, 0), a.value = i.reduce((m, { blockSize: h }) => m + h, 0)) : (o.value = r.contentRect.width, a.value = r.contentRect.height);
|
|
98
|
+
}, n), ne(() => He(t), (r) => {
|
|
99
99
|
o.value = r ? e.width : 0, a.value = r ? e.height : 0;
|
|
100
100
|
}), {
|
|
101
101
|
width: o,
|
|
@@ -106,12 +106,12 @@ var Ee;
|
|
|
106
106
|
(function(t) {
|
|
107
107
|
t.UP = "UP", t.RIGHT = "RIGHT", t.DOWN = "DOWN", t.LEFT = "LEFT", t.NONE = "NONE";
|
|
108
108
|
})(Ee || (Ee = {}));
|
|
109
|
-
var St = Object.defineProperty, we = Object.getOwnPropertySymbols,
|
|
109
|
+
var St = Object.defineProperty, we = Object.getOwnPropertySymbols, _t = Object.prototype.hasOwnProperty, Et = Object.prototype.propertyIsEnumerable, xe = (t, e, n) => e in t ? St(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, wt = (t, e) => {
|
|
110
110
|
for (var n in e || (e = {}))
|
|
111
|
-
|
|
111
|
+
_t.call(e, n) && xe(t, n, e[n]);
|
|
112
112
|
if (we)
|
|
113
113
|
for (var n of we(e))
|
|
114
|
-
|
|
114
|
+
Et.call(e, n) && xe(t, n, e[n]);
|
|
115
115
|
return t;
|
|
116
116
|
};
|
|
117
117
|
const xt = {
|
|
@@ -140,23 +140,23 @@ const xt = {
|
|
|
140
140
|
easeOutBack: [0.34, 1.56, 0.64, 1],
|
|
141
141
|
easeInOutBack: [0.68, -0.6, 0.32, 1.6]
|
|
142
142
|
};
|
|
143
|
-
|
|
143
|
+
wt({
|
|
144
144
|
linear: ct
|
|
145
145
|
}, xt);
|
|
146
146
|
function Tt(t, e) {
|
|
147
|
-
const { scrollEndHook: n, itemHeight: l, overscan: o = 5 } = e, a =
|
|
148
|
-
let
|
|
149
|
-
const d = qe(t), c =
|
|
147
|
+
const { scrollEndHook: n, itemHeight: l, overscan: o = 5 } = e, a = E(null), r = bt(a), i = E(!0), m = Le(ee, 100);
|
|
148
|
+
let h;
|
|
149
|
+
const d = qe(t), c = E(0), s = E({ start: 0, end: 10 });
|
|
150
150
|
let u = 0;
|
|
151
|
-
const b =
|
|
151
|
+
const b = E([]), w = S(() => {
|
|
152
152
|
let { sum: f, height: y } = { sum: 0, height: 0 };
|
|
153
153
|
return d.value.map((I, C) => (typeof l == "number" ? y = l : y = l(C), f += y, { height: y, sum: f }));
|
|
154
|
-
}),
|
|
154
|
+
}), _ = S(() => V(s.value.start)), g = S(() => typeof l == "number" ? w.value.length * l : w.value[w.value.length - 1]?.sum || 0), D = S(() => {
|
|
155
155
|
let f = b.value.length - o, y = Math.max(f - u, 0);
|
|
156
156
|
return b.value.slice(y, f);
|
|
157
157
|
});
|
|
158
|
-
|
|
159
|
-
}),
|
|
158
|
+
fe(() => {
|
|
159
|
+
}), Oe(() => cancelAnimationFrame(h)), ne(
|
|
160
160
|
[r.width, r.height, d],
|
|
161
161
|
([f, y]) => {
|
|
162
162
|
(f || y) && U();
|
|
@@ -172,7 +172,7 @@ function Tt(t, e) {
|
|
|
172
172
|
i.value = !0, n?.();
|
|
173
173
|
}
|
|
174
174
|
function U() {
|
|
175
|
-
cancelAnimationFrame(
|
|
175
|
+
cancelAnimationFrame(h), h = requestAnimationFrame(N);
|
|
176
176
|
}
|
|
177
177
|
function N() {
|
|
178
178
|
if (a.value) {
|
|
@@ -185,27 +185,27 @@ function Tt(t, e) {
|
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
function A(f) {
|
|
188
|
-
let y = 0, I =
|
|
188
|
+
let y = 0, I = w.value.length - 1, C = -1;
|
|
189
189
|
for (; y <= I; ) {
|
|
190
190
|
const O = Math.floor((y + I) / 2);
|
|
191
|
-
|
|
191
|
+
w.value[O].sum >= f ? (C = O, I = O - 1) : y = O + 1;
|
|
192
192
|
}
|
|
193
193
|
return Math.max(0, C);
|
|
194
194
|
}
|
|
195
195
|
function z() {
|
|
196
196
|
let f = 0, y = 0, I = H();
|
|
197
|
-
for (let C = I; C <
|
|
197
|
+
for (let C = I; C < w.value.length && (f++, y += w.value[C].height, !(y >= r.height.value)); C++)
|
|
198
198
|
;
|
|
199
199
|
return f;
|
|
200
200
|
}
|
|
201
201
|
function V(f) {
|
|
202
202
|
if (typeof l == "number")
|
|
203
203
|
return f * l;
|
|
204
|
-
let y =
|
|
204
|
+
let y = w.value[f];
|
|
205
205
|
return y ? y.sum - y.height : 0;
|
|
206
206
|
}
|
|
207
207
|
function j(f) {
|
|
208
|
-
return
|
|
208
|
+
return w.value[f] || { sum: 0, height: 0 };
|
|
209
209
|
}
|
|
210
210
|
function H() {
|
|
211
211
|
let f = s.value.start;
|
|
@@ -225,7 +225,7 @@ function Tt(t, e) {
|
|
|
225
225
|
}
|
|
226
226
|
})), K = S(() => ({
|
|
227
227
|
style: {
|
|
228
|
-
transform: `translate3d(0, ${
|
|
228
|
+
transform: `translate3d(0, ${_.value}px, 0)`,
|
|
229
229
|
"will-change": "transform"
|
|
230
230
|
}
|
|
231
231
|
})), Y = {
|
|
@@ -233,7 +233,7 @@ function Tt(t, e) {
|
|
|
233
233
|
};
|
|
234
234
|
return {
|
|
235
235
|
list: b,
|
|
236
|
-
visiableList:
|
|
236
|
+
visiableList: D,
|
|
237
237
|
getItemHeightData: j,
|
|
238
238
|
getoffsetTopIndex: A,
|
|
239
239
|
totalHeight: g,
|
|
@@ -252,29 +252,29 @@ function Tt(t, e) {
|
|
|
252
252
|
innerProps: K
|
|
253
253
|
};
|
|
254
254
|
}
|
|
255
|
-
const
|
|
256
|
-
function
|
|
255
|
+
const $e = Symbol(), Ae = Symbol(), Pe = Symbol(), Fe = Symbol(), Me = Symbol(), ze = Symbol(), We = Symbol(), ke = Symbol(), Ne = Symbol();
|
|
256
|
+
function Wt() {
|
|
257
257
|
const { voidFn: t, boolFn: e, boolRef: n, arrayRef: l } = {
|
|
258
258
|
voidFn: (u) => {
|
|
259
259
|
},
|
|
260
260
|
boolFn: (u) => !1,
|
|
261
261
|
boolRef: S(() => !1),
|
|
262
262
|
arrayRef: S(() => [])
|
|
263
|
-
}, o = F(
|
|
263
|
+
}, o = F(Fe, l), a = F(Pe, e), r = F(ke, n), i = F(Ae, t), m = F($e, t), h = F(Me, t), d = F(ze, t), c = F(We, t), s = F(Ne, t);
|
|
264
264
|
return {
|
|
265
265
|
selected: o,
|
|
266
266
|
isSelected: a,
|
|
267
267
|
isAllSelected: r,
|
|
268
268
|
toggle: i,
|
|
269
269
|
toggleAll: m,
|
|
270
|
-
select:
|
|
270
|
+
select: h,
|
|
271
271
|
selectAll: d,
|
|
272
272
|
unselect: c,
|
|
273
273
|
unselectAll: s
|
|
274
274
|
};
|
|
275
275
|
}
|
|
276
|
-
function
|
|
277
|
-
const n =
|
|
276
|
+
function kt(t, e) {
|
|
277
|
+
const n = E({}), l = S(() => t.value.filter((s) => n.value[s[e]])), o = S(() => l.value.length != 0 && Object.keys(n.value).length == t.value.length);
|
|
278
278
|
function a() {
|
|
279
279
|
t.value.forEach((s) => {
|
|
280
280
|
n.value[s[e]] = !0;
|
|
@@ -293,18 +293,18 @@ function zt(t, e) {
|
|
|
293
293
|
n.value[u[e]] && delete n.value[u[e]];
|
|
294
294
|
});
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function h(s) {
|
|
297
297
|
return !!n.value[s[e]];
|
|
298
298
|
}
|
|
299
299
|
function d(s) {
|
|
300
300
|
s.forEach((u) => {
|
|
301
|
-
|
|
301
|
+
h(u) ? delete n.value[u[e]] : n.value[u[e]] = !0;
|
|
302
302
|
});
|
|
303
303
|
}
|
|
304
304
|
function c() {
|
|
305
305
|
o.value ? r() : a();
|
|
306
306
|
}
|
|
307
|
-
return $(
|
|
307
|
+
return $($e, c), $(Ae, d), $(Pe, h), $(Fe, l), $(Me, i), $(ze, a), $(We, m), $(ke, o), $(Ne, r), {
|
|
308
308
|
selected: l,
|
|
309
309
|
select: i,
|
|
310
310
|
selectAll: a,
|
|
@@ -312,40 +312,40 @@ function zt(t, e) {
|
|
|
312
312
|
unselectAll: r,
|
|
313
313
|
toggle: d,
|
|
314
314
|
toggleAll: c,
|
|
315
|
-
isSelected:
|
|
315
|
+
isSelected: h,
|
|
316
316
|
isAllSelected: o
|
|
317
317
|
};
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function ce(t) {
|
|
320
320
|
return () => {
|
|
321
321
|
console.debug(`\u9ED8\u8BA4${t}\u65B9\u6CD5,\u9700\u8981\u81EA\u5B9A\u4E49\u751F\u6548`);
|
|
322
322
|
};
|
|
323
323
|
}
|
|
324
|
-
function
|
|
324
|
+
function Ve({
|
|
325
325
|
attribute: t,
|
|
326
326
|
selectWay: e = "colum",
|
|
327
327
|
scrollOptions: n = {},
|
|
328
328
|
getSelectMap: l = () => ({})
|
|
329
329
|
}) {
|
|
330
330
|
const {
|
|
331
|
-
select: o =
|
|
332
|
-
unselect: a =
|
|
333
|
-
unselectAll: r =
|
|
331
|
+
select: o = ce("\u9009\u62E9"),
|
|
332
|
+
unselect: a = ce("\u53D6\u6D88\u9009\u62E9"),
|
|
333
|
+
unselectAll: r = ce("\u53D6\u6D88\u5168\u9009")
|
|
334
334
|
} = l();
|
|
335
335
|
let i = {};
|
|
336
336
|
const m = S(
|
|
337
|
-
() =>
|
|
338
|
-
),
|
|
339
|
-
(v) =>
|
|
340
|
-
),
|
|
337
|
+
() => Se(e === "colum" ? W : oe, 50)
|
|
338
|
+
), h = /* @__PURE__ */ new Set(), d = E(!0), c = E(), s = E(!1), u = E({ x: 0, y: 0 }), b = E({ x: 0, y: 0, scrollTop: 0 }), w = new ResizeObserver(
|
|
339
|
+
(v) => _.value = v[0].target.getBoundingClientRect()
|
|
340
|
+
), _ = E({}), g = E({
|
|
341
341
|
top: 0,
|
|
342
342
|
height: 0,
|
|
343
343
|
sync(v = !1) {
|
|
344
344
|
g.value.top = c.value?.scrollTop || 0, v && (g.value.height = c.value?.scrollHeight || 0);
|
|
345
345
|
}
|
|
346
|
-
}),
|
|
347
|
-
left: Math.min(u.value.x, b.value.x) -
|
|
348
|
-
top: Math.min(u.value.y, b.value.y) -
|
|
346
|
+
}), D = S(() => s.value ? {
|
|
347
|
+
left: Math.min(u.value.x, b.value.x) - _.value.left,
|
|
348
|
+
top: Math.min(u.value.y, b.value.y) - _.value.top,
|
|
349
349
|
width: Math.abs(u.value.x - b.value.x),
|
|
350
350
|
height: Math.abs(u.value.y - b.value.y)
|
|
351
351
|
} : { left: 0, top: 0, width: 0, height: 0 }), { margin: L = 50, startSpeed: ee = 30, maxSpeed: U = 30 } = n;
|
|
@@ -357,55 +357,55 @@ function Ne({
|
|
|
357
357
|
Math.min(H, V),
|
|
358
358
|
-V
|
|
359
359
|
), H !== 0) {
|
|
360
|
-
const
|
|
361
|
-
if (!
|
|
360
|
+
const p = c.value;
|
|
361
|
+
if (!p || !s.value)
|
|
362
362
|
return;
|
|
363
|
-
const
|
|
363
|
+
const R = g.value.height - _.value.height;
|
|
364
364
|
let x = g.value.top + Number(H);
|
|
365
|
-
x = Math.min(Math.max(0, x),
|
|
365
|
+
x = Math.min(Math.max(0, x), R), p.scrollTop = x, Y(), N = requestAnimationFrame(() => q(v));
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
function te(v) {
|
|
369
369
|
if (c.value) {
|
|
370
|
-
const
|
|
370
|
+
const R = _.value, x = R.bottom - v;
|
|
371
371
|
if (x < A)
|
|
372
372
|
return z * j(1 - x / A);
|
|
373
|
-
const P = v -
|
|
373
|
+
const P = v - R.top;
|
|
374
374
|
if (P < A)
|
|
375
375
|
return -z * j(1 - P / A);
|
|
376
376
|
}
|
|
377
377
|
return 0;
|
|
378
378
|
}
|
|
379
379
|
function K(v) {
|
|
380
|
-
const
|
|
381
|
-
return
|
|
380
|
+
const p = { ...D.value, right: 0, bottom: 0 };
|
|
381
|
+
return p.left += _.value.left, p.top += _.value.top - g.value.top, p.right = p.width + p.left, p.bottom = p.height + p.top, p.left < v.right && p.right > v.left && p.top < v.bottom && p.bottom > v.top;
|
|
382
382
|
}
|
|
383
383
|
function Y() {
|
|
384
384
|
g.value.sync();
|
|
385
|
-
const { top: v, height:
|
|
385
|
+
const { top: v, height: p } = g.value;
|
|
386
386
|
b.value.y = Math.min(
|
|
387
|
-
|
|
387
|
+
p + _.value.top,
|
|
388
388
|
b.value.y + v - b.value.scrollTop
|
|
389
389
|
), b.value.scrollTop = v;
|
|
390
390
|
}
|
|
391
|
-
function f(v,
|
|
392
|
-
let x = document.getElementById(
|
|
393
|
-
x || (x = document.createElement("style"), x.id =
|
|
394
|
-
const P = x.sheet.cssRules, X = P.length, je = `${v} { ${
|
|
395
|
-
for (let
|
|
396
|
-
const
|
|
397
|
-
if (
|
|
391
|
+
function f(v, p, R = "dynamic-styles") {
|
|
392
|
+
let x = document.getElementById(R);
|
|
393
|
+
x || (x = document.createElement("style"), x.id = R, document.head.appendChild(x));
|
|
394
|
+
const P = x.sheet.cssRules, X = P.length, je = `${v} { ${p} }`;
|
|
395
|
+
for (let ie = 0; ie < X; ie++) {
|
|
396
|
+
const me = P[ie];
|
|
397
|
+
if (me.selectorText === v && me.style.cssText === p)
|
|
398
398
|
return;
|
|
399
399
|
}
|
|
400
400
|
x.sheet.insertRule(je, X);
|
|
401
401
|
}
|
|
402
|
-
function y(v,
|
|
403
|
-
d.value = !0, s.value = !0, g.value.height ? g.value.sync() : g.value.sync(!0), u.value.x = v, u.value.y =
|
|
402
|
+
function y(v, p) {
|
|
403
|
+
d.value = !0, s.value = !0, g.value.height ? g.value.sync() : g.value.sync(!0), u.value.x = v, u.value.y = p + g.value.top, b.value.x = u.value.x, b.value.y = u.value.y, c.value?.classList.add("disable-scroll-behavior"), h.clear();
|
|
404
404
|
}
|
|
405
|
-
function I(v,
|
|
406
|
-
!s.value || (d.value && e === "colum" && !T() && (r(), d.value = !1),
|
|
407
|
-
|
|
408
|
-
g.value.height +
|
|
405
|
+
function I(v, p, R) {
|
|
406
|
+
!s.value || (d.value && e === "colum" && !T() && (r(), d.value = !1), R?.(), q(p), b.value.x = Math.max(v, _.value.left), b.value.y = Math.min(
|
|
407
|
+
p + g.value.top,
|
|
408
|
+
g.value.height + _.value.top
|
|
409
409
|
), b.value.scrollTop = g.value.top, m.value());
|
|
410
410
|
}
|
|
411
411
|
function C() {
|
|
@@ -417,8 +417,8 @@ function Ne({
|
|
|
417
417
|
function T() {
|
|
418
418
|
if (!s.value)
|
|
419
419
|
return !1;
|
|
420
|
-
const { width: v, height:
|
|
421
|
-
return !(Math.max(v,
|
|
420
|
+
const { width: v, height: p } = D.value;
|
|
421
|
+
return !(Math.max(v, p) > 5);
|
|
422
422
|
}
|
|
423
423
|
function G() {
|
|
424
424
|
T() && r();
|
|
@@ -430,16 +430,16 @@ function Ne({
|
|
|
430
430
|
}
|
|
431
431
|
function oe() {
|
|
432
432
|
const v = [];
|
|
433
|
-
let
|
|
433
|
+
let p = null, R = 0;
|
|
434
434
|
c.value?.querySelectorAll(`[${t}]`).forEach((x, P) => {
|
|
435
435
|
const X = x.getAttribute(`${t}`);
|
|
436
|
-
v.push(X), K(x.getBoundingClientRect()) ? (
|
|
436
|
+
v.push(X), K(x.getBoundingClientRect()) ? (p === null && (p = P), p = Math.min(p, P), R = Math.max(R, P)) : (i[`${t}`] = X, h.has(X) && a([i]));
|
|
437
437
|
});
|
|
438
|
-
for (let x =
|
|
439
|
-
i[`${t}`] = v[x], o([i]),
|
|
438
|
+
for (let x = p; x < R + 1; x++)
|
|
439
|
+
i[`${t}`] = v[x], o([i]), h.add(v[x]);
|
|
440
440
|
}
|
|
441
441
|
function re(v) {
|
|
442
|
-
return !v?.value || (c.value = v.value, !c?.value) ? !1 : (
|
|
442
|
+
return !v?.value || (c.value = v.value, !c?.value) ? !1 : (w.observe(c.value), f(
|
|
443
443
|
".disable-scroll-behavior",
|
|
444
444
|
"scroll-behavior: unset !important;"
|
|
445
445
|
), !0);
|
|
@@ -453,20 +453,20 @@ function Ne({
|
|
|
453
453
|
isSingleClick: T,
|
|
454
454
|
cancelSelectAllBySingleClick: G,
|
|
455
455
|
selectFn: m,
|
|
456
|
-
selectRange:
|
|
456
|
+
selectRange: D,
|
|
457
457
|
isPressing: s,
|
|
458
458
|
containerEl: c,
|
|
459
|
-
observer:
|
|
459
|
+
observer: w
|
|
460
460
|
};
|
|
461
461
|
}
|
|
462
|
-
function
|
|
463
|
-
const e =
|
|
462
|
+
function Nt(t) {
|
|
463
|
+
const e = Ve(t), { observer: n, selectRange: l } = e, {
|
|
464
464
|
onScroll: o,
|
|
465
465
|
dragStart: a,
|
|
466
466
|
dragMove: r,
|
|
467
467
|
dragEnd: i,
|
|
468
468
|
cancelSelectAllBySingleClick: m
|
|
469
|
-
} = e,
|
|
469
|
+
} = e, h = S(() => ({
|
|
470
470
|
left: `${l.value.left}px`,
|
|
471
471
|
top: `${l.value.top}px`,
|
|
472
472
|
width: `${l.value.width}px`,
|
|
@@ -476,22 +476,22 @@ function Wt(t) {
|
|
|
476
476
|
return Q("div", {
|
|
477
477
|
id: "selectBoxEl",
|
|
478
478
|
class: "absolute z-50 bg-blue-200 opacity-50",
|
|
479
|
-
style:
|
|
479
|
+
style: h.value
|
|
480
480
|
});
|
|
481
481
|
}
|
|
482
482
|
});
|
|
483
|
-
function c(
|
|
484
|
-
|
|
483
|
+
function c(_) {
|
|
484
|
+
_.button === 0 && a(_.x, _.y);
|
|
485
485
|
}
|
|
486
|
-
function s(
|
|
487
|
-
r(
|
|
486
|
+
function s(_) {
|
|
487
|
+
r(_.x, _.y);
|
|
488
488
|
}
|
|
489
|
-
function u(
|
|
490
|
-
|
|
489
|
+
function u(_) {
|
|
490
|
+
_.composedPath().some((D) => D?.getAttribute?.(t.attribute)) || m(), i();
|
|
491
491
|
}
|
|
492
|
-
function b(
|
|
492
|
+
function b(_) {
|
|
493
493
|
try {
|
|
494
|
-
if (!e.init(
|
|
494
|
+
if (!e.init(_))
|
|
495
495
|
throw "\u521D\u59CB\u5316\u5931\u8D25,Ref\u5143\u7D20\u4E0D\u6B63\u786E";
|
|
496
496
|
if (!e.containerEl?.value)
|
|
497
497
|
return !1;
|
|
@@ -500,55 +500,55 @@ function Wt(t) {
|
|
|
500
500
|
console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25", g);
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
|
-
function
|
|
503
|
+
function w() {
|
|
504
504
|
n.disconnect(), e.containerEl.value?.removeEventListener("scroll", o), e.containerEl.value?.removeEventListener("mousedown", c), window.removeEventListener("mousemove", s), window.removeEventListener("mouseup", u);
|
|
505
505
|
}
|
|
506
|
-
return { init: b, unMount:
|
|
506
|
+
return { init: b, unMount: w };
|
|
507
507
|
}
|
|
508
|
-
function
|
|
509
|
-
const l =
|
|
508
|
+
function Vt(t, e, n = 600) {
|
|
509
|
+
const l = Ve({
|
|
510
510
|
...t,
|
|
511
511
|
selectWay: "row",
|
|
512
512
|
scrollOptions: {
|
|
513
513
|
startSpeed: 5,
|
|
514
514
|
maxSpeed: 5
|
|
515
515
|
}
|
|
516
|
-
}), { observer: o } = l, { onScroll: a, dragStart: r, dragMove: i, dragEnd: m, selectFn:
|
|
516
|
+
}), { observer: o } = l, { onScroll: a, dragStart: r, dragMove: i, dragEnd: m, selectFn: h } = l;
|
|
517
517
|
let d;
|
|
518
518
|
function c() {
|
|
519
519
|
clearTimeout(d);
|
|
520
520
|
}
|
|
521
521
|
function s(g) {
|
|
522
522
|
c(), d = setTimeout(() => {
|
|
523
|
-
const { clientX:
|
|
524
|
-
r(
|
|
523
|
+
const { clientX: D, clientY: L } = g.targetTouches[0];
|
|
524
|
+
r(D, L), e?.(), h.value(), g.preventDefault();
|
|
525
525
|
}, n);
|
|
526
526
|
}
|
|
527
527
|
function u(g) {
|
|
528
528
|
c();
|
|
529
|
-
const { clientX:
|
|
530
|
-
i(
|
|
529
|
+
const { clientX: D, clientY: L } = g.targetTouches[0];
|
|
530
|
+
i(D, L, () => g.preventDefault());
|
|
531
531
|
}
|
|
532
532
|
function b() {
|
|
533
533
|
c(), m();
|
|
534
534
|
}
|
|
535
|
-
function
|
|
535
|
+
function w(g) {
|
|
536
536
|
try {
|
|
537
537
|
if (!l.init(g))
|
|
538
538
|
throw "\u521D\u59CB\u5316\u5931\u8D25,Ref\u5143\u7D20\u4E0D\u6B63\u786E";
|
|
539
539
|
if (!l.containerEl?.value)
|
|
540
540
|
return !1;
|
|
541
541
|
l.containerEl.value?.addEventListener("scroll", a), l.containerEl.value?.addEventListener("touchstart", s), l.containerEl.value?.addEventListener("touchmove", u), window.addEventListener("touchcancel", b), window.addEventListener("touchend", b);
|
|
542
|
-
} catch (
|
|
543
|
-
console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25",
|
|
542
|
+
} catch (D) {
|
|
543
|
+
console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25", D);
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
|
-
function
|
|
546
|
+
function _() {
|
|
547
547
|
o.disconnect(), l.containerEl.value?.removeEventListener("scroll", a), l.containerEl.value?.removeEventListener("touchstart", s), l.containerEl.value?.removeEventListener("touchmove", u), window.removeEventListener("touchcancel", b), window.removeEventListener("touchEnd", b);
|
|
548
548
|
}
|
|
549
|
-
return { init:
|
|
549
|
+
return { init: w, unMount: _ };
|
|
550
550
|
}
|
|
551
|
-
const Ot = Symbol(),
|
|
551
|
+
const Ot = Symbol(), Dt = /* @__PURE__ */ Z({
|
|
552
552
|
__name: "Dialog",
|
|
553
553
|
props: {
|
|
554
554
|
visiable: { type: Boolean, default: !1 },
|
|
@@ -560,19 +560,19 @@ const Ot = Symbol(), Rt = /* @__PURE__ */ Z({
|
|
|
560
560
|
const n = t, l = () => {
|
|
561
561
|
n.closeOnClickOverlay && e("update:visiable", !1);
|
|
562
562
|
};
|
|
563
|
-
return $(Ot, () => e("update:visiable", !1)), (o, a) => (k(),
|
|
564
|
-
default:
|
|
563
|
+
return $(Ot, () => e("update:visiable", !1)), (o, a) => (k(), De(Re, { name: "modal" }, {
|
|
564
|
+
default: Ce(() => [
|
|
565
565
|
t.visiable ? (k(), J("div", {
|
|
566
566
|
key: 0,
|
|
567
567
|
onClick: l,
|
|
568
|
-
class: "modal
|
|
568
|
+
class: "modal"
|
|
569
569
|
}, [
|
|
570
570
|
M("div", {
|
|
571
571
|
onClick: a[0] || (a[0] = Ye(() => {
|
|
572
572
|
}, ["stop"])),
|
|
573
|
-
class: Ge(["dialog
|
|
573
|
+
class: Ge(["dialog", t.dialogClass])
|
|
574
574
|
}, [
|
|
575
|
-
he(o.$slots, "default")
|
|
575
|
+
he(o.$slots, "default", {}, void 0, !0)
|
|
576
576
|
], 2)
|
|
577
577
|
])) : Xe("", !0)
|
|
578
578
|
]),
|
|
@@ -580,7 +580,13 @@ const Ot = Symbol(), Rt = /* @__PURE__ */ Z({
|
|
|
580
580
|
}));
|
|
581
581
|
}
|
|
582
582
|
});
|
|
583
|
-
|
|
583
|
+
const ue = (t, e) => {
|
|
584
|
+
const n = t.__vccOpts || t;
|
|
585
|
+
for (const [l, o] of e)
|
|
586
|
+
n[l] = o;
|
|
587
|
+
return n;
|
|
588
|
+
}, Rt = /* @__PURE__ */ ue(Dt, [["__scopeId", "data-v-415900d3"]]);
|
|
589
|
+
function jt(t) {
|
|
584
590
|
function e(n, l) {
|
|
585
591
|
const o = document.createElement("div"), a = {
|
|
586
592
|
setup() {
|
|
@@ -607,14 +613,14 @@ function Nt(t) {
|
|
|
607
613
|
create: e
|
|
608
614
|
};
|
|
609
615
|
}
|
|
610
|
-
const
|
|
616
|
+
const Ct = /* @__PURE__ */ Z({
|
|
611
617
|
__name: "Toast",
|
|
612
618
|
props: {
|
|
613
619
|
message: null,
|
|
614
620
|
position: null
|
|
615
621
|
},
|
|
616
622
|
setup(t) {
|
|
617
|
-
const e = t, n =
|
|
623
|
+
const e = t, n = E(), l = E(), o = E(), a = S(() => {
|
|
618
624
|
switch (e.position) {
|
|
619
625
|
case "top":
|
|
620
626
|
return 10;
|
|
@@ -638,9 +644,9 @@ const Dt = /* @__PURE__ */ Z({
|
|
|
638
644
|
color: "white",
|
|
639
645
|
fontSize: "14px"
|
|
640
646
|
}));
|
|
641
|
-
return
|
|
647
|
+
return pe(() => {
|
|
642
648
|
l.value = n.value.offsetWidth / 2, o.value = n.value.offsetHeight / 2;
|
|
643
|
-
}), (m,
|
|
649
|
+
}), (m, h) => (k(), J("div", {
|
|
644
650
|
id: "toastWrapper",
|
|
645
651
|
ref_key: "toastWrapper",
|
|
646
652
|
ref: n,
|
|
@@ -654,32 +660,38 @@ const Dt = /* @__PURE__ */ Z({
|
|
|
654
660
|
], 4)
|
|
655
661
|
], 4));
|
|
656
662
|
}
|
|
657
|
-
})
|
|
663
|
+
});
|
|
664
|
+
const Bt = /* @__PURE__ */ ue(Ct, [["__scopeId", "data-v-15ab4094"]]), Te = {
|
|
658
665
|
message: "\u61D2\u732B\u4E91 Yes!!!",
|
|
659
666
|
position: "middle",
|
|
660
667
|
duration: 1500
|
|
661
668
|
};
|
|
662
|
-
class
|
|
669
|
+
class Kt {
|
|
663
670
|
options;
|
|
664
671
|
container;
|
|
665
672
|
constructor(e) {
|
|
666
673
|
this.options = e, this.container = document.createElement("div");
|
|
667
674
|
}
|
|
668
675
|
present() {
|
|
669
|
-
const e = Q(Q(
|
|
676
|
+
const e = Q(Q(Bt), { ...Te, ...this.options });
|
|
670
677
|
ae(e, this.container), document.body.insertBefore(this.container, document.body.firstChild);
|
|
671
|
-
const n = this.options.duration ||
|
|
678
|
+
const n = this.options.duration || Te.duration;
|
|
672
679
|
setTimeout(() => {
|
|
673
680
|
this.dismiss();
|
|
674
681
|
}, n);
|
|
675
682
|
}
|
|
676
683
|
dismiss() {
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
684
|
+
if (this.container) {
|
|
685
|
+
const e = this.container.querySelector(
|
|
686
|
+
"#toastWrapper"
|
|
687
|
+
);
|
|
688
|
+
e.style.opacity = "0", e.style.transition = "opacity 0.4s ease-in", setTimeout(() => {
|
|
689
|
+
this.container && (ae(null, this.container), document.body.removeChild(this.container));
|
|
690
|
+
}, 500);
|
|
691
|
+
}
|
|
680
692
|
}
|
|
681
693
|
}
|
|
682
|
-
const
|
|
694
|
+
const It = ["xlink:href", "fill", "color"], Qt = /* @__PURE__ */ Z({
|
|
683
695
|
__name: "SvgIcon",
|
|
684
696
|
props: {
|
|
685
697
|
name: null,
|
|
@@ -702,27 +714,27 @@ const Ct = ["xlink:href", "fill", "color"], jt = /* @__PURE__ */ Z({
|
|
|
702
714
|
"xlink:href": B(n),
|
|
703
715
|
fill: t.color,
|
|
704
716
|
color: t.color
|
|
705
|
-
}, null, 8,
|
|
717
|
+
}, null, 8, It)
|
|
706
718
|
], 4));
|
|
707
719
|
}
|
|
708
720
|
});
|
|
709
|
-
function
|
|
721
|
+
function Lt(t) {
|
|
710
722
|
const {
|
|
711
723
|
containerEl: e,
|
|
712
724
|
sliderEl: n,
|
|
713
725
|
autoHeight: l,
|
|
714
726
|
performance: o = {},
|
|
715
727
|
maxHeightRatio: a = 0.9
|
|
716
|
-
} = t, r =
|
|
717
|
-
let m,
|
|
718
|
-
const d =
|
|
728
|
+
} = t, r = E(!0), i = Le(V, 100);
|
|
729
|
+
let m, h = "";
|
|
730
|
+
const d = E(0), c = E(0), s = E(0), u = E({
|
|
719
731
|
top: 0,
|
|
720
732
|
scrollTop: 0,
|
|
721
733
|
scrollHeight: 0,
|
|
722
734
|
clientHeight: 0
|
|
723
|
-
}), b =
|
|
735
|
+
}), b = E({
|
|
724
736
|
clientHeight: 0
|
|
725
|
-
}),
|
|
737
|
+
}), w = S(() => !!c.value), _ = S(() => u.value.scrollHeight > u.value.clientHeight), g = S(() => u.value.clientHeight - b.value.clientHeight), D = S(() => u.value.scrollHeight - u.value.clientHeight), L = S(() => Math.max(
|
|
726
738
|
u.value.clientHeight / u.value.scrollHeight,
|
|
727
739
|
0.05
|
|
728
740
|
)), ee = S(() => L.value > a ? 0 : L.value * u.value.clientHeight), U = S(() => ({
|
|
@@ -731,33 +743,33 @@ function Bt(t) {
|
|
|
731
743
|
height: l ? `${ee.value}px` : void 0
|
|
732
744
|
}));
|
|
733
745
|
function N(O) {
|
|
734
|
-
z(), c.value = O.clientY - n.value.getBoundingClientRect().top || 1,
|
|
746
|
+
z(), c.value = O.clientY - n.value.getBoundingClientRect().top || 1, h = getComputedStyle(e.value).scrollBehavior, h === "smooth" && (e.value.style.scrollBehavior = "unset");
|
|
735
747
|
}
|
|
736
748
|
function A() {
|
|
737
|
-
e.value.style.scrollBehavior =
|
|
749
|
+
e.value.style.scrollBehavior = h, c.value = 0, i();
|
|
738
750
|
}
|
|
739
751
|
function z() {
|
|
740
752
|
r.value = !1;
|
|
741
753
|
}
|
|
742
754
|
function V() {
|
|
743
|
-
|
|
755
|
+
w.value || (r.value = !0);
|
|
744
756
|
}
|
|
745
757
|
function j(O) {
|
|
746
|
-
if (!
|
|
758
|
+
if (!w.value)
|
|
747
759
|
return;
|
|
748
760
|
let T = O.clientY - u.value.top - c.value;
|
|
749
761
|
T < 0 ? s.value = 0 : T >= g.value ? s.value = g.value : s.value = T, e.value.scrollTo({
|
|
750
|
-
top: s.value / g.value *
|
|
762
|
+
top: s.value / g.value * D.value
|
|
751
763
|
});
|
|
752
764
|
}
|
|
753
765
|
function H() {
|
|
754
|
-
|
|
766
|
+
w.value || q();
|
|
755
767
|
}
|
|
756
768
|
function q() {
|
|
757
769
|
cancelAnimationFrame(m), m = requestAnimationFrame(te);
|
|
758
770
|
}
|
|
759
771
|
function te() {
|
|
760
|
-
e.value && (d.value = o.scrollTop?.value ?? e.value.scrollTop, s.value = d.value /
|
|
772
|
+
e.value && (d.value = o.scrollTop?.value ?? e.value.scrollTop, s.value = d.value / D.value * g.value);
|
|
761
773
|
}
|
|
762
774
|
function K(O) {
|
|
763
775
|
let T = "addEventListener";
|
|
@@ -780,9 +792,9 @@ function Bt(t) {
|
|
|
780
792
|
let W = document.getElementById(G);
|
|
781
793
|
W || (W = document.createElement("style"), W.id = G, document.head.appendChild(W));
|
|
782
794
|
const oe = W.sheet.cssRules, re = oe.length, v = `${O} { ${T} }`;
|
|
783
|
-
for (let
|
|
784
|
-
const
|
|
785
|
-
if (
|
|
795
|
+
for (let p = 0; p < re; p++) {
|
|
796
|
+
const R = oe[p];
|
|
797
|
+
if (R.selectorText === O && R.style.cssText === T)
|
|
786
798
|
return;
|
|
787
799
|
}
|
|
788
800
|
W.sheet.insertRule(v, re);
|
|
@@ -805,16 +817,16 @@ function Bt(t) {
|
|
|
805
817
|
z(), i();
|
|
806
818
|
}), {
|
|
807
819
|
isScrollEnd: r,
|
|
808
|
-
isDragSlider:
|
|
820
|
+
isDragSlider: w,
|
|
809
821
|
offsetTop: s,
|
|
810
822
|
scrollTop: d,
|
|
811
|
-
scrollable:
|
|
823
|
+
scrollable: _,
|
|
812
824
|
sliderPos: U,
|
|
813
825
|
init: C,
|
|
814
826
|
modifySliderEventListener: K
|
|
815
827
|
};
|
|
816
828
|
}
|
|
817
|
-
const
|
|
829
|
+
const Ht = (t) => (nt("data-v-edec7292"), t = t(), lt(), t), $t = /* @__PURE__ */ Ht(() => /* @__PURE__ */ M("div", { class: "default-slider" }, null, -1)), At = /* @__PURE__ */ Z({
|
|
818
830
|
__name: "ScrollBar",
|
|
819
831
|
props: {
|
|
820
832
|
containerEl: null,
|
|
@@ -823,17 +835,17 @@ const It = (t) => (nt("data-v-edec7292"), t = t(), lt(), t), Lt = /* @__PURE__ *
|
|
|
823
835
|
performance: null
|
|
824
836
|
},
|
|
825
837
|
setup(t, { expose: e }) {
|
|
826
|
-
const n = t, l = !!Ze().default, o =
|
|
838
|
+
const n = t, l = !!Ze().default, o = E(null), a = S(() => n.containerEl), r = Lt({
|
|
827
839
|
containerEl: a,
|
|
828
840
|
sliderEl: o,
|
|
829
841
|
autoHeight: l ? n.autoHeight : !0,
|
|
830
842
|
performance: n.performance
|
|
831
|
-
}), { scrollable: i, isScrollEnd: m, sliderPos:
|
|
832
|
-
|
|
833
|
-
|
|
843
|
+
}), { scrollable: i, isScrollEnd: m, sliderPos: h } = r, d = E(!1), c = n.autoHide ? S(() => d.value || !m.value) : S(() => i.value);
|
|
844
|
+
fe(() => {
|
|
845
|
+
pe(() => {
|
|
834
846
|
r.init();
|
|
835
847
|
});
|
|
836
|
-
}),
|
|
848
|
+
}), Oe(() => {
|
|
837
849
|
r.modifySliderEventListener("remove");
|
|
838
850
|
});
|
|
839
851
|
function s() {
|
|
@@ -842,18 +854,18 @@ const It = (t) => (nt("data-v-edec7292"), t = t(), lt(), t), Lt = /* @__PURE__ *
|
|
|
842
854
|
function u() {
|
|
843
855
|
d.value = !1;
|
|
844
856
|
}
|
|
845
|
-
return e({ uScrollBarReturn: r }), (b,
|
|
846
|
-
default:
|
|
857
|
+
return e({ uScrollBarReturn: r }), (b, w) => (k(), De(Re, null, {
|
|
858
|
+
default: Ce(() => [
|
|
847
859
|
et(M("div", {
|
|
848
860
|
ref_key: "sliderRef",
|
|
849
861
|
ref: o,
|
|
850
862
|
class: "slider-wrapper",
|
|
851
863
|
onMouseenter: s,
|
|
852
864
|
onMouseleave: u,
|
|
853
|
-
style: le(B(
|
|
865
|
+
style: le(B(h))
|
|
854
866
|
}, [
|
|
855
867
|
he(b.$slots, "default", {}, () => [
|
|
856
|
-
|
|
868
|
+
$t
|
|
857
869
|
], !0)
|
|
858
870
|
], 36), [
|
|
859
871
|
[tt, B(c)]
|
|
@@ -863,15 +875,10 @@ const It = (t) => (nt("data-v-edec7292"), t = t(), lt(), t), Lt = /* @__PURE__ *
|
|
|
863
875
|
}));
|
|
864
876
|
}
|
|
865
877
|
});
|
|
866
|
-
const
|
|
867
|
-
const n = t.__vccOpts || t;
|
|
868
|
-
for (const [l, o] of e)
|
|
869
|
-
n[l] = o;
|
|
870
|
-
return n;
|
|
871
|
-
}, Kt = /* @__PURE__ */ Ve(Ht, [["__scopeId", "data-v-edec7292"]]), $t = { class: "virtualListWrapper" }, At = {
|
|
878
|
+
const Ut = /* @__PURE__ */ ue(At, [["__scopeId", "data-v-edec7292"]]), Pt = { class: "virtualListWrapper" }, Ft = {
|
|
872
879
|
inheritAttrs: !1
|
|
873
|
-
},
|
|
874
|
-
...
|
|
880
|
+
}, Mt = /* @__PURE__ */ Z({
|
|
881
|
+
...Ft,
|
|
875
882
|
__name: "VirtualList",
|
|
876
883
|
props: {
|
|
877
884
|
data: null,
|
|
@@ -886,21 +893,21 @@ const Ve = (t, e) => {
|
|
|
886
893
|
scrollEndHook: () => {
|
|
887
894
|
n("scrollEnd");
|
|
888
895
|
}
|
|
889
|
-
}), { list: a, containerProps: r, wrapperProps: i, innerProps: m, getItemHeightData:
|
|
896
|
+
}), { list: a, containerProps: r, wrapperProps: i, innerProps: m, getItemHeightData: h } = o;
|
|
890
897
|
return e({
|
|
891
898
|
vListReturn: o
|
|
892
|
-
}), (d, c) => (k(), J("div",
|
|
899
|
+
}), (d, c) => (k(), J("div", Pt, [
|
|
893
900
|
M("div", rt({
|
|
894
901
|
onScrollPassive: c[0] || (c[0] = (...s) => B(r).onScroll && B(r).onScroll(...s)),
|
|
895
902
|
ref: B(r).ref,
|
|
896
903
|
class: "virtualList"
|
|
897
904
|
}, d.$attrs), [
|
|
898
|
-
M("div",
|
|
899
|
-
M("div",
|
|
905
|
+
M("div", ge(ye(B(i))), [
|
|
906
|
+
M("div", ge(ye(B(m))), [
|
|
900
907
|
(k(!0), J(at, null, st(B(a), ({ index: s, data: u }) => (k(), J("div", {
|
|
901
908
|
key: s,
|
|
902
909
|
style: le({
|
|
903
|
-
height: `${B(
|
|
910
|
+
height: `${B(h)(s).height}px`,
|
|
904
911
|
display: "flex"
|
|
905
912
|
})
|
|
906
913
|
}, [
|
|
@@ -915,27 +922,27 @@ const Ve = (t, e) => {
|
|
|
915
922
|
]));
|
|
916
923
|
}
|
|
917
924
|
});
|
|
918
|
-
const
|
|
925
|
+
const qt = /* @__PURE__ */ ue(Mt, [["__scopeId", "data-v-4ba97cce"]]);
|
|
919
926
|
export {
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
927
|
+
Ut as ScrollBar,
|
|
928
|
+
Qt as SvgIcon,
|
|
929
|
+
Kt as ToastCreator,
|
|
930
|
+
qt as VirtualList,
|
|
931
|
+
Fe as allSelectedKey,
|
|
925
932
|
Ot as closeDialogKey,
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
933
|
+
jt as dialogController,
|
|
934
|
+
ke as isAllSelectedKey,
|
|
935
|
+
Pe as isSelectedKey,
|
|
936
|
+
ze as selectAllKey,
|
|
937
|
+
Me as selectKey,
|
|
938
|
+
$e as toggleAllKey,
|
|
939
|
+
Ae as toggleKey,
|
|
940
|
+
Ne as unselectAllKey,
|
|
941
|
+
We as unselectKey,
|
|
942
|
+
Ve as useDragSelect,
|
|
943
|
+
Vt as useDragSelectByMobile,
|
|
944
|
+
Nt as useDragSelectByPc,
|
|
945
|
+
kt as useSelectable,
|
|
946
|
+
Wt as useSelectableInjectors,
|
|
940
947
|
Tt as useVirtualList
|
|
941
948
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(E,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(E=typeof globalThis<"u"?globalThis:E||self,e(E.ui={},E.Vue))})(this,function(E,e){"use strict";var de;const fe=typeof window<"u";fe&&((de=window?.navigator)==null?void 0:de.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function Q(n){return typeof n=="function"?n():e.unref(n)}function pe(n,t){function o(...l){n(()=>t.apply(this,l),{fn:t,thisArg:this,args:l})}return o}function Be(n,t={}){let o,l;return i=>{const a=Q(n),u=Q(t.maxWait);if(o&&clearTimeout(o),a<=0||u!==void 0&&u<=0)return l&&(clearTimeout(l),l=null),i();u&&!l&&(l=setTimeout(()=>{o&&clearTimeout(o),l=null,i()},u)),o=setTimeout(()=>{l&&clearTimeout(l),l=null,i()},a)}}function Oe(n,t=!0,o=!0){let l=0,r,i=!0;const a=()=>{r&&(clearTimeout(r),r=void 0)};return v=>{const g=Q(n),p=Date.now()-l;if(a(),g<=0)return l=Date.now(),v();p>g&&(o||!i)?(l=Date.now(),v()):t&&(r=setTimeout(()=>{l=Date.now(),i=!0,a(),v()},g)),!o&&!r&&(r=setTimeout(()=>i=!0,g)),i=!1}}function Ce(n){return n}function De(n){return e.getCurrentScope()?(e.onScopeDispose(n),!0):!1}function he(n,t=200,o={}){return pe(Be(t,o),n)}function me(n,t=200,o=!1,l=!0){return pe(Oe(t,o,l),n)}function Re(n,t=!0){e.getCurrentInstance()?e.onMounted(n):t?n():e.nextTick(n)}function ge(n){var t;const o=Q(n);return(t=o?.$el)!=null?t:o}const Ie=fe?window:void 0;function Le(n,t=!1){const o=e.ref(),l=()=>o.value=Boolean(n());return l(),Re(l,t),o}const X=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},J="__vueuse_ssr_handlers__";X[J]=X[J]||{},X[J];var ve=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,He=Object.prototype.propertyIsEnumerable,Pe=(n,t)=>{var o={};for(var l in n)Ae.call(n,l)&&t.indexOf(l)<0&&(o[l]=n[l]);if(n!=null&&ve)for(var l of ve(n))t.indexOf(l)<0&&He.call(n,l)&&(o[l]=n[l]);return o};function Me(n,t,o={}){const l=o,{window:r=Ie}=l,i=Pe(l,["window"]);let a;const u=Le(()=>r&&"ResizeObserver"in r),v=()=>{a&&(a.disconnect(),a=void 0)},g=e.watch(()=>ge(n),d=>{v(),u.value&&r&&d&&(a=new ResizeObserver(t),a.observe(d,i))},{immediate:!0,flush:"post"}),p=()=>{v(),g()};return De(p),{isSupported:u,stop:p}}function $e(n,t={width:0,height:0},o={}){const{box:l="content-box"}=o,r=e.ref(t.width),i=e.ref(t.height);return Me(n,([a])=>{const u=l==="border-box"?a.borderBoxSize:l==="content-box"?a.contentBoxSize:a.devicePixelContentBoxSize;u?(r.value=u.reduce((v,{inlineSize:g})=>v+g,0),i.value=u.reduce((v,{blockSize:g})=>v+g,0)):(r.value=a.contentRect.width,i.value=a.contentRect.height)},o),e.watch(()=>ge(n),a=>{r.value=a?t.width:0,i.value=a?t.height:0}),{width:r,height:i}}var ye;(function(n){n.UP="UP",n.RIGHT="RIGHT",n.DOWN="DOWN",n.LEFT="LEFT",n.NONE="NONE"})(ye||(ye={}));var Fe=Object.defineProperty,Se=Object.getOwnPropertySymbols,ke=Object.prototype.hasOwnProperty,Ve=Object.prototype.propertyIsEnumerable,be=(n,t,o)=>t in n?Fe(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,je=(n,t)=>{for(var o in t||(t={}))ke.call(t,o)&&be(n,o,t[o]);if(Se)for(var o of Se(t))Ve.call(t,o)&&be(n,o,t[o]);return n};je({linear:Ce},{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 Ee(n,t){const{scrollEndHook:o,itemHeight:l,overscan:r=5}=t,i=e.ref(null),a=$e(i),u=e.ref(!0),v=he(U,100);let g;const p=e.shallowRef(n),d=e.ref(0),s=e.ref({start:0,end:10});let c=0;const b=e.ref([]),_=e.computed(()=>{let{sum:h,height:S}={sum:0,height:0};return p.value.map((R,D)=>(typeof l=="number"?S=l:S=l(D),h+=S,{height:S,sum:h}))}),w=e.computed(()=>F(s.value.start)),y=e.computed(()=>typeof l=="number"?_.value.length*l:_.value[_.value.length-1]?.sum||0),O=e.computed(()=>{let h=b.value.length-r,S=Math.max(h-c,0);return b.value.slice(S,h)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(g)),e.watch([a.width,a.height,p],([h,S])=>{(h||S)&&j()},{deep:!0}),e.watch(d,()=>{I(),v()});function I(){u.value=!1}function U(){u.value=!0,o?.()}function j(){cancelAnimationFrame(g),g=requestAnimationFrame($)}function $(){if(i.value){d.value=i.value.scrollTop,c=P();let h=A(d.value),S=h+c+r;h=h-r,h=h<0?0:h,S=S>p.value.length?p.value.length:S,s.value={start:h,end:S},b.value=p.value.slice(h,S).map((R,D)=>({data:R,index:D+h}))}}function A(h){let S=0,R=_.value.length-1,D=-1;for(;S<=R;){const B=Math.floor((S+R)/2);_.value[B].sum>=h?(D=B,R=B-1):S=B+1}return Math.max(0,D)}function P(){let h=0,S=0,R=L();for(let D=R;D<_.value.length&&(h++,S+=_.value[D].height,!(S>=a.height.value));D++);return h}function F(h){if(typeof l=="number")return h*l;let S=_.value[h];return S?S.sum-S.height:0}function k(h){return _.value[h]||{sum:0,height:0}}function L(){let h=s.value.start;return h>=r&&(h+=r),h}function z(h){if(i.value){const S=k(h);i.value.scrollTop=S.sum-S.height,$()}}const q=e.computed(()=>({style:{width:"100%",height:`${y.value}px`,pointerEvents:u.value?void 0:"none"}})),V=e.computed(()=>({style:{transform:`translate3d(0, ${w.value}px, 0)`,"will-change":"transform"}})),K={overflowY:"auto"};return{list:b,visiableList:O,getItemHeightData:k,getoffsetTopIndex:A,totalHeight:y,clientHeight:a.height,scrollTo:z,scrollTop:d,isScrollEnd:u,containerProps:{ref:i,onScroll:()=>{j()},style:K},wrapperProps:q,innerProps:V}}const Z=Symbol(),ee=Symbol(),te=Symbol(),ne=Symbol(),oe=Symbol(),le=Symbol(),re=Symbol(),ae=Symbol(),ie=Symbol();function ze(){const{voidFn:n,boolFn:t,boolRef:o,arrayRef:l}={voidFn:c=>{},boolFn:c=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},r=e.inject(ne,l),i=e.inject(te,t),a=e.inject(ae,o),u=e.inject(ee,n),v=e.inject(Z,n),g=e.inject(oe,n),p=e.inject(le,n),d=e.inject(re,n),s=e.inject(ie,n);return{selected:r,isSelected:i,isAllSelected:a,toggle:u,toggleAll:v,select:g,selectAll:p,unselect:d,unselectAll:s}}function Ke(n,t){const o=e.ref({}),l=e.computed(()=>n.value.filter(s=>o.value[s[t]])),r=e.computed(()=>l.value.length!=0&&Object.keys(o.value).length==n.value.length);function i(){n.value.forEach(s=>{o.value[s[t]]=!0})}function a(){o.value={}}function u(s){s.forEach(c=>{o.value[c[t]]||(o.value[c[t]]=!0)})}function v(s){s.forEach(c=>{o.value[c[t]]&&delete o.value[c[t]]})}function g(s){return!!o.value[s[t]]}function p(s){s.forEach(c=>{g(c)?delete o.value[c[t]]:o.value[c[t]]=!0})}function d(){r.value?a():i()}return e.provide(Z,d),e.provide(ee,p),e.provide(te,g),e.provide(ne,l),e.provide(oe,u),e.provide(le,i),e.provide(re,v),e.provide(ae,r),e.provide(ie,a),{selected:l,select:u,selectAll:i,unselect:v,unselectAll:a,toggle:p,toggleAll:d,isSelected:g,isAllSelected:r}}function se(n){return()=>{console.debug(`\u9ED8\u8BA4${n}\u65B9\u6CD5,\u9700\u8981\u81EA\u5B9A\u4E49\u751F\u6548`)}}function ce({attribute:n,selectWay:t="colum",scrollOptions:o={},getSelectMap:l=()=>({})}){const{select:r=se("\u9009\u62E9"),unselect:i=se("\u53D6\u6D88\u9009\u62E9"),unselectAll:a=se("\u53D6\u6D88\u5168\u9009")}=l();let u={};const v=e.computed(()=>me(t==="colum"?M:Y,50)),g=new Set,p=e.ref(!0),d=e.ref(),s=e.ref(!1),c=e.ref({x:0,y:0}),b=e.ref({x:0,y:0,scrollTop:0}),_=new ResizeObserver(f=>w.value=f[0].target.getBoundingClientRect()),w=e.ref({}),y=e.ref({top:0,height:0,sync(f=!1){y.value.top=d.value?.scrollTop||0,f&&(y.value.height=d.value?.scrollHeight||0)}}),O=e.computed(()=>s.value?{left:Math.min(c.value.x,b.value.x)-w.value.left,top:Math.min(c.value.y,b.value.y)-w.value.top,width:Math.abs(c.value.x-b.value.x),height:Math.abs(c.value.y-b.value.y)}:{left:0,top:0,width:0,height:0}),{margin:I=50,startSpeed:U=30,maxSpeed:j=30}=o;let $;const A=I,P=U,F=j,k=f=>f**1;let L=0;function z(f){if(cancelAnimationFrame($),L=q(f),L=Math.max(Math.min(L,F),-F),L!==0){const m=d.value;if(!m||!s.value)return;const C=y.value.height-w.value.height;let T=y.value.top+Number(L);T=Math.min(Math.max(0,T),C),m.scrollTop=T,K(),$=requestAnimationFrame(()=>z(f))}}function q(f){if(d.value){const C=w.value,T=C.bottom-f;if(T<A)return P*k(1-T/A);const H=f-C.top;if(H<A)return-P*k(1-H/A)}return 0}function V(f){const m={...O.value,right:0,bottom:0};return m.left+=w.value.left,m.top+=w.value.top-y.value.top,m.right=m.width+m.left,m.bottom=m.height+m.top,m.left<f.right&&m.right>f.left&&m.top<f.bottom&&m.bottom>f.top}function K(){y.value.sync();const{top:f,height:m}=y.value;b.value.y=Math.min(m+w.value.top,b.value.y+f-b.value.scrollTop),b.value.scrollTop=f}function h(f,m,C="dynamic-styles"){let T=document.getElementById(C);T||(T=document.createElement("style"),T.id=C,document.head.appendChild(T));const H=T.sheet.cssRules,W=H.length,at=`${f} { ${m} }`;for(let ue=0;ue<W;ue++){const xe=H[ue];if(xe.selectorText===f&&xe.style.cssText===m)return}T.sheet.insertRule(at,W)}function S(f,m){p.value=!0,s.value=!0,y.value.height?y.value.sync():y.value.sync(!0),c.value.x=f,c.value.y=m+y.value.top,b.value.x=c.value.x,b.value.y=c.value.y,d.value?.classList.add("disable-scroll-behavior"),g.clear()}function R(f,m,C){!s.value||(p.value&&t==="colum"&&!x()&&(a(),p.value=!1),C?.(),z(m),b.value.x=Math.max(f,w.value.left),b.value.y=Math.min(m+y.value.top,y.value.height+w.value.top),b.value.scrollTop=y.value.top,v.value())}function D(){s.value=!1,d.value?.classList.remove("disable-scroll-behavior")}function B(){!s.value||(L||K(),v.value())}function x(){if(!s.value)return!1;const{width:f,height:m}=O.value;return!(Math.max(f,m)>5)}function N(){x()&&a()}function M(){x()||d.value?.querySelectorAll(`[${n}]`).forEach(f=>{u[`${n}`]=f.getAttribute(`${n}`),V(f.getBoundingClientRect())?r([u]):i([u])})}function Y(){const f=[];let m=null,C=0;d.value?.querySelectorAll(`[${n}]`).forEach((T,H)=>{const W=T.getAttribute(`${n}`);f.push(W),V(T.getBoundingClientRect())?(m===null&&(m=H),m=Math.min(m,H),C=Math.max(C,H)):(u[`${n}`]=W,g.has(W)&&i([u]))});for(let T=m;T<C+1;T++)u[`${n}`]=f[T],r([u]),g.add(f[T])}function G(f){return!f?.value||(d.value=f.value,!d?.value)?!1:(_.observe(d.value),h(".disable-scroll-behavior","scroll-behavior: unset !important;"),!0)}return{init:G,dragStart:S,dragMove:R,dragEnd:D,onScroll:B,isSingleClick:x,cancelSelectAllBySingleClick:N,selectFn:v,selectRange:O,isPressing:s,containerEl:d,observer:_}}function Ne(n){const t=ce(n),{observer:o,selectRange:l}=t,{onScroll:r,dragStart:i,dragMove:a,dragEnd:u,cancelSelectAllBySingleClick:v}=t,g=e.computed(()=>({left:`${l.value.left}px`,top:`${l.value.top}px`,width:`${l.value.width}px`,height:`${l.value.height}px`})),p=e.defineComponent({render(){return e.h("div",{id:"selectBoxEl",class:"absolute z-50 bg-blue-200 opacity-50",style:g.value})}});function d(w){w.button===0&&i(w.x,w.y)}function s(w){a(w.x,w.y)}function c(w){w.composedPath().some(O=>O?.getAttribute?.(n.attribute))||v(),u()}function b(w){try{if(!t.init(w))throw"\u521D\u59CB\u5316\u5931\u8D25,Ref\u5143\u7D20\u4E0D\u6B63\u786E";if(!t.containerEl?.value)return!1;e.render(e.h(p),t.containerEl.value),t.containerEl.value?.addEventListener("scroll",r),t.containerEl.value?.addEventListener("mousedown",d),window.addEventListener("mousemove",s),window.addEventListener("mouseup",c)}catch(y){console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25",y)}}function _(){o.disconnect(),t.containerEl.value?.removeEventListener("scroll",r),t.containerEl.value?.removeEventListener("mousedown",d),window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",c)}return{init:b,unMount:_}}function We(n,t,o=600){const l=ce({...n,selectWay:"row",scrollOptions:{startSpeed:5,maxSpeed:5}}),{observer:r}=l,{onScroll:i,dragStart:a,dragMove:u,dragEnd:v,selectFn:g}=l;let p;function d(){clearTimeout(p)}function s(y){d(),p=setTimeout(()=>{const{clientX:O,clientY:I}=y.targetTouches[0];a(O,I),t?.(),g.value(),y.preventDefault()},o)}function c(y){d();const{clientX:O,clientY:I}=y.targetTouches[0];u(O,I,()=>y.preventDefault())}function b(){d(),v()}function _(y){try{if(!l.init(y))throw"\u521D\u59CB\u5316\u5931\u8D25,Ref\u5143\u7D20\u4E0D\u6B63\u786E";if(!l.containerEl?.value)return!1;l.containerEl.value?.addEventListener("scroll",i),l.containerEl.value?.addEventListener("touchstart",s),l.containerEl.value?.addEventListener("touchmove",c),window.addEventListener("touchcancel",b),window.addEventListener("touchend",b)}catch(O){console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25",O)}}function w(){r.disconnect(),l.containerEl.value?.removeEventListener("scroll",i),l.containerEl.value?.removeEventListener("touchstart",s),l.containerEl.value?.removeEventListener("touchmove",c),window.removeEventListener("touchcancel",b),window.removeEventListener("touchEnd",b)}return{init:_,unMount:w}}const we=Symbol(),Ue=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0},dialogClass:{default:""}},emits:["update:visiable"],setup(n,{emit:t}){const o=n,l=()=>{o.closeOnClickOverlay&&t("update:visiable",!1)};return e.provide(we,()=>t("update:visiable",!1)),(r,i)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[n.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:l,class:"modal absolute left-0 right-0 top-0 bottom-0 flex bg-stone-900 bg-opacity-50 z-[999]"},[e.createElementVNode("div",{onClick:i[0]||(i[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog m-auto flex flex-col",n.dialogClass])},[e.renderSlot(r.$slots,"default")],2)])):e.createCommentVNode("",!0)]),_:3}))}});function qe(n){function t(o,l){const r=document.createElement("div"),i={setup(){return()=>e.h(Ue,{visiable:!0,"onUpdate:visiable":()=>{r?.remove()},...n},{default:()=>e.h(o,l)})}};return document.body.appendChild(r),e.render(e.h(i),r),{close:()=>r?.remove()}}return{create:t}}const Qe=e.defineComponent({__name:"Toast",props:{message:null,position:null},setup(n){const t=n,o=e.ref(),l=e.ref(),r=e.ref(),i=e.computed(()=>{switch(t.position){case"top":return 10;case"middle":return 50;case"bottom":return 85}}),a=e.computed(()=>({position:"absolute",borderRadius:"10px",backgroundColor:"rgba(0, 0, 0, 0.8)",padding:"14px 19px",top:`calc(${i.value}% - ${r.value}px)`,left:`calc(50% - ${l.value}px)`})),u=e.computed(()=>({width:"fit-content",display:"flex",justifyContent:"center",alignItems:"center",color:"white",fontSize:"14px"}));return e.nextTick(()=>{l.value=o.value.offsetWidth/2,r.value=o.value.offsetHeight/2}),(v,g)=>(e.openBlock(),e.createElementBlock("div",{id:"toastWrapper",ref_key:"toastWrapper",ref:o,class:"toastWrapper",style:e.normalizeStyle([e.unref(a),{zIndex:9999}])},[e.createElementVNode("div",{style:e.normalizeStyle(e.unref(u))},[e.createElementVNode("span",null,e.toDisplayString(n.message),1)],4)],4))}}),_e={message:"\u61D2\u732B\u4E91 Yes!!!",position:"middle",duration:1500};class Ye{options;container;constructor(t){this.options=t,this.container=document.createElement("div")}present(){const t=e.h(e.h(Qe),{..._e,...this.options});e.render(t,this.container),document.body.insertBefore(this.container,document.body.firstChild);const o=this.options.duration||_e.duration;setTimeout(()=>{this.dismiss()},o)}dismiss(){this.container&&(this.container.querySelector("#toastWrapper")?.classList.add("animate-toastAnimation"),setTimeout(()=>{this.container&&(e.render(null,this.container),document.body.removeChild(this.container))},500))}}const Ge=["xlink:href","fill","color"],Xe=e.defineComponent({__name:"SvgIcon",props:{name:null,prefix:{default:"icon"},color:{default:"#FFF"},width:null,height:null},setup(n){const t=n,o=e.computed(()=>`#${t.prefix}-${t.name}`),l=e.computed(()=>({width:`${t.width??t.height}px`,height:`${t.height??t.width}px`,aspectRatio:t.width&&t.height?void 0:"1/1"}));return(r,i)=>(e.openBlock(),e.createElementBlock("svg",{"aria-hidden":"",style:e.normalizeStyle(e.unref(l))},[e.createElementVNode("use",{"xlink:href":e.unref(o),fill:n.color,color:n.color},null,8,Ge)],4))}});function Je(n){const{containerEl:t,sliderEl:o,autoHeight:l,performance:r={},maxHeightRatio:i=.9}=n,a=e.ref(!0),u=he(F,100);let v,g="";const p=e.ref(0),d=e.ref(0),s=e.ref(0),c=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),b=e.ref({clientHeight:0}),_=e.computed(()=>!!d.value),w=e.computed(()=>c.value.scrollHeight>c.value.clientHeight),y=e.computed(()=>c.value.clientHeight-b.value.clientHeight),O=e.computed(()=>c.value.scrollHeight-c.value.clientHeight),I=e.computed(()=>Math.max(c.value.clientHeight/c.value.scrollHeight,.05)),U=e.computed(()=>I.value>i?0:I.value*c.value.clientHeight),j=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${s.value}px,0)`,height:l?`${U.value}px`:void 0}));function $(B){P(),d.value=B.clientY-o.value.getBoundingClientRect().top||1,g=getComputedStyle(t.value).scrollBehavior,g==="smooth"&&(t.value.style.scrollBehavior="unset")}function A(){t.value.style.scrollBehavior=g,d.value=0,u()}function P(){a.value=!1}function F(){_.value||(a.value=!0)}function k(B){if(!_.value)return;let x=B.clientY-c.value.top-d.value;x<0?s.value=0:x>=y.value?s.value=y.value:s.value=x,t.value.scrollTo({top:s.value/y.value*O.value})}function L(){_.value||z()}function z(){cancelAnimationFrame(v),v=requestAnimationFrame(q)}function q(){t.value&&(p.value=r.scrollTop?.value??t.value.scrollTop,s.value=p.value/O.value*y.value)}function V(B){let x="addEventListener";B==="add"?x="addEventListener":x="removeEventListener",o.value?.[x]("pointerdown",$,{passive:!0}),window[x]("pointermove",k,{passive:!0}),window[x]("pointerup",A,{passive:!0})}const K=new MutationObserver(B=>{B.map(N=>N.oldValue).join().includes("height")&&h()});function h(){c.value.top=t.value?.getBoundingClientRect().top??0,c.value.scrollHeight=t.value?.scrollHeight??0,c.value.clientHeight=t.value?.clientHeight??0}function S(){P(),setTimeout(()=>{b.value.clientHeight=o.value?.clientHeight??0,F()},150)}function R(B,x,N="dynamic-styles"){let M=document.getElementById(N);M||(M=document.createElement("style"),M.id=N,document.head.appendChild(M));const Y=M.sheet.cssRules,G=Y.length,f=`${B} { ${x} }`;for(let m=0;m<G;m++){const C=Y[m];if(C.selectorText===B&&C.style.cssText===x)return}M.sheet.insertRule(f,G)}function D(){t.value&&o.value?(R(".hide-scrollbar","scrollbar-width: none; -ms-overflow-style: none;"),R(".hide-scrollbar::-webkit-scrollbar","display: none"),t.value.addEventListener("scroll",L,{passive:!0}),V("add"),K.observe(t.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{h()},100),S()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:t,sliderEl:o})}return e.watch(p,()=>{P(),u()}),{isScrollEnd:a,isDragSlider:_,offsetTop:s,scrollTop:p,scrollable:w,sliderPos:j,init:D,modifySliderEventListener:V}}const Ze=(n=>(e.pushScopeId("data-v-edec7292"),n=n(),e.popScopeId(),n))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),et=e.defineComponent({__name:"ScrollBar",props:{containerEl:null,autoHide:{type:Boolean},autoHeight:{type:Boolean},performance:null},setup(n,{expose:t}){const o=n,l=!!e.useSlots().default,r=e.ref(null),i=e.computed(()=>o.containerEl),a=Je({containerEl:i,sliderEl:r,autoHeight:l?o.autoHeight:!0,performance:o.performance}),{scrollable:u,isScrollEnd:v,sliderPos:g}=a,p=e.ref(!1),d=o.autoHide?e.computed(()=>p.value||!v.value):e.computed(()=>u.value);e.onMounted(()=>{e.nextTick(()=>{a.init()})}),e.onUnmounted(()=>{a.modifySliderEventListener("remove")});function s(){p.value=!0}function c(){p.value=!1}return t({uScrollBarReturn:a}),(b,_)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"sliderRef",ref:r,class:"slider-wrapper",onMouseenter:s,onMouseleave:c,style:e.normalizeStyle(e.unref(g))},[e.renderSlot(b.$slots,"default",{},()=>[Ze],!0)],36),[[e.vShow,e.unref(d)]])]),_:3}))}}),ct="",Te=(n,t)=>{const o=n.__vccOpts||n;for(const[l,r]of t)o[l]=r;return o},tt=Te(et,[["__scopeId","data-v-edec7292"]]),nt={class:"virtualListWrapper"},ot={inheritAttrs:!1},lt=e.defineComponent({...ot,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},emits:["scrollEnd"],setup(n,{expose:t,emit:o}){const l=n,r=Ee(e.toRef(l,"data"),{itemHeight:p=>l.itemHeight(l.data[p]),overscan:l.overscan,scrollEndHook:()=>{o("scrollEnd")}}),{list:i,containerProps:a,wrapperProps:u,innerProps:v,getItemHeightData:g}=r;return t({vListReturn:r}),(p,d)=>(e.openBlock(),e.createElementBlock("div",nt,[e.createElementVNode("div",e.mergeProps({onScrollPassive:d[0]||(d[0]=(...s)=>e.unref(a).onScroll&&e.unref(a).onScroll(...s)),ref:e.unref(a).ref,class:"virtualList"},p.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(u))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(v))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i),({index:s,data:c})=>(e.openBlock(),e.createElementBlock("div",{key:s,style:e.normalizeStyle({height:`${e.unref(g)(s).height}px`,display:"flex"})},[e.renderSlot(p.$slots,"default",{data:c,index:s},void 0,!0)],4))),128))],16)],16)],16)]))}}),ut="",rt=Te(lt,[["__scopeId","data-v-4ba97cce"]]);E.ScrollBar=tt,E.SvgIcon=Xe,E.ToastCreator=Ye,E.VirtualList=rt,E.allSelectedKey=ne,E.closeDialogKey=we,E.dialogController=qe,E.isAllSelectedKey=ae,E.isSelectedKey=te,E.selectAllKey=le,E.selectKey=oe,E.toggleAllKey=Z,E.toggleKey=ee,E.unselectAllKey=ie,E.unselectKey=re,E.useDragSelect=ce,E.useDragSelectByMobile=We,E.useDragSelectByPc=Ne,E.useSelectable=Ke,E.useSelectableInjectors=ze,E.useVirtualList=Ee,Object.defineProperties(E,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(E,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(E=typeof globalThis<"u"?globalThis:E||self,e(E.ui={},E.Vue))})(this,function(E,e){"use strict";var fe;const pe=typeof window<"u";pe&&((fe=window?.navigator)==null?void 0:fe.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function Q(n){return typeof n=="function"?n():e.unref(n)}function he(n,t){function o(...l){n(()=>t.apply(this,l),{fn:t,thisArg:this,args:l})}return o}function Be(n,t={}){let o,l;return i=>{const a=Q(n),u=Q(t.maxWait);if(o&&clearTimeout(o),a<=0||u!==void 0&&u<=0)return l&&(clearTimeout(l),l=null),i();u&&!l&&(l=setTimeout(()=>{o&&clearTimeout(o),l=null,i()},u)),o=setTimeout(()=>{l&&clearTimeout(l),l=null,i()},a)}}function Oe(n,t=!0,o=!0){let l=0,r,i=!0;const a=()=>{r&&(clearTimeout(r),r=void 0)};return g=>{const v=Q(n),p=Date.now()-l;if(a(),v<=0)return l=Date.now(),g();p>v&&(o||!i)?(l=Date.now(),g()):t&&(r=setTimeout(()=>{l=Date.now(),i=!0,a(),g()},v)),!o&&!r&&(r=setTimeout(()=>i=!0,v)),i=!1}}function Ce(n){return n}function De(n){return e.getCurrentScope()?(e.onScopeDispose(n),!0):!1}function me(n,t=200,o={}){return he(Be(t,o),n)}function ve(n,t=200,o=!1,l=!0){return he(Oe(t,o,l),n)}function Re(n,t=!0){e.getCurrentInstance()?e.onMounted(n):t?n():e.nextTick(n)}function ge(n){var t;const o=Q(n);return(t=o?.$el)!=null?t:o}const Ie=pe?window:void 0;function Le(n,t=!1){const o=e.ref(),l=()=>o.value=Boolean(n());return l(),Re(l,t),o}const J=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Z="__vueuse_ssr_handlers__";J[Z]=J[Z]||{},J[Z];var ye=Object.getOwnPropertySymbols,He=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,Pe=(n,t)=>{var o={};for(var l in n)He.call(n,l)&&t.indexOf(l)<0&&(o[l]=n[l]);if(n!=null&&ye)for(var l of ye(n))t.indexOf(l)<0&&Ae.call(n,l)&&(o[l]=n[l]);return o};function Me(n,t,o={}){const l=o,{window:r=Ie}=l,i=Pe(l,["window"]);let a;const u=Le(()=>r&&"ResizeObserver"in r),g=()=>{a&&(a.disconnect(),a=void 0)},v=e.watch(()=>ge(n),d=>{g(),u.value&&r&&d&&(a=new ResizeObserver(t),a.observe(d,i))},{immediate:!0,flush:"post"}),p=()=>{g(),v()};return De(p),{isSupported:u,stop:p}}function $e(n,t={width:0,height:0},o={}){const{box:l="content-box"}=o,r=e.ref(t.width),i=e.ref(t.height);return Me(n,([a])=>{const u=l==="border-box"?a.borderBoxSize:l==="content-box"?a.contentBoxSize:a.devicePixelContentBoxSize;u?(r.value=u.reduce((g,{inlineSize:v})=>g+v,0),i.value=u.reduce((g,{blockSize:v})=>g+v,0)):(r.value=a.contentRect.width,i.value=a.contentRect.height)},o),e.watch(()=>ge(n),a=>{r.value=a?t.width:0,i.value=a?t.height:0}),{width:r,height:i}}var Se;(function(n){n.UP="UP",n.RIGHT="RIGHT",n.DOWN="DOWN",n.LEFT="LEFT",n.NONE="NONE"})(Se||(Se={}));var Fe=Object.defineProperty,be=Object.getOwnPropertySymbols,ke=Object.prototype.hasOwnProperty,Ve=Object.prototype.propertyIsEnumerable,Ee=(n,t,o)=>t in n?Fe(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,je=(n,t)=>{for(var o in t||(t={}))ke.call(t,o)&&Ee(n,o,t[o]);if(be)for(var o of be(t))Ve.call(t,o)&&Ee(n,o,t[o]);return n};je({linear:Ce},{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 _e(n,t){const{scrollEndHook:o,itemHeight:l,overscan:r=5}=t,i=e.ref(null),a=$e(i),u=e.ref(!0),g=me(U,100);let v;const p=e.shallowRef(n),d=e.ref(0),s=e.ref({start:0,end:10});let c=0;const b=e.ref([]),w=e.computed(()=>{let{sum:h,height:S}={sum:0,height:0};return p.value.map((R,D)=>(typeof l=="number"?S=l:S=l(D),h+=S,{height:S,sum:h}))}),_=e.computed(()=>F(s.value.start)),y=e.computed(()=>typeof l=="number"?w.value.length*l:w.value[w.value.length-1]?.sum||0),O=e.computed(()=>{let h=b.value.length-r,S=Math.max(h-c,0);return b.value.slice(S,h)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(v)),e.watch([a.width,a.height,p],([h,S])=>{(h||S)&&j()},{deep:!0}),e.watch(d,()=>{I(),g()});function I(){u.value=!1}function U(){u.value=!0,o?.()}function j(){cancelAnimationFrame(v),v=requestAnimationFrame($)}function $(){if(i.value){d.value=i.value.scrollTop,c=P();let h=H(d.value),S=h+c+r;h=h-r,h=h<0?0:h,S=S>p.value.length?p.value.length:S,s.value={start:h,end:S},b.value=p.value.slice(h,S).map((R,D)=>({data:R,index:D+h}))}}function H(h){let S=0,R=w.value.length-1,D=-1;for(;S<=R;){const B=Math.floor((S+R)/2);w.value[B].sum>=h?(D=B,R=B-1):S=B+1}return Math.max(0,D)}function P(){let h=0,S=0,R=L();for(let D=R;D<w.value.length&&(h++,S+=w.value[D].height,!(S>=a.height.value));D++);return h}function F(h){if(typeof l=="number")return h*l;let S=w.value[h];return S?S.sum-S.height:0}function k(h){return w.value[h]||{sum:0,height:0}}function L(){let h=s.value.start;return h>=r&&(h+=r),h}function K(h){if(i.value){const S=k(h);i.value.scrollTop=S.sum-S.height,$()}}const q=e.computed(()=>({style:{width:"100%",height:`${y.value}px`,pointerEvents:u.value?void 0:"none"}})),V=e.computed(()=>({style:{transform:`translate3d(0, ${_.value}px, 0)`,"will-change":"transform"}})),N={overflowY:"auto"};return{list:b,visiableList:O,getItemHeightData:k,getoffsetTopIndex:H,totalHeight:y,clientHeight:a.height,scrollTo:K,scrollTop:d,isScrollEnd:u,containerProps:{ref:i,onScroll:()=>{j()},style:N},wrapperProps:q,innerProps:V}}const ee=Symbol(),te=Symbol(),ne=Symbol(),oe=Symbol(),le=Symbol(),re=Symbol(),ae=Symbol(),ie=Symbol(),se=Symbol();function Ke(){const{voidFn:n,boolFn:t,boolRef:o,arrayRef:l}={voidFn:c=>{},boolFn:c=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},r=e.inject(oe,l),i=e.inject(ne,t),a=e.inject(ie,o),u=e.inject(te,n),g=e.inject(ee,n),v=e.inject(le,n),p=e.inject(re,n),d=e.inject(ae,n),s=e.inject(se,n);return{selected:r,isSelected:i,isAllSelected:a,toggle:u,toggleAll:g,select:v,selectAll:p,unselect:d,unselectAll:s}}function Ne(n,t){const o=e.ref({}),l=e.computed(()=>n.value.filter(s=>o.value[s[t]])),r=e.computed(()=>l.value.length!=0&&Object.keys(o.value).length==n.value.length);function i(){n.value.forEach(s=>{o.value[s[t]]=!0})}function a(){o.value={}}function u(s){s.forEach(c=>{o.value[c[t]]||(o.value[c[t]]=!0)})}function g(s){s.forEach(c=>{o.value[c[t]]&&delete o.value[c[t]]})}function v(s){return!!o.value[s[t]]}function p(s){s.forEach(c=>{v(c)?delete o.value[c[t]]:o.value[c[t]]=!0})}function d(){r.value?a():i()}return e.provide(ee,d),e.provide(te,p),e.provide(ne,v),e.provide(oe,l),e.provide(le,u),e.provide(re,i),e.provide(ae,g),e.provide(ie,r),e.provide(se,a),{selected:l,select:u,selectAll:i,unselect:g,unselectAll:a,toggle:p,toggleAll:d,isSelected:v,isAllSelected:r}}function ce(n){return()=>{console.debug(`\u9ED8\u8BA4${n}\u65B9\u6CD5,\u9700\u8981\u81EA\u5B9A\u4E49\u751F\u6548`)}}function ue({attribute:n,selectWay:t="colum",scrollOptions:o={},getSelectMap:l=()=>({})}){const{select:r=ce("\u9009\u62E9"),unselect:i=ce("\u53D6\u6D88\u9009\u62E9"),unselectAll:a=ce("\u53D6\u6D88\u5168\u9009")}=l();let u={};const g=e.computed(()=>ve(t==="colum"?M:G,50)),v=new Set,p=e.ref(!0),d=e.ref(),s=e.ref(!1),c=e.ref({x:0,y:0}),b=e.ref({x:0,y:0,scrollTop:0}),w=new ResizeObserver(f=>_.value=f[0].target.getBoundingClientRect()),_=e.ref({}),y=e.ref({top:0,height:0,sync(f=!1){y.value.top=d.value?.scrollTop||0,f&&(y.value.height=d.value?.scrollHeight||0)}}),O=e.computed(()=>s.value?{left:Math.min(c.value.x,b.value.x)-_.value.left,top:Math.min(c.value.y,b.value.y)-_.value.top,width:Math.abs(c.value.x-b.value.x),height:Math.abs(c.value.y-b.value.y)}:{left:0,top:0,width:0,height:0}),{margin:I=50,startSpeed:U=30,maxSpeed:j=30}=o;let $;const H=I,P=U,F=j,k=f=>f**1;let L=0;function K(f){if(cancelAnimationFrame($),L=q(f),L=Math.max(Math.min(L,F),-F),L!==0){const m=d.value;if(!m||!s.value)return;const C=y.value.height-_.value.height;let T=y.value.top+Number(L);T=Math.min(Math.max(0,T),C),m.scrollTop=T,N(),$=requestAnimationFrame(()=>K(f))}}function q(f){if(d.value){const C=_.value,T=C.bottom-f;if(T<H)return P*k(1-T/H);const A=f-C.top;if(A<H)return-P*k(1-A/H)}return 0}function V(f){const m={...O.value,right:0,bottom:0};return m.left+=_.value.left,m.top+=_.value.top-y.value.top,m.right=m.width+m.left,m.bottom=m.height+m.top,m.left<f.right&&m.right>f.left&&m.top<f.bottom&&m.bottom>f.top}function N(){y.value.sync();const{top:f,height:m}=y.value;b.value.y=Math.min(m+_.value.top,b.value.y+f-b.value.scrollTop),b.value.scrollTop=f}function h(f,m,C="dynamic-styles"){let T=document.getElementById(C);T||(T=document.createElement("style"),T.id=C,document.head.appendChild(T));const A=T.sheet.cssRules,W=A.length,st=`${f} { ${m} }`;for(let de=0;de<W;de++){const xe=A[de];if(xe.selectorText===f&&xe.style.cssText===m)return}T.sheet.insertRule(st,W)}function S(f,m){p.value=!0,s.value=!0,y.value.height?y.value.sync():y.value.sync(!0),c.value.x=f,c.value.y=m+y.value.top,b.value.x=c.value.x,b.value.y=c.value.y,d.value?.classList.add("disable-scroll-behavior"),v.clear()}function R(f,m,C){!s.value||(p.value&&t==="colum"&&!x()&&(a(),p.value=!1),C?.(),K(m),b.value.x=Math.max(f,_.value.left),b.value.y=Math.min(m+y.value.top,y.value.height+_.value.top),b.value.scrollTop=y.value.top,g.value())}function D(){s.value=!1,d.value?.classList.remove("disable-scroll-behavior")}function B(){!s.value||(L||N(),g.value())}function x(){if(!s.value)return!1;const{width:f,height:m}=O.value;return!(Math.max(f,m)>5)}function z(){x()&&a()}function M(){x()||d.value?.querySelectorAll(`[${n}]`).forEach(f=>{u[`${n}`]=f.getAttribute(`${n}`),V(f.getBoundingClientRect())?r([u]):i([u])})}function G(){const f=[];let m=null,C=0;d.value?.querySelectorAll(`[${n}]`).forEach((T,A)=>{const W=T.getAttribute(`${n}`);f.push(W),V(T.getBoundingClientRect())?(m===null&&(m=A),m=Math.min(m,A),C=Math.max(C,A)):(u[`${n}`]=W,v.has(W)&&i([u]))});for(let T=m;T<C+1;T++)u[`${n}`]=f[T],r([u]),v.add(f[T])}function X(f){return!f?.value||(d.value=f.value,!d?.value)?!1:(w.observe(d.value),h(".disable-scroll-behavior","scroll-behavior: unset !important;"),!0)}return{init:X,dragStart:S,dragMove:R,dragEnd:D,onScroll:B,isSingleClick:x,cancelSelectAllBySingleClick:z,selectFn:g,selectRange:O,isPressing:s,containerEl:d,observer:w}}function ze(n){const t=ue(n),{observer:o,selectRange:l}=t,{onScroll:r,dragStart:i,dragMove:a,dragEnd:u,cancelSelectAllBySingleClick:g}=t,v=e.computed(()=>({left:`${l.value.left}px`,top:`${l.value.top}px`,width:`${l.value.width}px`,height:`${l.value.height}px`})),p=e.defineComponent({render(){return e.h("div",{id:"selectBoxEl",class:"absolute z-50 bg-blue-200 opacity-50",style:v.value})}});function d(_){_.button===0&&i(_.x,_.y)}function s(_){a(_.x,_.y)}function c(_){_.composedPath().some(O=>O?.getAttribute?.(n.attribute))||g(),u()}function b(_){try{if(!t.init(_))throw"\u521D\u59CB\u5316\u5931\u8D25,Ref\u5143\u7D20\u4E0D\u6B63\u786E";if(!t.containerEl?.value)return!1;e.render(e.h(p),t.containerEl.value),t.containerEl.value?.addEventListener("scroll",r),t.containerEl.value?.addEventListener("mousedown",d),window.addEventListener("mousemove",s),window.addEventListener("mouseup",c)}catch(y){console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25",y)}}function w(){o.disconnect(),t.containerEl.value?.removeEventListener("scroll",r),t.containerEl.value?.removeEventListener("mousedown",d),window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",c)}return{init:b,unMount:w}}function We(n,t,o=600){const l=ue({...n,selectWay:"row",scrollOptions:{startSpeed:5,maxSpeed:5}}),{observer:r}=l,{onScroll:i,dragStart:a,dragMove:u,dragEnd:g,selectFn:v}=l;let p;function d(){clearTimeout(p)}function s(y){d(),p=setTimeout(()=>{const{clientX:O,clientY:I}=y.targetTouches[0];a(O,I),t?.(),v.value(),y.preventDefault()},o)}function c(y){d();const{clientX:O,clientY:I}=y.targetTouches[0];u(O,I,()=>y.preventDefault())}function b(){d(),g()}function w(y){try{if(!l.init(y))throw"\u521D\u59CB\u5316\u5931\u8D25,Ref\u5143\u7D20\u4E0D\u6B63\u786E";if(!l.containerEl?.value)return!1;l.containerEl.value?.addEventListener("scroll",i),l.containerEl.value?.addEventListener("touchstart",s),l.containerEl.value?.addEventListener("touchmove",c),window.addEventListener("touchcancel",b),window.addEventListener("touchend",b)}catch(O){console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25",O)}}function _(){r.disconnect(),l.containerEl.value?.removeEventListener("scroll",i),l.containerEl.value?.removeEventListener("touchstart",s),l.containerEl.value?.removeEventListener("touchmove",c),window.removeEventListener("touchcancel",b),window.removeEventListener("touchEnd",b)}return{init:w,unMount:_}}const we=Symbol(),Ue=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0},dialogClass:{default:""}},emits:["update:visiable"],setup(n,{emit:t}){const o=n,l=()=>{o.closeOnClickOverlay&&t("update:visiable",!1)};return e.provide(we,()=>t("update:visiable",!1)),(r,i)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[n.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:l,class:"modal"},[e.createElementVNode("div",{onClick:i[0]||(i[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog",n.dialogClass])},[e.renderSlot(r.$slots,"default",{},void 0,!0)],2)])):e.createCommentVNode("",!0)]),_:3}))}}),ut="",Y=(n,t)=>{const o=n.__vccOpts||n;for(const[l,r]of t)o[l]=r;return o},qe=Y(Ue,[["__scopeId","data-v-415900d3"]]);function Qe(n){function t(o,l){const r=document.createElement("div"),i={setup(){return()=>e.h(qe,{visiable:!0,"onUpdate:visiable":()=>{r?.remove()},...n},{default:()=>e.h(o,l)})}};return document.body.appendChild(r),e.render(e.h(i),r),{close:()=>r?.remove()}}return{create:t}}const Ye=e.defineComponent({__name:"Toast",props:{message:null,position:null},setup(n){const t=n,o=e.ref(),l=e.ref(),r=e.ref(),i=e.computed(()=>{switch(t.position){case"top":return 10;case"middle":return 50;case"bottom":return 85}}),a=e.computed(()=>({position:"absolute",borderRadius:"10px",backgroundColor:"rgba(0, 0, 0, 0.8)",padding:"14px 19px",top:`calc(${i.value}% - ${r.value}px)`,left:`calc(50% - ${l.value}px)`})),u=e.computed(()=>({width:"fit-content",display:"flex",justifyContent:"center",alignItems:"center",color:"white",fontSize:"14px"}));return e.nextTick(()=>{l.value=o.value.offsetWidth/2,r.value=o.value.offsetHeight/2}),(g,v)=>(e.openBlock(),e.createElementBlock("div",{id:"toastWrapper",ref_key:"toastWrapper",ref:o,class:"toastWrapper",style:e.normalizeStyle([e.unref(a),{zIndex:9999}])},[e.createElementVNode("div",{style:e.normalizeStyle(e.unref(u))},[e.createElementVNode("span",null,e.toDisplayString(n.message),1)],4)],4))}}),dt="",Ge=Y(Ye,[["__scopeId","data-v-15ab4094"]]),Te={message:"\u61D2\u732B\u4E91 Yes!!!",position:"middle",duration:1500};class Xe{options;container;constructor(t){this.options=t,this.container=document.createElement("div")}present(){const t=e.h(e.h(Ge),{...Te,...this.options});e.render(t,this.container),document.body.insertBefore(this.container,document.body.firstChild);const o=this.options.duration||Te.duration;setTimeout(()=>{this.dismiss()},o)}dismiss(){if(this.container){const t=this.container.querySelector("#toastWrapper");t.style.opacity="0",t.style.transition="opacity 0.4s ease-in",setTimeout(()=>{this.container&&(e.render(null,this.container),document.body.removeChild(this.container))},500)}}}const Je=["xlink:href","fill","color"],Ze=e.defineComponent({__name:"SvgIcon",props:{name:null,prefix:{default:"icon"},color:{default:"#FFF"},width:null,height:null},setup(n){const t=n,o=e.computed(()=>`#${t.prefix}-${t.name}`),l=e.computed(()=>({width:`${t.width??t.height}px`,height:`${t.height??t.width}px`,aspectRatio:t.width&&t.height?void 0:"1/1"}));return(r,i)=>(e.openBlock(),e.createElementBlock("svg",{"aria-hidden":"",style:e.normalizeStyle(e.unref(l))},[e.createElementVNode("use",{"xlink:href":e.unref(o),fill:n.color,color:n.color},null,8,Je)],4))}});function et(n){const{containerEl:t,sliderEl:o,autoHeight:l,performance:r={},maxHeightRatio:i=.9}=n,a=e.ref(!0),u=me(F,100);let g,v="";const p=e.ref(0),d=e.ref(0),s=e.ref(0),c=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),b=e.ref({clientHeight:0}),w=e.computed(()=>!!d.value),_=e.computed(()=>c.value.scrollHeight>c.value.clientHeight),y=e.computed(()=>c.value.clientHeight-b.value.clientHeight),O=e.computed(()=>c.value.scrollHeight-c.value.clientHeight),I=e.computed(()=>Math.max(c.value.clientHeight/c.value.scrollHeight,.05)),U=e.computed(()=>I.value>i?0:I.value*c.value.clientHeight),j=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${s.value}px,0)`,height:l?`${U.value}px`:void 0}));function $(B){P(),d.value=B.clientY-o.value.getBoundingClientRect().top||1,v=getComputedStyle(t.value).scrollBehavior,v==="smooth"&&(t.value.style.scrollBehavior="unset")}function H(){t.value.style.scrollBehavior=v,d.value=0,u()}function P(){a.value=!1}function F(){w.value||(a.value=!0)}function k(B){if(!w.value)return;let x=B.clientY-c.value.top-d.value;x<0?s.value=0:x>=y.value?s.value=y.value:s.value=x,t.value.scrollTo({top:s.value/y.value*O.value})}function L(){w.value||K()}function K(){cancelAnimationFrame(g),g=requestAnimationFrame(q)}function q(){t.value&&(p.value=r.scrollTop?.value??t.value.scrollTop,s.value=p.value/O.value*y.value)}function V(B){let x="addEventListener";B==="add"?x="addEventListener":x="removeEventListener",o.value?.[x]("pointerdown",$,{passive:!0}),window[x]("pointermove",k,{passive:!0}),window[x]("pointerup",H,{passive:!0})}const N=new MutationObserver(B=>{B.map(z=>z.oldValue).join().includes("height")&&h()});function h(){c.value.top=t.value?.getBoundingClientRect().top??0,c.value.scrollHeight=t.value?.scrollHeight??0,c.value.clientHeight=t.value?.clientHeight??0}function S(){P(),setTimeout(()=>{b.value.clientHeight=o.value?.clientHeight??0,F()},150)}function R(B,x,z="dynamic-styles"){let M=document.getElementById(z);M||(M=document.createElement("style"),M.id=z,document.head.appendChild(M));const G=M.sheet.cssRules,X=G.length,f=`${B} { ${x} }`;for(let m=0;m<X;m++){const C=G[m];if(C.selectorText===B&&C.style.cssText===x)return}M.sheet.insertRule(f,X)}function D(){t.value&&o.value?(R(".hide-scrollbar","scrollbar-width: none; -ms-overflow-style: none;"),R(".hide-scrollbar::-webkit-scrollbar","display: none"),t.value.addEventListener("scroll",L,{passive:!0}),V("add"),N.observe(t.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{h()},100),S()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:t,sliderEl:o})}return e.watch(p,()=>{P(),u()}),{isScrollEnd:a,isDragSlider:w,offsetTop:s,scrollTop:p,scrollable:_,sliderPos:j,init:D,modifySliderEventListener:V}}const tt=(n=>(e.pushScopeId("data-v-edec7292"),n=n(),e.popScopeId(),n))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),nt=e.defineComponent({__name:"ScrollBar",props:{containerEl:null,autoHide:{type:Boolean},autoHeight:{type:Boolean},performance:null},setup(n,{expose:t}){const o=n,l=!!e.useSlots().default,r=e.ref(null),i=e.computed(()=>o.containerEl),a=et({containerEl:i,sliderEl:r,autoHeight:l?o.autoHeight:!0,performance:o.performance}),{scrollable:u,isScrollEnd:g,sliderPos:v}=a,p=e.ref(!1),d=o.autoHide?e.computed(()=>p.value||!g.value):e.computed(()=>u.value);e.onMounted(()=>{e.nextTick(()=>{a.init()})}),e.onUnmounted(()=>{a.modifySliderEventListener("remove")});function s(){p.value=!0}function c(){p.value=!1}return t({uScrollBarReturn:a}),(b,w)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"sliderRef",ref:r,class:"slider-wrapper",onMouseenter:s,onMouseleave:c,style:e.normalizeStyle(e.unref(v))},[e.renderSlot(b.$slots,"default",{},()=>[tt],!0)],36),[[e.vShow,e.unref(d)]])]),_:3}))}}),pt="",ot=Y(nt,[["__scopeId","data-v-edec7292"]]),lt={class:"virtualListWrapper"},rt={inheritAttrs:!1},at=e.defineComponent({...rt,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},emits:["scrollEnd"],setup(n,{expose:t,emit:o}){const l=n,r=_e(e.toRef(l,"data"),{itemHeight:p=>l.itemHeight(l.data[p]),overscan:l.overscan,scrollEndHook:()=>{o("scrollEnd")}}),{list:i,containerProps:a,wrapperProps:u,innerProps:g,getItemHeightData:v}=r;return t({vListReturn:r}),(p,d)=>(e.openBlock(),e.createElementBlock("div",lt,[e.createElementVNode("div",e.mergeProps({onScrollPassive:d[0]||(d[0]=(...s)=>e.unref(a).onScroll&&e.unref(a).onScroll(...s)),ref:e.unref(a).ref,class:"virtualList"},p.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(u))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(g))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i),({index:s,data:c})=>(e.openBlock(),e.createElementBlock("div",{key:s,style:e.normalizeStyle({height:`${e.unref(v)(s).height}px`,display:"flex"})},[e.renderSlot(p.$slots,"default",{data:c,index:s},void 0,!0)],4))),128))],16)],16)],16)]))}}),ht="",it=Y(at,[["__scopeId","data-v-4ba97cce"]]);E.ScrollBar=ot,E.SvgIcon=Ze,E.ToastCreator=Xe,E.VirtualList=it,E.allSelectedKey=oe,E.closeDialogKey=we,E.dialogController=Qe,E.isAllSelectedKey=ie,E.isSelectedKey=ne,E.selectAllKey=re,E.selectKey=le,E.toggleAllKey=ee,E.toggleKey=te,E.unselectAllKey=se,E.unselectKey=ae,E.useDragSelect=ue,E.useDragSelectByMobile=We,E.useDragSelectByPc=ze,E.useSelectable=Ne,E.useSelectableInjectors=Ke,E.useVirtualList=_e,Object.defineProperties(E,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.v-leave-active[data-v-edec7292]{transition:all .15s ease-out;transition-delay:.9s}.v-leave-to[data-v-edec7292]{opacity:0}.slider-wrapper[data-v-edec7292]{z-index:100;position:absolute;right:0;touch-action:none}.default-slider[data-v-edec7292]{width:6px;height:100%;background-color:#0003;border-radius:3px;margin-right:3px}.virtualList[data-v-4ba97cce]{width:100%;height:100%;position:absolute;overflow-y:auto;scroll-behavior:smooth;user-select:none}.virtualListWrapper[data-v-4ba97cce]{width:100%;height:100%;position:relative}
|
|
1
|
+
.modal[data-v-415900d3]{position:absolute;inset:0;display:flex;z-index:999;background-color:#1c191780}.dialog[data-v-415900d3]{margin:auto;display:flex;flex-direction:column}@keyframes slide-15ab4094{0%{opacity:1}to{opacity:0}}.animate-toastAnimation[data-v-15ab4094]{animation:slide-15ab4094 .3s linear}.v-leave-active[data-v-edec7292]{transition:all .15s ease-out;transition-delay:.9s}.v-leave-to[data-v-edec7292]{opacity:0}.slider-wrapper[data-v-edec7292]{z-index:100;position:absolute;right:0;touch-action:none}.default-slider[data-v-edec7292]{width:6px;height:100%;background-color:#0003;border-radius:3px;margin-right:3px}.virtualList[data-v-4ba97cce]{width:100%;height:100%;position:absolute;overflow-y:auto;scroll-behavior:smooth;user-select:none}.virtualListWrapper[data-v-4ba97cce]{width:100%;height:100%;position:relative}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lazycatcloud/lzc-toolkit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.54",
|
|
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
|
+
}
|