@lazycatcloud/lzc-toolkit 0.0.7 → 0.0.8
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 +65 -65
- package/dist/index.umd.js +1 -1
- package/dist/types/dialog/index.d.ts +1 -1
- package/package.json +2 -1
package/dist/index.es.js
CHANGED
|
@@ -40,30 +40,30 @@ var z = Object.getOwnPropertySymbols, _e = Object.prototype.hasOwnProperty, Oe =
|
|
|
40
40
|
return n;
|
|
41
41
|
};
|
|
42
42
|
function Pe(e, t, n = {}) {
|
|
43
|
-
const l = n, { window:
|
|
43
|
+
const l = n, { window: a = ye } = l, i = Se(l, ["window"]);
|
|
44
44
|
let o;
|
|
45
|
-
const
|
|
45
|
+
const r = we(() => a && "ResizeObserver" in a), s = () => {
|
|
46
46
|
o && (o.disconnect(), o = void 0);
|
|
47
47
|
}, c = T(() => M(e), (_) => {
|
|
48
|
-
|
|
48
|
+
s(), r.value && a && _ && (o = new ResizeObserver(t), o.observe(_, i));
|
|
49
49
|
}, { immediate: !0, flush: "post" }), w = () => {
|
|
50
|
-
|
|
50
|
+
s(), c();
|
|
51
51
|
};
|
|
52
52
|
return me(w), {
|
|
53
|
-
isSupported:
|
|
53
|
+
isSupported: r,
|
|
54
54
|
stop: w
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
function Ie(e, t = { width: 0, height: 0 }, n = {}) {
|
|
58
|
-
const { box: l = "content-box" } = n,
|
|
58
|
+
const { box: l = "content-box" } = n, a = b(t.width), i = b(t.height);
|
|
59
59
|
return Pe(e, ([o]) => {
|
|
60
|
-
const
|
|
61
|
-
|
|
60
|
+
const r = l === "border-box" ? o.borderBoxSize : l === "content-box" ? o.contentBoxSize : o.devicePixelContentBoxSize;
|
|
61
|
+
r ? (a.value = r.reduce((s, { inlineSize: c }) => s + c, 0), i.value = r.reduce((s, { blockSize: c }) => s + c, 0)) : (a.value = o.contentRect.width, i.value = o.contentRect.height);
|
|
62
62
|
}, n), T(() => M(e), (o) => {
|
|
63
|
-
|
|
63
|
+
a.value = o ? t.width : 0, i.value = o ? t.height : 0;
|
|
64
64
|
}), {
|
|
65
|
-
width:
|
|
66
|
-
height:
|
|
65
|
+
width: a,
|
|
66
|
+
height: i
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
var Q;
|
|
@@ -108,11 +108,11 @@ Te({
|
|
|
108
108
|
linear: ge
|
|
109
109
|
}, Be);
|
|
110
110
|
function Ae(e, t) {
|
|
111
|
-
const n = b(), l = Ie(n),
|
|
112
|
-
const { start: h = 0 } =
|
|
111
|
+
const n = b(), l = Ie(n), a = b([]), i = b(0), o = le(e), r = b({ start: 0, end: 10 }), { itemHeight: s, overscan: c = 5 } = t, w = (u) => {
|
|
112
|
+
const { start: h = 0 } = r.value;
|
|
113
113
|
let v = 0, p = 0;
|
|
114
114
|
for (let g = h; g < o.value.length; g++)
|
|
115
|
-
if (v +=
|
|
115
|
+
if (v += s(g), v >= u) {
|
|
116
116
|
p = g;
|
|
117
117
|
break;
|
|
118
118
|
}
|
|
@@ -120,7 +120,7 @@ function Ae(e, t) {
|
|
|
120
120
|
}, _ = (u) => {
|
|
121
121
|
let h = 0, v = 0;
|
|
122
122
|
for (let p = 0; p < o.value.length; p++)
|
|
123
|
-
if (h +=
|
|
123
|
+
if (h += s(p), h >= u) {
|
|
124
124
|
v = p;
|
|
125
125
|
break;
|
|
126
126
|
}
|
|
@@ -133,12 +133,12 @@ function Ae(e, t) {
|
|
|
133
133
|
const u = n.value;
|
|
134
134
|
if (u) {
|
|
135
135
|
const h = _(u.scrollTop), v = w(u.clientHeight), p = h - c, g = h + v + c;
|
|
136
|
-
|
|
136
|
+
r.value = {
|
|
137
137
|
start: p < 0 ? 0 : p,
|
|
138
138
|
end: g > o.value.length ? o.value.length : g
|
|
139
|
-
},
|
|
139
|
+
}, a.value = o.value.slice(r.value.start, r.value.end).map((R, Z) => ({
|
|
140
140
|
data: R,
|
|
141
|
-
index: Z +
|
|
141
|
+
index: Z + r.value.start
|
|
142
142
|
}));
|
|
143
143
|
}
|
|
144
144
|
};
|
|
@@ -152,9 +152,9 @@ function Ae(e, t) {
|
|
|
152
152
|
},
|
|
153
153
|
{ deep: !0 }
|
|
154
154
|
);
|
|
155
|
-
const A = O(() => typeof
|
|
155
|
+
const A = O(() => typeof s == "number" ? o.value.length * s : o.value.reduce((u, h, v) => u + s(v), 0)), W = (u) => typeof s == "number" ? u * s : o.value.slice(0, u).reduce((v, p, g) => v + s(g), 0), q = (u) => {
|
|
156
156
|
n.value && (n.value.scrollTop = u, B());
|
|
157
|
-
}, G = O(() => W(
|
|
157
|
+
}, G = O(() => W(r.value.start)), Y = O(() => ({
|
|
158
158
|
style: {
|
|
159
159
|
width: "100%",
|
|
160
160
|
height: `${A.value}px`
|
|
@@ -166,15 +166,15 @@ function Ae(e, t) {
|
|
|
166
166
|
}
|
|
167
167
|
})), X = { overflowY: "auto" };
|
|
168
168
|
return {
|
|
169
|
-
list:
|
|
169
|
+
list: a,
|
|
170
170
|
totalHeight: A,
|
|
171
171
|
clientHeight: l.height,
|
|
172
172
|
scrollTo: q,
|
|
173
|
-
scrollTop:
|
|
173
|
+
scrollTop: i,
|
|
174
174
|
containerProps: {
|
|
175
175
|
ref: n,
|
|
176
176
|
onScroll: (u) => {
|
|
177
|
-
u.target && (
|
|
177
|
+
u.target && (i.value = u.target.scrollTop), f();
|
|
178
178
|
},
|
|
179
179
|
style: X
|
|
180
180
|
},
|
|
@@ -184,8 +184,8 @@ function Ae(e, t) {
|
|
|
184
184
|
}
|
|
185
185
|
const Re = Symbol(), Ne = Symbol(), $e = Symbol(), He = Symbol(), Ke = Symbol(), Ve = Symbol(), ze = Symbol(), Qe = Symbol();
|
|
186
186
|
function Ue(e, t) {
|
|
187
|
-
const n = b({}), l = O(() => e.value.filter((d) => n.value[d[t]])),
|
|
188
|
-
function
|
|
187
|
+
const n = b({}), l = O(() => e.value.filter((d) => n.value[d[t]])), a = O(() => l.value.length != 0 && Object.keys(n.value).length == e.value.length);
|
|
188
|
+
function i() {
|
|
189
189
|
e.value.forEach((d) => {
|
|
190
190
|
n.value[d[t]] = !0;
|
|
191
191
|
});
|
|
@@ -193,12 +193,12 @@ function Ue(e, t) {
|
|
|
193
193
|
function o() {
|
|
194
194
|
n.value = {};
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function r(d) {
|
|
197
197
|
d.forEach((f) => {
|
|
198
198
|
n.value[f[t]] || (n.value[f[t]] = !0);
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function s(d) {
|
|
202
202
|
d.forEach((f) => {
|
|
203
203
|
n.value[f[t]] && delete n.value[f[t]];
|
|
204
204
|
});
|
|
@@ -212,18 +212,18 @@ function Ue(e, t) {
|
|
|
212
212
|
});
|
|
213
213
|
}
|
|
214
214
|
function _() {
|
|
215
|
-
|
|
215
|
+
a.value ? o() : i();
|
|
216
216
|
}
|
|
217
|
-
return m(Re, _), m(Ne, w), m($e, c), m(He, l), m(Ke,
|
|
217
|
+
return m(Re, _), m(Ne, w), m($e, c), m(He, l), m(Ke, r), m(Ve, s), m(ze, a), m(Qe, o), {
|
|
218
218
|
selected: l,
|
|
219
|
-
select:
|
|
220
|
-
selectAll:
|
|
221
|
-
unselect:
|
|
219
|
+
select: r,
|
|
220
|
+
selectAll: i,
|
|
221
|
+
unselect: s,
|
|
222
222
|
unselectAll: o,
|
|
223
223
|
toggle: w,
|
|
224
224
|
toggleAll: _,
|
|
225
225
|
isSelected: c,
|
|
226
|
-
isAllSelected:
|
|
226
|
+
isAllSelected: a
|
|
227
227
|
};
|
|
228
228
|
}
|
|
229
229
|
const ke = Symbol(), Le = /* @__PURE__ */ D({
|
|
@@ -237,7 +237,7 @@ const ke = Symbol(), Le = /* @__PURE__ */ D({
|
|
|
237
237
|
const n = e, l = () => {
|
|
238
238
|
n.closeOnClickOverlay && t("update:show", !1);
|
|
239
239
|
};
|
|
240
|
-
return m(ke, () => t("update:show", !1)), (
|
|
240
|
+
return m(ke, () => t("update:show", !1)), (a, i) => (S(), re(se, { name: "modal" }, {
|
|
241
241
|
default: ae(() => [
|
|
242
242
|
e.visiable ? (S(), I("div", {
|
|
243
243
|
key: 0,
|
|
@@ -245,11 +245,11 @@ const ke = Symbol(), Le = /* @__PURE__ */ D({
|
|
|
245
245
|
class: "modal absolute inset-0 bottom-0 z-50 flex bg-stone-900 bg-opacity-50"
|
|
246
246
|
}, [
|
|
247
247
|
x("div", {
|
|
248
|
-
onClick:
|
|
248
|
+
onClick: i[0] || (i[0] = ie(() => {
|
|
249
249
|
}, ["stop"])),
|
|
250
250
|
class: "dialog m-auto flex flex-col"
|
|
251
251
|
}, [
|
|
252
|
-
U(
|
|
252
|
+
U(a.$slots, "default")
|
|
253
253
|
])
|
|
254
254
|
])) : ue("", !0)
|
|
255
255
|
]),
|
|
@@ -258,47 +258,47 @@ const ke = Symbol(), Le = /* @__PURE__ */ D({
|
|
|
258
258
|
}
|
|
259
259
|
});
|
|
260
260
|
function Me() {
|
|
261
|
-
let e = null;
|
|
262
|
-
const
|
|
263
|
-
function
|
|
264
|
-
return
|
|
261
|
+
let e = null, t = null;
|
|
262
|
+
const n = b({});
|
|
263
|
+
function l(o, r, s = !0) {
|
|
264
|
+
return n.value[o] ? (n.value[o].visiable = s, !0) : (n.value[o] = {
|
|
265
265
|
visiable: s,
|
|
266
|
-
componentProps:
|
|
266
|
+
componentProps: r
|
|
267
267
|
}, !1);
|
|
268
268
|
}
|
|
269
|
-
function
|
|
270
|
-
|
|
271
|
-
|
|
269
|
+
function a(o) {
|
|
270
|
+
n.value[o].visiable = !1, n.value = {}, t && t.childNodes.length > 0 && t.childNodes.forEach((r) => {
|
|
271
|
+
t?.removeChild(r);
|
|
272
272
|
});
|
|
273
273
|
}
|
|
274
|
-
function i(
|
|
275
|
-
const
|
|
276
|
-
if (!
|
|
274
|
+
function i(o) {
|
|
275
|
+
const r = o.component.name;
|
|
276
|
+
if (!l(r, o.componentProps || {})) {
|
|
277
277
|
const s = {
|
|
278
278
|
setup() {
|
|
279
279
|
return () => N(
|
|
280
280
|
Le,
|
|
281
281
|
{
|
|
282
|
-
visiable:
|
|
283
|
-
"onUpdate:show": (
|
|
284
|
-
|
|
282
|
+
visiable: n.value[r].visiable,
|
|
283
|
+
"onUpdate:show": () => {
|
|
284
|
+
a(r);
|
|
285
285
|
}
|
|
286
286
|
},
|
|
287
287
|
{
|
|
288
288
|
default: () => N(
|
|
289
|
-
|
|
290
|
-
|
|
289
|
+
o.component,
|
|
290
|
+
n.value[r].componentProps
|
|
291
291
|
)
|
|
292
292
|
}
|
|
293
293
|
);
|
|
294
294
|
}
|
|
295
295
|
};
|
|
296
|
-
e || (e = document.createElement("div"),
|
|
296
|
+
e || (e = document.body.querySelector("#app") || document.body), t || (t = document.createElement("div"), t.setAttribute("id", "dialog"), e.appendChild(t)), ce(de(s), t);
|
|
297
297
|
}
|
|
298
|
-
return { close:
|
|
298
|
+
return { close: () => a(r) };
|
|
299
299
|
}
|
|
300
300
|
return F(() => {
|
|
301
|
-
e &&
|
|
301
|
+
t && e && e.removeChild(t);
|
|
302
302
|
}), {
|
|
303
303
|
create: i
|
|
304
304
|
};
|
|
@@ -310,23 +310,23 @@ const je = /* @__PURE__ */ D({
|
|
|
310
310
|
itemHeight: null
|
|
311
311
|
},
|
|
312
312
|
setup(e) {
|
|
313
|
-
const t = e, { list: n, containerProps: l, wrapperProps:
|
|
313
|
+
const t = e, { list: n, containerProps: l, wrapperProps: a, innerProps: i } = Ae(
|
|
314
314
|
fe(t, "data"),
|
|
315
315
|
{
|
|
316
316
|
itemHeight: (o) => t.itemHeight(0),
|
|
317
317
|
overscan: 10
|
|
318
318
|
}
|
|
319
319
|
);
|
|
320
|
-
return (o,
|
|
320
|
+
return (o, r) => (S(), I("div", {
|
|
321
321
|
ref: y(l).ref,
|
|
322
|
-
onScrollPassive:
|
|
322
|
+
onScrollPassive: r[0] || (r[0] = (...s) => y(l).onScroll && y(l).onScroll(...s)),
|
|
323
323
|
class: "hiddenScorllBar-firefox hiddenScorllBar h-full overflow-hidden",
|
|
324
324
|
style: $(y(l).style)
|
|
325
325
|
}, [
|
|
326
|
-
x("div", H(K(y(
|
|
327
|
-
x("div", H(K(y(
|
|
328
|
-
(S(!0), I(ve, null, pe(y(n), ({ index:
|
|
329
|
-
key:
|
|
326
|
+
x("div", H(K(y(a))), [
|
|
327
|
+
x("div", H(K(y(i))), [
|
|
328
|
+
(S(!0), I(ve, null, pe(y(n), ({ index: s, data: c }) => (S(), I("div", {
|
|
329
|
+
key: s,
|
|
330
330
|
style: $({
|
|
331
331
|
height: `${e.itemHeight(c)}px`,
|
|
332
332
|
display: "flex"
|
|
@@ -334,7 +334,7 @@ const je = /* @__PURE__ */ D({
|
|
|
334
334
|
}, [
|
|
335
335
|
U(o.$slots, "default", {
|
|
336
336
|
data: c,
|
|
337
|
-
index:
|
|
337
|
+
index: s
|
|
338
338
|
}, void 0, !0)
|
|
339
339
|
], 4))), 128))
|
|
340
340
|
], 16)
|
|
@@ -344,8 +344,8 @@ const je = /* @__PURE__ */ D({
|
|
|
344
344
|
});
|
|
345
345
|
const Fe = (e, t) => {
|
|
346
346
|
const n = e.__vccOpts || e;
|
|
347
|
-
for (const [l,
|
|
348
|
-
n[l] =
|
|
347
|
+
for (const [l, a] of t)
|
|
348
|
+
n[l] = a;
|
|
349
349
|
return n;
|
|
350
350
|
}, We = /* @__PURE__ */ Fe(je, [["__scopeId", "data-v-b9b7f6cb"]]);
|
|
351
351
|
export {
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(c,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(c=typeof globalThis<"u"?globalThis:c||self,e(c.ui={},c.Vue))})(this,function(c,e){"use strict";var P;const w=typeof window<"u";w&&((P=window?.navigator)==null?void 0:P.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function D(t){return typeof t=="function"?t():e.unref(t)}function M(t){return t}function F(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function U(t,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 q=w?window:void 0;w&&window.document,w&&window.navigator,w&&window.location;function W(t,n=!1){const o=e.ref(),r=()=>o.value=Boolean(t());return r(),U(r,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 E=Object.getOwnPropertySymbols,G=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable,J=(t,n)=>{var o={};for(var r in t)G.call(t,r)&&n.indexOf(r)<0&&(o[r]=t[r]);if(t!=null&&E)for(var r of E(t))n.indexOf(r)<0&&Y.call(t,r)&&(o[r]=t[r]);return o};function X(t,n,o={}){const r=o,{window:i=q}=r,u=J(r,["window"]);let l;const a=W(()=>i&&"ResizeObserver"in i),s=()=>{l&&(l.disconnect(),l=void 0)},f=e.watch(()=>C(t),v=>{s(),a.value&&i&&v&&(l=new ResizeObserver(n),l.observe(v,u))},{immediate:!0,flush:"post"}),_=()=>{s(),f()};return F(_),{isSupported:a,stop:_}}function Z(t,n={width:0,height:0},o={}){const{box:r="content-box"}=o,i=e.ref(n.width),u=e.ref(n.height);return X(t,([l])=>{const a=r==="border-box"?l.borderBoxSize:r==="content-box"?l.contentBoxSize:l.devicePixelContentBoxSize;a?(i.value=a.reduce((s,{inlineSize:f})=>s+f,0),u.value=a.reduce((s,{blockSize:f})=>s+f,0)):(i.value=l.contentRect.width,u.value=l.contentRect.height)},o),e.watch(()=>C(t),l=>{i.value=l?n.width:0,u.value=l?n.height:0}),{width:i,height:u}}var I;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(I||(I={}));var ee=Object.defineProperty,B=Object.getOwnPropertySymbols,te=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable,T=(t,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(),r=Z(o),i=e.ref([]),u=e.ref(0),l=e.shallowRef(t),a=e.ref({start:0,end:10}),{itemHeight:s,overscan:f=5}=n,_=d=>{const{start:y=0}=a.value;let g=0,m=0;for(let b=y;b<l.value.length;b++)if(g+=s(b),g>=d){m=b;break}return m-y},v=d=>{let y=0,g=0;for(let m=0;m<l.value.length;m++)if(y+=s(m),y>=d){g=m;break}return g};let p;const h=()=>{cancelAnimationFrame(p),p=requestAnimationFrame(L)},L=()=>{const d=o.value;if(d){const y=v(d.scrollTop),g=_(d.clientHeight),m=y-f,b=y+g+f;a.value={start:m<0?0:m,end:b>l.value.length?l.value.length:b},i.value=l.value.slice(a.value.start,a.value.end).map((Q,ge)=>({data:Q,index:ge+a.value.start}))}};e.onMounted(()=>{}),e.onUnmounted(()=>{cancelAnimationFrame(p)}),e.watch([r.width,r.height,l],()=>{h()},{deep:!0});const j=e.computed(()=>typeof s=="number"?l.value.length*s:l.value.reduce((d,y,g)=>d+s(g),0)),ce=d=>typeof s=="number"?d*s:l.value.slice(0,d).reduce((g,m,b)=>g+s(b),0),ue=d=>{o.value&&(o.value.scrollTop=d,L())},de=e.computed(()=>ce(a.value.start)),fe=e.computed(()=>({style:{width:"100%",height:`${j.value}px`}})),pe=e.computed(()=>({style:{transform:`translate3d(0, ${de.value}px, 0)`,"will-change":"transform"}})),he={overflowY:"auto"};return{list:i,totalHeight:j,clientHeight:r.height,scrollTo:ue,scrollTop:u,containerProps:{ref:o,onScroll:d=>{d.target&&(u.value=d.target.scrollTop),h()},style:he},wrapperProps:fe,innerProps:pe}}const A=Symbol(),k=Symbol(),x=Symbol(),V=Symbol(),N=Symbol(),R=Symbol(),z=Symbol(),$=Symbol();function le(t,n){const o=e.ref({}),r=e.computed(()=>t.value.filter(p=>o.value[p[n]])),i=e.computed(()=>r.value.length!=0&&Object.keys(o.value).length==t.value.length);function u(){t.value.forEach(p=>{o.value[p[n]]=!0})}function l(){o.value={}}function a(p){p.forEach(h=>{o.value[h[n]]||(o.value[h[n]]=!0)})}function s(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 v(){i.value?l():u()}return e.provide(A,v),e.provide(k,_),e.provide(x,f),e.provide(V,r),e.provide(N,a),e.provide(R,s),e.provide(z,i),e.provide($,l),{selected:r,select:a,selectAll:u,unselect:s,unselectAll:l,toggle:_,toggleAll:v,isSelected:f,isAllSelected:i}}const H=Symbol(),re=e.defineComponent({__name:"Dialog",props:{visiable:{type:Boolean,default:!1},closeOnClickOverlay:{type:Boolean,default:!0}},emits:["update:show"],setup(t,{emit:n}){const o=t,r=()=>{o.closeOnClickOverlay&&n("update:show",!1)};return e.provide(H,()=>n("update:show",!1)),(i,u)=>(e.openBlock(),e.createBlock(e.Transition,{name:"modal"},{default:e.withCtx(()=>[t.visiable?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:r,class:"modal absolute inset-0 bottom-0 z-50 flex bg-stone-900 bg-opacity-50"},[e.createElementVNode("div",{onClick:u[0]||(u[0]=e.withModifiers(()=>{},["stop"])),class:"dialog m-auto flex flex-col"},[e.renderSlot(i.$slots,"default")])])):e.createCommentVNode("",!0)]),_:3}))}});function ae(){let t=null,n=null;const o=e.ref({});function r(l,a,s=!0){return o.value[l]?(o.value[l].visiable=s,!0):(o.value[l]={visiable:s,componentProps:a},!1)}function i(l){o.value[l].visiable=!1,o.value={},n&&n.childNodes.length>0&&n.childNodes.forEach(a=>{n?.removeChild(a)})}function u(l){const a=l.component.name;if(!r(a,l.componentProps||{})){const s={setup(){return()=>e.h(re,{visiable:o.value[a].visiable,"onUpdate:show":()=>{i(a)}},{default:()=>e.h(l.component,o.value[a].componentProps)})}};t||(t=document.body.querySelector("#app")||document.body),n||(n=document.createElement("div"),n.setAttribute("id","dialog"),t.appendChild(n)),e.render(e.createVNode(s),n)}return{close:()=>i(a)}}return e.onUnmounted(()=>{n&&t&&t.removeChild(n)}),{create:u}}const se=e.defineComponent({__name:"VirtualList",props:{data:null,itemHeight:null},setup(t){const n=t,{list:o,containerProps:r,wrapperProps:i,innerProps:u}=K(e.toRef(n,"data"),{itemHeight:l=>n.itemHeight(0),overscan:10});return(l,a)=>(e.openBlock(),e.createElementBlock("div",{ref:e.unref(r).ref,onScrollPassive:a[0]||(a[0]=(...s)=>e.unref(r).onScroll&&e.unref(r).onScroll(...s)),class:"hiddenScorllBar-firefox hiddenScorllBar h-full overflow-hidden",style:e.normalizeStyle(e.unref(r).style)},[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(i))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(u))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(o),({index:s,data:f})=>(e.openBlock(),e.createElementBlock("div",{key:s,style:e.normalizeStyle({height:`${t.itemHeight(f)}px`,display:"flex"})},[e.renderSlot(l.$slots,"default",{data:f,index:s},void 0,!0)],4))),128))],16)],16)],36))}}),ye="",ie=((t,n)=>{const o=t.__vccOpts||t;for(const[r,i]of n)o[r]=i;return o})(se,[["__scopeId","data-v-b9b7f6cb"]]);c.DialogController=ae,c.VirtualList=ie,c.allSelectedKey=V,c.closeDialogKey=H,c.isAllSelectedKey=z,c.isSelectedKey=x,c.selectKey=N,c.toggleAllKey=A,c.toggleKey=k,c.unselectAllKey=$,c.unselectKey=R,c.useSelectable=le,c.useVirtualList=K,Object.defineProperties(c,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lazycatcloud/lzc-toolkit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "lazycat ui toolkits",
|
|
5
5
|
"main": "./dist/index.umd.js",
|
|
6
6
|
"module": "./dist/index.es.js",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"@vueuse/core": "^9.2.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
+
"@types/node": "^18.11.9",
|
|
28
29
|
"@vitejs/plugin-vue": "^3.1.0",
|
|
29
30
|
"typescript": "^4.8.3",
|
|
30
31
|
"vite": "^3.1.1",
|