@lazycatcloud/lzc-toolkit 0.0.1

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.
@@ -0,0 +1,286 @@
1
+ import { unref as _, getCurrentScope as Y, onScopeDispose as J, getCurrentInstance as X, onMounted as V, nextTick as Z, ref as w, watch as T, shallowRef as ee, onUnmounted as te, computed as O, provide as m, defineComponent as ne, toRef as oe, openBlock as I, createElementBlock as P, normalizeStyle as B, createElementVNode as H, normalizeProps as K, guardReactiveProps as Q, Fragment as re, renderList as le, renderSlot as se } from "vue";
2
+ var $;
3
+ const S = typeof window < "u";
4
+ S && (($ = window?.navigator) == null ? void 0 : $.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
5
+ function ae(e) {
6
+ return typeof e == "function" ? e() : _(e);
7
+ }
8
+ function ie(e) {
9
+ return e;
10
+ }
11
+ function ue(e) {
12
+ return Y() ? (J(e), !0) : !1;
13
+ }
14
+ function ce(e, n = !0) {
15
+ X() ? V(e) : n ? e() : Z(e);
16
+ }
17
+ function F(e) {
18
+ var n;
19
+ const t = ae(e);
20
+ return (n = t?.$el) != null ? n : t;
21
+ }
22
+ const fe = S ? window : void 0;
23
+ S && window.document;
24
+ S && window.navigator;
25
+ S && window.location;
26
+ function de(e, n = !1) {
27
+ const t = w(), o = () => t.value = Boolean(e());
28
+ return o(), ce(o, n), t;
29
+ }
30
+ const x = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, E = "__vueuse_ssr_handlers__";
31
+ x[E] = x[E] || {};
32
+ x[E];
33
+ var z = Object.getOwnPropertySymbols, ve = Object.prototype.hasOwnProperty, pe = Object.prototype.propertyIsEnumerable, he = (e, n) => {
34
+ var t = {};
35
+ for (var o in e)
36
+ ve.call(e, o) && n.indexOf(o) < 0 && (t[o] = e[o]);
37
+ if (e != null && z)
38
+ for (var o of z(e))
39
+ n.indexOf(o) < 0 && pe.call(e, o) && (t[o] = e[o]);
40
+ return t;
41
+ };
42
+ function ge(e, n, t = {}) {
43
+ const o = t, { window: s = fe } = o, f = he(o, ["window"]);
44
+ let r;
45
+ const a = de(() => s && "ResizeObserver" in s), l = () => {
46
+ r && (r.disconnect(), r = void 0);
47
+ }, u = T(() => F(e), (b) => {
48
+ l(), a.value && s && b && (r = new ResizeObserver(n), r.observe(b, f));
49
+ }, { immediate: !0, flush: "post" }), y = () => {
50
+ l(), u();
51
+ };
52
+ return ue(y), {
53
+ isSupported: a,
54
+ stop: y
55
+ };
56
+ }
57
+ function me(e, n = { width: 0, height: 0 }, t = {}) {
58
+ const { box: o = "content-box" } = t, s = w(n.width), f = w(n.height);
59
+ return ge(e, ([r]) => {
60
+ const a = o === "border-box" ? r.borderBoxSize : o === "content-box" ? r.contentBoxSize : r.devicePixelContentBoxSize;
61
+ a ? (s.value = a.reduce((l, { inlineSize: u }) => l + u, 0), f.value = a.reduce((l, { blockSize: u }) => l + u, 0)) : (s.value = r.contentRect.width, f.value = r.contentRect.height);
62
+ }, t), T(() => F(e), (r) => {
63
+ s.value = r ? n.width : 0, f.value = r ? n.height : 0;
64
+ }), {
65
+ width: s,
66
+ height: f
67
+ };
68
+ }
69
+ var L;
70
+ (function(e) {
71
+ e.UP = "UP", e.RIGHT = "RIGHT", e.DOWN = "DOWN", e.LEFT = "LEFT", e.NONE = "NONE";
72
+ })(L || (L = {}));
73
+ var _e = Object.defineProperty, N = Object.getOwnPropertySymbols, we = Object.prototype.hasOwnProperty, ye = Object.prototype.propertyIsEnumerable, j = (e, n, t) => n in e ? _e(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t, be = (e, n) => {
74
+ for (var t in n || (n = {}))
75
+ we.call(n, t) && j(e, t, n[t]);
76
+ if (N)
77
+ for (var t of N(n))
78
+ ye.call(n, t) && j(e, t, n[t]);
79
+ return e;
80
+ };
81
+ const Oe = {
82
+ easeInSine: [0.12, 0, 0.39, 0],
83
+ easeOutSine: [0.61, 1, 0.88, 1],
84
+ easeInOutSine: [0.37, 0, 0.63, 1],
85
+ easeInQuad: [0.11, 0, 0.5, 0],
86
+ easeOutQuad: [0.5, 1, 0.89, 1],
87
+ easeInOutQuad: [0.45, 0, 0.55, 1],
88
+ easeInCubic: [0.32, 0, 0.67, 0],
89
+ easeOutCubic: [0.33, 1, 0.68, 1],
90
+ easeInOutCubic: [0.65, 0, 0.35, 1],
91
+ easeInQuart: [0.5, 0, 0.75, 0],
92
+ easeOutQuart: [0.25, 1, 0.5, 1],
93
+ easeInOutQuart: [0.76, 0, 0.24, 1],
94
+ easeInQuint: [0.64, 0, 0.78, 0],
95
+ easeOutQuint: [0.22, 1, 0.36, 1],
96
+ easeInOutQuint: [0.83, 0, 0.17, 1],
97
+ easeInExpo: [0.7, 0, 0.84, 0],
98
+ easeOutExpo: [0.16, 1, 0.3, 1],
99
+ easeInOutExpo: [0.87, 0, 0.13, 1],
100
+ easeInCirc: [0.55, 0, 1, 0.45],
101
+ easeOutCirc: [0, 0.55, 0.45, 1],
102
+ easeInOutCirc: [0.85, 0, 0.15, 1],
103
+ easeInBack: [0.36, 0, 0.66, -0.56],
104
+ easeOutBack: [0.34, 1.56, 0.64, 1],
105
+ easeInOutBack: [0.68, -0.6, 0.32, 1.6]
106
+ };
107
+ be({
108
+ linear: ie
109
+ }, Oe);
110
+ function Se(e, n) {
111
+ const t = w(), o = me(t), s = w([]), f = w(0), r = ee(e), a = w({ start: 0, end: 10 }), { itemHeight: l, overscan: u = 5 } = n, y = (i) => {
112
+ const { start: h = 0 } = a.value;
113
+ let v = 0, p = 0;
114
+ for (let g = h; g < r.value.length; g++)
115
+ if (v += l(g), v >= i) {
116
+ p = g;
117
+ break;
118
+ }
119
+ return p - h;
120
+ }, b = (i) => {
121
+ let h = 0, v = 0;
122
+ for (let p = 0; p < r.value.length; p++)
123
+ if (h += l(p), h >= i) {
124
+ v = p;
125
+ break;
126
+ }
127
+ return v;
128
+ };
129
+ let c;
130
+ const d = () => {
131
+ cancelAnimationFrame(c), c = requestAnimationFrame(C);
132
+ }, C = () => {
133
+ const i = t.value;
134
+ if (i) {
135
+ const h = b(i.scrollTop), v = y(i.clientHeight), p = h - u, g = h + v + u;
136
+ a.value = {
137
+ start: p < 0 ? 0 : p,
138
+ end: g > r.value.length ? r.value.length : g
139
+ }, s.value = r.value.slice(a.value.start, a.value.end).map((A, k) => ({
140
+ data: A,
141
+ index: k + a.value.start
142
+ }));
143
+ }
144
+ };
145
+ V(() => {
146
+ }), te(() => {
147
+ cancelAnimationFrame(c);
148
+ }), T(
149
+ [o.width, o.height, r],
150
+ () => {
151
+ d();
152
+ },
153
+ { deep: !0 }
154
+ );
155
+ const R = O(() => typeof l == "number" ? r.value.length * l : r.value.reduce((i, h, v) => i + l(v), 0)), U = (i) => typeof l == "number" ? i * l : r.value.slice(0, i).reduce((v, p, g) => v + l(g), 0), W = (i) => {
156
+ t.value && (t.value.scrollTop = i, C());
157
+ }, D = O(() => U(a.value.start)), q = O(() => ({
158
+ style: {
159
+ width: "100%",
160
+ height: `${R.value}px`
161
+ }
162
+ })), G = O(() => ({
163
+ style: {
164
+ transform: `translate3d(0, ${D.value}px, 0)`,
165
+ "will-change": "transform"
166
+ }
167
+ })), M = { overflowY: "auto" };
168
+ return {
169
+ list: s,
170
+ totalHeight: R,
171
+ clientHeight: o.height,
172
+ scrollTo: W,
173
+ scrollTop: f,
174
+ containerProps: {
175
+ ref: t,
176
+ onScroll: (i) => {
177
+ i.target && (f.value = i.target.scrollTop), d();
178
+ },
179
+ style: M
180
+ },
181
+ wrapperProps: q,
182
+ innerProps: G
183
+ };
184
+ }
185
+ const Ie = Symbol(), Pe = Symbol(), xe = Symbol(), Ee = Symbol(), Te = Symbol(), Ce = Symbol(), Re = Symbol(), Ae = Symbol();
186
+ function Qe(e, n) {
187
+ const t = w({}), o = O(() => e.value.filter((c) => t.value[c[n]])), s = O(() => Object.keys(t.value).length == e.value.length);
188
+ function f() {
189
+ e.value.forEach((c) => {
190
+ t.value[c[n]] = !0;
191
+ });
192
+ }
193
+ function r() {
194
+ t.value = {};
195
+ }
196
+ function a(c) {
197
+ c.forEach((d) => {
198
+ t.value[d[n]] || (t.value[d[n]] = !0);
199
+ });
200
+ }
201
+ function l(c) {
202
+ c.forEach((d) => {
203
+ t.value[d[n]] && delete t.value[d[n]];
204
+ });
205
+ }
206
+ function u(c) {
207
+ return !!t.value[c[n]];
208
+ }
209
+ function y(c) {
210
+ c.forEach((d) => {
211
+ u(d) ? delete t.value[d[n]] : t.value[d[n]] = !0;
212
+ });
213
+ }
214
+ function b() {
215
+ s.value ? r() : f();
216
+ }
217
+ return m(Ie, b), m(Pe, y), m(xe, u), m(Ee, o), m(Te, a), m(Ce, l), m(Re, s), m(Ae, r), {
218
+ selected: o,
219
+ select: a,
220
+ selectAll: f,
221
+ unselect: l,
222
+ unselectAll: r,
223
+ toggle: y,
224
+ toggleAll: b,
225
+ isSelected: u,
226
+ isAllSelected: s
227
+ };
228
+ }
229
+ const $e = Symbol(), Be = /* @__PURE__ */ ne({
230
+ __name: "VirtualList",
231
+ props: {
232
+ data: null,
233
+ itemHeight: null
234
+ },
235
+ setup(e) {
236
+ const n = e, { list: t, containerProps: o, wrapperProps: s, innerProps: f } = Se(
237
+ oe(n, "data"),
238
+ {
239
+ itemHeight: (r) => n.itemHeight(0),
240
+ overscan: 10
241
+ }
242
+ );
243
+ return (r, a) => (I(), P("div", {
244
+ ref: _(o).ref,
245
+ onScrollPassive: a[0] || (a[0] = (...l) => _(o).onScroll && _(o).onScroll(...l)),
246
+ class: "hiddenScorllBar-firefox hiddenScorllBar h-full overflow-hidden",
247
+ style: B(_(o).style)
248
+ }, [
249
+ H("div", K(Q(_(s))), [
250
+ H("div", K(Q(_(f))), [
251
+ (I(!0), P(re, null, le(_(t), ({ index: l, data: u }) => (I(), P("div", {
252
+ key: l,
253
+ style: B({
254
+ height: `${e.itemHeight(u)}px`
255
+ })
256
+ }, [
257
+ se(r.$slots, "default", {
258
+ data: u,
259
+ index: l
260
+ }, void 0, !0)
261
+ ], 4))), 128))
262
+ ], 16)
263
+ ], 16)
264
+ ], 36));
265
+ }
266
+ });
267
+ const He = (e, n) => {
268
+ const t = e.__vccOpts || e;
269
+ for (const [o, s] of n)
270
+ t[o] = s;
271
+ return t;
272
+ }, ze = /* @__PURE__ */ He(Be, [["__scopeId", "data-v-c990a04d"]]);
273
+ export {
274
+ ze as VirtualList,
275
+ Ee as allSelectedKey,
276
+ $e as closeDialogKey,
277
+ Re as isAllSelectedKey,
278
+ xe as isSelectedKey,
279
+ Te as selectKey,
280
+ Ie as toggleAllKey,
281
+ Pe as toggleKey,
282
+ Ae as unselectAllKey,
283
+ Ce as unselectKey,
284
+ Qe as useSelectable,
285
+ Se as useVirtualList
286
+ };
@@ -0,0 +1 @@
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 b=typeof window<"u";b&&((P=window?.navigator)==null?void 0:P.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function F(t){return typeof t=="function"?t():e.unref(t)}function k(t){return t}function M(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function D(t,o=!0){e.getCurrentInstance()?e.onMounted(t):o?t():e.nextTick(t)}function I(t){var o;const n=F(t);return(o=n?.$el)!=null?o:n}const U=b?window:void 0;b&&window.document,b&&window.navigator,b&&window.location;function W(t,o=!1){const n=e.ref(),l=()=>n.value=Boolean(t());return l(),D(l,o),n}const O=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},S="__vueuse_ssr_handlers__";O[S]=O[S]||{},O[S];var E=Object.getOwnPropertySymbols,q=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable,Y=(t,o)=>{var n={};for(var l in t)q.call(t,l)&&o.indexOf(l)<0&&(n[l]=t[l]);if(t!=null&&E)for(var l of E(t))o.indexOf(l)<0&&G.call(t,l)&&(n[l]=t[l]);return n};function J(t,o,n={}){const l=n,{window:i=U}=l,p=Y(l,["window"]);let r;const a=W(()=>i&&"ResizeObserver"in i),s=()=>{r&&(r.disconnect(),r=void 0)},d=e.watch(()=>I(t),w=>{s(),a.value&&i&&w&&(r=new ResizeObserver(o),r.observe(w,p))},{immediate:!0,flush:"post"}),v=()=>{s(),d()};return M(v),{isSupported:a,stop:v}}function X(t,o={width:0,height:0},n={}){const{box:l="content-box"}=n,i=e.ref(o.width),p=e.ref(o.height);return J(t,([r])=>{const a=l==="border-box"?r.borderBoxSize:l==="content-box"?r.contentBoxSize:r.devicePixelContentBoxSize;a?(i.value=a.reduce((s,{inlineSize:d})=>s+d,0),p.value=a.reduce((s,{blockSize:d})=>s+d,0)):(i.value=r.contentRect.width,p.value=r.contentRect.height)},n),e.watch(()=>I(t),r=>{i.value=r?o.width:0,p.value=r?o.height:0}),{width:i,height:p}}var K;(function(t){t.UP="UP",t.RIGHT="RIGHT",t.DOWN="DOWN",t.LEFT="LEFT",t.NONE="NONE"})(K||(K={}));var Z=Object.defineProperty,T=Object.getOwnPropertySymbols,ee=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable,A=(t,o,n)=>o in t?Z(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n,ne=(t,o)=>{for(var n in o||(o={}))ee.call(o,n)&&A(t,n,o[n]);if(T)for(var n of T(o))te.call(o,n)&&A(t,n,o[n]);return t};ne({linear:k},{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 B(t,o){const n=e.ref(),l=X(n),i=e.ref([]),p=e.ref(0),r=e.shallowRef(t),a=e.ref({start:0,end:10}),{itemHeight:s,overscan:d=5}=o,v=u=>{const{start:y=0}=a.value;let g=0,m=0;for(let _=y;_<r.value.length;_++)if(g+=s(_),g>=u){m=_;break}return m-y},w=u=>{let y=0,g=0;for(let m=0;m<r.value.length;m++)if(y+=s(m),y>=u){g=m;break}return g};let f;const h=()=>{cancelAnimationFrame(f),f=requestAnimationFrame(N)},N=()=>{const u=n.value;if(u){const y=w(u.scrollTop),g=v(u.clientHeight),m=y-d,_=y+g+d;a.value={start:m<0?0:m,end:_>r.value.length?r.value.length:_},i.value=r.value.slice(a.value.start,a.value.end).map(($,pe)=>({data:$,index:pe+a.value.start}))}};e.onMounted(()=>{}),e.onUnmounted(()=>{cancelAnimationFrame(f)}),e.watch([l.width,l.height,r],()=>{h()},{deep:!0});const Q=e.computed(()=>typeof s=="number"?r.value.length*s:r.value.reduce((u,y,g)=>u+s(g),0)),ie=u=>typeof s=="number"?u*s:r.value.slice(0,u).reduce((g,m,_)=>g+s(_),0),ae=u=>{n.value&&(n.value.scrollTop=u,N())},ce=e.computed(()=>ie(a.value.start)),ue=e.computed(()=>({style:{width:"100%",height:`${Q.value}px`}})),de=e.computed(()=>({style:{transform:`translate3d(0, ${ce.value}px, 0)`,"will-change":"transform"}})),fe={overflowY:"auto"};return{list:i,totalHeight:Q,clientHeight:l.height,scrollTo:ae,scrollTop:p,containerProps:{ref:n,onScroll:u=>{u.target&&(p.value=u.target.scrollTop),h()},style:fe},wrapperProps:ue,innerProps:de}}const R=Symbol(),C=Symbol(),x=Symbol(),V=Symbol(),z=Symbol(),H=Symbol(),L=Symbol(),j=Symbol();function oe(t,o){const n=e.ref({}),l=e.computed(()=>t.value.filter(f=>n.value[f[o]])),i=e.computed(()=>Object.keys(n.value).length==t.value.length);function p(){t.value.forEach(f=>{n.value[f[o]]=!0})}function r(){n.value={}}function a(f){f.forEach(h=>{n.value[h[o]]||(n.value[h[o]]=!0)})}function s(f){f.forEach(h=>{n.value[h[o]]&&delete n.value[h[o]]})}function d(f){return!!n.value[f[o]]}function v(f){f.forEach(h=>{d(h)?delete n.value[h[o]]:n.value[h[o]]=!0})}function w(){i.value?r():p()}return e.provide(R,w),e.provide(C,v),e.provide(x,d),e.provide(V,l),e.provide(z,a),e.provide(H,s),e.provide(L,i),e.provide(j,r),{selected:l,select:a,selectAll:p,unselect:s,unselectAll:r,toggle:v,toggleAll:w,isSelected:d,isAllSelected:i}}const le=Symbol(),re=e.defineComponent({__name:"VirtualList",props:{data:null,itemHeight:null},setup(t){const o=t,{list:n,containerProps:l,wrapperProps:i,innerProps:p}=B(e.toRef(o,"data"),{itemHeight:r=>o.itemHeight(0),overscan:10});return(r,a)=>(e.openBlock(),e.createElementBlock("div",{ref:e.unref(l).ref,onScrollPassive:a[0]||(a[0]=(...s)=>e.unref(l).onScroll&&e.unref(l).onScroll(...s)),class:"hiddenScorllBar-firefox hiddenScorllBar h-full overflow-hidden",style:e.normalizeStyle(e.unref(l).style)},[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(i))),[e.createElementVNode("div",e.normalizeProps(e.guardReactiveProps(e.unref(p))),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),({index:s,data:d})=>(e.openBlock(),e.createElementBlock("div",{key:s,style:e.normalizeStyle({height:`${t.itemHeight(d)}px`})},[e.renderSlot(r.$slots,"default",{data:d,index:s},void 0,!0)],4))),128))],16)],16)],36))}}),ge="",se=((t,o)=>{const n=t.__vccOpts||t;for(const[l,i]of o)n[l]=i;return n})(re,[["__scopeId","data-v-c990a04d"]]);c.VirtualList=se,c.allSelectedKey=V,c.closeDialogKey=le,c.isAllSelectedKey=L,c.isSelectedKey=x,c.selectKey=z,c.toggleAllKey=R,c.toggleKey=C,c.unselectAllKey=j,c.unselectKey=H,c.useSelectable=oe,c.useVirtualList=B,Object.defineProperties(c,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ .hiddenScorllBar[data-v-c990a04d]::-webkit-scrollbar{display:none}.hiddenScorllBar-firefox[data-v-c990a04d]{-ms-overflow-style:none;scrollbar-width:none}.h-full[data-v-c990a04d]{height:100%}.overflow-hidden[data-v-c990a04d]{overflow:hidden}
@@ -0,0 +1,95 @@
1
+ export interface DialogProps {
2
+ visiable?: boolean;
3
+ closeOnClickOverlay?: boolean;
4
+ }
5
+ declare const _default: {
6
+ new (...args: any[]): {
7
+ $: import("vue").ComponentInternalInstance;
8
+ $data: {};
9
+ $props: Partial<{
10
+ visiable: boolean;
11
+ closeOnClickOverlay: boolean;
12
+ }> & Omit<Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<DialogProps>, {
13
+ visiable: boolean;
14
+ closeOnClickOverlay: boolean;
15
+ }>>> & {
16
+ "onUpdate:show"?: ((...args: any[]) => any) | undefined;
17
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "visiable" | "closeOnClickOverlay">;
18
+ $attrs: {
19
+ [x: string]: unknown;
20
+ };
21
+ $refs: {
22
+ [x: string]: unknown;
23
+ };
24
+ $slots: Readonly<{
25
+ [name: string]: import("vue").Slot | undefined;
26
+ }>;
27
+ $root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
28
+ $parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
29
+ $emit: (event: "update:show", ...args: any[]) => void;
30
+ $el: any;
31
+ $options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<DialogProps>, {
32
+ visiable: boolean;
33
+ closeOnClickOverlay: boolean;
34
+ }>>> & {
35
+ "onUpdate:show"?: ((...args: any[]) => any) | undefined;
36
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:show"[], string, {
37
+ visiable: boolean;
38
+ closeOnClickOverlay: boolean;
39
+ }> & {
40
+ beforeCreate?: ((() => void) | (() => void)[]) | undefined;
41
+ created?: ((() => void) | (() => void)[]) | undefined;
42
+ beforeMount?: ((() => void) | (() => void)[]) | undefined;
43
+ mounted?: ((() => void) | (() => void)[]) | undefined;
44
+ beforeUpdate?: ((() => void) | (() => void)[]) | undefined;
45
+ updated?: ((() => void) | (() => void)[]) | undefined;
46
+ activated?: ((() => void) | (() => void)[]) | undefined;
47
+ deactivated?: ((() => void) | (() => void)[]) | undefined;
48
+ beforeDestroy?: ((() => void) | (() => void)[]) | undefined;
49
+ beforeUnmount?: ((() => void) | (() => void)[]) | undefined;
50
+ destroyed?: ((() => void) | (() => void)[]) | undefined;
51
+ unmounted?: ((() => void) | (() => void)[]) | undefined;
52
+ renderTracked?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
53
+ renderTriggered?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
54
+ errorCaptured?: (((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void)[]) | undefined;
55
+ };
56
+ $forceUpdate: () => void;
57
+ $nextTick: typeof import("vue").nextTick;
58
+ $watch(source: string | Function, cb: Function, options?: import("vue").WatchOptions<boolean> | undefined): import("vue").WatchStopHandle;
59
+ } & Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<DialogProps>, {
60
+ visiable: boolean;
61
+ closeOnClickOverlay: boolean;
62
+ }>>> & {
63
+ "onUpdate:show"?: ((...args: any[]) => any) | undefined;
64
+ } & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties;
65
+ __isFragment?: undefined;
66
+ __isTeleport?: undefined;
67
+ __isSuspense?: undefined;
68
+ } & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<DialogProps>, {
69
+ visiable: boolean;
70
+ closeOnClickOverlay: boolean;
71
+ }>>> & {
72
+ "onUpdate:show"?: ((...args: any[]) => any) | undefined;
73
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:show"[], "update:show", {
74
+ visiable: boolean;
75
+ closeOnClickOverlay: boolean;
76
+ }> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
77
+ $slots: {
78
+ default: (_: {}) => any;
79
+ };
80
+ });
81
+ export default _default;
82
+ declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
83
+ declare type __VLS_TypePropsToRuntimeProps<T> = {
84
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
85
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
86
+ } : {
87
+ type: import('vue').PropType<T[K]>;
88
+ required: true;
89
+ };
90
+ };
91
+ declare type __VLS_WithDefaults<P, D> = {
92
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
93
+ default: D[K];
94
+ } : P[K];
95
+ };
@@ -0,0 +1,18 @@
1
+ import { type Component } from "vue";
2
+ export * from "./keys";
3
+ export interface DialogControllerOptions {
4
+ component: Component;
5
+ componentProps?: string[] | object;
6
+ }
7
+ export interface DialogOptions {
8
+ visiable?: boolean;
9
+ componentProps?: string[] | object;
10
+ }
11
+ export declare type DialogOptionsMap = {
12
+ [id: string]: DialogOptions;
13
+ };
14
+ export default function dialogController(): {
15
+ create: (options: DialogControllerOptions) => {
16
+ close: () => boolean;
17
+ };
18
+ };
@@ -0,0 +1,2 @@
1
+ import type { InjectionKey } from "vue";
2
+ export declare const closeDialogKey: InjectionKey<() => void>;
@@ -0,0 +1,4 @@
1
+ export * from "./useVirtualList";
2
+ export * from "./useSelectable";
3
+ export * from "./dialog";
4
+ export { default as VirtualList } from "./useVirtualList/VirtualList.vue";
@@ -0,0 +1,13 @@
1
+ import { type ComputedRef, type Ref } from "vue";
2
+ export * from "./keys";
3
+ export declare function useSelectable<T extends Record<K, string | number>, K extends keyof T>(data: Ref<Array<T>>, key: K): {
4
+ selected: ComputedRef<T[]>;
5
+ select: (items: Array<T>) => void;
6
+ selectAll: () => void;
7
+ unselect: (items: Array<T>) => void;
8
+ unselectAll: () => void;
9
+ toggle: (items: Array<T>) => void;
10
+ toggleAll: () => void;
11
+ isSelected: (item: T) => boolean;
12
+ isAllSelected: ComputedRef<boolean>;
13
+ };
@@ -0,0 +1,9 @@
1
+ import type { InjectionKey, ComputedRef } from "vue";
2
+ export declare const toggleAllKey: InjectionKey<() => void>;
3
+ export declare const toggleKey: InjectionKey<(a: Array<any>) => void>;
4
+ export declare const isSelectedKey: InjectionKey<(a: any) => boolean>;
5
+ export declare const allSelectedKey: InjectionKey<ComputedRef<any[]>>;
6
+ export declare const selectKey: InjectionKey<(a: any) => void>;
7
+ export declare const unselectKey: InjectionKey<(a: any) => void>;
8
+ export declare const isAllSelectedKey: InjectionKey<ComputedRef<boolean>>;
9
+ export declare const unselectAllKey: InjectionKey<() => void>;
@@ -0,0 +1,72 @@
1
+ declare const _default: {
2
+ new (...args: any[]): {
3
+ $: import("vue").ComponentInternalInstance;
4
+ $data: {};
5
+ $props: Partial<{}> & Omit<Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
6
+ data: any;
7
+ itemHeight: (a: number) => number;
8
+ }>>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>;
9
+ $attrs: {
10
+ [x: string]: unknown;
11
+ };
12
+ $refs: {
13
+ [x: string]: unknown;
14
+ };
15
+ $slots: Readonly<{
16
+ [name: string]: import("vue").Slot | undefined;
17
+ }>;
18
+ $root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
19
+ $parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
20
+ $emit: (event: string, ...args: any[]) => void;
21
+ $el: any;
22
+ $options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
23
+ data: any;
24
+ itemHeight: (a: number) => number;
25
+ }>>>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}> & {
26
+ beforeCreate?: ((() => void) | (() => void)[]) | undefined;
27
+ created?: ((() => void) | (() => void)[]) | undefined;
28
+ beforeMount?: ((() => void) | (() => void)[]) | undefined;
29
+ mounted?: ((() => void) | (() => void)[]) | undefined;
30
+ beforeUpdate?: ((() => void) | (() => void)[]) | undefined;
31
+ updated?: ((() => void) | (() => void)[]) | undefined;
32
+ activated?: ((() => void) | (() => void)[]) | undefined;
33
+ deactivated?: ((() => void) | (() => void)[]) | undefined;
34
+ beforeDestroy?: ((() => void) | (() => void)[]) | undefined;
35
+ beforeUnmount?: ((() => void) | (() => void)[]) | undefined;
36
+ destroyed?: ((() => void) | (() => void)[]) | undefined;
37
+ unmounted?: ((() => void) | (() => void)[]) | undefined;
38
+ renderTracked?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
39
+ renderTriggered?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
40
+ errorCaptured?: (((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void)[]) | undefined;
41
+ };
42
+ $forceUpdate: () => void;
43
+ $nextTick: typeof import("vue").nextTick;
44
+ $watch(source: string | Function, cb: Function, options?: import("vue").WatchOptions<boolean> | undefined): import("vue").WatchStopHandle;
45
+ } & Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
46
+ data: any;
47
+ itemHeight: (a: number) => number;
48
+ }>>> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties;
49
+ __isFragment?: undefined;
50
+ __isTeleport?: undefined;
51
+ __isSuspense?: undefined;
52
+ } & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
53
+ data: any;
54
+ itemHeight: (a: number) => number;
55
+ }>>>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
56
+ $slots: {
57
+ default: (_: {
58
+ data: any;
59
+ index: number;
60
+ }) => any;
61
+ };
62
+ });
63
+ export default _default;
64
+ declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
65
+ declare type __VLS_TypePropsToRuntimeProps<T> = {
66
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
67
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
68
+ } : {
69
+ type: import('vue').PropType<T[K]>;
70
+ required: true;
71
+ };
72
+ };
@@ -0,0 +1,44 @@
1
+ import { type ComputedRef, type Ref, type StyleValue } from "vue";
2
+ export interface UseVirtualListOptions {
3
+ /**
4
+ * item height, accept a pixel value or a function that returns the height
5
+ *
6
+ * @default 0
7
+ */
8
+ itemHeight: number | ((index: number) => number);
9
+ /**
10
+ * the extra buffer items outside of the view area
11
+ *
12
+ * @default 5
13
+ */
14
+ overscan?: number;
15
+ }
16
+ export interface UseVirtualListItem<T> {
17
+ data: T;
18
+ index: number;
19
+ }
20
+ export interface UseVirtualListReturn<T> {
21
+ list: Ref<UseVirtualListItem<T>[]>;
22
+ scrollTo: (index: number) => void;
23
+ totalHeight: Ref<number>;
24
+ clientHeight: Ref<number>;
25
+ scrollTop: Ref<number>;
26
+ containerProps: {
27
+ ref: Ref<HTMLElement | null>;
28
+ onScroll: (e: Event) => void;
29
+ style: StyleValue;
30
+ };
31
+ wrapperProps: ComputedRef<{
32
+ style: {
33
+ width: string;
34
+ height: string;
35
+ };
36
+ }>;
37
+ innerProps: ComputedRef<{
38
+ style: {
39
+ transform: string;
40
+ "will-change": string;
41
+ };
42
+ }>;
43
+ }
44
+ export declare function useVirtualList<T = any>(list: Ref<T[]>, options: UseVirtualListOptions): UseVirtualListReturn<T>;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vite").UserConfigExport;
2
+ export default _default;
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@lazycatcloud/lzc-toolkit",
3
+ "version": "0.0.1",
4
+ "description": "lazycat ui toolkits",
5
+ "main": "./dist/index.umd.js",
6
+ "module": "./dist/index.es.js",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "directories": {
11
+ "test": "test"
12
+ },
13
+ "types": "./dist/types/index.d.ts",
14
+ "scripts": {
15
+ "dev": "vite",
16
+ "build": "vite build && vue-tsc --emitDeclarationOnly && mv dist/src dist/types",
17
+ "test": "echo \"Error: no test specified\" && exit 1",
18
+ "typecheck": "vue-tsc --noEmit"
19
+ },
20
+ "author": "",
21
+ "license": "ISC",
22
+ "dependencies": {
23
+ "@vueuse/core": "^9.2.0"
24
+ },
25
+ "devDependencies": {
26
+ "@vitejs/plugin-vue": "^3.1.0",
27
+ "typescript": "^4.8.3",
28
+ "vite": "^3.1.1",
29
+ "vue": "^3.2.39",
30
+ "vue-tsc": "^0.40.13"
31
+ }
32
+ }