@lazycatcloud/lzc-toolkit 0.0.54 → 0.0.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +275 -275
- package/dist/index.umd.js +1 -1
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,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
|
|
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 P, provide as H, defineComponent as Z, h as K, render as ae, openBlock as W, createBlock as De, Transition as Re, withCtx as Ce, createElementBlock as J, createElementVNode as F, 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
2
|
var be;
|
|
3
3
|
const Be = typeof window < "u";
|
|
4
4
|
Be && ((be = window?.navigator) == null ? void 0 : be.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
@@ -29,13 +29,13 @@ function it(t, e = !0, n = !0) {
|
|
|
29
29
|
const r = () => {
|
|
30
30
|
o && (clearTimeout(o), o = void 0);
|
|
31
31
|
};
|
|
32
|
-
return (
|
|
33
|
-
const
|
|
34
|
-
if (r(),
|
|
35
|
-
return l = Date.now(),
|
|
36
|
-
d >
|
|
37
|
-
l = Date.now(), a = !0, r(),
|
|
38
|
-
},
|
|
32
|
+
return (g) => {
|
|
33
|
+
const f = se(t), d = Date.now() - l;
|
|
34
|
+
if (r(), f <= 0)
|
|
35
|
+
return l = Date.now(), g();
|
|
36
|
+
d > f && (n || !a) ? (l = Date.now(), g()) : e && (o = setTimeout(() => {
|
|
37
|
+
l = Date.now(), a = !0, r(), g();
|
|
38
|
+
}, f)), !n && !o && (o = setTimeout(() => a = !0, f)), a = !1;
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
function ct(t) {
|
|
@@ -78,12 +78,12 @@ var _e = Object.getOwnPropertySymbols, ht = Object.prototype.hasOwnProperty, mt
|
|
|
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 = pt(() => o && "ResizeObserver" in o),
|
|
81
|
+
const i = pt(() => o && "ResizeObserver" in o), g = () => {
|
|
82
82
|
r && (r.disconnect(), r = void 0);
|
|
83
|
-
},
|
|
84
|
-
|
|
83
|
+
}, f = ne(() => He(t), (c) => {
|
|
84
|
+
g(), i.value && o && c && (r = new ResizeObserver(e), r.observe(c, a));
|
|
85
85
|
}, { immediate: !0, flush: "post" }), d = () => {
|
|
86
|
-
|
|
86
|
+
g(), f();
|
|
87
87
|
};
|
|
88
88
|
return vt(d), {
|
|
89
89
|
isSupported: i,
|
|
@@ -94,7 +94,7 @@ function bt(t, e = { width: 0, height: 0 }, n = {}) {
|
|
|
94
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((
|
|
97
|
+
i ? (o.value = i.reduce((g, { inlineSize: f }) => g + f, 0), a.value = i.reduce((g, { blockSize: f }) => g + f, 0)) : (o.value = r.contentRect.width, a.value = r.contentRect.height);
|
|
98
98
|
}, n), ne(() => He(t), (r) => {
|
|
99
99
|
o.value = r ? e.width : 0, a.value = r ? e.height : 0;
|
|
100
100
|
}), {
|
|
@@ -144,99 +144,99 @@ 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 = E(null), r = bt(a), i = E(!0),
|
|
148
|
-
let
|
|
149
|
-
const d = qe(t), c = E(0),
|
|
150
|
-
let
|
|
151
|
-
const
|
|
152
|
-
let { sum:
|
|
153
|
-
return d.value.map((I, C) => (typeof l == "number" ?
|
|
154
|
-
}),
|
|
155
|
-
let
|
|
156
|
-
return
|
|
147
|
+
const { scrollEndHook: n, itemHeight: l, overscan: o = 5 } = e, a = E(null), r = bt(a), i = E(!0), g = Le(ee, 100);
|
|
148
|
+
let f;
|
|
149
|
+
const d = qe(t), c = E(0), u = E({ start: 0, end: 10 });
|
|
150
|
+
let s = 0;
|
|
151
|
+
const _ = E([]), w = S(() => {
|
|
152
|
+
let { sum: p, height: b } = { sum: 0, height: 0 };
|
|
153
|
+
return d.value.map((I, C) => (typeof l == "number" ? b = l : b = l(C), p += b, { height: b, sum: p }));
|
|
154
|
+
}), m = S(() => N(u.value.start)), y = S(() => typeof l == "number" ? w.value.length * l : w.value[w.value.length - 1]?.sum || 0), R = S(() => {
|
|
155
|
+
let p = _.value.length - o, b = Math.max(p - s, 0);
|
|
156
|
+
return _.value.slice(b, p);
|
|
157
157
|
});
|
|
158
158
|
fe(() => {
|
|
159
|
-
}), Oe(() => cancelAnimationFrame(
|
|
159
|
+
}), Oe(() => cancelAnimationFrame(f)), ne(
|
|
160
160
|
[r.width, r.height, d],
|
|
161
|
-
([
|
|
162
|
-
(
|
|
161
|
+
([p, b]) => {
|
|
162
|
+
(p || b) && U();
|
|
163
163
|
},
|
|
164
164
|
{ deep: !0 }
|
|
165
165
|
), ne(c, () => {
|
|
166
|
-
|
|
166
|
+
Q(), g();
|
|
167
167
|
});
|
|
168
|
-
function
|
|
168
|
+
function Q() {
|
|
169
169
|
i.value = !1;
|
|
170
170
|
}
|
|
171
171
|
function ee() {
|
|
172
172
|
i.value = !0, n?.();
|
|
173
173
|
}
|
|
174
174
|
function U() {
|
|
175
|
-
cancelAnimationFrame(
|
|
175
|
+
cancelAnimationFrame(f), f = requestAnimationFrame(k);
|
|
176
176
|
}
|
|
177
|
-
function
|
|
177
|
+
function k() {
|
|
178
178
|
if (a.value) {
|
|
179
|
-
c.value = a.value.scrollTop,
|
|
180
|
-
let
|
|
181
|
-
|
|
179
|
+
c.value = a.value.scrollTop, s = M();
|
|
180
|
+
let p = $(c.value), b = p + s + o;
|
|
181
|
+
p = p - o, p = p < 0 ? 0 : p, b = b > d.value.length ? d.value.length : b, u.value = { start: p, end: b }, _.value = d.value.slice(p, b).map((I, C) => ({
|
|
182
182
|
data: I,
|
|
183
|
-
index: C +
|
|
183
|
+
index: C + p
|
|
184
184
|
}));
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
let
|
|
189
|
-
for (;
|
|
190
|
-
const O = Math.floor((
|
|
191
|
-
w.value[O].sum >=
|
|
187
|
+
function $(p) {
|
|
188
|
+
let b = 0, I = w.value.length - 1, C = -1;
|
|
189
|
+
for (; b <= I; ) {
|
|
190
|
+
const O = Math.floor((b + I) / 2);
|
|
191
|
+
w.value[O].sum >= p ? (C = O, I = O - 1) : b = O + 1;
|
|
192
192
|
}
|
|
193
193
|
return Math.max(0, C);
|
|
194
194
|
}
|
|
195
|
-
function
|
|
196
|
-
let
|
|
197
|
-
for (let C = I; C < w.value.length && (
|
|
195
|
+
function M() {
|
|
196
|
+
let p = 0, b = 0, I = L();
|
|
197
|
+
for (let C = I; C < w.value.length && (p++, b += w.value[C].height, !(b >= r.height.value)); C++)
|
|
198
198
|
;
|
|
199
|
-
return
|
|
199
|
+
return p;
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function N(p) {
|
|
202
202
|
if (typeof l == "number")
|
|
203
|
-
return
|
|
204
|
-
let
|
|
205
|
-
return
|
|
203
|
+
return p * l;
|
|
204
|
+
let b = w.value[p];
|
|
205
|
+
return b ? b.sum - b.height : 0;
|
|
206
206
|
}
|
|
207
|
-
function
|
|
208
|
-
return w.value[
|
|
207
|
+
function V(p) {
|
|
208
|
+
return w.value[p] || { sum: 0, height: 0 };
|
|
209
209
|
}
|
|
210
|
-
function
|
|
211
|
-
let
|
|
212
|
-
return
|
|
210
|
+
function L() {
|
|
211
|
+
let p = u.value.start;
|
|
212
|
+
return p >= o && (p += o), p;
|
|
213
213
|
}
|
|
214
|
-
function q(
|
|
214
|
+
function q(p) {
|
|
215
215
|
if (a.value) {
|
|
216
|
-
const
|
|
217
|
-
a.value.scrollTop =
|
|
216
|
+
const b = V(p);
|
|
217
|
+
a.value.scrollTop = b.sum - b.height, k();
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
const te = S(() => ({
|
|
221
221
|
style: {
|
|
222
222
|
width: "100%",
|
|
223
|
-
height: `${
|
|
223
|
+
height: `${y.value}px`,
|
|
224
224
|
pointerEvents: i.value ? void 0 : "none"
|
|
225
225
|
}
|
|
226
|
-
})),
|
|
226
|
+
})), j = S(() => ({
|
|
227
227
|
style: {
|
|
228
|
-
transform: `translate3d(0, ${
|
|
228
|
+
transform: `translate3d(0, ${m.value}px, 0)`,
|
|
229
229
|
"will-change": "transform"
|
|
230
230
|
}
|
|
231
231
|
})), Y = {
|
|
232
232
|
overflowY: "auto"
|
|
233
233
|
};
|
|
234
234
|
return {
|
|
235
|
-
list:
|
|
236
|
-
visiableList:
|
|
237
|
-
getItemHeightData:
|
|
238
|
-
getoffsetTopIndex:
|
|
239
|
-
totalHeight:
|
|
235
|
+
list: _,
|
|
236
|
+
visiableList: R,
|
|
237
|
+
getItemHeightData: V,
|
|
238
|
+
getoffsetTopIndex: $,
|
|
239
|
+
totalHeight: y,
|
|
240
240
|
clientHeight: r.height,
|
|
241
241
|
scrollTo: q,
|
|
242
242
|
scrollTop: c,
|
|
@@ -249,70 +249,70 @@ function Tt(t, e) {
|
|
|
249
249
|
style: Y
|
|
250
250
|
},
|
|
251
251
|
wrapperProps: te,
|
|
252
|
-
innerProps:
|
|
252
|
+
innerProps: j
|
|
253
253
|
};
|
|
254
254
|
}
|
|
255
255
|
const $e = Symbol(), Ae = Symbol(), Pe = Symbol(), Fe = Symbol(), Me = Symbol(), ze = Symbol(), We = Symbol(), ke = Symbol(), Ne = Symbol();
|
|
256
256
|
function Wt() {
|
|
257
257
|
const { voidFn: t, boolFn: e, boolRef: n, arrayRef: l } = {
|
|
258
|
-
voidFn: (
|
|
258
|
+
voidFn: (s) => {
|
|
259
259
|
},
|
|
260
|
-
boolFn: (
|
|
260
|
+
boolFn: (s) => !1,
|
|
261
261
|
boolRef: S(() => !1),
|
|
262
262
|
arrayRef: S(() => [])
|
|
263
|
-
}, o =
|
|
263
|
+
}, o = P(Fe, l), a = P(Pe, e), r = P(ke, n), i = P(Ae, t), g = P($e, t), f = P(Me, t), d = P(ze, t), c = P(We, t), u = P(Ne, t);
|
|
264
264
|
return {
|
|
265
265
|
selected: o,
|
|
266
266
|
isSelected: a,
|
|
267
267
|
isAllSelected: r,
|
|
268
268
|
toggle: i,
|
|
269
|
-
toggleAll:
|
|
270
|
-
select:
|
|
269
|
+
toggleAll: g,
|
|
270
|
+
select: f,
|
|
271
271
|
selectAll: d,
|
|
272
272
|
unselect: c,
|
|
273
|
-
unselectAll:
|
|
273
|
+
unselectAll: u
|
|
274
274
|
};
|
|
275
275
|
}
|
|
276
276
|
function kt(t, e) {
|
|
277
|
-
const n = E({}), l = S(() => t.value.filter((
|
|
277
|
+
const n = E({}), l = S(() => t.value.filter((u) => n.value[u[e]])), o = S(() => l.value.length != 0 && Object.keys(n.value).length == t.value.length);
|
|
278
278
|
function a() {
|
|
279
|
-
t.value.forEach((
|
|
280
|
-
n.value[
|
|
279
|
+
t.value.forEach((u) => {
|
|
280
|
+
n.value[u[e]] = !0;
|
|
281
281
|
});
|
|
282
282
|
}
|
|
283
283
|
function r() {
|
|
284
284
|
n.value = {};
|
|
285
285
|
}
|
|
286
|
-
function i(
|
|
287
|
-
|
|
288
|
-
n.value[
|
|
286
|
+
function i(u) {
|
|
287
|
+
u.forEach((s) => {
|
|
288
|
+
n.value[s[e]] || (n.value[s[e]] = !0);
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
|
-
function
|
|
292
|
-
|
|
293
|
-
n.value[
|
|
291
|
+
function g(u) {
|
|
292
|
+
u.forEach((s) => {
|
|
293
|
+
n.value[s[e]] && delete n.value[s[e]];
|
|
294
294
|
});
|
|
295
295
|
}
|
|
296
|
-
function
|
|
297
|
-
return !!n.value[
|
|
296
|
+
function f(u) {
|
|
297
|
+
return !!n.value[u[e]];
|
|
298
298
|
}
|
|
299
|
-
function d(
|
|
300
|
-
|
|
301
|
-
|
|
299
|
+
function d(u) {
|
|
300
|
+
u.forEach((s) => {
|
|
301
|
+
f(s) ? delete n.value[s[e]] : n.value[s[e]] = !0;
|
|
302
302
|
});
|
|
303
303
|
}
|
|
304
304
|
function c() {
|
|
305
305
|
o.value ? r() : a();
|
|
306
306
|
}
|
|
307
|
-
return
|
|
307
|
+
return H($e, c), H(Ae, d), H(Pe, f), H(Fe, l), H(Me, i), H(ze, a), H(We, g), H(ke, o), H(Ne, r), {
|
|
308
308
|
selected: l,
|
|
309
309
|
select: i,
|
|
310
310
|
selectAll: a,
|
|
311
|
-
unselect:
|
|
311
|
+
unselect: g,
|
|
312
312
|
unselectAll: r,
|
|
313
313
|
toggle: d,
|
|
314
314
|
toggleAll: c,
|
|
315
|
-
isSelected:
|
|
315
|
+
isSelected: f,
|
|
316
316
|
isAllSelected: o
|
|
317
317
|
};
|
|
318
318
|
}
|
|
@@ -333,128 +333,128 @@ function Ve({
|
|
|
333
333
|
unselectAll: r = ce("\u53D6\u6D88\u5168\u9009")
|
|
334
334
|
} = l();
|
|
335
335
|
let i = {};
|
|
336
|
-
const
|
|
337
|
-
() => Se(e === "colum" ?
|
|
338
|
-
),
|
|
339
|
-
(v) =>
|
|
340
|
-
),
|
|
336
|
+
const g = S(
|
|
337
|
+
() => Se(e === "colum" ? z : oe, 50)
|
|
338
|
+
), f = /* @__PURE__ */ new Set(), d = E(!0), c = E(), u = E(!1), s = E({ x: 0, y: 0 }), _ = E({ x: 0, y: 0, scrollTop: 0 }), w = new ResizeObserver(
|
|
339
|
+
(v) => m.value = v[0].target.getBoundingClientRect()
|
|
340
|
+
), m = E({}), y = E({
|
|
341
341
|
top: 0,
|
|
342
342
|
height: 0,
|
|
343
343
|
sync(v = !1) {
|
|
344
|
-
|
|
344
|
+
y.value.top = c.value?.scrollTop || 0, v && (y.value.height = c.value?.scrollHeight || 0);
|
|
345
345
|
}
|
|
346
|
-
}),
|
|
347
|
-
left: Math.min(
|
|
348
|
-
top: Math.min(
|
|
349
|
-
width: Math.abs(
|
|
350
|
-
height: Math.abs(
|
|
351
|
-
} : { left: 0, top: 0, width: 0, height: 0 }), { margin:
|
|
352
|
-
let
|
|
353
|
-
const
|
|
354
|
-
let
|
|
346
|
+
}), R = S(() => u.value ? {
|
|
347
|
+
left: Math.min(s.value.x, _.value.x) - m.value.left,
|
|
348
|
+
top: Math.min(s.value.y, _.value.y) - m.value.top,
|
|
349
|
+
width: Math.abs(s.value.x - _.value.x),
|
|
350
|
+
height: Math.abs(s.value.y - _.value.y)
|
|
351
|
+
} : { left: 0, top: 0, width: 0, height: 0 }), { margin: Q = 50, startSpeed: ee = 30, maxSpeed: U = 30 } = n;
|
|
352
|
+
let k;
|
|
353
|
+
const $ = Q, M = ee, N = U, V = (v) => v ** 1;
|
|
354
|
+
let L = 0;
|
|
355
355
|
function q(v) {
|
|
356
|
-
if (cancelAnimationFrame(
|
|
357
|
-
Math.min(
|
|
358
|
-
-
|
|
359
|
-
),
|
|
360
|
-
const
|
|
361
|
-
if (!
|
|
356
|
+
if (cancelAnimationFrame(k), L = te(v), L = Math.max(
|
|
357
|
+
Math.min(L, N),
|
|
358
|
+
-N
|
|
359
|
+
), L !== 0) {
|
|
360
|
+
const h = c.value;
|
|
361
|
+
if (!h || !u.value)
|
|
362
362
|
return;
|
|
363
|
-
const
|
|
364
|
-
let x =
|
|
365
|
-
x = Math.min(Math.max(0, x),
|
|
363
|
+
const D = y.value.height - m.value.height;
|
|
364
|
+
let x = y.value.top + Number(L);
|
|
365
|
+
x = Math.min(Math.max(0, x), D), h.scrollTop = x, Y(), k = requestAnimationFrame(() => q(v));
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
function te(v) {
|
|
369
369
|
if (c.value) {
|
|
370
|
-
const
|
|
371
|
-
if (x <
|
|
372
|
-
return
|
|
373
|
-
const
|
|
374
|
-
if (
|
|
375
|
-
return -
|
|
370
|
+
const D = m.value, x = D.bottom - v;
|
|
371
|
+
if (x < $)
|
|
372
|
+
return M * V(1 - x / $);
|
|
373
|
+
const A = v - D.top;
|
|
374
|
+
if (A < $)
|
|
375
|
+
return -M * V(1 - A / $);
|
|
376
376
|
}
|
|
377
377
|
return 0;
|
|
378
378
|
}
|
|
379
|
-
function
|
|
380
|
-
const
|
|
381
|
-
return
|
|
379
|
+
function j(v) {
|
|
380
|
+
const h = { ...R.value, right: 0, bottom: 0 };
|
|
381
|
+
return h.left += m.value.left, h.top += m.value.top - y.value.top, h.right = h.width + h.left, h.bottom = h.height + h.top, h.left < v.right && h.right > v.left && h.top < v.bottom && h.bottom > v.top;
|
|
382
382
|
}
|
|
383
383
|
function Y() {
|
|
384
|
-
|
|
385
|
-
const { top: v, height:
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
),
|
|
390
|
-
}
|
|
391
|
-
function
|
|
392
|
-
let x = document.getElementById(
|
|
393
|
-
x || (x = document.createElement("style"), x.id =
|
|
394
|
-
const
|
|
384
|
+
y.value.sync();
|
|
385
|
+
const { top: v, height: h } = y.value;
|
|
386
|
+
_.value.y = Math.min(
|
|
387
|
+
h + m.value.top,
|
|
388
|
+
_.value.y + v - _.value.scrollTop
|
|
389
|
+
), _.value.scrollTop = v;
|
|
390
|
+
}
|
|
391
|
+
function p(v, h, D = "dynamic-styles") {
|
|
392
|
+
let x = document.getElementById(D);
|
|
393
|
+
x || (x = document.createElement("style"), x.id = D, document.head.appendChild(x));
|
|
394
|
+
const A = x.sheet.cssRules, X = A.length, je = `${v} { ${h} }`;
|
|
395
395
|
for (let ie = 0; ie < X; ie++) {
|
|
396
|
-
const me =
|
|
397
|
-
if (me.selectorText === v && me.style.cssText ===
|
|
396
|
+
const me = A[ie];
|
|
397
|
+
if (me.selectorText === v && me.style.cssText === h)
|
|
398
398
|
return;
|
|
399
399
|
}
|
|
400
400
|
x.sheet.insertRule(je, X);
|
|
401
401
|
}
|
|
402
|
-
function
|
|
403
|
-
d.value = !0,
|
|
402
|
+
function b(v, h) {
|
|
403
|
+
d.value = !0, u.value = !0, y.value.height ? y.value.sync() : y.value.sync(!0), s.value.x = v, s.value.y = h + y.value.top, _.value.x = s.value.x, _.value.y = s.value.y, c.value?.classList.add("disable-scroll-behavior"), f.clear();
|
|
404
404
|
}
|
|
405
|
-
function I(v,
|
|
406
|
-
!
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
),
|
|
405
|
+
function I(v, h, D) {
|
|
406
|
+
!u.value || (d.value && e === "colum" && !T() && (r(), d.value = !1), D?.(), q(h), _.value.x = Math.max(v, m.value.left), _.value.y = Math.min(
|
|
407
|
+
h + y.value.top,
|
|
408
|
+
y.value.height + m.value.top
|
|
409
|
+
), _.value.scrollTop = y.value.top, g.value());
|
|
410
410
|
}
|
|
411
411
|
function C() {
|
|
412
|
-
|
|
412
|
+
u.value = !1, c.value?.classList.remove("disable-scroll-behavior");
|
|
413
413
|
}
|
|
414
414
|
function O() {
|
|
415
|
-
!
|
|
415
|
+
!u.value || (L || Y(), g.value());
|
|
416
416
|
}
|
|
417
417
|
function T() {
|
|
418
|
-
if (!
|
|
418
|
+
if (!u.value)
|
|
419
419
|
return !1;
|
|
420
|
-
const { width: v, height:
|
|
421
|
-
return !(Math.max(v,
|
|
420
|
+
const { width: v, height: h } = R.value;
|
|
421
|
+
return !(Math.max(v, h) > 5);
|
|
422
422
|
}
|
|
423
423
|
function G() {
|
|
424
424
|
T() && r();
|
|
425
425
|
}
|
|
426
|
-
function
|
|
426
|
+
function z() {
|
|
427
427
|
T() || c.value?.querySelectorAll(`[${t}]`).forEach((v) => {
|
|
428
|
-
i[`${t}`] = v.getAttribute(`${t}`),
|
|
428
|
+
i[`${t}`] = v.getAttribute(`${t}`), j(v.getBoundingClientRect()) ? o([i]) : a([i]);
|
|
429
429
|
});
|
|
430
430
|
}
|
|
431
431
|
function oe() {
|
|
432
432
|
const v = [];
|
|
433
|
-
let
|
|
434
|
-
c.value?.querySelectorAll(`[${t}]`).forEach((x,
|
|
433
|
+
let h = null, D = 0;
|
|
434
|
+
c.value?.querySelectorAll(`[${t}]`).forEach((x, A) => {
|
|
435
435
|
const X = x.getAttribute(`${t}`);
|
|
436
|
-
v.push(X),
|
|
436
|
+
v.push(X), j(x.getBoundingClientRect()) ? (h === null && (h = A), h = Math.min(h, A), D = Math.max(D, A)) : (i[`${t}`] = X, f.has(X) && a([i]));
|
|
437
437
|
});
|
|
438
|
-
for (let x =
|
|
439
|
-
i[`${t}`] = v[x], o([i]),
|
|
438
|
+
for (let x = h; x < D + 1; x++)
|
|
439
|
+
i[`${t}`] = v[x], o([i]), f.add(v[x]);
|
|
440
440
|
}
|
|
441
441
|
function re(v) {
|
|
442
|
-
return !v?.value || (c.value = v.value, !c?.value) ? !1 : (w.observe(c.value),
|
|
442
|
+
return !v?.value || (c.value = v.value, !c?.value) ? !1 : (w.observe(c.value), p(
|
|
443
443
|
".disable-scroll-behavior",
|
|
444
444
|
"scroll-behavior: unset !important;"
|
|
445
445
|
), !0);
|
|
446
446
|
}
|
|
447
447
|
return {
|
|
448
448
|
init: re,
|
|
449
|
-
dragStart:
|
|
449
|
+
dragStart: b,
|
|
450
450
|
dragMove: I,
|
|
451
451
|
dragEnd: C,
|
|
452
452
|
onScroll: O,
|
|
453
453
|
isSingleClick: T,
|
|
454
454
|
cancelSelectAllBySingleClick: G,
|
|
455
|
-
selectFn:
|
|
456
|
-
selectRange:
|
|
457
|
-
isPressing:
|
|
455
|
+
selectFn: g,
|
|
456
|
+
selectRange: R,
|
|
457
|
+
isPressing: u,
|
|
458
458
|
containerEl: c,
|
|
459
459
|
observer: w
|
|
460
460
|
};
|
|
@@ -465,45 +465,45 @@ function Nt(t) {
|
|
|
465
465
|
dragStart: a,
|
|
466
466
|
dragMove: r,
|
|
467
467
|
dragEnd: i,
|
|
468
|
-
cancelSelectAllBySingleClick:
|
|
469
|
-
} = e,
|
|
468
|
+
cancelSelectAllBySingleClick: g
|
|
469
|
+
} = e, f = S(() => ({
|
|
470
470
|
left: `${l.value.left}px`,
|
|
471
471
|
top: `${l.value.top}px`,
|
|
472
472
|
width: `${l.value.width}px`,
|
|
473
473
|
height: `${l.value.height}px`
|
|
474
474
|
})), d = Z({
|
|
475
475
|
render() {
|
|
476
|
-
return
|
|
476
|
+
return K("div", {
|
|
477
477
|
id: "selectBoxEl",
|
|
478
478
|
class: "absolute z-50 bg-blue-200 opacity-50",
|
|
479
|
-
style:
|
|
479
|
+
style: f.value
|
|
480
480
|
});
|
|
481
481
|
}
|
|
482
482
|
});
|
|
483
|
-
function c(
|
|
484
|
-
|
|
483
|
+
function c(m) {
|
|
484
|
+
m.button === 0 && a(m.x, m.y);
|
|
485
485
|
}
|
|
486
|
-
function
|
|
487
|
-
r(
|
|
486
|
+
function u(m) {
|
|
487
|
+
r(m.x, m.y);
|
|
488
488
|
}
|
|
489
|
-
function
|
|
490
|
-
|
|
489
|
+
function s(m) {
|
|
490
|
+
m.composedPath().some((R) => R?.getAttribute?.(t.attribute)) || g(), i();
|
|
491
491
|
}
|
|
492
|
-
function
|
|
492
|
+
function _(m) {
|
|
493
493
|
try {
|
|
494
|
-
if (!e.init(
|
|
494
|
+
if (!e.init(m))
|
|
495
495
|
throw "\u521D\u59CB\u5316\u5931\u8D25,Ref\u5143\u7D20\u4E0D\u6B63\u786E";
|
|
496
496
|
if (!e.containerEl?.value)
|
|
497
497
|
return !1;
|
|
498
|
-
ae(
|
|
499
|
-
} catch (
|
|
500
|
-
console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25",
|
|
498
|
+
ae(K(d), e.containerEl.value), e.containerEl.value?.addEventListener("scroll", o), e.containerEl.value?.addEventListener("mousedown", c), window.addEventListener("mousemove", u), window.addEventListener("mouseup", s);
|
|
499
|
+
} catch (y) {
|
|
500
|
+
console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25", y);
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
503
|
function w() {
|
|
504
|
-
n.disconnect(), e.containerEl.value?.removeEventListener("scroll", o), e.containerEl.value?.removeEventListener("mousedown", c), window.removeEventListener("mousemove",
|
|
504
|
+
n.disconnect(), e.containerEl.value?.removeEventListener("scroll", o), e.containerEl.value?.removeEventListener("mousedown", c), window.removeEventListener("mousemove", u), window.removeEventListener("mouseup", s);
|
|
505
505
|
}
|
|
506
|
-
return { init:
|
|
506
|
+
return { init: _, unMount: w };
|
|
507
507
|
}
|
|
508
508
|
function Vt(t, e, n = 600) {
|
|
509
509
|
const l = Ve({
|
|
@@ -513,40 +513,40 @@ function Vt(t, e, n = 600) {
|
|
|
513
513
|
startSpeed: 5,
|
|
514
514
|
maxSpeed: 5
|
|
515
515
|
}
|
|
516
|
-
}), { observer: o } = l, { onScroll: a, dragStart: r, dragMove: i, dragEnd:
|
|
517
|
-
let
|
|
518
|
-
function
|
|
519
|
-
clearTimeout(
|
|
520
|
-
}
|
|
521
|
-
function
|
|
522
|
-
|
|
523
|
-
const { clientX:
|
|
524
|
-
r(
|
|
516
|
+
}), { observer: o } = l, { onScroll: a, dragStart: r, dragMove: i, dragEnd: g } = l;
|
|
517
|
+
let f;
|
|
518
|
+
function d() {
|
|
519
|
+
clearTimeout(f);
|
|
520
|
+
}
|
|
521
|
+
function c(m) {
|
|
522
|
+
d(), f = setTimeout(() => {
|
|
523
|
+
const { clientX: y, clientY: R } = m.targetTouches[0];
|
|
524
|
+
r(y, R), e?.(), i(y, R, () => m.preventDefault()), m.preventDefault();
|
|
525
525
|
}, n);
|
|
526
526
|
}
|
|
527
|
-
function u(
|
|
528
|
-
|
|
529
|
-
const { clientX:
|
|
530
|
-
i(
|
|
527
|
+
function u(m) {
|
|
528
|
+
d();
|
|
529
|
+
const { clientX: y, clientY: R } = m.targetTouches[0];
|
|
530
|
+
i(y, R, () => m.preventDefault());
|
|
531
531
|
}
|
|
532
|
-
function
|
|
533
|
-
|
|
532
|
+
function s() {
|
|
533
|
+
d(), g();
|
|
534
534
|
}
|
|
535
|
-
function
|
|
535
|
+
function _(m) {
|
|
536
536
|
try {
|
|
537
|
-
if (!l.init(
|
|
537
|
+
if (!l.init(m))
|
|
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
|
-
l.containerEl.value?.addEventListener("scroll", a), l.containerEl.value?.addEventListener("touchstart",
|
|
542
|
-
} catch (
|
|
543
|
-
console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25",
|
|
541
|
+
l.containerEl.value?.addEventListener("scroll", a), l.containerEl.value?.addEventListener("touchstart", c), l.containerEl.value?.addEventListener("touchmove", u), window.addEventListener("touchcancel", s), window.addEventListener("touchend", s);
|
|
542
|
+
} catch (y) {
|
|
543
|
+
console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25", y);
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
|
-
function
|
|
547
|
-
o.disconnect(), l.containerEl.value?.removeEventListener("scroll", a), l.containerEl.value?.removeEventListener("touchstart",
|
|
546
|
+
function w() {
|
|
547
|
+
o.disconnect(), l.containerEl.value?.removeEventListener("scroll", a), l.containerEl.value?.removeEventListener("touchstart", c), l.containerEl.value?.removeEventListener("touchmove", u), window.removeEventListener("touchcancel", s), window.removeEventListener("touchEnd", s);
|
|
548
548
|
}
|
|
549
|
-
return { init:
|
|
549
|
+
return { init: _, unMount: w };
|
|
550
550
|
}
|
|
551
551
|
const Ot = Symbol(), Dt = /* @__PURE__ */ Z({
|
|
552
552
|
__name: "Dialog",
|
|
@@ -560,14 +560,14 @@ const Ot = Symbol(), Dt = /* @__PURE__ */ Z({
|
|
|
560
560
|
const n = t, l = () => {
|
|
561
561
|
n.closeOnClickOverlay && e("update:visiable", !1);
|
|
562
562
|
};
|
|
563
|
-
return
|
|
563
|
+
return H(Ot, () => e("update:visiable", !1)), (o, a) => (W(), De(Re, { name: "modal" }, {
|
|
564
564
|
default: Ce(() => [
|
|
565
|
-
t.visiable ? (
|
|
565
|
+
t.visiable ? (W(), J("div", {
|
|
566
566
|
key: 0,
|
|
567
567
|
onClick: l,
|
|
568
568
|
class: "modal"
|
|
569
569
|
}, [
|
|
570
|
-
|
|
570
|
+
F("div", {
|
|
571
571
|
onClick: a[0] || (a[0] = Ye(() => {
|
|
572
572
|
}, ["stop"])),
|
|
573
573
|
class: Ge(["dialog", t.dialogClass])
|
|
@@ -590,7 +590,7 @@ function jt(t) {
|
|
|
590
590
|
function e(n, l) {
|
|
591
591
|
const o = document.createElement("div"), a = {
|
|
592
592
|
setup() {
|
|
593
|
-
return () =>
|
|
593
|
+
return () => K(
|
|
594
594
|
Rt,
|
|
595
595
|
{
|
|
596
596
|
visiable: !0,
|
|
@@ -600,12 +600,12 @@ function jt(t) {
|
|
|
600
600
|
...t
|
|
601
601
|
},
|
|
602
602
|
{
|
|
603
|
-
default: () =>
|
|
603
|
+
default: () => K(n, l)
|
|
604
604
|
}
|
|
605
605
|
);
|
|
606
606
|
}
|
|
607
607
|
};
|
|
608
|
-
return document.body.appendChild(o), ae(
|
|
608
|
+
return document.body.appendChild(o), ae(K(a), o), {
|
|
609
609
|
close: () => o?.remove()
|
|
610
610
|
};
|
|
611
611
|
}
|
|
@@ -646,17 +646,17 @@ const Ct = /* @__PURE__ */ Z({
|
|
|
646
646
|
}));
|
|
647
647
|
return pe(() => {
|
|
648
648
|
l.value = n.value.offsetWidth / 2, o.value = n.value.offsetHeight / 2;
|
|
649
|
-
}), (
|
|
649
|
+
}), (g, f) => (W(), J("div", {
|
|
650
650
|
id: "toastWrapper",
|
|
651
651
|
ref_key: "toastWrapper",
|
|
652
652
|
ref: n,
|
|
653
653
|
class: "toastWrapper",
|
|
654
654
|
style: le([B(r), { zIndex: 9999 }])
|
|
655
655
|
}, [
|
|
656
|
-
|
|
656
|
+
F("div", {
|
|
657
657
|
style: le(B(i))
|
|
658
658
|
}, [
|
|
659
|
-
|
|
659
|
+
F("span", null, Je(t.message), 1)
|
|
660
660
|
], 4)
|
|
661
661
|
], 4));
|
|
662
662
|
}
|
|
@@ -673,7 +673,7 @@ class Kt {
|
|
|
673
673
|
this.options = e, this.container = document.createElement("div");
|
|
674
674
|
}
|
|
675
675
|
present() {
|
|
676
|
-
const e =
|
|
676
|
+
const e = K(K(Bt), { ...Te, ...this.options });
|
|
677
677
|
ae(e, this.container), document.body.insertBefore(this.container, document.body.firstChild);
|
|
678
678
|
const n = this.options.duration || Te.duration;
|
|
679
679
|
setTimeout(() => {
|
|
@@ -706,11 +706,11 @@ const It = ["xlink:href", "fill", "color"], Qt = /* @__PURE__ */ Z({
|
|
|
706
706
|
height: `${e.height ?? e.width}px`,
|
|
707
707
|
aspectRatio: e.width && e.height ? void 0 : "1/1"
|
|
708
708
|
}));
|
|
709
|
-
return (o, a) => (
|
|
709
|
+
return (o, a) => (W(), J("svg", {
|
|
710
710
|
"aria-hidden": "",
|
|
711
711
|
style: le(B(l))
|
|
712
712
|
}, [
|
|
713
|
-
|
|
713
|
+
F("use", {
|
|
714
714
|
"xlink:href": B(n),
|
|
715
715
|
fill: t.color,
|
|
716
716
|
color: t.color
|
|
@@ -725,108 +725,108 @@ function Lt(t) {
|
|
|
725
725
|
autoHeight: l,
|
|
726
726
|
performance: o = {},
|
|
727
727
|
maxHeightRatio: a = 0.9
|
|
728
|
-
} = t, r = E(!0), i = Le(
|
|
729
|
-
let
|
|
730
|
-
const d = E(0), c = E(0),
|
|
728
|
+
} = t, r = E(!0), i = Le(N, 100);
|
|
729
|
+
let g, f = "";
|
|
730
|
+
const d = E(0), c = E(0), u = E(0), s = E({
|
|
731
731
|
top: 0,
|
|
732
732
|
scrollTop: 0,
|
|
733
733
|
scrollHeight: 0,
|
|
734
734
|
clientHeight: 0
|
|
735
|
-
}),
|
|
735
|
+
}), _ = E({
|
|
736
736
|
clientHeight: 0
|
|
737
|
-
}), w = S(() => !!c.value),
|
|
738
|
-
|
|
737
|
+
}), w = S(() => !!c.value), m = S(() => s.value.scrollHeight > s.value.clientHeight), y = S(() => s.value.clientHeight - _.value.clientHeight), R = S(() => s.value.scrollHeight - s.value.clientHeight), Q = S(() => Math.max(
|
|
738
|
+
s.value.clientHeight / s.value.scrollHeight,
|
|
739
739
|
0.05
|
|
740
|
-
)), ee = S(() =>
|
|
740
|
+
)), ee = S(() => Q.value > a ? 0 : Q.value * s.value.clientHeight), U = S(() => ({
|
|
741
741
|
willChange: "transform",
|
|
742
|
-
transform: `translate3d(0,${
|
|
742
|
+
transform: `translate3d(0,${u.value}px,0)`,
|
|
743
743
|
height: l ? `${ee.value}px` : void 0
|
|
744
744
|
}));
|
|
745
|
-
function
|
|
746
|
-
|
|
745
|
+
function k(O) {
|
|
746
|
+
M(), c.value = O.clientY - n.value.getBoundingClientRect().top || 1, f = getComputedStyle(e.value).scrollBehavior, f === "smooth" && (e.value.style.scrollBehavior = "unset");
|
|
747
747
|
}
|
|
748
|
-
function
|
|
749
|
-
e.value.style.scrollBehavior =
|
|
748
|
+
function $() {
|
|
749
|
+
e.value.style.scrollBehavior = f, c.value = 0, i();
|
|
750
750
|
}
|
|
751
|
-
function
|
|
751
|
+
function M() {
|
|
752
752
|
r.value = !1;
|
|
753
753
|
}
|
|
754
|
-
function
|
|
754
|
+
function N() {
|
|
755
755
|
w.value || (r.value = !0);
|
|
756
756
|
}
|
|
757
|
-
function
|
|
757
|
+
function V(O) {
|
|
758
758
|
if (!w.value)
|
|
759
759
|
return;
|
|
760
|
-
let T = O.clientY -
|
|
761
|
-
T < 0 ?
|
|
762
|
-
top:
|
|
760
|
+
let T = O.clientY - s.value.top - c.value;
|
|
761
|
+
T < 0 ? u.value = 0 : T >= y.value ? u.value = y.value : u.value = T, e.value.scrollTo({
|
|
762
|
+
top: u.value / y.value * R.value
|
|
763
763
|
});
|
|
764
764
|
}
|
|
765
|
-
function
|
|
765
|
+
function L() {
|
|
766
766
|
w.value || q();
|
|
767
767
|
}
|
|
768
768
|
function q() {
|
|
769
|
-
cancelAnimationFrame(
|
|
769
|
+
cancelAnimationFrame(g), g = requestAnimationFrame(te);
|
|
770
770
|
}
|
|
771
771
|
function te() {
|
|
772
|
-
e.value && (d.value = o.scrollTop?.value ?? e.value.scrollTop,
|
|
772
|
+
e.value && (d.value = o.scrollTop?.value ?? e.value.scrollTop, u.value = d.value / R.value * y.value);
|
|
773
773
|
}
|
|
774
|
-
function
|
|
774
|
+
function j(O) {
|
|
775
775
|
let T = "addEventListener";
|
|
776
|
-
O === "add" ? T = "addEventListener" : T = "removeEventListener", n.value?.[T]("pointerdown",
|
|
776
|
+
O === "add" ? T = "addEventListener" : T = "removeEventListener", n.value?.[T]("pointerdown", k, {
|
|
777
777
|
passive: !0
|
|
778
|
-
}), window[T]("pointermove",
|
|
778
|
+
}), window[T]("pointermove", V, { passive: !0 }), window[T]("pointerup", $, { passive: !0 });
|
|
779
779
|
}
|
|
780
780
|
const Y = new MutationObserver((O) => {
|
|
781
|
-
O.map((G) => G.oldValue).join().includes("height") &&
|
|
781
|
+
O.map((G) => G.oldValue).join().includes("height") && p();
|
|
782
782
|
});
|
|
783
|
-
function
|
|
784
|
-
|
|
783
|
+
function p() {
|
|
784
|
+
s.value.top = e.value?.getBoundingClientRect().top ?? 0, s.value.scrollHeight = e.value?.scrollHeight ?? 0, s.value.clientHeight = e.value?.clientHeight ?? 0;
|
|
785
785
|
}
|
|
786
|
-
function
|
|
787
|
-
|
|
788
|
-
|
|
786
|
+
function b() {
|
|
787
|
+
M(), setTimeout(() => {
|
|
788
|
+
_.value.clientHeight = n.value?.clientHeight ?? 0, N();
|
|
789
789
|
}, 150);
|
|
790
790
|
}
|
|
791
791
|
function I(O, T, G = "dynamic-styles") {
|
|
792
|
-
let
|
|
793
|
-
|
|
794
|
-
const oe =
|
|
795
|
-
for (let
|
|
796
|
-
const
|
|
797
|
-
if (
|
|
792
|
+
let z = document.getElementById(G);
|
|
793
|
+
z || (z = document.createElement("style"), z.id = G, document.head.appendChild(z));
|
|
794
|
+
const oe = z.sheet.cssRules, re = oe.length, v = `${O} { ${T} }`;
|
|
795
|
+
for (let h = 0; h < re; h++) {
|
|
796
|
+
const D = oe[h];
|
|
797
|
+
if (D.selectorText === O && D.style.cssText === T)
|
|
798
798
|
return;
|
|
799
799
|
}
|
|
800
|
-
|
|
800
|
+
z.sheet.insertRule(v, re);
|
|
801
801
|
}
|
|
802
802
|
function C() {
|
|
803
803
|
e.value && n.value ? (I(
|
|
804
804
|
".hide-scrollbar",
|
|
805
805
|
"scrollbar-width: none; -ms-overflow-style: none;"
|
|
806
|
-
), I(".hide-scrollbar::-webkit-scrollbar", "display: none"), e.value.addEventListener("scroll",
|
|
806
|
+
), I(".hide-scrollbar::-webkit-scrollbar", "display: none"), e.value.addEventListener("scroll", L, {
|
|
807
807
|
passive: !0
|
|
808
|
-
}),
|
|
808
|
+
}), j("add"), Y.observe(e.value, {
|
|
809
809
|
subtree: !0,
|
|
810
810
|
attributeOldValue: !0,
|
|
811
811
|
attributeFilter: ["style"]
|
|
812
812
|
}), setTimeout(() => {
|
|
813
|
-
|
|
814
|
-
}, 100),
|
|
813
|
+
p();
|
|
814
|
+
}, 100), b()) : console.error("useScrollBar:", "\u521D\u59CB\u5316\u5931\u8D25!", { containerEl: e, sliderEl: n });
|
|
815
815
|
}
|
|
816
816
|
return ne(d, () => {
|
|
817
|
-
|
|
817
|
+
M(), i();
|
|
818
818
|
}), {
|
|
819
819
|
isScrollEnd: r,
|
|
820
820
|
isDragSlider: w,
|
|
821
|
-
offsetTop:
|
|
821
|
+
offsetTop: u,
|
|
822
822
|
scrollTop: d,
|
|
823
|
-
scrollable:
|
|
823
|
+
scrollable: m,
|
|
824
824
|
sliderPos: U,
|
|
825
825
|
init: C,
|
|
826
|
-
modifySliderEventListener:
|
|
826
|
+
modifySliderEventListener: j
|
|
827
827
|
};
|
|
828
828
|
}
|
|
829
|
-
const Ht = (t) => (nt("data-v-edec7292"), t = t(), lt(), t), $t = /* @__PURE__ */ Ht(() => /* @__PURE__ */
|
|
829
|
+
const Ht = (t) => (nt("data-v-edec7292"), t = t(), lt(), t), $t = /* @__PURE__ */ Ht(() => /* @__PURE__ */ F("div", { class: "default-slider" }, null, -1)), At = /* @__PURE__ */ Z({
|
|
830
830
|
__name: "ScrollBar",
|
|
831
831
|
props: {
|
|
832
832
|
containerEl: null,
|
|
@@ -840,7 +840,7 @@ const Ht = (t) => (nt("data-v-edec7292"), t = t(), lt(), t), $t = /* @__PURE__ *
|
|
|
840
840
|
sliderEl: o,
|
|
841
841
|
autoHeight: l ? n.autoHeight : !0,
|
|
842
842
|
performance: n.performance
|
|
843
|
-
}), { scrollable: i, isScrollEnd:
|
|
843
|
+
}), { scrollable: i, isScrollEnd: g, sliderPos: f } = r, d = E(!1), c = n.autoHide ? S(() => d.value || !g.value) : S(() => i.value);
|
|
844
844
|
fe(() => {
|
|
845
845
|
pe(() => {
|
|
846
846
|
r.init();
|
|
@@ -848,23 +848,23 @@ const Ht = (t) => (nt("data-v-edec7292"), t = t(), lt(), t), $t = /* @__PURE__ *
|
|
|
848
848
|
}), Oe(() => {
|
|
849
849
|
r.modifySliderEventListener("remove");
|
|
850
850
|
});
|
|
851
|
-
function
|
|
851
|
+
function u() {
|
|
852
852
|
d.value = !0;
|
|
853
853
|
}
|
|
854
|
-
function
|
|
854
|
+
function s() {
|
|
855
855
|
d.value = !1;
|
|
856
856
|
}
|
|
857
|
-
return e({ uScrollBarReturn: r }), (
|
|
857
|
+
return e({ uScrollBarReturn: r }), (_, w) => (W(), De(Re, null, {
|
|
858
858
|
default: Ce(() => [
|
|
859
|
-
et(
|
|
859
|
+
et(F("div", {
|
|
860
860
|
ref_key: "sliderRef",
|
|
861
861
|
ref: o,
|
|
862
862
|
class: "slider-wrapper",
|
|
863
|
-
onMouseenter:
|
|
864
|
-
onMouseleave:
|
|
865
|
-
style: le(B(
|
|
863
|
+
onMouseenter: u,
|
|
864
|
+
onMouseleave: s,
|
|
865
|
+
style: le(B(f))
|
|
866
866
|
}, [
|
|
867
|
-
he(
|
|
867
|
+
he(_.$slots, "default", {}, () => [
|
|
868
868
|
$t
|
|
869
869
|
], !0)
|
|
870
870
|
], 36), [
|
|
@@ -893,27 +893,27 @@ const Ut = /* @__PURE__ */ ue(At, [["__scopeId", "data-v-edec7292"]]), Pt = { cl
|
|
|
893
893
|
scrollEndHook: () => {
|
|
894
894
|
n("scrollEnd");
|
|
895
895
|
}
|
|
896
|
-
}), { list: a, containerProps: r, wrapperProps: i, innerProps:
|
|
896
|
+
}), { list: a, containerProps: r, wrapperProps: i, innerProps: g, getItemHeightData: f } = o;
|
|
897
897
|
return e({
|
|
898
898
|
vListReturn: o
|
|
899
|
-
}), (d, c) => (
|
|
900
|
-
|
|
901
|
-
onScrollPassive: c[0] || (c[0] = (...
|
|
899
|
+
}), (d, c) => (W(), J("div", Pt, [
|
|
900
|
+
F("div", rt({
|
|
901
|
+
onScrollPassive: c[0] || (c[0] = (...u) => B(r).onScroll && B(r).onScroll(...u)),
|
|
902
902
|
ref: B(r).ref,
|
|
903
903
|
class: "virtualList"
|
|
904
904
|
}, d.$attrs), [
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
(
|
|
908
|
-
key:
|
|
905
|
+
F("div", ge(ye(B(i))), [
|
|
906
|
+
F("div", ge(ye(B(g))), [
|
|
907
|
+
(W(!0), J(at, null, st(B(a), ({ index: u, data: s }) => (W(), J("div", {
|
|
908
|
+
key: u,
|
|
909
909
|
style: le({
|
|
910
|
-
height: `${B(
|
|
910
|
+
height: `${B(f)(u).height}px`,
|
|
911
911
|
display: "flex"
|
|
912
912
|
})
|
|
913
913
|
}, [
|
|
914
914
|
he(d.$slots, "default", {
|
|
915
|
-
data:
|
|
916
|
-
index:
|
|
915
|
+
data: s,
|
|
916
|
+
index: u
|
|
917
917
|
}, void 0, !0)
|
|
918
918
|
], 4))), 128))
|
|
919
919
|
], 16)
|
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 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"}})});
|
|
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 y=>{const h=Q(n),p=Date.now()-l;if(a(),h<=0)return l=Date.now(),y();p>h&&(o||!i)?(l=Date.now(),y()):t&&(r=setTimeout(()=>{l=Date.now(),i=!0,a(),y()},h)),!o&&!r&&(r=setTimeout(()=>i=!0,h)),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),y=()=>{a&&(a.disconnect(),a=void 0)},h=e.watch(()=>ge(n),d=>{y(),u.value&&r&&d&&(a=new ResizeObserver(t),a.observe(d,i))},{immediate:!0,flush:"post"}),p=()=>{y(),h()};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((y,{inlineSize:h})=>y+h,0),i.value=u.reduce((y,{blockSize:h})=>y+h,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),y=me(U,100);let h;const p=e.shallowRef(n),d=e.ref(0),c=e.ref({start:0,end:10});let s=0;const _=e.ref([]),w=e.computed(()=>{let{sum:m,height:b}={sum:0,height:0};return p.value.map((R,D)=>(typeof l=="number"?b=l:b=l(D),m+=b,{height:b,sum:m}))}),g=e.computed(()=>$(c.value.start)),S=e.computed(()=>typeof l=="number"?w.value.length*l:w.value[w.value.length-1]?.sum||0),C=e.computed(()=>{let m=_.value.length-r,b=Math.max(m-s,0);return _.value.slice(b,m)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(h)),e.watch([a.width,a.height,p],([m,b])=>{(m||b)&&j()},{deep:!0}),e.watch(d,()=>{V(),y()});function V(){u.value=!1}function U(){u.value=!0,o?.()}function j(){cancelAnimationFrame(h),h=requestAnimationFrame(M)}function M(){if(i.value){d.value=i.value.scrollTop,s=A();let m=L(d.value),b=m+s+r;m=m-r,m=m<0?0:m,b=b>p.value.length?p.value.length:b,c.value={start:m,end:b},_.value=p.value.slice(m,b).map((R,D)=>({data:R,index:D+m}))}}function L(m){let b=0,R=w.value.length-1,D=-1;for(;b<=R;){const B=Math.floor((b+R)/2);w.value[B].sum>=m?(D=B,R=B-1):b=B+1}return Math.max(0,D)}function A(){let m=0,b=0,R=I();for(let D=R;D<w.value.length&&(m++,b+=w.value[D].height,!(b>=a.height.value));D++);return m}function $(m){if(typeof l=="number")return m*l;let b=w.value[m];return b?b.sum-b.height:0}function F(m){return w.value[m]||{sum:0,height:0}}function I(){let m=c.value.start;return m>=r&&(m+=r),m}function K(m){if(i.value){const b=F(m);i.value.scrollTop=b.sum-b.height,M()}}const q=e.computed(()=>({style:{width:"100%",height:`${S.value}px`,pointerEvents:u.value?void 0:"none"}})),k=e.computed(()=>({style:{transform:`translate3d(0, ${g.value}px, 0)`,"will-change":"transform"}})),N={overflowY:"auto"};return{list:_,visiableList:C,getItemHeightData:F,getoffsetTopIndex:L,totalHeight:S,clientHeight:a.height,scrollTo:K,scrollTop:d,isScrollEnd:u,containerProps:{ref:i,onScroll:()=>{j()},style:N},wrapperProps:q,innerProps:k}}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:s=>{},boolFn:s=>!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),y=e.inject(ee,n),h=e.inject(le,n),p=e.inject(re,n),d=e.inject(ae,n),c=e.inject(se,n);return{selected:r,isSelected:i,isAllSelected:a,toggle:u,toggleAll:y,select:h,selectAll:p,unselect:d,unselectAll:c}}function Ne(n,t){const o=e.ref({}),l=e.computed(()=>n.value.filter(c=>o.value[c[t]])),r=e.computed(()=>l.value.length!=0&&Object.keys(o.value).length==n.value.length);function i(){n.value.forEach(c=>{o.value[c[t]]=!0})}function a(){o.value={}}function u(c){c.forEach(s=>{o.value[s[t]]||(o.value[s[t]]=!0)})}function y(c){c.forEach(s=>{o.value[s[t]]&&delete o.value[s[t]]})}function h(c){return!!o.value[c[t]]}function p(c){c.forEach(s=>{h(s)?delete o.value[s[t]]:o.value[s[t]]=!0})}function d(){r.value?a():i()}return e.provide(ee,d),e.provide(te,p),e.provide(ne,h),e.provide(oe,l),e.provide(le,u),e.provide(re,i),e.provide(ae,y),e.provide(ie,r),e.provide(se,a),{selected:l,select:u,selectAll:i,unselect:y,unselectAll:a,toggle:p,toggleAll:d,isSelected:h,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 y=e.computed(()=>ve(t==="colum"?P:G,50)),h=new Set,p=e.ref(!0),d=e.ref(),c=e.ref(!1),s=e.ref({x:0,y:0}),_=e.ref({x:0,y:0,scrollTop:0}),w=new ResizeObserver(f=>g.value=f[0].target.getBoundingClientRect()),g=e.ref({}),S=e.ref({top:0,height:0,sync(f=!1){S.value.top=d.value?.scrollTop||0,f&&(S.value.height=d.value?.scrollHeight||0)}}),C=e.computed(()=>c.value?{left:Math.min(s.value.x,_.value.x)-g.value.left,top:Math.min(s.value.y,_.value.y)-g.value.top,width:Math.abs(s.value.x-_.value.x),height:Math.abs(s.value.y-_.value.y)}:{left:0,top:0,width:0,height:0}),{margin:V=50,startSpeed:U=30,maxSpeed:j=30}=o;let M;const L=V,A=U,$=j,F=f=>f**1;let I=0;function K(f){if(cancelAnimationFrame(M),I=q(f),I=Math.max(Math.min(I,$),-$),I!==0){const v=d.value;if(!v||!c.value)return;const O=S.value.height-g.value.height;let T=S.value.top+Number(I);T=Math.min(Math.max(0,T),O),v.scrollTop=T,N(),M=requestAnimationFrame(()=>K(f))}}function q(f){if(d.value){const O=g.value,T=O.bottom-f;if(T<L)return A*F(1-T/L);const H=f-O.top;if(H<L)return-A*F(1-H/L)}return 0}function k(f){const v={...C.value,right:0,bottom:0};return v.left+=g.value.left,v.top+=g.value.top-S.value.top,v.right=v.width+v.left,v.bottom=v.height+v.top,v.left<f.right&&v.right>f.left&&v.top<f.bottom&&v.bottom>f.top}function N(){S.value.sync();const{top:f,height:v}=S.value;_.value.y=Math.min(v+g.value.top,_.value.y+f-_.value.scrollTop),_.value.scrollTop=f}function m(f,v,O="dynamic-styles"){let T=document.getElementById(O);T||(T=document.createElement("style"),T.id=O,document.head.appendChild(T));const H=T.sheet.cssRules,W=H.length,st=`${f} { ${v} }`;for(let de=0;de<W;de++){const xe=H[de];if(xe.selectorText===f&&xe.style.cssText===v)return}T.sheet.insertRule(st,W)}function b(f,v){p.value=!0,c.value=!0,S.value.height?S.value.sync():S.value.sync(!0),s.value.x=f,s.value.y=v+S.value.top,_.value.x=s.value.x,_.value.y=s.value.y,d.value?.classList.add("disable-scroll-behavior"),h.clear()}function R(f,v,O){!c.value||(p.value&&t==="colum"&&!x()&&(a(),p.value=!1),O?.(),K(v),_.value.x=Math.max(f,g.value.left),_.value.y=Math.min(v+S.value.top,S.value.height+g.value.top),_.value.scrollTop=S.value.top,y.value())}function D(){c.value=!1,d.value?.classList.remove("disable-scroll-behavior")}function B(){!c.value||(I||N(),y.value())}function x(){if(!c.value)return!1;const{width:f,height:v}=C.value;return!(Math.max(f,v)>5)}function z(){x()&&a()}function P(){x()||d.value?.querySelectorAll(`[${n}]`).forEach(f=>{u[`${n}`]=f.getAttribute(`${n}`),k(f.getBoundingClientRect())?r([u]):i([u])})}function G(){const f=[];let v=null,O=0;d.value?.querySelectorAll(`[${n}]`).forEach((T,H)=>{const W=T.getAttribute(`${n}`);f.push(W),k(T.getBoundingClientRect())?(v===null&&(v=H),v=Math.min(v,H),O=Math.max(O,H)):(u[`${n}`]=W,h.has(W)&&i([u]))});for(let T=v;T<O+1;T++)u[`${n}`]=f[T],r([u]),h.add(f[T])}function X(f){return!f?.value||(d.value=f.value,!d?.value)?!1:(w.observe(d.value),m(".disable-scroll-behavior","scroll-behavior: unset !important;"),!0)}return{init:X,dragStart:b,dragMove:R,dragEnd:D,onScroll:B,isSingleClick:x,cancelSelectAllBySingleClick:z,selectFn:y,selectRange:C,isPressing:c,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:y}=t,h=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:h.value})}});function d(g){g.button===0&&i(g.x,g.y)}function c(g){a(g.x,g.y)}function s(g){g.composedPath().some(C=>C?.getAttribute?.(n.attribute))||y(),u()}function _(g){try{if(!t.init(g))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",c),window.addEventListener("mouseup",s)}catch(S){console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25",S)}}function w(){o.disconnect(),t.containerEl.value?.removeEventListener("scroll",r),t.containerEl.value?.removeEventListener("mousedown",d),window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",s)}return{init:_,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:y}=l;let h;function p(){clearTimeout(h)}function d(g){p(),h=setTimeout(()=>{const{clientX:S,clientY:C}=g.targetTouches[0];a(S,C),t?.(),u(S,C,()=>g.preventDefault()),g.preventDefault()},o)}function c(g){p();const{clientX:S,clientY:C}=g.targetTouches[0];u(S,C,()=>g.preventDefault())}function s(){p(),y()}function _(g){try{if(!l.init(g))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",d),l.containerEl.value?.addEventListener("touchmove",c),window.addEventListener("touchcancel",s),window.addEventListener("touchend",s)}catch(S){console.error("\u62D6\u9009\u529F\u80FD\u521D\u59CB\u5316\u5931\u8D25",S)}}function w(){r.disconnect(),l.containerEl.value?.removeEventListener("scroll",i),l.containerEl.value?.removeEventListener("touchstart",d),l.containerEl.value?.removeEventListener("touchmove",c),window.removeEventListener("touchcancel",s),window.removeEventListener("touchEnd",s)}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"},[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}),(y,h)=>(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($,100);let y,h="";const p=e.ref(0),d=e.ref(0),c=e.ref(0),s=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),_=e.ref({clientHeight:0}),w=e.computed(()=>!!d.value),g=e.computed(()=>s.value.scrollHeight>s.value.clientHeight),S=e.computed(()=>s.value.clientHeight-_.value.clientHeight),C=e.computed(()=>s.value.scrollHeight-s.value.clientHeight),V=e.computed(()=>Math.max(s.value.clientHeight/s.value.scrollHeight,.05)),U=e.computed(()=>V.value>i?0:V.value*s.value.clientHeight),j=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${c.value}px,0)`,height:l?`${U.value}px`:void 0}));function M(B){A(),d.value=B.clientY-o.value.getBoundingClientRect().top||1,h=getComputedStyle(t.value).scrollBehavior,h==="smooth"&&(t.value.style.scrollBehavior="unset")}function L(){t.value.style.scrollBehavior=h,d.value=0,u()}function A(){a.value=!1}function $(){w.value||(a.value=!0)}function F(B){if(!w.value)return;let x=B.clientY-s.value.top-d.value;x<0?c.value=0:x>=S.value?c.value=S.value:c.value=x,t.value.scrollTo({top:c.value/S.value*C.value})}function I(){w.value||K()}function K(){cancelAnimationFrame(y),y=requestAnimationFrame(q)}function q(){t.value&&(p.value=r.scrollTop?.value??t.value.scrollTop,c.value=p.value/C.value*S.value)}function k(B){let x="addEventListener";B==="add"?x="addEventListener":x="removeEventListener",o.value?.[x]("pointerdown",M,{passive:!0}),window[x]("pointermove",F,{passive:!0}),window[x]("pointerup",L,{passive:!0})}const N=new MutationObserver(B=>{B.map(z=>z.oldValue).join().includes("height")&&m()});function m(){s.value.top=t.value?.getBoundingClientRect().top??0,s.value.scrollHeight=t.value?.scrollHeight??0,s.value.clientHeight=t.value?.clientHeight??0}function b(){A(),setTimeout(()=>{_.value.clientHeight=o.value?.clientHeight??0,$()},150)}function R(B,x,z="dynamic-styles"){let P=document.getElementById(z);P||(P=document.createElement("style"),P.id=z,document.head.appendChild(P));const G=P.sheet.cssRules,X=G.length,f=`${B} { ${x} }`;for(let v=0;v<X;v++){const O=G[v];if(O.selectorText===B&&O.style.cssText===x)return}P.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",I,{passive:!0}),k("add"),N.observe(t.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{m()},100),b()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:t,sliderEl:o})}return e.watch(p,()=>{A(),u()}),{isScrollEnd:a,isDragSlider:w,offsetTop:c,scrollTop:p,scrollable:g,sliderPos:j,init:D,modifySliderEventListener:k}}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:y,sliderPos:h}=a,p=e.ref(!1),d=o.autoHide?e.computed(()=>p.value||!y.value):e.computed(()=>u.value);e.onMounted(()=>{e.nextTick(()=>{a.init()})}),e.onUnmounted(()=>{a.modifySliderEventListener("remove")});function c(){p.value=!0}function s(){p.value=!1}return t({uScrollBarReturn:a}),(_,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:c,onMouseleave:s,style:e.normalizeStyle(e.unref(h))},[e.renderSlot(_.$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:y,getItemHeightData:h}=r;return t({vListReturn:r}),(p,d)=>(e.openBlock(),e.createElementBlock("div",lt,[e.createElementVNode("div",e.mergeProps({onScrollPassive:d[0]||(d[0]=(...c)=>e.unref(a).onScroll&&e.unref(a).onScroll(...c)),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(y))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i),({index:c,data:s})=>(e.openBlock(),e.createElementBlock("div",{key:c,style:e.normalizeStyle({height:`${e.unref(h)(c).height}px`,display:"flex"})},[e.renderSlot(p.$slots,"default",{data:s,index:c},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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lazycatcloud/lzc-toolkit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.55",
|
|
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
|
+
}
|