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