@lazycatcloud/lzc-toolkit 0.0.45 → 0.0.47
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 +400 -343
- package/dist/index.umd.js +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/toast/Toast.vue.d.ts +17 -0
- package/dist/types/toast/ToastCreator.d.ts +13 -0
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
import { unref as
|
|
2
|
-
var
|
|
1
|
+
import { unref as _, getCurrentScope as Ce, onScopeDispose as Be, getCurrentInstance as Pe, onMounted as te, nextTick as ne, ref as g, watch as $, shallowRef as Re, computed as f, onUnmounted as ve, inject as H, provide as x, defineComponent as F, openBlock as I, createBlock as fe, Transition as pe, withCtx as he, createElementBlock as B, createElementVNode as E, withModifiers as $e, normalizeClass as Fe, renderSlot as oe, createCommentVNode as Ae, render as J, h as R, normalizeStyle as K, useSlots as Le, withDirectives as De, vShow as ke, pushScopeId as Me, popScopeId as We, toRef as Ve, mergeProps as je, normalizeProps as le, guardReactiveProps as se, Fragment as ze, renderList as Ke, toDisplayString as Ne } from "vue";
|
|
2
|
+
var re;
|
|
3
3
|
const A = typeof window < "u";
|
|
4
|
-
A && ((
|
|
5
|
-
function
|
|
6
|
-
return typeof
|
|
4
|
+
A && ((re = window?.navigator) == null ? void 0 : re.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
5
|
+
function X(t) {
|
|
6
|
+
return typeof t == "function" ? t() : _(t);
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
function
|
|
10
|
-
|
|
8
|
+
function Qe(t, e) {
|
|
9
|
+
function n(...o) {
|
|
10
|
+
t(() => e.apply(this, o), { fn: e, thisArg: this, args: o });
|
|
11
11
|
}
|
|
12
|
-
return
|
|
12
|
+
return n;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
let
|
|
16
|
-
return (
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
-
return
|
|
20
|
-
d && !
|
|
21
|
-
|
|
22
|
-
}, d)),
|
|
23
|
-
|
|
24
|
-
},
|
|
14
|
+
function Ue(t, e = {}) {
|
|
15
|
+
let n, o;
|
|
16
|
+
return (r) => {
|
|
17
|
+
const l = X(t), d = X(e.maxWait);
|
|
18
|
+
if (n && clearTimeout(n), l <= 0 || d !== void 0 && d <= 0)
|
|
19
|
+
return o && (clearTimeout(o), o = null), r();
|
|
20
|
+
d && !o && (o = setTimeout(() => {
|
|
21
|
+
n && clearTimeout(n), o = null, r();
|
|
22
|
+
}, d)), n = setTimeout(() => {
|
|
23
|
+
o && clearTimeout(o), o = null, r();
|
|
24
|
+
}, l);
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
return
|
|
27
|
+
function qe(t) {
|
|
28
|
+
return t;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
return
|
|
30
|
+
function Ye(t) {
|
|
31
|
+
return Ce() ? (Be(t), !0) : !1;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
return
|
|
33
|
+
function me(t, e = 200, n = {}) {
|
|
34
|
+
return Qe(Ue(e, n), t);
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
|
|
36
|
+
function Ge(t, e = !0) {
|
|
37
|
+
Pe() ? te(t) : e ? t() : ne(t);
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
var
|
|
41
|
-
const
|
|
42
|
-
return (
|
|
39
|
+
function ge(t) {
|
|
40
|
+
var e;
|
|
41
|
+
const n = X(t);
|
|
42
|
+
return (e = n?.$el) != null ? e : n;
|
|
43
43
|
}
|
|
44
|
-
const
|
|
44
|
+
const Je = A ? window : void 0;
|
|
45
45
|
A && window.document;
|
|
46
46
|
A && window.navigator;
|
|
47
47
|
A && window.location;
|
|
48
|
-
function
|
|
49
|
-
const
|
|
50
|
-
return
|
|
48
|
+
function Xe(t, e = !1) {
|
|
49
|
+
const n = g(), o = () => n.value = Boolean(t());
|
|
50
|
+
return o(), Ge(o, e), n;
|
|
51
51
|
}
|
|
52
|
-
const
|
|
53
|
-
ee
|
|
54
|
-
ee
|
|
55
|
-
var
|
|
56
|
-
var
|
|
57
|
-
for (var
|
|
58
|
-
|
|
59
|
-
if (
|
|
60
|
-
for (var
|
|
61
|
-
|
|
62
|
-
return
|
|
52
|
+
const Z = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, ee = "__vueuse_ssr_handlers__";
|
|
53
|
+
Z[ee] = Z[ee] || {};
|
|
54
|
+
Z[ee];
|
|
55
|
+
var ae = Object.getOwnPropertySymbols, Ze = Object.prototype.hasOwnProperty, et = Object.prototype.propertyIsEnumerable, tt = (t, e) => {
|
|
56
|
+
var n = {};
|
|
57
|
+
for (var o in t)
|
|
58
|
+
Ze.call(t, o) && e.indexOf(o) < 0 && (n[o] = t[o]);
|
|
59
|
+
if (t != null && ae)
|
|
60
|
+
for (var o of ae(t))
|
|
61
|
+
e.indexOf(o) < 0 && et.call(t, o) && (n[o] = t[o]);
|
|
62
|
+
return n;
|
|
63
63
|
};
|
|
64
|
-
function
|
|
65
|
-
const
|
|
66
|
-
let
|
|
67
|
-
const d =
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
|
|
64
|
+
function nt(t, e, n = {}) {
|
|
65
|
+
const o = n, { window: s = Je } = o, r = tt(o, ["window"]);
|
|
66
|
+
let l;
|
|
67
|
+
const d = Xe(() => s && "ResizeObserver" in s), m = () => {
|
|
68
|
+
l && (l.disconnect(), l = void 0);
|
|
69
|
+
}, p = $(() => ge(t), (h) => {
|
|
70
|
+
m(), d.value && s && h && (l = new ResizeObserver(e), l.observe(h, r));
|
|
71
71
|
}, { immediate: !0, flush: "post" }), v = () => {
|
|
72
|
-
|
|
72
|
+
m(), p();
|
|
73
73
|
};
|
|
74
|
-
return
|
|
74
|
+
return Ye(v), {
|
|
75
75
|
isSupported: d,
|
|
76
76
|
stop: v
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
-
function
|
|
80
|
-
const { box:
|
|
81
|
-
return
|
|
82
|
-
const d =
|
|
83
|
-
d ? (
|
|
84
|
-
},
|
|
85
|
-
|
|
79
|
+
function ot(t, e = { width: 0, height: 0 }, n = {}) {
|
|
80
|
+
const { box: o = "content-box" } = n, s = g(e.width), r = g(e.height);
|
|
81
|
+
return nt(t, ([l]) => {
|
|
82
|
+
const d = o === "border-box" ? l.borderBoxSize : o === "content-box" ? l.contentBoxSize : l.devicePixelContentBoxSize;
|
|
83
|
+
d ? (s.value = d.reduce((m, { inlineSize: p }) => m + p, 0), r.value = d.reduce((m, { blockSize: p }) => m + p, 0)) : (s.value = l.contentRect.width, r.value = l.contentRect.height);
|
|
84
|
+
}, n), $(() => ge(t), (l) => {
|
|
85
|
+
s.value = l ? e.width : 0, r.value = l ? e.height : 0;
|
|
86
86
|
}), {
|
|
87
|
-
width:
|
|
88
|
-
height:
|
|
87
|
+
width: s,
|
|
88
|
+
height: r
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
-
var
|
|
92
|
-
(function(
|
|
93
|
-
|
|
94
|
-
})(
|
|
95
|
-
var
|
|
96
|
-
for (var
|
|
97
|
-
|
|
98
|
-
if (
|
|
99
|
-
for (var
|
|
100
|
-
|
|
101
|
-
return
|
|
91
|
+
var ie;
|
|
92
|
+
(function(t) {
|
|
93
|
+
t.UP = "UP", t.RIGHT = "RIGHT", t.DOWN = "DOWN", t.LEFT = "LEFT", t.NONE = "NONE";
|
|
94
|
+
})(ie || (ie = {}));
|
|
95
|
+
var lt = Object.defineProperty, ue = Object.getOwnPropertySymbols, st = Object.prototype.hasOwnProperty, rt = Object.prototype.propertyIsEnumerable, ce = (t, e, n) => e in t ? lt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, at = (t, e) => {
|
|
96
|
+
for (var n in e || (e = {}))
|
|
97
|
+
st.call(e, n) && ce(t, n, e[n]);
|
|
98
|
+
if (ue)
|
|
99
|
+
for (var n of ue(e))
|
|
100
|
+
rt.call(e, n) && ce(t, n, e[n]);
|
|
101
|
+
return t;
|
|
102
102
|
};
|
|
103
|
-
const
|
|
103
|
+
const it = {
|
|
104
104
|
easeInSine: [0.12, 0, 0.39, 0],
|
|
105
105
|
easeOutSine: [0.61, 1, 0.88, 1],
|
|
106
106
|
easeInOutSine: [0.37, 0, 0.63, 1],
|
|
@@ -126,183 +126,183 @@ const vt = {
|
|
|
126
126
|
easeOutBack: [0.34, 1.56, 0.64, 1],
|
|
127
127
|
easeInOutBack: [0.68, -0.6, 0.32, 1.6]
|
|
128
128
|
};
|
|
129
|
-
|
|
130
|
-
linear:
|
|
131
|
-
},
|
|
132
|
-
function
|
|
133
|
-
const { scrollEndHook:
|
|
134
|
-
let
|
|
135
|
-
const v =
|
|
129
|
+
at({
|
|
130
|
+
linear: qe
|
|
131
|
+
}, it);
|
|
132
|
+
function ut(t, e) {
|
|
133
|
+
const { scrollEndHook: n, itemHeight: o, overscan: s = 5 } = e, r = g(null), l = ot(r), d = g(!0), m = me(Q, 100);
|
|
134
|
+
let p;
|
|
135
|
+
const v = Re(t), h = g(0), i = g({ start: 0, end: 10 });
|
|
136
136
|
let u = 0;
|
|
137
|
-
const
|
|
138
|
-
let { sum:
|
|
139
|
-
return v.value.map((
|
|
140
|
-
}),
|
|
141
|
-
let
|
|
142
|
-
return
|
|
137
|
+
const T = g([]), b = f(() => {
|
|
138
|
+
let { sum: a, height: c } = { sum: 0, height: 0 };
|
|
139
|
+
return v.value.map((S, y) => (typeof o == "number" ? c = o : c = o(y), a += c, { height: c, sum: a }));
|
|
140
|
+
}), N = f(() => V(i.value.start)), C = f(() => typeof o == "number" ? b.value.length * o : b.value[b.value.length - 1]?.sum || 0), L = f(() => {
|
|
141
|
+
let a = T.value.length - s, c = Math.max(a - u, 0);
|
|
142
|
+
return T.value.slice(c, a);
|
|
143
143
|
});
|
|
144
|
-
|
|
145
|
-
}),
|
|
146
|
-
[
|
|
147
|
-
([
|
|
148
|
-
(
|
|
144
|
+
te(() => {
|
|
145
|
+
}), ve(() => cancelAnimationFrame(p)), $(
|
|
146
|
+
[l.width, l.height, v],
|
|
147
|
+
([a, c]) => {
|
|
148
|
+
(a || c) && k();
|
|
149
149
|
},
|
|
150
150
|
{ deep: !0 }
|
|
151
|
-
), $(
|
|
152
|
-
|
|
151
|
+
), $(h, () => {
|
|
152
|
+
D(), m();
|
|
153
153
|
});
|
|
154
|
-
function
|
|
154
|
+
function D() {
|
|
155
155
|
d.value = !1;
|
|
156
156
|
}
|
|
157
|
-
function
|
|
158
|
-
d.value = !0,
|
|
157
|
+
function Q() {
|
|
158
|
+
d.value = !0, n?.();
|
|
159
159
|
}
|
|
160
|
-
function
|
|
161
|
-
cancelAnimationFrame(
|
|
160
|
+
function k() {
|
|
161
|
+
cancelAnimationFrame(p), p = requestAnimationFrame(M);
|
|
162
162
|
}
|
|
163
163
|
function M() {
|
|
164
|
-
if (
|
|
165
|
-
|
|
166
|
-
let
|
|
167
|
-
|
|
168
|
-
data:
|
|
169
|
-
index:
|
|
164
|
+
if (r.value) {
|
|
165
|
+
h.value = r.value.scrollTop, u = P();
|
|
166
|
+
let a = W(h.value), c = a + u + s;
|
|
167
|
+
a = a - s, a = a < 0 ? 0 : a, c = c > v.value.length ? v.value.length : c, i.value = { start: a, end: c }, T.value = v.value.slice(a, c).map((S, y) => ({
|
|
168
|
+
data: S,
|
|
169
|
+
index: y + a
|
|
170
170
|
}));
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
function
|
|
174
|
-
let c = 0,
|
|
175
|
-
for (; c <=
|
|
176
|
-
const
|
|
177
|
-
b.value[
|
|
173
|
+
function W(a) {
|
|
174
|
+
let c = 0, S = b.value.length - 1, y = -1;
|
|
175
|
+
for (; c <= S; ) {
|
|
176
|
+
const w = Math.floor((c + S) / 2);
|
|
177
|
+
b.value[w].sum >= a ? (y = w, S = w - 1) : c = w + 1;
|
|
178
178
|
}
|
|
179
|
-
return Math.max(0,
|
|
179
|
+
return Math.max(0, y);
|
|
180
180
|
}
|
|
181
|
-
function
|
|
182
|
-
let
|
|
183
|
-
for (let
|
|
181
|
+
function P() {
|
|
182
|
+
let a = 0, c = 0, S = U();
|
|
183
|
+
for (let y = S; y < b.value.length && (a++, c += b.value[y].height, !(c >= l.height.value)); y++)
|
|
184
184
|
;
|
|
185
|
-
return
|
|
185
|
+
return a;
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
if (typeof
|
|
189
|
-
return
|
|
190
|
-
let c = b.value[
|
|
187
|
+
function V(a) {
|
|
188
|
+
if (typeof o == "number")
|
|
189
|
+
return a * o;
|
|
190
|
+
let c = b.value[a];
|
|
191
191
|
return c ? c.sum - c.height : 0;
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
return b.value[
|
|
193
|
+
function j(a) {
|
|
194
|
+
return b.value[a] || { sum: 0, height: 0 };
|
|
195
195
|
}
|
|
196
196
|
function U() {
|
|
197
|
-
let
|
|
198
|
-
return
|
|
197
|
+
let a = i.value.start;
|
|
198
|
+
return a >= s && (a += s), a;
|
|
199
199
|
}
|
|
200
|
-
function q(
|
|
201
|
-
if (
|
|
202
|
-
const c =
|
|
203
|
-
|
|
200
|
+
function q(a) {
|
|
201
|
+
if (r.value) {
|
|
202
|
+
const c = j(a);
|
|
203
|
+
r.value.scrollTop = c.sum - c.height, M();
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
const Y =
|
|
206
|
+
const Y = f(() => ({
|
|
207
207
|
style: {
|
|
208
208
|
width: "100%",
|
|
209
|
-
height: `${
|
|
209
|
+
height: `${C.value}px`,
|
|
210
210
|
pointerEvents: d.value ? void 0 : "none"
|
|
211
211
|
}
|
|
212
|
-
})),
|
|
212
|
+
})), z = f(() => ({
|
|
213
213
|
style: {
|
|
214
|
-
transform: `translate3d(0, ${
|
|
214
|
+
transform: `translate3d(0, ${N.value}px, 0)`,
|
|
215
215
|
"will-change": "transform"
|
|
216
216
|
}
|
|
217
217
|
})), G = {
|
|
218
218
|
overflowY: "auto"
|
|
219
219
|
};
|
|
220
220
|
return {
|
|
221
|
-
list:
|
|
222
|
-
visiableList:
|
|
223
|
-
getItemHeightData:
|
|
224
|
-
getoffsetTopIndex:
|
|
225
|
-
totalHeight:
|
|
226
|
-
clientHeight:
|
|
221
|
+
list: T,
|
|
222
|
+
visiableList: L,
|
|
223
|
+
getItemHeightData: j,
|
|
224
|
+
getoffsetTopIndex: W,
|
|
225
|
+
totalHeight: C,
|
|
226
|
+
clientHeight: l.height,
|
|
227
227
|
scrollTo: q,
|
|
228
|
-
scrollTop:
|
|
228
|
+
scrollTop: h,
|
|
229
229
|
isScrollEnd: d,
|
|
230
230
|
containerProps: {
|
|
231
|
-
ref:
|
|
231
|
+
ref: r,
|
|
232
232
|
onScroll: () => {
|
|
233
|
-
|
|
233
|
+
k();
|
|
234
234
|
},
|
|
235
235
|
style: G
|
|
236
236
|
},
|
|
237
237
|
wrapperProps: Y,
|
|
238
|
-
innerProps:
|
|
238
|
+
innerProps: z
|
|
239
239
|
};
|
|
240
240
|
}
|
|
241
|
-
const
|
|
242
|
-
function
|
|
243
|
-
const { voidFn:
|
|
241
|
+
const be = Symbol(), _e = Symbol(), ye = Symbol(), we = Symbol(), Se = Symbol(), Oe = Symbol(), xe = Symbol(), Ee = Symbol(), Te = Symbol();
|
|
242
|
+
function xt() {
|
|
243
|
+
const { voidFn: t, boolFn: e, boolRef: n, arrayRef: o } = {
|
|
244
244
|
voidFn: (u) => {
|
|
245
245
|
},
|
|
246
246
|
boolFn: (u) => !1,
|
|
247
|
-
boolRef:
|
|
248
|
-
arrayRef:
|
|
249
|
-
},
|
|
247
|
+
boolRef: f(() => !1),
|
|
248
|
+
arrayRef: f(() => [])
|
|
249
|
+
}, s = H(we, o), r = H(ye, e), l = H(Ee, n), d = H(_e, t), m = H(be, t), p = H(Se, t), v = H(Oe, t), h = H(xe, t), i = H(Te, t);
|
|
250
250
|
return {
|
|
251
|
-
selected:
|
|
252
|
-
isSelected:
|
|
253
|
-
isAllSelected:
|
|
251
|
+
selected: s,
|
|
252
|
+
isSelected: r,
|
|
253
|
+
isAllSelected: l,
|
|
254
254
|
toggle: d,
|
|
255
|
-
toggleAll:
|
|
256
|
-
select:
|
|
255
|
+
toggleAll: m,
|
|
256
|
+
select: p,
|
|
257
257
|
selectAll: v,
|
|
258
|
-
unselect:
|
|
258
|
+
unselect: h,
|
|
259
259
|
unselectAll: i
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
|
-
function
|
|
263
|
-
const
|
|
264
|
-
function
|
|
265
|
-
|
|
266
|
-
|
|
262
|
+
function Et(t, e) {
|
|
263
|
+
const n = g({}), o = f(() => t.value.filter((i) => n.value[i[e]])), s = f(() => o.value.length != 0 && Object.keys(n.value).length == t.value.length);
|
|
264
|
+
function r() {
|
|
265
|
+
t.value.forEach((i) => {
|
|
266
|
+
n.value[i[e]] = !0;
|
|
267
267
|
});
|
|
268
268
|
}
|
|
269
|
-
function
|
|
270
|
-
|
|
269
|
+
function l() {
|
|
270
|
+
n.value = {};
|
|
271
271
|
}
|
|
272
272
|
function d(i) {
|
|
273
273
|
i.forEach((u) => {
|
|
274
|
-
|
|
274
|
+
n.value[u[e]] || (n.value[u[e]] = !0);
|
|
275
275
|
});
|
|
276
276
|
}
|
|
277
|
-
function
|
|
277
|
+
function m(i) {
|
|
278
278
|
i.forEach((u) => {
|
|
279
|
-
|
|
279
|
+
n.value[u[e]] && delete n.value[u[e]];
|
|
280
280
|
});
|
|
281
281
|
}
|
|
282
|
-
function
|
|
283
|
-
return !!
|
|
282
|
+
function p(i) {
|
|
283
|
+
return !!n.value[i[e]];
|
|
284
284
|
}
|
|
285
285
|
function v(i) {
|
|
286
286
|
i.forEach((u) => {
|
|
287
|
-
|
|
287
|
+
p(u) ? delete n.value[u[e]] : n.value[u[e]] = !0;
|
|
288
288
|
});
|
|
289
289
|
}
|
|
290
|
-
function
|
|
291
|
-
|
|
290
|
+
function h() {
|
|
291
|
+
s.value ? l() : r();
|
|
292
292
|
}
|
|
293
|
-
return x(
|
|
294
|
-
selected:
|
|
293
|
+
return x(be, h), x(_e, v), x(ye, p), x(we, o), x(Se, d), x(Oe, r), x(xe, m), x(Ee, s), x(Te, l), {
|
|
294
|
+
selected: o,
|
|
295
295
|
select: d,
|
|
296
|
-
selectAll:
|
|
297
|
-
unselect:
|
|
298
|
-
unselectAll:
|
|
296
|
+
selectAll: r,
|
|
297
|
+
unselect: m,
|
|
298
|
+
unselectAll: l,
|
|
299
299
|
toggle: v,
|
|
300
|
-
toggleAll:
|
|
301
|
-
isSelected:
|
|
302
|
-
isAllSelected:
|
|
300
|
+
toggleAll: h,
|
|
301
|
+
isSelected: p,
|
|
302
|
+
isAllSelected: s
|
|
303
303
|
};
|
|
304
304
|
}
|
|
305
|
-
const
|
|
305
|
+
const ct = Symbol(), dt = /* @__PURE__ */ F({
|
|
306
306
|
__name: "Dialog",
|
|
307
307
|
props: {
|
|
308
308
|
visiable: { type: Boolean, default: !1 },
|
|
@@ -310,58 +310,58 @@ const pt = Symbol(), ht = /* @__PURE__ */ N({
|
|
|
310
310
|
dialogClass: { default: "" }
|
|
311
311
|
},
|
|
312
312
|
emits: ["update:visiable"],
|
|
313
|
-
setup(
|
|
314
|
-
const
|
|
315
|
-
|
|
313
|
+
setup(t, { emit: e }) {
|
|
314
|
+
const n = t, o = () => {
|
|
315
|
+
n.closeOnClickOverlay && e("update:visiable", !1);
|
|
316
316
|
};
|
|
317
|
-
return x(
|
|
318
|
-
default:
|
|
319
|
-
|
|
317
|
+
return x(ct, () => e("update:visiable", !1)), (s, r) => (I(), fe(pe, { name: "modal" }, {
|
|
318
|
+
default: he(() => [
|
|
319
|
+
t.visiable ? (I(), B("div", {
|
|
320
320
|
key: 0,
|
|
321
|
-
onClick:
|
|
322
|
-
class: "modal absolute
|
|
321
|
+
onClick: o,
|
|
322
|
+
class: "modal absolute inset-0 bottom-0 flex bg-stone-900 bg-opacity-50 z-[999]"
|
|
323
323
|
}, [
|
|
324
|
-
|
|
325
|
-
onClick:
|
|
324
|
+
E("div", {
|
|
325
|
+
onClick: r[0] || (r[0] = $e(() => {
|
|
326
326
|
}, ["stop"])),
|
|
327
|
-
class:
|
|
327
|
+
class: Fe(["dialog m-auto flex flex-col", t.dialogClass])
|
|
328
328
|
}, [
|
|
329
|
-
|
|
329
|
+
oe(s.$slots, "default")
|
|
330
330
|
], 2)
|
|
331
|
-
])) :
|
|
331
|
+
])) : Ae("", !0)
|
|
332
332
|
]),
|
|
333
333
|
_: 3
|
|
334
334
|
}));
|
|
335
335
|
}
|
|
336
336
|
});
|
|
337
|
-
function
|
|
338
|
-
function
|
|
339
|
-
const
|
|
337
|
+
function Tt(t) {
|
|
338
|
+
function e(n, o) {
|
|
339
|
+
const s = document.createElement("div"), r = {
|
|
340
340
|
setup() {
|
|
341
|
-
return () =>
|
|
342
|
-
|
|
341
|
+
return () => R(
|
|
342
|
+
dt,
|
|
343
343
|
{
|
|
344
344
|
visiable: !0,
|
|
345
345
|
"onUpdate:visiable": () => {
|
|
346
|
-
|
|
346
|
+
s?.remove();
|
|
347
347
|
},
|
|
348
|
-
...
|
|
348
|
+
...t
|
|
349
349
|
},
|
|
350
350
|
{
|
|
351
|
-
default: () =>
|
|
351
|
+
default: () => R(n, o)
|
|
352
352
|
}
|
|
353
353
|
);
|
|
354
354
|
}
|
|
355
355
|
};
|
|
356
|
-
return document.body.appendChild(
|
|
357
|
-
close: () =>
|
|
356
|
+
return document.body.appendChild(s), J(R(r), s), {
|
|
357
|
+
close: () => s?.remove()
|
|
358
358
|
};
|
|
359
359
|
}
|
|
360
360
|
return {
|
|
361
|
-
create:
|
|
361
|
+
create: e
|
|
362
362
|
};
|
|
363
363
|
}
|
|
364
|
-
const
|
|
364
|
+
const vt = ["xlink:href", "fill", "color"], Ht = /* @__PURE__ */ F({
|
|
365
365
|
__name: "SvgIcon",
|
|
366
366
|
props: {
|
|
367
367
|
name: null,
|
|
@@ -370,133 +370,128 @@ const gt = ["xlink:href", "fill", "color"], Tt = /* @__PURE__ */ N({
|
|
|
370
370
|
width: null,
|
|
371
371
|
height: null
|
|
372
372
|
},
|
|
373
|
-
setup(
|
|
374
|
-
const
|
|
375
|
-
width: `${
|
|
376
|
-
height: `${
|
|
377
|
-
aspectRatio:
|
|
373
|
+
setup(t) {
|
|
374
|
+
const e = t, n = f(() => `#${e.prefix}-${e.name}`), o = f(() => ({
|
|
375
|
+
width: `${e.width ?? e.height}px`,
|
|
376
|
+
height: `${e.height ?? e.width}px`,
|
|
377
|
+
aspectRatio: e.width && e.height ? void 0 : "1/1"
|
|
378
378
|
}));
|
|
379
|
-
return (
|
|
379
|
+
return (s, r) => (I(), B("svg", {
|
|
380
380
|
"aria-hidden": "",
|
|
381
|
-
style:
|
|
381
|
+
style: K(_(o))
|
|
382
382
|
}, [
|
|
383
|
-
|
|
384
|
-
"xlink:href":
|
|
385
|
-
fill:
|
|
386
|
-
color:
|
|
387
|
-
}, null, 8,
|
|
383
|
+
E("use", {
|
|
384
|
+
"xlink:href": _(n),
|
|
385
|
+
fill: t.color,
|
|
386
|
+
color: t.color
|
|
387
|
+
}, null, 8, vt)
|
|
388
388
|
], 4));
|
|
389
389
|
}
|
|
390
390
|
});
|
|
391
|
-
function
|
|
391
|
+
function ft(t) {
|
|
392
392
|
const {
|
|
393
|
-
containerEl:
|
|
394
|
-
sliderEl:
|
|
395
|
-
autoHeight:
|
|
396
|
-
performance:
|
|
397
|
-
maxHeightRatio:
|
|
398
|
-
} =
|
|
399
|
-
let
|
|
400
|
-
const v =
|
|
393
|
+
containerEl: e,
|
|
394
|
+
sliderEl: n,
|
|
395
|
+
autoHeight: o,
|
|
396
|
+
performance: s = {},
|
|
397
|
+
maxHeightRatio: r = 0.9
|
|
398
|
+
} = t, l = g(!0), d = me(V, 100);
|
|
399
|
+
let m, p = "";
|
|
400
|
+
const v = g(0), h = g(0), i = g(0), u = g({
|
|
401
401
|
top: 0,
|
|
402
402
|
scrollTop: 0,
|
|
403
403
|
scrollHeight: 0,
|
|
404
404
|
clientHeight: 0
|
|
405
|
-
}),
|
|
405
|
+
}), T = g({
|
|
406
406
|
clientHeight: 0
|
|
407
|
-
}), b =
|
|
407
|
+
}), b = f(() => !!h.value), N = f(() => u.value.scrollHeight > u.value.clientHeight), C = f(() => u.value.clientHeight - T.value.clientHeight), L = f(() => u.value.scrollHeight - u.value.clientHeight), D = f(() => Math.max(
|
|
408
408
|
u.value.clientHeight / u.value.scrollHeight,
|
|
409
409
|
0.05
|
|
410
|
-
)),
|
|
410
|
+
)), Q = f(() => D.value > r ? 0 : D.value * u.value.clientHeight), k = f(() => ({
|
|
411
411
|
willChange: "transform",
|
|
412
412
|
transform: `translate3d(0,${i.value}px,0)`,
|
|
413
|
-
height:
|
|
413
|
+
height: o ? `${Q.value}px` : void 0
|
|
414
414
|
}));
|
|
415
|
-
function M(
|
|
416
|
-
|
|
415
|
+
function M(w) {
|
|
416
|
+
P(), h.value = w.clientY - n.value.getBoundingClientRect().top || 1, p = getComputedStyle(e.value).scrollBehavior, p === "smooth" && (e.value.style.scrollBehavior = "unset");
|
|
417
417
|
}
|
|
418
|
-
function
|
|
419
|
-
|
|
418
|
+
function W() {
|
|
419
|
+
e.value.style.scrollBehavior = p, h.value = 0, d();
|
|
420
420
|
}
|
|
421
|
-
function
|
|
422
|
-
|
|
421
|
+
function P() {
|
|
422
|
+
l.value = !1;
|
|
423
423
|
}
|
|
424
|
-
function
|
|
425
|
-
b.value || (
|
|
424
|
+
function V() {
|
|
425
|
+
b.value || (l.value = !0);
|
|
426
426
|
}
|
|
427
|
-
function
|
|
427
|
+
function j(w) {
|
|
428
428
|
if (!b.value)
|
|
429
429
|
return;
|
|
430
|
-
let
|
|
431
|
-
|
|
432
|
-
top: i.value /
|
|
430
|
+
let O = w.clientY - u.value.top - h.value;
|
|
431
|
+
O < 0 ? i.value = 0 : O >= C.value ? i.value = C.value : i.value = O, e.value.scrollTo({
|
|
432
|
+
top: i.value / C.value * L.value
|
|
433
433
|
});
|
|
434
434
|
}
|
|
435
435
|
function U() {
|
|
436
436
|
b.value || q();
|
|
437
437
|
}
|
|
438
438
|
function q() {
|
|
439
|
-
cancelAnimationFrame(
|
|
439
|
+
cancelAnimationFrame(m), m = requestAnimationFrame(Y);
|
|
440
440
|
}
|
|
441
441
|
function Y() {
|
|
442
|
-
|
|
442
|
+
e.value && (v.value = s.scrollTop?.value ?? e.value.scrollTop, i.value = v.value / L.value * C.value);
|
|
443
443
|
}
|
|
444
|
-
function
|
|
445
|
-
let
|
|
446
|
-
|
|
444
|
+
function z(w) {
|
|
445
|
+
let O = "addEventListener";
|
|
446
|
+
w === "add" ? O = "addEventListener" : O = "removeEventListener", n.value?.[O]("pointerdown", M, {
|
|
447
447
|
passive: !0
|
|
448
|
-
}), window[
|
|
448
|
+
}), window[O]("pointermove", j, { passive: !0 }), window[O]("pointerup", W, { passive: !0 });
|
|
449
449
|
}
|
|
450
|
-
const G = new MutationObserver((
|
|
451
|
-
|
|
450
|
+
const G = new MutationObserver((w) => {
|
|
451
|
+
w.map((Ie) => Ie.oldValue).join().includes("height") && a();
|
|
452
452
|
});
|
|
453
|
-
function
|
|
454
|
-
u.value.top =
|
|
453
|
+
function a() {
|
|
454
|
+
u.value.top = e.value?.getBoundingClientRect().top ?? 0, u.value.scrollHeight = e.value?.scrollHeight ?? 0, u.value.clientHeight = e.value?.clientHeight ?? 0;
|
|
455
455
|
}
|
|
456
456
|
function c() {
|
|
457
|
-
|
|
458
|
-
|
|
457
|
+
P(), setTimeout(() => {
|
|
458
|
+
T.value.clientHeight = n.value?.clientHeight ?? 0, V();
|
|
459
459
|
}, 150);
|
|
460
460
|
}
|
|
461
|
-
function
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
function w() {
|
|
473
|
-
t.value && l.value ? (O(
|
|
474
|
-
".hide-scrollbar",
|
|
475
|
-
"scrollbar-width: none; -ms-overflow-style: none;"
|
|
476
|
-
), O(".hide-scrollbar::-webkit-scrollbar", "display: none"), t.value.addEventListener("scroll", U, {
|
|
461
|
+
function S() {
|
|
462
|
+
document.styleSheets[0].insertRule(
|
|
463
|
+
".hide-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }",
|
|
464
|
+
0
|
|
465
|
+
), document.styleSheets[0].insertRule(
|
|
466
|
+
".hide-scrollbar::-webkit-scrollbar{ display: none }",
|
|
467
|
+
0
|
|
468
|
+
), e.value?.classList.add("hide-scrollbar");
|
|
469
|
+
}
|
|
470
|
+
function y() {
|
|
471
|
+
e.value && n.value ? (S(), e.value.addEventListener("scroll", U, {
|
|
477
472
|
passive: !0
|
|
478
|
-
}),
|
|
473
|
+
}), z("add"), G.observe(e.value, {
|
|
479
474
|
subtree: !0,
|
|
480
475
|
attributeOldValue: !0,
|
|
481
476
|
attributeFilter: ["style"]
|
|
482
477
|
}), setTimeout(() => {
|
|
483
|
-
|
|
484
|
-
}, 100), c()) : console.error("useScrollBar:", "\u521D\u59CB\u5316\u5931\u8D25!", { containerEl:
|
|
478
|
+
a();
|
|
479
|
+
}, 100), c()) : console.error("useScrollBar:", "\u521D\u59CB\u5316\u5931\u8D25!", { containerEl: e, sliderEl: n });
|
|
485
480
|
}
|
|
486
481
|
return $(v, () => {
|
|
487
|
-
|
|
482
|
+
P(), d();
|
|
488
483
|
}), {
|
|
489
|
-
isScrollEnd:
|
|
484
|
+
isScrollEnd: l,
|
|
490
485
|
isDragSlider: b,
|
|
491
486
|
offsetTop: i,
|
|
492
487
|
scrollTop: v,
|
|
493
|
-
scrollable:
|
|
494
|
-
sliderPos:
|
|
495
|
-
init:
|
|
496
|
-
modifySliderEventListener:
|
|
488
|
+
scrollable: N,
|
|
489
|
+
sliderPos: k,
|
|
490
|
+
init: y,
|
|
491
|
+
modifySliderEventListener: z
|
|
497
492
|
};
|
|
498
493
|
}
|
|
499
|
-
const
|
|
494
|
+
const pt = (t) => (Me("data-v-edec7292"), t = t(), We(), t), ht = /* @__PURE__ */ pt(() => /* @__PURE__ */ E("div", { class: "default-slider" }, null, -1)), mt = /* @__PURE__ */ F({
|
|
500
495
|
__name: "ScrollBar",
|
|
501
496
|
props: {
|
|
502
497
|
containerEl: null,
|
|
@@ -504,19 +499,19 @@ const bt = (e) => (Ne("data-v-edec7292"), e = e(), Qe(), e), yt = /* @__PURE__ *
|
|
|
504
499
|
autoHeight: { type: Boolean },
|
|
505
500
|
performance: null
|
|
506
501
|
},
|
|
507
|
-
setup(
|
|
508
|
-
const
|
|
509
|
-
containerEl:
|
|
510
|
-
sliderEl:
|
|
511
|
-
autoHeight:
|
|
512
|
-
performance:
|
|
513
|
-
}), { scrollable: d, isScrollEnd:
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
502
|
+
setup(t, { expose: e }) {
|
|
503
|
+
const n = t, o = !!Le().default, s = g(null), r = f(() => n.containerEl), l = ft({
|
|
504
|
+
containerEl: r,
|
|
505
|
+
sliderEl: s,
|
|
506
|
+
autoHeight: o ? n.autoHeight : !0,
|
|
507
|
+
performance: n.performance
|
|
508
|
+
}), { scrollable: d, isScrollEnd: m, sliderPos: p } = l, v = g(!1), h = n.autoHide ? f(() => v.value || !m.value) : f(() => d.value);
|
|
509
|
+
te(() => {
|
|
510
|
+
ne(() => {
|
|
511
|
+
l.init();
|
|
517
512
|
});
|
|
518
|
-
}),
|
|
519
|
-
|
|
513
|
+
}), ve(() => {
|
|
514
|
+
l.modifySliderEventListener("remove");
|
|
520
515
|
});
|
|
521
516
|
function i() {
|
|
522
517
|
v.value = !0;
|
|
@@ -524,36 +519,36 @@ const bt = (e) => (Ne("data-v-edec7292"), e = e(), Qe(), e), yt = /* @__PURE__ *
|
|
|
524
519
|
function u() {
|
|
525
520
|
v.value = !1;
|
|
526
521
|
}
|
|
527
|
-
return
|
|
528
|
-
default:
|
|
529
|
-
|
|
522
|
+
return e({ uScrollBarReturn: l }), (T, b) => (I(), fe(pe, null, {
|
|
523
|
+
default: he(() => [
|
|
524
|
+
De(E("div", {
|
|
530
525
|
ref_key: "sliderRef",
|
|
531
|
-
ref:
|
|
526
|
+
ref: s,
|
|
532
527
|
class: "slider-wrapper",
|
|
533
528
|
onMouseenter: i,
|
|
534
529
|
onMouseleave: u,
|
|
535
|
-
style:
|
|
530
|
+
style: K(_(p))
|
|
536
531
|
}, [
|
|
537
|
-
|
|
538
|
-
|
|
532
|
+
oe(T.$slots, "default", {}, () => [
|
|
533
|
+
ht
|
|
539
534
|
], !0)
|
|
540
535
|
], 36), [
|
|
541
|
-
[
|
|
536
|
+
[ke, _(h)]
|
|
542
537
|
])
|
|
543
538
|
]),
|
|
544
539
|
_: 3
|
|
545
540
|
}));
|
|
546
541
|
}
|
|
547
542
|
});
|
|
548
|
-
const
|
|
549
|
-
const
|
|
550
|
-
for (const [
|
|
551
|
-
|
|
552
|
-
return
|
|
553
|
-
},
|
|
543
|
+
const He = (t, e) => {
|
|
544
|
+
const n = t.__vccOpts || t;
|
|
545
|
+
for (const [o, s] of e)
|
|
546
|
+
n[o] = s;
|
|
547
|
+
return n;
|
|
548
|
+
}, It = /* @__PURE__ */ He(mt, [["__scopeId", "data-v-edec7292"]]), gt = { class: "virtualListWrapper" }, bt = {
|
|
554
549
|
inheritAttrs: !1
|
|
555
|
-
},
|
|
556
|
-
...
|
|
550
|
+
}, _t = /* @__PURE__ */ F({
|
|
551
|
+
...bt,
|
|
557
552
|
__name: "VirtualList",
|
|
558
553
|
props: {
|
|
559
554
|
data: null,
|
|
@@ -561,32 +556,32 @@ const Be = (e, t) => {
|
|
|
561
556
|
overscan: { default: 10 }
|
|
562
557
|
},
|
|
563
558
|
emits: ["scrollEnd"],
|
|
564
|
-
setup(
|
|
565
|
-
const
|
|
566
|
-
itemHeight: (v) =>
|
|
567
|
-
overscan:
|
|
559
|
+
setup(t, { expose: e, emit: n }) {
|
|
560
|
+
const o = t, s = ut(Ve(o, "data"), {
|
|
561
|
+
itemHeight: (v) => o.itemHeight(o.data[v]),
|
|
562
|
+
overscan: o.overscan,
|
|
568
563
|
scrollEndHook: () => {
|
|
569
|
-
|
|
564
|
+
n("scrollEnd");
|
|
570
565
|
}
|
|
571
|
-
}), { list:
|
|
572
|
-
return
|
|
573
|
-
vListReturn:
|
|
574
|
-
}), (v,
|
|
575
|
-
|
|
576
|
-
onScrollPassive:
|
|
577
|
-
ref:
|
|
566
|
+
}), { list: r, containerProps: l, wrapperProps: d, innerProps: m, getItemHeightData: p } = s;
|
|
567
|
+
return e({
|
|
568
|
+
vListReturn: s
|
|
569
|
+
}), (v, h) => (I(), B("div", gt, [
|
|
570
|
+
E("div", je({
|
|
571
|
+
onScrollPassive: h[0] || (h[0] = (...i) => _(l).onScroll && _(l).onScroll(...i)),
|
|
572
|
+
ref: _(l).ref,
|
|
578
573
|
class: "virtualList"
|
|
579
574
|
}, v.$attrs), [
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
(
|
|
575
|
+
E("div", le(se(_(d))), [
|
|
576
|
+
E("div", le(se(_(m))), [
|
|
577
|
+
(I(!0), B(ze, null, Ke(_(r), ({ index: i, data: u }) => (I(), B("div", {
|
|
583
578
|
key: i,
|
|
584
|
-
style:
|
|
585
|
-
height: `${
|
|
579
|
+
style: K({
|
|
580
|
+
height: `${_(p)(i).height}px`,
|
|
586
581
|
display: "flex"
|
|
587
582
|
})
|
|
588
583
|
}, [
|
|
589
|
-
|
|
584
|
+
oe(v.$slots, "default", {
|
|
590
585
|
data: u,
|
|
591
586
|
index: i
|
|
592
587
|
}, void 0, !0)
|
|
@@ -597,23 +592,85 @@ const Be = (e, t) => {
|
|
|
597
592
|
]));
|
|
598
593
|
}
|
|
599
594
|
});
|
|
600
|
-
const Ct = /* @__PURE__ */
|
|
595
|
+
const Ct = /* @__PURE__ */ He(_t, [["__scopeId", "data-v-4ba97cce"]]), yt = { class: "flex w-full max-w-[700px] items-center justify-center" }, wt = { class: "text-[14px] text-white" }, St = /* @__PURE__ */ F({
|
|
596
|
+
__name: "Toast",
|
|
597
|
+
props: {
|
|
598
|
+
message: null,
|
|
599
|
+
position: null
|
|
600
|
+
},
|
|
601
|
+
setup(t) {
|
|
602
|
+
const e = t, n = g(), o = g(), s = g(), r = f(() => {
|
|
603
|
+
switch (e.position) {
|
|
604
|
+
case "top":
|
|
605
|
+
return 10;
|
|
606
|
+
case "middle":
|
|
607
|
+
return 50;
|
|
608
|
+
case "bottom":
|
|
609
|
+
return 85;
|
|
610
|
+
}
|
|
611
|
+
}), l = f(() => ({
|
|
612
|
+
top: `calc(${r.value}% - ${s.value}px)`,
|
|
613
|
+
left: `calc(50% - ${o.value}px)`,
|
|
614
|
+
backgroundColor: "black"
|
|
615
|
+
}));
|
|
616
|
+
return ne(() => {
|
|
617
|
+
o.value = n.value.offsetWidth / 2, s.value = n.value.offsetHeight / 2;
|
|
618
|
+
}), (d, m) => (I(), B("div", null, [
|
|
619
|
+
E("div", {
|
|
620
|
+
id: "toastWrapper",
|
|
621
|
+
ref_key: "toastWrapper",
|
|
622
|
+
ref: n,
|
|
623
|
+
class: "absolute rounded-[8px] bg-black px-[14px] py-[12px] opacity-[0.79]",
|
|
624
|
+
style: K([_(l), { zIndex: 9999 }])
|
|
625
|
+
}, [
|
|
626
|
+
E("div", yt, [
|
|
627
|
+
E("span", wt, Ne(t.message), 1)
|
|
628
|
+
])
|
|
629
|
+
], 4)
|
|
630
|
+
]));
|
|
631
|
+
}
|
|
632
|
+
}), de = {
|
|
633
|
+
message: "\u61D2\u732B\u4E91 Yes!!!",
|
|
634
|
+
position: "middle",
|
|
635
|
+
duration: 1500
|
|
636
|
+
};
|
|
637
|
+
class Bt {
|
|
638
|
+
options;
|
|
639
|
+
container;
|
|
640
|
+
constructor(e) {
|
|
641
|
+
this.options = e, this.container = document.createElement("div");
|
|
642
|
+
}
|
|
643
|
+
present() {
|
|
644
|
+
const e = R(R(St), { ...de, ...this.options });
|
|
645
|
+
J(e, this.container), document.body.insertBefore(this.container, document.body.firstChild);
|
|
646
|
+
const n = this.options.duration || de.duration;
|
|
647
|
+
setTimeout(() => {
|
|
648
|
+
this.dismiss();
|
|
649
|
+
}, n);
|
|
650
|
+
}
|
|
651
|
+
dismiss() {
|
|
652
|
+
this.container && (this.container.querySelector("#toastWrapper")?.classList.add("animate-toastAnimation"), setTimeout(() => {
|
|
653
|
+
this.container && (J(null, this.container), document.body.removeChild(this.container));
|
|
654
|
+
}, 500));
|
|
655
|
+
}
|
|
656
|
+
}
|
|
601
657
|
export {
|
|
602
|
-
|
|
603
|
-
|
|
658
|
+
It as ScrollBar,
|
|
659
|
+
Ht as SvgIcon,
|
|
660
|
+
Bt as ToastCreator,
|
|
604
661
|
Ct as VirtualList,
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
662
|
+
we as allSelectedKey,
|
|
663
|
+
ct as closeDialogKey,
|
|
664
|
+
Tt as dialogController,
|
|
665
|
+
Ee as isAllSelectedKey,
|
|
666
|
+
ye as isSelectedKey,
|
|
667
|
+
Oe as selectAllKey,
|
|
668
|
+
Se as selectKey,
|
|
669
|
+
be as toggleAllKey,
|
|
670
|
+
_e as toggleKey,
|
|
671
|
+
Te as unselectAllKey,
|
|
672
|
+
xe as unselectKey,
|
|
673
|
+
Et as useSelectable,
|
|
674
|
+
xt as useSelectableInjectors,
|
|
675
|
+
ut as useVirtualList
|
|
619
676
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(h,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(h=typeof globalThis<"u"?globalThis:h||self,e(h.ui={},h.Vue))})(this,function(h,e){"use strict";var le;const B=typeof window<"u";B&&((le=window?.navigator)==null?void 0:le.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function j(t){return typeof t=="function"?t():e.unref(t)}function me(t,l){function n(...o){t(()=>l.apply(this,o),{fn:l,thisArg:this,args:o})}return n}function ge(t,l={}){let n,o;return s=>{const r=j(t),f=j(l.maxWait);if(n&&clearTimeout(n),r<=0||f!==void 0&&f<=0)return o&&(clearTimeout(o),o=null),s();f&&!o&&(o=setTimeout(()=>{n&&clearTimeout(n),o=null,s()},f)),n=setTimeout(()=>{o&&clearTimeout(o),o=null,s()},r)}}function ve(t){return t}function ye(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function ne(t,l=200,n={}){return me(ge(l,n),t)}function be(t,l=!0){e.getCurrentInstance()?e.onMounted(t):l?t():e.nextTick(t)}function oe(t){var l;const n=j(t);return(l=n?.$el)!=null?l:n}const _e=B?window:void 0;B&&window.document,B&&window.navigator,B&&window.location;function we(t,l=!1){const n=e.ref(),o=()=>n.value=Boolean(t());return o(),be(o,l),n}const K=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},V="__vueuse_ssr_handlers__";K[V]=K[V]||{},K[V];var re=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,Oe=(t,l)=>{var n={};for(var o in t)Se.call(t,o)&&l.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&re)for(var o of re(t))l.indexOf(o)<0&&Ee.call(t,o)&&(n[o]=t[o]);return n};function Te(t,l,n={}){const o=n,{window:i=_e}=o,s=Oe(o,["window"]);let r;const f=we(()=>i&&"ResizeObserver"in i),v=()=>{r&&(r.disconnect(),r=void 0)},m=e.watch(()=>oe(t),g=>{v(),f.value&&i&&g&&(r=new ResizeObserver(l),r.observe(g,s))},{immediate:!0,flush:"post"}),p=()=>{v(),m()};return ye(p),{isSupported:f,stop:p}}function Be(t,l={width:0,height:0},n={}){const{box:o="content-box"}=n,i=e.ref(l.width),s=e.ref(l.height);return Te(t,([r])=>{const f=o==="border-box"?r.borderBoxSize:o==="content-box"?r.contentBoxSize:r.devicePixelContentBoxSize;f?(i.value=f.reduce((v,{inlineSize:m})=>v+m,0),s.value=f.reduce((v,{blockSize:m})=>v+m,0)):(i.value=r.contentRect.width,s.value=r.contentRect.height)},n),e.watch(()=>oe(t),r=>{i.value=r?l.width:0,s.value=r?l.height:0}),{width:i,height:s}}var ie;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(ie||(ie={}));var He=Object.defineProperty,ae=Object.getOwnPropertySymbols,Ie=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable,se=(t,l,n)=>l in t?He(t,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[l]=n,Re=(t,l)=>{for(var n in l||(l={}))Ie.call(l,n)&&se(t,n,l[n]);if(ae)for(var n of ae(l))Ce.call(l,n)&&se(t,n,l[n]);return t};Re({linear:ve},{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 ce(t,l){const{scrollEndHook:n,itemHeight:o,overscan:i=5}=l,s=e.ref(null),r=Be(s),f=e.ref(!0),v=ne(G,100);let m;const p=e.shallowRef(t),g=e.ref(0),c=e.ref({start:0,end:10});let u=0;const E=e.ref([]),y=e.computed(()=>{let{sum:a,height:d}={sum:0,height:0};return p.value.map((S,w)=>(typeof o=="number"?d=o:d=o(w),a+=d,{height:d,sum:a}))}),Y=e.computed(()=>A(c.value.start)),O=e.computed(()=>typeof o=="number"?y.value.length*o:y.value[y.value.length-1]?.sum||0),I=e.computed(()=>{let a=E.value.length-i,d=Math.max(a-u,0);return E.value.slice(d,a)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(m)),e.watch([r.width,r.height,p],([a,d])=>{(a||d)&&R()},{deep:!0}),e.watch(g,()=>{C(),v()});function C(){f.value=!1}function G(){f.value=!0,n?.()}function R(){cancelAnimationFrame(m),m=requestAnimationFrame(x)}function x(){if(s.value){g.value=s.value.scrollTop,u=H();let a=P(g.value),d=a+u+i;a=a-i,a=a<0?0:a,d=d>p.value.length?p.value.length:d,c.value={start:a,end:d},E.value=p.value.slice(a,d).map((S,w)=>({data:S,index:w+a}))}}function P(a){let d=0,S=y.value.length-1,w=-1;for(;d<=S;){const b=Math.floor((d+S)/2);y.value[b].sum>=a?(w=b,S=b-1):d=b+1}return Math.max(0,w)}function H(){let a=0,d=0,S=J();for(let w=S;w<y.value.length&&(a++,d+=y.value[w].height,!(d>=r.height.value));w++);return a}function A(a){if(typeof o=="number")return a*o;let d=y.value[a];return d?d.sum-d.height:0}function $(a){return y.value[a]||{sum:0,height:0}}function J(){let a=c.value.start;return a>=i&&(a+=i),a}function X(a){if(s.value){const d=$(a);s.value.scrollTop=d.sum-d.height,x()}}const Z=e.computed(()=>({style:{width:"100%",height:`${O.value}px`,pointerEvents:f.value?void 0:"none"}})),k=e.computed(()=>({style:{transform:`translate3d(0, ${Y.value}px, 0)`,"will-change":"transform"}})),ee={overflowY:"auto"};return{list:E,visiableList:I,getItemHeightData:$,getoffsetTopIndex:P,totalHeight:O,clientHeight:r.height,scrollTo:X,scrollTop:g,isScrollEnd:f,containerProps:{ref:s,onScroll:()=>{R()},style:ee},wrapperProps:Z,innerProps:k}}const F=Symbol(),D=Symbol(),M=Symbol(),N=Symbol(),z=Symbol(),Q=Symbol(),U=Symbol(),W=Symbol(),q=Symbol();function xe(){const{voidFn:t,boolFn:l,boolRef:n,arrayRef:o}={voidFn:u=>{},boolFn:u=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},i=e.inject(N,o),s=e.inject(M,l),r=e.inject(W,n),f=e.inject(D,t),v=e.inject(F,t),m=e.inject(z,t),p=e.inject(Q,t),g=e.inject(U,t),c=e.inject(q,t);return{selected:i,isSelected:s,isAllSelected:r,toggle:f,toggleAll:v,select:m,selectAll:p,unselect:g,unselectAll:c}}function Pe(t,l){const n=e.ref({}),o=e.computed(()=>t.value.filter(c=>n.value[c[l]])),i=e.computed(()=>o.value.length!=0&&Object.keys(n.value).length==t.value.length);function s(){t.value.forEach(c=>{n.value[c[l]]=!0})}function r(){n.value={}}function f(c){c.forEach(u=>{n.value[u[l]]||(n.value[u[l]]=!0)})}function v(c){c.forEach(u=>{n.value[u[l]]&&delete n.value[u[l]]})}function m(c){return!!n.value[c[l]]}function p(c){c.forEach(u=>{m(u)?delete n.value[u[l]]:n.value[u[l]]=!0})}function g(){i.value?r():s()}return e.provide(F,g),e.provide(D,p),e.provide(M,m),e.provide(N,o),e.provide(z,f),e.provide(Q,s),e.provide(U,v),e.provide(W,i),e.provide(q,r),{selected:o,select:f,selectAll:s,unselect:v,unselectAll:r,toggle:p,toggleAll:g,isSelected:m,isAllSelected:i}}const ue=Symbol(),Ae=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0},dialogClass:{default:""}},emits:["update:visiable"],setup(t,{emit:l}){const n=t,o=()=>{n.closeOnClickOverlay&&l("update:visiable",!1)};return e.provide(ue,()=>l("update:visiable",!1)),(i,s)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[t.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:o,class:"modal absolute left-0 right-0 top-0 bottom-0 flex bg-stone-900 bg-opacity-50 z-[999]"},[e.createElementVNode("div",{onClick:s[0]||(s[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog m-auto flex flex-col",t.dialogClass])},[e.renderSlot(i.$slots,"default")],2)])):e.createCommentVNode("",!0)]),_:3}))}});function $e(t){function l(n,o){const i=document.createElement("div"),s={setup(){return()=>e.h(Ae,{visiable:!0,"onUpdate:visiable":()=>{i?.remove()},...t},{default:()=>e.h(n,o)})}};return document.body.appendChild(i),e.render(e.h(s),i),{close:()=>i?.remove()}}return{create:l}}const ke=["xlink:href","fill","color"],Le=e.defineComponent({__name:"SvgIcon",props:{name:null,prefix:{default:"icon"},color:{default:"#FFF"},width:null,height:null},setup(t){const l=t,n=e.computed(()=>`#${l.prefix}-${l.name}`),o=e.computed(()=>({width:`${l.width??l.height}px`,height:`${l.height??l.width}px`,aspectRatio:l.width&&l.height?void 0:"1/1"}));return(i,s)=>(e.openBlock(),e.createElementBlock("svg",{"aria-hidden":"",style:e.normalizeStyle(e.unref(o))},[e.createElementVNode("use",{"xlink:href":e.unref(n),fill:t.color,color:t.color},null,8,ke)],4))}});function je(t){const{containerEl:l,sliderEl:n,autoHeight:o,performance:i={},maxHeightRatio:s=.9}=t,r=e.ref(!0),f=ne(A,100);let v,m="";const p=e.ref(0),g=e.ref(0),c=e.ref(0),u=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),E=e.ref({clientHeight:0}),y=e.computed(()=>!!g.value),Y=e.computed(()=>u.value.scrollHeight>u.value.clientHeight),O=e.computed(()=>u.value.clientHeight-E.value.clientHeight),I=e.computed(()=>u.value.scrollHeight-u.value.clientHeight),C=e.computed(()=>Math.max(u.value.clientHeight/u.value.scrollHeight,.05)),G=e.computed(()=>C.value>s?0:C.value*u.value.clientHeight),R=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${c.value}px,0)`,height:o?`${G.value}px`:void 0}));function x(b){H(),g.value=b.clientY-n.value.getBoundingClientRect().top||1,m=getComputedStyle(l.value).scrollBehavior,m==="smooth"&&(l.value.style.scrollBehavior="unset")}function P(){l.value.style.scrollBehavior=m,g.value=0,f()}function H(){r.value=!1}function A(){y.value||(r.value=!0)}function $(b){if(!y.value)return;let _=b.clientY-u.value.top-g.value;_<0?c.value=0:_>=O.value?c.value=O.value:c.value=_,l.value.scrollTo({top:c.value/O.value*I.value})}function J(){y.value||X()}function X(){cancelAnimationFrame(v),v=requestAnimationFrame(Z)}function Z(){l.value&&(p.value=i.scrollTop?.value??l.value.scrollTop,c.value=p.value/I.value*O.value)}function k(b){let _="addEventListener";b==="add"?_="addEventListener":_="removeEventListener",n.value?.[_]("pointerdown",x,{passive:!0}),window[_]("pointermove",$,{passive:!0}),window[_]("pointerup",P,{passive:!0})}const ee=new MutationObserver(b=>{b.map(L=>L.oldValue).join().includes("height")&&a()});function a(){u.value.top=l.value?.getBoundingClientRect().top??0,u.value.scrollHeight=l.value?.scrollHeight??0,u.value.clientHeight=l.value?.clientHeight??0}function d(){H(),setTimeout(()=>{E.value.clientHeight=n.value?.clientHeight??0,A()},150)}function S(b,_,L="dynamic-styles"){let T=document.getElementById(L);T||(T=document.createElement("style"),T.id=L,document.head.appendChild(T));const fe=T.sheet.cssRules,pe=fe.length,Qe=`${b} { ${_} }`;for(let te=0;te<pe;te++){const he=fe[te];if(he.selectorText===b&&he.style.cssText===_)return}T.sheet.insertRule(Qe,pe)}function w(){l.value&&n.value?(S(".hide-scrollbar","scrollbar-width: none; -ms-overflow-style: none;"),S(".hide-scrollbar::-webkit-scrollbar","display: none"),l.value.addEventListener("scroll",J,{passive:!0}),k("add"),ee.observe(l.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{a()},100),d()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:l,sliderEl:n})}return e.watch(p,()=>{H(),f()}),{isScrollEnd:r,isDragSlider:y,offsetTop:c,scrollTop:p,scrollable:Y,sliderPos:R,init:w,modifySliderEventListener:k}}const Ke=(t=>(e.pushScopeId("data-v-edec7292"),t=t(),e.popScopeId(),t))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),Ve=e.defineComponent({__name:"ScrollBar",props:{containerEl:null,autoHide:{type:Boolean},autoHeight:{type:Boolean},performance:null},setup(t,{expose:l}){const n=t,o=!!e.useSlots().default,i=e.ref(null),s=e.computed(()=>n.containerEl),r=je({containerEl:s,sliderEl:i,autoHeight:o?n.autoHeight:!0,performance:n.performance}),{scrollable:f,isScrollEnd:v,sliderPos:m}=r,p=e.ref(!1),g=n.autoHide?e.computed(()=>p.value||!v.value):e.computed(()=>f.value);e.onMounted(()=>{e.nextTick(()=>{r.init()})}),e.onUnmounted(()=>{r.modifySliderEventListener("remove")});function c(){p.value=!0}function u(){p.value=!1}return l({uScrollBarReturn:r}),(E,y)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"sliderRef",ref:i,class:"slider-wrapper",onMouseenter:c,onMouseleave:u,style:e.normalizeStyle(e.unref(m))},[e.renderSlot(E.$slots,"default",{},()=>[Ke],!0)],36),[[e.vShow,e.unref(g)]])]),_:3}))}}),qe="",de=(t,l)=>{const n=t.__vccOpts||t;for(const[o,i]of l)n[o]=i;return n},Fe=de(Ve,[["__scopeId","data-v-edec7292"]]),De={class:"virtualListWrapper"},Me={inheritAttrs:!1},Ne=e.defineComponent({...Me,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},emits:["scrollEnd"],setup(t,{expose:l,emit:n}){const o=t,i=ce(e.toRef(o,"data"),{itemHeight:p=>o.itemHeight(o.data[p]),overscan:o.overscan,scrollEndHook:()=>{n("scrollEnd")}}),{list:s,containerProps:r,wrapperProps:f,innerProps:v,getItemHeightData:m}=i;return l({vListReturn:i}),(p,g)=>(e.openBlock(),e.createElementBlock("div",De,[e.createElementVNode("div",e.mergeProps({onScrollPassive:g[0]||(g[0]=(...c)=>e.unref(r).onScroll&&e.unref(r).onScroll(...c)),ref:e.unref(r).ref,class:"virtualList"},p.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(f))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(v))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),({index:c,data:u})=>(e.openBlock(),e.createElementBlock("div",{key:c,style:e.normalizeStyle({height:`${e.unref(m)(c).height}px`,display:"flex"})},[e.renderSlot(p.$slots,"default",{data:u,index:c},void 0,!0)],4))),128))],16)],16)],16)]))}}),Ye="",ze=de(Ne,[["__scopeId","data-v-4ba97cce"]]);h.ScrollBar=Fe,h.SvgIcon=Le,h.VirtualList=ze,h.allSelectedKey=N,h.closeDialogKey=ue,h.dialogController=$e,h.isAllSelectedKey=W,h.isSelectedKey=M,h.selectAllKey=Q,h.selectKey=z,h.toggleAllKey=F,h.toggleKey=D,h.unselectAllKey=q,h.unselectKey=U,h.useSelectable=Pe,h.useSelectableInjectors=xe,h.useVirtualList=ce,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(h,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(h=typeof globalThis<"u"?globalThis:h||self,e(h.ui={},h.Vue))})(this,function(h,e){"use strict";var Z;const T=typeof window<"u";T&&((Z=window?.navigator)==null?void 0:Z.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function $(n){return typeof n=="function"?n():e.unref(n)}function ue(n,t){function o(...l){n(()=>t.apply(this,l),{fn:t,thisArg:this,args:l})}return o}function de(n,t={}){let o,l;return s=>{const r=$(n),f=$(t.maxWait);if(o&&clearTimeout(o),r<=0||f!==void 0&&f<=0)return l&&(clearTimeout(l),l=null),s();f&&!l&&(l=setTimeout(()=>{o&&clearTimeout(o),l=null,s()},f)),o=setTimeout(()=>{l&&clearTimeout(l),l=null,s()},r)}}function fe(n){return n}function pe(n){return e.getCurrentScope()?(e.onScopeDispose(n),!0):!1}function ee(n,t=200,o={}){return ue(de(t,o),n)}function he(n,t=!0){e.getCurrentInstance()?e.onMounted(n):t?n():e.nextTick(n)}function te(n){var t;const o=$(n);return(t=o?.$el)!=null?t:o}const me=T?window:void 0;T&&window.document,T&&window.navigator,T&&window.location;function ge(n,t=!1){const o=e.ref(),l=()=>o.value=Boolean(n());return l(),he(l,t),o}const F=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},L="__vueuse_ssr_handlers__";F[L]=F[L]||{},F[L];var ne=Object.getOwnPropertySymbols,ye=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable,be=(n,t)=>{var o={};for(var l in n)ye.call(n,l)&&t.indexOf(l)<0&&(o[l]=n[l]);if(n!=null&&ne)for(var l of ne(n))t.indexOf(l)<0&&ve.call(n,l)&&(o[l]=n[l]);return o};function _e(n,t,o={}){const l=o,{window:i=me}=l,s=be(l,["window"]);let r;const f=ge(()=>i&&"ResizeObserver"in i),y=()=>{r&&(r.disconnect(),r=void 0)},m=e.watch(()=>te(n),g=>{y(),f.value&&i&&g&&(r=new ResizeObserver(t),r.observe(g,s))},{immediate:!0,flush:"post"}),p=()=>{y(),m()};return pe(p),{isSupported:f,stop:p}}function Se(n,t={width:0,height:0},o={}){const{box:l="content-box"}=o,i=e.ref(t.width),s=e.ref(t.height);return _e(n,([r])=>{const f=l==="border-box"?r.borderBoxSize:l==="content-box"?r.contentBoxSize:r.devicePixelContentBoxSize;f?(i.value=f.reduce((y,{inlineSize:m})=>y+m,0),s.value=f.reduce((y,{blockSize:m})=>y+m,0)):(i.value=r.contentRect.width,s.value=r.contentRect.height)},o),e.watch(()=>te(n),r=>{i.value=r?t.width:0,s.value=r?t.height:0}),{width:i,height:s}}var oe;(function(n){n.UP="UP",n.RIGHT="RIGHT",n.DOWN="DOWN",n.LEFT="LEFT",n.NONE="NONE"})(oe||(oe={}));var we=Object.defineProperty,le=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,re=(n,t,o)=>t in n?we(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,Te=(n,t)=>{for(var o in t||(t={}))Ee.call(t,o)&&re(n,o,t[o]);if(le)for(var o of le(t))Oe.call(t,o)&&re(n,o,t[o]);return n};Te({linear:fe},{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 ie(n,t){const{scrollEndHook:o,itemHeight:l,overscan:i=5}=t,s=e.ref(null),r=Se(s),f=e.ref(!0),y=ee(q,100);let m;const p=e.shallowRef(n),g=e.ref(0),c=e.ref({start:0,end:10});let u=0;const E=e.ref([]),v=e.computed(()=>{let{sum:a,height:d}={sum:0,height:0};return p.value.map((S,b)=>(typeof l=="number"?d=l:d=l(b),a+=d,{height:d,sum:a}))}),U=e.computed(()=>R(c.value.start)),O=e.computed(()=>typeof l=="number"?v.value.length*l:v.value[v.value.length-1]?.sum||0),x=e.computed(()=>{let a=E.value.length-i,d=Math.max(a-u,0);return E.value.slice(d,a)});e.onMounted(()=>{}),e.onUnmounted(()=>cancelAnimationFrame(m)),e.watch([r.width,r.height,p],([a,d])=>{(a||d)&&I()},{deep:!0}),e.watch(g,()=>{H(),y()});function H(){f.value=!1}function q(){f.value=!0,o?.()}function I(){cancelAnimationFrame(m),m=requestAnimationFrame(C)}function C(){if(s.value){g.value=s.value.scrollTop,u=B();let a=P(g.value),d=a+u+i;a=a-i,a=a<0?0:a,d=d>p.value.length?p.value.length:d,c.value={start:a,end:d},E.value=p.value.slice(a,d).map((S,b)=>({data:S,index:b+a}))}}function P(a){let d=0,S=v.value.length-1,b=-1;for(;d<=S;){const _=Math.floor((d+S)/2);v.value[_].sum>=a?(b=_,S=_-1):d=_+1}return Math.max(0,b)}function B(){let a=0,d=0,S=Y();for(let b=S;b<v.value.length&&(a++,d+=v.value[b].height,!(d>=r.height.value));b++);return a}function R(a){if(typeof l=="number")return a*l;let d=v.value[a];return d?d.sum-d.height:0}function k(a){return v.value[a]||{sum:0,height:0}}function Y(){let a=c.value.start;return a>=i&&(a+=i),a}function G(a){if(s.value){const d=k(a);s.value.scrollTop=d.sum-d.height,C()}}const J=e.computed(()=>({style:{width:"100%",height:`${O.value}px`,pointerEvents:f.value?void 0:"none"}})),A=e.computed(()=>({style:{transform:`translate3d(0, ${U.value}px, 0)`,"will-change":"transform"}})),X={overflowY:"auto"};return{list:E,visiableList:x,getItemHeightData:k,getoffsetTopIndex:P,totalHeight:O,clientHeight:r.height,scrollTo:G,scrollTop:g,isScrollEnd:f,containerProps:{ref:s,onScroll:()=>{I()},style:X},wrapperProps:J,innerProps:A}}const V=Symbol(),D=Symbol(),j=Symbol(),K=Symbol(),M=Symbol(),N=Symbol(),z=Symbol(),W=Symbol(),Q=Symbol();function Be(){const{voidFn:n,boolFn:t,boolRef:o,arrayRef:l}={voidFn:u=>{},boolFn:u=>!1,boolRef:e.computed(()=>!1),arrayRef:e.computed(()=>[])},i=e.inject(K,l),s=e.inject(j,t),r=e.inject(W,o),f=e.inject(D,n),y=e.inject(V,n),m=e.inject(M,n),p=e.inject(N,n),g=e.inject(z,n),c=e.inject(Q,n);return{selected:i,isSelected:s,isAllSelected:r,toggle:f,toggleAll:y,select:m,selectAll:p,unselect:g,unselectAll:c}}function xe(n,t){const o=e.ref({}),l=e.computed(()=>n.value.filter(c=>o.value[c[t]])),i=e.computed(()=>l.value.length!=0&&Object.keys(o.value).length==n.value.length);function s(){n.value.forEach(c=>{o.value[c[t]]=!0})}function r(){o.value={}}function f(c){c.forEach(u=>{o.value[u[t]]||(o.value[u[t]]=!0)})}function y(c){c.forEach(u=>{o.value[u[t]]&&delete o.value[u[t]]})}function m(c){return!!o.value[c[t]]}function p(c){c.forEach(u=>{m(u)?delete o.value[u[t]]:o.value[u[t]]=!0})}function g(){i.value?r():s()}return e.provide(V,g),e.provide(D,p),e.provide(j,m),e.provide(K,l),e.provide(M,f),e.provide(N,s),e.provide(z,y),e.provide(W,i),e.provide(Q,r),{selected:l,select:f,selectAll:s,unselect:y,unselectAll:r,toggle:p,toggleAll:g,isSelected:m,isAllSelected:i}}const se=Symbol(),He=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0},dialogClass:{default:""}},emits:["update:visiable"],setup(n,{emit:t}){const o=n,l=()=>{o.closeOnClickOverlay&&t("update:visiable",!1)};return e.provide(se,()=>t("update:visiable",!1)),(i,s)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[n.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:l,class:"modal absolute inset-0 bottom-0 flex bg-stone-900 bg-opacity-50 z-[999]"},[e.createElementVNode("div",{onClick:s[0]||(s[0]=e.withModifiers(()=>{},["stop"])),class:e.normalizeClass(["dialog m-auto flex flex-col",n.dialogClass])},[e.renderSlot(i.$slots,"default")],2)])):e.createCommentVNode("",!0)]),_:3}))}});function Ie(n){function t(o,l){const i=document.createElement("div"),s={setup(){return()=>e.h(He,{visiable:!0,"onUpdate:visiable":()=>{i?.remove()},...n},{default:()=>e.h(o,l)})}};return document.body.appendChild(i),e.render(e.h(s),i),{close:()=>i?.remove()}}return{create:t}}const Ce=["xlink:href","fill","color"],Pe=e.defineComponent({__name:"SvgIcon",props:{name:null,prefix:{default:"icon"},color:{default:"#FFF"},width:null,height:null},setup(n){const t=n,o=e.computed(()=>`#${t.prefix}-${t.name}`),l=e.computed(()=>({width:`${t.width??t.height}px`,height:`${t.height??t.width}px`,aspectRatio:t.width&&t.height?void 0:"1/1"}));return(i,s)=>(e.openBlock(),e.createElementBlock("svg",{"aria-hidden":"",style:e.normalizeStyle(e.unref(l))},[e.createElementVNode("use",{"xlink:href":e.unref(o),fill:n.color,color:n.color},null,8,Ce)],4))}});function Re(n){const{containerEl:t,sliderEl:o,autoHeight:l,performance:i={},maxHeightRatio:s=.9}=n,r=e.ref(!0),f=ee(R,100);let y,m="";const p=e.ref(0),g=e.ref(0),c=e.ref(0),u=e.ref({top:0,scrollTop:0,scrollHeight:0,clientHeight:0}),E=e.ref({clientHeight:0}),v=e.computed(()=>!!g.value),U=e.computed(()=>u.value.scrollHeight>u.value.clientHeight),O=e.computed(()=>u.value.clientHeight-E.value.clientHeight),x=e.computed(()=>u.value.scrollHeight-u.value.clientHeight),H=e.computed(()=>Math.max(u.value.clientHeight/u.value.scrollHeight,.05)),q=e.computed(()=>H.value>s?0:H.value*u.value.clientHeight),I=e.computed(()=>({willChange:"transform",transform:`translate3d(0,${c.value}px,0)`,height:l?`${q.value}px`:void 0}));function C(_){B(),g.value=_.clientY-o.value.getBoundingClientRect().top||1,m=getComputedStyle(t.value).scrollBehavior,m==="smooth"&&(t.value.style.scrollBehavior="unset")}function P(){t.value.style.scrollBehavior=m,g.value=0,f()}function B(){r.value=!1}function R(){v.value||(r.value=!0)}function k(_){if(!v.value)return;let w=_.clientY-u.value.top-g.value;w<0?c.value=0:w>=O.value?c.value=O.value:c.value=w,t.value.scrollTo({top:c.value/O.value*x.value})}function Y(){v.value||G()}function G(){cancelAnimationFrame(y),y=requestAnimationFrame(J)}function J(){t.value&&(p.value=i.scrollTop?.value??t.value.scrollTop,c.value=p.value/x.value*O.value)}function A(_){let w="addEventListener";_==="add"?w="addEventListener":w="removeEventListener",o.value?.[w]("pointerdown",C,{passive:!0}),window[w]("pointermove",k,{passive:!0}),window[w]("pointerup",P,{passive:!0})}const X=new MutationObserver(_=>{_.map(ze=>ze.oldValue).join().includes("height")&&a()});function a(){u.value.top=t.value?.getBoundingClientRect().top??0,u.value.scrollHeight=t.value?.scrollHeight??0,u.value.clientHeight=t.value?.clientHeight??0}function d(){B(),setTimeout(()=>{E.value.clientHeight=o.value?.clientHeight??0,R()},150)}function S(){document.styleSheets[0].insertRule(".hide-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }",0),document.styleSheets[0].insertRule(".hide-scrollbar::-webkit-scrollbar{ display: none }",0),t.value?.classList.add("hide-scrollbar")}function b(){t.value&&o.value?(S(),t.value.addEventListener("scroll",Y,{passive:!0}),A("add"),X.observe(t.value,{subtree:!0,attributeOldValue:!0,attributeFilter:["style"]}),setTimeout(()=>{a()},100),d()):console.error("useScrollBar:","\u521D\u59CB\u5316\u5931\u8D25!",{containerEl:t,sliderEl:o})}return e.watch(p,()=>{B(),f()}),{isScrollEnd:r,isDragSlider:v,offsetTop:c,scrollTop:p,scrollable:U,sliderPos:I,init:b,modifySliderEventListener:A}}const ke=(n=>(e.pushScopeId("data-v-edec7292"),n=n(),e.popScopeId(),n))(()=>e.createElementVNode("div",{class:"default-slider"},null,-1)),Ae=e.defineComponent({__name:"ScrollBar",props:{containerEl:null,autoHide:{type:Boolean},autoHeight:{type:Boolean},performance:null},setup(n,{expose:t}){const o=n,l=!!e.useSlots().default,i=e.ref(null),s=e.computed(()=>o.containerEl),r=Re({containerEl:s,sliderEl:i,autoHeight:l?o.autoHeight:!0,performance:o.performance}),{scrollable:f,isScrollEnd:y,sliderPos:m}=r,p=e.ref(!1),g=o.autoHide?e.computed(()=>p.value||!y.value):e.computed(()=>f.value);e.onMounted(()=>{e.nextTick(()=>{r.init()})}),e.onUnmounted(()=>{r.modifySliderEventListener("remove")});function c(){p.value=!0}function u(){p.value=!1}return t({uScrollBarReturn:r}),(E,v)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"sliderRef",ref:i,class:"slider-wrapper",onMouseenter:c,onMouseleave:u,style:e.normalizeStyle(e.unref(m))},[e.renderSlot(E.$slots,"default",{},()=>[ke],!0)],36),[[e.vShow,e.unref(g)]])]),_:3}))}}),Ue="",ae=(n,t)=>{const o=n.__vccOpts||n;for(const[l,i]of t)o[l]=i;return o},$e=ae(Ae,[["__scopeId","data-v-edec7292"]]),Fe={class:"virtualListWrapper"},Le={inheritAttrs:!1},Ve=e.defineComponent({...Le,__name:"VirtualList",props:{data:null,itemHeight:null,overscan:{default:10}},emits:["scrollEnd"],setup(n,{expose:t,emit:o}){const l=n,i=ie(e.toRef(l,"data"),{itemHeight:p=>l.itemHeight(l.data[p]),overscan:l.overscan,scrollEndHook:()=>{o("scrollEnd")}}),{list:s,containerProps:r,wrapperProps:f,innerProps:y,getItemHeightData:m}=i;return t({vListReturn:i}),(p,g)=>(e.openBlock(),e.createElementBlock("div",Fe,[e.createElementVNode("div",e.mergeProps({onScrollPassive:g[0]||(g[0]=(...c)=>e.unref(r).onScroll&&e.unref(r).onScroll(...c)),ref:e.unref(r).ref,class:"virtualList"},p.$attrs),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(f))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(y))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),({index:c,data:u})=>(e.openBlock(),e.createElementBlock("div",{key:c,style:e.normalizeStyle({height:`${e.unref(m)(c).height}px`,display:"flex"})},[e.renderSlot(p.$slots,"default",{data:u,index:c},void 0,!0)],4))),128))],16)],16)],16)]))}}),qe="",De=ae(Ve,[["__scopeId","data-v-4ba97cce"]]),je={class:"flex w-full max-w-[700px] items-center justify-center"},Ke={class:"text-[14px] text-white"},Me=e.defineComponent({__name:"Toast",props:{message:null,position:null},setup(n){const t=n,o=e.ref(),l=e.ref(),i=e.ref(),s=e.computed(()=>{switch(t.position){case"top":return 10;case"middle":return 50;case"bottom":return 85}}),r=e.computed(()=>({top:`calc(${s.value}% - ${i.value}px)`,left:`calc(50% - ${l.value}px)`,backgroundColor:"black"}));return e.nextTick(()=>{l.value=o.value.offsetWidth/2,i.value=o.value.offsetHeight/2}),(f,y)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",{id:"toastWrapper",ref_key:"toastWrapper",ref:o,class:"absolute rounded-[8px] bg-black px-[14px] py-[12px] opacity-[0.79]",style:e.normalizeStyle([e.unref(r),{zIndex:9999}])},[e.createElementVNode("div",je,[e.createElementVNode("span",Ke,e.toDisplayString(n.message),1)])],4)]))}}),ce={message:"\u61D2\u732B\u4E91 Yes!!!",position:"middle",duration:1500};class Ne{options;container;constructor(t){this.options=t,this.container=document.createElement("div")}present(){const t=e.h(e.h(Me),{...ce,...this.options});e.render(t,this.container),document.body.insertBefore(this.container,document.body.firstChild);const o=this.options.duration||ce.duration;setTimeout(()=>{this.dismiss()},o)}dismiss(){this.container&&(this.container.querySelector("#toastWrapper")?.classList.add("animate-toastAnimation"),setTimeout(()=>{this.container&&(e.render(null,this.container),document.body.removeChild(this.container))},500))}}h.ScrollBar=$e,h.SvgIcon=Pe,h.ToastCreator=Ne,h.VirtualList=De,h.allSelectedKey=K,h.closeDialogKey=se,h.dialogController=Ie,h.isAllSelectedKey=W,h.isSelectedKey=j,h.selectAllKey=N,h.selectKey=M,h.toggleAllKey=V,h.toggleKey=D,h.unselectAllKey=Q,h.unselectKey=z,h.useSelectable=xe,h.useSelectableInjectors=Be,h.useVirtualList=ie,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
+
message: string;
|
|
3
|
+
position: "top" | "middle" | "bottom";
|
|
4
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
5
|
+
message: string;
|
|
6
|
+
position: "top" | "middle" | "bottom";
|
|
7
|
+
}>>>, {}>;
|
|
8
|
+
export default _default;
|
|
9
|
+
declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
10
|
+
declare type __VLS_TypePropsToRuntimeProps<T> = {
|
|
11
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
12
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
13
|
+
} : {
|
|
14
|
+
type: import('vue').PropType<T[K]>;
|
|
15
|
+
required: true;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface ToastOptions {
|
|
2
|
+
message?: string;
|
|
3
|
+
position?: "top" | "middle" | "bottom";
|
|
4
|
+
duration?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare class ToastCreator {
|
|
7
|
+
options: ToastOptions;
|
|
8
|
+
container: HTMLElement;
|
|
9
|
+
constructor(options: ToastOptions);
|
|
10
|
+
present(): void;
|
|
11
|
+
dismiss(): void;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lazycatcloud/lzc-toolkit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.47",
|
|
4
4
|
"description": "lazycat ui toolkits",
|
|
5
5
|
"main": "./dist/index.umd.js",
|
|
6
6
|
"module": "./dist/index.es.js",
|
|
@@ -32,4 +32,4 @@
|
|
|
32
32
|
"vue": "^3.2.39",
|
|
33
33
|
"vue-tsc": "^0.40.13"
|
|
34
34
|
}
|
|
35
|
-
}
|
|
35
|
+
}
|