@lazycatcloud/lzc-toolkit 0.0.16 → 0.0.17
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 +156 -130
- package/dist/index.umd.js +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/types/svgIcon/index.d.ts +0 -2
package/dist/index.es.js
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
import { unref as
|
|
2
|
-
var
|
|
1
|
+
import { unref as m, getCurrentScope as ie, onScopeDispose as ce, getCurrentInstance as ue, onMounted as U, 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 x, createBlock as pe, Transition as he, withCtx as ge, createElementBlock as I, createElementVNode as P, withModifiers as me, normalizeClass as be, renderSlot as D, createCommentVNode as ye, render as _e, h as E, normalizeStyle as T, toRef as we, normalizeProps as K, guardReactiveProps as j, Fragment as Oe, renderList as Se } from "vue";
|
|
2
|
+
var F;
|
|
3
3
|
const C = typeof window < "u";
|
|
4
|
-
C && ((
|
|
5
|
-
function
|
|
6
|
-
return typeof e == "function" ? e() :
|
|
4
|
+
C && ((F = window?.navigator) == null ? void 0 : F.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
5
|
+
function xe(e) {
|
|
6
|
+
return typeof e == "function" ? e() : m(e);
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function Ie(e) {
|
|
9
9
|
return e;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function Ce(e) {
|
|
12
12
|
return ie() ? (ce(e), !0) : !1;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
ue() ?
|
|
14
|
+
function Pe(e, t = !0) {
|
|
15
|
+
ue() ? U(e) : t ? e() : de(e);
|
|
16
16
|
}
|
|
17
17
|
function W(e) {
|
|
18
|
-
var
|
|
19
|
-
const
|
|
20
|
-
return (
|
|
18
|
+
var t;
|
|
19
|
+
const n = xe(e);
|
|
20
|
+
return (t = n?.$el) != null ? t : n;
|
|
21
21
|
}
|
|
22
22
|
const Ee = C ? window : void 0;
|
|
23
23
|
C && window.document;
|
|
24
24
|
C && window.navigator;
|
|
25
25
|
C && window.location;
|
|
26
|
-
function Te(e,
|
|
27
|
-
const
|
|
28
|
-
return o(),
|
|
26
|
+
function Te(e, t = !1) {
|
|
27
|
+
const n = _(), o = () => n.value = Boolean(e());
|
|
28
|
+
return o(), Pe(o, t), n;
|
|
29
29
|
}
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var
|
|
34
|
-
var
|
|
30
|
+
const A = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, B = "__vueuse_ssr_handlers__";
|
|
31
|
+
A[B] = A[B] || {};
|
|
32
|
+
A[B];
|
|
33
|
+
var N = Object.getOwnPropertySymbols, Ae = Object.prototype.hasOwnProperty, Be = Object.prototype.propertyIsEnumerable, $e = (e, t) => {
|
|
34
|
+
var n = {};
|
|
35
35
|
for (var o in e)
|
|
36
|
-
Ae.call(e, o) &&
|
|
37
|
-
if (e != null &&
|
|
38
|
-
for (var o of
|
|
39
|
-
|
|
40
|
-
return
|
|
36
|
+
Ae.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
|
|
37
|
+
if (e != null && N)
|
|
38
|
+
for (var o of N(e))
|
|
39
|
+
t.indexOf(o) < 0 && Be.call(e, o) && (n[o] = e[o]);
|
|
40
|
+
return n;
|
|
41
41
|
};
|
|
42
|
-
function
|
|
43
|
-
const o =
|
|
42
|
+
function Re(e, t, n = {}) {
|
|
43
|
+
const o = n, { window: s = Ee } = o, a = $e(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 =
|
|
48
|
-
r(), i.value && s &&
|
|
49
|
-
}, { immediate: !0, flush: "post" }),
|
|
47
|
+
}, u = $(() => W(e), (S) => {
|
|
48
|
+
r(), i.value && s && S && (l = new ResizeObserver(t), l.observe(S, a));
|
|
49
|
+
}, { immediate: !0, flush: "post" }), O = () => {
|
|
50
50
|
r(), u();
|
|
51
51
|
};
|
|
52
|
-
return
|
|
52
|
+
return Ce(O), {
|
|
53
53
|
isSupported: i,
|
|
54
|
-
stop:
|
|
54
|
+
stop: O
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
const { box: o = "content-box" } =
|
|
59
|
-
return
|
|
57
|
+
function ke(e, t = { width: 0, height: 0 }, n = {}) {
|
|
58
|
+
const { box: o = "content-box" } = n, s = _(t.width), a = _(t.height);
|
|
59
|
+
return Re(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
|
-
},
|
|
63
|
-
s.value = l ?
|
|
62
|
+
}, n), $(() => W(e), (l) => {
|
|
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 Q;
|
|
70
70
|
(function(e) {
|
|
71
71
|
e.UP = "UP", e.RIGHT = "RIGHT", e.DOWN = "DOWN", e.LEFT = "LEFT", e.NONE = "NONE";
|
|
72
|
-
})(
|
|
73
|
-
var
|
|
74
|
-
for (var
|
|
75
|
-
|
|
72
|
+
})(Q || (Q = {}));
|
|
73
|
+
var ze = Object.defineProperty, L = 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, je = (e, t) => {
|
|
74
|
+
for (var n in t || (t = {}))
|
|
75
|
+
He.call(t, n) && V(e, n, t[n]);
|
|
76
76
|
if (L)
|
|
77
|
-
for (var
|
|
78
|
-
|
|
77
|
+
for (var n of L(t))
|
|
78
|
+
Ke.call(t, n) && V(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,23 +104,23 @@ const Qe = {
|
|
|
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
|
|
112
|
-
const { start:
|
|
107
|
+
je({
|
|
108
|
+
linear: Ie
|
|
109
|
+
}, Fe);
|
|
110
|
+
function Ne(e, t) {
|
|
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
|
+
const { start: h = 0 } = i.value;
|
|
113
113
|
let v = 0, p = 0;
|
|
114
|
-
for (let
|
|
115
|
-
if (v += r(
|
|
116
|
-
p =
|
|
114
|
+
for (let g = h; g < l.value.length; g++)
|
|
115
|
+
if (v += r(g), v >= c) {
|
|
116
|
+
p = g;
|
|
117
117
|
break;
|
|
118
118
|
}
|
|
119
|
-
return p -
|
|
120
|
-
},
|
|
121
|
-
let
|
|
119
|
+
return p - h;
|
|
120
|
+
}, S = (c) => {
|
|
121
|
+
let h = 0, v = 0;
|
|
122
122
|
for (let p = 0; p < l.value.length; p++)
|
|
123
|
-
if (
|
|
123
|
+
if (h += r(p), h >= c) {
|
|
124
124
|
v = p;
|
|
125
125
|
break;
|
|
126
126
|
}
|
|
@@ -128,38 +128,38 @@ function ke(e, n) {
|
|
|
128
128
|
};
|
|
129
129
|
let d;
|
|
130
130
|
const f = () => {
|
|
131
|
-
cancelAnimationFrame(d), d = requestAnimationFrame(
|
|
132
|
-
},
|
|
133
|
-
const c =
|
|
131
|
+
cancelAnimationFrame(d), d = requestAnimationFrame(k);
|
|
132
|
+
}, k = () => {
|
|
133
|
+
const c = n.value;
|
|
134
134
|
if (c) {
|
|
135
|
-
const
|
|
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
|
-
end:
|
|
139
|
-
}, s.value = l.value.slice(i.value.start, i.value.end).map((
|
|
140
|
-
data:
|
|
138
|
+
end: g > l.value.length ? l.value.length : g
|
|
139
|
+
}, s.value = l.value.slice(i.value.start, i.value.end).map((H, ae) => ({
|
|
140
|
+
data: H,
|
|
141
141
|
index: ae + i.value.start
|
|
142
142
|
}));
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
|
-
|
|
145
|
+
U(() => {
|
|
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
|
-
|
|
157
|
-
}, oe =
|
|
155
|
+
const z = 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, k());
|
|
157
|
+
}, oe = w(() => te(i.value.start)), le = w(() => ({
|
|
158
158
|
style: {
|
|
159
159
|
width: "100%",
|
|
160
|
-
height: `${
|
|
160
|
+
height: `${z.value}px`
|
|
161
161
|
}
|
|
162
|
-
})), se =
|
|
162
|
+
})), se = w(() => ({
|
|
163
163
|
style: {
|
|
164
164
|
transform: `translate3d(0, ${oe.value}px, 0)`,
|
|
165
165
|
"will-change": "transform"
|
|
@@ -167,12 +167,12 @@ function ke(e, n) {
|
|
|
167
167
|
})), re = { overflowY: "auto" };
|
|
168
168
|
return {
|
|
169
169
|
list: s,
|
|
170
|
-
totalHeight:
|
|
170
|
+
totalHeight: z,
|
|
171
171
|
clientHeight: o.height,
|
|
172
172
|
scrollTo: ne,
|
|
173
173
|
scrollTop: a,
|
|
174
174
|
containerProps: {
|
|
175
|
-
ref:
|
|
175
|
+
ref: n,
|
|
176
176
|
onScroll: (c) => {
|
|
177
177
|
c.target && (a.value = c.target.scrollTop), f();
|
|
178
178
|
},
|
|
@@ -183,12 +183,12 @@ function ke(e, n) {
|
|
|
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
|
|
187
|
-
const e =
|
|
186
|
+
function Me() {
|
|
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,
|
|
190
|
-
toggle:
|
|
191
|
-
isSelected:
|
|
190
|
+
toggle: t,
|
|
191
|
+
isSelected: n,
|
|
192
192
|
selected: o,
|
|
193
193
|
select: s,
|
|
194
194
|
unselect: a,
|
|
@@ -196,50 +196,50 @@ function We() {
|
|
|
196
196
|
unselectAll: i
|
|
197
197
|
};
|
|
198
198
|
}
|
|
199
|
-
function
|
|
200
|
-
const
|
|
199
|
+
function qe(e, t) {
|
|
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) => {
|
|
203
|
-
|
|
203
|
+
n.value[d[t]] = !0;
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
206
|
function l() {
|
|
207
|
-
|
|
207
|
+
n.value = {};
|
|
208
208
|
}
|
|
209
209
|
function i(d) {
|
|
210
210
|
d.forEach((f) => {
|
|
211
|
-
|
|
211
|
+
n.value[f[t]] || (n.value[f[t]] = !0);
|
|
212
212
|
});
|
|
213
213
|
}
|
|
214
214
|
function r(d) {
|
|
215
215
|
d.forEach((f) => {
|
|
216
|
-
|
|
216
|
+
n.value[f[t]] && delete n.value[f[t]];
|
|
217
217
|
});
|
|
218
218
|
}
|
|
219
219
|
function u(d) {
|
|
220
|
-
return !!
|
|
220
|
+
return !!n.value[d[t]];
|
|
221
221
|
}
|
|
222
|
-
function
|
|
222
|
+
function O(d) {
|
|
223
223
|
d.forEach((f) => {
|
|
224
|
-
u(f) ? delete
|
|
224
|
+
u(f) ? delete n.value[f[t]] : n.value[f[t]] = !0;
|
|
225
225
|
});
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function S() {
|
|
228
228
|
s.value ? l() : a();
|
|
229
229
|
}
|
|
230
|
-
return
|
|
230
|
+
return b(M, S), b(q, O), b(G, u), b(Y, o), b(J, i), b(X, r), b(Z, s), b(ee, l), {
|
|
231
231
|
selected: o,
|
|
232
232
|
select: i,
|
|
233
233
|
selectAll: a,
|
|
234
234
|
unselect: r,
|
|
235
235
|
unselectAll: l,
|
|
236
|
-
toggle:
|
|
237
|
-
toggleAll:
|
|
236
|
+
toggle: O,
|
|
237
|
+
toggleAll: S,
|
|
238
238
|
isSelected: u,
|
|
239
239
|
isAllSelected: s
|
|
240
240
|
};
|
|
241
241
|
}
|
|
242
|
-
const
|
|
242
|
+
const Qe = Symbol(), Le = /* @__PURE__ */ R({
|
|
243
243
|
__name: "Dialog",
|
|
244
244
|
props: {
|
|
245
245
|
visiable: { type: Boolean, default: !1 },
|
|
@@ -247,18 +247,18 @@ const Le = Symbol(), Ve = /* @__PURE__ */ U({
|
|
|
247
247
|
dialogClass: { default: "" }
|
|
248
248
|
},
|
|
249
249
|
emits: ["update:visiable"],
|
|
250
|
-
setup(e, { emit:
|
|
251
|
-
const
|
|
252
|
-
|
|
250
|
+
setup(e, { emit: t }) {
|
|
251
|
+
const n = e, o = () => {
|
|
252
|
+
n.closeOnClickOverlay && t("update:visiable", !1);
|
|
253
253
|
};
|
|
254
|
-
return
|
|
255
|
-
default:
|
|
256
|
-
e.visiable ? (
|
|
254
|
+
return b(Qe, () => t("update:visiable", !1)), (s, a) => (x(), pe(he, { name: "modal" }, {
|
|
255
|
+
default: ge(() => [
|
|
256
|
+
e.visiable ? (x(), I("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])
|
|
@@ -271,12 +271,12 @@ const Le = Symbol(), Ve = /* @__PURE__ */ U({
|
|
|
271
271
|
}));
|
|
272
272
|
}
|
|
273
273
|
});
|
|
274
|
-
function
|
|
275
|
-
function n
|
|
274
|
+
function Ge(e) {
|
|
275
|
+
function t(n, o) {
|
|
276
276
|
const s = document.createElement("div"), a = {
|
|
277
277
|
setup() {
|
|
278
|
-
return () =>
|
|
279
|
-
|
|
278
|
+
return () => E(
|
|
279
|
+
Le,
|
|
280
280
|
{
|
|
281
281
|
visiable: !0,
|
|
282
282
|
"onUpdate:visiable": () => {
|
|
@@ -285,44 +285,69 @@ function qe(e) {
|
|
|
285
285
|
...e
|
|
286
286
|
},
|
|
287
287
|
{
|
|
288
|
-
default: () =>
|
|
288
|
+
default: () => E(n, o)
|
|
289
289
|
}
|
|
290
290
|
);
|
|
291
291
|
}
|
|
292
292
|
};
|
|
293
|
-
return document.body.appendChild(s),
|
|
293
|
+
return document.body.appendChild(s), _e(E(a), s), {
|
|
294
294
|
close: () => s?.remove()
|
|
295
295
|
};
|
|
296
296
|
}
|
|
297
297
|
return {
|
|
298
|
-
create:
|
|
298
|
+
create: t
|
|
299
299
|
};
|
|
300
300
|
}
|
|
301
|
-
const
|
|
301
|
+
const Ve = ["xlink:href", "fill", "color"], Ye = /* @__PURE__ */ R({
|
|
302
|
+
__name: "SvgIcon",
|
|
303
|
+
props: {
|
|
304
|
+
prefix: { default: "icon" },
|
|
305
|
+
name: null,
|
|
306
|
+
color: { default: "#FFF" },
|
|
307
|
+
width: { default: 16 },
|
|
308
|
+
height: { default: 16 }
|
|
309
|
+
},
|
|
310
|
+
setup(e) {
|
|
311
|
+
const t = e, n = w(() => `#${t.prefix}-${t.name}`), o = w(() => ({
|
|
312
|
+
width: t.width,
|
|
313
|
+
height: t.height
|
|
314
|
+
}));
|
|
315
|
+
return (s, a) => (x(), I("svg", {
|
|
316
|
+
"aria-hidden": "",
|
|
317
|
+
style: T(m(o))
|
|
318
|
+
}, [
|
|
319
|
+
P("use", {
|
|
320
|
+
"xlink:href": m(n),
|
|
321
|
+
fill: e.color,
|
|
322
|
+
color: e.color
|
|
323
|
+
}, null, 8, Ve)
|
|
324
|
+
], 4));
|
|
325
|
+
}
|
|
326
|
+
}), Ue = /* @__PURE__ */ R({
|
|
302
327
|
__name: "VirtualList",
|
|
303
328
|
props: {
|
|
304
329
|
data: null,
|
|
305
330
|
itemHeight: null
|
|
306
331
|
},
|
|
307
332
|
setup(e) {
|
|
308
|
-
const
|
|
309
|
-
we(
|
|
333
|
+
const t = e, { list: n, containerProps: o, wrapperProps: s, innerProps: a } = Ne(
|
|
334
|
+
we(t, "data"),
|
|
310
335
|
{
|
|
311
|
-
itemHeight: (l) =>
|
|
336
|
+
itemHeight: (l) => t.itemHeight(0),
|
|
312
337
|
overscan: 10
|
|
313
338
|
}
|
|
314
339
|
);
|
|
315
|
-
return (l, i) => (
|
|
316
|
-
ref:
|
|
317
|
-
onScrollPassive: i[0] || (i[0] = (...r) =>
|
|
340
|
+
return (l, i) => (x(), I("div", {
|
|
341
|
+
ref: m(o).ref,
|
|
342
|
+
onScrollPassive: i[0] || (i[0] = (...r) => m(o).onScroll && m(o).onScroll(...r)),
|
|
318
343
|
class: "hiddenScorllBar-firefox hiddenScorllBar h-full overflow-hidden",
|
|
319
|
-
style:
|
|
344
|
+
style: T(m(o).style)
|
|
320
345
|
}, [
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
(
|
|
346
|
+
P("div", K(j(m(s))), [
|
|
347
|
+
P("div", K(j(m(a))), [
|
|
348
|
+
(x(!0), I(Oe, null, Se(m(n), ({ index: r, data: u }) => (x(), I("div", {
|
|
324
349
|
key: r,
|
|
325
|
-
style:
|
|
350
|
+
style: T({
|
|
326
351
|
height: `${e.itemHeight(u)}px`,
|
|
327
352
|
display: "flex"
|
|
328
353
|
})
|
|
@@ -337,17 +362,18 @@ const Fe = /* @__PURE__ */ U({
|
|
|
337
362
|
], 36));
|
|
338
363
|
}
|
|
339
364
|
});
|
|
340
|
-
const
|
|
341
|
-
const
|
|
342
|
-
for (const [o, s] of
|
|
343
|
-
|
|
344
|
-
return
|
|
345
|
-
},
|
|
365
|
+
const De = (e, t) => {
|
|
366
|
+
const n = e.__vccOpts || e;
|
|
367
|
+
for (const [o, s] of t)
|
|
368
|
+
n[o] = s;
|
|
369
|
+
return n;
|
|
370
|
+
}, Je = /* @__PURE__ */ De(Ue, [["__scopeId", "data-v-b9b7f6cb"]]);
|
|
346
371
|
export {
|
|
347
|
-
|
|
372
|
+
Ye as SvgIcon,
|
|
373
|
+
Je as VirtualList,
|
|
348
374
|
Y as allSelectedKey,
|
|
349
|
-
|
|
350
|
-
|
|
375
|
+
Qe as closeDialogKey,
|
|
376
|
+
Ge as dialogController,
|
|
351
377
|
Z as isAllSelectedKey,
|
|
352
378
|
G as isSelectedKey,
|
|
353
379
|
J as selectKey,
|
|
@@ -355,7 +381,7 @@ export {
|
|
|
355
381
|
q as toggleKey,
|
|
356
382
|
ee as unselectAllKey,
|
|
357
383
|
X as unselectKey,
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
384
|
+
qe as useSelectable,
|
|
385
|
+
Me as useSelectableInjectors,
|
|
386
|
+
Ne as useVirtualList
|
|
361
387
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(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 x(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 A=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&&A)for(var l of A(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(()=>x(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(()=>x(t),r=>{s.value=r?n.width:0,a.value=r?n.height:0}),{width:s,height:a}}var R;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(R||(R={}));var ee=Object.defineProperty,V=Object.getOwnPropertySymbols,te=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable,$=(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)&&$(t,o,n[o]);if(V)for(var o of V(n))ne.call(n,o)&&$(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(H)},H=()=>{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,be)=>({data:F,index:be+d.value.start}))}};e.onMounted(()=>{}),e.onUnmounted(()=>{cancelAnimationFrame(p)}),e.watch([l.width,l.height,r],()=>{h()},{deep:!0});const L=e.computed(()=>typeof i=="number"?r.value.length*i:r.value.reduce((u,y,g)=>u+i(g),0)),fe=u=>typeof i=="number"?u*i:r.value.slice(0,u).reduce((g,m,b)=>g+i(b),0),pe=u=>{o.value&&(o.value.scrollTop=u,H())},he=e.computed(()=>fe(d.value.start)),ge=e.computed(()=>({style:{width:"100%",height:`${L.value}px`}})),me=e.computed(()=>({style:{transform:`translate3d(0, ${he.value}px, 0)`,"will-change":"transform"}})),ye={overflowY:"auto"};return{list:s,totalHeight:L,clientHeight:l.height,scrollTo:pe,scrollTop:a,containerProps:{ref:o,onScroll:u=>{u.target&&(a.value=u.target.scrollTop),h()},style:ye},wrapperProps:ge,innerProps:me}}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=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",{ref:e.unref(l).ref,onScrollPassive:d[0]||(d[0]=(...i)=>e.unref(l).onScroll&&e.unref(l).onScroll(...i)),class:"hiddenScorllBar-firefox hiddenScorllBar h-full overflow-hidden",style:e.normalizeStyle(e.unref(l).style)},[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))}}),we="",ue=((t,n)=>{const o=t.__vccOpts||t;for(const[l,s]of n)o[l]=s;return o})(de,[["__scopeId","data-v-b9b7f6cb"]]);c.SvgIcon=ce,c.VirtualList=ue,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/types/index.d.ts
CHANGED
package/package.json
CHANGED