@lazycatcloud/lzc-toolkit 0.0.10 → 0.0.12
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 +79 -79
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unref as y, getCurrentScope as ee, onScopeDispose as te, getCurrentInstance as ne, onMounted as j, nextTick as oe, ref as b, watch as T, shallowRef as le, onUnmounted as F, computed as O, provide as m, defineComponent as D, openBlock as S, createBlock as re, Transition as se, withCtx as ae, createElementBlock as I, createElementVNode as x, withModifiers as ie, renderSlot as U, createCommentVNode as ue, render as ce, createVNode as
|
|
1
|
+
import { unref as y, getCurrentScope as ee, onScopeDispose as te, getCurrentInstance as ne, onMounted as j, nextTick as oe, ref as b, watch as T, shallowRef as le, onUnmounted as F, computed as O, provide as m, defineComponent as D, openBlock as S, createBlock as re, Transition as se, withCtx as ae, createElementBlock as I, createElementVNode as x, withModifiers as ie, renderSlot as U, createCommentVNode as ue, render as ce, createVNode as fe, h as N, toRef as de, normalizeStyle as $, normalizeProps as H, guardReactiveProps as K, Fragment as ve, renderList as pe } from "vue";
|
|
2
2
|
var V;
|
|
3
3
|
const P = typeof window < "u";
|
|
4
4
|
P && ((V = window?.navigator) == null ? void 0 : V.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
@@ -11,41 +11,41 @@ function ge(e) {
|
|
|
11
11
|
function me(e) {
|
|
12
12
|
return ee() ? (te(e), !0) : !1;
|
|
13
13
|
}
|
|
14
|
-
function be(e,
|
|
15
|
-
ne() ? j(e) :
|
|
14
|
+
function be(e, n = !0) {
|
|
15
|
+
ne() ? j(e) : n ? e() : oe(e);
|
|
16
16
|
}
|
|
17
17
|
function M(e) {
|
|
18
|
-
var
|
|
19
|
-
const
|
|
20
|
-
return (
|
|
18
|
+
var n;
|
|
19
|
+
const t = he(e);
|
|
20
|
+
return (n = t?.$el) != null ? n : t;
|
|
21
21
|
}
|
|
22
22
|
const ye = P ? window : void 0;
|
|
23
23
|
P && window.document;
|
|
24
24
|
P && window.navigator;
|
|
25
25
|
P && window.location;
|
|
26
|
-
function we(e,
|
|
27
|
-
const
|
|
28
|
-
return l(), be(l,
|
|
26
|
+
function we(e, n = !1) {
|
|
27
|
+
const t = b(), l = () => t.value = Boolean(e());
|
|
28
|
+
return l(), be(l, n), t;
|
|
29
29
|
}
|
|
30
30
|
const C = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, E = "__vueuse_ssr_handlers__";
|
|
31
31
|
C[E] = C[E] || {};
|
|
32
32
|
C[E];
|
|
33
|
-
var z = Object.getOwnPropertySymbols, _e = Object.prototype.hasOwnProperty, Oe = Object.prototype.propertyIsEnumerable, Se = (e,
|
|
34
|
-
var
|
|
33
|
+
var z = Object.getOwnPropertySymbols, _e = Object.prototype.hasOwnProperty, Oe = Object.prototype.propertyIsEnumerable, Se = (e, n) => {
|
|
34
|
+
var t = {};
|
|
35
35
|
for (var l in e)
|
|
36
|
-
_e.call(e, l) &&
|
|
36
|
+
_e.call(e, l) && n.indexOf(l) < 0 && (t[l] = e[l]);
|
|
37
37
|
if (e != null && z)
|
|
38
38
|
for (var l of z(e))
|
|
39
|
-
|
|
40
|
-
return
|
|
39
|
+
n.indexOf(l) < 0 && Oe.call(e, l) && (t[l] = e[l]);
|
|
40
|
+
return t;
|
|
41
41
|
};
|
|
42
|
-
function Pe(e,
|
|
43
|
-
const l =
|
|
42
|
+
function Pe(e, n, t = {}) {
|
|
43
|
+
const l = t, { window: a = ye } = l, i = Se(l, ["window"]);
|
|
44
44
|
let o;
|
|
45
45
|
const r = we(() => a && "ResizeObserver" in a), s = () => {
|
|
46
46
|
o && (o.disconnect(), o = void 0);
|
|
47
47
|
}, c = T(() => M(e), (_) => {
|
|
48
|
-
s(), r.value && a && _ && (o = new ResizeObserver(
|
|
48
|
+
s(), r.value && a && _ && (o = new ResizeObserver(n), o.observe(_, i));
|
|
49
49
|
}, { immediate: !0, flush: "post" }), w = () => {
|
|
50
50
|
s(), c();
|
|
51
51
|
};
|
|
@@ -54,13 +54,13 @@ function Pe(e, t, n = {}) {
|
|
|
54
54
|
stop: w
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
function Ie(e,
|
|
58
|
-
const { box: l = "content-box" } =
|
|
57
|
+
function Ie(e, n = { width: 0, height: 0 }, t = {}) {
|
|
58
|
+
const { box: l = "content-box" } = t, a = b(n.width), i = b(n.height);
|
|
59
59
|
return Pe(e, ([o]) => {
|
|
60
60
|
const r = l === "border-box" ? o.borderBoxSize : l === "content-box" ? o.contentBoxSize : o.devicePixelContentBoxSize;
|
|
61
61
|
r ? (a.value = r.reduce((s, { inlineSize: c }) => s + c, 0), i.value = r.reduce((s, { blockSize: c }) => s + c, 0)) : (a.value = o.contentRect.width, i.value = o.contentRect.height);
|
|
62
|
-
},
|
|
63
|
-
a.value = o ?
|
|
62
|
+
}, t), T(() => M(e), (o) => {
|
|
63
|
+
a.value = o ? n.width : 0, i.value = o ? n.height : 0;
|
|
64
64
|
}), {
|
|
65
65
|
width: a,
|
|
66
66
|
height: i
|
|
@@ -70,12 +70,12 @@ var Q;
|
|
|
70
70
|
(function(e) {
|
|
71
71
|
e.UP = "UP", e.RIGHT = "RIGHT", e.DOWN = "DOWN", e.LEFT = "LEFT", e.NONE = "NONE";
|
|
72
72
|
})(Q || (Q = {}));
|
|
73
|
-
var xe = Object.defineProperty, k = Object.getOwnPropertySymbols, Ce = Object.prototype.hasOwnProperty, Ee = Object.prototype.propertyIsEnumerable, L = (e,
|
|
74
|
-
for (var
|
|
75
|
-
Ce.call(
|
|
73
|
+
var xe = Object.defineProperty, k = Object.getOwnPropertySymbols, Ce = Object.prototype.hasOwnProperty, Ee = Object.prototype.propertyIsEnumerable, L = (e, n, t) => n in e ? xe(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t, Te = (e, n) => {
|
|
74
|
+
for (var t in n || (n = {}))
|
|
75
|
+
Ce.call(n, t) && L(e, t, n[t]);
|
|
76
76
|
if (k)
|
|
77
|
-
for (var
|
|
78
|
-
Ee.call(
|
|
77
|
+
for (var t of k(n))
|
|
78
|
+
Ee.call(n, t) && L(e, t, n[t]);
|
|
79
79
|
return e;
|
|
80
80
|
};
|
|
81
81
|
const Be = {
|
|
@@ -107,8 +107,8 @@ const Be = {
|
|
|
107
107
|
Te({
|
|
108
108
|
linear: ge
|
|
109
109
|
}, Be);
|
|
110
|
-
function Ae(e,
|
|
111
|
-
const
|
|
110
|
+
function Ae(e, n) {
|
|
111
|
+
const t = b(), l = Ie(t), a = b([]), i = b(0), o = le(e), r = b({ start: 0, end: 10 }), { itemHeight: s, overscan: c = 5 } = n, w = (u) => {
|
|
112
112
|
const { start: h = 0 } = r.value;
|
|
113
113
|
let v = 0, p = 0;
|
|
114
114
|
for (let g = h; g < o.value.length; g++)
|
|
@@ -126,11 +126,11 @@ function Ae(e, t) {
|
|
|
126
126
|
}
|
|
127
127
|
return v;
|
|
128
128
|
};
|
|
129
|
-
let
|
|
130
|
-
const
|
|
131
|
-
cancelAnimationFrame(
|
|
129
|
+
let f;
|
|
130
|
+
const d = () => {
|
|
131
|
+
cancelAnimationFrame(f), f = requestAnimationFrame(B);
|
|
132
132
|
}, B = () => {
|
|
133
|
-
const u =
|
|
133
|
+
const u = t.value;
|
|
134
134
|
if (u) {
|
|
135
135
|
const h = _(u.scrollTop), v = w(u.clientHeight), p = h - c, g = h + v + c;
|
|
136
136
|
r.value = {
|
|
@@ -144,16 +144,16 @@ function Ae(e, t) {
|
|
|
144
144
|
};
|
|
145
145
|
j(() => {
|
|
146
146
|
}), F(() => {
|
|
147
|
-
cancelAnimationFrame(
|
|
147
|
+
cancelAnimationFrame(f);
|
|
148
148
|
}), T(
|
|
149
149
|
[l.width, l.height, o],
|
|
150
150
|
() => {
|
|
151
|
-
|
|
151
|
+
d();
|
|
152
152
|
},
|
|
153
153
|
{ deep: !0 }
|
|
154
154
|
);
|
|
155
155
|
const A = O(() => typeof s == "number" ? o.value.length * s : o.value.reduce((u, h, v) => u + s(v), 0)), W = (u) => typeof s == "number" ? u * s : o.value.slice(0, u).reduce((v, p, g) => v + s(g), 0), q = (u) => {
|
|
156
|
-
|
|
156
|
+
t.value && (t.value.scrollTop = u, B());
|
|
157
157
|
}, G = O(() => W(r.value.start)), Y = O(() => ({
|
|
158
158
|
style: {
|
|
159
159
|
width: "100%",
|
|
@@ -172,9 +172,9 @@ function Ae(e, t) {
|
|
|
172
172
|
scrollTo: q,
|
|
173
173
|
scrollTop: i,
|
|
174
174
|
containerProps: {
|
|
175
|
-
ref:
|
|
175
|
+
ref: t,
|
|
176
176
|
onScroll: (u) => {
|
|
177
|
-
u.target && (i.value = u.target.scrollTop),
|
|
177
|
+
u.target && (i.value = u.target.scrollTop), d();
|
|
178
178
|
},
|
|
179
179
|
style: X
|
|
180
180
|
},
|
|
@@ -183,32 +183,32 @@ function Ae(e, t) {
|
|
|
183
183
|
};
|
|
184
184
|
}
|
|
185
185
|
const Re = Symbol(), Ne = Symbol(), $e = Symbol(), He = Symbol(), Ke = Symbol(), Ve = Symbol(), ze = Symbol(), Qe = Symbol();
|
|
186
|
-
function Ue(e,
|
|
187
|
-
const
|
|
186
|
+
function Ue(e, n) {
|
|
187
|
+
const t = b({}), l = O(() => e.value.filter((f) => t.value[f[n]])), a = O(() => l.value.length != 0 && Object.keys(t.value).length == e.value.length);
|
|
188
188
|
function i() {
|
|
189
|
-
e.value.forEach((
|
|
190
|
-
|
|
189
|
+
e.value.forEach((f) => {
|
|
190
|
+
t.value[f[n]] = !0;
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
193
|
function o() {
|
|
194
|
-
|
|
194
|
+
t.value = {};
|
|
195
195
|
}
|
|
196
|
-
function r(
|
|
197
|
-
|
|
198
|
-
|
|
196
|
+
function r(f) {
|
|
197
|
+
f.forEach((d) => {
|
|
198
|
+
t.value[d[n]] || (t.value[d[n]] = !0);
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
|
-
function s(
|
|
202
|
-
|
|
203
|
-
|
|
201
|
+
function s(f) {
|
|
202
|
+
f.forEach((d) => {
|
|
203
|
+
t.value[d[n]] && delete t.value[d[n]];
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
|
-
function c(
|
|
207
|
-
return !!
|
|
206
|
+
function c(f) {
|
|
207
|
+
return !!t.value[f[n]];
|
|
208
208
|
}
|
|
209
|
-
function w(
|
|
210
|
-
|
|
211
|
-
c(
|
|
209
|
+
function w(f) {
|
|
210
|
+
f.forEach((d) => {
|
|
211
|
+
c(d) ? delete t.value[d[n]] : t.value[d[n]] = !0;
|
|
212
212
|
});
|
|
213
213
|
}
|
|
214
214
|
function _() {
|
|
@@ -233,11 +233,11 @@ const ke = Symbol(), Le = /* @__PURE__ */ D({
|
|
|
233
233
|
closeOnClickOverlay: { type: Boolean, default: !0 }
|
|
234
234
|
},
|
|
235
235
|
emits: ["update:show"],
|
|
236
|
-
setup(e, { emit:
|
|
237
|
-
const
|
|
238
|
-
|
|
236
|
+
setup(e, { emit: n }) {
|
|
237
|
+
const t = e, l = () => {
|
|
238
|
+
t.closeOnClickOverlay && n("update:show", !1);
|
|
239
239
|
};
|
|
240
|
-
return m(ke, () =>
|
|
240
|
+
return m(ke, () => n("update:show", !1)), (a, i) => (S(), re(se, { name: "modal" }, {
|
|
241
241
|
default: ae(() => [
|
|
242
242
|
e.visiable ? (S(), I("div", {
|
|
243
243
|
key: 0,
|
|
@@ -258,47 +258,47 @@ const ke = Symbol(), Le = /* @__PURE__ */ D({
|
|
|
258
258
|
}
|
|
259
259
|
});
|
|
260
260
|
function Me() {
|
|
261
|
-
let e = null,
|
|
262
|
-
const
|
|
261
|
+
let e = null, n = null;
|
|
262
|
+
const t = b({});
|
|
263
263
|
function l(o, r, s = !0) {
|
|
264
|
-
return
|
|
264
|
+
return t.value[o] ? (t.value[o].visiable = s, !0) : (t.value[o] = {
|
|
265
265
|
visiable: s,
|
|
266
266
|
componentProps: r
|
|
267
267
|
}, !1);
|
|
268
268
|
}
|
|
269
269
|
function a(o) {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
});
|
|
270
|
+
t.value[o] && (t.value[o].visiable = !1), n && n.childNodes.length > 0 && n.childNodes.forEach((r) => {
|
|
271
|
+
n?.removeChild(r);
|
|
272
|
+
}), t.value = {};
|
|
273
273
|
}
|
|
274
274
|
function i(o) {
|
|
275
|
-
const r =
|
|
276
|
-
if (!l(r, o.componentProps || {})) {
|
|
275
|
+
const r = "0";
|
|
276
|
+
if (a(r), !l(r, o.componentProps || {})) {
|
|
277
277
|
const s = {
|
|
278
278
|
setup() {
|
|
279
279
|
return () => N(
|
|
280
280
|
Le,
|
|
281
281
|
{
|
|
282
|
-
visiable:
|
|
282
|
+
visiable: t.value[r]?.visiable || !1,
|
|
283
283
|
"onUpdate:show": () => {
|
|
284
|
-
|
|
284
|
+
t.value[r].visiable = !1;
|
|
285
285
|
}
|
|
286
286
|
},
|
|
287
287
|
{
|
|
288
288
|
default: () => N(
|
|
289
289
|
o.component,
|
|
290
|
-
|
|
290
|
+
t.value[r].componentProps
|
|
291
291
|
)
|
|
292
292
|
}
|
|
293
293
|
);
|
|
294
294
|
}
|
|
295
295
|
};
|
|
296
|
-
e || (e = document.body.querySelector("#app") || document.body),
|
|
296
|
+
e || (e = document.body.querySelector("#app") || document.body), n || (n = document.createElement("div"), n.setAttribute("id", "dialog"), e.appendChild(n)), ce(fe(s), n);
|
|
297
297
|
}
|
|
298
298
|
return { close: () => a(r) };
|
|
299
299
|
}
|
|
300
300
|
return F(() => {
|
|
301
|
-
|
|
301
|
+
n && e && e.removeChild(n);
|
|
302
302
|
}), {
|
|
303
303
|
create: i
|
|
304
304
|
};
|
|
@@ -310,10 +310,10 @@ const je = /* @__PURE__ */ D({
|
|
|
310
310
|
itemHeight: null
|
|
311
311
|
},
|
|
312
312
|
setup(e) {
|
|
313
|
-
const
|
|
314
|
-
|
|
313
|
+
const n = e, { list: t, containerProps: l, wrapperProps: a, innerProps: i } = Ae(
|
|
314
|
+
de(n, "data"),
|
|
315
315
|
{
|
|
316
|
-
itemHeight: (o) =>
|
|
316
|
+
itemHeight: (o) => n.itemHeight(0),
|
|
317
317
|
overscan: 10
|
|
318
318
|
}
|
|
319
319
|
);
|
|
@@ -325,7 +325,7 @@ const je = /* @__PURE__ */ D({
|
|
|
325
325
|
}, [
|
|
326
326
|
x("div", H(K(y(a))), [
|
|
327
327
|
x("div", H(K(y(i))), [
|
|
328
|
-
(S(!0), I(ve, null, pe(y(
|
|
328
|
+
(S(!0), I(ve, null, pe(y(t), ({ index: s, data: c }) => (S(), I("div", {
|
|
329
329
|
key: s,
|
|
330
330
|
style: $({
|
|
331
331
|
height: `${e.itemHeight(c)}px`,
|
|
@@ -342,11 +342,11 @@ const je = /* @__PURE__ */ D({
|
|
|
342
342
|
], 36));
|
|
343
343
|
}
|
|
344
344
|
});
|
|
345
|
-
const Fe = (e,
|
|
346
|
-
const
|
|
347
|
-
for (const [l, a] of
|
|
348
|
-
|
|
349
|
-
return
|
|
345
|
+
const Fe = (e, n) => {
|
|
346
|
+
const t = e.__vccOpts || e;
|
|
347
|
+
for (const [l, a] of n)
|
|
348
|
+
t[l] = a;
|
|
349
|
+
return t;
|
|
350
350
|
}, We = /* @__PURE__ */ Fe(je, [["__scopeId", "data-v-b9b7f6cb"]]);
|
|
351
351
|
export {
|
|
352
352
|
Me as DialogController,
|
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 P;const w=typeof window<"u";w&&((P=window?.navigator)==null?void 0:P.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function D(t){return typeof t=="function"?t():e.unref(t)}function M(t){return t}function F(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function U(t,
|
|
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 P;const w=typeof window<"u";w&&((P=window?.navigator)==null?void 0:P.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function D(t){return typeof t=="function"?t():e.unref(t)}function M(t){return t}function F(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function U(t,o=!0){e.getCurrentInstance()?e.onMounted(t):o?t():e.nextTick(t)}function C(t){var o;const n=D(t);return(o=n?.$el)!=null?o:n}const q=w?window:void 0;w&&window.document,w&&window.navigator,w&&window.location;function W(t,o=!1){const n=e.ref(),r=()=>n.value=Boolean(t());return r(),U(r,o),n}const O=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},S="__vueuse_ssr_handlers__";O[S]=O[S]||{},O[S];var E=Object.getOwnPropertySymbols,G=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable,J=(t,o)=>{var n={};for(var r in t)G.call(t,r)&&o.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&E)for(var r of E(t))o.indexOf(r)<0&&Y.call(t,r)&&(n[r]=t[r]);return n};function X(t,o,n={}){const r=n,{window:i=q}=r,u=J(r,["window"]);let l;const a=W(()=>i&&"ResizeObserver"in i),s=()=>{l&&(l.disconnect(),l=void 0)},f=e.watch(()=>C(t),_=>{s(),a.value&&i&&_&&(l=new ResizeObserver(o),l.observe(_,u))},{immediate:!0,flush:"post"}),v=()=>{s(),f()};return F(v),{isSupported:a,stop:v}}function Z(t,o={width:0,height:0},n={}){const{box:r="content-box"}=n,i=e.ref(o.width),u=e.ref(o.height);return X(t,([l])=>{const a=r==="border-box"?l.borderBoxSize:r==="content-box"?l.contentBoxSize:l.devicePixelContentBoxSize;a?(i.value=a.reduce((s,{inlineSize:f})=>s+f,0),u.value=a.reduce((s,{blockSize:f})=>s+f,0)):(i.value=l.contentRect.width,u.value=l.contentRect.height)},n),e.watch(()=>C(t),l=>{i.value=l?o.width:0,u.value=l?o.height:0}),{width:i,height:u}}var I;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(I||(I={}));var ee=Object.defineProperty,B=Object.getOwnPropertySymbols,te=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable,T=(t,o,n)=>o in t?ee(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n,oe=(t,o)=>{for(var n in o||(o={}))te.call(o,n)&&T(t,n,o[n]);if(B)for(var n of B(o))ne.call(o,n)&&T(t,n,o[n]);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 K(t,o){const n=e.ref(),r=Z(n),i=e.ref([]),u=e.ref(0),l=e.shallowRef(t),a=e.ref({start:0,end:10}),{itemHeight:s,overscan:f=5}=o,v=d=>{const{start:y=0}=a.value;let g=0,m=0;for(let b=y;b<l.value.length;b++)if(g+=s(b),g>=d){m=b;break}return m-y},_=d=>{let y=0,g=0;for(let m=0;m<l.value.length;m++)if(y+=s(m),y>=d){g=m;break}return g};let p;const h=()=>{cancelAnimationFrame(p),p=requestAnimationFrame(L)},L=()=>{const d=n.value;if(d){const y=_(d.scrollTop),g=v(d.clientHeight),m=y-f,b=y+g+f;a.value={start:m<0?0:m,end:b>l.value.length?l.value.length:b},i.value=l.value.slice(a.value.start,a.value.end).map((Q,ge)=>({data:Q,index:ge+a.value.start}))}};e.onMounted(()=>{}),e.onUnmounted(()=>{cancelAnimationFrame(p)}),e.watch([r.width,r.height,l],()=>{h()},{deep:!0});const j=e.computed(()=>typeof s=="number"?l.value.length*s:l.value.reduce((d,y,g)=>d+s(g),0)),ce=d=>typeof s=="number"?d*s:l.value.slice(0,d).reduce((g,m,b)=>g+s(b),0),ue=d=>{n.value&&(n.value.scrollTop=d,L())},de=e.computed(()=>ce(a.value.start)),fe=e.computed(()=>({style:{width:"100%",height:`${j.value}px`}})),pe=e.computed(()=>({style:{transform:`translate3d(0, ${de.value}px, 0)`,"will-change":"transform"}})),he={overflowY:"auto"};return{list:i,totalHeight:j,clientHeight:r.height,scrollTo:ue,scrollTop:u,containerProps:{ref:n,onScroll:d=>{d.target&&(u.value=d.target.scrollTop),h()},style:he},wrapperProps:fe,innerProps:pe}}const A=Symbol(),k=Symbol(),x=Symbol(),V=Symbol(),N=Symbol(),R=Symbol(),z=Symbol(),$=Symbol();function le(t,o){const n=e.ref({}),r=e.computed(()=>t.value.filter(p=>n.value[p[o]])),i=e.computed(()=>r.value.length!=0&&Object.keys(n.value).length==t.value.length);function u(){t.value.forEach(p=>{n.value[p[o]]=!0})}function l(){n.value={}}function a(p){p.forEach(h=>{n.value[h[o]]||(n.value[h[o]]=!0)})}function s(p){p.forEach(h=>{n.value[h[o]]&&delete n.value[h[o]]})}function f(p){return!!n.value[p[o]]}function v(p){p.forEach(h=>{f(h)?delete n.value[h[o]]:n.value[h[o]]=!0})}function _(){i.value?l():u()}return e.provide(A,_),e.provide(k,v),e.provide(x,f),e.provide(V,r),e.provide(N,a),e.provide(R,s),e.provide(z,i),e.provide($,l),{selected:r,select:a,selectAll:u,unselect:s,unselectAll:l,toggle:v,toggleAll:_,isSelected:f,isAllSelected:i}}const H=Symbol(),re=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0}},emits:["update:show"],setup(t,{emit:o}){const n=t,r=()=>{n.closeOnClickOverlay&&o("update:show",!1)};return e.provide(H,()=>o("update:show",!1)),(i,u)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[t.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:r,class:"modal absolute inset-0 bottom-0 z-50 flex bg-stone-900 bg-opacity-50"},[e.createElementVNode("div",{onClick:u[0]||(u[0]=e.withModifiers(()=>{},["stop"])),class:"dialog m-auto flex flex-col"},[e.renderSlot(i.$slots,"default")])])):e.createCommentVNode("",!0)]),_:3}))}});function ae(){let t=null,o=null;const n=e.ref({});function r(l,a,s=!0){return n.value[l]?(n.value[l].visiable=s,!0):(n.value[l]={visiable:s,componentProps:a},!1)}function i(l){n.value[l]&&(n.value[l].visiable=!1),o&&o.childNodes.length>0&&o.childNodes.forEach(a=>{o?.removeChild(a)}),n.value={}}function u(l){const a="0";if(i(a),!r(a,l.componentProps||{})){const s={setup(){return()=>e.h(re,{visiable:n.value[a]?.visiable||!1,"onUpdate:show":()=>{n.value[a].visiable=!1}},{default:()=>e.h(l.component,n.value[a].componentProps)})}};t||(t=document.body.querySelector("#app")||document.body),o||(o=document.createElement("div"),o.setAttribute("id","dialog"),t.appendChild(o)),e.render(e.createVNode(s),o)}return{close:()=>i(a)}}return e.onUnmounted(()=>{o&&t&&t.removeChild(o)}),{create:u}}const se=e.defineComponent({__name:"VirtualList",props:{data:null,itemHeight:null},setup(t){const o=t,{list:n,containerProps:r,wrapperProps:i,innerProps:u}=K(e.toRef(o,"data"),{itemHeight:l=>o.itemHeight(0),overscan:10});return(l,a)=>(e.openBlock(),e.createElementBlock("div",{ref:e.unref(r).ref,onScrollPassive:a[0]||(a[0]=(...s)=>e.unref(r).onScroll&&e.unref(r).onScroll(...s)),class:"hiddenScorllBar-firefox hiddenScorllBar h-full overflow-hidden",style:e.normalizeStyle(e.unref(r).style)},[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(i))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(u))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),({index:s,data:f})=>(e.openBlock(),e.createElementBlock("div",{key:s,style:e.normalizeStyle({height:`${t.itemHeight(f)}px`,display:"flex"})},[e.renderSlot(l.$slots,"default",{data:f,index:s},void 0,!0)],4))),128))],16)],16)],36))}}),ye="",ie=((t,o)=>{const n=t.__vccOpts||t;for(const[r,i]of o)n[r]=i;return n})(se,[["__scopeId","data-v-b9b7f6cb"]]);c.DialogController=ae,c.VirtualList=ie,c.allSelectedKey=V,c.closeDialogKey=H,c.isAllSelectedKey=z,c.isSelectedKey=x,c.selectKey=N,c.toggleAllKey=A,c.toggleKey=k,c.unselectAllKey=$,c.unselectKey=R,c.useSelectable=le,c.useVirtualList=K,Object.defineProperties(c,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|