@lazycatcloud/lzc-toolkit 0.0.19 → 0.0.20
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 +87 -84
- package/dist/index.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { unref as m, getCurrentScope as ie, onScopeDispose as ce, getCurrentInstance as ue, onMounted as
|
|
2
|
-
var
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
function
|
|
1
|
+
import { unref as m, getCurrentScope as ie, onScopeDispose as ce, getCurrentInstance as ue, onMounted as V, nextTick as de, ref as _, watch as $, shallowRef as fe, onUnmounted as ve, computed as w, inject as y, provide as b, defineComponent as R, openBlock as I, createBlock as pe, Transition as he, withCtx as ge, createElementBlock as x, createElementVNode as P, withModifiers as me, normalizeClass as be, renderSlot as U, createCommentVNode as ye, render as _e, h as E, normalizeStyle as W, toRef as we, mergeProps as Oe, normalizeProps as H, guardReactiveProps as K, Fragment as Se, renderList as Ie } from "vue";
|
|
2
|
+
var L;
|
|
3
|
+
const C = typeof window < "u";
|
|
4
|
+
C && ((L = window?.navigator) == null ? void 0 : L.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
5
|
+
function xe(e) {
|
|
6
6
|
return typeof e == "function" ? e() : m(e);
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function Pe(e) {
|
|
9
9
|
return e;
|
|
10
10
|
}
|
|
11
11
|
function Ce(e) {
|
|
12
12
|
return ie() ? (ce(e), !0) : !1;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
ue() ?
|
|
14
|
+
function Ee(e, t = !0) {
|
|
15
|
+
ue() ? V(e) : t ? e() : de(e);
|
|
16
16
|
}
|
|
17
17
|
function D(e) {
|
|
18
18
|
var t;
|
|
19
|
-
const n =
|
|
19
|
+
const n = xe(e);
|
|
20
20
|
return (t = n?.$el) != null ? t : n;
|
|
21
21
|
}
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
const Ae = C ? window : void 0;
|
|
23
|
+
C && window.document;
|
|
24
|
+
C && window.navigator;
|
|
25
|
+
C && window.location;
|
|
26
26
|
function Te(e, t = !1) {
|
|
27
27
|
const n = _(), o = () => n.value = Boolean(e());
|
|
28
|
-
return o(),
|
|
28
|
+
return o(), Ee(o, t), n;
|
|
29
29
|
}
|
|
30
|
-
const A = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {},
|
|
31
|
-
A[
|
|
32
|
-
A[
|
|
33
|
-
var
|
|
30
|
+
const A = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, T = "__vueuse_ssr_handlers__";
|
|
31
|
+
A[T] = A[T] || {};
|
|
32
|
+
A[T];
|
|
33
|
+
var j = Object.getOwnPropertySymbols, $e = Object.prototype.hasOwnProperty, Re = Object.prototype.propertyIsEnumerable, Be = (e, t) => {
|
|
34
34
|
var n = {};
|
|
35
35
|
for (var o in e)
|
|
36
|
-
|
|
37
|
-
if (e != null &&
|
|
38
|
-
for (var o of
|
|
39
|
-
t.indexOf(o) < 0 &&
|
|
36
|
+
$e.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
|
|
37
|
+
if (e != null && j)
|
|
38
|
+
for (var o of j(e))
|
|
39
|
+
t.indexOf(o) < 0 && Re.call(e, o) && (n[o] = e[o]);
|
|
40
40
|
return n;
|
|
41
41
|
};
|
|
42
|
-
function
|
|
43
|
-
const o = n, { window: s =
|
|
42
|
+
function ke(e, t, n = {}) {
|
|
43
|
+
const o = n, { window: s = Ae } = o, a = Be(o, ["window"]);
|
|
44
44
|
let l;
|
|
45
45
|
const i = Te(() => s && "ResizeObserver" in s), r = () => {
|
|
46
46
|
l && (l.disconnect(), l = void 0);
|
|
47
|
-
}, u =
|
|
47
|
+
}, u = $(() => D(e), (S) => {
|
|
48
48
|
r(), i.value && s && S && (l = new ResizeObserver(t), l.observe(S, a));
|
|
49
49
|
}, { immediate: !0, flush: "post" }), O = () => {
|
|
50
50
|
r(), u();
|
|
@@ -54,31 +54,31 @@ function Be(e, t, n = {}) {
|
|
|
54
54
|
stop: O
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function ze(e, t = { width: 0, height: 0 }, n = {}) {
|
|
58
58
|
const { box: o = "content-box" } = n, s = _(t.width), a = _(t.height);
|
|
59
|
-
return
|
|
59
|
+
return ke(e, ([l]) => {
|
|
60
60
|
const i = o === "border-box" ? l.borderBoxSize : o === "content-box" ? l.contentBoxSize : l.devicePixelContentBoxSize;
|
|
61
61
|
i ? (s.value = i.reduce((r, { inlineSize: u }) => r + u, 0), a.value = i.reduce((r, { blockSize: u }) => r + u, 0)) : (s.value = l.contentRect.width, a.value = l.contentRect.height);
|
|
62
|
-
}, n),
|
|
62
|
+
}, n), $(() => D(e), (l) => {
|
|
63
63
|
s.value = l ? t.width : 0, a.value = l ? t.height : 0;
|
|
64
64
|
}), {
|
|
65
65
|
width: s,
|
|
66
66
|
height: a
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
var
|
|
69
|
+
var F;
|
|
70
70
|
(function(e) {
|
|
71
71
|
e.UP = "UP", e.RIGHT = "RIGHT", e.DOWN = "DOWN", e.LEFT = "LEFT", e.NONE = "NONE";
|
|
72
|
-
})(
|
|
73
|
-
var
|
|
72
|
+
})(F || (F = {}));
|
|
73
|
+
var He = Object.defineProperty, N = Object.getOwnPropertySymbols, Ke = Object.prototype.hasOwnProperty, Le = Object.prototype.propertyIsEnumerable, Q = (e, t, n) => t in e ? He(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, je = (e, t) => {
|
|
74
74
|
for (var n in t || (t = {}))
|
|
75
|
-
|
|
76
|
-
if (
|
|
77
|
-
for (var n of
|
|
78
|
-
|
|
75
|
+
Ke.call(t, n) && Q(e, n, t[n]);
|
|
76
|
+
if (N)
|
|
77
|
+
for (var n of N(t))
|
|
78
|
+
Le.call(t, n) && Q(e, n, t[n]);
|
|
79
79
|
return e;
|
|
80
80
|
};
|
|
81
|
-
const
|
|
81
|
+
const Fe = {
|
|
82
82
|
easeInSine: [0.12, 0, 0.39, 0],
|
|
83
83
|
easeOutSine: [0.61, 1, 0.88, 1],
|
|
84
84
|
easeInOutSine: [0.37, 0, 0.63, 1],
|
|
@@ -104,11 +104,11 @@ const je = {
|
|
|
104
104
|
easeOutBack: [0.34, 1.56, 0.64, 1],
|
|
105
105
|
easeInOutBack: [0.68, -0.6, 0.32, 1.6]
|
|
106
106
|
};
|
|
107
|
-
|
|
108
|
-
linear:
|
|
109
|
-
},
|
|
110
|
-
function
|
|
111
|
-
const n = _(), o =
|
|
107
|
+
je({
|
|
108
|
+
linear: Pe
|
|
109
|
+
}, Fe);
|
|
110
|
+
function Ne(e, t) {
|
|
111
|
+
const n = _(), o = ze(n), s = _([]), a = _(0), l = fe(e), i = _({ start: 0, end: 10 }), { itemHeight: r, overscan: u = 5 } = t, O = (c) => {
|
|
112
112
|
const { start: h = 0 } = i.value;
|
|
113
113
|
let v = 0, p = 0;
|
|
114
114
|
for (let g = h; g < l.value.length; g++)
|
|
@@ -128,36 +128,36 @@ function Fe(e, t) {
|
|
|
128
128
|
};
|
|
129
129
|
let d;
|
|
130
130
|
const f = () => {
|
|
131
|
-
cancelAnimationFrame(d), d = requestAnimationFrame(
|
|
132
|
-
},
|
|
131
|
+
cancelAnimationFrame(d), d = requestAnimationFrame(B);
|
|
132
|
+
}, B = () => {
|
|
133
133
|
const c = n.value;
|
|
134
134
|
if (c) {
|
|
135
135
|
const h = S(c.scrollTop), v = O(c.clientHeight), p = h - u, g = h + v + u;
|
|
136
136
|
i.value = {
|
|
137
137
|
start: p < 0 ? 0 : p,
|
|
138
138
|
end: g > l.value.length ? l.value.length : g
|
|
139
|
-
}, s.value = l.value.slice(i.value.start, i.value.end).map((
|
|
140
|
-
data:
|
|
139
|
+
}, s.value = l.value.slice(i.value.start, i.value.end).map((z, ae) => ({
|
|
140
|
+
data: z,
|
|
141
141
|
index: ae + i.value.start
|
|
142
142
|
}));
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
|
-
|
|
145
|
+
V(() => {
|
|
146
146
|
}), ve(() => {
|
|
147
147
|
cancelAnimationFrame(d);
|
|
148
|
-
}),
|
|
148
|
+
}), $(
|
|
149
149
|
[o.width, o.height, l],
|
|
150
150
|
() => {
|
|
151
151
|
f();
|
|
152
152
|
},
|
|
153
153
|
{ deep: !0 }
|
|
154
154
|
);
|
|
155
|
-
const
|
|
156
|
-
n.value && (n.value.scrollTop = c,
|
|
155
|
+
const k = w(() => typeof r == "number" ? l.value.length * r : l.value.reduce((c, h, v) => c + r(v), 0)), te = (c) => typeof r == "number" ? c * r : l.value.slice(0, c).reduce((v, p, g) => v + r(g), 0), ne = (c) => {
|
|
156
|
+
n.value && (n.value.scrollTop = c, B());
|
|
157
157
|
}, oe = w(() => te(i.value.start)), le = w(() => ({
|
|
158
158
|
style: {
|
|
159
159
|
width: "100%",
|
|
160
|
-
height: `${
|
|
160
|
+
height: `${k.value}px`
|
|
161
161
|
}
|
|
162
162
|
})), se = w(() => ({
|
|
163
163
|
style: {
|
|
@@ -167,7 +167,7 @@ function Fe(e, t) {
|
|
|
167
167
|
})), re = { overflowY: "auto" };
|
|
168
168
|
return {
|
|
169
169
|
list: s,
|
|
170
|
-
totalHeight:
|
|
170
|
+
totalHeight: k,
|
|
171
171
|
clientHeight: o.height,
|
|
172
172
|
scrollTo: ne,
|
|
173
173
|
scrollTop: a,
|
|
@@ -183,7 +183,7 @@ function Fe(e, t) {
|
|
|
183
183
|
};
|
|
184
184
|
}
|
|
185
185
|
const M = Symbol(), q = Symbol(), G = Symbol(), Y = Symbol(), J = Symbol(), X = Symbol(), Z = Symbol(), ee = Symbol();
|
|
186
|
-
function
|
|
186
|
+
function Ye() {
|
|
187
187
|
const e = y(M), t = y(q), n = y(G), o = y(Y), s = y(J), a = y(X), l = y(Z), i = y(ee);
|
|
188
188
|
return {
|
|
189
189
|
toggleAll: e,
|
|
@@ -196,7 +196,7 @@ function qe() {
|
|
|
196
196
|
unselectAll: i
|
|
197
197
|
};
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function Je(e, t) {
|
|
200
200
|
const n = _({}), o = w(() => e.value.filter((d) => n.value[d[t]])), s = w(() => o.value.length != 0 && Object.keys(n.value).length == e.value.length);
|
|
201
201
|
function a() {
|
|
202
202
|
e.value.forEach((d) => {
|
|
@@ -239,7 +239,7 @@ function Ge(e, t) {
|
|
|
239
239
|
isAllSelected: s
|
|
240
240
|
};
|
|
241
241
|
}
|
|
242
|
-
const
|
|
242
|
+
const Qe = Symbol(), Ve = /* @__PURE__ */ R({
|
|
243
243
|
__name: "Dialog",
|
|
244
244
|
props: {
|
|
245
245
|
visiable: { type: Boolean, default: !1 },
|
|
@@ -251,19 +251,19 @@ const Ne = Symbol(), Qe = /* @__PURE__ */ B({
|
|
|
251
251
|
const n = e, o = () => {
|
|
252
252
|
n.closeOnClickOverlay && t("update:visiable", !1);
|
|
253
253
|
};
|
|
254
|
-
return b(
|
|
254
|
+
return b(Qe, () => t("update:visiable", !1)), (s, a) => (I(), pe(he, { name: "modal" }, {
|
|
255
255
|
default: ge(() => [
|
|
256
256
|
e.visiable ? (I(), x("div", {
|
|
257
257
|
key: 0,
|
|
258
258
|
onClick: o,
|
|
259
259
|
class: "modal absolute inset-0 bottom-0 z-50 flex bg-stone-900 bg-opacity-50"
|
|
260
260
|
}, [
|
|
261
|
-
|
|
261
|
+
P("div", {
|
|
262
262
|
onClick: a[0] || (a[0] = me(() => {
|
|
263
263
|
}, ["stop"])),
|
|
264
264
|
class: be(["dialog m-auto flex flex-col", e.dialogClass])
|
|
265
265
|
}, [
|
|
266
|
-
|
|
266
|
+
U(s.$slots, "default")
|
|
267
267
|
], 2)
|
|
268
268
|
])) : ye("", !0)
|
|
269
269
|
]),
|
|
@@ -271,12 +271,12 @@ const Ne = Symbol(), Qe = /* @__PURE__ */ B({
|
|
|
271
271
|
}));
|
|
272
272
|
}
|
|
273
273
|
});
|
|
274
|
-
function
|
|
274
|
+
function Xe(e) {
|
|
275
275
|
function t(n, o) {
|
|
276
276
|
const s = document.createElement("div"), a = {
|
|
277
277
|
setup() {
|
|
278
278
|
return () => E(
|
|
279
|
-
|
|
279
|
+
Ve,
|
|
280
280
|
{
|
|
281
281
|
visiable: !0,
|
|
282
282
|
"onUpdate:visiable": () => {
|
|
@@ -298,7 +298,7 @@ function Ye(e) {
|
|
|
298
298
|
create: t
|
|
299
299
|
};
|
|
300
300
|
}
|
|
301
|
-
const
|
|
301
|
+
const Ue = ["xlink:href", "fill", "color"], Ze = /* @__PURE__ */ R({
|
|
302
302
|
__name: "SvgIcon",
|
|
303
303
|
props: {
|
|
304
304
|
prefix: { default: "icon" },
|
|
@@ -314,68 +314,71 @@ const Ve = ["xlink:href", "fill", "color"], Je = /* @__PURE__ */ B({
|
|
|
314
314
|
}));
|
|
315
315
|
return (s, a) => (I(), x("svg", {
|
|
316
316
|
"aria-hidden": "",
|
|
317
|
-
style:
|
|
317
|
+
style: W(m(o))
|
|
318
318
|
}, [
|
|
319
|
-
|
|
319
|
+
P("use", {
|
|
320
320
|
"xlink:href": m(n),
|
|
321
321
|
fill: e.color,
|
|
322
322
|
color: e.color
|
|
323
|
-
}, null, 8,
|
|
323
|
+
}, null, 8, Ue)
|
|
324
324
|
], 4));
|
|
325
325
|
}
|
|
326
|
-
}),
|
|
326
|
+
}), We = { class: "virtualListWrapper" }, De = {
|
|
327
|
+
inheritAttrs: !1
|
|
328
|
+
}, Me = /* @__PURE__ */ R({
|
|
329
|
+
...De,
|
|
327
330
|
__name: "VirtualList",
|
|
328
331
|
props: {
|
|
329
332
|
data: null,
|
|
330
333
|
itemHeight: null
|
|
331
334
|
},
|
|
332
335
|
setup(e) {
|
|
333
|
-
const t = e, { list: n, containerProps: o, wrapperProps: s, innerProps: a } =
|
|
336
|
+
const t = e, { list: n, containerProps: o, wrapperProps: s, innerProps: a } = Ne(
|
|
334
337
|
we(t, "data"),
|
|
335
338
|
{
|
|
336
339
|
itemHeight: (l) => t.itemHeight(0),
|
|
337
340
|
overscan: 10
|
|
338
341
|
}
|
|
339
342
|
);
|
|
340
|
-
return (l, i) => (I(), x("div",
|
|
341
|
-
|
|
343
|
+
return (l, i) => (I(), x("div", We, [
|
|
344
|
+
P("div", Oe({
|
|
342
345
|
onScrollPassive: i[0] || (i[0] = (...r) => m(o).onScroll && m(o).onScroll(...r)),
|
|
343
346
|
ref: m(o).ref,
|
|
344
|
-
style:
|
|
347
|
+
style: m(o).style,
|
|
345
348
|
class: "virtualList"
|
|
346
|
-
}, [
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
(I(!0), x(
|
|
349
|
+
}, l.$attrs), [
|
|
350
|
+
P("div", H(K(m(s))), [
|
|
351
|
+
P("div", H(K(m(a))), [
|
|
352
|
+
(I(!0), x(Se, null, Ie(m(n), ({ index: r, data: u }) => (I(), x("div", {
|
|
350
353
|
key: r,
|
|
351
|
-
style:
|
|
354
|
+
style: W({
|
|
352
355
|
height: `${e.itemHeight(u)}px`,
|
|
353
356
|
display: "flex"
|
|
354
357
|
})
|
|
355
358
|
}, [
|
|
356
|
-
|
|
359
|
+
U(l.$slots, "default", {
|
|
357
360
|
data: u,
|
|
358
361
|
index: r
|
|
359
362
|
}, void 0, !0)
|
|
360
363
|
], 4))), 128))
|
|
361
364
|
], 16)
|
|
362
365
|
], 16)
|
|
363
|
-
],
|
|
366
|
+
], 16)
|
|
364
367
|
]));
|
|
365
368
|
}
|
|
366
369
|
});
|
|
367
|
-
const
|
|
370
|
+
const qe = (e, t) => {
|
|
368
371
|
const n = e.__vccOpts || e;
|
|
369
372
|
for (const [o, s] of t)
|
|
370
373
|
n[o] = s;
|
|
371
374
|
return n;
|
|
372
|
-
},
|
|
375
|
+
}, et = /* @__PURE__ */ qe(Me, [["__scopeId", "data-v-06e648eb"]]);
|
|
373
376
|
export {
|
|
374
|
-
|
|
375
|
-
|
|
377
|
+
Ze as SvgIcon,
|
|
378
|
+
et as VirtualList,
|
|
376
379
|
Y as allSelectedKey,
|
|
377
|
-
|
|
378
|
-
|
|
380
|
+
Qe as closeDialogKey,
|
|
381
|
+
Xe as dialogController,
|
|
379
382
|
Z as isAllSelectedKey,
|
|
380
383
|
G as isSelectedKey,
|
|
381
384
|
J as selectKey,
|
|
@@ -383,7 +386,7 @@ export {
|
|
|
383
386
|
q as toggleKey,
|
|
384
387
|
ee as unselectAllKey,
|
|
385
388
|
X as unselectKey,
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
+
Je as useSelectable,
|
|
390
|
+
Ye as useSelectableInjectors,
|
|
391
|
+
Ne as useVirtualList
|
|
389
392
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(c,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(c=typeof globalThis<"u"?globalThis:c||self,e(c.ui={},c.Vue))})(this,function(c,e){"use strict";var
|
|
1
|
+
(function(c,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(c=typeof globalThis<"u"?globalThis:c||self,e(c.ui={},c.Vue))})(this,function(c,e){"use strict";var A;const O=typeof window<"u";O&&((A=window?.navigator)==null?void 0:A.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function Q(t){return typeof t=="function"?t():e.unref(t)}function M(t){return t}function D(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function U(t,n=!0){e.getCurrentInstance()?e.onMounted(t):n?t():e.nextTick(t)}function K(t){var n;const o=Q(t);return(n=o?.$el)!=null?n:o}const W=O?window:void 0;O&&window.document,O&&window.navigator,O&&window.location;function q(t,n=!1){const o=e.ref(),l=()=>o.value=Boolean(t());return l(),U(l,n),o}const S=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},v="__vueuse_ssr_handlers__";S[v]=S[v]||{},S[v];var x=Object.getOwnPropertySymbols,G=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable,J=(t,n)=>{var o={};for(var l in t)G.call(t,l)&&n.indexOf(l)<0&&(o[l]=t[l]);if(t!=null&&x)for(var l of x(t))n.indexOf(l)<0&&Y.call(t,l)&&(o[l]=t[l]);return o};function X(t,n,o={}){const l=o,{window:s=W}=l,a=J(l,["window"]);let r;const d=q(()=>s&&"ResizeObserver"in s),i=()=>{r&&(r.disconnect(),r=void 0)},f=e.watch(()=>K(t),w=>{i(),d.value&&s&&w&&(r=new ResizeObserver(n),r.observe(w,a))},{immediate:!0,flush:"post"}),_=()=>{i(),f()};return D(_),{isSupported:d,stop:_}}function Z(t,n={width:0,height:0},o={}){const{box:l="content-box"}=o,s=e.ref(n.width),a=e.ref(n.height);return X(t,([r])=>{const d=l==="border-box"?r.borderBoxSize:l==="content-box"?r.contentBoxSize:r.devicePixelContentBoxSize;d?(s.value=d.reduce((i,{inlineSize:f})=>i+f,0),a.value=d.reduce((i,{blockSize:f})=>i+f,0)):(s.value=r.contentRect.width,a.value=r.contentRect.height)},o),e.watch(()=>K(t),r=>{s.value=r?n.width:0,a.value=r?n.height:0}),{width:s,height:a}}var $;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})($||($={}));var ee=Object.defineProperty,V=Object.getOwnPropertySymbols,te=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable,R=(t,n,o)=>n in t?ee(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,oe=(t,n)=>{for(var o in n||(n={}))te.call(n,o)&&R(t,o,n[o]);if(V)for(var o of V(n))ne.call(n,o)&&R(t,o,n[o]);return t};oe({linear:M},{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 N(t,n){const o=e.ref(),l=Z(o),s=e.ref([]),a=e.ref(0),r=e.shallowRef(t),d=e.ref({start:0,end:10}),{itemHeight:i,overscan:f=5}=n,_=u=>{const{start:y=0}=d.value;let g=0,m=0;for(let b=y;b<r.value.length;b++)if(g+=i(b),g>=u){m=b;break}return m-y},w=u=>{let y=0,g=0;for(let m=0;m<r.value.length;m++)if(y+=i(m),y>=u){g=m;break}return g};let p;const h=()=>{cancelAnimationFrame(p),p=requestAnimationFrame(L)},L=()=>{const u=o.value;if(u){const y=w(u.scrollTop),g=_(u.clientHeight),m=y-f,b=y+g+f;d.value={start:m<0?0:m,end:b>r.value.length?r.value.length:b},s.value=r.value.slice(d.value.start,d.value.end).map((F,we)=>({data:F,index:we+d.value.start}))}};e.onMounted(()=>{}),e.onUnmounted(()=>{cancelAnimationFrame(p)}),e.watch([l.width,l.height,r],()=>{h()},{deep:!0});const H=e.computed(()=>typeof i=="number"?r.value.length*i:r.value.reduce((u,y,g)=>u+i(g),0)),he=u=>typeof i=="number"?u*i:r.value.slice(0,u).reduce((g,m,b)=>g+i(b),0),ge=u=>{o.value&&(o.value.scrollTop=u,L())},me=e.computed(()=>he(d.value.start)),ye=e.computed(()=>({style:{width:"100%",height:`${H.value}px`}})),be=e.computed(()=>({style:{transform:`translate3d(0, ${me.value}px, 0)`,"will-change":"transform"}})),_e={overflowY:"auto"};return{list:s,totalHeight:H,clientHeight:l.height,scrollTo:ge,scrollTop:a,containerProps:{ref:o,onScroll:u=>{u.target&&(a.value=u.target.scrollTop),h()},style:_e},wrapperProps:ye,innerProps:be}}const I=Symbol(),P=Symbol(),C=Symbol(),E=Symbol(),B=Symbol(),T=Symbol(),j=Symbol(),k=Symbol();function le(){const t=e.inject(I),n=e.inject(P),o=e.inject(C),l=e.inject(E),s=e.inject(B),a=e.inject(T),r=e.inject(j),d=e.inject(k);return{toggleAll:t,toggle:n,isSelected:o,selected:l,select:s,unselect:a,isAllSelected:r,unselectAll:d}}function re(t,n){const o=e.ref({}),l=e.computed(()=>t.value.filter(p=>o.value[p[n]])),s=e.computed(()=>l.value.length!=0&&Object.keys(o.value).length==t.value.length);function a(){t.value.forEach(p=>{o.value[p[n]]=!0})}function r(){o.value={}}function d(p){p.forEach(h=>{o.value[h[n]]||(o.value[h[n]]=!0)})}function i(p){p.forEach(h=>{o.value[h[n]]&&delete o.value[h[n]]})}function f(p){return!!o.value[p[n]]}function _(p){p.forEach(h=>{f(h)?delete o.value[h[n]]:o.value[h[n]]=!0})}function w(){s.value?r():a()}return e.provide(I,w),e.provide(P,_),e.provide(C,f),e.provide(E,l),e.provide(B,d),e.provide(T,i),e.provide(j,s),e.provide(k,r),{selected:l,select:d,selectAll:a,unselect:i,unselectAll:r,toggle:_,toggleAll:w,isSelected:f,isAllSelected:s}}const z=Symbol(),se=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0},dialogClass:{default:""}},emits:["update:visiable"],setup(t,{emit:n}){const o=t,l=()=>{o.closeOnClickOverlay&&n("update:visiable",!1)};return e.provide(z,()=>n("update:visiable",!1)),(s,a)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[t.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:l,class:"modal absolute inset-0 bottom-0 z-50 flex bg-stone-900 bg-opacity-50"},[e.createElementVNode("div",{onClick:a[0]||(a[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog m-auto flex flex-col",t.dialogClass])},[e.renderSlot(s.$slots,"default")],2)])):e.createCommentVNode("",!0)]),_:3}))}});function ie(t){function n(o,l){const s=document.createElement("div"),a={setup(){return()=>e.h(se,{visiable:!0,"onUpdate:visiable":()=>{s?.remove()},...t},{default:()=>e.h(o,l)})}};return document.body.appendChild(s),e.render(e.h(a),s),{close:()=>s?.remove()}}return{create:n}}const ae=["xlink:href","fill","color"],ce=e.defineComponent({__name:"SvgIcon",props:{prefix:{default:"icon"},name:null,color:{default:"#FFF"},width:{default:16},height:{default:16}},setup(t){const n=t,o=e.computed(()=>`#${n.prefix}-${n.name}`),l=e.computed(()=>({width:n.width,height:n.height}));return(s,a)=>(e.openBlock(),e.createElementBlock("svg",{"aria-hidden":"",style:e.normalizeStyle(e.unref(l))},[e.createElementVNode("use",{"xlink:href":e.unref(o),fill:t.color,color:t.color},null,8,ae)],4))}}),de={class:"virtualListWrapper"},ue={inheritAttrs:!1},fe=e.defineComponent({...ue,__name:"VirtualList",props:{data:null,itemHeight:null},setup(t){const n=t,{list:o,containerProps:l,wrapperProps:s,innerProps:a}=N(e.toRef(n,"data"),{itemHeight:r=>n.itemHeight(0),overscan:10});return(r,d)=>(e.openBlock(),e.createElementBlock("div",de,[e.createElementVNode("div",e.mergeProps({onScrollPassive:d[0]||(d[0]=(...i)=>e.unref(l).onScroll&&e.unref(l).onScroll(...i)),ref:e.unref(l).ref,style:e.unref(l).style,class:"virtualList"},r.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(s))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(a))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(o),({index:i,data:f})=>(e.openBlock(),e.createElementBlock("div",{key:i,style:e.normalizeStyle({height:`${t.itemHeight(f)}px`,display:"flex"})},[e.renderSlot(r.$slots,"default",{data:f,index:i},void 0,!0)],4))),128))],16)],16)],16)]))}}),Se="",pe=((t,n)=>{const o=t.__vccOpts||t;for(const[l,s]of n)o[l]=s;return o})(fe,[["__scopeId","data-v-06e648eb"]]);c.SvgIcon=ce,c.VirtualList=pe,c.allSelectedKey=E,c.closeDialogKey=z,c.dialogController=ie,c.isAllSelectedKey=j,c.isSelectedKey=C,c.selectKey=B,c.toggleAllKey=I,c.toggleKey=P,c.unselectAllKey=k,c.unselectKey=T,c.useSelectable=re,c.useSelectableInjectors=le,c.useVirtualList=N,Object.defineProperties(c,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.virtualListWrapper[data-v-
|
|
1
|
+
.virtualListWrapper[data-v-06e648eb]{width:100%;height:100%;position:relative}.virtualList[data-v-06e648eb] ::-webkit-scrollbar{display:none}.virtualList[data-v-06e648eb]{width:100%;height:100%;position:absolute;top:0}
|