@lazycatcloud/lzc-toolkit 0.0.12 → 0.0.13
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 +176 -194
- package/dist/index.umd.js +1 -1
- package/dist/types/dialog/Dialog.vue.d.ts +16 -8
- package/dist/types/dialog/index.d.ts +5 -14
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
import { unref as
|
|
2
|
-
var
|
|
3
|
-
const
|
|
4
|
-
|
|
1
|
+
import { unref as b, getCurrentScope as Z, onScopeDispose as ee, getCurrentInstance as te, onMounted as j, nextTick as ne, ref as y, watch as B, shallowRef as oe, onUnmounted as le, computed as _, provide as m, defineComponent as F, openBlock as S, createBlock as re, Transition as se, withCtx as ae, createElementBlock as I, createElementVNode as x, withModifiers as ie, normalizeClass as ue, renderSlot as U, createCommentVNode as ce, render as de, h as P, toRef as fe, normalizeStyle as z, normalizeProps as H, guardReactiveProps as K, Fragment as ve, renderList as pe } from "vue";
|
|
2
|
+
var N;
|
|
3
|
+
const C = typeof window < "u";
|
|
4
|
+
C && ((N = window?.navigator) == null ? void 0 : N.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
5
5
|
function he(e) {
|
|
6
|
-
return typeof e == "function" ? e() :
|
|
6
|
+
return typeof e == "function" ? e() : b(e);
|
|
7
7
|
}
|
|
8
8
|
function ge(e) {
|
|
9
9
|
return e;
|
|
10
10
|
}
|
|
11
11
|
function me(e) {
|
|
12
|
-
return
|
|
12
|
+
return Z() ? (ee(e), !0) : !1;
|
|
13
13
|
}
|
|
14
14
|
function be(e, n = !0) {
|
|
15
|
-
|
|
15
|
+
te() ? j(e) : n ? e() : ne(e);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function D(e) {
|
|
18
18
|
var n;
|
|
19
19
|
const t = he(e);
|
|
20
20
|
return (n = t?.$el) != null ? n : t;
|
|
21
21
|
}
|
|
22
|
-
const ye =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
const t =
|
|
28
|
-
return
|
|
22
|
+
const ye = C ? window : void 0;
|
|
23
|
+
C && window.document;
|
|
24
|
+
C && window.navigator;
|
|
25
|
+
C && window.location;
|
|
26
|
+
function Oe(e, n = !1) {
|
|
27
|
+
const t = y(), o = () => t.value = Boolean(e());
|
|
28
|
+
return o(), be(o, n), t;
|
|
29
29
|
}
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var
|
|
30
|
+
const E = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, T = "__vueuse_ssr_handlers__";
|
|
31
|
+
E[T] = E[T] || {};
|
|
32
|
+
E[T];
|
|
33
|
+
var Q = Object.getOwnPropertySymbols, we = Object.prototype.hasOwnProperty, _e = Object.prototype.propertyIsEnumerable, Se = (e, n) => {
|
|
34
34
|
var t = {};
|
|
35
|
-
for (var
|
|
36
|
-
|
|
37
|
-
if (e != null &&
|
|
38
|
-
for (var
|
|
39
|
-
n.indexOf(
|
|
35
|
+
for (var o in e)
|
|
36
|
+
we.call(e, o) && n.indexOf(o) < 0 && (t[o] = e[o]);
|
|
37
|
+
if (e != null && Q)
|
|
38
|
+
for (var o of Q(e))
|
|
39
|
+
n.indexOf(o) < 0 && _e.call(e, o) && (t[o] = e[o]);
|
|
40
40
|
return t;
|
|
41
41
|
};
|
|
42
|
-
function
|
|
43
|
-
const
|
|
44
|
-
let
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
}, c =
|
|
48
|
-
s(),
|
|
49
|
-
}, { immediate: !0, flush: "post" }),
|
|
42
|
+
function Ce(e, n, t = {}) {
|
|
43
|
+
const o = t, { window: r = ye } = o, a = Se(o, ["window"]);
|
|
44
|
+
let l;
|
|
45
|
+
const i = Oe(() => r && "ResizeObserver" in r), s = () => {
|
|
46
|
+
l && (l.disconnect(), l = void 0);
|
|
47
|
+
}, c = B(() => D(e), (w) => {
|
|
48
|
+
s(), i.value && r && w && (l = new ResizeObserver(n), l.observe(w, a));
|
|
49
|
+
}, { immediate: !0, flush: "post" }), O = () => {
|
|
50
50
|
s(), c();
|
|
51
51
|
};
|
|
52
|
-
return me(
|
|
53
|
-
isSupported:
|
|
54
|
-
stop:
|
|
52
|
+
return me(O), {
|
|
53
|
+
isSupported: i,
|
|
54
|
+
stop: O
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
function Ie(e, n = { width: 0, height: 0 }, t = {}) {
|
|
58
|
-
const { box:
|
|
59
|
-
return
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
}, t),
|
|
63
|
-
|
|
58
|
+
const { box: o = "content-box" } = t, r = y(n.width), a = y(n.height);
|
|
59
|
+
return Ce(e, ([l]) => {
|
|
60
|
+
const i = o === "border-box" ? l.borderBoxSize : o === "content-box" ? l.contentBoxSize : l.devicePixelContentBoxSize;
|
|
61
|
+
i ? (r.value = i.reduce((s, { inlineSize: c }) => s + c, 0), a.value = i.reduce((s, { blockSize: c }) => s + c, 0)) : (r.value = l.contentRect.width, a.value = l.contentRect.height);
|
|
62
|
+
}, t), B(() => D(e), (l) => {
|
|
63
|
+
r.value = l ? n.width : 0, a.value = l ? n.height : 0;
|
|
64
64
|
}), {
|
|
65
|
-
width:
|
|
66
|
-
height:
|
|
65
|
+
width: r,
|
|
66
|
+
height: a
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
var
|
|
69
|
+
var k;
|
|
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
|
+
})(k || (k = {}));
|
|
73
|
+
var Pe = Object.defineProperty, L = Object.getOwnPropertySymbols, xe = Object.prototype.hasOwnProperty, Ee = Object.prototype.propertyIsEnumerable, V = (e, n, t) => n in e ? Pe(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t, Te = (e, n) => {
|
|
74
74
|
for (var t in n || (n = {}))
|
|
75
|
-
|
|
76
|
-
if (
|
|
77
|
-
for (var t of
|
|
78
|
-
Ee.call(n, t) &&
|
|
75
|
+
xe.call(n, t) && V(e, t, n[t]);
|
|
76
|
+
if (L)
|
|
77
|
+
for (var t of L(n))
|
|
78
|
+
Ee.call(n, t) && V(e, t, n[t]);
|
|
79
79
|
return e;
|
|
80
80
|
};
|
|
81
81
|
const Be = {
|
|
@@ -107,232 +107,214 @@ const Be = {
|
|
|
107
107
|
Te({
|
|
108
108
|
linear: ge
|
|
109
109
|
}, Be);
|
|
110
|
-
function
|
|
111
|
-
const t =
|
|
112
|
-
const { start: h = 0 } =
|
|
110
|
+
function Re(e, n) {
|
|
111
|
+
const t = y(), o = Ie(t), r = y([]), a = y(0), l = oe(e), i = y({ start: 0, end: 10 }), { itemHeight: s, overscan: c = 5 } = n, O = (u) => {
|
|
112
|
+
const { start: h = 0 } = i.value;
|
|
113
113
|
let v = 0, p = 0;
|
|
114
|
-
for (let g = h; g <
|
|
114
|
+
for (let g = h; g < l.value.length; g++)
|
|
115
115
|
if (v += s(g), v >= u) {
|
|
116
116
|
p = g;
|
|
117
117
|
break;
|
|
118
118
|
}
|
|
119
119
|
return p - h;
|
|
120
|
-
},
|
|
120
|
+
}, w = (u) => {
|
|
121
121
|
let h = 0, v = 0;
|
|
122
|
-
for (let p = 0; p <
|
|
122
|
+
for (let p = 0; p < l.value.length; p++)
|
|
123
123
|
if (h += s(p), h >= u) {
|
|
124
124
|
v = p;
|
|
125
125
|
break;
|
|
126
126
|
}
|
|
127
127
|
return v;
|
|
128
128
|
};
|
|
129
|
-
let
|
|
130
|
-
const
|
|
131
|
-
cancelAnimationFrame(
|
|
132
|
-
},
|
|
129
|
+
let d;
|
|
130
|
+
const f = () => {
|
|
131
|
+
cancelAnimationFrame(d), d = requestAnimationFrame(R);
|
|
132
|
+
}, R = () => {
|
|
133
133
|
const u = t.value;
|
|
134
134
|
if (u) {
|
|
135
|
-
const h =
|
|
136
|
-
|
|
135
|
+
const h = w(u.scrollTop), v = O(u.clientHeight), p = h - c, g = h + v + c;
|
|
136
|
+
i.value = {
|
|
137
137
|
start: p < 0 ? 0 : p,
|
|
138
|
-
end: g >
|
|
139
|
-
},
|
|
140
|
-
data:
|
|
141
|
-
index:
|
|
138
|
+
end: g > l.value.length ? l.value.length : g
|
|
139
|
+
}, r.value = l.value.slice(i.value.start, i.value.end).map(($, X) => ({
|
|
140
|
+
data: $,
|
|
141
|
+
index: X + i.value.start
|
|
142
142
|
}));
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
145
|
j(() => {
|
|
146
|
-
}),
|
|
147
|
-
cancelAnimationFrame(
|
|
148
|
-
}),
|
|
149
|
-
[
|
|
146
|
+
}), le(() => {
|
|
147
|
+
cancelAnimationFrame(d);
|
|
148
|
+
}), B(
|
|
149
|
+
[o.width, o.height, l],
|
|
150
150
|
() => {
|
|
151
|
-
|
|
151
|
+
f();
|
|
152
152
|
},
|
|
153
153
|
{ deep: !0 }
|
|
154
154
|
);
|
|
155
|
-
const A =
|
|
156
|
-
t.value && (t.value.scrollTop = u,
|
|
157
|
-
},
|
|
155
|
+
const A = _(() => typeof s == "number" ? l.value.length * s : l.value.reduce((u, h, v) => u + s(v), 0)), W = (u) => typeof s == "number" ? u * s : l.value.slice(0, u).reduce((v, p, g) => v + s(g), 0), M = (u) => {
|
|
156
|
+
t.value && (t.value.scrollTop = u, R());
|
|
157
|
+
}, q = _(() => W(i.value.start)), G = _(() => ({
|
|
158
158
|
style: {
|
|
159
159
|
width: "100%",
|
|
160
160
|
height: `${A.value}px`
|
|
161
161
|
}
|
|
162
|
-
})),
|
|
162
|
+
})), Y = _(() => ({
|
|
163
163
|
style: {
|
|
164
|
-
transform: `translate3d(0, ${
|
|
164
|
+
transform: `translate3d(0, ${q.value}px, 0)`,
|
|
165
165
|
"will-change": "transform"
|
|
166
166
|
}
|
|
167
|
-
})),
|
|
167
|
+
})), J = { overflowY: "auto" };
|
|
168
168
|
return {
|
|
169
|
-
list:
|
|
169
|
+
list: r,
|
|
170
170
|
totalHeight: A,
|
|
171
|
-
clientHeight:
|
|
172
|
-
scrollTo:
|
|
173
|
-
scrollTop:
|
|
171
|
+
clientHeight: o.height,
|
|
172
|
+
scrollTo: M,
|
|
173
|
+
scrollTop: a,
|
|
174
174
|
containerProps: {
|
|
175
175
|
ref: t,
|
|
176
176
|
onScroll: (u) => {
|
|
177
|
-
u.target && (
|
|
177
|
+
u.target && (a.value = u.target.scrollTop), f();
|
|
178
178
|
},
|
|
179
|
-
style:
|
|
179
|
+
style: J
|
|
180
180
|
},
|
|
181
|
-
wrapperProps:
|
|
182
|
-
innerProps:
|
|
181
|
+
wrapperProps: G,
|
|
182
|
+
innerProps: Y
|
|
183
183
|
};
|
|
184
184
|
}
|
|
185
|
-
const
|
|
186
|
-
function
|
|
187
|
-
const t =
|
|
188
|
-
function
|
|
189
|
-
e.value.forEach((
|
|
190
|
-
t.value[
|
|
185
|
+
const Ae = Symbol(), $e = Symbol(), ze = Symbol(), He = Symbol(), Ke = Symbol(), Ne = Symbol(), Qe = Symbol(), ke = Symbol();
|
|
186
|
+
function De(e, n) {
|
|
187
|
+
const t = y({}), o = _(() => e.value.filter((d) => t.value[d[n]])), r = _(() => o.value.length != 0 && Object.keys(t.value).length == e.value.length);
|
|
188
|
+
function a() {
|
|
189
|
+
e.value.forEach((d) => {
|
|
190
|
+
t.value[d[n]] = !0;
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function l() {
|
|
194
194
|
t.value = {};
|
|
195
195
|
}
|
|
196
|
-
function
|
|
197
|
-
|
|
198
|
-
t.value[
|
|
196
|
+
function i(d) {
|
|
197
|
+
d.forEach((f) => {
|
|
198
|
+
t.value[f[n]] || (t.value[f[n]] = !0);
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
|
-
function s(
|
|
202
|
-
|
|
203
|
-
t.value[
|
|
201
|
+
function s(d) {
|
|
202
|
+
d.forEach((f) => {
|
|
203
|
+
t.value[f[n]] && delete t.value[f[n]];
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
|
-
function c(
|
|
207
|
-
return !!t.value[
|
|
206
|
+
function c(d) {
|
|
207
|
+
return !!t.value[d[n]];
|
|
208
208
|
}
|
|
209
|
-
function
|
|
210
|
-
|
|
211
|
-
c(
|
|
209
|
+
function O(d) {
|
|
210
|
+
d.forEach((f) => {
|
|
211
|
+
c(f) ? delete t.value[f[n]] : t.value[f[n]] = !0;
|
|
212
212
|
});
|
|
213
213
|
}
|
|
214
|
-
function
|
|
215
|
-
|
|
214
|
+
function w() {
|
|
215
|
+
r.value ? l() : a();
|
|
216
216
|
}
|
|
217
|
-
return m(
|
|
218
|
-
selected:
|
|
219
|
-
select:
|
|
220
|
-
selectAll:
|
|
217
|
+
return m(Ae, w), m($e, O), m(ze, c), m(He, o), m(Ke, i), m(Ne, s), m(Qe, r), m(ke, l), {
|
|
218
|
+
selected: o,
|
|
219
|
+
select: i,
|
|
220
|
+
selectAll: a,
|
|
221
221
|
unselect: s,
|
|
222
|
-
unselectAll:
|
|
223
|
-
toggle:
|
|
224
|
-
toggleAll:
|
|
222
|
+
unselectAll: l,
|
|
223
|
+
toggle: O,
|
|
224
|
+
toggleAll: w,
|
|
225
225
|
isSelected: c,
|
|
226
|
-
isAllSelected:
|
|
226
|
+
isAllSelected: r
|
|
227
227
|
};
|
|
228
228
|
}
|
|
229
|
-
const
|
|
229
|
+
const Le = Symbol(), Ve = /* @__PURE__ */ F({
|
|
230
230
|
__name: "Dialog",
|
|
231
231
|
props: {
|
|
232
232
|
visiable: { type: Boolean, default: !1 },
|
|
233
|
-
closeOnClickOverlay: { type: Boolean, default: !0 }
|
|
233
|
+
closeOnClickOverlay: { type: Boolean, default: !0 },
|
|
234
|
+
dialogClass: { default: "" }
|
|
234
235
|
},
|
|
235
|
-
emits: ["update:
|
|
236
|
+
emits: ["update:visiable"],
|
|
236
237
|
setup(e, { emit: n }) {
|
|
237
|
-
const t = e,
|
|
238
|
-
t.closeOnClickOverlay && n("update:
|
|
238
|
+
const t = e, o = () => {
|
|
239
|
+
t.closeOnClickOverlay && n("update:visiable", !1);
|
|
239
240
|
};
|
|
240
|
-
return m(
|
|
241
|
+
return m(Le, () => n("update:visiable", !1)), (r, a) => (S(), re(se, { name: "modal" }, {
|
|
241
242
|
default: ae(() => [
|
|
242
243
|
e.visiable ? (S(), I("div", {
|
|
243
244
|
key: 0,
|
|
244
|
-
onClick:
|
|
245
|
+
onClick: o,
|
|
245
246
|
class: "modal absolute inset-0 bottom-0 z-50 flex bg-stone-900 bg-opacity-50"
|
|
246
247
|
}, [
|
|
247
248
|
x("div", {
|
|
248
|
-
onClick:
|
|
249
|
+
onClick: a[0] || (a[0] = ie(() => {
|
|
249
250
|
}, ["stop"])),
|
|
250
|
-
class: "dialog m-auto flex flex-col"
|
|
251
|
+
class: ue(["dialog m-auto flex flex-col", e.dialogClass])
|
|
251
252
|
}, [
|
|
252
|
-
U(
|
|
253
|
-
])
|
|
254
|
-
])) :
|
|
253
|
+
U(r.$slots, "default")
|
|
254
|
+
], 2)
|
|
255
|
+
])) : ce("", !0)
|
|
255
256
|
]),
|
|
256
257
|
_: 3
|
|
257
258
|
}));
|
|
258
259
|
}
|
|
259
260
|
});
|
|
260
|
-
function
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
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
|
-
}
|
|
274
|
-
function i(o) {
|
|
275
|
-
const r = "0";
|
|
276
|
-
if (a(r), !l(r, o.componentProps || {})) {
|
|
277
|
-
const s = {
|
|
278
|
-
setup() {
|
|
279
|
-
return () => N(
|
|
280
|
-
Le,
|
|
281
|
-
{
|
|
282
|
-
visiable: t.value[r]?.visiable || !1,
|
|
283
|
-
"onUpdate:show": () => {
|
|
284
|
-
t.value[r].visiable = !1;
|
|
285
|
-
}
|
|
261
|
+
function We(e) {
|
|
262
|
+
function n(t, o) {
|
|
263
|
+
const r = document.createElement("div"), a = {
|
|
264
|
+
setup() {
|
|
265
|
+
return () => P(
|
|
266
|
+
Ve,
|
|
267
|
+
{
|
|
268
|
+
visiable: !0,
|
|
269
|
+
"onUpdate:visiable": () => {
|
|
270
|
+
r?.remove();
|
|
286
271
|
},
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
}
|
|
298
|
-
return { close: () => a(r) };
|
|
272
|
+
...e
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
default: () => P(t, o)
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
return document.body.appendChild(r), de(P(a), r), {
|
|
281
|
+
close: () => r?.remove()
|
|
282
|
+
};
|
|
299
283
|
}
|
|
300
|
-
return
|
|
301
|
-
|
|
302
|
-
}), {
|
|
303
|
-
create: i
|
|
284
|
+
return {
|
|
285
|
+
create: n
|
|
304
286
|
};
|
|
305
287
|
}
|
|
306
|
-
const je = /* @__PURE__ */
|
|
288
|
+
const je = /* @__PURE__ */ F({
|
|
307
289
|
__name: "VirtualList",
|
|
308
290
|
props: {
|
|
309
291
|
data: null,
|
|
310
292
|
itemHeight: null
|
|
311
293
|
},
|
|
312
294
|
setup(e) {
|
|
313
|
-
const n = e, { list: t, containerProps:
|
|
314
|
-
|
|
295
|
+
const n = e, { list: t, containerProps: o, wrapperProps: r, innerProps: a } = Re(
|
|
296
|
+
fe(n, "data"),
|
|
315
297
|
{
|
|
316
|
-
itemHeight: (
|
|
298
|
+
itemHeight: (l) => n.itemHeight(0),
|
|
317
299
|
overscan: 10
|
|
318
300
|
}
|
|
319
301
|
);
|
|
320
|
-
return (
|
|
321
|
-
ref:
|
|
322
|
-
onScrollPassive:
|
|
302
|
+
return (l, i) => (S(), I("div", {
|
|
303
|
+
ref: b(o).ref,
|
|
304
|
+
onScrollPassive: i[0] || (i[0] = (...s) => b(o).onScroll && b(o).onScroll(...s)),
|
|
323
305
|
class: "hiddenScorllBar-firefox hiddenScorllBar h-full overflow-hidden",
|
|
324
|
-
style:
|
|
306
|
+
style: z(b(o).style)
|
|
325
307
|
}, [
|
|
326
|
-
x("div", H(K(
|
|
327
|
-
x("div", H(K(
|
|
328
|
-
(S(!0), I(ve, null, pe(
|
|
308
|
+
x("div", H(K(b(r))), [
|
|
309
|
+
x("div", H(K(b(a))), [
|
|
310
|
+
(S(!0), I(ve, null, pe(b(t), ({ index: s, data: c }) => (S(), I("div", {
|
|
329
311
|
key: s,
|
|
330
|
-
style:
|
|
312
|
+
style: z({
|
|
331
313
|
height: `${e.itemHeight(c)}px`,
|
|
332
314
|
display: "flex"
|
|
333
315
|
})
|
|
334
316
|
}, [
|
|
335
|
-
U(
|
|
317
|
+
U(l.$slots, "default", {
|
|
336
318
|
data: c,
|
|
337
319
|
index: s
|
|
338
320
|
}, void 0, !0)
|
|
@@ -344,22 +326,22 @@ const je = /* @__PURE__ */ D({
|
|
|
344
326
|
});
|
|
345
327
|
const Fe = (e, n) => {
|
|
346
328
|
const t = e.__vccOpts || e;
|
|
347
|
-
for (const [
|
|
348
|
-
t[
|
|
329
|
+
for (const [o, r] of n)
|
|
330
|
+
t[o] = r;
|
|
349
331
|
return t;
|
|
350
|
-
},
|
|
332
|
+
}, Me = /* @__PURE__ */ Fe(je, [["__scopeId", "data-v-b9b7f6cb"]]);
|
|
351
333
|
export {
|
|
352
|
-
Me as
|
|
353
|
-
We as VirtualList,
|
|
334
|
+
Me as VirtualList,
|
|
354
335
|
He as allSelectedKey,
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
336
|
+
Le as closeDialogKey,
|
|
337
|
+
We as dialogController,
|
|
338
|
+
Qe as isAllSelectedKey,
|
|
339
|
+
ze as isSelectedKey,
|
|
358
340
|
Ke as selectKey,
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
341
|
+
Ae as toggleAllKey,
|
|
342
|
+
$e as toggleKey,
|
|
343
|
+
ke as unselectAllKey,
|
|
344
|
+
Ne as unselectKey,
|
|
345
|
+
De as useSelectable,
|
|
346
|
+
Re as useVirtualList
|
|
365
347
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(i,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(i=typeof globalThis<"u"?globalThis:i||self,e(i.ui={},i.Vue))})(this,function(i,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 F(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,o=!0){e.getCurrentInstance()?e.onMounted(t):o?t():e.nextTick(t)}function C(t){var o;const n=F(t);return(o=n?.$el)!=null?o:n}const W=w?window:void 0;w&&window.document,w&&window.navigator,w&&window.location;function q(t,o=!1){const n=e.ref(),l=()=>n.value=Boolean(t());return l(),U(l,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 I=Object.getOwnPropertySymbols,G=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable,J=(t,o)=>{var n={};for(var l in t)G.call(t,l)&&o.indexOf(l)<0&&(n[l]=t[l]);if(t!=null&&I)for(var l of I(t))o.indexOf(l)<0&&Y.call(t,l)&&(n[l]=t[l]);return n};function X(t,o,n={}){const l=n,{window:a=W}=l,c=J(l,["window"]);let r;const u=q(()=>a&&"ResizeObserver"in a),s=()=>{r&&(r.disconnect(),r=void 0)},f=e.watch(()=>C(t),v=>{s(),u.value&&a&&v&&(r=new ResizeObserver(o),r.observe(v,c))},{immediate:!0,flush:"post"}),_=()=>{s(),f()};return D(_),{isSupported:u,stop:_}}function Z(t,o={width:0,height:0},n={}){const{box:l="content-box"}=n,a=e.ref(o.width),c=e.ref(o.height);return X(t,([r])=>{const u=l==="border-box"?r.borderBoxSize:l==="content-box"?r.contentBoxSize:r.devicePixelContentBoxSize;u?(a.value=u.reduce((s,{inlineSize:f})=>s+f,0),c.value=u.reduce((s,{blockSize:f})=>s+f,0)):(a.value=r.contentRect.width,c.value=r.contentRect.height)},n),e.watch(()=>C(t),r=>{a.value=r?o.width:0,c.value=r?o.height:0}),{width:a,height:c}}var E;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(E||(E={}));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(),l=Z(n),a=e.ref([]),c=e.ref(0),r=e.shallowRef(t),u=e.ref({start:0,end:10}),{itemHeight:s,overscan:f=5}=o,_=d=>{const{start:y=0}=u.value;let g=0,m=0;for(let b=y;b<r.value.length;b++)if(g+=s(b),g>=d){m=b;break}return m-y},v=d=>{let y=0,g=0;for(let m=0;m<r.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=v(d.scrollTop),g=_(d.clientHeight),m=y-f,b=y+g+f;u.value={start:m<0?0:m,end:b>r.value.length?r.value.length:b},a.value=r.value.slice(u.value.start,u.value.end).map((Q,ge)=>({data:Q,index:ge+u.value.start}))}};e.onMounted(()=>{}),e.onUnmounted(()=>{cancelAnimationFrame(p)}),e.watch([l.width,l.height,r],()=>{h()},{deep:!0});const j=e.computed(()=>typeof s=="number"?r.value.length*s:r.value.reduce((d,y,g)=>d+s(g),0)),ce=d=>typeof s=="number"?d*s:r.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(u.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:a,totalHeight:j,clientHeight:l.height,scrollTo:ue,scrollTop:c,containerProps:{ref:n,onScroll:d=>{d.target&&(c.value=d.target.scrollTop),h()},style:he},wrapperProps:fe,innerProps:pe}}const k=Symbol(),x=Symbol(),A=Symbol(),R=Symbol(),V=Symbol(),z=Symbol(),N=Symbol(),$=Symbol();function le(t,o){const n=e.ref({}),l=e.computed(()=>t.value.filter(p=>n.value[p[o]])),a=e.computed(()=>l.value.length!=0&&Object.keys(n.value).length==t.value.length);function c(){t.value.forEach(p=>{n.value[p[o]]=!0})}function r(){n.value={}}function u(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 _(p){p.forEach(h=>{f(h)?delete n.value[h[o]]:n.value[h[o]]=!0})}function v(){a.value?r():c()}return e.provide(k,v),e.provide(x,_),e.provide(A,f),e.provide(R,l),e.provide(V,u),e.provide(z,s),e.provide(N,a),e.provide($,r),{selected:l,select:u,selectAll:c,unselect:s,unselectAll:r,toggle:_,toggleAll:v,isSelected:f,isAllSelected:a}}const H=Symbol(),re=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0},dialogClass:{default:""}},emits:["update:visiable"],setup(t,{emit:o}){const n=t,l=()=>{n.closeOnClickOverlay&&o("update:visiable",!1)};return e.provide(H,()=>o("update:visiable",!1)),(a,c)=>(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:c[0]||(c[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog m-auto flex flex-col",t.dialogClass])},[e.renderSlot(a.$slots,"default")],2)])):e.createCommentVNode("",!0)]),_:3}))}});function ae(t){function o(n,l){const a=document.createElement("div"),c={setup(){return()=>e.h(re,{visiable:!0,"onUpdate:visiable":()=>{a?.remove()},...t},{default:()=>e.h(n,l)})}};return document.body.appendChild(a),e.render(e.h(c),a),{close:()=>a?.remove()}}return{create:o}}const se=e.defineComponent({__name:"VirtualList",props:{data:null,itemHeight:null},setup(t){const o=t,{list:n,containerProps:l,wrapperProps:a,innerProps:c}=K(e.toRef(o,"data"),{itemHeight:r=>o.itemHeight(0),overscan:10});return(r,u)=>(e.openBlock(),e.createElementBlock("div",{ref:e.unref(l).ref,onScrollPassive:u[0]||(u[0]=(...s)=>e.unref(l).onScroll&&e.unref(l).onScroll(...s)),class:"hiddenScorllBar-firefox hiddenScorllBar h-full overflow-hidden",style:e.normalizeStyle(e.unref(l).style)},[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(a))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(c))),[(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(r.$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[l,a]of o)n[l]=a;return n})(se,[["__scopeId","data-v-b9b7f6cb"]]);i.VirtualList=ie,i.allSelectedKey=R,i.closeDialogKey=H,i.dialogController=ae,i.isAllSelectedKey=N,i.isSelectedKey=A,i.selectKey=V,i.toggleAllKey=k,i.toggleKey=x,i.unselectAllKey=$,i.unselectKey=z,i.useSelectable=le,i.useVirtualList=K,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export interface DialogProps {
|
|
2
2
|
visiable?: boolean;
|
|
3
3
|
closeOnClickOverlay?: boolean;
|
|
4
|
+
dialogClass?: string | string[] | object;
|
|
4
5
|
}
|
|
5
6
|
declare const _default: {
|
|
6
7
|
new (...args: any[]): {
|
|
@@ -9,12 +10,14 @@ declare const _default: {
|
|
|
9
10
|
$props: Partial<{
|
|
10
11
|
visiable: boolean;
|
|
11
12
|
closeOnClickOverlay: boolean;
|
|
13
|
+
dialogClass: string | object | string[];
|
|
12
14
|
}> & Omit<Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<DialogProps>, {
|
|
13
15
|
visiable: boolean;
|
|
14
16
|
closeOnClickOverlay: boolean;
|
|
17
|
+
dialogClass: string;
|
|
15
18
|
}>>> & {
|
|
16
|
-
"onUpdate:
|
|
17
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "visiable" | "closeOnClickOverlay">;
|
|
19
|
+
"onUpdate:visiable"?: ((...args: any[]) => any) | undefined;
|
|
20
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "visiable" | "closeOnClickOverlay" | "dialogClass">;
|
|
18
21
|
$attrs: {
|
|
19
22
|
[x: string]: unknown;
|
|
20
23
|
};
|
|
@@ -26,16 +29,18 @@ declare const _default: {
|
|
|
26
29
|
}>;
|
|
27
30
|
$root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
|
|
28
31
|
$parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
|
|
29
|
-
$emit: (event: "update:
|
|
32
|
+
$emit: (event: "update:visiable", ...args: any[]) => void;
|
|
30
33
|
$el: any;
|
|
31
34
|
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<DialogProps>, {
|
|
32
35
|
visiable: boolean;
|
|
33
36
|
closeOnClickOverlay: boolean;
|
|
37
|
+
dialogClass: string;
|
|
34
38
|
}>>> & {
|
|
35
|
-
"onUpdate:
|
|
36
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:
|
|
39
|
+
"onUpdate:visiable"?: ((...args: any[]) => any) | undefined;
|
|
40
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:visiable"[], string, {
|
|
37
41
|
visiable: boolean;
|
|
38
42
|
closeOnClickOverlay: boolean;
|
|
43
|
+
dialogClass: string | object | string[];
|
|
39
44
|
}> & {
|
|
40
45
|
beforeCreate?: ((() => void) | (() => void)[]) | undefined;
|
|
41
46
|
created?: ((() => void) | (() => void)[]) | undefined;
|
|
@@ -59,8 +64,9 @@ declare const _default: {
|
|
|
59
64
|
} & Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<DialogProps>, {
|
|
60
65
|
visiable: boolean;
|
|
61
66
|
closeOnClickOverlay: boolean;
|
|
67
|
+
dialogClass: string;
|
|
62
68
|
}>>> & {
|
|
63
|
-
"onUpdate:
|
|
69
|
+
"onUpdate:visiable"?: ((...args: any[]) => any) | undefined;
|
|
64
70
|
} & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties;
|
|
65
71
|
__isFragment?: undefined;
|
|
66
72
|
__isTeleport?: undefined;
|
|
@@ -68,11 +74,13 @@ declare const _default: {
|
|
|
68
74
|
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<DialogProps>, {
|
|
69
75
|
visiable: boolean;
|
|
70
76
|
closeOnClickOverlay: boolean;
|
|
77
|
+
dialogClass: string;
|
|
71
78
|
}>>> & {
|
|
72
|
-
"onUpdate:
|
|
73
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:
|
|
79
|
+
"onUpdate:visiable"?: ((...args: any[]) => any) | undefined;
|
|
80
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:visiable"[], "update:visiable", {
|
|
74
81
|
visiable: boolean;
|
|
75
82
|
closeOnClickOverlay: boolean;
|
|
83
|
+
dialogClass: string | object | string[];
|
|
76
84
|
}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
77
85
|
$slots: {
|
|
78
86
|
default: (_: {}) => any;
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ComponentOptions, type VNodeProps } from "vue";
|
|
2
|
+
import { type DialogProps } from "./Dialog.vue";
|
|
2
3
|
export * from "./keys";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
componentProps?:
|
|
6
|
-
}
|
|
7
|
-
export interface DialogOptions {
|
|
8
|
-
visiable?: boolean;
|
|
9
|
-
componentProps?: string[] | object;
|
|
10
|
-
}
|
|
11
|
-
export declare type DialogOptionsMap = {
|
|
12
|
-
[id: string]: DialogOptions;
|
|
13
|
-
};
|
|
14
|
-
export declare function DialogController(): {
|
|
15
|
-
create: (options: DialogControllerOptions) => {
|
|
4
|
+
declare type DialogControllerOptions = Omit<DialogProps, "visiable">;
|
|
5
|
+
export declare function dialogController(dialogProps?: DialogControllerOptions): {
|
|
6
|
+
create: <P>(component: ComponentOptions<P, any, any, any, any, any, any, any>, componentProps?: (VNodeProps & P) | undefined) => {
|
|
16
7
|
close: () => void;
|
|
17
8
|
};
|
|
18
9
|
};
|