@lazycatcloud/lzc-toolkit 0.0.17 → 0.0.19
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 +81 -79
- 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,11 +1,11 @@
|
|
|
1
|
-
import { unref as m, getCurrentScope as ie, onScopeDispose as ce, getCurrentInstance as ue, onMounted as U, nextTick as de, ref as _, watch as
|
|
2
|
-
var
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
function
|
|
1
|
+
import { unref as m, getCurrentScope as ie, onScopeDispose as ce, getCurrentInstance as ue, onMounted as U, nextTick as de, ref as _, watch as R, shallowRef as fe, onUnmounted as ve, computed as w, inject as y, provide as b, defineComponent as B, openBlock as I, createBlock as pe, Transition as he, withCtx as ge, createElementBlock as x, createElementVNode as C, withModifiers as me, normalizeClass as be, renderSlot as W, createCommentVNode as ye, render as _e, h as E, normalizeStyle as T, toRef as we, normalizeProps as K, guardReactiveProps as L, Fragment as Oe, renderList as Se } from "vue";
|
|
2
|
+
var j;
|
|
3
|
+
const P = typeof window < "u";
|
|
4
|
+
P && ((j = window?.navigator) == null ? void 0 : j.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
5
|
+
function Ie(e) {
|
|
6
6
|
return typeof e == "function" ? e() : m(e);
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function xe(e) {
|
|
9
9
|
return e;
|
|
10
10
|
}
|
|
11
11
|
function Ce(e) {
|
|
@@ -14,37 +14,37 @@ function Ce(e) {
|
|
|
14
14
|
function Pe(e, t = !0) {
|
|
15
15
|
ue() ? U(e) : t ? e() : de(e);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function D(e) {
|
|
18
18
|
var t;
|
|
19
|
-
const n =
|
|
19
|
+
const n = Ie(e);
|
|
20
20
|
return (t = n?.$el) != null ? t : n;
|
|
21
21
|
}
|
|
22
|
-
const Ee =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
const Ee = P ? window : void 0;
|
|
23
|
+
P && window.document;
|
|
24
|
+
P && window.navigator;
|
|
25
|
+
P && window.location;
|
|
26
26
|
function Te(e, t = !1) {
|
|
27
27
|
const n = _(), o = () => n.value = Boolean(e());
|
|
28
28
|
return o(), Pe(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 : {}, $ = "__vueuse_ssr_handlers__";
|
|
31
|
+
A[$] = A[$] || {};
|
|
32
|
+
A[$];
|
|
33
|
+
var F = Object.getOwnPropertySymbols, Ae = Object.prototype.hasOwnProperty, $e = Object.prototype.propertyIsEnumerable, Re = (e, t) => {
|
|
34
34
|
var n = {};
|
|
35
35
|
for (var o in e)
|
|
36
36
|
Ae.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
|
|
37
|
-
if (e != null &&
|
|
38
|
-
for (var o of
|
|
39
|
-
t.indexOf(o) < 0 &&
|
|
37
|
+
if (e != null && F)
|
|
38
|
+
for (var o of F(e))
|
|
39
|
+
t.indexOf(o) < 0 && $e.call(e, o) && (n[o] = e[o]);
|
|
40
40
|
return n;
|
|
41
41
|
};
|
|
42
|
-
function
|
|
43
|
-
const o = n, { window: s = Ee } = o, a =
|
|
42
|
+
function Be(e, t, n = {}) {
|
|
43
|
+
const o = n, { window: s = Ee } = o, a = Re(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 = R(() => 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();
|
|
@@ -56,29 +56,29 @@ function Re(e, t, n = {}) {
|
|
|
56
56
|
}
|
|
57
57
|
function ke(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 Be(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), R(() => 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 N;
|
|
70
70
|
(function(e) {
|
|
71
71
|
e.UP = "UP", e.RIGHT = "RIGHT", e.DOWN = "DOWN", e.LEFT = "LEFT", e.NONE = "NONE";
|
|
72
|
-
})(
|
|
73
|
-
var ze = Object.defineProperty,
|
|
72
|
+
})(N || (N = {}));
|
|
73
|
+
var ze = Object.defineProperty, Q = Object.getOwnPropertySymbols, He = Object.prototype.hasOwnProperty, Ke = Object.prototype.propertyIsEnumerable, V = (e, t, n) => t in e ? ze(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Le = (e, t) => {
|
|
74
74
|
for (var n in t || (t = {}))
|
|
75
75
|
He.call(t, n) && V(e, n, t[n]);
|
|
76
|
-
if (
|
|
77
|
-
for (var n of
|
|
76
|
+
if (Q)
|
|
77
|
+
for (var n of Q(t))
|
|
78
78
|
Ke.call(t, n) && V(e, n, t[n]);
|
|
79
79
|
return e;
|
|
80
80
|
};
|
|
81
|
-
const
|
|
81
|
+
const je = {
|
|
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,10 +104,10 @@ const Fe = {
|
|
|
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
|
|
107
|
+
Le({
|
|
108
|
+
linear: xe
|
|
109
|
+
}, je);
|
|
110
|
+
function Fe(e, t) {
|
|
111
111
|
const n = _(), o = ke(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;
|
|
@@ -145,7 +145,7 @@ function Ne(e, t) {
|
|
|
145
145
|
U(() => {
|
|
146
146
|
}), ve(() => {
|
|
147
147
|
cancelAnimationFrame(d);
|
|
148
|
-
}),
|
|
148
|
+
}), R(
|
|
149
149
|
[o.width, o.height, l],
|
|
150
150
|
() => {
|
|
151
151
|
f();
|
|
@@ -183,7 +183,7 @@ function Ne(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 qe() {
|
|
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 Me() {
|
|
|
196
196
|
unselectAll: i
|
|
197
197
|
};
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function Ge(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 qe(e, t) {
|
|
|
239
239
|
isAllSelected: s
|
|
240
240
|
};
|
|
241
241
|
}
|
|
242
|
-
const
|
|
242
|
+
const Ne = Symbol(), Qe = /* @__PURE__ */ B({
|
|
243
243
|
__name: "Dialog",
|
|
244
244
|
props: {
|
|
245
245
|
visiable: { type: Boolean, default: !1 },
|
|
@@ -251,19 +251,19 @@ const Qe = Symbol(), Le = /* @__PURE__ */ R({
|
|
|
251
251
|
const n = e, o = () => {
|
|
252
252
|
n.closeOnClickOverlay && t("update:visiable", !1);
|
|
253
253
|
};
|
|
254
|
-
return b(
|
|
254
|
+
return b(Ne, () => t("update:visiable", !1)), (s, a) => (I(), pe(he, { name: "modal" }, {
|
|
255
255
|
default: ge(() => [
|
|
256
|
-
e.visiable ? (
|
|
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
|
+
C("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
|
+
W(s.$slots, "default")
|
|
267
267
|
], 2)
|
|
268
268
|
])) : ye("", !0)
|
|
269
269
|
]),
|
|
@@ -271,12 +271,12 @@ const Qe = Symbol(), Le = /* @__PURE__ */ R({
|
|
|
271
271
|
}));
|
|
272
272
|
}
|
|
273
273
|
});
|
|
274
|
-
function
|
|
274
|
+
function Ye(e) {
|
|
275
275
|
function t(n, o) {
|
|
276
276
|
const s = document.createElement("div"), a = {
|
|
277
277
|
setup() {
|
|
278
278
|
return () => E(
|
|
279
|
-
|
|
279
|
+
Qe,
|
|
280
280
|
{
|
|
281
281
|
visiable: !0,
|
|
282
282
|
"onUpdate:visiable": () => {
|
|
@@ -298,7 +298,7 @@ function Ge(e) {
|
|
|
298
298
|
create: t
|
|
299
299
|
};
|
|
300
300
|
}
|
|
301
|
-
const Ve = ["xlink:href", "fill", "color"],
|
|
301
|
+
const Ve = ["xlink:href", "fill", "color"], Je = /* @__PURE__ */ B({
|
|
302
302
|
__name: "SvgIcon",
|
|
303
303
|
props: {
|
|
304
304
|
prefix: { default: "icon" },
|
|
@@ -312,54 +312,56 @@ const Ve = ["xlink:href", "fill", "color"], Ye = /* @__PURE__ */ R({
|
|
|
312
312
|
width: t.width,
|
|
313
313
|
height: t.height
|
|
314
314
|
}));
|
|
315
|
-
return (s, a) => (
|
|
315
|
+
return (s, a) => (I(), x("svg", {
|
|
316
316
|
"aria-hidden": "",
|
|
317
317
|
style: T(m(o))
|
|
318
318
|
}, [
|
|
319
|
-
|
|
319
|
+
C("use", {
|
|
320
320
|
"xlink:href": m(n),
|
|
321
321
|
fill: e.color,
|
|
322
322
|
color: e.color
|
|
323
323
|
}, null, 8, Ve)
|
|
324
324
|
], 4));
|
|
325
325
|
}
|
|
326
|
-
}), Ue = /* @__PURE__ */
|
|
326
|
+
}), Ue = { class: "virtualListWrapper" }, We = /* @__PURE__ */ B({
|
|
327
327
|
__name: "VirtualList",
|
|
328
328
|
props: {
|
|
329
329
|
data: null,
|
|
330
330
|
itemHeight: null
|
|
331
331
|
},
|
|
332
332
|
setup(e) {
|
|
333
|
-
const t = e, { list: n, containerProps: o, wrapperProps: s, innerProps: a } =
|
|
333
|
+
const t = e, { list: n, containerProps: o, wrapperProps: s, innerProps: a } = Fe(
|
|
334
334
|
we(t, "data"),
|
|
335
335
|
{
|
|
336
336
|
itemHeight: (l) => t.itemHeight(0),
|
|
337
337
|
overscan: 10
|
|
338
338
|
}
|
|
339
339
|
);
|
|
340
|
-
return (l, i) => (
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
(
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
340
|
+
return (l, i) => (I(), x("div", Ue, [
|
|
341
|
+
C("div", {
|
|
342
|
+
onScrollPassive: i[0] || (i[0] = (...r) => m(o).onScroll && m(o).onScroll(...r)),
|
|
343
|
+
ref: m(o).ref,
|
|
344
|
+
style: T(m(o).style),
|
|
345
|
+
class: "virtualList"
|
|
346
|
+
}, [
|
|
347
|
+
C("div", K(L(m(s))), [
|
|
348
|
+
C("div", K(L(m(a))), [
|
|
349
|
+
(I(!0), x(Oe, null, Se(m(n), ({ index: r, data: u }) => (I(), x("div", {
|
|
350
|
+
key: r,
|
|
351
|
+
style: T({
|
|
352
|
+
height: `${e.itemHeight(u)}px`,
|
|
353
|
+
display: "flex"
|
|
354
|
+
})
|
|
355
|
+
}, [
|
|
356
|
+
W(l.$slots, "default", {
|
|
357
|
+
data: u,
|
|
358
|
+
index: r
|
|
359
|
+
}, void 0, !0)
|
|
360
|
+
], 4))), 128))
|
|
361
|
+
], 16)
|
|
360
362
|
], 16)
|
|
361
|
-
],
|
|
362
|
-
]
|
|
363
|
+
], 36)
|
|
364
|
+
]));
|
|
363
365
|
}
|
|
364
366
|
});
|
|
365
367
|
const De = (e, t) => {
|
|
@@ -367,13 +369,13 @@ const De = (e, t) => {
|
|
|
367
369
|
for (const [o, s] of t)
|
|
368
370
|
n[o] = s;
|
|
369
371
|
return n;
|
|
370
|
-
},
|
|
372
|
+
}, Xe = /* @__PURE__ */ De(We, [["__scopeId", "data-v-e5ab2b81"]]);
|
|
371
373
|
export {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
+
Je as SvgIcon,
|
|
375
|
+
Xe as VirtualList,
|
|
374
376
|
Y as allSelectedKey,
|
|
375
|
-
|
|
376
|
-
|
|
377
|
+
Ne as closeDialogKey,
|
|
378
|
+
Ye as dialogController,
|
|
377
379
|
Z as isAllSelectedKey,
|
|
378
380
|
G as isSelectedKey,
|
|
379
381
|
J as selectKey,
|
|
@@ -381,7 +383,7 @@ export {
|
|
|
381
383
|
q as toggleKey,
|
|
382
384
|
ee as unselectAllKey,
|
|
383
385
|
X as unselectKey,
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
386
|
+
Ge as useSelectable,
|
|
387
|
+
qe as useSelectableInjectors,
|
|
388
|
+
Fe as useVirtualList
|
|
387
389
|
};
|
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 K;const O=typeof window<"u";O&&((K=window?.navigator)==null?void 0:K.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
|
|
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 K;const O=typeof window<"u";O&&((K=window?.navigator)==null?void 0:K.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 A(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(()=>A(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(()=>A(t),r=>{s.value=r?n.width:0,a.value=r?n.height:0}),{width:s,height:a}}var V;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(V||(V={}));var ee=Object.defineProperty,$=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($)for(var o of $(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 z(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,_e)=>({data:F,index:_e+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)),pe=u=>typeof i=="number"?u*i:r.value.slice(0,u).reduce((g,m,b)=>g+i(b),0),he=u=>{o.value&&(o.value.scrollTop=u,L())},ge=e.computed(()=>pe(d.value.start)),me=e.computed(()=>({style:{width:"100%",height:`${H.value}px`}})),ye=e.computed(()=>({style:{transform:`translate3d(0, ${ge.value}px, 0)`,"will-change":"transform"}})),be={overflowY:"auto"};return{list:s,totalHeight:H,clientHeight:l.height,scrollTo:he,scrollTop:a,containerProps:{ref:o,onScroll:u=>{u.target&&(a.value=u.target.scrollTop),h()},style:be},wrapperProps:me,innerProps:ye}}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 N=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(N,()=>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=e.defineComponent({__name:"VirtualList",props:{data:null,itemHeight:null},setup(t){const n=t,{list:o,containerProps:l,wrapperProps:s,innerProps:a}=z(e.toRef(n,"data"),{itemHeight:r=>n.itemHeight(0),overscan:10});return(r,d)=>(e.openBlock(),e.createElementBlock("div",de,[e.createElementVNode("div",{onScrollPassive:d[0]||(d[0]=(...i)=>e.unref(l).onScroll&&e.unref(l).onScroll(...i)),ref:e.unref(l).ref,style:e.normalizeStyle(e.unref(l).style),class:"virtualList"},[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)],36)]))}}),Oe="",fe=((t,n)=>{const o=t.__vccOpts||t;for(const[l,s]of n)o[l]=s;return o})(ue,[["__scopeId","data-v-e5ab2b81"]]);c.SvgIcon=ce,c.VirtualList=fe,c.allSelectedKey=E,c.closeDialogKey=N,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=z,Object.defineProperties(c,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
.virtualListWrapper[data-v-e5ab2b81]{width:100%;height:100%;position:relative}.virtualList[data-v-e5ab2b81] ::-webkit-scrollbar{display:none}.virtualList[data-v-e5ab2b81]{width:100%;height:100%;position:absolute;top:0;-ms-overflow-style:none;scrollbar-width:none}
|